@kne/super-select 0.1.9 → 0.1.11

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.
@@ -1,9 +1,9 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { forwardRef, useState, useImperativeHandle, useEffect, useRef, Fragment } from 'react';
2
2
  import { createContext } from '@kne/global-context';
3
3
  import useResize from '@kne/use-resize';
4
4
  import useControlValue from '@kne/use-control-value';
5
5
  import classnames from 'classnames';
6
- import { Modal, App, Dropdown, Flex, Tag, Checkbox, List } from 'antd';
6
+ import { Modal, App, Dropdown, Flex, Tag, Checkbox, List, Row, Col, Button, Popover } from 'antd';
7
7
  import { CloseCircleFilled, DownOutlined, CheckOutlined } from '@ant-design/icons';
8
8
  import SimpleBar from 'simplebar-react';
9
9
  import 'simplebar-react/dist/simplebar.min.css';
@@ -316,17 +316,17 @@ var Symbol = _root.Symbol;
316
316
  var _Symbol = Symbol;
317
317
 
318
318
  /** Used for built-in method references. */
319
- var objectProto$e = Object.prototype;
319
+ var objectProto$b = Object.prototype;
320
320
 
321
321
  /** Used to check objects for own properties. */
322
- var hasOwnProperty$b = objectProto$e.hasOwnProperty;
322
+ var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
323
323
 
324
324
  /**
325
325
  * Used to resolve the
326
326
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
327
327
  * of values.
328
328
  */
329
- var nativeObjectToString$1 = objectProto$e.toString;
329
+ var nativeObjectToString$1 = objectProto$b.toString;
330
330
 
331
331
  /** Built-in value references. */
332
332
  var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
@@ -339,7 +339,7 @@ var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
339
339
  * @returns {string} Returns the raw `toStringTag`.
340
340
  */
