react-select-input-v2 1.0.7 → 1.0.8-react16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +82 -82
- package/es/index.js +68 -91
- package/es/react-select-input.css +92 -92
- package/lib/index.js +70 -91
- package/lib/react-select-input.css +92 -92
- package/package.json +12 -37
- package/src/index.js +270 -0
- package/src/react-select-input.css +92 -0
- package/umd/{react-select-input.js → react-select-input-v2.js} +341 -629
- package/umd/react-select-input-v2.min.js +6 -0
- package/umd/react-select-input-v2.min.js.map +1 -0
- package/umd/react-select-input.min.js +0 -6
- package/umd/react-select-input.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-select-input v1.0.
|
|
2
|
+
* react-select-input-v2 v1.0.8-react16
|
|
3
3
|
* MIT Licensed
|
|
4
4
|
*/
|
|
5
5
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -74,7 +74,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
74
74
|
/******/ __webpack_require__.p = "";
|
|
75
75
|
/******/
|
|
76
76
|
/******/ // Load entry module and return exports
|
|
77
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
77
|
+
/******/ return __webpack_require__(__webpack_require__.s = 3);
|
|
78
78
|
/******/ })
|
|
79
79
|
/************************************************************************/
|
|
80
80
|
/******/ ([
|
|
@@ -87,13 +87,33 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
|
|
|
87
87
|
/* 1 */
|
|
88
88
|
/***/ (function(module, exports, __webpack_require__) {
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the MIT license found in the
|
|
94
|
+
* LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/
|
|
91
96
|
|
|
97
|
+
if (true) {
|
|
98
|
+
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
|
99
|
+
Symbol.for &&
|
|
100
|
+
Symbol.for('react.element')) ||
|
|
101
|
+
0xeac7;
|
|
102
|
+
|
|
103
|
+
var isValidElement = function(object) {
|
|
104
|
+
return typeof object === 'object' &&
|
|
105
|
+
object !== null &&
|
|
106
|
+
object.$$typeof === REACT_ELEMENT_TYPE;
|
|
107
|
+
};
|
|
92
108
|
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
110
|
+
// http://fb.me/prop-types-in-prod
|
|
111
|
+
var throwOnDirectAccess = true;
|
|
112
|
+
module.exports = __webpack_require__(5)(isValidElement, throwOnDirectAccess);
|
|
95
113
|
} else {
|
|
96
|
-
|
|
114
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
115
|
+
// http://fb.me/prop-types-in-prod
|
|
116
|
+
module.exports = require('./factoryWithThrowingShims')();
|
|
97
117
|
}
|
|
98
118
|
|
|
99
119
|
|
|
@@ -118,20 +138,13 @@ module.exports = ReactPropTypesSecret;
|
|
|
118
138
|
|
|
119
139
|
/***/ }),
|
|
120
140
|
/* 3 */
|
|
121
|
-
/***/ (function(module, exports) {
|
|
122
|
-
|
|
123
|
-
module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/***/ }),
|
|
127
|
-
/* 4 */
|
|
128
141
|
/***/ (function(module, exports, __webpack_require__) {
|
|
129
142
|
|
|
130
|
-
module.exports = __webpack_require__(
|
|
143
|
+
module.exports = __webpack_require__(4);
|
|
131
144
|
|
|
132
145
|
|
|
133
146
|
/***/ }),
|
|
134
|
-
/*
|
|
147
|
+
/* 4 */
|
|
135
148
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
136
149
|
|
|
137
150
|
"use strict";
|
|
@@ -139,8 +152,12 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|
|
139
152
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return SelectInput; });
|
|
140
153
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
|
141
154
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
|
142
|
-
/* harmony import */ var
|
|
143
|
-
/* harmony import */ var
|
|
155
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types__ = __webpack_require__(1);
|
|
156
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prop_types__);
|
|
157
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_autosize_textarea__ = __webpack_require__(8);
|
|
158
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_autosize_textarea___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react_autosize_textarea__);
|
|
159
|
+
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; };
|
|
160
|
+
|
|
144
161
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
145
162
|
|
|
146
163
|
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; }
|
|
@@ -189,7 +206,6 @@ var SelectInput = function (_Component) {
|
|
|
189
206
|
if (_this.props.collapseOnSelect) state = _this.setIsOpen(state, false);
|
|
190
207
|
state = _this.manipState(state, 'searchMatchOptions', _this.matchingOptions(_this.props.options, state.value));
|
|
191
208
|
_this.setState(state);
|
|
192
|
-
|
|
193
209
|
if (_this.isFunction(_this.props.onSelect)) _this.props.onSelect(option);
|
|
194
210
|
};
|
|
195
211
|
|
|
@@ -202,14 +218,11 @@ var SelectInput = function (_Component) {
|
|
|
202
218
|
var state = _this.manipState(_this.state, 'value', event.target.value);
|
|
203
219
|
state = _this.manipState(state, 'searchMatchOptions', _this.matchingOptions(_this.props.options, event.target.value));
|
|
204
220
|
state = _this.setIsOpen(state, true);
|
|
205
|
-
|
|
206
221
|
if (!state.value) {
|
|
207
222
|
state = _this.manipState(state, 'currentOption', -1);
|
|
208
223
|
state = _this.manipState(state, 'selectedOption', null);
|
|
209
224
|
}
|
|
210
|
-
|
|
211
225
|
if (_this.isFunction(_this.props.onChange)) _this.props.onChange(event);
|
|
212
|
-
|
|
213
226
|
_this.setState(state);
|
|
214
227
|
};
|
|
215
228
|
|
|
@@ -217,7 +230,6 @@ var SelectInput = function (_Component) {
|
|
|
217
230
|
var state = _this.setIsOpen(_this.state, true);
|
|
218
231
|
state = _this.manipState(state, 'searchMatchOptions', _this.matchingOptions(_this.props.options, event.target.value));
|
|
219
232
|
_this.setState(state);
|
|
220
|
-
|
|
221
233
|
if (_this.isFunction(_this.props.onFocus)) _this.props.onFocus(event);
|
|
222
234
|
};
|
|
223
235
|
|
|
@@ -228,65 +240,47 @@ var SelectInput = function (_Component) {
|
|
|
228
240
|
state = _this.manipState(state, 'currentOption', -1);
|
|
229
241
|
state = _this.manipState(state, 'selectedOption', null);
|
|
230
242
|
_this.setState(state);
|
|
231
|
-
|
|
232
243
|
if (_this.isFunction(_this.props.onClear)) _this.props.onClear();
|
|
233
244
|
};
|
|
234
245
|
|
|
235
246
|
_this.handleBlur = function (event) {
|
|
236
247
|
if (_this.props.collapseOnBlur) {
|
|
237
|
-
|
|
238
|
-
_this.setState(state);
|
|
248
|
+
_this.setState(_this.setIsOpen(_this.state, false));
|
|
239
249
|
}
|
|
240
|
-
|
|
241
250
|
if (_this.isFunction(_this.props.onBlur)) _this.props.onBlur(event);
|
|
242
251
|
};
|
|
243
252
|
|
|
244
253
|
_this.handleKeyUp = function (event) {
|
|
245
|
-
if (event.key === 'Enter' && _this.state.currentOption > -1)
|
|
246
|
-
|
|
247
|
-
} else if (event.key === 'Enter' && _this.state.currentOption === -1) {
|
|
248
|
-
_this.handleSelect(_this.pickOption());
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (event.key === 'Escape' && _this.props.collapseOnEscape) {
|
|
252
|
-
_this.setState(_this.setIsOpen(_this.state, false));
|
|
253
|
-
}
|
|
254
|
-
|
|
254
|
+
if (event.key === 'Enter' && _this.state.currentOption > -1) _this.handleSelect(_this.pickOption());
|
|
255
|
+
if (event.key === 'Escape' && _this.props.collapseOnEscape) _this.setState(_this.setIsOpen(_this.state, false));
|
|
255
256
|
if (_this.isFunction(_this.props.onKeyUp)) _this.props.onKeyUp(event);
|
|
256
257
|
};
|
|
257
258
|
|
|
258
259
|
_this.handleKeyDown = function (event) {
|
|
259
260
|
if (event.key === 'Enter' && _this.props.disableEnter) event.preventDefault();
|
|
260
|
-
|
|
261
|
-
if (event.key === 'Escape' && _this.props.collapseOnEscape) {
|
|
262
|
-
var state = _this.setIsOpen(_this.state, false);
|
|
263
|
-
_this.setState(state);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
_this.handleOptionNavigation(event);
|
|
267
|
-
|
|
261
|
+
if (event.key === 'Escape' && _this.props.collapseOnEscape) _this.setState(_this.setIsOpen(_this.state, false));
|
|
268
262
|
if (_this.isFunction(_this.props.onKeyDown)) _this.props.onKeyDown(event);
|
|
263
|
+
_this.handleOptionNavigation(event);
|
|
269
264
|
};
|
|
270
265
|
|
|
271
266
|
_this.handleOptionNavigation = function (event) {
|
|
272
267
|
var state = {};
|
|
273
268
|
var currentOption = _this.state.currentOption;
|
|
274
269
|
|
|
275
|
-
if (event.key === 'ArrowUp' || event.key === 'ArrowDown'
|
|
270
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') event.preventDefault();
|
|
276
271
|
|
|
277
272
|
if (event.key === 'ArrowUp' && currentOption === -1 && _this.props.openUp) currentOption = _this.state.searchMatchOptions.length;
|
|
278
273
|
|
|
279
274
|
if (_this.props.openUp) {
|
|
280
|
-
if (event.key === 'ArrowDown')
|
|
281
|
-
if (currentOption > -1) currentOption++;else currentOption = -1;
|
|
282
|
-
} else if (event.key === 'ArrowUp') currentOption--;
|
|
275
|
+
if (event.key === 'ArrowDown') currentOption = currentOption > -1 ? currentOption + 1 : -1;else if (event.key === 'ArrowUp') currentOption--;
|
|
283
276
|
} else {
|
|
284
277
|
if (event.key === 'ArrowDown') currentOption++;else if (event.key === 'ArrowUp') currentOption--;
|
|
285
278
|
}
|
|
286
279
|
|
|
287
|
-
if (currentOption < -1) currentOption = -1;else if (currentOption > _this.state.searchMatchOptions.length - 1
|
|
280
|
+
if (currentOption < -1) currentOption = -1;else if (currentOption > _this.state.searchMatchOptions.length - 1) currentOption = _this.state.searchMatchOptions.length - 1;
|
|
288
281
|
|
|
289
282
|
state = _this.manipState(_this.state, 'currentOption', currentOption);
|
|
283
|
+
|
|
290
284
|
var optionRef = currentOption > -1 ? _this['option-' + _this.state.searchMatchOptions[currentOption][_this.props.valueKey]] : null;
|
|
291
285
|
if (optionRef) optionRef.scrollIntoViewIfNeeded(false);
|
|
292
286
|
|
|
@@ -298,12 +292,12 @@ var SelectInput = function (_Component) {
|
|
|
298
292
|
var searchValue = value.replace(/\s/g, '');
|
|
299
293
|
var searchOptions = [];
|
|
300
294
|
|
|
301
|
-
if (options && options.length > 0 && value) searchOptions = options.filter(function (option
|
|
302
|
-
var
|
|
303
|
-
var value = option[_this.props.valueKey] || '';
|
|
295
|
+
if (options && options.length > 0 && value) searchOptions = options.filter(function (option) {
|
|
296
|
+
var val = option[_this.props.valueKey] || '';
|
|
304
297
|
var label = option[_this.props.labelKey] || '';
|
|
305
|
-
|
|
306
|
-
|
|
298
|
+
var regexp = new RegExp(searchValue, 'gi');
|
|
299
|
+
return regexp.test(label.replace(/\s/g, '')) || regexp.test(val.replace(/\s/g, ''));
|
|
300
|
+
});else searchOptions = options.slice();
|
|
307
301
|
|
|
308
302
|
if (_this.props.openUp) searchOptions.reverse();
|
|
309
303
|
|
|
@@ -318,15 +312,13 @@ var SelectInput = function (_Component) {
|
|
|
318
312
|
};
|
|
319
313
|
|
|
320
314
|
_this.setIsOpen = function (state, show) {
|
|
321
|
-
return
|
|
322
|
-
isOpen: show || false
|
|
323
|
-
});
|
|
315
|
+
return _extends({}, state, { isOpen: show || false });
|
|
324
316
|
};
|
|
325
317
|
|
|
326
318
|
_this.manipState = function (state, key, value) {
|
|
327
|
-
var
|
|
319
|
+
var _extends2;
|
|
328
320
|
|
|
329
|
-
return
|
|
321
|
+
return _extends({}, state, (_extends2 = {}, _extends2[key] = value, _extends2));
|
|
330
322
|
};
|
|
331
323
|
|
|
332
324
|
_this.isFunction = function (obj) {
|
|
@@ -334,7 +326,7 @@ var SelectInput = function (_Component) {
|
|
|
334
326
|
};
|
|
335
327
|
|
|
336
328
|
_this.handleOutsideClick = function (event) {
|
|
337
|
-
if (!_this.ris.contains(event.target) && _this.props.collapseOnBlur) _this.setState(
|
|
329
|
+
if (_this.ris && !_this.ris.contains(event.target) && _this.props.collapseOnBlur) _this.setState({ isOpen: false });
|
|
338
330
|
};
|
|
339
331
|
|
|
340
332
|
_this.state = {
|
|
@@ -353,9 +345,10 @@ var SelectInput = function (_Component) {
|
|
|
353
345
|
|
|
354
346
|
SelectInput.prototype.componentDidUpdate = function componentDidUpdate() {
|
|
355
347
|
if (this.props.openUp && this.state.currentOption === -1 && this.state.isOpen && !this.state.selectedOption) {
|
|
356
|
-
this.options.scrollTop = this.options.scrollHeight;
|
|
348
|
+
if (this.options) this.options.scrollTop = this.options.scrollHeight;
|
|
357
349
|
} else if (this.props.openUp && this.state.selectedOption && this.state.isOpen) {
|
|
358
|
-
this['option-' + this.state.selectedOption]
|
|
350
|
+
var ref = this['option-' + this.state.selectedOption];
|
|
351
|
+
if (ref && ref.scrollIntoViewIfNeeded) ref.scrollIntoViewIfNeeded(true);
|
|
359
352
|
}
|
|
360
353
|
};
|
|
361
354
|
|
|
@@ -363,21 +356,11 @@ var SelectInput = function (_Component) {
|
|
|
363
356
|
document.removeEventListener('click', this.handleOutsideClick);
|
|
364
357
|
};
|
|
365
358
|
|
|
366
|
-
|
|
367
|
-
Various renderers
|
|
368
|
-
*/
|
|
359
|
+
// ======= 渲染选项 =======
|
|
369
360
|
|
|
370
|
-
/*
|
|
371
|
-
Handle different events
|
|
372
|
-
*/
|
|
373
361
|
|
|
374
|
-
|
|
375
|
-
Searching function
|
|
376
|
-
*/
|
|
362
|
+
// ======= 事件处理 =======
|
|
377
363
|
|
|
378
|
-
/*
|
|
379
|
-
Various helpers
|
|
380
|
-
*/
|
|
381
364
|
|
|
382
365
|
SelectInput.prototype.render = function render() {
|
|
383
366
|
var _this2 = this;
|
|
@@ -392,7 +375,7 @@ var SelectInput = function (_Component) {
|
|
|
392
375
|
},
|
|
393
376
|
style: this.props.style
|
|
394
377
|
},
|
|
395
|
-
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
|
378
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2_react_autosize_textarea___default.a, {
|
|
396
379
|
className: 'ris-input',
|
|
397
380
|
value: this.state.value !== null ? this.state.value : this.props.value,
|
|
398
381
|
placeholder: this.props.placeholder,
|
|
@@ -406,481 +389,69 @@ var SelectInput = function (_Component) {
|
|
|
406
389
|
return _this2.input = ref;
|
|
407
390
|
}
|
|
408
391
|
}),
|
|
409
|
-
this.props.clearable
|
|
392
|
+
this.props.clearable && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
|
410
393
|
'div',
|
|
411
394
|
{ className: 'ris-clearable', onClick: this.handleClear },
|
|
412
395
|
'x'
|
|
413
|
-
)
|
|
414
|
-
this.state.isOpen
|
|
396
|
+
),
|
|
397
|
+
this.state.isOpen && this.state.searchMatchOptions.length > 0 && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
|
415
398
|
'div',
|
|
416
399
|
{ className: 'ris-options', ref: function ref(_ref3) {
|
|
417
400
|
return _this2.options = _ref3;
|
|
418
401
|
} },
|
|
419
402
|
this.renderOptions(this.state.searchMatchOptions)
|
|
420
|
-
)
|
|
421
|
-
'div',
|
|
422
|
-
{ className: 'ris-options ris-no-options' },
|
|
423
|
-
this.props.noOptions
|
|
424
|
-
) : null : null
|
|
403
|
+
)
|
|
425
404
|
);
|
|
426
405
|
};
|
|
427
406
|
|
|
428
|
-
return SelectInput;
|
|
429
|
-
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
SelectInput.defaultProps = {
|
|
435
|
-
uniqueKey: 'react-select-input',
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
clearable: true, //Boolean
|
|
450
|
-
options: [], //Array
|
|
451
|
-
onChange: undefined, //Function
|
|
452
|
-
onSelect: undefined, //Function
|
|
453
|
-
onFocus: undefined, //Function
|
|
454
|
-
onBlur: undefined, //Function
|
|
455
|
-
onKeyUp: undefined, //Function
|
|
456
|
-
onKeyDown: undefined, //Function
|
|
457
|
-
onClear: undefined, //Function
|
|
458
|
-
noOptions: undefined //JSX
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
/***/ }),
|
|
462
|
-
/* 6 */
|
|
463
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
464
|
-
|
|
465
|
-
"use strict";
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
Object.defineProperty(exports, "__esModule", {
|
|
469
|
-
value: true
|
|
470
|
-
});
|
|
471
|
-
exports.default = undefined;
|
|
472
|
-
|
|
473
|
-
var _TextareaAutosize = __webpack_require__(7);
|
|
474
|
-
|
|
475
|
-
var _TextareaAutosize2 = _interopRequireDefault(_TextareaAutosize);
|
|
476
|
-
|
|
477
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
478
|
-
|
|
479
|
-
exports.default = _TextareaAutosize2.default;
|
|
480
|
-
|
|
481
|
-
/***/ }),
|
|
482
|
-
/* 7 */
|
|
483
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
484
|
-
|
|
485
|
-
"use strict";
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
Object.defineProperty(exports, "__esModule", {
|
|
489
|
-
value: true
|
|
490
|
-
});
|
|
491
|
-
exports.default = undefined;
|
|
492
|
-
|
|
493
|
-
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; };
|
|
494
|
-
|
|
495
|
-
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; }; }();
|
|
496
|
-
|
|
497
|
-
var _class, _temp2;
|
|
498
|
-
|
|
499
|
-
var _react = __webpack_require__(0);
|
|
500
|
-
|
|
501
|
-
var _react2 = _interopRequireDefault(_react);
|
|
502
|
-
|
|
503
|
-
var _propTypes = __webpack_require__(8);
|
|
504
|
-
|
|
505
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
506
|
-
|
|
507
|
-
var _autosize = __webpack_require__(13);
|
|
508
|
-
|
|
509
|
-
var _autosize2 = _interopRequireDefault(_autosize);
|
|
510
|
-
|
|
511
|
-
var _lineHeight = __webpack_require__(14);
|
|
512
|
-
|
|
513
|
-
var _lineHeight2 = _interopRequireDefault(_lineHeight);
|
|
514
|
-
|
|
515
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
516
|
-
|
|
517
|
-
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; }
|
|
518
|
-
|
|
519
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
520
|
-
|
|
521
|
-
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; }
|
|
522
|
-
|
|
523
|
-
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; }
|
|
524
|
-
|
|
525
|
-
var UPDATE = 'autosize:update',
|
|
526
|
-
DESTROY = 'autosize:destroy',
|
|
527
|
-
RESIZED = 'autosize:resized';
|
|
528
|
-
|
|
529
|
-
/** A light replacement for built-in textarea component
|
|
530
|
-
* which automaticaly adjusts its height to match the content
|
|
531
|
-
* @param onResize - called whenever the textarea resizes
|
|
532
|
-
* @param rows - minimum number of visible rows
|
|
533
|
-
* @param maxRows - maximum number of visible rows
|
|
534
|
-
* @param innerRef - called with the ref to the DOM node
|
|
535
|
-
*/
|
|
536
|
-
var TextareaAutosize = (_temp2 = _class = function (_React$Component) {
|
|
537
|
-
_inherits(TextareaAutosize, _React$Component);
|
|
538
|
-
|
|
539
|
-
function TextareaAutosize() {
|
|
540
|
-
var _ref;
|
|
541
|
-
|
|
542
|
-
var _temp, _this, _ret;
|
|
543
|
-
|
|
544
|
-
_classCallCheck(this, TextareaAutosize);
|
|
545
|
-
|
|
546
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
547
|
-
args[_key] = arguments[_key];
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TextareaAutosize.__proto__ || Object.getPrototypeOf(TextareaAutosize)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
|
551
|
-
lineHeight: null
|
|
552
|
-
}, _this.dispatchEvent = function (EVENT_TYPE) {
|
|
553
|
-
var event = document.createEvent('Event');
|
|
554
|
-
event.initEvent(EVENT_TYPE, true, false);
|
|
555
|
-
|
|
556
|
-
_this.textarea.dispatchEvent(event);
|
|
557
|
-
}, _this.getValue = function (_ref2) {
|
|
558
|
-
var valueLink = _ref2.valueLink,
|
|
559
|
-
value = _ref2.value;
|
|
560
|
-
return valueLink ? valueLink.value : value;
|
|
561
|
-
}, _this.updateLineHeight = function () {
|
|
562
|
-
_this.setState({
|
|
563
|
-
lineHeight: (0, _lineHeight2.default)(_this.textarea)
|
|
564
|
-
});
|
|
565
|
-
}, _this.onChange = function (e) {
|
|
566
|
-
_this.currentValue = e.target.value;
|
|
567
|
-
_this.props.onChange && _this.props.onChange(e);
|
|
568
|
-
}, _this.saveDOMNodeRef = function (ref) {
|
|
569
|
-
var innerRef = _this.props.innerRef;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (innerRef) {
|
|
573
|
-
innerRef(ref);
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
_this.textarea = ref;
|
|
577
|
-
}, _this.getLocals = function () {
|
|
578
|
-
var _this2 = _this,
|
|
579
|
-
_this2$props = _this2.props,
|
|
580
|
-
onResize = _this2$props.onResize,
|
|
581
|
-
maxRows = _this2$props.maxRows,
|
|
582
|
-
onChange = _this2$props.onChange,
|
|
583
|
-
style = _this2$props.style,
|
|
584
|
-
innerRef = _this2$props.innerRef,
|
|
585
|
-
props = _objectWithoutProperties(_this2$props, ['onResize', 'maxRows', 'onChange', 'style', 'innerRef']),
|
|
586
|
-
lineHeight = _this2.state.lineHeight,
|
|
587
|
-
saveDOMNodeRef = _this2.saveDOMNodeRef;
|
|
588
|
-
|
|
589
|
-
var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
|
|
590
|
-
|
|
591
|
-
return _extends({}, props, {
|
|
592
|
-
saveDOMNodeRef: saveDOMNodeRef,
|
|
593
|
-
style: maxHeight ? _extends({}, style, { maxHeight: maxHeight }) : style,
|
|
594
|
-
onChange: _this.onChange
|
|
595
|
-
});
|
|
596
|
-
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
_createClass(TextareaAutosize, [{
|
|
600
|
-
key: 'componentDidMount',
|
|
601
|
-
value: function componentDidMount() {
|
|
602
|
-
var _this3 = this;
|
|
603
|
-
|
|
604
|
-
var _props = this.props,
|
|
605
|
-
onResize = _props.onResize,
|
|
606
|
-
maxRows = _props.maxRows;
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
if (typeof maxRows === 'number') {
|
|
610
|
-
this.updateLineHeight();
|
|
611
|
-
|
|
612
|
-
// this trick is needed to force "autosize" to activate the scrollbar
|
|
613
|
-
setTimeout(function () {
|
|
614
|
-
return (0, _autosize2.default)(_this3.textarea);
|
|
615
|
-
});
|
|
616
|
-
} else {
|
|
617
|
-
(0, _autosize2.default)(this.textarea);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
if (onResize) {
|
|
621
|
-
this.textarea.addEventListener(RESIZED, this.props.onResize);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}, {
|
|
625
|
-
key: 'componentWillUnmount',
|
|
626
|
-
value: function componentWillUnmount() {
|
|
627
|
-
if (this.props.onResize) {
|
|
628
|
-
this.textarea.removeEventListener(RESIZED, this.props.onResize);
|
|
629
|
-
}
|
|
630
|
-
this.dispatchEvent(DESTROY);
|
|
631
|
-
}
|
|
632
|
-
}, {
|
|
633
|
-
key: 'render',
|
|
634
|
-
value: function render() {
|
|
635
|
-
var _getLocals = this.getLocals(),
|
|
636
|
-
children = _getLocals.children,
|
|
637
|
-
saveDOMNodeRef = _getLocals.saveDOMNodeRef,
|
|
638
|
-
locals = _objectWithoutProperties(_getLocals, ['children', 'saveDOMNodeRef']);
|
|
639
|
-
|
|
640
|
-
return _react2.default.createElement(
|
|
641
|
-
'textarea',
|
|
642
|
-
_extends({}, locals, { ref: saveDOMNodeRef }),
|
|
643
|
-
children
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
}, {
|
|
647
|
-
key: 'componentDidUpdate',
|
|
648
|
-
value: function componentDidUpdate() {
|
|
649
|
-
if (this.getValue(this.props) !== this.currentValue) {
|
|
650
|
-
this.dispatchEvent(UPDATE);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}]);
|
|
654
|
-
|
|
655
|
-
return TextareaAutosize;
|
|
656
|
-
}(_react2.default.Component), _class.defaultProps = {
|
|
657
|
-
rows: 1
|
|
658
|
-
}, _temp2);
|
|
659
|
-
exports.default = TextareaAutosize;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
TextareaAutosize.propTypes = {
|
|
663
|
-
rows: _propTypes2.default.number,
|
|
664
|
-
maxRows: _propTypes2.default.number,
|
|
665
|
-
onResize: _propTypes2.default.func,
|
|
666
|
-
innerRef: _propTypes2.default.func
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
/***/ }),
|
|
670
|
-
/* 8 */
|
|
671
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
675
|
-
*
|
|
676
|
-
* This source code is licensed under the MIT license found in the
|
|
677
|
-
* LICENSE file in the root directory of this source tree.
|
|
678
|
-
*/
|
|
679
|
-
|
|
680
|
-
if (true) {
|
|
681
|
-
var ReactIs = __webpack_require__(1);
|
|
682
|
-
|
|
683
|
-
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
684
|
-
// http://fb.me/prop-types-in-prod
|
|
685
|
-
var throwOnDirectAccess = true;
|
|
686
|
-
module.exports = __webpack_require__(10)(ReactIs.isElement, throwOnDirectAccess);
|
|
687
|
-
} else {
|
|
688
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
689
|
-
// http://fb.me/prop-types-in-prod
|
|
690
|
-
module.exports = require('./factoryWithThrowingShims')();
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
/***/ }),
|
|
695
|
-
/* 9 */
|
|
696
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
697
|
-
|
|
698
|
-
"use strict";
|
|
699
|
-
/** @license React v16.13.1
|
|
700
|
-
* react-is.development.js
|
|
701
|
-
*
|
|
702
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
703
|
-
*
|
|
704
|
-
* This source code is licensed under the MIT license found in the
|
|
705
|
-
* LICENSE file in the root directory of this source tree.
|
|
706
|
-
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
if (true) {
|
|
713
|
-
(function() {
|
|
714
|
-
'use strict';
|
|
715
|
-
|
|
716
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
717
|
-
// nor polyfill, then a plain number is used for performance.
|
|
718
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
719
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
720
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
721
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
722
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
723
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
724
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
725
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
726
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
727
|
-
|
|
728
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
729
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
730
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
731
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
732
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
733
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
734
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
735
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
736
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
737
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
738
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
739
|
-
|
|
740
|
-
function isValidElementType(type) {
|
|
741
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
742
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
function typeOf(object) {
|
|
746
|
-
if (typeof object === 'object' && object !== null) {
|
|
747
|
-
var $$typeof = object.$$typeof;
|
|
748
|
-
|
|
749
|
-
switch ($$typeof) {
|
|
750
|
-
case REACT_ELEMENT_TYPE:
|
|
751
|
-
var type = object.type;
|
|
752
|
-
|
|
753
|
-
switch (type) {
|
|
754
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
755
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
756
|
-
case REACT_FRAGMENT_TYPE:
|
|
757
|
-
case REACT_PROFILER_TYPE:
|
|
758
|
-
case REACT_STRICT_MODE_TYPE:
|
|
759
|
-
case REACT_SUSPENSE_TYPE:
|
|
760
|
-
return type;
|
|
761
|
-
|
|
762
|
-
default:
|
|
763
|
-
var $$typeofType = type && type.$$typeof;
|
|
764
|
-
|
|
765
|
-
switch ($$typeofType) {
|
|
766
|
-
case REACT_CONTEXT_TYPE:
|
|
767
|
-
case REACT_FORWARD_REF_TYPE:
|
|
768
|
-
case REACT_LAZY_TYPE:
|
|
769
|
-
case REACT_MEMO_TYPE:
|
|
770
|
-
case REACT_PROVIDER_TYPE:
|
|
771
|
-
return $$typeofType;
|
|
772
|
-
|
|
773
|
-
default:
|
|
774
|
-
return $$typeof;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
case REACT_PORTAL_TYPE:
|
|
780
|
-
return $$typeof;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
return undefined;
|
|
785
|
-
} // AsyncMode is deprecated along with isAsyncMode
|
|
786
|
-
|
|
787
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
788
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
789
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
790
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
791
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
792
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
793
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
794
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
795
|
-
var Memo = REACT_MEMO_TYPE;
|
|
796
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
797
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
798
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
799
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
800
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
801
|
-
|
|
802
|
-
function isAsyncMode(object) {
|
|
803
|
-
{
|
|
804
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
805
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
806
|
-
|
|
807
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
812
|
-
}
|
|
813
|
-
function isConcurrentMode(object) {
|
|
814
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
815
|
-
}
|
|
816
|
-
function isContextConsumer(object) {
|
|
817
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
818
|
-
}
|
|
819
|
-
function isContextProvider(object) {
|
|
820
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
821
|
-
}
|
|
822
|
-
function isElement(object) {
|
|
823
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
824
|
-
}
|
|
825
|
-
function isForwardRef(object) {
|
|
826
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
827
|
-
}
|
|
828
|
-
function isFragment(object) {
|
|
829
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
830
|
-
}
|
|
831
|
-
function isLazy(object) {
|
|
832
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
833
|
-
}
|
|
834
|
-
function isMemo(object) {
|
|
835
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
836
|
-
}
|
|
837
|
-
function isPortal(object) {
|
|
838
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
839
|
-
}
|
|
840
|
-
function isProfiler(object) {
|
|
841
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
842
|
-
}
|
|
843
|
-
function isStrictMode(object) {
|
|
844
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
845
|
-
}
|
|
846
|
-
function isSuspense(object) {
|
|
847
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
exports.AsyncMode = AsyncMode;
|
|
851
|
-
exports.ConcurrentMode = ConcurrentMode;
|
|
852
|
-
exports.ContextConsumer = ContextConsumer;
|
|
853
|
-
exports.ContextProvider = ContextProvider;
|
|
854
|
-
exports.Element = Element;
|
|
855
|
-
exports.ForwardRef = ForwardRef;
|
|
856
|
-
exports.Fragment = Fragment;
|
|
857
|
-
exports.Lazy = Lazy;
|
|
858
|
-
exports.Memo = Memo;
|
|
859
|
-
exports.Portal = Portal;
|
|
860
|
-
exports.Profiler = Profiler;
|
|
861
|
-
exports.StrictMode = StrictMode;
|
|
862
|
-
exports.Suspense = Suspense;
|
|
863
|
-
exports.isAsyncMode = isAsyncMode;
|
|
864
|
-
exports.isConcurrentMode = isConcurrentMode;
|
|
865
|
-
exports.isContextConsumer = isContextConsumer;
|
|
866
|
-
exports.isContextProvider = isContextProvider;
|
|
867
|
-
exports.isElement = isElement;
|
|
868
|
-
exports.isForwardRef = isForwardRef;
|
|
869
|
-
exports.isFragment = isFragment;
|
|
870
|
-
exports.isLazy = isLazy;
|
|
871
|
-
exports.isMemo = isMemo;
|
|
872
|
-
exports.isPortal = isPortal;
|
|
873
|
-
exports.isProfiler = isProfiler;
|
|
874
|
-
exports.isStrictMode = isStrictMode;
|
|
875
|
-
exports.isSuspense = isSuspense;
|
|
876
|
-
exports.isValidElementType = isValidElementType;
|
|
877
|
-
exports.typeOf = typeOf;
|
|
878
|
-
})();
|
|
879
|
-
}
|
|
407
|
+
return SelectInput;
|
|
408
|
+
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]);
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
SelectInput.defaultProps = {
|
|
414
|
+
uniqueKey: 'react-select-input',
|
|
415
|
+
value: '',
|
|
416
|
+
valueKey: 'value',
|
|
417
|
+
labelKey: 'label',
|
|
418
|
+
placeholder: 'Enter text',
|
|
419
|
+
openUp: false,
|
|
420
|
+
disableEnter: true,
|
|
421
|
+
collapseOnBlur: true,
|
|
422
|
+
collapseOnEscape: true,
|
|
423
|
+
collapseOnSelect: true,
|
|
424
|
+
autoFocus: true,
|
|
425
|
+
clearable: true,
|
|
426
|
+
options: []
|
|
427
|
+
};
|
|
880
428
|
|
|
429
|
+
SelectInput.propTypes = {
|
|
430
|
+
uniqueKey: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
|
|
431
|
+
value: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
|
|
432
|
+
valueKey: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
|
|
433
|
+
labelKey: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
|
|
434
|
+
placeholder: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string,
|
|
435
|
+
openUp: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
436
|
+
disableEnter: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
437
|
+
collapseOnBlur: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
438
|
+
collapseOnEscape: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
439
|
+
collapseOnSelect: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
440
|
+
autoFocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
441
|
+
clearable: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool,
|
|
442
|
+
options: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.array,
|
|
443
|
+
onChange: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
444
|
+
onSelect: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
445
|
+
onFocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
446
|
+
onBlur: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
447
|
+
onKeyUp: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
448
|
+
onKeyDown: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
449
|
+
onClear: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func,
|
|
450
|
+
noOptions: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node
|
|
451
|
+
};
|
|
881
452
|
|
|
882
453
|
/***/ }),
|
|
883
|
-
/*
|
|
454
|
+
/* 5 */
|
|
884
455
|
/***/ (function(module, exports, __webpack_require__) {
|
|
885
456
|
|
|
886
457
|
"use strict";
|
|
@@ -893,12 +464,10 @@ exports.typeOf = typeOf;
|
|
|
893
464
|
|
|
894
465
|
|
|
895
466
|
|
|
896
|
-
var
|
|
897
|
-
var assign = __webpack_require__(11);
|
|
467
|
+
var assign = __webpack_require__(6);
|
|
898
468
|
|
|
899
469
|
var ReactPropTypesSecret = __webpack_require__(2);
|
|
900
|
-
var
|
|
901
|
-
var checkPropTypes = __webpack_require__(12);
|
|
470
|
+
var checkPropTypes = __webpack_require__(7);
|
|
902
471
|
|
|
903
472
|
var printWarning = function() {};
|
|
904
473
|
|
|
@@ -1000,7 +569,6 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1000
569
|
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
1001
570
|
var ReactPropTypes = {
|
|
1002
571
|
array: createPrimitiveTypeChecker('array'),
|
|
1003
|
-
bigint: createPrimitiveTypeChecker('bigint'),
|
|
1004
572
|
bool: createPrimitiveTypeChecker('boolean'),
|
|
1005
573
|
func: createPrimitiveTypeChecker('function'),
|
|
1006
574
|
number: createPrimitiveTypeChecker('number'),
|
|
@@ -1011,7 +579,6 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1011
579
|
any: createAnyTypeChecker(),
|
|
1012
580
|
arrayOf: createArrayOfTypeChecker,
|
|
1013
581
|
element: createElementTypeChecker(),
|
|
1014
|
-
elementType: createElementTypeTypeChecker(),
|
|
1015
582
|
instanceOf: createInstanceTypeChecker,
|
|
1016
583
|
node: createNodeChecker(),
|
|
1017
584
|
objectOf: createObjectOfTypeChecker,
|
|
@@ -1046,9 +613,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1046
613
|
* is prohibitively expensive if they are created too often, such as what
|
|
1047
614
|
* happens in oneOfType() for any type before the one that matched.
|
|
1048
615
|
*/
|
|
1049
|
-
function PropTypeError(message
|
|
616
|
+
function PropTypeError(message) {
|
|
1050
617
|
this.message = message;
|
|
1051
|
-
this.data = data && typeof data === 'object' ? data: {};
|
|
1052
618
|
this.stack = '';
|
|
1053
619
|
}
|
|
1054
620
|
// Make `instanceof Error` still work for returned errors.
|
|
@@ -1083,7 +649,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1083
649
|
) {
|
|
1084
650
|
printWarning(
|
|
1085
651
|
'You are manually calling a React.PropTypes validation ' +
|
|
1086
|
-
'function for the `' + propFullName + '` prop on `' + componentName
|
|
652
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
1087
653
|
'and will throw in the standalone `prop-types` package. ' +
|
|
1088
654
|
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
1089
655
|
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
@@ -1122,10 +688,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1122
688
|
// 'of type `object`'.
|
|
1123
689
|
var preciseType = getPreciseType(propValue);
|
|
1124
690
|
|
|
1125
|
-
return new PropTypeError(
|
|
1126
|
-
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
1127
|
-
{expectedType: expectedType}
|
|
1128
|
-
);
|
|
691
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
1129
692
|
}
|
|
1130
693
|
return null;
|
|
1131
694
|
}
|
|
@@ -1169,18 +732,6 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1169
732
|
return createChainableTypeChecker(validate);
|
|
1170
733
|
}
|
|
1171
734
|
|
|
1172
|
-
function createElementTypeTypeChecker() {
|
|
1173
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1174
|
-
var propValue = props[propName];
|
|
1175
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
1176
|
-
var propType = getPropType(propValue);
|
|
1177
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
1178
|
-
}
|
|
1179
|
-
return null;
|
|
1180
|
-
}
|
|
1181
|
-
return createChainableTypeChecker(validate);
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
735
|
function createInstanceTypeChecker(expectedClass) {
|
|
1185
736
|
function validate(props, propName, componentName, location, propFullName) {
|
|
1186
737
|
if (!(props[propName] instanceof expectedClass)) {
|
|
@@ -1195,16 +746,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1195
746
|
|
|
1196
747
|
function createEnumTypeChecker(expectedValues) {
|
|
1197
748
|
if (!Array.isArray(expectedValues)) {
|
|
1198
|
-
|
|
1199
|
-
if (arguments.length > 1) {
|
|
1200
|
-
printWarning(
|
|
1201
|
-
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
1202
|
-
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
1203
|
-
);
|
|
1204
|
-
} else {
|
|
1205
|
-
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
749
|
+
true ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
|
1208
750
|
return emptyFunctionThatReturnsNull;
|
|
1209
751
|
}
|
|
1210
752
|
|
|
@@ -1216,14 +758,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1216
758
|
}
|
|
1217
759
|
}
|
|
1218
760
|
|
|
1219
|
-
var valuesString = JSON.stringify(expectedValues
|
|
1220
|
-
|
|
1221
|
-
if (type === 'symbol') {
|
|
1222
|
-
return String(value);
|
|
1223
|
-
}
|
|
1224
|
-
return value;
|
|
1225
|
-
});
|
|
1226
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
761
|
+
var valuesString = JSON.stringify(expectedValues);
|
|
762
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
1227
763
|
}
|
|
1228
764
|
return createChainableTypeChecker(validate);
|
|
1229
765
|
}
|
|
@@ -1239,7 +775,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1239
775
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
1240
776
|
}
|
|
1241
777
|
for (var key in propValue) {
|
|
1242
|
-
if (
|
|
778
|
+
if (propValue.hasOwnProperty(key)) {
|
|
1243
779
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1244
780
|
if (error instanceof Error) {
|
|
1245
781
|
return error;
|
|
@@ -1269,19 +805,14 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1269
805
|
}
|
|
1270
806
|
|
|
1271
807
|
function validate(props, propName, componentName, location, propFullName) {
|
|
1272
|
-
var expectedTypes = [];
|
|
1273
808
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1274
809
|
var checker = arrayOfTypeCheckers[i];
|
|
1275
|
-
|
|
1276
|
-
if (checkerResult == null) {
|
|
810
|
+
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
|
1277
811
|
return null;
|
|
1278
812
|
}
|
|
1279
|
-
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1280
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
1281
|
-
}
|
|
1282
813
|
}
|
|
1283
|
-
|
|
1284
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '
|
|
814
|
+
|
|
815
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
1285
816
|
}
|
|
1286
817
|
return createChainableTypeChecker(validate);
|
|
1287
818
|
}
|
|
@@ -1296,13 +827,6 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1296
827
|
return createChainableTypeChecker(validate);
|
|
1297
828
|
}
|
|
1298
829
|
|
|
1299
|
-
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1300
|
-
return new PropTypeError(
|
|
1301
|
-
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
1302
|
-
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
1303
|
-
);
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
830
|
function createShapeTypeChecker(shapeTypes) {
|
|
1307
831
|
function validate(props, propName, componentName, location, propFullName) {
|
|
1308
832
|
var propValue = props[propName];
|
|
@@ -1312,8 +836,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1312
836
|
}
|
|
1313
837
|
for (var key in shapeTypes) {
|
|
1314
838
|
var checker = shapeTypes[key];
|
|
1315
|
-
if (
|
|
1316
|
-
|
|
839
|
+
if (!checker) {
|
|
840
|
+
continue;
|
|
1317
841
|
}
|
|
1318
842
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1319
843
|
if (error) {
|
|
@@ -1332,18 +856,16 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1332
856
|
if (propType !== 'object') {
|
|
1333
857
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1334
858
|
}
|
|
1335
|
-
// We need to check all keys in case some are required but missing from
|
|
859
|
+
// We need to check all keys in case some are required but missing from
|
|
860
|
+
// props.
|
|
1336
861
|
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1337
862
|
for (var key in allKeys) {
|
|
1338
863
|
var checker = shapeTypes[key];
|
|
1339
|
-
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1340
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1341
|
-
}
|
|
1342
864
|
if (!checker) {
|
|
1343
865
|
return new PropTypeError(
|
|
1344
866
|
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1345
867
|
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1346
|
-
'\nValid keys: ' +
|
|
868
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1347
869
|
);
|
|
1348
870
|
}
|
|
1349
871
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
@@ -1410,11 +932,6 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1410
932
|
return true;
|
|
1411
933
|
}
|
|
1412
934
|
|
|
1413
|
-
// falsy value can't be a Symbol
|
|
1414
|
-
if (!propValue) {
|
|
1415
|
-
return false;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
935
|
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1419
936
|
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1420
937
|
return true;
|
|
@@ -1489,7 +1006,6 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1489
1006
|
}
|
|
1490
1007
|
|
|
1491
1008
|
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1492
|
-
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1493
1009
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1494
1010
|
|
|
1495
1011
|
return ReactPropTypes;
|
|
@@ -1497,7 +1013,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
1497
1013
|
|
|
1498
1014
|
|
|
1499
1015
|
/***/ }),
|
|
1500
|
-
/*
|
|
1016
|
+
/* 6 */
|
|
1501
1017
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1502
1018
|
|
|
1503
1019
|
"use strict";
|
|
@@ -1594,7 +1110,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
|
|
1594
1110
|
|
|
1595
1111
|
|
|
1596
1112
|
/***/ }),
|
|
1597
|
-
/*
|
|
1113
|
+
/* 7 */
|
|
1598
1114
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1599
1115
|
|
|
1600
1116
|
"use strict";
|
|
@@ -1612,7 +1128,6 @@ var printWarning = function() {};
|
|
|
1612
1128
|
if (true) {
|
|
1613
1129
|
var ReactPropTypesSecret = __webpack_require__(2);
|
|
1614
1130
|
var loggedTypeFailures = {};
|
|
1615
|
-
var has = __webpack_require__(3);
|
|
1616
1131
|
|
|
1617
1132
|
printWarning = function(text) {
|
|
1618
1133
|
var message = 'Warning: ' + text;
|
|
@@ -1624,7 +1139,7 @@ if (true) {
|
|
|
1624
1139
|
// This error was thrown as a convenience so that you can use this stack
|
|
1625
1140
|
// to find the callsite that caused this warning to fire.
|
|
1626
1141
|
throw new Error(message);
|
|
1627
|
-
} catch (x) {
|
|
1142
|
+
} catch (x) {}
|
|
1628
1143
|
};
|
|
1629
1144
|
}
|
|
1630
1145
|
|
|
@@ -1642,7 +1157,7 @@ if (true) {
|
|
|
1642
1157
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1643
1158
|
if (true) {
|
|
1644
1159
|
for (var typeSpecName in typeSpecs) {
|
|
1645
|
-
if (
|
|
1160
|
+
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
1646
1161
|
var error;
|
|
1647
1162
|
// Prop type validation may throw. In case they do, we don't want to
|
|
1648
1163
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -1653,8 +1168,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1653
1168
|
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1654
1169
|
var err = Error(
|
|
1655
1170
|
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
1656
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
1657
|
-
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
1171
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
1658
1172
|
);
|
|
1659
1173
|
err.name = 'Invariant Violation';
|
|
1660
1174
|
throw err;
|
|
@@ -1671,7 +1185,8 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1671
1185
|
'You may have forgotten to pass an argument to the type checker ' +
|
|
1672
1186
|
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
1673
1187
|
'shape all require an argument).'
|
|
1674
|
-
)
|
|
1188
|
+
)
|
|
1189
|
+
|
|
1675
1190
|
}
|
|
1676
1191
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1677
1192
|
// Only monitor this failure once because there tends to be a lot of the
|
|
@@ -1689,22 +1204,219 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1689
1204
|
}
|
|
1690
1205
|
}
|
|
1691
1206
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1207
|
+
module.exports = checkPropTypes;
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
/***/ }),
|
|
1211
|
+
/* 8 */
|
|
1212
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1213
|
+
|
|
1214
|
+
"use strict";
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1218
|
+
value: true
|
|
1219
|
+
});
|
|
1220
|
+
exports.default = undefined;
|
|
1221
|
+
|
|
1222
|
+
var _TextareaAutosize = __webpack_require__(9);
|
|
1223
|
+
|
|
1224
|
+
var _TextareaAutosize2 = _interopRequireDefault(_TextareaAutosize);
|
|
1225
|
+
|
|
1226
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1227
|
+
|
|
1228
|
+
exports.default = _TextareaAutosize2.default;
|
|
1229
|
+
|
|
1230
|
+
/***/ }),
|
|
1231
|
+
/* 9 */
|
|
1232
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1233
|
+
|
|
1234
|
+
"use strict";
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1238
|
+
value: true
|
|
1239
|
+
});
|
|
1240
|
+
exports.default = undefined;
|
|
1241
|
+
|
|
1242
|
+
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; };
|
|
1243
|
+
|
|
1244
|
+
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; }; }();
|
|
1245
|
+
|
|
1246
|
+
var _class, _temp2;
|
|
1247
|
+
|
|
1248
|
+
var _react = __webpack_require__(0);
|
|
1249
|
+
|
|
1250
|
+
var _react2 = _interopRequireDefault(_react);
|
|
1251
|
+
|
|
1252
|
+
var _propTypes = __webpack_require__(1);
|
|
1253
|
+
|
|
1254
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
1255
|
+
|
|
1256
|
+
var _autosize = __webpack_require__(10);
|
|
1257
|
+
|
|
1258
|
+
var _autosize2 = _interopRequireDefault(_autosize);
|
|
1259
|
+
|
|
1260
|
+
var _lineHeight = __webpack_require__(11);
|
|
1261
|
+
|
|
1262
|
+
var _lineHeight2 = _interopRequireDefault(_lineHeight);
|
|
1263
|
+
|
|
1264
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1265
|
+
|
|
1266
|
+
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; }
|
|
1267
|
+
|
|
1268
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1269
|
+
|
|
1270
|
+
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; }
|
|
1271
|
+
|
|
1272
|
+
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; }
|
|
1273
|
+
|
|
1274
|
+
var UPDATE = 'autosize:update',
|
|
1275
|
+
DESTROY = 'autosize:destroy',
|
|
1276
|
+
RESIZED = 'autosize:resized';
|
|
1277
|
+
|
|
1278
|
+
/** A light replacement for built-in textarea component
|
|
1279
|
+
* which automaticaly adjusts its height to match the content
|
|
1280
|
+
* @param onResize - called whenever the textarea resizes
|
|
1281
|
+
* @param rows - minimum number of visible rows
|
|
1282
|
+
* @param maxRows - maximum number of visible rows
|
|
1283
|
+
* @param innerRef - called with the ref to the DOM node
|
|
1696
1284
|
*/
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1285
|
+
var TextareaAutosize = (_temp2 = _class = function (_React$Component) {
|
|
1286
|
+
_inherits(TextareaAutosize, _React$Component);
|
|
1287
|
+
|
|
1288
|
+
function TextareaAutosize() {
|
|
1289
|
+
var _ref;
|
|
1290
|
+
|
|
1291
|
+
var _temp, _this, _ret;
|
|
1292
|
+
|
|
1293
|
+
_classCallCheck(this, TextareaAutosize);
|
|
1294
|
+
|
|
1295
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1296
|
+
args[_key] = arguments[_key];
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TextareaAutosize.__proto__ || Object.getPrototypeOf(TextareaAutosize)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
|
1300
|
+
lineHeight: null
|
|
1301
|
+
}, _this.dispatchEvent = function (EVENT_TYPE) {
|
|
1302
|
+
var event = document.createEvent('Event');
|
|
1303
|
+
event.initEvent(EVENT_TYPE, true, false);
|
|
1304
|
+
|
|
1305
|
+
_this.textarea.dispatchEvent(event);
|
|
1306
|
+
}, _this.getValue = function (_ref2) {
|
|
1307
|
+
var valueLink = _ref2.valueLink,
|
|
1308
|
+
value = _ref2.value;
|
|
1309
|
+
return valueLink ? valueLink.value : value;
|
|
1310
|
+
}, _this.updateLineHeight = function () {
|
|
1311
|
+
_this.setState({
|
|
1312
|
+
lineHeight: (0, _lineHeight2.default)(_this.textarea)
|
|
1313
|
+
});
|
|
1314
|
+
}, _this.onChange = function (e) {
|
|
1315
|
+
_this.currentValue = e.target.value;
|
|
1316
|
+
_this.props.onChange && _this.props.onChange(e);
|
|
1317
|
+
}, _this.saveDOMNodeRef = function (ref) {
|
|
1318
|
+
var innerRef = _this.props.innerRef;
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
if (innerRef) {
|
|
1322
|
+
innerRef(ref);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
_this.textarea = ref;
|
|
1326
|
+
}, _this.getLocals = function () {
|
|
1327
|
+
var _this2 = _this,
|
|
1328
|
+
_this2$props = _this2.props,
|
|
1329
|
+
onResize = _this2$props.onResize,
|
|
1330
|
+
maxRows = _this2$props.maxRows,
|
|
1331
|
+
onChange = _this2$props.onChange,
|
|
1332
|
+
style = _this2$props.style,
|
|
1333
|
+
innerRef = _this2$props.innerRef,
|
|
1334
|
+
props = _objectWithoutProperties(_this2$props, ['onResize', 'maxRows', 'onChange', 'style', 'innerRef']),
|
|
1335
|
+
lineHeight = _this2.state.lineHeight,
|
|
1336
|
+
saveDOMNodeRef = _this2.saveDOMNodeRef;
|
|
1337
|
+
|
|
1338
|
+
var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
|
|
1339
|
+
|
|
1340
|
+
return _extends({}, props, {
|
|
1341
|
+
saveDOMNodeRef: saveDOMNodeRef,
|
|
1342
|
+
style: maxHeight ? _extends({}, style, { maxHeight: maxHeight }) : style,
|
|
1343
|
+
onChange: _this.onChange
|
|
1344
|
+
});
|
|
1345
|
+
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
1700
1346
|
}
|
|
1701
|
-
}
|
|
1702
1347
|
|
|
1703
|
-
|
|
1348
|
+
_createClass(TextareaAutosize, [{
|
|
1349
|
+
key: 'componentDidMount',
|
|
1350
|
+
value: function componentDidMount() {
|
|
1351
|
+
var _this3 = this;
|
|
1352
|
+
|
|
1353
|
+
var _props = this.props,
|
|
1354
|
+
onResize = _props.onResize,
|
|
1355
|
+
maxRows = _props.maxRows;
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
if (typeof maxRows === 'number') {
|
|
1359
|
+
this.updateLineHeight();
|
|
1360
|
+
|
|
1361
|
+
// this trick is needed to force "autosize" to activate the scrollbar
|
|
1362
|
+
setTimeout(function () {
|
|
1363
|
+
return (0, _autosize2.default)(_this3.textarea);
|
|
1364
|
+
});
|
|
1365
|
+
} else {
|
|
1366
|
+
(0, _autosize2.default)(this.textarea);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
if (onResize) {
|
|
1370
|
+
this.textarea.addEventListener(RESIZED, this.props.onResize);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}, {
|
|
1374
|
+
key: 'componentWillUnmount',
|
|
1375
|
+
value: function componentWillUnmount() {
|
|
1376
|
+
if (this.props.onResize) {
|
|
1377
|
+
this.textarea.removeEventListener(RESIZED, this.props.onResize);
|
|
1378
|
+
}
|
|
1379
|
+
this.dispatchEvent(DESTROY);
|
|
1380
|
+
}
|
|
1381
|
+
}, {
|
|
1382
|
+
key: 'render',
|
|
1383
|
+
value: function render() {
|
|
1384
|
+
var _getLocals = this.getLocals(),
|
|
1385
|
+
children = _getLocals.children,
|
|
1386
|
+
saveDOMNodeRef = _getLocals.saveDOMNodeRef,
|
|
1387
|
+
locals = _objectWithoutProperties(_getLocals, ['children', 'saveDOMNodeRef']);
|
|
1388
|
+
|
|
1389
|
+
return _react2.default.createElement(
|
|
1390
|
+
'textarea',
|
|
1391
|
+
_extends({}, locals, { ref: saveDOMNodeRef }),
|
|
1392
|
+
children
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
}, {
|
|
1396
|
+
key: 'componentDidUpdate',
|
|
1397
|
+
value: function componentDidUpdate() {
|
|
1398
|
+
if (this.getValue(this.props) !== this.currentValue) {
|
|
1399
|
+
this.dispatchEvent(UPDATE);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
}]);
|
|
1704
1403
|
|
|
1404
|
+
return TextareaAutosize;
|
|
1405
|
+
}(_react2.default.Component), _class.defaultProps = {
|
|
1406
|
+
rows: 1
|
|
1407
|
+
}, _temp2);
|
|
1408
|
+
exports.default = TextareaAutosize;
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
TextareaAutosize.propTypes = {
|
|
1412
|
+
rows: _propTypes2.default.number,
|
|
1413
|
+
maxRows: _propTypes2.default.number,
|
|
1414
|
+
onResize: _propTypes2.default.func,
|
|
1415
|
+
innerRef: _propTypes2.default.func
|
|
1416
|
+
};
|
|
1705
1417
|
|
|
1706
1418
|
/***/ }),
|
|
1707
|
-
/*
|
|
1419
|
+
/* 10 */
|
|
1708
1420
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1709
1421
|
|
|
1710
1422
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
@@ -2004,11 +1716,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
2004
1716
|
});
|
|
2005
1717
|
|
|
2006
1718
|
/***/ }),
|
|
2007
|
-
/*
|
|
1719
|
+
/* 11 */
|
|
2008
1720
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2009
1721
|
|
|
2010
1722
|
// Load in dependencies
|
|
2011
|
-
var computedStyle = __webpack_require__(
|
|
1723
|
+
var computedStyle = __webpack_require__(12);
|
|
2012
1724
|
|
|
2013
1725
|
/**
|
|
2014
1726
|
* Calculate the `line-height` of a given node
|
|
@@ -2107,7 +1819,7 @@ module.exports = lineHeight;
|
|
|
2107
1819
|
|
|
2108
1820
|
|
|
2109
1821
|
/***/ }),
|
|
2110
|
-
/*
|
|
1822
|
+
/* 12 */
|
|
2111
1823
|
/***/ (function(module, exports) {
|
|
2112
1824
|
|
|
2113
1825
|
// This code has been refactored for 140 bytes
|