@progress/kendo-dropdowns-react-wrapper
Version:
Kendo UI DropDowns wrapper for React
475 lines (449 loc) • 18.8 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["KendoDropdownsReactWrapper"] = factory(require("react"));
else
root["KendoDropdownsReactWrapper"] = factory(root["React"]);
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/// <reference types="@progress/kendo-ui" />
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(0);
var KendoBaseComponent = /** @class */ (function (_super) {
__extends(KendoBaseComponent, _super);
function KendoBaseComponent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.didMount = false;
_this.elementRef = function (el) {
_this.domNode = el;
};
_this.exposeWidget = function () {
if (_this.props.widgetRef && typeof _this.props.widgetRef === 'function') {
_this.props.widgetRef(_this.widgetInstance);
}
};
_this.overrideDestroy = function () {
_this.widgetDestroy = _this.widgetInstance.destroy;
_this.widgetInstance.destroy = function () {
_this.destroyed = !_this.destroyed;
_this.widgetDestroy.call(_this.widgetInstance);
};
};
return _this;
}
KendoBaseComponent.prototype.componentDidMount = function () {
this.exposeWidget();
this.overrideDestroy();
this.didMount = true;
};
KendoBaseComponent.prototype.componentWillUnmount = function () {
if (!this.destroyed) {
this.widgetDestroy.call(this.widgetInstance);
}
this.exposeWidget();
};
return KendoBaseComponent;
}(React.PureComponent));
exports.default = KendoBaseComponent;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var autocomplete_1 = __webpack_require__(3);
exports.AutoComplete = autocomplete_1.default;
var combobox_1 = __webpack_require__(4);
exports.ComboBox = combobox_1.default;
var dropdownlist_1 = __webpack_require__(5);
exports.DropDownList = dropdownlist_1.default;
var multiselect_1 = __webpack_require__(6);
exports.MultiSelect = multiselect_1.default;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(0);
var kendo_base_component_react_wrapper_1 = __webpack_require__(1);
var AutoComplete = /** @class */ (function (_super) {
__extends(AutoComplete, _super);
function AutoComplete() {
return _super !== null && _super.apply(this, arguments) || this;
}
AutoComplete.prototype.componentDidMount = function () {
var domNode = this.domNode;
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
if (domNode) {
this.widgetInstance =
new kendo.ui.AutoComplete(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
AutoComplete.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, dataSource = _a.dataSource, props = __rest(_a, ["children", "widgetRef", "dataSource"]);
this.widgetInstance.setOptions(props);
var widget = this.widgetInstance;
if (widget.options.dataSource !== dataSource) {
widget.setDataSource(dataSource);
}
widget.value(this.props.value);
}
var domChild = React.Children
.toArray(this.props.children)
.filter(function (child) { return child && (child.type === 'input'); })
.shift();
return domChild
? React.cloneElement(domChild, __assign({}, domChild.props, { ref: this.elementRef }))
: React.createElement("input", { ref: this.elementRef });
};
return AutoComplete;
}(kendo_base_component_react_wrapper_1.default));
exports.default = AutoComplete;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(0);
var kendo_base_component_react_wrapper_1 = __webpack_require__(1);
var ComboBox = /** @class */ (function (_super) {
__extends(ComboBox, _super);
function ComboBox() {
return _super !== null && _super.apply(this, arguments) || this;
}
ComboBox.prototype.componentDidMount = function () {
var domNode = this.domNode;
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
if (domNode) {
this.widgetInstance = new kendo.ui.ComboBox(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
ComboBox.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, dataSource = _a.dataSource, props = __rest(_a, ["children", "widgetRef", "dataSource"]);
this.widgetInstance.setOptions(props);
var widget = this.widgetInstance;
if (widget.options.dataSource !== dataSource) {
widget.setDataSource(dataSource);
}
widget.value(this.props.value);
}
var domChild = React.Children
.toArray(this.props.children)
.filter(function (child) { return child && (child.type === 'input'); })
.shift();
return domChild
? React.cloneElement(domChild, __assign({}, domChild.props, { ref: this.elementRef }))
: React.createElement("input", { ref: this.elementRef });
};
return ComboBox;
}(kendo_base_component_react_wrapper_1.default));
exports.default = ComboBox;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(0);
var kendo_base_component_react_wrapper_1 = __webpack_require__(1);
var DropDownList = /** @class */ (function (_super) {
__extends(DropDownList, _super);
function DropDownList() {
return _super !== null && _super.apply(this, arguments) || this;
}
DropDownList.prototype.componentDidMount = function () {
var domNode = this.domNode;
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
if (domNode) {
this.widgetInstance = new kendo.ui.DropDownList(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
DropDownList.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, dataSource = _a.dataSource, props = __rest(_a, ["children", "widgetRef", "dataSource"]);
this.widgetInstance.setOptions(props);
var widget = this.widgetInstance;
if (widget.options.dataSource !== dataSource) {
widget.setDataSource(dataSource);
}
this.widgetInstance.value(this.props.value);
}
var domChild = React.Children
.toArray(this.props.children)
.filter(function (child) { return child && (child.type === 'input'); })
.shift();
return domChild
? React.cloneElement(domChild, __assign({}, domChild.props, { ref: this.elementRef }))
: React.createElement("input", { ref: this.elementRef });
};
return DropDownList;
}(kendo_base_component_react_wrapper_1.default));
exports.default = DropDownList;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(0);
var kendo_base_component_react_wrapper_1 = __webpack_require__(1);
var MultiSelect = /** @class */ (function (_super) {
__extends(MultiSelect, _super);
function MultiSelect() {
return _super !== null && _super.apply(this, arguments) || this;
}
MultiSelect.prototype.componentDidMount = function () {
var domNode = this.domNode;
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
if (domNode) {
this.widgetInstance = new kendo.ui.MultiSelect(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
MultiSelect.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, dataSource = _a.dataSource, props = __rest(_a, ["children", "widgetRef", "dataSource"]);
this.widgetInstance.setOptions(props);
var widget = this.widgetInstance;
if (widget.options.dataSource !== dataSource) {
widget.setDataSource(dataSource);
}
widget.value(this.props.value);
}
var domChild = React.Children
.toArray(this.props.children)
.filter(function (child) { return child && (child.type === 'select'); })
.shift();
return domChild
? React.cloneElement(domChild, __assign({}, domChild.props, { ref: this.elementRef }))
: React.createElement("select", { ref: this.elementRef });
};
return MultiSelect;
}(kendo_base_component_react_wrapper_1.default));
exports.default = MultiSelect;
/***/ })
/******/ ]);
});
//# sourceMappingURL=kendo-dropdowns-react-wrapper.js.map