@geneui/components 3.0.0-next-9ffcb93-16102024 → 3.0.0-next-48d0ef7-31102024

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.
Files changed (248) hide show
  1. package/Avatar.js +63 -0
  2. package/CHANGELOG.md +7 -0
  3. package/Divider.js +23 -0
  4. package/{GeneUIProvider/index.js → GeneUIProvider.js} +52 -65
  5. package/HelperText.js +69 -0
  6. package/Info.js +64 -0
  7. package/Label.js +38 -0
  8. package/Loader.js +21 -0
  9. package/Pill.js +64 -0
  10. package/TextLink.js +20 -0
  11. package/{index-65217440.js → Tooltip.js} +104 -80
  12. package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
  13. package/components/atoms/Avatar/index.d.ts +1 -0
  14. package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
  15. package/components/atoms/Divider/index.d.ts +1 -0
  16. package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
  17. package/components/atoms/HelperText/index.d.ts +1 -0
  18. package/{lib → components}/atoms/Info/Info.d.ts +5 -5
  19. package/components/atoms/Info/index.d.ts +1 -0
  20. package/{lib → components}/atoms/Label/Label.d.ts +3 -3
  21. package/components/atoms/Label/index.d.ts +1 -0
  22. package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
  23. package/components/atoms/Loader/index.d.ts +1 -0
  24. package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
  25. package/components/atoms/Pill/index.d.ts +1 -0
  26. package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
  27. package/components/atoms/TextLink/index.d.ts +1 -0
  28. package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
  29. package/components/molecules/Tooltip/index.d.ts +1 -0
  30. package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
  31. package/components/providers/GeneUIProvider/index.d.ts +1 -0
  32. package/hooks/index.d.ts +2 -20
  33. package/hooks/useDebounceCallback/index.d.ts +1 -0
  34. package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
  35. package/hooks/useEllipsisDetection/index.d.ts +1 -1
  36. package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
  37. package/{index-031ff73c.js → index-ce02421b.js} +4 -4
  38. package/index.d.ts +11 -121
  39. package/index.js +12 -159
  40. package/package.json +24 -43
  41. package/tokens-0abb4e1b.js +6 -0
  42. package/types/index.d.ts +0 -3
  43. package/useEllipsisDetection-46d712b6.js +34 -0
  44. package/ActionableList/index.js +0 -1694
  45. package/AdvancedSearch/index.js +0 -892
  46. package/Alert/index.js +0 -98
  47. package/Avatar/index.js +0 -58
  48. package/Badge/index.js +0 -29
  49. package/Breadcrumb/index.js +0 -130
  50. package/BusyLoader/index.js +0 -31
  51. package/Button/index.js +0 -30
  52. package/Card/index.js +0 -502
  53. package/CardList/index.js +0 -662
  54. package/CellMeasurerCache-80be385d.js +0 -229
  55. package/Charts/index.js +0 -17662
  56. package/Checkbox/index.js +0 -229
  57. package/CheckboxGroup/index.js +0 -203
  58. package/CheckboxGroupWithSearch/index.js +0 -280
  59. package/Collapse/index.js +0 -195
  60. package/ColorPicker/index.js +0 -210
  61. package/ComboBox/index.js +0 -524
  62. package/Copy/index.js +0 -56
  63. package/Counter/index.js +0 -312
  64. package/DateFilter/index.js +0 -183
  65. package/DatePicker/index.js +0 -1229
  66. package/DatePickerInput/index.js +0 -883
  67. package/Divider/index.js +0 -23
  68. package/Drawer/index.js +0 -261
  69. package/Dropdown/index.js +0 -43
  70. package/Editor/index.js +0 -22975
  71. package/Empty/index.js +0 -76
  72. package/ExtendedInput/index.js +0 -590
  73. package/Form/index.js +0 -85
  74. package/FormContainer/index.js +0 -189
  75. package/FormableCheckbox/index.js +0 -24
  76. package/FormableDatePicker/index.js +0 -43
  77. package/FormableDropdown/index.js +0 -50
  78. package/FormableEditor/index.js +0 -26
  79. package/FormableHOC-85f89a81.js +0 -83
  80. package/FormableMultiSelectDropdown/index.js +0 -50
  81. package/FormableNumberInput/index.js +0 -34
  82. package/FormableRadio/index.js +0 -22
  83. package/FormableSwitcher/index.js +0 -22
  84. package/FormableTextInput/index.js +0 -34
  85. package/FormableUploader/index.js +0 -44
  86. package/Grid/index.js +0 -167
  87. package/HelperText/index.js +0 -86
  88. package/Holder/index.js +0 -261
  89. package/Icon/index.js +0 -62
  90. package/Image/index.js +0 -45
  91. package/ImagePreview/index.js +0 -217
  92. package/Info/index.js +0 -41
  93. package/InfoOutline-dd2e89d9.js +0 -29
  94. package/InteractiveWidget/index.js +0 -78
  95. package/KeyValue/index.js +0 -22
  96. package/Label/index.js +0 -48
  97. package/LinkButton/index.js +0 -34
  98. package/Loader/index.js +0 -23
  99. package/Menu/index.js +0 -281
  100. package/MobileNavigation/index.js +0 -94
  101. package/MobilePopup/index.js +0 -182
  102. package/Modal/index.js +0 -251
  103. package/ModuleTitle/index.js +0 -141
  104. package/NavigationMenu/index.js +0 -222
  105. package/Notification/index.js +0 -120
  106. package/Option/index.js +0 -184
  107. package/Overlay/index.js +0 -187
  108. package/Overspread/index.js +0 -291
  109. package/Pagination/index.js +0 -261
  110. package/Paper/index.js +0 -96
  111. package/Pill/index.js +0 -67
  112. package/Popover/index.js +0 -725
  113. package/PopoverV2/index.js +0 -19
  114. package/Portal/index.js +0 -58
  115. package/Products/index.js +0 -115
  116. package/Profile/index.js +0 -589
  117. package/Progress/index.js +0 -200
  118. package/QRCode/index.js +0 -814
  119. package/Radio/index.js +0 -151
  120. package/RadioGroup/index.js +0 -104
  121. package/Range/index.js +0 -191
  122. package/Rating/index.js +0 -174
  123. package/RichEditor/index.js +0 -13
  124. package/RichEditor-78c2617e.js +0 -228
  125. package/Scrollbar/index.js +0 -1585
  126. package/Search/index.js +0 -75
  127. package/SearchWithDropdown/index.js +0 -140
  128. package/Section/index.js +0 -61
  129. package/SkeletonLoader/index.js +0 -81
  130. package/Slider/index.js +0 -261
  131. package/Status/index.js +0 -97
  132. package/Steps/index.js +0 -314
  133. package/SuggestionList/index.js +0 -385
  134. package/Switcher/index.js +0 -193
  135. package/Table/index.js +0 -57
  136. package/TableCompositions/index.js +0 -16995
  137. package/Tabs/index.js +0 -235
  138. package/Tag/index.js +0 -102
  139. package/TextLink/index.js +0 -20
  140. package/Textarea/index.js +0 -242
  141. package/Time/index.js +0 -62
  142. package/TimePicker/index.js +0 -575
  143. package/Timeline/index.js +0 -113
  144. package/Title/index.js +0 -65
  145. package/Toaster/index.js +0 -116
  146. package/Tooltip/index.js +0 -6
  147. package/TransferList/index.js +0 -493
  148. package/Uploader/index.js +0 -992
  149. package/ValidatableCheckbox/index.js +0 -123
  150. package/ValidatableDatePicker/index.js +0 -316
  151. package/ValidatableDropdown/index.js +0 -141
  152. package/ValidatableElements/index.js +0 -67
  153. package/ValidatableMultiSelectDropdown/index.js +0 -152
  154. package/ValidatableNumberInput/index.js +0 -204
  155. package/ValidatableRadio/index.js +0 -116
  156. package/ValidatableSwitcher/index.js +0 -93
  157. package/ValidatableTextInput/index.js +0 -167
  158. package/ValidatableTimeInput/index.js +0 -174
  159. package/ValidatableUploader/index.js +0 -98
  160. package/Widget/index.js +0 -225
  161. package/_commonjsHelpers-24198af3.js +0 -35
  162. package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
  163. package/callAfterDelay-7272faca.js +0 -12
  164. package/checkTimeValidation-e56771be.js +0 -16
  165. package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
  166. package/clsx.m-2bb6df4b.js +0 -3
  167. package/config-1053d64d.js +0 -20
  168. package/configs-00612ce0.js +0 -103
  169. package/configs.js +0 -111
  170. package/dateValidation-67caec66.js +0 -225
  171. package/debounce-4419bc2f.js +0 -17
  172. package/guid-8ddf77b3.js +0 -16
  173. package/hooks/useBodyScroll.js +0 -16
  174. package/hooks/useClick.js +0 -18
  175. package/hooks/useClickOutside.js +0 -25
  176. package/hooks/useDebounce.js +0 -28
  177. package/hooks/useDeviceType.js +0 -17
  178. package/hooks/useDidMount.js +0 -15
  179. package/hooks/useForceUpdate.js +0 -8
  180. package/hooks/useHover.js +0 -20
  181. package/hooks/useImgDownload.js +0 -18
  182. package/hooks/useKeyDown.js +0 -21
  183. package/hooks/useMount.js +0 -13
  184. package/hooks/useMutationObserver.js +0 -21
  185. package/hooks/usePrevious.js +0 -10
  186. package/hooks/useThrottle.js +0 -16
  187. package/hooks/useToggle.js +0 -11
  188. package/hooks/useUpdatableRef.js +0 -14
  189. package/hooks/useUpdate.js +0 -10
  190. package/hooks/useWidth.js +0 -16
  191. package/hooks/useWindowSize.js +0 -40
  192. package/index-122432cd.js +0 -270
  193. package/index-262edd7a.js +0 -77
  194. package/index-2f5aa51e.js +0 -6483
  195. package/index-370f9acd.js +0 -4
  196. package/index-45eafea6.js +0 -90
  197. package/index-480fd7d9.js +0 -10032
  198. package/index-5f37f281.js +0 -168
  199. package/index-73aaa093.js +0 -1940
  200. package/index.mobile.d.ts +0 -14
  201. package/lib/atoms/Avatar/index.d.ts +0 -1
  202. package/lib/atoms/Badge/Badge.d.ts +0 -36
  203. package/lib/atoms/Badge/index.d.ts +0 -1
  204. package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
  205. package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
  206. package/lib/atoms/BusyLoader/index.d.ts +0 -1
  207. package/lib/atoms/Button/Button.d.ts +0 -70
  208. package/lib/atoms/Button/index.d.ts +0 -1
  209. package/lib/atoms/Divider/index.d.ts +0 -1
  210. package/lib/atoms/Empty/Empty.d.ts +0 -39
  211. package/lib/atoms/Empty/index.d.ts +0 -1
  212. package/lib/atoms/Empty/utils.d.ts +0 -9
  213. package/lib/atoms/HelperText/index.d.ts +0 -1
  214. package/lib/atoms/Image/Image.d.ts +0 -51
  215. package/lib/atoms/Image/index.d.ts +0 -1
  216. package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
  217. package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
  218. package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
  219. package/lib/atoms/ImagePreview/index.d.ts +0 -1
  220. package/lib/atoms/Info/index.d.ts +0 -1
  221. package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
  222. package/lib/atoms/KeyValue/index.d.ts +0 -1
  223. package/lib/atoms/Label/index.d.ts +0 -1
  224. package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
  225. package/lib/atoms/LinkButton/index.d.ts +0 -1
  226. package/lib/atoms/Loader/index.d.ts +0 -1
  227. package/lib/atoms/Pill/index.d.ts +0 -1
  228. package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
  229. package/lib/atoms/Rating/Rating.d.ts +0 -49
  230. package/lib/atoms/Rating/index.d.ts +0 -1
  231. package/lib/atoms/TextLink/index.d.ts +0 -1
  232. package/lib/molecules/Copy/Copy.d.ts +0 -38
  233. package/lib/molecules/Copy/index.d.ts +0 -1
  234. package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
  235. package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
  236. package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
  237. package/lib/molecules/Tooltip/index.d.ts +0 -1
  238. package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
  239. package/lib/providers/GeneUIProvider/index.d.ts +0 -1
  240. package/localization-4ba17032.js +0 -46
  241. package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
  242. package/rangeAndSlider-693a3d41.js +0 -8684
  243. package/react-beautiful-dnd.esm-b637016a.js +0 -10116
  244. package/react-lifecycles-compat.es-6e1f3768.js +0 -158
  245. package/redux-e591c1b8.js +0 -536
  246. package/tokens-8ab1179c.js +0 -6
  247. package/tslib.es6-f211516f.js +0 -35
  248. package/useEllipsisDetection-c1c9ad94.js +0 -38
