@progress/kendo-dateinputs-react-wrapper
Version:
Kendo UI DateInputs wrapper for React
535 lines (505 loc) • 21.1 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["KendoDateinputsReactWrapper"] = factory(require("react"));
else
root["KendoDateinputsReactWrapper"] = 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 timepicker_1 = __webpack_require__(3);
exports.TimePicker = timepicker_1.default;
var datepicker_1 = __webpack_require__(4);
exports.DatePicker = datepicker_1.default;
var datetimepicker_1 = __webpack_require__(5);
exports.DateTimePicker = datetimepicker_1.default;
var dateinput_1 = __webpack_require__(6);
exports.DateInput = dateinput_1.default;
var calendar_1 = __webpack_require__(7);
exports.Calendar = calendar_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 TimePicker = /** @class */ (function (_super) {
__extends(TimePicker, _super);
function TimePicker() {
return _super !== null && _super.apply(this, arguments) || this;
}
TimePicker.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.TimePicker(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
TimePicker.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
this.widgetInstance.setOptions(props);
this.widgetInstance.value(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 TimePicker;
}(kendo_base_component_react_wrapper_1.default));
exports.default = TimePicker;
/***/ }),
/* 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 DatePicker = /** @class */ (function (_super) {
__extends(DatePicker, _super);
function DatePicker() {
return _super !== null && _super.apply(this, arguments) || this;
}
DatePicker.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.DatePicker(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
DatePicker.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
this.widgetInstance.setOptions(props);
this.widgetInstance.value(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 DatePicker;
}(kendo_base_component_react_wrapper_1.default));
exports.default = DatePicker;
/***/ }),
/* 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 DateTimePicker = /** @class */ (function (_super) {
__extends(DateTimePicker, _super);
function DateTimePicker() {
return _super !== null && _super.apply(this, arguments) || this;
}
DateTimePicker.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
.DateTimePicker(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
DateTimePicker.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
this.widgetInstance.setOptions(props);
this.widgetInstance.value(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 DateTimePicker;
}(kendo_base_component_react_wrapper_1.default));
exports.default = DateTimePicker;
/***/ }),
/* 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 DateInput = /** @class */ (function (_super) {
__extends(DateInput, _super);
function DateInput() {
return _super !== null && _super.apply(this, arguments) || this;
}
DateInput.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.DateInput(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
DateInput.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
this.widgetInstance.setOptions(props);
this.widgetInstance.value(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 DateInput;
}(kendo_base_component_react_wrapper_1.default));
exports.default = DateInput;
/***/ }),
/* 7 */
/***/ (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 Calendar = /** @class */ (function (_super) {
__extends(Calendar, _super);
function Calendar() {
return _super !== null && _super.apply(this, arguments) || this;
}
Calendar.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.Calendar(domNode, props);
_super.prototype.componentDidMount.call(this);
}
};
Calendar.prototype.render = function () {
if (this.didMount) {
var _a = this.props, children = _a.children, widgetRef = _a.widgetRef, props = __rest(_a, ["children", "widgetRef"]);
this.widgetInstance.setOptions(props);
this.widgetInstance.value(props.value);
}
var domChild = React.Children
.toArray(this.props.children)
.filter(function (child) { return child && (child.type === 'div'); })
.shift();
return domChild
? React.cloneElement(domChild, __assign({}, domChild.props, { ref: this.elementRef }))
: React.createElement("div", { ref: this.elementRef });
};
return Calendar;
}(kendo_base_component_react_wrapper_1.default));
exports.default = Calendar;
/***/ })
/******/ ]);
});
//# sourceMappingURL=kendo-dateinputs-react-wrapper.js.map