341
341
  function getRawTag(value) {
342
- var isOwn = hasOwnProperty$b.call(value, symToStringTag$1),
342
+ var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
343
343
  tag = value[symToStringTag$1];
344
344
 
345
345
  try {
@@ -361,14 +361,14 @@ function getRawTag(value) {
361
361
  var _getRawTag = getRawTag;
362
362
 
363
363
  /** Used for built-in method references. */
364
- var objectProto$d = Object.prototype;
364
+ var objectProto$a = Object.prototype;
365
365
 
366
366
  /**
367
367
  * Used to resolve the
368
368
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
369
369
  * of values.
370
370
  */
371
- var nativeObjectToString = objectProto$d.toString;
371
+ var nativeObjectToString = objectProto$a.toString;
372
372
 
373
373
  /**
374
374
  * Converts `value` to a string using `Object.prototype.toString`.
@@ -500,10 +500,10 @@ function isMasked(func) {
500
500
  var _isMasked = isMasked;
501
501
 
502
502
  /** Used for built-in method references. */
503
- var funcProto$2 = Function.prototype;
503
+ var funcProto$1 = Function.prototype;
504
504
 
505
505
  /** Used to resolve the decompiled source of functions. */
506
- var funcToString$2 = funcProto$2.toString;
506
+ var funcToString$1 = funcProto$1.toString;
507
507
 
508
508
  /**
509
509
  * Converts `func` to its source code.
@@ -515,7 +515,7 @@ var funcToString$2 = funcProto$2.toString;
515
515
  function toSource(func) {
516
516
  if (func != null) {
517
517
  try {
518
- return funcToString$2.call(func);
518
+ return funcToString$1.call(func);
519
519
  } catch (e) {}
520
520
  try {
521
521
  return (func + '');
@@ -536,18 +536,18 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
536
536
  var reIsHostCtor = /^\[object .+?Constructor\]$/;
537
537
 
538
538
  /** Used for built-in method references. */
539
- var funcProto$1 = Function.prototype,
540
- objectProto$c = Object.prototype;
539
+ var funcProto = Function.prototype,
540
+ objectProto$9 = Object.prototype;
541
541
 
542
542
  /** Used to resolve the decompiled source of functions. */
543
- var funcToString$1 = funcProto$1.toString;
543
+ var funcToString = funcProto.toString;
544
544
 
545
545
  /** Used to check objects for own properties. */
546
- var hasOwnProperty$a = objectProto$c.hasOwnProperty;
546
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
547
547
 
548
548
  /** Used to detect if a method is native. */
549
549
  var reIsNative = RegExp('^' +
550
- funcToString$1.call(hasOwnProperty$a).replace(reRegExpChar, '\\$&')
550
+ funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
551
551
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
552
552
  );
553
553
 
@@ -644,10 +644,10 @@ var _hashDelete = hashDelete;
644
644
  var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
645
645
 
646
646
  /** Used for built-in method references. */
647
- var objectProto$b = Object.prototype;
647
+ var objectProto$8 = Object.prototype;
648
648
 
649
649
  /** Used to check objects for own properties. */
650
- var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
650
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
651
651
 
652
652
  /**
653
653
  * Gets the hash value for `key`.
@@ -664,16 +664,16 @@ function hashGet(key) {
664
664
  var result = data[key];
665
665
  return result === HASH_UNDEFINED$2 ? undefined : result;
666
666
  }
667
- return hasOwnProperty$9.call(data, key) ? data[key] : undefined;
667
+ return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
668
668
  }
669
669
 
670
670
  var _hashGet = hashGet;
671
671
 
672
672
  /** Used for built-in method references. */
673
- var objectProto$a = Object.prototype;
673
+ var objectProto$7 = Object.prototype;
674
674
 
675
675
  /** Used to check objects for own properties. */
676
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
676
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
677
677
 
678
678
  /**
679
679
  * Checks if a hash value for `key` exists.
@@ -686,7 +686,7 @@ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
686
686
  */
687
687
  function hashHas(key) {
688
688
  var data = this.__data__;
689
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$8.call(data, key);
689
+ return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
690
690
  }
691
691
 
692
692
  var _hashHas = hashHas;
@@ -1382,10 +1382,10 @@ function stubArray() {
1382
1382
  var stubArray_1 = stubArray;
1383
1383
 
1384
1384
  /** Used for built-in method references. */
1385
- var objectProto$9 = Object.prototype;
1385
+ var objectProto$6 = Object.prototype;
1386
1386
 
1387
1387
  /** Built-in value references. */
1388
- var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
1388
+ var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1389
1389
 
1390
1390
  /* Built-in method references for those with the same name as other `lodash` methods. */
1391
1391
  var nativeGetSymbols = Object.getOwnPropertySymbols;
@@ -1477,13 +1477,13 @@ function baseIsArguments(value) {
1477
1477
  var _baseIsArguments = baseIsArguments;
1478
1478
 
1479
1479
  /** Used for built-in method references. */
1480
- var objectProto$8 = Object.prototype;
1480
+ var objectProto$5 = Object.prototype;
1481
1481
 
1482
1482
  /** Used to check objects for own properties. */
1483
- var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
1483
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1484
1484
 
1485
1485
  /** Built-in value references. */
1486
- var propertyIsEnumerable = objectProto$8.propertyIsEnumerable;
1486
+ var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
1487
1487
 
1488
1488
  /**
1489
1489
  * Checks if `value` is likely an `arguments` object.
@@ -1504,7 +1504,7 @@ var propertyIsEnumerable = objectProto$8.propertyIsEnumerable;
1504
1504
  * // => false
1505
1505
  */
1506
1506
  var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
1507
- return isObjectLike_1(value) && hasOwnProperty$7.call(value, 'callee') &&
1507
+ return isObjectLike_1(value) && hasOwnProperty$4.call(value, 'callee') &&
1508
1508
  !propertyIsEnumerable.call(value, 'callee');
1509
1509
  };
1510
1510
 
@@ -1638,7 +1638,7 @@ var argsTag$1 = '[object Arguments]',
1638
1638
  funcTag = '[object Function]',
1639
1639
  mapTag$1 = '[object Map]',
1640
1640
  numberTag = '[object Number]',
1641
- objectTag$3 = '[object Object]',
1641
+ objectTag$2 = '[object Object]',
1642
1642
  regexpTag = '[object RegExp]',
1643
1643
  setTag$1 = '[object Set]',
1644
1644
  stringTag = '[object String]',
@@ -1668,7 +1668,7 @@ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1668
1668
  typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
1669
1669
  typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1670
1670
  typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
1671
- typedArrayTags[objectTag$3] = typedArrayTags[regexpTag] =
1671
+ typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
1672
1672
  typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
1673
1673
  typedArrayTags[weakMapTag$1] = false;
1674
1674
 
@@ -1757,10 +1757,10 @@ var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsType
1757
1757
  var isTypedArray_1 = isTypedArray;
1758
1758
 
1759
1759
  /** Used for built-in method references. */
1760
- var objectProto$7 = Object.prototype;
1760
+ var objectProto$4 = Object.prototype;
1761
1761
 
1762
1762
  /** Used to check objects for own properties. */
1763
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
1763
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1764
1764
 
1765
1765
  /**
1766
1766
  * Creates an array of the enumerable property names of the array-like `value`.
@@ -1780,7 +1780,7 @@ function arrayLikeKeys(value, inherited) {
1780
1780
  length = result.length;
1781
1781
 
1782
1782
  for (var key in value) {
1783
- if ((inherited || hasOwnProperty$6.call(value, key)) &&
1783
+ if ((inherited || hasOwnProperty$3.call(value, key)) &&
1784
1784
  !(skipIndexes && (
1785
1785
  // Safari 9 has enumerable `arguments.length` in strict mode.
1786
1786
  key == 'length' ||
@@ -1800,7 +1800,7 @@ function arrayLikeKeys(value, inherited) {
1800
1800
  var _arrayLikeKeys = arrayLikeKeys;
1801
1801
 
1802
1802
  /** Used for built-in method references. */
1803
- var objectProto$6 = Object.prototype;
1803
+ var objectProto$3 = Object.prototype;
1804
1804
 
1805
1805
  /**
1806
1806
  * Checks if `value` is likely a prototype object.
@@ -1811,7 +1811,7 @@ var objectProto$6 = Object.prototype;
1811
1811
  */
1812
1812
  function isPrototype(value) {
1813
1813
  var Ctor = value && value.constructor,
1814
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
1814
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
1815
1815
 
1816
1816
  return value === proto;
1817
1817
  }
@@ -1840,10 +1840,10 @@ var nativeKeys = _overArg(Object.keys, Object);
1840
1840
  var _nativeKeys = nativeKeys;
1841
1841
 
1842
1842
  /** Used for built-in method references. */
1843
- var objectProto$5 = Object.prototype;
1843
+ var objectProto$2 = Object.prototype;
1844
1844
 
1845
1845
  /** Used to check objects for own properties. */
1846
- var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
1846
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1847
1847
 
1848
1848
  /**
1849
1849
  * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
@@ -1858,7 +1858,7 @@ function baseKeys(object) {
1858
1858
  }
1859
1859
  var result = [];
1860
1860
  for (var key in Object(object)) {
1861
- if (hasOwnProperty$5.call(object, key) && key != 'constructor') {
1861
+ if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
1862
1862
  result.push(key);
1863
1863
  }
1864
1864
  }
@@ -1949,10 +1949,10 @@ var _getAllKeys = getAllKeys;
1949
1949
  var COMPARE_PARTIAL_FLAG$1 = 1;
1950
1950
 
1951
1951
  /** Used for built-in method references. */
1952
- var objectProto$4 = Object.prototype;
1952
+ var objectProto$1 = Object.prototype;
1953
1953
 
1954
1954
  /** Used to check objects for own properties. */
1955
- var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
1955
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1956
1956
 
1957
1957
  /**
1958
1958
  * A specialized version of `baseIsEqualDeep` for objects with support for
@@ -1980,7 +1980,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1980
1980
  var index = objLength;
1981
1981
  while (index--) {
1982
1982
  var key = objProps[index];
1983
- if (!(isPartial ? key in other : hasOwnProperty$4.call(other, key))) {
1983
+ if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
1984
1984
  return false;
1985
1985
  }
1986
1986
  }
@@ -2056,7 +2056,7 @@ var _WeakMap = WeakMap;
2056
2056
 
2057
2057
  /** `Object#toString` result references. */
2058
2058
  var mapTag = '[object Map]',
2059
- objectTag$2 = '[object Object]',
2059
+ objectTag$1 = '[object Object]',
2060
2060
  promiseTag = '[object Promise]',
2061
2061
  setTag = '[object Set]',
2062
2062
  weakMapTag = '[object WeakMap]';
@@ -2087,7 +2087,7 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
2087
2087
  (_WeakMap && getTag(new _WeakMap) != weakMapTag)) {
2088
2088
  getTag = function(value) {
2089
2089
  var result = _baseGetTag(value),
2090
- Ctor = result == objectTag$2 ? value.constructor : undefined,
2090
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
2091
2091
  ctorString = Ctor ? _toSource(Ctor) : '';
2092
2092
 
2093
2093
  if (ctorString) {
@@ -2111,13 +2111,13 @@ var COMPARE_PARTIAL_FLAG = 1;
2111
2111
  /** `Object#toString` result references. */
2112
2112
  var argsTag = '[object Arguments]',
2113
2113
  arrayTag = '[object Array]',
2114
- objectTag$1 = '[object Object]';
2114
+ objectTag = '[object Object]';
2115
2115
 
2116
2116
  /** Used for built-in method references. */
2117
- var objectProto$3 = Object.prototype;
2117
+ var objectProto = Object.prototype;
2118
2118
 
2119
2119
  /** Used to check objects for own properties. */
2120
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
2120
+ var hasOwnProperty = objectProto.hasOwnProperty;
2121
2121
 
2122
2122
  /**
2123
2123
  * A specialized version of `baseIsEqual` for arrays and objects which performs
@@ -2139,11 +2139,11 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2139
2139
  objTag = objIsArr ? arrayTag : _getTag(object),
2140
2140
  othTag = othIsArr ? arrayTag : _getTag(other);
2141
2141
 
2142
- objTag = objTag == argsTag ? objectTag$1 : objTag;
2143
- othTag = othTag == argsTag ? objectTag$1 : othTag;
2142
+ objTag = objTag == argsTag ? objectTag : objTag;
2143
+ othTag = othTag == argsTag ? objectTag : othTag;
2144
2144
 
2145
- var objIsObj = objTag == objectTag$1,
2146
- othIsObj = othTag == objectTag$1,
2145
+ var objIsObj = objTag == objectTag,
2146
+ othIsObj = othTag == objectTag,
2147
2147
  isSameTag = objTag == othTag;
2148
2148
 
2149
2149
  if (isSameTag && isBuffer_1(object)) {
@@ -2160,8 +2160,8 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2160
2160
  : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2161
2161
  }
2162
2162
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2163
- var objIsWrapped = objIsObj && hasOwnProperty$3.call(object, '__wrapped__'),
2164
- othIsWrapped = othIsObj && hasOwnProperty$3.call(other, '__wrapped__');
2163
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2164
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2165
2165
 
2166
2166
  if (objIsWrapped || othIsWrapped) {
2167
2167
  var objUnwrapped = objIsWrapped ? object.value() : object,
@@ -2240,7 +2240,7 @@ function isEqual(value, other) {
2240
2240
 
2241
2241
  var isEqual_1 = isEqual;
2242
2242
 
2243
- var style$3 = {"select-input":"_d8lGc","disabled":"_3kjwO","wrap":"_dsTM2","select-input-inner":"_NQoX9","large":"_T8ZX8","small":"_1B72H","select-input-icon":"_g8QC-","placeholder":"_r3q69","overlay-content":"_zEqGe","overlay":"_ybN30","select-input-prefix":"_4Pw75","select-input-suffix":"_Wd4pE"};
2243
+ var style$4 = {"select-input":"_d8lGc","disabled":"_3kjwO","wrap":"_dsTM2","select-input-inner":"_NQoX9","large":"_T8ZX8","small":"_1B72H","select-input-icon":"_g8QC-","placeholder":"_r3q69","overlay-content":"_zEqGe","overlay":"_ybN30","select-input-prefix":"_4Pw75","select-input-suffix":"_Wd4pE"};
2244
2244
 
2245
2245
  const _excluded$1 = ["children"];
2246
2246
  const numberToPx = val => {
@@ -2248,7 +2248,10 @@ const numberToPx = val => {
2248
2248
  };
2249
2249
  const pxToNumber = value => {
2250
2250
  if (!value) return 0;
2251
- const match = value.match(/^\d*(\.\d*)?/);
2251
+ if (Number.isInteger(value)) {
2252
+ return value;
2253
+ }
2254
+ const match = value.toString().match(/^\d*(\.\d*)?/);
2252
2255
  return match ? Number(match[0]) : 0;
2253
2256
  };
2254
2257
  const ModalContent = _ref => {
@@ -2279,7 +2282,7 @@ const ModalContent = _ref => {
2279
2282
  value: contextProps
2280
2283
  }, children(contextProps));
2281
2284
  };
2282
- const SelectInput = p => {
2285
+ const SelectInput = forwardRef((p, ref) => {
2283
2286
  const locale = Object.assign({}, {
2284
2287
  placeholder: '请选择',
2285
2288
  selectAll: '全选',
@@ -2299,6 +2302,8 @@ const SelectInput = p => {
2299
2302
  placeholder: locale.placeholder,
2300
2303
  searchPlaceholder: locale.search,
2301
2304
  allowSelectedAll: false,
2305
+ labelKey: 'label',
2306
+ valueKey: 'value',
2302
2307
  selectedAllValue: {
2303
2308
  value: 'all',
2304
2309
  label: locale.selectAll
@@ -2337,6 +2342,10 @@ const SelectInput = p => {
2337
2342
  }, p, {
2338
2343
  locale
2339
2344
  });
2345
+ props.selectedAllValue = {
2346
+ [props.valueKey]: props.selectedAllValue.value,
2347
+ [props.labelKey]: props.selectedAllValue.label
2348
+ };
2340
2349
  const [stateValue, setValue] = useControlValue(props);
2341
2350
  const value = stateValue || [];
2342
2351
  const [searchText, setSearchText] = useState('');
@@ -2362,7 +2371,9 @@ const SelectInput = p => {
2362
2371
  selectedAllValue,
2363
2372
  overlayWidth,
2364
2373
  placement,
2365
- renderModal
2374
+ renderModal,
2375
+ labelKey,
2376
+ valueKey
2366
2377
  } = props;
2367
2378
  const popupOverlayWidth = numberToPx(Math.max(inputWidth, pxToNumber(overlayWidth)));
2368
2379
  const {
@@ -2378,7 +2389,7 @@ const SelectInput = p => {
2378
2389
  const onRemove = (item, currentSetValue) => {
2379
2390
  (currentSetValue || setValue)(value => {
2380
2391
  const newValue = value.slice(0);
2381
- const index = value.findIndex(currentItem => currentItem.value === item.value);
2392
+ const index = value.findIndex(currentItem => currentItem[valueKey] === item[valueKey]);
2382
2393
  if (index > -1) {
2383
2394
  newValue.splice(index, 1);
2384
2395
  }
@@ -2391,7 +2402,7 @@ const SelectInput = p => {
2391
2402
  return value;
2392
2403
  }
2393
2404
  const newValue = value.slice(0);
2394
- const index = value.findIndex(currentItem => currentItem.value === item.value);
2405
+ const index = value.findIndex(currentItem => currentItem[valueKey] === item[valueKey]);
2395
2406
  if (index === -1) {
2396
2407
  newValue.push(item);
2397
2408
  }
@@ -2401,7 +2412,7 @@ const SelectInput = p => {
2401
2412
  const onSelect = (item, currentSetValue) => {
2402
2413
  (currentSetValue || setValue)(value => {
2403
2414
  const newValue = (value || []).slice(0);
2404
- const index = newValue.findIndex(currentItem => currentItem.value === item.value);
2415
+ const index = newValue.findIndex(currentItem => currentItem[valueKey] === item[valueKey]);
2405
2416
  if (index === -1 && !checkMaxLength(newValue, maxLength)) {
2406
2417
  return value;
2407
2418
  }
@@ -2415,9 +2426,9 @@ const SelectInput = p => {
2415
2426
  };
2416
2427
  const inputInnerRender = (props = {}) => /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
2417
2428
  ref: inputRef,
2418
- className: classnames(className, style$3['select-input'], 'select-input', {
2419
- [style$3['wrap']]: labelWrap,
2420
- [style$3['disabled']]: disabled
2429
+ className: classnames(className, style$4['select-input'], 'select-input', {
2430
+ [style$4['wrap']]: labelWrap,
2431
+ [style$4['disabled']]: disabled
2421
2432
  }),
2422
2433
  justify: "space-between",
2423
2434
  onMouseOver: () => {
@@ -2429,27 +2440,27 @@ const SelectInput = p => {
2429
2440
  }), (() => {
2430
2441
  const current = typeof prefix === 'function' ? prefix(contextProps) : prefix;
2431
2442
  return current && /*#__PURE__*/React.createElement("span", {
2432
- className: classnames(style$3['select-input-prefix'], 'select-input-prefix'),
2443
+ className: classnames(style$4['select-input-prefix'], 'select-input-prefix'),
2433
2444
  onClick: e => {
2434
2445
  e.stopPropagation();
2435
2446
  }
2436
2447
  }, current);
2437
2448
  })(), /*#__PURE__*/React.createElement("div", {
2438
- className: classnames(style$3['select-input-inner'], 'select-input-inner')
2439
- }, value.length > 0 ? single || value[0].value === selectedAllValue.value ? value[0].label : value.map(item => {
2449
+ className: classnames(style$4['select-input-inner'], 'select-input-inner')
2450
+ }, value.length > 0 ? single || value[0][valueKey] === selectedAllValue[valueKey] ? value[0][labelKey] : value.map(item => {
2440
2451
  return /*#__PURE__*/React.createElement(Tag, {
2441
- key: item.value,
2452
+ key: item[valueKey],
2442
2453
  closable: true,
2443
2454
  bordered: false,
2444
2455
  onClose: e => {
2445
2456
  e.preventDefault();
2446
2457
  onRemove(item);
2447
2458
  }
2448
- }, item.label);
2459
+ }, item[labelKey]);
2449
2460
  }) : /*#__PURE__*/React.createElement("span", {
2450
- className: classnames(style$3['placeholder'], 'select-input-placeholder')
2461
+ className: classnames(style$4['placeholder'], 'select-input-placeholder')
2451
2462
  }, placeholder)), /*#__PURE__*/React.createElement("div", {
2452
- className: classnames(style$3['select-input-icon'], 'select-input-icon')
2463
+ className: classnames(style$4['select-input-icon'], 'select-input-icon')
2453
2464
  }, !disabled && allowClear && hover && value.length > 0 ? /*#__PURE__*/React.createElement(CloseCircleFilled, {
2454
2465
  onClick: e => {
2455
2466
  e.stopPropagation();
@@ -2458,7 +2469,7 @@ const SelectInput = p => {
2458
2469
  }) : /*#__PURE__*/React.createElement(DownOutlined, null)), (() => {
2459
2470
  const current = typeof suffix === 'function' ? suffix(contextProps) : suffix;
2460
2471
  return current && /*#__PURE__*/React.createElement("span", {
2461
- className: classnames(style$3['select-input-suffix'], 'select-input-suffix'),
2472
+ className: classnames(style$4['select-input-suffix'], 'select-input-suffix'),
2462
2473
  onClick: e => {
2463
2474
  e.stopPropagation();
2464
2475
  }
@@ -2479,6 +2490,9 @@ const SelectInput = p => {
2479
2490
  onOpenChange: setOpen,
2480
2491
  children
2481
2492
  };
2493
+ useImperativeHandle(ref, () => {
2494
+ return contextProps;
2495
+ });
2482
2496
  return /*#__PURE__*/React.createElement(Provider, {
2483
2497
  value: contextProps
2484
2498
  }, isPopup ? /*#__PURE__*/React.createElement(Dropdown, {
@@ -2486,13 +2500,13 @@ const SelectInput = p => {
2486
2500
  onOpenChange: setOpen,
2487
2501
  placement: placement,
2488
2502
  arrow: false,
2489
- overlayClassName: classnames(style$3['overlay'], overlayClassName),
2503
+ overlayClassName: classnames(style$4['overlay'], overlayClassName),
2490
2504
  trigger: "click",
2491
2505
  dropdownRender: () => /*#__PURE__*/React.createElement("div", {
2492
2506
  style: {
2493
2507
  '--overlay-width': popupOverlayWidth
2494
2508
  },
2495
- className: classnames(style$3['overlay-content'], 'over-content'),
2509
+ className: classnames(style$4['overlay-content'], 'over-content'),
2496
2510
  onClick: e => {
2497
2511
  e.stopPropagation();
2498
2512
  }
@@ -2502,7 +2516,7 @@ const SelectInput = p => {
2502
2516
  setOpen(true);
2503
2517
  }
2504
2518
  }), /*#__PURE__*/React.createElement(ModalContent, contextProps, renderModal)));
2505
- };
2519
+ });
2506
2520
 
2507
2521
  /** `Object#toString` result references. */
2508
2522
  var symbolTag = '[object Symbol]';
@@ -2854,7 +2868,7 @@ function get(object, path, defaultValue) {
2854
2868
 
2855
2869
  var get_1 = get;
2856
2870
 
2857
- var style$2 = {"selected-all":"_prlgN"};
2871
+ var style$3 = {"selected-all":"_prlgN"};
2858
2872
 
2859
2873
  const SelectedAll = () => {
2860
2874
  const {
@@ -2865,14 +2879,15 @@ const SelectedAll = () => {
2865
2879
  const {
2866
2880
  unit,
2867
2881
  selectedAllValue,
2868
- locale
2882
+ locale,
2883
+ valueKey
2869
2884
  } = Object.assign({}, {
2870
2885
  unit: number => locale.numberOf.replace('%s', number)
2871
2886
  }, props);
2872
- const isSelectedAll = computedIsSelectAll(value, selectedAllValue);
2887
+ const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
2873
2888
  return /*#__PURE__*/React.createElement(Flex, {
2874
2889
  justify: "space-between",
2875
- className: classnames(style$2['selected-all'], 'selected-all')
2890
+ className: classnames(style$3['selected-all'], 'selected-all')
2876
2891
  }, /*#__PURE__*/React.createElement(Flex, {
2877
2892
  gap: 8
2878
2893
  }, /*#__PURE__*/React.createElement("span", null, locale.selected, ":"), /*#__PURE__*/React.createElement("span", null, isSelectedAll ? selectedAllValue.label : typeof unit === 'function' ? unit(value.length) : value.length)), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Checkbox, {
@@ -2887,11 +2902,11 @@ const SelectedAll = () => {
2887
2902
  }
2888
2903
  }, locale.selectAll)));
2889
2904
  };
2890
- const computedIsSelectAll = (value, selectedAllValue) => {
2891
- return (value == null ? void 0 : value.length) === 1 && get_1(value, '[0].value') === selectedAllValue.value;
2905
+ const computedIsSelectAll = (value, selectedAllValue, valueKey = 'value') => {
2906
+ return (value == null ? void 0 : value.length) === 1 && get_1(value, `[0][${valueKey}]`) === selectedAllValue[valueKey];
2892
2907
  };
2893
2908
 
2894
- var style$1 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-container":"_dKZHi","tag-container-inner":"_oijCI","tag":"_WmnnS","tag-inner":"_TMcFl"};
2909
+ var style$2 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-container":"_dKZHi","tag-container-inner":"_oijCI","tag":"_WmnnS","tag-inner":"_TMcFl"};
2895
2910
 
2896
2911
  const SelectedTagList = () => {
2897
2912
  const {
@@ -2902,23 +2917,25 @@ const SelectedTagList = () => {
2902
2917
  const {
2903
2918
  locale,
2904
2919
  single,
2905
- maxLength
2920
+ maxLength,
2921
+ labelKey,
2922
+ valueKey
2906
2923
  } = Object.assign({}, props);
2907
2924
  return /*#__PURE__*/React.createElement(Flex, {
2908
- className: classnames(style$1['tag-list'], 'selected-tag-list'),
2925
+ className: classnames(style$2['tag-list'], 'selected-tag-list'),
2909
2926
  gap: 8
2910
2927
  }, /*#__PURE__*/React.createElement("div", {
2911
- className: style$1['label']
2928
+ className: style$2['label']
2912
2929
  }, locale.selected, !single && value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React.createElement(SimpleBar, {
2913
- className: style$1['tag-container']
2930
+ className: style$2['tag-container']
2914
2931
  }, /*#__PURE__*/React.createElement(Flex, {
2915
2932
  gap: 8,
2916
2933
  wrap: true,
2917
- className: style$1['tag-container-inner']
2934
+ className: style$2['tag-container-inner']
2918
2935
  }, value.map(item => {
2919
2936
  return /*#__PURE__*/React.createElement(Tag, {
2920
- className: style$1['tag'],
2921
- key: item.value,
2937
+ className: style$2['tag'],
2938
+ key: item[valueKey],
2922
2939
  closable: true,
2923
2940
  bordered: false,
2924
2941
  onClose: e => {
@@ -2926,1105 +2943,471 @@ const SelectedTagList = () => {
2926
2943
  onRemove(item);
2927
2944
  }
2928
2945
  }, /*#__PURE__*/React.createElement("span", {
2929
- className: style$1['tag-inner']
2930
- }, item.label));
2946
+ className: style$2['tag-inner']
2947
+ }, item[labelKey]));
2931
2948
  }))));
2932
2949
  };
2933
2950
 
2934
- var defineProperty = (function() {
2935
- try {
2936
- var func = _getNative(Object, 'defineProperty');
2937
- func({}, '', {});
2938
- return func;
2939
- } catch (e) {}
2940
- }());
2941
-
2942
- var _defineProperty = defineProperty;
2943
-
2944
- /**
2945
- * The base implementation of `assignValue` and `assignMergeValue` without
2946
- * value checks.
2947
- *
2948
- * @private
2949
- * @param {Object} object The object to modify.
2950
- * @param {string} key The key of the property to assign.
2951
- * @param {*} value The value to assign.
2952
- */
2953
- function baseAssignValue(object, key, value) {
2954
- if (key == '__proto__' && _defineProperty) {
2955
- _defineProperty(object, key, {
2956
- 'configurable': true,
2957
- 'enumerable': true,
2958
- 'value': value,
2959
- 'writable': true
2960
- });
2961
- } else {
2962
- object[key] = value;
2963
- }
2964
- }
2965
-
2966
- var _baseAssignValue = baseAssignValue;
2967
-
2968
- /**
2969
- * This function is like `assignValue` except that it doesn't assign
2970
- * `undefined` values.
2971
- *
2972
- * @private
2973
- * @param {Object} object The object to modify.
2974
- * @param {string} key The key of the property to assign.
2975
- * @param {*} value The value to assign.
2976
- */
2977
- function assignMergeValue(object, key, value) {
2978
- if ((value !== undefined && !eq_1(object[key], value)) ||
2979
- (value === undefined && !(key in object))) {
2980
- _baseAssignValue(object, key, value);
2981
- }
2982
- }
2951
+ var style$1 = {"list":"_IsXdU","is-popup":"_-dvpa","default-list":"_QD1Mz","is-selected-all":"_M-mOy","default-list-item":"_KtOsz","is-selected":"_TQhBB","single-checked":"_2rUrh","is-disabled":"_NbwX5","selected-all":"_vN2Fx","selected-tag":"_6oITk","select-search":"_iAH9D"};
2983
2952
 
2984
- var _assignMergeValue = assignMergeValue;
2953
+ const _excluded = ["children"];
2954
+ const SelectList = forwardRef((_ref, ref) => {
2955
+ let {
2956
+ children
2957
+ } = _ref,
2958
+ p = _objectWithoutPropertiesLoose(_ref, _excluded);
2959
+ const props = Object.assign({}, {
2960
+ renderItemContent: ({
2961
+ item,
2962
+ props
2963
+ }) => {
2964
+ const {
2965
+ labelKey
2966
+ } = props;
2967
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2968
+ className: 'select-list-item-label'
2969
+ }, item[labelKey]), item.description && /*#__PURE__*/React.createElement("div", {
2970
+ className: 'select-list-item-description'
2971
+ }, item.description));
2972
+ },
2973
+ renderItem: contextProps => {
2974
+ const {
2975
+ item,
2976
+ props,
2977
+ isSelectedAll,
2978
+ value,
2979
+ onSelect,
2980
+ setValue,
2981
+ onOpenChange
2982
+ } = contextProps;
2983
+ const {
2984
+ single,
2985
+ isPopup,
2986
+ renderItemContent,
2987
+ valueKey
2988
+ } = props;
2989
+ const isChecked = value.some(target => target[valueKey] === item[valueKey]);
2990
+ return /*#__PURE__*/React.createElement(List.Item, {
2991
+ className: classnames(style$1['default-list-item'], 'select-list-item', {
2992
+ [style$1['is-selected']]: isChecked,
2993
+ [style$1['is-disabled']]: item.disabled
2994
+ }),
2995
+ key: item[valueKey],
2996
+ onClick: () => {
2997
+ if (item.disabled) {
2998
+ return;
2999
+ }
3000
+ if (isSelectedAll) {
3001
+ return;
3002
+ }
3003
+ if (single) {
3004
+ setValue([item]);
3005
+ } else {
3006
+ onSelect(item);
3007
+ }
3008
+ if (isPopup && single) {
3009
+ onOpenChange(false);
3010
+ }
3011
+ }
3012
+ }, !single && /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Checkbox, {
3013
+ checked: isSelectedAll || isChecked,
3014
+ disabled: isSelectedAll || item.disabled
3015
+ })), /*#__PURE__*/React.createElement(Flex, {
3016
+ vertical: true,
3017
+ gag: 8,
3018
+ flex: 1,
3019
+ className: 'select-list-item-content'
3020
+ }, renderItemContent(contextProps)), single && /*#__PURE__*/React.createElement("div", {
3021
+ className: style$1['single-checked']
3022
+ }, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
3023
+ },
3024
+ renderList: contextProps => {
3025
+ const {
3026
+ props,
3027
+ isSelectedAll,
3028
+ list
3029
+ } = contextProps;
3030
+ const {
3031
+ renderItem
3032
+ } = props;
3033
+ return /*#__PURE__*/React.createElement(List, {
3034
+ className: classnames(style$1['default-list'], {
3035
+ [style$1['is-selected-all']]: isSelectedAll
3036
+ }),
3037
+ size: "small",
3038
+ dataSource: list,
3039
+ renderItem: item => renderItem(Object.assign({}, contextProps, {
3040
+ item
3041
+ }))
3042
+ });
3043
+ }
3044
+ }, p);
3045
+ return /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
3046
+ ref: ref
3047
+ }), targetProps => {
3048
+ const {
3049
+ props,
3050
+ value,
3051
+ searchText,
3052
+ setSearchText
3053
+ } = targetProps;
3054
+ const {
3055
+ isPopup,
3056
+ getSearchProps,
3057
+ getSearchCallback,
3058
+ searchPlaceholder,
3059
+ valueKey,
3060
+ single,
3061
+ allowSelectedAll,
3062
+ showSelectedTag,
3063
+ api,
3064
+ options,
3065
+ renderList,
3066
+ selectedAllValue
3067
+ } = props;
3068
+ const components = {
3069
+ search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React.createElement(SearchInput, {
3070
+ className: classnames(style$1['select-search'], 'select-list-search', {
3071
+ 'is-popup': isPopup
3072
+ }),
3073
+ placeholder: searchPlaceholder,
3074
+ value: searchText,
3075
+ onSearch: value => {
3076
+ setSearchText(value);
3077
+ },
3078
+ simple: isPopup,
3079
+ showSearchButton: !isPopup
3080
+ }),
3081
+ selectedAll: /*#__PURE__*/React.createElement("div", {
3082
+ className: classnames(style$1['selected-all'], 'select-list-selected-all', {
3083
+ 'is-popup': isPopup
3084
+ })
3085
+ }, !single && allowSelectedAll && /*#__PURE__*/React.createElement(SelectedAll, null)),
3086
+ fetchList: /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
3087
+ className: classnames(style$1['list'], 'select-list-scroll-list', {
3088
+ 'is-popup': isPopup
3089
+ }),
3090
+ searchProps: {
3091
+ searchText
3092
+ },
3093
+ getSearchProps: getSearchProps,
3094
+ api: Object.assign({}, options ? {
3095
+ data: {
3096
+ options,
3097
+ searchText
3098
+ },
3099
+ loader: ({
3100
+ data
3101
+ }) => {
3102
+ const {
3103
+ options,
3104
+ searchText
3105
+ } = data;
3106
+ if (typeof getSearchCallback === 'function') {
3107
+ const newOptions = options.filter(item => getSearchCallback(searchText, item));
3108
+ return {
3109
+ pageData: newOptions
3110
+ };
3111
+ }
3112
+ return {
3113
+ pageData: options
3114
+ };
3115
+ }
3116
+ } : api)
3117
+ }), fetchProps => {
3118
+ const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
3119
+ return renderList(Object.assign({}, fetchProps, targetProps, {
3120
+ isSelectedAll
3121
+ }));
3122
+ }),
3123
+ selectedTag: showSelectedTag && /*#__PURE__*/React.createElement("div", {
3124
+ className: classnames(style$1['selected-tag'], 'select-list-selected-tag', {
3125
+ 'is-popup': isPopup
3126
+ })
3127
+ }, /*#__PURE__*/React.createElement(SelectedTagList, null))
3128
+ };
3129
+ if (typeof children === 'function') {
3130
+ return children(Object.assign({}, targetProps, {
3131
+ components
3132
+ }));
3133
+ }
3134
+ return /*#__PURE__*/React.createElement(Flex, {
3135
+ vertical: true
3136
+ }, components.search, components.selectedAll, components.fetchList, components.selectedTag);
3137
+ });
3138
+ });
2985
3139
 
2986
- /**
2987
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
2988
- *
2989
- * @private
2990
- * @param {boolean} [fromRight] Specify iterating from right to left.
2991
- * @returns {Function} Returns the new base function.
2992
- */
2993
- function createBaseFor(fromRight) {
2994
- return function(object, iteratee, keysFunc) {
2995
- var index = -1,
2996
- iterable = Object(object),
2997
- props = keysFunc(object),
2998
- length = props.length;
3140
+ var style = {"list":"_DrEYJ","is-popup":"_KgWTX","header":"_Vmbrg","col":"_dJmfs","body":"_704J1","is-selected-all":"_qU5zU","is-selected":"_MzyWg","is-disabled":"_5luTv","right-options":"_UXi-g","no-padding-btn":"_iaCir","tag":"_JkYqS","tag-inner":"_VZlBL","single-checked":"_Eiz-u","select-search":"_temy6","tags-search":"_7phL2","descriptions":"_ttNK9","descriptions-col-label":"_xU-i7","descriptions-col-content":"_SvfzQ"};
2999
3141
 
3000
- while (length--) {
3001
- var key = props[fromRight ? length : ++index];
3002
- if (iteratee(iterable[key], key, iterable) === false) {
3003
- break;
3142
+ const SelectTableList = forwardRef((p, ref) => {
3143
+ const [filter, setFilter] = useState({});
3144
+ const [tagSearchText, setTagSearchText] = useState('');
3145
+ const props = Object.assign({}, {
3146
+ overlayWidth: '600px',
3147
+ filterRender: contextProps => {
3148
+ const {
3149
+ props,
3150
+ filter,
3151
+ setFilter
3152
+ } = contextProps;
3153
+ const {
3154
+ isPopup,
3155
+ searchPlaceholder,
3156
+ api,
3157
+ getSearchProps,
3158
+ options,
3159
+ getSearchCallback,
3160
+ labelKey
3161
+ } = props;
3162
+ if (!(api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function')) {
3163
+ return null;
3164
+ }
3165
+ return /*#__PURE__*/React.createElement(SearchInput, {
3166
+ className: classnames(style['select-search'], 'select-list-search', {
3167
+ 'is-popup': isPopup
3168
+ }),
3169
+ placeholder: searchPlaceholder,
3170
+ value: filter.searchText || '',
3171
+ onSearch: value => {
3172
+ setFilter(filter => Object.assign({}, filter, {
3173
+ searchText: value
3174
+ }));
3175
+ },
3176
+ simple: isPopup,
3177
+ showSearchButton: !isPopup
3178
+ });
3179
+ },
3180
+ getTagSearchCallback: (tagSearchText, item, contextProps) => {
3181
+ const {
3182
+ props
3183
+ } = contextProps;
3184
+ const {
3185
+ labelKey
3186
+ } = props;
3187
+ if (!tagSearchText) {
3188
+ return true;
3004
3189
  }
3005
- }
3006
- return object;
3007
- };
3008
- }
3009
-
3010
- var _createBaseFor = createBaseFor;
3011
-
3012
- /**
3013
- * The base implementation of `baseForOwn` which iterates over `object`
3014
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
3015
- * Iteratee functions may exit iteration early by explicitly returning `false`.
3016
- *
3017
- * @private
3018
- * @param {Object} object The object to iterate over.
3019
- * @param {Function} iteratee The function invoked per iteration.
3020
- * @param {Function} keysFunc The function to get the keys of `object`.
3021
- * @returns {Object} Returns `object`.
3022
- */
3023
- var baseFor = _createBaseFor();
3024
-
3025
- var _baseFor = baseFor;
3026
-
3027
- var _cloneBuffer = createCommonjsModule(function (module, exports) {
3028
- /** Detect free variable `exports`. */
3029
- var freeExports = exports && !exports.nodeType && exports;
3030
-
3031
- /** Detect free variable `module`. */
3032
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
3033
-
3034
- /** Detect the popular CommonJS extension `module.exports`. */
3035
- var moduleExports = freeModule && freeModule.exports === freeExports;
3036
-
3037
- /** Built-in value references. */
3038
- var Buffer = moduleExports ? _root.Buffer : undefined,
3039
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
3040
-
3041
- /**
3042
- * Creates a clone of `buffer`.
3043
- *
3044
- * @private
3045
- * @param {Buffer} buffer The buffer to clone.
3046
- * @param {boolean} [isDeep] Specify a deep clone.
3047
- * @returns {Buffer} Returns the cloned buffer.
3048
- */
3049
- function cloneBuffer(buffer, isDeep) {
3050
- if (isDeep) {
3051
- return buffer.slice();
3052
- }
3053
- var length = buffer.length,
3054
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
3055
-
3056
- buffer.copy(result);
3057
- return result;
3058
- }
3059
-
3060
- module.exports = cloneBuffer;
3061
- });
3062
-
3063
- /**
3064
- * Creates a clone of `arrayBuffer`.
3065
- *
3066
- * @private
3067
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
3068
- * @returns {ArrayBuffer} Returns the cloned array buffer.
3069
- */
3070
- function cloneArrayBuffer(arrayBuffer) {
3071
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
3072
- new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
3073
- return result;
3074
- }
3075
-
3076
- var _cloneArrayBuffer = cloneArrayBuffer;
3077
-
3078
- /**
3079
- * Creates a clone of `typedArray`.
3080
- *
3081
- * @private
3082
- * @param {Object} typedArray The typed array to clone.
3083
- * @param {boolean} [isDeep] Specify a deep clone.
3084
- * @returns {Object} Returns the cloned typed array.
3085
- */
3086
- function cloneTypedArray(typedArray, isDeep) {
3087
- var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
3088
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3089
- }
3090
-
3091
- var _cloneTypedArray = cloneTypedArray;
3092
-
3093
- /**
3094
- * Copies the values of `source` to `array`.
3095
- *
3096
- * @private
3097
- * @param {Array} source The array to copy values from.
3098
- * @param {Array} [array=[]] The array to copy values to.
3099
- * @returns {Array} Returns `array`.
3100
- */
3101
- function copyArray(source, array) {
3102
- var index = -1,
3103
- length = source.length;
3104
-
3105
- array || (array = Array(length));
3106
- while (++index < length) {
3107
- array[index] = source[index];
3108
- }
3109
- return array;
3110
- }
3111
-
3112
- var _copyArray = copyArray;
3113
-
3114
- /** Built-in value references. */
3115
- var objectCreate = Object.create;
3116
-
3117
- /**
3118
- * The base implementation of `_.create` without support for assigning
3119
- * properties to the created object.
3120
- *
3121
- * @private
3122
- * @param {Object} proto The object to inherit from.
3123
- * @returns {Object} Returns the new object.
3124
- */
3125
- var baseCreate = (function() {
3126
- function object() {}
3127
- return function(proto) {
3128
- if (!isObject_1(proto)) {
3129
- return {};
3130
- }
3131
- if (objectCreate) {
3132
- return objectCreate(proto);
3133
- }
3134
- object.prototype = proto;
3135
- var result = new object;
3136
- object.prototype = undefined;
3137
- return result;
3138
- };
3139
- }());
3140
-
3141
- var _baseCreate = baseCreate;
3142
-
3143
- /** Built-in value references. */
3144
- var getPrototype = _overArg(Object.getPrototypeOf, Object);
3145
-
3146
- var _getPrototype = getPrototype;
3147
-
3148
- /**
3149
- * Initializes an object clone.
3150
- *
3151
- * @private
3152
- * @param {Object} object The object to clone.
3153
- * @returns {Object} Returns the initialized clone.
3154
- */
3155
- function initCloneObject(object) {
3156
- return (typeof object.constructor == 'function' && !_isPrototype(object))
3157
- ? _baseCreate(_getPrototype(object))
3158
- : {};
3159
- }
3160
-
3161
- var _initCloneObject = initCloneObject;
3162
-
3163
- /**
3164
- * This method is like `_.isArrayLike` except that it also checks if `value`
3165
- * is an object.
3166
- *
3167
- * @static
3168
- * @memberOf _
3169
- * @since 4.0.0
3170
- * @category Lang
3171
- * @param {*} value The value to check.
3172
- * @returns {boolean} Returns `true` if `value` is an array-like object,
3173
- * else `false`.
3174
- * @example
3175
- *
3176
- * _.isArrayLikeObject([1, 2, 3]);
3177
- * // => true
3178
- *
3179
- * _.isArrayLikeObject(document.body.children);
3180
- * // => true
3181
- *
3182
- * _.isArrayLikeObject('abc');
3183
- * // => false
3184
- *
3185
- * _.isArrayLikeObject(_.noop);
3186
- * // => false
3187
- */
3188
- function isArrayLikeObject(value) {
3189
- return isObjectLike_1(value) && isArrayLike_1(value);
3190
- }
3191
-
3192
- var isArrayLikeObject_1 = isArrayLikeObject;
3193
-
3194
- /** `Object#toString` result references. */
3195
- var objectTag = '[object Object]';
3196
-
3197
- /** Used for built-in method references. */
3198
- var funcProto = Function.prototype,
3199
- objectProto$2 = Object.prototype;
3200
-
3201
- /** Used to resolve the decompiled source of functions. */
3202
- var funcToString = funcProto.toString;
3203
-
3204
- /** Used to check objects for own properties. */
3205
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
3206
-
3207
- /** Used to infer the `Object` constructor. */
3208
- var objectCtorString = funcToString.call(Object);
3209
-
3210
- /**
3211
- * Checks if `value` is a plain object, that is, an object created by the
3212
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
3213
- *
3214
- * @static
3215
- * @memberOf _
3216
- * @since 0.8.0
3217
- * @category Lang
3218
- * @param {*} value The value to check.
3219
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
3220
- * @example
3221
- *
3222
- * function Foo() {
3223
- * this.a = 1;
3224
- * }
3225
- *
3226
- * _.isPlainObject(new Foo);
3227
- * // => false
3228
- *
3229
- * _.isPlainObject([1, 2, 3]);
3230
- * // => false
3231
- *
3232
- * _.isPlainObject({ 'x': 0, 'y': 0 });
3233
- * // => true
3234
- *
3235
- * _.isPlainObject(Object.create(null));
3236
- * // => true
3237
- */
3238
- function isPlainObject(value) {
3239
- if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
3240
- return false;
3241
- }
3242
- var proto = _getPrototype(value);
3243
- if (proto === null) {
3244
- return true;
3245
- }
3246
- var Ctor = hasOwnProperty$2.call(proto, 'constructor') && proto.constructor;
3247
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
3248
- funcToString.call(Ctor) == objectCtorString;
3249
- }
3250
-
3251
- var isPlainObject_1 = isPlainObject;
3252
-
3253
- /**
3254
- * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
3255
- *
3256
- * @private
3257
- * @param {Object} object The object to query.
3258
- * @param {string} key The key of the property to get.
3259
- * @returns {*} Returns the property value.
3260
- */
3261
- function safeGet(object, key) {
3262
- if (key === 'constructor' && typeof object[key] === 'function') {
3263
- return;
3264
- }
3265
-
3266
- if (key == '__proto__') {
3267
- return;
3268
- }
3269
-
3270
- return object[key];
3271
- }
3272
-
3273
- var _safeGet = safeGet;
3274
-
3275
- /** Used for built-in method references. */
3276
- var objectProto$1 = Object.prototype;
3277
-
3278
- /** Used to check objects for own properties. */
3279
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
3280
-
3281
- /**
3282
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
3283
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3284
- * for equality comparisons.
3285
- *
3286
- * @private
3287
- * @param {Object} object The object to modify.
3288
- * @param {string} key The key of the property to assign.
3289
- * @param {*} value The value to assign.
3290
- */
3291
- function assignValue(object, key, value) {
3292
- var objValue = object[key];
3293
- if (!(hasOwnProperty$1.call(object, key) && eq_1(objValue, value)) ||
3294
- (value === undefined && !(key in object))) {
3295
- _baseAssignValue(object, key, value);
3296
- }
3297
- }
3298
-
3299
- var _assignValue = assignValue;
3300
-
3301
- /**
3302
- * Copies properties of `source` to `object`.
3303
- *
3304
- * @private
3305
- * @param {Object} source The object to copy properties from.
3306
- * @param {Array} props The property identifiers to copy.
3307
- * @param {Object} [object={}] The object to copy properties to.
3308
- * @param {Function} [customizer] The function to customize copied values.
3309
- * @returns {Object} Returns `object`.
3310
- */
3311
- function copyObject(source, props, object, customizer) {
3312
- var isNew = !object;
3313
- object || (object = {});
3314
-
3315
- var index = -1,
3316
- length = props.length;
3317
-
3318
- while (++index < length) {
3319
- var key = props[index];
3320
-
3321
- var newValue = customizer
3322
- ? customizer(object[key], source[key], key, object, source)
3323
- : undefined;
3324
-
3325
- if (newValue === undefined) {
3326
- newValue = source[key];
3327
- }
3328
- if (isNew) {
3329
- _baseAssignValue(object, key, newValue);
3330
- } else {
3331
- _assignValue(object, key, newValue);
3332
- }
3333
- }
3334
- return object;
3335
- }
3336
-
3337
- var _copyObject = copyObject;
3338
-
3339
- /**
3340
- * This function is like
3341
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
3342
- * except that it includes inherited enumerable properties.
3343
- *
3344
- * @private
3345
- * @param {Object} object The object to query.
3346
- * @returns {Array} Returns the array of property names.
3347
- */
3348
- function nativeKeysIn(object) {
3349
- var result = [];
3350
- if (object != null) {
3351
- for (var key in Object(object)) {
3352
- result.push(key);
3353
- }
3354
- }
3355
- return result;
3356
- }
3357
-
3358
- var _nativeKeysIn = nativeKeysIn;
3359
-
3360
- /** Used for built-in method references. */
3361
- var objectProto = Object.prototype;
3362
-
3363
- /** Used to check objects for own properties. */
3364
- var hasOwnProperty = objectProto.hasOwnProperty;
3365
-
3366
- /**
3367
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
3368
- *
3369
- * @private
3370
- * @param {Object} object The object to query.
3371
- * @returns {Array} Returns the array of property names.
3372
- */
3373
- function baseKeysIn(object) {
3374
- if (!isObject_1(object)) {
3375
- return _nativeKeysIn(object);
3376
- }
3377
- var isProto = _isPrototype(object),
3378
- result = [];
3379
-
3380
- for (var key in object) {
3381
- if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
3382
- result.push(key);
3383
- }
3384
- }
3385
- return result;
3386
- }
3387
-
3388
- var _baseKeysIn = baseKeysIn;
3389
-
3390
- /**
3391
- * Creates an array of the own and inherited enumerable property names of `object`.
3392
- *
3393
- * **Note:** Non-object values are coerced to objects.
3394
- *
3395
- * @static
3396
- * @memberOf _
3397
- * @since 3.0.0
3398
- * @category Object
3399
- * @param {Object} object The object to query.
3400
- * @returns {Array} Returns the array of property names.
3401
- * @example
3402
- *
3403
- * function Foo() {
3404
- * this.a = 1;
3405
- * this.b = 2;
3406
- * }
3407
- *
3408
- * Foo.prototype.c = 3;
3409
- *
3410
- * _.keysIn(new Foo);
3411
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
3412
- */
3413
- function keysIn(object) {
3414
- return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
3415
- }
3416
-
3417
- var keysIn_1 = keysIn;
3418
-
3419
- /**
3420
- * Converts `value` to a plain object flattening inherited enumerable string
3421
- * keyed properties of `value` to own properties of the plain object.
3422
- *
3423
- * @static
3424
- * @memberOf _
3425
- * @since 3.0.0
3426
- * @category Lang
3427
- * @param {*} value The value to convert.
3428
- * @returns {Object} Returns the converted plain object.
3429
- * @example
3430
- *
3431
- * function Foo() {
3432
- * this.b = 2;
3433
- * }
3434
- *
3435
- * Foo.prototype.c = 3;
3436
- *
3437
- * _.assign({ 'a': 1 }, new Foo);
3438
- * // => { 'a': 1, 'b': 2 }
3439
- *
3440
- * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
3441
- * // => { 'a': 1, 'b': 2, 'c': 3 }
3442
- */
3443
- function toPlainObject(value) {
3444
- return _copyObject(value, keysIn_1(value));
3445
- }
3446
-
3447
- var toPlainObject_1 = toPlainObject;
3448
-
3449
- /**
3450
- * A specialized version of `baseMerge` for arrays and objects which performs
3451
- * deep merges and tracks traversed objects enabling objects with circular
3452
- * references to be merged.
3453
- *
3454
- * @private
3455
- * @param {Object} object The destination object.
3456
- * @param {Object} source The source object.
3457
- * @param {string} key The key of the value to merge.
3458
- * @param {number} srcIndex The index of `source`.
3459
- * @param {Function} mergeFunc The function to merge values.
3460
- * @param {Function} [customizer] The function to customize assigned values.
3461
- * @param {Object} [stack] Tracks traversed source values and their merged
3462
- * counterparts.
3463
- */
3464
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
3465
- var objValue = _safeGet(object, key),
3466
- srcValue = _safeGet(source, key),
3467
- stacked = stack.get(srcValue);
3468
-
3469
- if (stacked) {
3470
- _assignMergeValue(object, key, stacked);
3471
- return;
3472
- }
3473
- var newValue = customizer
3474
- ? customizer(objValue, srcValue, (key + ''), object, source, stack)
3475
- : undefined;
3476
-
3477
- var isCommon = newValue === undefined;
3478
-
3479
- if (isCommon) {
3480
- var isArr = isArray_1(srcValue),
3481
- isBuff = !isArr && isBuffer_1(srcValue),
3482
- isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
3483
-
3484
- newValue = srcValue;
3485
- if (isArr || isBuff || isTyped) {
3486
- if (isArray_1(objValue)) {
3487
- newValue = objValue;
3488
- }
3489
- else if (isArrayLikeObject_1(objValue)) {
3490
- newValue = _copyArray(objValue);
3491
- }
3492
- else if (isBuff) {
3493
- isCommon = false;
3494
- newValue = _cloneBuffer(srcValue, true);
3495
- }
3496
- else if (isTyped) {
3497
- isCommon = false;
3498
- newValue = _cloneTypedArray(srcValue, true);
3499
- }
3500
- else {
3501
- newValue = [];
3502
- }
3503
- }
3504
- else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
3505
- newValue = objValue;
3506
- if (isArguments_1(objValue)) {
3507
- newValue = toPlainObject_1(objValue);
3508
- }
3509
- else if (!isObject_1(objValue) || isFunction_1(objValue)) {
3510
- newValue = _initCloneObject(srcValue);
3511
- }
3512
- }
3513
- else {
3514
- isCommon = false;
3515
- }
3516
- }
3517
- if (isCommon) {
3518
- // Recursively merge objects and arrays (susceptible to call stack limits).
3519
- stack.set(srcValue, newValue);
3520
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
3521
- stack['delete'](srcValue);
3522
- }
3523
- _assignMergeValue(object, key, newValue);
3524
- }
3525
-
3526
- var _baseMergeDeep = baseMergeDeep;
3527
-
3528
- /**
3529
- * The base implementation of `_.merge` without support for multiple sources.
3530
- *
3531
- * @private
3532
- * @param {Object} object The destination object.
3533
- * @param {Object} source The source object.
3534
- * @param {number} srcIndex The index of `source`.
3535
- * @param {Function} [customizer] The function to customize merged values.
3536
- * @param {Object} [stack] Tracks traversed source values and their merged
3537
- * counterparts.
3538
- */
3539
- function baseMerge(object, source, srcIndex, customizer, stack) {
3540
- if (object === source) {
3541
- return;
3542
- }
3543
- _baseFor(source, function(srcValue, key) {
3544
- stack || (stack = new _Stack);
3545
- if (isObject_1(srcValue)) {
3546
- _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
3547
- }
3548
- else {
3549
- var newValue = customizer
3550
- ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
3551
- : undefined;
3552
-
3553
- if (newValue === undefined) {
3554
- newValue = srcValue;
3555
- }
3556
- _assignMergeValue(object, key, newValue);
3557
- }
3558
- }, keysIn_1);
3559
- }
3560
-
3561
- var _baseMerge = baseMerge;
3562
-
3563
- /**
3564
- * This method returns the first argument it receives.
3565
- *
3566
- * @static
3567
- * @since 0.1.0
3568
- * @memberOf _
3569
- * @category Util
3570
- * @param {*} value Any value.
3571
- * @returns {*} Returns `value`.
3572
- * @example
3573
- *
3574
- * var object = { 'a': 1 };
3575
- *
3576
- * console.log(_.identity(object) === object);
3577
- * // => true
3578
- */
3579
- function identity(value) {
3580
- return value;
3581
- }
3582
-
3583
- var identity_1 = identity;
3584
-
3585
- /**
3586
- * A faster alternative to `Function#apply`, this function invokes `func`
3587
- * with the `this` binding of `thisArg` and the arguments of `args`.
3588
- *
3589
- * @private
3590
- * @param {Function} func The function to invoke.
3591
- * @param {*} thisArg The `this` binding of `func`.
3592
- * @param {Array} args The arguments to invoke `func` with.
3593
- * @returns {*} Returns the result of `func`.
3594
- */
3595
- function apply(func, thisArg, args) {
3596
- switch (args.length) {
3597
- case 0: return func.call(thisArg);
3598
- case 1: return func.call(thisArg, args[0]);
3599
- case 2: return func.call(thisArg, args[0], args[1]);
3600
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
3601
- }
3602
- return func.apply(thisArg, args);
3603
- }
3604
-
3605
- var _apply = apply;
3606
-
3607
- /* Built-in method references for those with the same name as other `lodash` methods. */
3608
- var nativeMax = Math.max;
3609
-
3610
- /**
3611
- * A specialized version of `baseRest` which transforms the rest array.
3612
- *
3613
- * @private
3614
- * @param {Function} func The function to apply a rest parameter to.
3615
- * @param {number} [start=func.length-1] The start position of the rest parameter.
3616
- * @param {Function} transform The rest array transform.
3617
- * @returns {Function} Returns the new function.
3618
- */
3619
- function overRest(func, start, transform) {
3620
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
3621
- return function() {
3622
- var args = arguments,
3623
- index = -1,
3624
- length = nativeMax(args.length - start, 0),
3625
- array = Array(length);
3626
-
3627
- while (++index < length) {
3628
- array[index] = args[start + index];
3629
- }
3630
- index = -1;
3631
- var otherArgs = Array(start + 1);
3632
- while (++index < start) {
3633
- otherArgs[index] = args[index];
3634
- }
3635
- otherArgs[start] = transform(array);
3636
- return _apply(func, this, otherArgs);
3637
- };
3638
- }
3639
-
3640
- var _overRest = overRest;
3641
-
3642
- /**
3643
- * Creates a function that returns `value`.
3644
- *
3645
- * @static
3646
- * @memberOf _
3647
- * @since 2.4.0
3648
- * @category Util
3649
- * @param {*} value The value to return from the new function.
3650
- * @returns {Function} Returns the new constant function.
3651
- * @example
3652
- *
3653
- * var objects = _.times(2, _.constant({ 'a': 1 }));
3654
- *
3655
- * console.log(objects);
3656
- * // => [{ 'a': 1 }, { 'a': 1 }]
3657
- *
3658
- * console.log(objects[0] === objects[1]);
3659
- * // => true
3660
- */
3661
- function constant(value) {
3662
- return function() {
3663
- return value;
3664
- };
3665
- }
3666
-
3667
- var constant_1 = constant;
3668
-
3669
- /**
3670
- * The base implementation of `setToString` without support for hot loop shorting.
3671
- *
3672
- * @private
3673
- * @param {Function} func The function to modify.
3674
- * @param {Function} string The `toString` result.
3675
- * @returns {Function} Returns `func`.
3676
- */
3677
- var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
3678
- return _defineProperty(func, 'toString', {
3679
- 'configurable': true,
3680
- 'enumerable': false,
3681
- 'value': constant_1(string),
3682
- 'writable': true
3683
- });
3684
- };
3685
-
3686
- var _baseSetToString = baseSetToString;
3687
-
3688
- /** Used to detect hot functions by number of calls within a span of milliseconds. */
3689
- var HOT_COUNT = 800,
3690
- HOT_SPAN = 16;
3691
-
3692
- /* Built-in method references for those with the same name as other `lodash` methods. */
3693
- var nativeNow = Date.now;
3694
-
3695
- /**
3696
- * Creates a function that'll short out and invoke `identity` instead
3697
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
3698
- * milliseconds.
3699
- *
3700
- * @private
3701
- * @param {Function} func The function to restrict.
3702
- * @returns {Function} Returns the new shortable function.
3703
- */
3704
- function shortOut(func) {
3705
- var count = 0,
3706
- lastCalled = 0;
3707
-
3708
- return function() {
3709
- var stamp = nativeNow(),
3710
- remaining = HOT_SPAN - (stamp - lastCalled);
3711
-
3712
- lastCalled = stamp;
3713
- if (remaining > 0) {
3714
- if (++count >= HOT_COUNT) {
3715
- return arguments[0];
3716
- }
3717
- } else {
3718
- count = 0;
3719
- }
3720
- return func.apply(undefined, arguments);
3721
- };
3722
- }
3723
-
3724
- var _shortOut = shortOut;
3725
-
3726
- /**
3727
- * Sets the `toString` method of `func` to return `string`.
3728
- *
3729
- * @private
3730
- * @param {Function} func The function to modify.
3731
- * @param {Function} string The `toString` result.
3732
- * @returns {Function} Returns `func`.
3733
- */
3734
- var setToString = _shortOut(_baseSetToString);
3735
-
3736
- var _setToString = setToString;
3737
-
3738
- /**
3739
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
3740
- *
3741
- * @private
3742
- * @param {Function} func The function to apply a rest parameter to.
3743
- * @param {number} [start=func.length-1] The start position of the rest parameter.
3744
- * @returns {Function} Returns the new function.
3745
- */
3746
- function baseRest(func, start) {
3747
- return _setToString(_overRest(func, start, identity_1), func + '');
3748
- }
3749
-
3750
- var _baseRest = baseRest;
3751
-
3752
- /**
3753
- * Checks if the given arguments are from an iteratee call.
3754
- *
3755
- * @private
3756
- * @param {*} value The potential iteratee value argument.
3757
- * @param {*} index The potential iteratee index or key argument.
3758
- * @param {*} object The potential iteratee object argument.
3759
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
3760
- * else `false`.
3761
- */
3762
- function isIterateeCall(value, index, object) {
3763
- if (!isObject_1(object)) {
3764
- return false;
3765
- }
3766
- var type = typeof index;
3767
- if (type == 'number'
3768
- ? (isArrayLike_1(object) && _isIndex(index, object.length))
3769
- : (type == 'string' && index in object)
3770
- ) {
3771
- return eq_1(object[index], value);
3772
- }
3773
- return false;
3774
- }
3775
-
3776
- var _isIterateeCall = isIterateeCall;
3777
-
3778
- /**
3779
- * Creates a function like `_.assign`.
3780
- *
3781
- * @private
3782
- * @param {Function} assigner The function to assign values.
3783
- * @returns {Function} Returns the new assigner function.
3784
- */
3785
- function createAssigner(assigner) {
3786
- return _baseRest(function(object, sources) {
3787
- var index = -1,
3788
- length = sources.length,
3789
- customizer = length > 1 ? sources[length - 1] : undefined,
3790
- guard = length > 2 ? sources[2] : undefined;
3791
-
3792
- customizer = (assigner.length > 3 && typeof customizer == 'function')
3793
- ? (length--, customizer)
3794
- : undefined;
3795
-
3796
- if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
3797
- customizer = length < 3 ? undefined : customizer;
3798
- length = 1;
3799
- }
3800
- object = Object(object);
3801
- while (++index < length) {
3802
- var source = sources[index];
3803
- if (source) {
3804
- assigner(object, source, index, customizer);
3805
- }
3806
- }
3807
- return object;
3808
- });
3809
- }
3810
-
3811
- var _createAssigner = createAssigner;
3812
-
3813
- /**
3814
- * This method is like `_.assign` except that it recursively merges own and
3815
- * inherited enumerable string keyed properties of source objects into the
3816
- * destination object. Source properties that resolve to `undefined` are
3817
- * skipped if a destination value exists. Array and plain object properties
3818
- * are merged recursively. Other objects and value types are overridden by
3819
- * assignment. Source objects are applied from left to right. Subsequent
3820
- * sources overwrite property assignments of previous sources.
3821
- *
3822
- * **Note:** This method mutates `object`.
3823
- *
3824
- * @static
3825
- * @memberOf _
3826
- * @since 0.5.0
3827
- * @category Object
3828
- * @param {Object} object The destination object.
3829
- * @param {...Object} [sources] The source objects.
3830
- * @returns {Object} Returns `object`.
3831
- * @example
3832
- *
3833
- * var object = {
3834
- * 'a': [{ 'b': 2 }, { 'd': 4 }]
3835
- * };
3836
- *
3837
- * var other = {
3838
- * 'a': [{ 'c': 3 }, { 'e': 5 }]
3839
- * };
3840
- *
3841
- * _.merge(object, other);
3842
- * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
3843
- */
3844
- _createAssigner(function(object, source, srcIndex) {
3845
- _baseMerge(object, source, srcIndex);
3846
- });
3847
-
3848
- var style = {"list":"_IsXdU","is-popup":"_-dvpa","default-list":"_QD1Mz","is-selected-all":"_M-mOy","default-list-item":"_KtOsz","is-selected":"_TQhBB","single-checked":"_2rUrh","is-disabled":"_NbwX5","selected-all":"_vN2Fx","selected-tag":"_6oITk","select-search":"_iAH9D"};
3849
-
3850
- const _excluded = ["children"];
3851
- const SelectList = _ref => {
3852
- let {
3853
- children
3854
- } = _ref,
3855
- p = _objectWithoutPropertiesLoose(_ref, _excluded);
3856
- const props = Object.assign({}, {
3857
- renderItemContent: ({
3858
- item
3859
- }) => {
3860
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
3861
- className: 'select-list-item-label'
3862
- }, item.label), item.description && /*#__PURE__*/React.createElement("div", {
3863
- className: 'select-list-item-description'
3864
- }, item.description));
3865
- },
3866
- renderItem: contextProps => {
3867
- const {
3868
- item,
3869
- props,
3870
- isSelectedAll,
3871
- value,
3872
- onSelect,
3873
- setValue,
3874
- onOpenChange
3875
- } = contextProps;
3876
- const {
3877
- single,
3878
- isPopup,
3879
- renderItemContent
3880
- } = props;
3881
- const isChecked = value.some(target => target.value === item.value);
3882
- return /*#__PURE__*/React.createElement(List.Item, {
3883
- className: classnames(style['default-list-item'], 'select-list-item', {
3884
- [style['is-selected']]: isChecked
3885
- }),
3886
- key: item.value,
3887
- onClick: () => {
3888
- if (item.disabled) {
3889
- return;
3890
- }
3891
- if (isSelectedAll) {
3892
- return;
3893
- }
3894
- if (single) {
3895
- setValue([item]);
3896
- } else {
3897
- onSelect(item);
3898
- }
3899
- if (isPopup && single) {
3900
- onOpenChange(false);
3901
- }
3902
- }
3903
- }, !single && /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Checkbox, {
3904
- checked: isSelectedAll || isChecked,
3905
- disabled: isSelectedAll || item.disabled
3906
- })), /*#__PURE__*/React.createElement(Flex, {
3907
- vertical: true,
3908
- gag: 8,
3909
- flex: 1,
3910
- className: 'select-list-item-content'
3911
- }, renderItemContent(contextProps)), single && /*#__PURE__*/React.createElement("div", {
3912
- className: style['single-checked']
3913
- }, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
3914
- },
3915
- renderList: contextProps => {
3916
- const {
3917
- props,
3918
- isSelectedAll,
3919
- list
3920
- } = contextProps;
3921
- const {
3922
- renderItem
3923
- } = props;
3924
- return /*#__PURE__*/React.createElement(List, {
3925
- className: classnames(style['default-list'], {
3926
- [style['is-selected-all']]: isSelectedAll
3927
- }),
3928
- size: "small",
3929
- dataSource: list,
3930
- renderItem: item => renderItem(Object.assign({}, contextProps, {
3931
- item
3932
- }))
3933
- });
3190
+ return item[labelKey].indexOf(tagSearchText) > -1;
3934
3191
  }
3935
3192
  }, p);
3936
- return /*#__PURE__*/React.createElement(SelectInput, props, targetProps => {
3193
+ const bodyRef = useRef(null);
3194
+ return /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
3195
+ ref: ref
3196
+ }), targetProps => {
3937
3197
  const {
3938
3198
  props,
3939
3199
  value,
3940
- searchText,
3941
- setSearchText
3200
+ setValue,
3201
+ onSelect,
3202
+ onRemove,
3203
+ onOpenChange
3942
3204
  } = targetProps;
3943
3205
  const {
3944
- isPopup,
3945
- getSearchProps,
3206
+ filterRender,
3207
+ columns,
3208
+ options,
3946
3209
  getSearchCallback,
3947
- searchPlaceholder
3948
- } = props;
3949
- const {
3210
+ getTagSearchCallback,
3211
+ api,
3212
+ selectedAllValue,
3213
+ isPopup,
3214
+ locale,
3950
3215
  single,
3216
+ maxLength,
3217
+ getSearchProps,
3218
+ searchPlaceholder,
3951
3219
  allowSelectedAll,
3952
- showSelectedTag,
3953
- api,
3954
- options,
3955
- renderList,
3956
- selectedAllValue
3220
+ labelKey,
3221
+ valueKey
3957
3222
  } = props;
3958
- const components = {
3959
- search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React.createElement(SearchInput, {
3960
- className: classnames(style['select-search'], 'select-list-search', {
3961
- 'is-popup': isPopup
3962
- }),
3963
- placeholder: searchPlaceholder,
3964
- value: searchText,
3965
- onSearch: value => {
3966
- setSearchText(value);
3967
- },
3968
- simple: isPopup,
3969
- showSearchButton: !isPopup
3223
+ const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
3224
+ return /*#__PURE__*/React.createElement(Row, {
3225
+ wrap: false,
3226
+ ref: bodyRef
3227
+ }, /*#__PURE__*/React.createElement(Col, {
3228
+ span: single ? 24 : 16
3229
+ }, /*#__PURE__*/React.createElement("div", null, filterRender(Object.assign({}, targetProps, {
3230
+ filter,
3231
+ setFilter
3232
+ }))), /*#__PURE__*/React.createElement(Row, {
3233
+ wrap: false,
3234
+ className: classnames(style['header'], 'select-table-list-header')
3235
+ }, !single && /*#__PURE__*/React.createElement(Col, {
3236
+ className: classnames(style['col'], 'select-table-list-col')
3237
+ }, allowSelectedAll ? /*#__PURE__*/React.createElement(Checkbox, {
3238
+ checked: isSelectedAll,
3239
+ onChange: e => {
3240
+ const checked = e.target.checked;
3241
+ if (!checked) {
3242
+ setValue([]);
3243
+ } else {
3244
+ setValue([selectedAllValue]);
3245
+ }
3246
+ }
3247
+ }) : /*#__PURE__*/React.createElement(Checkbox, {
3248
+ style: {
3249
+ visibility: 'hidden'
3250
+ }
3251
+ })), /*#__PURE__*/React.createElement(Col, {
3252
+ flex: 1
3253
+ }, /*#__PURE__*/React.createElement(Row, {
3254
+ wrap: false
3255
+ }, columns.map(column => {
3256
+ const {
3257
+ name,
3258
+ title,
3259
+ span
3260
+ } = column;
3261
+ return /*#__PURE__*/React.createElement(Col, {
3262
+ key: name,
3263
+ span: span,
3264
+ className: classnames(style['col'], 'select-table-list-col')
3265
+ }, title);
3266
+ })))), /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
3267
+ className: classnames(style['list'], 'select-table-list-scroll-list', {
3268
+ 'is-popup': isPopup
3970
3269
  }),
3971
- selectedAll: /*#__PURE__*/React.createElement("div", {
3972
- className: classnames(style['selected-all'], 'select-list-selected-all', {
3973
- 'is-popup': isPopup
3974
- })
3975
- }, !single && allowSelectedAll && /*#__PURE__*/React.createElement(SelectedAll, null)),
3976
- fetchList: /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
3977
- className: classnames(style['list'], 'select-list-scroll-list', {
3978
- 'is-popup': isPopup
3979
- }),
3980
- searchText: searchText,
3981
- getSearchProps: getSearchProps,
3982
- api: Object.assign({}, options ? {
3983
- data: {
3270
+ searchProps: filter,
3271
+ getSearchProps: getSearchProps,
3272
+ api: Object.assign({}, options ? {
3273
+ data: {
3274
+ options,
3275
+ filter
3276
+ },
3277
+ loader: ({
3278
+ data
3279
+ }) => {
3280
+ const {
3984
3281
  options,
3985
- searchText
3986
- },
3987
- loader: ({
3988
- data
3989
- }) => {
3990
- console.log(data);
3991
- const {
3992
- options,
3993
- searchText
3994
- } = data;
3995
- if (typeof getSearchCallback === 'function') {
3996
- const newOptions = options.filter(item => getSearchCallback(searchText, item));
3997
- return {
3998
- pageData: newOptions
3999
- };
4000
- }
3282
+ filter
3283
+ } = data;
3284
+ if (typeof getSearchCallback === 'function') {
3285
+ const newOptions = options.filter(item => getSearchCallback(filter, item, targetProps));
4001
3286
  return {
4002
- pageData: options
3287
+ pageData: newOptions
4003
3288
  };
4004
3289
  }
4005
- } : api)
4006
- }), fetchProps => {
4007
- const isSelectedAll = computedIsSelectAll(value, selectedAllValue);
4008
- return renderList(Object.assign({}, fetchProps, targetProps, {
4009
- isSelectedAll
4010
- }));
4011
- }),
4012
- selectedTag: showSelectedTag && /*#__PURE__*/React.createElement("div", {
4013
- className: classnames(style['selected-tag'], 'select-list-selected-tag', {
4014
- 'is-popup': isPopup
4015
- })
4016
- }, /*#__PURE__*/React.createElement(SelectedTagList, null))
4017
- };
4018
- if (typeof children === 'function') {
4019
- return children(Object.assign({}, targetProps, {
4020
- components
4021
- }));
4022
- }
4023
- return /*#__PURE__*/React.createElement(Flex, {
4024
- vertical: true
4025
- }, components.search, components.selectedAll, components.fetchList, components.selectedTag);
3290
+ return {
3291
+ pageData: options
3292
+ };
3293
+ }
3294
+ } : api)
3295
+ }), fetchProps => {
3296
+ const {
3297
+ list
3298
+ } = fetchProps;
3299
+ const contextProps = Object.assign({}, fetchProps, targetProps, {
3300
+ isSelectedAll
3301
+ });
3302
+ return list.map(item => {
3303
+ const isChecked = value.some(target => target[valueKey] === item[valueKey]);
3304
+ return /*#__PURE__*/React.createElement(Row, {
3305
+ wrap: false,
3306
+ key: item[valueKey],
3307
+ className: classnames(style['body'], 'select-table-list-body', [{
3308
+ [style['is-selected-all']]: isSelectedAll,
3309
+ [style['is-selected']]: isChecked,
3310
+ [style['is-disabled']]: item.disabled
3311
+ }]),
3312
+ onClick: () => {
3313
+ if (item.disabled) {
3314
+ return;
3315
+ }
3316
+ if (isSelectedAll) {
3317
+ return;
3318
+ }
3319
+ if (single) {
3320
+ setValue([item]);
3321
+ } else {
3322
+ onSelect(item);
3323
+ }
3324
+ if (isPopup && single) {
3325
+ onOpenChange(false);
3326
+ }
3327
+ }
3328
+ }, !single && /*#__PURE__*/React.createElement(Col, {
3329
+ className: classnames(style['col'], 'select-table-list-col')
3330
+ }, /*#__PURE__*/React.createElement(Checkbox, {
3331
+ disabled: item.disabled || isSelectedAll,
3332
+ checked: isSelectedAll || isChecked
3333
+ })), /*#__PURE__*/React.createElement(Col, {
3334
+ flex: 1
3335
+ }, /*#__PURE__*/React.createElement(Row, {
3336
+ wrap: false
3337
+ }, columns.map(column => {
3338
+ const {
3339
+ name,
3340
+ span,
3341
+ getValueOf
3342
+ } = column;
3343
+ return /*#__PURE__*/React.createElement(Col, {
3344
+ key: name,
3345
+ span: span,
3346
+ className: classnames(style['col'], 'select-table-list-col')
3347
+ }, typeof getValueOf === 'function' ? getValueOf(item, contextProps) : get_1(item, name));
3348
+ }))), single && /*#__PURE__*/React.createElement(Col, {
3349
+ className: classnames(style['col'], style['single-checked'], 'select-table-list-col')
3350
+ }, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
3351
+ });
3352
+ })), !single && /*#__PURE__*/React.createElement(Col, {
3353
+ className: classnames(style['right-options']),
3354
+ span: 8
3355
+ }, /*#__PURE__*/React.createElement(SearchInput, {
3356
+ className: style['tags-search'],
3357
+ placeholder: searchPlaceholder,
3358
+ value: tagSearchText,
3359
+ onSearch: value => {
3360
+ setTagSearchText(value);
3361
+ },
3362
+ showSearchButton: false
3363
+ }), /*#__PURE__*/React.createElement(Row, {
3364
+ wrap: false,
3365
+ justify: 'space-between',
3366
+ align: 'middle'
3367
+ }, /*#__PURE__*/React.createElement(Col, null, locale.selected, value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Button, {
3368
+ className: style['no-padding-btn'],
3369
+ type: "link",
3370
+ onClick: () => {
3371
+ setValue([]);
3372
+ }
3373
+ }, "\u79FB\u9664\u5168\u90E8"))), /*#__PURE__*/React.createElement(SimpleBar, null, /*#__PURE__*/React.createElement(Flex, {
3374
+ wrap: true,
3375
+ gap: 8
3376
+ }, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
3377
+ return /*#__PURE__*/React.createElement(Tag, {
3378
+ className: style['tag'],
3379
+ key: item[valueKey],
3380
+ closable: true,
3381
+ bordered: false,
3382
+ onClose: e => {
3383
+ e.preventDefault();
3384
+ onRemove(item);
3385
+ }
3386
+ }, /*#__PURE__*/React.createElement(Popover, {
3387
+ getPopupContainer: () => bodyRef.current,
3388
+ content: /*#__PURE__*/React.createElement(Row, {
3389
+ className: style['descriptions']
3390
+ }, columns.map(({
3391
+ name,
3392
+ title,
3393
+ getValueOf
3394
+ }) => {
3395
+ return /*#__PURE__*/React.createElement(Fragment, {
3396
+ key: name
3397
+ }, /*#__PURE__*/React.createElement(Col, {
3398
+ span: 8,
3399
+ className: style['descriptions-col-label']
3400
+ }, title), /*#__PURE__*/React.createElement(Col, {
3401
+ className: style['descriptions-col-content'],
3402
+ span: 16
3403
+ }, typeof getValueOf === 'function' ? getValueOf(item, targetProps) : get_1(item, name)));
3404
+ }))
3405
+ }, /*#__PURE__*/React.createElement("span", {
3406
+ className: style['tag-inner']
3407
+ }, item[labelKey])));
3408
+ })))));
4026
3409
  });
4027
- };
3410
+ });
4028
3411
 
4029
- export { SelectInput, SelectedAll, SelectedTagList, SelectList as default };
3412
+ export { SelectInput, SelectTableList, SelectedAll, SelectedTagList, SelectList as default };
4030
3413
  //# sourceMappingURL=index.modern.js.map