1 |
|
2 | module.exports =
|
3 | (function(modules) {
|
4 |
|
5 | var installedModules = {};
|
6 |
|
7 |
|
8 | function __webpack_require__(moduleId) {
|
9 |
|
10 |
|
11 | if(installedModules[moduleId]) {
|
12 | return installedModules[moduleId].exports;
|
13 | }
|
14 |
|
15 | var module = installedModules[moduleId] = {
|
16 | i: moduleId,
|
17 | l: false,
|
18 | exports: {}
|
19 | };
|
20 |
|
21 |
|
22 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
23 |
|
24 |
|
25 | module.l = true;
|
26 |
|
27 |
|
28 | return module.exports;
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 | __webpack_require__.m = modules;
|
34 |
|
35 |
|
36 | __webpack_require__.c = installedModules;
|
37 |
|
38 |
|
39 | __webpack_require__.i = function(value) { return value; };
|
40 |
|
41 |
|
42 | __webpack_require__.d = function(exports, name, getter) {
|
43 | if(!__webpack_require__.o(exports, name)) {
|
44 | Object.defineProperty(exports, name, {
|
45 | configurable: false,
|
46 | enumerable: true,
|
47 | get: getter
|
48 | /******/ });
|
49 | /******/ }
|
50 | /******/ };
|
51 | /******/
|
52 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
53 | /******/ __webpack_require__.n = function(module) {
|
54 | var getter = module && module.__esModule ?
|
55 | function getDefault() { return module['default']; } :
|
56 | function getModuleExports() { return module; };
|
57 | __webpack_require__.d(getter, 'a', getter);
|
58 | return getter;
|
59 | };
|
60 |
|
61 |
|
62 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
63 |
|
64 |
|
65 | __webpack_require__.p = "";
|
66 |
|
67 |
|
68 | return __webpack_require__(__webpack_require__.s = 4);
|
69 | })
|
70 |
|
71 | ([
|
72 |
|
73 | (function(module, exports) {
|
74 |
|
75 | module.exports = require("prop-types");
|
76 |
|
77 | }),
|
78 |
|
79 | (function(module, exports) {
|
80 |
|
81 | module.exports = require("react");
|
82 |
|
83 | }),
|
84 |
|
85 | (function(module, exports, __webpack_require__) {
|
86 |
|
87 | "use strict";
|
88 |
|
89 |
|
90 | Object.defineProperty(exports, "__esModule", {
|
91 | value: true
|
92 | });
|
93 |
|
94 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
95 |
|
96 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
97 |
|
98 | var _class, _temp2;
|
99 |
|
100 |
|
101 | var _reactAnchor = __webpack_require__(6);
|
102 |
|
103 | var _reactAnchor2 = _interopRequireDefault(_reactAnchor);
|
104 |
|
105 | var _classnames = __webpack_require__(7);
|
106 |
|
107 | var _classnames2 = _interopRequireDefault(_classnames);
|
108 |
|
109 | var _propTypes = __webpack_require__(0);
|
110 |
|
111 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
112 |
|
113 | var _react = __webpack_require__(1);
|
114 |
|
115 | var _react2 = _interopRequireDefault(_react);
|
116 |
|
117 | var _AutosizeInput = __webpack_require__(3);
|
118 |
|
119 | var _AutosizeInput2 = _interopRequireDefault(_AutosizeInput);
|
120 |
|
121 | var _index = __webpack_require__(5);
|
122 |
|
123 | var _index2 = _interopRequireDefault(_index);
|
124 |
|
125 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
126 |
|
127 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
128 |
|
129 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
130 |
|
131 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
132 |
|
133 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
134 |
|
135 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | var limit = function limit(value, min, max) {
|
142 | return Math.max(min, Math.min(max, value));
|
143 | };
|
144 |
|
145 | var TablePagination = (_temp2 = _class = function (_Component) {
|
146 | _inherits(TablePagination, _Component);
|
147 |
|
148 | function TablePagination() {
|
149 | var _ref;
|
150 |
|
151 | var _temp, _this, _ret;
|
152 |
|
153 | _classCallCheck(this, TablePagination);
|
154 |
|
155 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
156 | args[_key] = arguments[_key];
|
157 | }
|
158 |
|
159 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TablePagination.__proto__ || Object.getPrototypeOf(TablePagination)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
160 | shouldOpenDropdownMenu: false,
|
161 | page: _this.props.page
|
162 | }, _this.actions = {
|
163 | toggleDropdownMenu: function toggleDropdownMenu() {
|
164 | _this.setState({ shouldOpenDropdownMenu: !_this.state.shouldOpenDropdownMenu });
|
165 | },
|
166 | closeDropdownMenu: function closeDropdownMenu() {
|
167 | _this.setState({ shouldOpenDropdownMenu: false });
|
168 | },
|
169 | changePage: function changePage(options) {
|
170 | var totalRecords = _this.props.totalRecords;
|
171 |
|
172 | var _options = _extends({}, options),
|
173 | _options$page = _options.page,
|
174 | page = _options$page === undefined ? _this.props.page : _options$page,
|
175 | _options$pageLength = _options.pageLength,
|
176 | pageLength = _options$pageLength === undefined ? _this.props.pageLength : _options$pageLength;
|
177 |
|
178 | var pageMin = 1;
|
179 | var pageMax = Math.max(Math.ceil(totalRecords / pageLength), 1);
|
180 | _this.props.onPageChange({
|
181 | page: limit(page, pageMin, pageMax),
|
182 | pageLength: pageLength
|
183 | });
|
184 | }
|
185 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
186 | }
|
187 |
|
188 | _createClass(TablePagination, [{
|
189 | key: 'componentWillReceiveProps',
|
190 | value: function componentWillReceiveProps(nextProps) {
|
191 | if (nextProps.page !== this.state.page) {
|
192 | this.setState({ page: Number(nextProps.page) });
|
193 | }
|
194 | }
|
195 | }, {
|
196 | key: 'render',
|
197 | value: function render() {
|
198 | var _this2 = this;
|
199 |
|
200 | var _props = this.props,
|
201 | type = _props.type,
|
202 | _props$totalRecords = _props.totalRecords,
|
203 | totalRecords = _props$totalRecords === undefined ? 0 : _props$totalRecords,
|
204 | pageLengthMenu = _props.pageLengthMenu,
|
205 | prevPageRenderer = _props.prevPageRenderer,
|
206 | nextPageRenderer = _props.nextPageRenderer,
|
207 | pageRecordsRenderer = _props.pageRecordsRenderer,
|
208 | pageLengthRenderer = _props.pageLengthRenderer,
|
209 | className = _props.className,
|
210 | props = _objectWithoutProperties(_props, ['type', 'totalRecords', 'pageLengthMenu', 'prevPageRenderer', 'nextPageRenderer', 'pageRecordsRenderer', 'pageLengthRenderer', 'className']);
|
211 |
|
212 | var pageLength = this.props.pageLength || pageLengthMenu[0] || 10;
|
213 | var totalPages = totalRecords > 0 ? Math.ceil(totalRecords / pageLength) : 1;
|
214 | var page = limit(this.props.page, 1, totalPages);
|
215 | var from = limit((page - 1) * pageLength + 1, 1, totalRecords);
|
216 | var to = limit((page - 1) * pageLength + pageLength, 1, totalRecords);
|
217 | var prevPageDisabled = page <= 1;
|
218 | var nextPageDisabled = page >= totalPages;
|
219 |
|
220 | delete props.pageLength;
|
221 | delete props.page;
|
222 | delete props.onPageChange;
|
223 |
|
224 | return _react2.default.createElement(
|
225 | 'div',
|
226 | _extends({}, props, {
|
227 | className: (0, _classnames2.default)(className, _index2.default.tablePagination)
|
228 | }),
|
229 | _react2.default.createElement(
|
230 | 'div',
|
231 | { className: _index2.default.tablePaginationBlock },
|
232 | _react2.default.createElement(
|
233 | 'div',
|
234 | { className: _index2.default.paginationRecords },
|
235 | pageRecordsRenderer({ totalRecords: totalRecords, from: from, to: to })
|
236 | ),
|
237 | type !== 'minor' && _react2.default.createElement(
|
238 | 'div',
|
239 | {
|
240 | className: (0, _classnames2.default)(_index2.default.dropdown, _defineProperty({}, _index2.default.open, this.state.shouldOpenDropdownMenu))
|
241 | },
|
242 | _react2.default.createElement(
|
243 | 'button',
|
244 | {
|
245 | type: 'button',
|
246 | className: (0, _classnames2.default)(_index2.default.btn, _index2.default.dropdownToggle),
|
247 | onClick: this.actions.toggleDropdownMenu,
|
248 | onBlur: this.actions.closeDropdownMenu
|
249 | },
|
250 | pageLengthRenderer({ pageLength: pageLength })
|
251 | ),
|
252 | _react2.default.createElement(
|
253 | 'ul',
|
254 | { className: _index2.default.dropdownMenu },
|
255 | pageLengthMenu.map(function (val) {
|
256 | return _react2.default.createElement(
|
257 | 'li',
|
258 | {
|
259 | key: val,
|
260 | className: (0, _classnames2.default)(_defineProperty({}, _index2.default.selected, pageLength === val)),
|
261 | onMouseDown: function onMouseDown() {
|
262 | _this2.actions.changePage({
|
263 | page: val !== pageLength ? 1 : page,
|
264 | pageLength: val
|
265 | });
|
266 | }
|
267 | },
|
268 | _react2.default.createElement(
|
269 | _reactAnchor2.default,
|
270 | null,
|
271 | val
|
272 | )
|
273 | );
|
274 | })
|
275 | )
|
276 | ),
|
277 | type !== 'reduced' && type !== 'minor' && _react2.default.createElement(
|
278 | 'div',
|
279 | { className: _index2.default.paginationInput },
|
280 | _react2.default.createElement(_AutosizeInput2.default, {
|
281 | value: this.state.page,
|
282 | onChange: function onChange(event) {
|
283 | var page = Number(event.target.value);
|
284 | if (isNaN(page)) {
|
285 | return;
|
286 | }
|
287 | _this2.setState({ page: limit(page, 1, totalPages) });
|
288 | },
|
289 | onKeyPress: function onKeyPress(event) {
|
290 | if (event.key !== 'Enter') {
|
291 | return;
|
292 | }
|
293 |
|
294 | var page = _this2.state.page;
|
295 |
|
296 | page = limit(page, 1, totalPages);
|
297 |
|
298 | if (page !== _this2.state.page) {
|
299 | _this2.setState({ page: page });
|
300 | }
|
301 |
|
302 | _this2.actions.changePage({ page: page });
|
303 | }
|
304 | }),
|
305 | '\xA0 / \xA0',
|
306 | totalPages
|
307 | ),
|
308 | _react2.default.createElement(
|
309 | 'div',
|
310 | null,
|
311 | _react2.default.createElement(
|
312 | 'ul',
|
313 | { className: _index2.default.pagination },
|
314 | _react2.default.createElement(
|
315 | 'li',
|
316 | {
|
317 | className: (0, _classnames2.default)(_defineProperty({}, _index2.default.disabled, prevPageDisabled))
|
318 | },
|
319 | _react2.default.createElement(
|
320 | _reactAnchor2.default,
|
321 | {
|
322 | disabled: prevPageDisabled,
|
323 | onClick: function onClick(event) {
|
324 | var prevPage = page > 1 ? page - 1 : page;
|
325 |
|
326 | if (prevPage !== _this2.state.page) {
|
327 | _this2.setState({ page: prevPage });
|
328 | }
|
329 |
|
330 | _this2.actions.changePage({ page: prevPage });
|
331 | }
|
332 | },
|
333 | prevPageRenderer()
|
334 | )
|
335 | ),
|
336 | _react2.default.createElement(
|
337 | 'li',
|
338 | {
|
339 | className: (0, _classnames2.default)(_defineProperty({}, _index2.default.disabled, nextPageDisabled))
|
340 | },
|
341 | _react2.default.createElement(
|
342 | _reactAnchor2.default,
|
343 | {
|
344 | disabled: nextPageDisabled,
|
345 | onClick: function onClick(event) {
|
346 | var nextPage = page < totalPages ? page + 1 : page;
|
347 |
|
348 | if (nextPage !== _this2.state.page) {
|
349 | _this2.setState({ page: nextPage });
|
350 | }
|
351 |
|
352 | _this2.actions.changePage({ page: nextPage });
|
353 | }
|
354 | },
|
355 | nextPageRenderer()
|
356 | )
|
357 | )
|
358 | )
|
359 | )
|
360 | )
|
361 | );
|
362 | }
|
363 | }]);
|
364 |
|
365 | return TablePagination;
|
366 | }(_react.Component), _class.propTypes = {
|
367 | type: _propTypes2.default.oneOf(['full', 'reduced', 'minor']),
|
368 | page: _propTypes2.default.number,
|
369 | pageLength: _propTypes2.default.number,
|
370 | pageLengthMenu: _propTypes2.default.array,
|
371 | totalRecords: _propTypes2.default.number,
|
372 | onPageChange: _propTypes2.default.func,
|
373 | prevPageRenderer: _propTypes2.default.func,
|
374 | nextPageRenderer: _propTypes2.default.func,
|
375 | pageRecordsRenderer: _propTypes2.default.func,
|
376 | pageLengthRenderer: _propTypes2.default.func
|
377 | }, _class.defaultProps = {
|
378 | type: 'full',
|
379 | page: 1,
|
380 | pageLength: 10,
|
381 | pageLengthMenu: [10, 25, 50, 100],
|
382 | totalRecords: 0,
|
383 | onPageChange: function onPageChange() {},
|
384 | prevPageRenderer: function prevPageRenderer() {
|
385 | return '‹';
|
386 | },
|
387 | nextPageRenderer: function nextPageRenderer() {
|
388 | return '›';
|
389 | },
|
390 | pageRecordsRenderer: function pageRecordsRenderer(_ref2) {
|
391 | var totalRecords = _ref2.totalRecords,
|
392 | from = _ref2.from,
|
393 | to = _ref2.to;
|
394 |
|
395 | if (totalRecords > 0) {
|
396 | return 'Records: ' + from + ' - ' + to + ' / ' + totalRecords;
|
397 | }
|
398 |
|
399 | return 'Records: ' + totalRecords;
|
400 | },
|
401 | pageLengthRenderer: function pageLengthRenderer(_ref3) {
|
402 | var pageLength = _ref3.pageLength;
|
403 |
|
404 | return _react2.default.createElement(
|
405 | 'span',
|
406 | null,
|
407 | pageLength + ' per page',
|
408 | _react2.default.createElement('i', { className: _index2.default.caret })
|
409 | );
|
410 | }
|
411 | }, _temp2);
|
412 | exports.default = TablePagination;
|
413 |
|
414 | }),
|
415 |
|
416 | (function(module, exports, __webpack_require__) {
|
417 |
|
418 | "use strict";
|
419 |
|
420 |
|
421 | Object.defineProperty(exports, "__esModule", {
|
422 | value: true
|
423 | });
|
424 |
|
425 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
426 |
|
427 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
428 |
|
429 | var _class, _temp2;
|
430 |
|
431 |
|
432 |
|
433 |
|
434 | var _propTypes = __webpack_require__(0);
|
435 |
|
436 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
437 |
|
438 | var _react = __webpack_require__(1);
|
439 |
|
440 | var _react2 = _interopRequireDefault(_react);
|
441 |
|
442 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
443 |
|
444 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
445 |
|
446 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
447 |
|
448 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
449 |
|
450 | var sizerStyle = {
|
451 | position: 'absolute',
|
452 | top: 0,
|
453 | left: 0,
|
454 | visibility: 'hidden',
|
455 | height: 0,
|
456 | overflow: 'scroll',
|
457 | whiteSpace: 'pre'
|
458 | };
|
459 |
|
460 | var AutosizeInput = (_temp2 = _class = function (_Component) {
|
461 | _inherits(AutosizeInput, _Component);
|
462 |
|
463 | function AutosizeInput() {
|
464 | var _ref;
|
465 |
|
466 | var _temp, _this, _ret;
|
467 |
|
468 | _classCallCheck(this, AutosizeInput);
|
469 |
|
470 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
471 | args[_key] = arguments[_key];
|
472 | }
|
473 |
|
474 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
475 | inputWidth: _this.props.minWidth
|
476 | }, _this.nodes = {
|
477 | input: null,
|
478 | sizer: null,
|
479 | placeholderSizer: null
|
480 | }, _this._isMounted = false, _temp), _possibleConstructorReturn(_this, _ret);
|
481 | }
|
482 |
|
483 | _createClass(AutosizeInput, [{
|
484 | key: 'componentDidMount',
|
485 | value: function componentDidMount() {
|
486 | this._isMounted = true;
|
487 | this.copyInputStyles();
|
488 | this.updateInputWidth();
|
489 | }
|
490 | }, {
|
491 | key: 'componentWillUnmount',
|
492 | value: function componentWillUnmount() {
|
493 | this._isMounted = false;
|
494 | }
|
495 | }, {
|
496 | key: 'componentDidUpdate',
|
497 | value: function componentDidUpdate(prevProps, prevState) {
|
498 | if (prevState.inputWidth !== this.state.inputWidth) {
|
499 | if (typeof this.props.onAutosize === 'function') {
|
500 | this.props.onAutosize(this.state.inputWidth);
|
501 | }
|
502 | }
|
503 | this.updateInputWidth();
|
504 | }
|
505 | }, {
|
506 | key: 'copyInputStyles',
|
507 | value: function copyInputStyles() {
|
508 | if (!this._isMounted || !window.getComputedStyle) {
|
509 | return;
|
510 | }
|
511 |
|
512 | var inputStyle = window.getComputedStyle(this.nodes.input);
|
513 | if (!inputStyle) {
|
514 | return;
|
515 | }
|
516 |
|
517 | var widthNode = this.nodes.sizer;
|
518 | widthNode.style.fontSize = inputStyle.fontSize;
|
519 | widthNode.style.fontFamily = inputStyle.fontFamily;
|
520 | widthNode.style.fontWeight = inputStyle.fontWeight;
|
521 | widthNode.style.fontStyle = inputStyle.fontStyle;
|
522 | widthNode.style.letterSpacing = inputStyle.letterSpacing;
|
523 |
|
524 | if (this.props.placeholder) {
|
525 | var placeholderNode = this.nodes.placeholderSizer;
|
526 | placeholderNode.style.fontSize = inputStyle.fontSize;
|
527 | placeholderNode.style.fontFamily = inputStyle.fontFamily;
|
528 | placeholderNode.style.fontWeight = inputStyle.fontWeight;
|
529 | placeholderNode.style.fontStyle = inputStyle.fontStyle;
|
530 | placeholderNode.style.letterSpacing = inputStyle.letterSpacing;
|
531 | }
|
532 | }
|
533 | }, {
|
534 | key: 'updateInputWidth',
|
535 | value: function updateInputWidth() {
|
536 | if (!this._isMounted || typeof this.nodes.sizer.scrollWidth === 'undefined') {
|
537 | return;
|
538 | }
|
539 | var newInputWidth = void 0;
|
540 | if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {
|
541 | newInputWidth = Math.max(this.nodes.sizer.scrollWidth, this.nodes.placeholderSizer.scrollWidth) + 2;
|
542 | } else {
|
543 | newInputWidth = this.nodes.sizer.scrollWidth + 2;
|
544 | }
|
545 | if (newInputWidth < this.props.minWidth) {
|
546 | newInputWidth = this.props.minWidth;
|
547 | }
|
548 | if (newInputWidth !== this.state.inputWidth) {
|
549 | this.setState({
|
550 | inputWidth: newInputWidth
|
551 | });
|
552 | }
|
553 | }
|
554 | }, {
|
555 | key: 'getInput',
|
556 | value: function getInput() {
|
557 | return this.nodes.input;
|
558 | }
|
559 | }, {
|
560 | key: 'focus',
|
561 | value: function focus() {
|
562 | this.nodes.input.focus();
|
563 | }
|
564 | }, {
|
565 | key: 'blur',
|
566 | value: function blur() {
|
567 | this.nodes.input.blur();
|
568 | }
|
569 | }, {
|
570 | key: 'select',
|
571 | value: function select() {
|
572 | this.nodes.input.select();
|
573 | }
|
574 | }, {
|
575 | key: 'render',
|
576 | value: function render() {
|
577 | var _this2 = this;
|
578 |
|
579 | var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {
|
580 | if (previousValue !== null && previousValue !== undefined) {
|
581 | return previousValue;
|
582 | }
|
583 | return currentValue;
|
584 | });
|
585 |
|
586 | var wrapperStyle = this.props.style || {};
|
587 | if (!wrapperStyle.display) {
|
588 | wrapperStyle.display = 'inline-block';
|
589 | }
|
590 |
|
591 | var inputStyle = _extends({}, this.props.inputStyle);
|
592 | inputStyle.width = this.state.inputWidth + 'px';
|
593 | inputStyle.boxSizing = 'content-box';
|
594 |
|
595 | var inputProps = _extends({}, this.props);
|
596 | inputProps.className = this.props.inputClassName;
|
597 | inputProps.style = inputStyle;
|
598 |
|
599 |
|
600 | delete inputProps.inputClassName;
|
601 | delete inputProps.inputStyle;
|
602 | delete inputProps.minWidth;
|
603 | delete inputProps.placeholderIsMinWidth;
|
604 |
|
605 | return _react2.default.createElement(
|
606 | 'div',
|
607 | { className: this.props.className, style: wrapperStyle },
|
608 | _react2.default.createElement('input', _extends({}, inputProps, {
|
609 | ref: function ref(node) {
|
610 | _this2.nodes.input = node;
|
611 | }
|
612 | })),
|
613 | _react2.default.createElement(
|
614 | 'div',
|
615 | {
|
616 | ref: function ref(node) {
|
617 | _this2.nodes.sizer = node;
|
618 | },
|
619 | style: sizerStyle
|
620 | },
|
621 | sizerValue
|
622 | ),
|
623 | this.props.placeholder && _react2.default.createElement(
|
624 | 'div',
|
625 | {
|
626 | ref: function ref(node) {
|
627 | _this2.nodes.placeholderSizer = node;
|
628 | },
|
629 | style: sizerStyle
|
630 | },
|
631 | this.props.placeholder
|
632 | )
|
633 | );
|
634 | }
|
635 | }]);
|
636 |
|
637 | return AutosizeInput;
|
638 | }(_react.Component), _class.propTypes = {
|
639 |
|
640 | className: _propTypes2.default.string,
|
641 |
|
642 |
|
643 | defaultValue: _propTypes2.default.any,
|
644 |
|
645 |
|
646 | inputClassName: _propTypes2.default.string,
|
647 |
|
648 |
|
649 | inputStyle: _propTypes2.default.object,
|
650 |
|
651 |
|
652 | minWidth: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
|
653 |
|
654 |
|
655 | onAutosize: _propTypes2.default.func,
|
656 |
|
657 |
|
658 | onChange: _propTypes2.default.func,
|
659 |
|
660 |
|
661 | placeholder: _propTypes2.default.string,
|
662 |
|
663 |
|
664 | placeholderIsMinWidth: _propTypes2.default.bool,
|
665 |
|
666 |
|
667 | style: _propTypes2.default.object,
|
668 |
|
669 |
|
670 | value: _propTypes2.default.any
|
671 | }, _class.defaultProps = {
|
672 | minWidth: 1
|
673 | }, _temp2);
|
674 | exports.default = AutosizeInput;
|
675 |
|
676 | }),
|
677 |
|
678 | (function(module, exports, __webpack_require__) {
|
679 |
|
680 | "use strict";
|
681 |
|
682 |
|
683 | Object.defineProperty(exports, "__esModule", {
|
684 | value: true
|
685 | });
|
686 | exports.TablePagination = undefined;
|
687 |
|
688 | var _TablePagination2 = __webpack_require__(2);
|
689 |
|
690 | var _TablePagination3 = _interopRequireDefault(_TablePagination2);
|
691 |
|
692 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
693 |
|
694 | exports.TablePagination = _TablePagination3.default;
|
695 |
|
696 | }),
|
697 |
|
698 | (function(module, exports) {
|
699 |
|
700 |
|
701 | module.exports = {"pagination":"paginations---pagination---2Rb5b","fa":"paginations---fa---2RjFS","active":"paginations---active---2-a32","disabled":"paginations---disabled---eCY9b","table-pagination":"paginations---table-pagination---41TU-","tablePagination":"paginations---table-pagination---41TU-","pull-right":"paginations---pull-right---2juGH","pullRight":"paginations---pull-right---2juGH","table-pagination-block":"paginations---table-pagination-block---Cx6IH","tablePaginationBlock":"paginations---table-pagination-block---Cx6IH","pagination-records":"paginations---pagination-records---YOUAz","paginationRecords":"paginations---pagination-records---YOUAz","dropdown":"paginations---dropdown---1yvIZ","btn":"paginations---btn---2jZHN","caret":"paginations---caret---3CkEt","dropdown-menu":"paginations---dropdown-menu---1fkH0","dropdownMenu":"paginations---dropdown-menu---1fkH0","pagination-input":"paginations---pagination-input---2C8oD","paginationInput":"paginations---pagination-input---2C8oD","open":"paginations---open---1ju75","selected":"paginations---selected---1EK3y"};
|
702 |
|
703 | }),
|
704 |
|
705 | (function(module, exports) {
|
706 |
|
707 | module.exports = require("@trendmicro/react-anchor");
|
708 |
|
709 | }),
|
710 |
|
711 | (function(module, exports) {
|
712 |
|
713 | module.exports = require("classnames");
|
714 |
|
715 | })
|
716 | ]);
|
717 |
|
\ | No newline at end of file |