@progress/kendo-treeview-react-wrapper
Version:
Kendo UI TreeView wrapper for React
288 lines (266 loc) • 10.6 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["KendoTreeviewReactWrapper"] = factory(require("react"));
else
root["KendoTreeviewReactWrapper"] = 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 = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
;
Object.defineProperty(exports, "__esModule", { value: true });
var treeview_1 = __webpack_require__(2);
exports.TreeView = treeview_1.default;
var treeviewsubitems_1 = __webpack_require__(4);
exports.TreeViewSubItems = treeviewsubitems_1.default;
var treeviewitem_1 = __webpack_require__(5);
exports.TreeViewItem = treeviewitem_1.default;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
;
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 __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__(3);
var TreeView = /** @class */ (function (_super) {
__extends(TreeView, _super);
function TreeView() {
return _super !== null && _super.apply(this, arguments) || this;
}
TreeView.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.TreeView(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
TreeView.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
var widget = this.widgetInstance;
if (props.dataSource && props.dataSource === widget.options.dataSource) {
delete props.dataSource;
}
this.widgetInstance.setOptions(props);
}
return (React.createElement("ul", { ref: this.elementRef }, this.props.children));
};
return TreeView;
}(kendo_base_component_react_wrapper_1.default));
exports.default = TreeView;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
;
/// <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;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
;
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 TreeViewSubItems = /** @class */ (function (_super) {
__extends(TreeViewSubItems, _super);
function TreeViewSubItems() {
return _super !== null && _super.apply(this, arguments) || this;
}
TreeViewSubItems.prototype.render = function () {
return (React.createElement("ul", null, this.props.children));
};
return TreeViewSubItems;
}(React.Component));
exports.default = TreeViewSubItems;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
;
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 TreeViewItem = /** @class */ (function (_super) {
__extends(TreeViewItem, _super);
function TreeViewItem() {
return _super !== null && _super.apply(this, arguments) || this;
}
TreeViewItem.prototype.render = function () {
return (React.createElement("li", null, this.props.children));
};
return TreeViewItem;
}(React.Component));
exports.default = TreeViewItem;
/***/ })
/******/ ]);
});
//# sourceMappingURL=kendo-treeview-react-wrapper.js.map