@@ -1,1694 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { useRef, useState, useMemo, useCallback, useEffect, forwardRef, useImperativeHandle } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { P as PublicDraggable, C as ConnectedDroppable, D as DragDropContext } from '../react-beautiful-dnd.esm-b637016a.js';
5
- import { n as noop } from '../index-5f37f281.js';
6
- import Icon from '../Icon/index.js';
7
- import Empty from '../Empty/index.js';
8
- import BusyLoader from '../BusyLoader/index.js';
9
- import CustomScrollbar from '../Scrollbar/index.js';
10
- import Checkbox from '../Checkbox/index.js';
11
- import ExtendedInput from '../ExtendedInput/index.js';
12
- import { T as Tooltip } from '../index-65217440.js';
13
- import { c as commonjsGlobal } from '../_commonjsHelpers-24198af3.js';
14
- import Button from '../Button/index.js';
15
- import { s as styleInject } from '../style-inject.es-746bb8ed.js';
16
- import '../objectWithoutPropertiesLoose-e1596bdb.js';
17
- import '../redux-e591c1b8.js';
18
- import 'react-dom';
19
- import '../dateValidation-67caec66.js';
20
- import '../index-031ff73c.js';
21
- import '../tslib.es6-f211516f.js';
22
- import '../configs-00612ce0.js';
23
- import '../checkboxRadioSwitcher-5b69d7bd.js';
24
- import '../guid-8ddf77b3.js';
25
- import '../GeneUIProvider/index.js';
26
- import '../hooks/useDeviceType.js';
27
- import '../hooks/useWindowSize.js';
28
- import '../hooks/useDebounce.js';
29
- import '../useEllipsisDetection-c1c9ad94.js';
30
- import '../SuggestionList/index.js';
31
- import '../hooks/useKeyDown.js';
32
- import '../hooks/useClickOutside.js';
33
- import '../config-1053d64d.js';
34
- import '../callAfterDelay-7272faca.js';
35
-
36
- // @TODO think about internalization give possibilities to
37
- // pass tooltip texts via props refactor code duplications
38
- const searchMethods = {
39
- like: {
40
- value: 'like',
41
- tooltipText: 'Your typed text will be applied to the last level of the data and will use the "like search" algorithm.'
42
- },
43
- startsWith: {
44
- value: 'startsWith',
45
- tooltipText: 'Your typed text will be applied to the last level of the data and will use the "starts with search" algorithm.'
46
- },
47
- endsWith: {
48
- value: 'endsWith',
49
- tooltipText: 'Your typed text will be applied to the last level of the data and will use the "ends with search" algorithm.'
50
- }
51
- };
52
- const searchFunctions = {
53
- [searchMethods.like.value]: (label, searchKey) => "".concat(label).toLowerCase().includes(searchKey.toLowerCase()),
54
- [searchMethods.startsWith.value]: (label, searchKey) => label.toLowerCase().startsWith(searchKey.toLowerCase()),
55
- [searchMethods.endsWith.value]: (label, searchKey) => label.toLowerCase().endsWith(searchKey.toLowerCase())
56
- };
57
-
58
- /** Used for built-in method references. */
59
-
60
- var objectProto$6 = Object.prototype;
61
-
62
- /**
63
- * Checks if `value` is likely a prototype object.
64
- *
65
- * @private
66
- * @param {*} value The value to check.
67
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
68
- */
69
- function isPrototype$2(value) {
70
- var Ctor = value && value.constructor,
71
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
72
-
73
- return value === proto;
74
- }
75
-
76
- var _isPrototype = isPrototype$2;
77
-
78
- /**
79
- * Creates a unary function that invokes `func` with its argument transformed.
80
- *
81
- * @private
82
- * @param {Function} func The function to wrap.
83
- * @param {Function} transform The argument transform.
84
- * @returns {Function} Returns the new function.
85
- */
86
-
87
- function overArg$1(func, transform) {
88
- return function(arg) {
89
- return func(transform(arg));
90
- };
91
- }
92
-
93
- var _overArg = overArg$1;
94
-
95
- var overArg = _overArg;
96
-
97
- /* Built-in method references for those with the same name as other `lodash` methods. */
98
- var nativeKeys$1 = overArg(Object.keys, Object);
99
-
100
- var _nativeKeys = nativeKeys$1;
101
-
102
- var isPrototype$1 = _isPrototype,
103
- nativeKeys = _nativeKeys;
104
-
105
- /** Used for built-in method references. */
106
- var objectProto$5 = Object.prototype;
107
-
108
- /** Used to check objects for own properties. */
109
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
110
-
111
- /**
112
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
113
- *
114
- * @private
115
- * @param {Object} object The object to query.
116
- * @returns {Array} Returns the array of property names.
117
- */
118
- function baseKeys$1(object) {
119
- if (!isPrototype$1(object)) {
120
- return nativeKeys(object);
121
- }
122
- var result = [];
123
- for (var key in Object(object)) {
124
- if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
125
- result.push(key);
126
- }
127
- }
128
- return result;
129
- }
130
-
131
- var _baseKeys = baseKeys$1;
132
-
133
- /** Detect free variable `global` from Node.js. */
134
-
135
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
136
-
137
- var _freeGlobal = freeGlobal$1;
138
-
139
- var freeGlobal = _freeGlobal;
140
-
141
- /** Detect free variable `self`. */
142
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
143
-
144
- /** Used as a reference to the global object. */
145
- var root$7 = freeGlobal || freeSelf || Function('return this')();
146
-
147
- var _root = root$7;
148
-
149
- var root$6 = _root;
150
-
151
- /** Built-in value references. */
152
- var Symbol$2 = root$6.Symbol;
153
-
154
- var _Symbol = Symbol$2;
155
-
156
- var Symbol$1 = _Symbol;
157
-
158
- /** Used for built-in method references. */
159
- var objectProto$4 = Object.prototype;
160
-
161
- /** Used to check objects for own properties. */
162
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
163
-
164
- /**
165
- * Used to resolve the
166
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
167
- * of values.
168
- */
169
- var nativeObjectToString$1 = objectProto$4.toString;
170
-
171
- /** Built-in value references. */
172
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
173
-
174
- /**
175
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
176
- *
177
- * @private
178
- * @param {*} value The value to query.
179
- * @returns {string} Returns the raw `toStringTag`.
180
- */
181
- function getRawTag$1(value) {
182
- var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
183
- tag = value[symToStringTag$1];
184
-
185
- try {
186
- value[symToStringTag$1] = undefined;
187
- var unmasked = true;
188
- } catch (e) {}
189
-
190
- var result = nativeObjectToString$1.call(value);
191
- if (unmasked) {
192
- if (isOwn) {
193
- value[symToStringTag$1] = tag;
194
- } else {
195
- delete value[symToStringTag$1];
196
- }
197
- }
198
- return result;
199
- }
200
-
201
- var _getRawTag = getRawTag$1;
202
-
203
- /** Used for built-in method references. */
204
-
205
- var objectProto$3 = Object.prototype;
206
-
207
- /**
208
- * Used to resolve the
209
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
210
- * of values.
211
- */
212
- var nativeObjectToString = objectProto$3.toString;
213
-
214
- /**
215
- * Converts `value` to a string using `Object.prototype.toString`.
216
- *
217
- * @private
218
- * @param {*} value The value to convert.
219
- * @returns {string} Returns the converted string.
220
- */
221
- function objectToString$1(value) {
222
- return nativeObjectToString.call(value);
223
- }
224
-
225
- var _objectToString = objectToString$1;
226
-
227
- var Symbol = _Symbol,
228
- getRawTag = _getRawTag,
229
- objectToString = _objectToString;
230
-
231
- /** `Object#toString` result references. */
232
- var nullTag = '[object Null]',
233
- undefinedTag = '[object Undefined]';
234
-
235
- /** Built-in value references. */
236
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
237
-
238
- /**
239
- * The base implementation of `getTag` without fallbacks for buggy environments.
240
- *
241
- * @private
242
- * @param {*} value The value to query.
243
- * @returns {string} Returns the `toStringTag`.
244
- */
245
- function baseGetTag$4(value) {
246
- if (value == null) {
247
- return value === undefined ? undefinedTag : nullTag;
248
- }
249
- return (symToStringTag && symToStringTag in Object(value))
250
- ? getRawTag(value)
251
- : objectToString(value);
252
- }
253
-
254
- var _baseGetTag = baseGetTag$4;
255
-
256
- /**
257
- * Checks if `value` is the
258
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
259
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
260
- *
261
- * @static
262
- * @memberOf _
263
- * @since 0.1.0
264
- * @category Lang
265
- * @param {*} value The value to check.
266
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
267
- * @example
268
- *
269
- * _.isObject({});
270
- * // => true
271
- *
272
- * _.isObject([1, 2, 3]);
273
- * // => true
274
- *
275
- * _.isObject(_.noop);
276
- * // => true
277
- *
278
- * _.isObject(null);
279
- * // => false
280
- */
281
-
282
- function isObject$2(value) {
283
- var type = typeof value;
284
- return value != null && (type == 'object' || type == 'function');
285
- }
286
-
287
- var isObject_1 = isObject$2;
288
-
289
- var baseGetTag$3 = _baseGetTag,
290
- isObject$1 = isObject_1;
291
-
292
- /** `Object#toString` result references. */
293
- var asyncTag = '[object AsyncFunction]',
294
- funcTag$1 = '[object Function]',
295
- genTag = '[object GeneratorFunction]',
296
- proxyTag = '[object Proxy]';
297
-
298
- /**
299
- * Checks if `value` is classified as a `Function` object.
300
- *
301
- * @static
302
- * @memberOf _
303
- * @since 0.1.0
304
- * @category Lang
305
- * @param {*} value The value to check.
306
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
307
- * @example
308
- *
309
- * _.isFunction(_);
310
- * // => true
311
- *
312
- * _.isFunction(/abc/);
313
- * // => false
314
- */
315
- function isFunction$2(value) {
316
- if (!isObject$1(value)) {
317
- return false;
318
- }
319
- // The use of `Object#toString` avoids issues with the `typeof` operator
320
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
321
- var tag = baseGetTag$3(value);
322
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
323
- }
324
-
325
- var isFunction_1 = isFunction$2;
326
-
327
- var root$5 = _root;
328
-
329
- /** Used to detect overreaching core-js shims. */
330
- var coreJsData$1 = root$5['__core-js_shared__'];
331
-
332
- var _coreJsData = coreJsData$1;
333
-
334
- var coreJsData = _coreJsData;
335
-
336
- /** Used to detect methods masquerading as native. */
337
- var maskSrcKey = (function() {
338
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
339
- return uid ? ('Symbol(src)_1.' + uid) : '';
340
- }());
341
-
342
- /**
343
- * Checks if `func` has its source masked.
344
- *
345
- * @private
346
- * @param {Function} func The function to check.
347
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
348
- */
349
- function isMasked$1(func) {
350
- return !!maskSrcKey && (maskSrcKey in func);
351
- }
352
-
353
- var _isMasked = isMasked$1;
354
-
355
- /** Used for built-in method references. */
356
-
357
- var funcProto$1 = Function.prototype;
358
-
359
- /** Used to resolve the decompiled source of functions. */
360
- var funcToString$1 = funcProto$1.toString;
361
-
362
- /**
363
- * Converts `func` to its source code.
364
- *
365
- * @private
366
- * @param {Function} func The function to convert.
367
- * @returns {string} Returns the source code.
368
- */
369
- function toSource$2(func) {
370
- if (func != null) {
371
- try {
372
- return funcToString$1.call(func);
373
- } catch (e) {}
374
- try {
375
- return (func + '');
376
- } catch (e) {}
377
- }
378
- return '';
379
- }
380
-
381
- var _toSource = toSource$2;
382
-
383
- var isFunction$1 = isFunction_1,
384
- isMasked = _isMasked,
385
- isObject = isObject_1,
386
- toSource$1 = _toSource;
387
-
388
- /**
389
- * Used to match `RegExp`
390
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
391
- */
392
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
393
-
394
- /** Used to detect host constructors (Safari). */
395
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
396
-
397
- /** Used for built-in method references. */
398
- var funcProto = Function.prototype,
399
- objectProto$2 = Object.prototype;
400
-
401
- /** Used to resolve the decompiled source of functions. */
402
- var funcToString = funcProto.toString;
403
-
404
- /** Used to check objects for own properties. */
405
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
406
-
407
- /** Used to detect if a method is native. */
408
- var reIsNative = RegExp('^' +
409
- funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
410
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
411
- );
412
-
413
- /**
414
- * The base implementation of `_.isNative` without bad shim checks.
415
- *
416
- * @private
417
- * @param {*} value The value to check.
418
- * @returns {boolean} Returns `true` if `value` is a native function,
419
- * else `false`.
420
- */
421
- function baseIsNative$1(value) {
422
- if (!isObject(value) || isMasked(value)) {
423
- return false;
424
- }
425
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
426
- return pattern.test(toSource$1(value));
427
- }
428
-
429
- var _baseIsNative = baseIsNative$1;
430
-
431
- /**
432
- * Gets the value at `key` of `object`.
433
- *
434
- * @private
435
- * @param {Object} [object] The object to query.
436
- * @param {string} key The key of the property to get.
437
- * @returns {*} Returns the property value.
438
- */
439
-
440
- function getValue$1(object, key) {
441
- return object == null ? undefined : object[key];
442
- }
443
-
444
- var _getValue = getValue$1;
445
-
446
- var baseIsNative = _baseIsNative,
447
- getValue = _getValue;
448
-
449
- /**
450
- * Gets the native function at `key` of `object`.
451
- *
452
- * @private
453
- * @param {Object} object The object to query.
454
- * @param {string} key The key of the method to get.
455
- * @returns {*} Returns the function if it's native, else `undefined`.
456
- */
457
- function getNative$5(object, key) {
458
- var value = getValue(object, key);
459
- return baseIsNative(value) ? value : undefined;
460
- }
461
-
462
- var _getNative = getNative$5;
463
-
464
- var getNative$4 = _getNative,
465
- root$4 = _root;
466
-
467
- /* Built-in method references that are verified to be native. */
468
- var DataView$1 = getNative$4(root$4, 'DataView');
469
-
470
- var _DataView = DataView$1;
471
-
472
- var getNative$3 = _getNative,
473
- root$3 = _root;
474
-
475
- /* Built-in method references that are verified to be native. */
476
- var Map$1 = getNative$3(root$3, 'Map');
477
-
478
- var _Map = Map$1;
479
-
480
- var getNative$2 = _getNative,
481
- root$2 = _root;
482
-
483
- /* Built-in method references that are verified to be native. */
484
- var Promise$2 = getNative$2(root$2, 'Promise');
485
-
486
- var _Promise = Promise$2;
487
-
488
- var getNative$1 = _getNative,
489
- root$1 = _root;
490
-
491
- /* Built-in method references that are verified to be native. */
492
- var Set$1 = getNative$1(root$1, 'Set');
493
-
494
- var _Set = Set$1;
495
-
496
- var getNative = _getNative,
497
- root = _root;
498
-
499
- /* Built-in method references that are verified to be native. */
500
- var WeakMap$1 = getNative(root, 'WeakMap');
501
-
502
- var _WeakMap = WeakMap$1;
503
-
504
- var DataView = _DataView,
505
- Map = _Map,
506
- Promise$1 = _Promise,
507
- Set = _Set,
508
- WeakMap = _WeakMap,
509
- baseGetTag$2 = _baseGetTag,
510
- toSource = _toSource;
511
-
512
- /** `Object#toString` result references. */
513
- var mapTag$2 = '[object Map]',
514
- objectTag$1 = '[object Object]',
515
- promiseTag = '[object Promise]',
516
- setTag$2 = '[object Set]',
517
- weakMapTag$1 = '[object WeakMap]';
518
-
519
- var dataViewTag$1 = '[object DataView]';
520
-
521
- /** Used to detect maps, sets, and weakmaps. */
522
- var dataViewCtorString = toSource(DataView),
523
- mapCtorString = toSource(Map),
524
- promiseCtorString = toSource(Promise$1),
525
- setCtorString = toSource(Set),
526
- weakMapCtorString = toSource(WeakMap);
527
-
528
- /**
529
- * Gets the `toStringTag` of `value`.
530
- *
531
- * @private
532
- * @param {*} value The value to query.
533
- * @returns {string} Returns the `toStringTag`.
534
- */
535
- var getTag$1 = baseGetTag$2;
536
-
537
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
538
- if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
539
- (Map && getTag$1(new Map) != mapTag$2) ||
540
- (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
541
- (Set && getTag$1(new Set) != setTag$2) ||
542
- (WeakMap && getTag$1(new WeakMap) != weakMapTag$1)) {
543
- getTag$1 = function(value) {
544
- var result = baseGetTag$2(value),
545
- Ctor = result == objectTag$1 ? value.constructor : undefined,
546
- ctorString = Ctor ? toSource(Ctor) : '';
547
-
548
- if (ctorString) {
549
- switch (ctorString) {
550
- case dataViewCtorString: return dataViewTag$1;
551
- case mapCtorString: return mapTag$2;
552
- case promiseCtorString: return promiseTag;
553
- case setCtorString: return setTag$2;
554
- case weakMapCtorString: return weakMapTag$1;
555
- }
556
- }
557
- return result;
558
- };
559
- }
560
-
561
- var _getTag = getTag$1;
562
-
563
- /**
564
- * Checks if `value` is object-like. A value is object-like if it's not `null`
565
- * and has a `typeof` result of "object".
566
- *
567
- * @static
568
- * @memberOf _
569
- * @since 4.0.0
570
- * @category Lang
571
- * @param {*} value The value to check.
572
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
573
- * @example
574
- *
575
- * _.isObjectLike({});
576
- * // => true
577
- *
578
- * _.isObjectLike([1, 2, 3]);
579
- * // => true
580
- *
581
- * _.isObjectLike(_.noop);
582
- * // => false
583
- *
584
- * _.isObjectLike(null);
585
- * // => false
586
- */
587
-
588
- function isObjectLike$3(value) {
589
- return value != null && typeof value == 'object';
590
- }
591
-
592
- var isObjectLike_1 = isObjectLike$3;
593
-
594
- var baseGetTag$1 = _baseGetTag,
595
- isObjectLike$2 = isObjectLike_1;
596
-
597
- /** `Object#toString` result references. */
598
- var argsTag$1 = '[object Arguments]';
599
-
600
- /**
601
- * The base implementation of `_.isArguments`.
602
- *
603
- * @private
604
- * @param {*} value The value to check.
605
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
606
- */
607
- function baseIsArguments$1(value) {
608
- return isObjectLike$2(value) && baseGetTag$1(value) == argsTag$1;
609
- }
610
-
611
- var _baseIsArguments = baseIsArguments$1;
612
-
613
- var baseIsArguments = _baseIsArguments,
614
- isObjectLike$1 = isObjectLike_1;
615
-
616
- /** Used for built-in method references. */
617
- var objectProto$1 = Object.prototype;
618
-
619
- /** Used to check objects for own properties. */
620
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
621
-
622
- /** Built-in value references. */
623
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
624
-
625
- /**
626
- * Checks if `value` is likely an `arguments` object.
627
- *
628
- * @static
629
- * @memberOf _
630
- * @since 0.1.0
631
- * @category Lang
632
- * @param {*} value The value to check.
633
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
634
- * else `false`.
635
- * @example
636
- *
637
- * _.isArguments(function() { return arguments; }());
638
- * // => true
639
- *
640
- * _.isArguments([1, 2, 3]);
641
- * // => false
642
- */
643
- var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
644
- return isObjectLike$1(value) && hasOwnProperty$1.call(value, 'callee') &&
645
- !propertyIsEnumerable.call(value, 'callee');
646
- };
647
-
648
- var isArguments_1 = isArguments$1;
649
-
650
- /**
651
- * Checks if `value` is classified as an `Array` object.
652
- *
653
- * @static
654
- * @memberOf _
655
- * @since 0.1.0
656
- * @category Lang
657
- * @param {*} value The value to check.
658
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
659
- * @example
660
- *
661
- * _.isArray([1, 2, 3]);
662
- * // => true
663
- *
664
- * _.isArray(document.body.children);
665
- * // => false
666
- *
667
- * _.isArray('abc');
668
- * // => false
669
- *
670
- * _.isArray(_.noop);
671
- * // => false
672
- */
673
-
674
- var isArray$1 = Array.isArray;
675
-
676
- var isArray_1 = isArray$1;
677
-
678
- /** Used as references for various `Number` constants. */
679
-
680
- var MAX_SAFE_INTEGER = 9007199254740991;
681
-
682
- /**
683
- * Checks if `value` is a valid array-like length.
684
- *
685
- * **Note:** This method is loosely based on
686
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
687
- *
688
- * @static
689
- * @memberOf _
690
- * @since 4.0.0
691
- * @category Lang
692
- * @param {*} value The value to check.
693
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
694
- * @example
695
- *
696
- * _.isLength(3);
697
- * // => true
698
- *
699
- * _.isLength(Number.MIN_VALUE);
700
- * // => false
701
- *
702
- * _.isLength(Infinity);
703
- * // => false
704
- *
705
- * _.isLength('3');
706
- * // => false
707
- */
708
- function isLength$2(value) {
709
- return typeof value == 'number' &&
710
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
711
- }
712
-
713
- var isLength_1 = isLength$2;
714
-
715
- var isFunction = isFunction_1,
716
- isLength$1 = isLength_1;
717
-
718
- /**
719
- * Checks if `value` is array-like. A value is considered array-like if it's
720
- * not a function and has a `value.length` that's an integer greater than or
721
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
722
- *
723
- * @static
724
- * @memberOf _
725
- * @since 4.0.0
726
- * @category Lang
727
- * @param {*} value The value to check.
728
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
729
- * @example
730
- *
731
- * _.isArrayLike([1, 2, 3]);
732
- * // => true
733
- *
734
- * _.isArrayLike(document.body.children);
735
- * // => true
736
- *
737
- * _.isArrayLike('abc');
738
- * // => true
739
- *
740
- * _.isArrayLike(_.noop);
741
- * // => false
742
- */
743
- function isArrayLike$1(value) {
744
- return value != null && isLength$1(value.length) && !isFunction(value);
745
- }
746
-
747
- var isArrayLike_1 = isArrayLike$1;
748
-
749
- var isBufferExports = {};
750
- var isBuffer$1 = {
751
- get exports(){ return isBufferExports; },
752
- set exports(v){ isBufferExports = v; },
753
- };
754
-
755
- /**
756
- * This method returns `false`.
757
- *
758
- * @static
759
- * @memberOf _
760
- * @since 4.13.0
761
- * @category Util
762
- * @returns {boolean} Returns `false`.
763
- * @example
764
- *
765
- * _.times(2, _.stubFalse);
766
- * // => [false, false]
767
- */
768
-
769
- function stubFalse() {
770
- return false;
771
- }
772
-
773
- var stubFalse_1 = stubFalse;
774
-
775
- (function (module, exports) {
776
- var root = _root,
777
- stubFalse = stubFalse_1;
778
-
779
- /** Detect free variable `exports`. */
780
- var freeExports = exports && !exports.nodeType && exports;
781
-
782
- /** Detect free variable `module`. */
783
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
784
-
785
- /** Detect the popular CommonJS extension `module.exports`. */
786
- var moduleExports = freeModule && freeModule.exports === freeExports;
787
-
788
- /** Built-in value references. */
789
- var Buffer = moduleExports ? root.Buffer : undefined;
790
-
791
- /* Built-in method references for those with the same name as other `lodash` methods. */
792
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
793
-
794
- /**
795
- * Checks if `value` is a buffer.
796
- *
797
- * @static
798
- * @memberOf _
799
- * @since 4.3.0
800
- * @category Lang
801
- * @param {*} value The value to check.
802
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
803
- * @example
804
- *
805
- * _.isBuffer(new Buffer(2));
806
- * // => true
807
- *
808
- * _.isBuffer(new Uint8Array(2));
809
- * // => false
810
- */
811
- var isBuffer = nativeIsBuffer || stubFalse;
812
-
813
- module.exports = isBuffer;
814
- } (isBuffer$1, isBufferExports));
815
-
816
- var baseGetTag = _baseGetTag,
817
- isLength = isLength_1,
818
- isObjectLike = isObjectLike_1;
819
-
820
- /** `Object#toString` result references. */
821
- var argsTag = '[object Arguments]',
822
- arrayTag = '[object Array]',
823
- boolTag = '[object Boolean]',
824
- dateTag = '[object Date]',
825
- errorTag = '[object Error]',
826
- funcTag = '[object Function]',
827
- mapTag$1 = '[object Map]',
828
- numberTag = '[object Number]',
829
- objectTag = '[object Object]',
830
- regexpTag = '[object RegExp]',
831
- setTag$1 = '[object Set]',
832
- stringTag = '[object String]',
833
- weakMapTag = '[object WeakMap]';
834
-
835
- var arrayBufferTag = '[object ArrayBuffer]',
836
- dataViewTag = '[object DataView]',
837
- float32Tag = '[object Float32Array]',
838
- float64Tag = '[object Float64Array]',
839
- int8Tag = '[object Int8Array]',
840
- int16Tag = '[object Int16Array]',
841
- int32Tag = '[object Int32Array]',
842
- uint8Tag = '[object Uint8Array]',
843
- uint8ClampedTag = '[object Uint8ClampedArray]',
844
- uint16Tag = '[object Uint16Array]',
845
- uint32Tag = '[object Uint32Array]';
846
-
847
- /** Used to identify `toStringTag` values of typed arrays. */
848
- var typedArrayTags = {};
849
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
850
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
851
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
852
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
853
- typedArrayTags[uint32Tag] = true;
854
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
855
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
856
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
857
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
858
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
859
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
860
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
861
- typedArrayTags[weakMapTag] = false;
862
-
863
- /**
864
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
865
- *
866
- * @private
867
- * @param {*} value The value to check.
868
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
869
- */
870
- function baseIsTypedArray$1(value) {
871
- return isObjectLike(value) &&
872
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
873
- }
874
-
875
- var _baseIsTypedArray = baseIsTypedArray$1;
876
-
877
- /**
878
- * The base implementation of `_.unary` without support for storing metadata.
879
- *
880
- * @private
881
- * @param {Function} func The function to cap arguments for.
882
- * @returns {Function} Returns the new capped function.
883
- */
884
-
885
- function baseUnary$1(func) {
886
- return function(value) {
887
- return func(value);
888
- };
889
- }
890
-
891
- var _baseUnary = baseUnary$1;
892
-
893
- var _nodeUtilExports = {};
894
- var _nodeUtil = {
895
- get exports(){ return _nodeUtilExports; },
896
- set exports(v){ _nodeUtilExports = v; },
897
- };
898
-
899
- (function (module, exports) {
900
- var freeGlobal = _freeGlobal;
901
-
902
- /** Detect free variable `exports`. */
903
- var freeExports = exports && !exports.nodeType && exports;
904
-
905
- /** Detect free variable `module`. */
906
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
907
-
908
- /** Detect the popular CommonJS extension `module.exports`. */
909
- var moduleExports = freeModule && freeModule.exports === freeExports;
910
-
911
- /** Detect free variable `process` from Node.js. */
912
- var freeProcess = moduleExports && freeGlobal.process;
913
-
914
- /** Used to access faster Node.js helpers. */
915
- var nodeUtil = (function() {
916
- try {
917
- // Use `util.types` for Node.js 10+.
918
- var types = freeModule && freeModule.require && freeModule.require('util').types;
919
-
920
- if (types) {
921
- return types;
922
- }
923
-
924
- // Legacy `process.binding('util')` for Node.js < 10.
925
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
926
- } catch (e) {}
927
- }());
928
-
929
- module.exports = nodeUtil;
930
- } (_nodeUtil, _nodeUtilExports));
931
-
932
- var baseIsTypedArray = _baseIsTypedArray,
933
- baseUnary = _baseUnary,
934
- nodeUtil = _nodeUtilExports;
935
-
936
- /* Node.js helper references. */
937
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
938
-
939
- /**
940
- * Checks if `value` is classified as a typed array.
941
- *
942
- * @static
943
- * @memberOf _
944
- * @since 3.0.0
945
- * @category Lang
946
- * @param {*} value The value to check.
947
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
948
- * @example
949
- *
950
- * _.isTypedArray(new Uint8Array);
951
- * // => true
952
- *
953
- * _.isTypedArray([]);
954
- * // => false
955
- */
956
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
957
-
958
- var isTypedArray_1 = isTypedArray$1;
959
-
960
- var baseKeys = _baseKeys,
961
- getTag = _getTag,
962
- isArguments = isArguments_1,
963
- isArray = isArray_1,
964
- isArrayLike = isArrayLike_1,
965
- isBuffer = isBufferExports,
966
- isPrototype = _isPrototype,
967
- isTypedArray = isTypedArray_1;
968
-
969
- /** `Object#toString` result references. */
970
- var mapTag = '[object Map]',
971
- setTag = '[object Set]';
972
-
973
- /** Used for built-in method references. */
974
- var objectProto = Object.prototype;
975
-
976
- /** Used to check objects for own properties. */
977
- var hasOwnProperty = objectProto.hasOwnProperty;
978
-
979
- /**
980
- * Checks if `value` is an empty object, collection, map, or set.
981
- *
982
- * Objects are considered empty if they have no own enumerable string keyed
983
- * properties.
984
- *
985
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
986
- * jQuery-like collections are considered empty if they have a `length` of `0`.
987
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
988
- *
989
- * @static
990
- * @memberOf _
991
- * @since 0.1.0
992
- * @category Lang
993
- * @param {*} value The value to check.
994
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
995
- * @example
996
- *
997
- * _.isEmpty(null);
998
- * // => true
999
- *
1000
- * _.isEmpty(true);
1001
- * // => true
1002
- *
1003
- * _.isEmpty(1);
1004
- * // => true
1005
- *
1006
- * _.isEmpty([1, 2, 3]);
1007
- * // => false
1008
- *
1009
- * _.isEmpty({ 'a': 1 });
1010
- * // => false
1011
- */
1012
- function isEmpty(value) {
1013
- if (value == null) {
1014
- return true;
1015
- }
1016
- if (isArrayLike(value) &&
1017
- (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
1018
- isBuffer(value) || isTypedArray(value) || isArguments(value))) {
1019
- return !value.length;
1020
- }
1021
- var tag = getTag(value);
1022
- if (tag == mapTag || tag == setTag) {
1023
- return !value.size;
1024
- }
1025
- if (isPrototype(value)) {
1026
- return !baseKeys(value).length;
1027
- }
1028
- for (var key in value) {
1029
- if (hasOwnProperty.call(value, key)) {
1030
- return false;
1031
- }
1032
- }
1033
- return true;
1034
- }
1035
-
1036
- var isEmpty_1 = isEmpty;
1037
-
1038
- var css_248z = "[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list{display:flex;flex-direction:column;height:100%}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-header{margin:16px 0}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-header .gene-actionable-list-header-title{align-items:center;border-bottom:1px solid rgba(var(--background-sc-rgb),.1);display:flex;font:600 1.4rem/1.8rem var(--font-family);height:5.1rem;justify-content:space-between;padding:0 2rem}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-header .gene-actionable-list-header-title h5{color:var(--hero)}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-header .gene-actionable-list-header-title span{color:rgba(var(--background-sc-rgb),.5)}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-header .gene-actionable-list-header-search-box{align-items:center;display:flex;padding:16px}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-header .gene-actionable-list-header-mark-all{padding:0 32px}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-body{height:100%;padding:0 16px}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-body .gene-actionable-list-row-content{align-items:center;background-color:var(--background);border:1px solid rgba(var(--background-sc-rgb),.1);border-radius:8px;display:flex;margin-bottom:1.5rem;padding:0 8px}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-body .gene-actionable-list-row-content .gene-actionable-list-row-content-body{align-items:center;display:flex;flex:1;height:100%}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-body .gene-actionable-list-row-content .gene-actionable-list-row-content-body>span{line-height:40px;margin-left:8px;width:100%}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-body .gene-actionable-list-row-content .gene-actionable-list-row-content-body>span>span.highlight{background:rgba(var(--hero-rgb),.15);color:var(--hero)}[data-gene-ui-version=\"2.16.3\"] .gene-actionable-list .gene-actionable-list-body .gene-actionable-list-row-children{margin-left:34px}";
1039
- styleInject(css_248z);
1040
-
1041
- function RowContent(_ref) {
1042
- let {
1043
- label,
1044
- highlightedLabel,
1045
- isChecked,
1046
- isPermanent,
1047
- // @TODO extend CRM permanent row styles for this flag
1048
- isOpened,
1049
- isDraggable,
1050
- isSelectable,
1051
- hasChildren,
1052
- onArrowBtnClick,
1053
- onCheckboxClick,
1054
- tooltipProps,
1055
- childNodesCount,
1056
- selectedChildNodesCount
1057
- } = _ref;
1058
- const checkboxRef = useRef({});
1059
- const handleCheckboxChange = _ref2 => {
1060
- let {
1061
- current
1062
- } = _ref2;
1063
- onCheckboxClick(current.checked);
1064
- };
1065
- const dynamicProps = {};
1066
- if (isSelectable) {
1067
- dynamicProps.onChange = () => {
1068
- handleCheckboxChange(checkboxRef);
1069
- };
1070
- dynamicProps.style = {
1071
- cursor: 'pointer'
1072
- };
1073
- }
1074
- return /*#__PURE__*/React__default.createElement("div", {
1075
- className: "gene-actionable-list-row-content"
1076
- }, hasChildren && /*#__PURE__*/React__default.createElement(Button, {
1077
- appearance: "minimal",
1078
- icon: "bc-icon-arrow-".concat(isOpened ? 'down' : 'right'),
1079
- onClick: onArrowBtnClick
1080
- }), /*#__PURE__*/React__default.createElement("div", {
1081
- className: "gene-actionable-list-row-content-body"
1082
- }, isSelectable && /*#__PURE__*/React__default.createElement(Checkbox, _extends({
1083
- indeterminate: isChecked === null,
1084
- checked: isChecked,
1085
- ref: checkboxRef
1086
- }, dynamicProps)), /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.isValidElement(highlightedLabel) ? highlightedLabel : label)), !isEmpty_1(tooltipProps) && /*#__PURE__*/React__default.createElement(Tooltip, tooltipProps, /*#__PURE__*/React__default.createElement(Icon, {
1087
- type: "bc-icon-info"
1088
- })), isDraggable && /*#__PURE__*/React__default.createElement(Icon, {
1089
- type: "bc-icon-drag"
1090
- }));
1091
- }
1092
- RowContent.propTypes = {
1093
- label: PropTypes.string,
1094
- highlightedLabel: PropTypes.node,
1095
- isChecked: PropTypes.bool,
1096
- isPermanent: PropTypes.bool,
1097
- isOpened: PropTypes.bool,
1098
- hasChildren: PropTypes.bool,
1099
- onArrowBtnClick: PropTypes.func,
1100
- onCheckboxClick: PropTypes.func,
1101
- isDraggable: PropTypes.bool,
1102
- isSelectable: PropTypes.bool,
1103
- tooltipProps: PropTypes.shape({
1104
- ...Tooltip.propTypes
1105
- })
1106
- };
1107
- RowContent.defaultProps = {
1108
- onArrowBtnClick: noop,
1109
- onCheckboxClick: noop,
1110
- tooltipProps: {}
1111
- };
1112
- RowContent.displayName = 'RowContent';
1113
-
1114
- const getItemStyle = (isDragging, draggableStyle) => ({
1115
- // some basic styles to make the items look a bit nicer
1116
- userSelect: 'none',
1117
- // padding: grid * 2,
1118
- margin: "0 0 1.5rem 0",
1119
- // change background colour if dragging
1120
- // background: isDragging ? "lightgreen" : "grey",
1121
-
1122
- // styles we need to apply on draggables
1123
- ...draggableStyle
1124
- });
1125
- function Row(props) {
1126
- const {
1127
- label,
1128
- id,
1129
- isChecked,
1130
- isVisible,
1131
- isPermanent,
1132
- positionIndex,
1133
- parentId,
1134
- childrenList,
1135
- isOpen,
1136
- isDraggable,
1137
- isSelectable,
1138
- onRowSelectHandler,
1139
- ...restProps
1140
- } = props;
1141
- const [isOpened, setIsOpened] = useState(isOpen);
1142
- const hasChildren = useMemo(() => childrenList.length > 0, [childrenList]);
1143
- const onRowToggleHandler = useCallback(() => {
1144
- setIsOpened(!isOpened);
1145
- // eslint-disable-next-line react-hooks/exhaustive-deps
1146
- }, [isOpened]);
1147
- useEffect(() => {
1148
- setIsOpened(isOpen);
1149
- }, [isOpen]);
1150
- const onRowSelectHandlerWrapper = checked => {
1151
- onRowSelectHandler(props, checked);
1152
- };
1153
- return isVisible && /*#__PURE__*/React__default.createElement(PublicDraggable, {
1154
- draggableId: id,
1155
- index: positionIndex,
1156
- isDragDisabled: !isDraggable || isOpened
1157
- }, (provided, snapshot) => /*#__PURE__*/React__default.createElement("div", _extends({
1158
- className: "gene-actionable-list-row",
1159
- ref: provided.innerRef
1160
- }, provided.draggableProps, provided.dragHandleProps, {
1161
- style: getItemStyle(snapshot === null || snapshot === void 0 ? void 0 : snapshot.isDragging, provided === null || provided === void 0 ? void 0 : provided.draggableProps.style)
1162
- }), /*#__PURE__*/React__default.createElement(RowContent, _extends({
1163
- hasChildren: hasChildren,
1164
- label: label,
1165
- isChecked: isChecked,
1166
- isPermanent: isPermanent,
1167
- isOpened: isOpened,
1168
- onArrowBtnClick: onRowToggleHandler,
1169
- onCheckboxClick: onRowSelectHandlerWrapper,
1170
- isDraggable: isDraggable,
1171
- isSelectable: isSelectable
1172
- }, restProps)), isOpened && /*#__PURE__*/React__default.createElement(ConnectedDroppable, {
1173
- droppableId: "droppable_cnt_".concat(id),
1174
- type: "droppable_cnt_".concat(id)
1175
- }, (provided, snapshot, rubric) => /*#__PURE__*/React__default.createElement("div", _extends({
1176
- className: "gene-actionable-list-row-children"
1177
- }, provided.droppableProps, {
1178
- ref: provided.innerRef
1179
- }), childrenList.map((row, index) => /*#__PURE__*/React__default.createElement(Row, _extends({}, row, {
1180
- key: row.id,
1181
- isDraggable: isDraggable,
1182
- isSelectable: isSelectable,
1183
- onRowSelectHandler: onRowSelectHandler
1184
- }))), provided.placeholder))));
1185
- }
1186
- Row.propTypes = {
1187
- label: PropTypes.string,
1188
- id: PropTypes.string,
1189
- isChecked: PropTypes.oneOf([true, false, null]),
1190
- isVisible: PropTypes.bool,
1191
- isPermanent: PropTypes.bool,
1192
- positionIndex: PropTypes.number,
1193
- parentId: PropTypes.string,
1194
- childrenList: PropTypes.array,
1195
- isOpen: PropTypes.bool,
1196
- isDraggable: PropTypes.bool,
1197
- isSelectable: PropTypes.bool,
1198
- onRowSelectHandler: PropTypes.func
1199
- };
1200
- Row.defaultProps = {
1201
- isChecked: false,
1202
- isVisible: true,
1203
- isPermanent: false,
1204
- childrenList: [],
1205
- isOpen: false,
1206
- tooltipInfo: '',
1207
- onRowSelectHandler: noop
1208
- };
1209
- Row.displayName = 'Row';
1210
-
1211
- // @TODO move helper function to separated file and check code to avoid code duplications
1212
- const isNodeLeaf = function () {
1213
- let node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1214
- return !node.hasOwnProperty('childrenList');
1215
- };
1216
- const isNodeVisible = function () {
1217
- let {
1218
- isVisible
1219
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1220
- return isVisible !== undefined ? isVisible : true;
1221
- };
1222
- const mapDataListToInternalModel = function () {
1223
- let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1224
- let parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1225
- return list.map((row, index) => {
1226
- if (parentId !== null) {
1227
- row.parentId = parentId;
1228
- row.id = "".concat(parentId, "_").concat(index);
1229
- } else {
1230
- row.id = "".concat(index);
1231
- }
1232
- if (!isNodeLeaf(row)) {
1233
- row.childNodesCount = row === null || row === void 0 ? void 0 : row.childrenList.length;
1234
- row.selectedChildNodesCount = row === null || row === void 0 ? void 0 : row.childrenList.filter(_ref => {
1235
- let {
1236
- isChecked
1237
- } = _ref;
1238
- return isChecked;
1239
- }).length;
1240
- mapDataListToInternalModel(row === null || row === void 0 ? void 0 : row.childrenList, row.id);
1241
- }
1242
- return row;
1243
- });
1244
- };
1245
- const reorder = (list, path, startIndex, endIndex) => {
1246
- if (path.length > 0) {
1247
- var _list$index$childrenL, _list$index;
1248
- const index = path.shift();
1249
- return reorder((_list$index$childrenL = (_list$index = list[index]) === null || _list$index === void 0 ? void 0 : _list$index.childrenList) !== null && _list$index$childrenL !== void 0 ? _list$index$childrenL : list, path, startIndex, endIndex);
1250
- }
1251
- const result = [...list];
1252
- const [removed] = result.splice(startIndex, 1);
1253
- result.splice(endIndex, 0, removed);
1254
- return result.map((row, index) => {
1255
- row.positionIndex = index;
1256
- return row;
1257
- });
1258
- };
1259
- const replaceList = (list, levelId, value) => list.map(row => {
1260
- var _row$childrenList;
1261
- const isRowMatched = row.id === levelId.substring(0, levelId.length - 2);
1262
- if (isRowMatched) {
1263
- row.childrenList = value;
1264
- }
1265
- if ((row === null || row === void 0 ? void 0 : (_row$childrenList = row.childrenList) === null || _row$childrenList === void 0 ? void 0 : _row$childrenList.length) > 0 && !isRowMatched) {
1266
- replaceList(row === null || row === void 0 ? void 0 : row.childrenList, levelId, value);
1267
- }
1268
- return row;
1269
- });
1270
- const highlightTextBySearchKey = function () {
1271
- let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1272
- let searchKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1273
- let searchMethod = arguments.length > 2 ? arguments[2] : undefined;
1274
- const result = text.replaceAll('<span className="highlight">', '').replaceAll('</span>', '');
1275
- const index = searchMethod === searchMethods.endsWith.value ? result.lastIndexOf(searchKey) : result.indexOf(searchKey);
1276
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, result.substring(0, index), /*#__PURE__*/React__default.createElement("span", {
1277
- className: "highlight"
1278
- }, result.substring(index, index + searchKey.length)), result.substring(index + searchKey.length));
1279
- };
1280
-
1281
- // '0'
1282
- // '0_0'
1283
- // '0_0_0_1'
1284
- const walkToNode = function (list, nodeIds) {
1285
- let forceCloseAllRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1286
- let searchKey = arguments.length > 3 ? arguments[3] : undefined;
1287
- let withSearchHighlighting = arguments.length > 4 ? arguments[4] : undefined;
1288
- let searchMethod = arguments.length > 5 ? arguments[5] : undefined;
1289
- return list.map(row => {
1290
- let isRowMatched = false;
1291
- for (let i = 0; i < nodeIds.length; i++) {
1292
- const _row = nodeIds[i];
1293
- isRowMatched = row.id === _row.id.substring(0, row.id.length);
1294
- if (isRowMatched) break;
1295
- }
1296
- row.isVisible = isRowMatched;
1297
- if (isRowMatched) {
1298
- if (!isNodeLeaf(row)) {
1299
- row.isOpen = !!forceCloseAllRows;
1300
- walkToNode(row.childrenList, nodeIds, forceCloseAllRows, searchKey, withSearchHighlighting, searchMethod);
1301
- } else if (withSearchHighlighting) {
1302
- row.highlightedLabel = highlightTextBySearchKey(row.label, searchKey, searchMethod);
1303
- }
1304
- }
1305
- return row;
1306
- });
1307
- };
1308
- const findLeafNodes = function (list) {
1309
- let leafNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1310
- list.forEach(row => {
1311
- if (isNodeLeaf(row)) {
1312
- leafNodes.push(row);
1313
- } else {
1314
- findLeafNodes(row.childrenList, leafNodes);
1315
- }
1316
- });
1317
- return leafNodes;
1318
- };
1319
- const applySearchFilter = function () {
1320
- let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1321
- let searchKey = arguments.length > 1 ? arguments[1] : undefined;
1322
- let method = arguments.length > 2 ? arguments[2] : undefined;
1323
- return list.filter(_ref2 => {
1324
- let {
1325
- label
1326
- } = _ref2;
1327
- return searchFunctions[method](label, searchKey);
1328
- });
1329
- };
1330
- const searchHandler = (list, searchKey, method, withSearchHighlighting) => {
1331
- const leafNodes = findLeafNodes(list);
1332
- const matchedNodes = searchKey.trim() !== '' ? applySearchFilter(leafNodes, searchKey, method) : leafNodes;
1333
- return {
1334
- searchResult: walkToNode(list, matchedNodes, searchKey !== '', searchKey, withSearchHighlighting, method),
1335
- matchedNodesCount: matchedNodes.length,
1336
- isSearchEmpty: matchedNodes.length === 0
1337
- };
1338
- };
1339
-
1340
- // @TODO fix bugs in selection logic
1341
- const markAllNodes = function () {
1342
- let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1343
- let checked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1344
- let selectedRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1345
- return list.map(row => {
1346
- if (!row.isPermanent && isNodeVisible(row)) {
1347
- if (!isNodeLeaf(row)) {
1348
- if (selectedRow !== null) {
1349
- selectedRow.selectedChildNodesCount = checked ? selectedRow.childNodesCount : 0;
1350
- }
1351
- row.selectedChildNodesCount = checked ? row.childNodesCount : 0;
1352
- markAllNodes(row.childrenList, checked, row);
1353
- }
1354
- }
1355
- return row;
1356
- });
1357
- };
1358
- const d = function () {
1359
- let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1360
- let id = arguments.length > 1 ? arguments[1] : undefined;
1361
- let checked = arguments.length > 2 ? arguments[2] : undefined;
1362
- const value = checked ? 1 : -1;
1363
- return list.map(row => {
1364
- if (id.startsWith(row.id)) {
1365
- if (!isNodeLeaf(row)) {
1366
- row.selectedChildNodesCount += row.selectedChildNodesCount + value <= row.childNodesCount && row.selectedChildNodesCount - value >= row.childNodesCount ? value : 0;
1367
- let parentRowCheckedStatus = false;
1368
- if (row.selectedChildNodesCount > 0) {
1369
- parentRowCheckedStatus = null;
1370
- if (row.selectedChildNodesCount === row.childNodesCount) {
1371
- parentRowCheckedStatus = true;
1372
- }
1373
- }
1374
- row.isChecked = parentRowCheckedStatus;
1375
- d(row.childrenList, id, checked);
1376
- } else {
1377
- row.isChecked = checked;
1378
- }
1379
- }
1380
- return row;
1381
- });
1382
- };
1383
- const selectHandler = (list, selectedRow, checked) => list.map(row => {
1384
- const {
1385
- id,
1386
- isPermanent
1387
- } = row;
1388
- const isRowMatched = id === selectedRow.id;
1389
- if (!isNodeLeaf(row)) {
1390
- if (isRowMatched && !isPermanent && isNodeVisible(row)) {
1391
- markAllNodes(row === null || row === void 0 ? void 0 : row.childrenList, checked, row);
1392
- } else {
1393
- selectHandler(row === null || row === void 0 ? void 0 : row.childrenList, selectedRow, checked);
1394
- }
1395
- }
1396
- return row;
1397
- });
1398
- const ActionableList = /*#__PURE__*/forwardRef((_ref3, ref) => {
1399
- let {
1400
- onChange,
1401
- data,
1402
- isLoading,
1403
- withSortable,
1404
- withSelection,
1405
- withSearch,
1406
- withSearchHighlighting,
1407
- readOnly,
1408
- searchPlaceholderText,
1409
- emptyDataText,
1410
- emptySearchText,
1411
- titleText,
1412
- selectionText,
1413
- filteredNodesText,
1414
- totalNodesText,
1415
- loadingText,
1416
- selectAllLabelText,
1417
- searchMethod
1418
- } = _ref3;
1419
- const [searchInput, setSearchInput] = useState('');
1420
- const searchInputTimeoutRef = useRef(null);
1421
- const [dataList, setDataList] = useState([]);
1422
- const leafNodes = useMemo(() => findLeafNodes(dataList), [dataList]);
1423
- const [leafNodesCount, setLeafNodesCount] = useState('');
1424
- const [selectedLeafNodesCount, setSelectedLeafNodesCount] = useState('');
1425
- const hasDataList = useMemo(() => dataList.length > 0, [dataList]);
1426
- const [isAllSelected, setIsAllSelected] = useState(false);
1427
- const [isSearchEmpty, setIsSearchEmpty] = useState(null);
1428
-
1429
- // Provide reset search functional to parent component
1430
- useImperativeHandle(ref, () => ({
1431
- resetSearch() {
1432
- setSearchInput('');
1433
- }
1434
- }));
1435
- const searchInputHandler = _ref4 => {
1436
- let {
1437
- target
1438
- } = _ref4;
1439
- setSearchInput(target === null || target === void 0 ? void 0 : target.value);
1440
- };
1441
- const onDragEnd = result => {
1442
- // Dropped outside of the list
1443
- if (!result.destination) {
1444
- return;
1445
- }
1446
- // Discover the depth of dragged row
1447
- const draggableIds = result.draggableId.split('_');
1448
- const path = [...draggableIds];
1449
- path.pop();
1450
- setDataList(previousBlockItems => {
1451
- const reorderedList = reorder(previousBlockItems, path, result.source.index, result.destination.index);
1452
- if (draggableIds.length === 1) {
1453
- const _data = mapDataListToInternalModel(reorderedList);
1454
- onChange(_data);
1455
- return _data;
1456
- }
1457
- const _data = mapDataListToInternalModel(replaceList(previousBlockItems, result.draggableId, reorderedList));
1458
- onChange(_data);
1459
- return _data;
1460
- });
1461
- };
1462
- useEffect(() => {
1463
- const _data = JSON.parse(JSON.stringify(data));
1464
- setDataList(mapDataListToInternalModel(_data));
1465
- }, [data]);
1466
- useEffect(() => {
1467
- if (hasDataList && leafNodesCount === '') {
1468
- setLeafNodesCount(leafNodes.length);
1469
- }
1470
- setSelectedLeafNodesCount(leafNodes.filter(_ref5 => {
1471
- let {
1472
- isChecked
1473
- } = _ref5;
1474
- return isChecked !== undefined ? isChecked : false;
1475
- }).length);
1476
- // eslint-disable-next-line react-hooks/exhaustive-deps
1477
- }, [hasDataList, leafNodes]);
1478
- useEffect(() => {
1479
- if (!hasDataList) return;
1480
- // debounce typing
1481
- // filter array by label recursively via following search method
1482
- // recursively find and open any parent row if exist set isOpen to true
1483
- // set filtered values to dataList
1484
-
1485
- clearTimeout(searchInputTimeoutRef.current);
1486
- searchInputTimeoutRef.current = setTimeout(() => {
1487
- const {
1488
- searchResult,
1489
- isSearchEmpty,
1490
- matchedNodesCount
1491
- } = searchHandler(dataList, searchInput, searchMethod, withSearchHighlighting);
1492
- setDataList(searchResult);
1493
- setLeafNodesCount(matchedNodesCount);
1494
- setIsSearchEmpty(isSearchEmpty);
1495
- }, 500);
1496
- // eslint-disable-next-line react-hooks/exhaustive-deps
1497
- }, [searchInput]);
1498
- const cleanup = () => () => {
1499
- clearTimeout(searchInputTimeoutRef.current);
1500
- };
1501
- useEffect(() => cleanup, []);
1502
-
1503
- // create selection logic
1504
-
1505
- const handleCheckboxChange = e => {
1506
- const {
1507
- checked
1508
- } = e.currentTarget ? e.currentTarget : e.current;
1509
- const _data = markAllNodes(dataList, checked);
1510
- setDataList(_data);
1511
- // onChange(_data);
1512
- setIsAllSelected(checked);
1513
- };
1514
- const onRowSelectHandler = (row, checked) => {
1515
- const _data = selectHandler(dataList, row, checked);
1516
- const a = d(_data, row.id, checked);
1517
- // console.log('🚀 ~ file: index.js ~ line 366 ~ onRowSelectHandler ~ row.id', row.id);
1518
-
1519
- setDataList(a);
1520
- onChange(a);
1521
- };
1522
- useEffect(() => {
1523
- setIsAllSelected(prev => {
1524
- let value = false;
1525
- if (prev !== true && selectedLeafNodesCount > 0) {
1526
- value = null;
1527
- if (leafNodes.length === selectedLeafNodesCount) {
1528
- value = true;
1529
- }
1530
- }
1531
- return value;
1532
- });
1533
- }, [leafNodes, selectedLeafNodesCount]);
1534
- return /*#__PURE__*/React__default.createElement("div", {
1535
- className: "gene-actionable-list"
1536
- }, /*#__PURE__*/React__default.createElement(BusyLoader, {
1537
- isBusy: isLoading,
1538
- loadingText: loadingText
1539
- }, hasDataList ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
1540
- className: "gene-actionable-list-header"
1541
- }, /*#__PURE__*/React__default.createElement("div", {
1542
- className: "gene-actionable-list-header-title"
1543
- }, /*#__PURE__*/React__default.createElement("h5", null, titleText), /*#__PURE__*/React__default.createElement("span", null, withSelection && "".concat(selectionText, " ").concat(selectedLeafNodesCount, " | "), withSearch && "".concat(filteredNodesText, " ").concat(leafNodesCount, " | "), "".concat(totalNodesText, " ").concat(leafNodes.length))), withSearch && /*#__PURE__*/React__default.createElement("div", {
1544
- className: "gene-actionable-list-header-search-box"
1545
- }, /*#__PURE__*/React__default.createElement(ExtendedInput, {
1546
- placeholder: searchPlaceholderText,
1547
- onChange: searchInputHandler,
1548
- value: searchInput,
1549
- icon: "bc-icon-search"
1550
- }), /*#__PURE__*/React__default.createElement(Tooltip, {
1551
- position: "left",
1552
- text: searchMethods[searchMethod].tooltipText
1553
- }, /*#__PURE__*/React__default.createElement(Icon, {
1554
- type: "bc-icon-info"
1555
- }))), withSelection && leafNodesCount > 1 && /*#__PURE__*/React__default.createElement(Checkbox, {
1556
- className: "gene-actionable-list-header-mark-all",
1557
- label: selectAllLabelText,
1558
- checked: isAllSelected,
1559
- onChange: handleCheckboxChange,
1560
- indeterminate: isAllSelected === null
1561
- })), /*#__PURE__*/React__default.createElement(CustomScrollbar, null, /*#__PURE__*/React__default.createElement("div", {
1562
- className: "gene-actionable-list-body"
1563
- }, isSearchEmpty ? /*#__PURE__*/React__default.createElement(Empty, {
1564
- appearance: "greyscale",
1565
- type: "search",
1566
- title: emptySearchText
1567
- }) : /*#__PURE__*/React__default.createElement(DragDropContext, {
1568
- onDragEnd: onDragEnd
1569
- }, /*#__PURE__*/React__default.createElement(ConnectedDroppable, {
1570
- droppableId: "droppable_cnt",
1571
- type: "droppable_cnt"
1572
- }, (provided, snapshot, rubric) => /*#__PURE__*/React__default.createElement("div", _extends({}, provided.droppableProps, {
1573
- ref: provided.innerRef
1574
- }), dataList.map((row, index) => /*#__PURE__*/React__default.createElement(Row, _extends({}, row, {
1575
- key: row.id,
1576
- isDraggable: withSortable,
1577
- isSelectable: withSelection,
1578
- onRowSelectHandler: onRowSelectHandler
1579
- }))), provided.placeholder)))))) : /*#__PURE__*/React__default.createElement(Empty, {
1580
- appearance: "greyscale",
1581
- type: "data",
1582
- title: emptyDataText
1583
- })));
1584
- });
1585
-
1586
- // @TODO add comments for props
1587
- ActionableList.propTypes = {
1588
- /**
1589
- * Execute an callback on Reorder event with already reordered data
1590
- */
1591
- onChange: PropTypes.func,
1592
- // @TODO map and remove component props for list objects and return cloned list back
1593
- /**
1594
- * Data list of objects. This list is dynamic and has listener inside of the component you can change the data list and its objects runtime
1595
- */
1596
- data: PropTypes.arrayOf(PropTypes.shape({
1597
- label: PropTypes.string,
1598
- id: PropTypes.string,
1599
- isChecked: PropTypes.bool,
1600
- isVisible: PropTypes.bool,
1601
- isPermanent: PropTypes.bool,
1602
- positionIndex: PropTypes.number,
1603
- parentId: PropTypes.string,
1604
- childrenList: PropTypes.array,
1605
- isOpen: PropTypes.bool
1606
- })),
1607
- /**
1608
- * Represent loader state in case of true will be shown spinner and loading text
1609
- */
1610
- isLoading: PropTypes.bool,
1611
- /**
1612
- * Turn on search logic and show search input element on the top of component
1613
- */
1614
- withSearch: PropTypes.bool,
1615
- /**
1616
- * Turn on search highlighting function
1617
- */
1618
- withSearchHighlighting: PropTypes.bool,
1619
- /**
1620
- * Not supported yet will provided on next version
1621
- */
1622
- withSelection: PropTypes.bool,
1623
- /**
1624
- * Turn on drag and drop reordering function on multilevel scopes
1625
- */
1626
- withSortable: PropTypes.bool,
1627
- /**
1628
- * Not supported yet will provided on next version
1629
- */
1630
- readOnly: PropTypes.bool,
1631
- /**
1632
- * Placeholder text for search input to cover localization support
1633
- */
1634
- searchPlaceholderText: PropTypes.string,
1635
- /**
1636
- * Empty data text to cover localization support
1637
- */
1638
- emptyDataText: PropTypes.string,
1639
- /**
1640
- * Empty search result text to cover localization support
1641
- */
1642
- emptySearchText: PropTypes.string,
1643
- /**
1644
- * Title text to cover localization support
1645
- */
1646
- titleText: PropTypes.string,
1647
- /**
1648
- * Not supported yet will provided on next version
1649
- */
1650
- selectionText: PropTypes.string,
1651
- /**
1652
- * Filtered nodes count text to cover localization support
1653
- */
1654
- filteredNodesText: PropTypes.string,
1655
- /**
1656
- * Total leaf nodes count text to cover localization support
1657
- */
1658
- totalNodesText: PropTypes.string,
1659
- /**
1660
- * Text for loading state to cover localization support
1661
- */
1662
- loadingText: PropTypes.string,
1663
- /**
1664
- * Not supported yet will provided on next version
1665
- */
1666
- selectAllLabelText: PropTypes.string,
1667
- /**
1668
- * Search method can be one of [startsWith, endsWith, like]
1669
- */
1670
- searchMethod: PropTypes.oneOf(Object.keys(searchMethods))
1671
- };
1672
- ActionableList.defaultProps = {
1673
- onChange: noop,
1674
- data: [],
1675
- isLoading: false,
1676
- withSearch: false,
1677
- withSearchHighlighting: false,
1678
- withSelection: false,
1679
- withSortable: false,
1680
- readOnly: true,
1681
- searchPlaceholderText: 'Search',
1682
- emptyDataText: 'No data to display',
1683
- emptySearchText: 'No data found',
1684
- titleText: 'Actionable list',
1685
- selectionText: 'Selected',
1686
- filteredNodesText: 'Filtered',
1687
- totalNodesText: 'Total',
1688
- loadingText: 'Loading data',
1689
- selectAllLabelText: 'Select all filtered items',
1690
- searchMethod: searchMethods.like.value
1691
- };
1692
- ActionableList.displayName = 'ActionableList';
1693
-
1694
- export { ActionableList as default };