funda-ui 1.1.162 → 1.1.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/index.js +88 -5
- package/DropdownMenu/index.js +23 -0
- package/HorizontalScrollContent/index.js +86 -2
- package/LiveSearch/index.d.ts +2 -0
- package/LiveSearch/index.js +27 -21
- package/MultipleCheckboxes/index.js +13 -13
- package/MultipleSelect/index.css +172 -0
- package/MultipleSelect/index.d.ts +39 -0
- package/MultipleSelect/index.js +750 -0
- package/README.md +1 -1
- package/all.d.ts +1 -0
- package/all.js +1 -0
- package/lib/cjs/Accordion/index.js +88 -5
- package/lib/cjs/DropdownMenu/index.js +23 -0
- package/lib/cjs/HorizontalScrollContent/index.js +86 -2
- package/lib/cjs/LiveSearch/index.d.ts +2 -0
- package/lib/cjs/LiveSearch/index.js +27 -21
- package/lib/cjs/MultipleCheckboxes/index.js +13 -13
- package/lib/cjs/MultipleSelect/index.d.ts +39 -0
- package/lib/cjs/MultipleSelect/index.js +750 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/css/MultipleSelect/index.css +172 -0
- package/lib/esm/Accordion/AccordionItem.tsx +18 -0
- package/lib/esm/Accordion/utils/performance.js +52 -0
- package/lib/esm/DropdownMenu/index.tsx +37 -2
- package/lib/esm/HorizontalScrollContent/index.tsx +17 -0
- package/lib/esm/HorizontalScrollContent/utils/performance.js +52 -0
- package/lib/esm/LiveSearch/index.tsx +23 -18
- package/lib/esm/MultipleCheckboxes/index.tsx +11 -11
- package/lib/esm/MultipleSelect/index.scss +208 -0
- package/lib/esm/MultipleSelect/index.tsx +466 -0
- package/lib/esm/MultipleSelect/utils/convert.js +59 -0
- package/lib/esm/MultipleSelect/utils/extract.js +63 -0
- package/lib/esm/MultipleSelect/utils/tree.js +119 -0
- package/lib/esm/ScrollReveal/utils/performance.js +52 -0
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
package/Accordion/index.js
CHANGED
|
@@ -355,6 +355,58 @@ module.exports = setDefaultOptions;
|
|
|
355
355
|
|
|
356
356
|
/***/ }),
|
|
357
357
|
|
|
358
|
+
/***/ 342:
|
|
359
|
+
/***/ ((module) => {
|
|
360
|
+
|
|
361
|
+
/*
|
|
362
|
+
* Debounce
|
|
363
|
+
*
|
|
364
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
365
|
+
* @param {Number} limit - Waiting time.
|
|
366
|
+
* @return {Function} - Returns a new function.
|
|
367
|
+
*/
|
|
368
|
+
function debounce(fn) {
|
|
369
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
370
|
+
var timer;
|
|
371
|
+
return function () {
|
|
372
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
373
|
+
clearTimeout(timer);
|
|
374
|
+
|
|
375
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
376
|
+
// Execute fn after another delay milliseconds
|
|
377
|
+
timer = setTimeout(function () {
|
|
378
|
+
fn.apply(this, arguments);
|
|
379
|
+
}, limit);
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/*
|
|
384
|
+
* Throttle
|
|
385
|
+
*
|
|
386
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
387
|
+
* @param {Number} limit - Waiting time.
|
|
388
|
+
* @return {Function} - Returns a new function.
|
|
389
|
+
*/
|
|
390
|
+
function throttle(fn) {
|
|
391
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
392
|
+
var waiting = false;
|
|
393
|
+
return function () {
|
|
394
|
+
if (!waiting) {
|
|
395
|
+
fn.apply(this, arguments);
|
|
396
|
+
waiting = true;
|
|
397
|
+
setTimeout(function () {
|
|
398
|
+
waiting = false;
|
|
399
|
+
}, limit);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
module.exports = {
|
|
404
|
+
debounce: debounce,
|
|
405
|
+
throttle: throttle
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/***/ }),
|
|
409
|
+
|
|
358
410
|
/***/ 787:
|
|
359
411
|
/***/ ((module) => {
|
|
360
412
|
|
|
@@ -447,8 +499,36 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
447
499
|
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
448
500
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
|
|
449
501
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
502
|
+
// EXTERNAL MODULE: ./src/utils/performance.js
|
|
503
|
+
var performance = __webpack_require__(342);
|
|
450
504
|
;// CONCATENATED MODULE: ./src/AccordionItem.tsx
|
|
451
|
-
|
|
505
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
506
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
507
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
508
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
509
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
510
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
511
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
512
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
513
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
514
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
515
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
516
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
517
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
// Fix ERROR: ResizeObserver loop completed with undelivered notifications.
|
|
521
|
+
var _ResizeObserver = window.ResizeObserver;
|
|
522
|
+
window.ResizeObserver = /*#__PURE__*/function (_ResizeObserver2) {
|
|
523
|
+
_inherits(ResizeObserver, _ResizeObserver2);
|
|
524
|
+
var _super = _createSuper(ResizeObserver);
|
|
525
|
+
function ResizeObserver(callback) {
|
|
526
|
+
_classCallCheck(this, ResizeObserver);
|
|
527
|
+
callback = (0,performance.debounce)(callback, 16);
|
|
528
|
+
return _super.call(this, callback);
|
|
529
|
+
}
|
|
530
|
+
return _createClass(ResizeObserver);
|
|
531
|
+
}(_ResizeObserver);
|
|
452
532
|
var AccordionItem = function AccordionItem(props) {
|
|
453
533
|
var heightObserver = props.heightObserver,
|
|
454
534
|
index = props.index,
|
|
@@ -476,6 +556,9 @@ var AccordionItem = function AccordionItem(props) {
|
|
|
476
556
|
if (contentRef.current && contentWrapperRef.current) {
|
|
477
557
|
var _contentPadding = window.getComputedStyle(contentRef.current).getPropertyValue('padding-bottom');
|
|
478
558
|
observer.current = new ResizeObserver(function (entries) {
|
|
559
|
+
if (!Array.isArray(entries) || !entries.length) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
479
562
|
entries.forEach(function (entry) {
|
|
480
563
|
if (contentWrapperRef.current !== null) contentWrapperRef.current.style.height = entry.contentRect.bottom + parseFloat(_contentPadding) + 'px';
|
|
481
564
|
});
|
|
@@ -520,13 +603,13 @@ var AccordionItem = function AccordionItem(props) {
|
|
|
520
603
|
var anim = __webpack_require__(710);
|
|
521
604
|
var anim_default = /*#__PURE__*/__webpack_require__.n(anim);
|
|
522
605
|
;// CONCATENATED MODULE: ./src/Accordion.tsx
|
|
523
|
-
function
|
|
606
|
+
function Accordion_typeof(obj) { "@babel/helpers - typeof"; return Accordion_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, Accordion_typeof(obj); }
|
|
524
607
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
525
608
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
526
609
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
527
|
-
function _defineProperty(obj, key, value) { key =
|
|
528
|
-
function
|
|
529
|
-
function
|
|
610
|
+
function _defineProperty(obj, key, value) { key = Accordion_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
611
|
+
function Accordion_toPropertyKey(arg) { var key = Accordion_toPrimitive(arg, "string"); return Accordion_typeof(key) === "symbol" ? key : String(key); }
|
|
612
|
+
function Accordion_toPrimitive(input, hint) { if (Accordion_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (Accordion_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
530
613
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
531
614
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
532
615
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
package/DropdownMenu/index.js
CHANGED
|
@@ -155,6 +155,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
155
155
|
options = props.options,
|
|
156
156
|
tabIndex = props.tabIndex,
|
|
157
157
|
onChange = props.onChange;
|
|
158
|
+
var POS_OFFSET = 10;
|
|
159
|
+
var modalRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
158
160
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
159
161
|
_useState2 = _slicedToArray(_useState, 2),
|
|
160
162
|
isOpen = _useState2[0],
|
|
@@ -182,6 +184,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
182
184
|
if (!hoverOn || typeof hoverOn === 'undefined') return;
|
|
183
185
|
setTimeout(function () {
|
|
184
186
|
setIsOpen(true);
|
|
187
|
+
popwinListInit();
|
|
185
188
|
}, _hoverDelay);
|
|
186
189
|
}
|
|
187
190
|
function handleHoverOff(event) {
|
|
@@ -202,6 +205,25 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
202
205
|
onChange(option);
|
|
203
206
|
}
|
|
204
207
|
}
|
|
208
|
+
function popwinListInit() {
|
|
209
|
+
if (modalRef.current === null) return;
|
|
210
|
+
setTimeout(function () {
|
|
211
|
+
// Determine whether it exceeds the far right or left side of the screen
|
|
212
|
+
var _modalContent = modalRef.current;
|
|
213
|
+
var _modalBox = _modalContent.getBoundingClientRect();
|
|
214
|
+
if (_modalBox.right > window.innerWidth) {
|
|
215
|
+
var _modalOffsetPosition = _modalBox.right - window.innerWidth + POS_OFFSET;
|
|
216
|
+
_modalContent.style.marginLeft = "-".concat(_modalOffsetPosition, "px");
|
|
217
|
+
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (_modalBox.left < 0) {
|
|
221
|
+
var _modalOffsetPosition2 = Math.abs(_modalBox.left) + POS_OFFSET;
|
|
222
|
+
_modalContent.style.marginLeft = "".concat(_modalOffsetPosition2, "px");
|
|
223
|
+
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
224
|
+
}
|
|
225
|
+
}, 0);
|
|
226
|
+
}
|
|
205
227
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
206
228
|
document.removeEventListener('pointerdown', handleClose);
|
|
207
229
|
document.addEventListener('pointerdown', handleClose);
|
|
@@ -233,6 +255,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
233
255
|
type: "hidden",
|
|
234
256
|
value: selected === null || selected === void 0 ? void 0 : selected.value
|
|
235
257
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
|
|
258
|
+
ref: modalRef,
|
|
236
259
|
className: isOpen ? "".concat(listClassName ? listClassName : 'dropdown-menu-default', " ").concat(showClassName ? showClassName : 'show') : "".concat(listClassName ? listClassName : 'dropdown-menu-default')
|
|
237
260
|
}, selectOptionsListPresentation)));
|
|
238
261
|
};
|
|
@@ -9,12 +9,64 @@
|
|
|
9
9
|
root["RPB"] = factory(root["React"]);
|
|
10
10
|
})(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
|
-
/******/ "use strict";
|
|
13
12
|
/******/ var __webpack_modules__ = ({
|
|
14
13
|
|
|
14
|
+
/***/ 342:
|
|
15
|
+
/***/ ((module) => {
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Debounce
|
|
19
|
+
*
|
|
20
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
21
|
+
* @param {Number} limit - Waiting time.
|
|
22
|
+
* @return {Function} - Returns a new function.
|
|
23
|
+
*/
|
|
24
|
+
function debounce(fn) {
|
|
25
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
26
|
+
var timer;
|
|
27
|
+
return function () {
|
|
28
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
|
|
31
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
32
|
+
// Execute fn after another delay milliseconds
|
|
33
|
+
timer = setTimeout(function () {
|
|
34
|
+
fn.apply(this, arguments);
|
|
35
|
+
}, limit);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* Throttle
|
|
41
|
+
*
|
|
42
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
43
|
+
* @param {Number} limit - Waiting time.
|
|
44
|
+
* @return {Function} - Returns a new function.
|
|
45
|
+
*/
|
|
46
|
+
function throttle(fn) {
|
|
47
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
48
|
+
var waiting = false;
|
|
49
|
+
return function () {
|
|
50
|
+
if (!waiting) {
|
|
51
|
+
fn.apply(this, arguments);
|
|
52
|
+
waiting = true;
|
|
53
|
+
setTimeout(function () {
|
|
54
|
+
waiting = false;
|
|
55
|
+
}, limit);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
module.exports = {
|
|
60
|
+
debounce: debounce,
|
|
61
|
+
throttle: throttle
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/***/ }),
|
|
65
|
+
|
|
15
66
|
/***/ 787:
|
|
16
67
|
/***/ ((module) => {
|
|
17
68
|
|
|
69
|
+
"use strict";
|
|
18
70
|
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
19
71
|
|
|
20
72
|
/***/ })
|
|
@@ -88,21 +140,50 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
|
88
140
|
/******/
|
|
89
141
|
/************************************************************************/
|
|
90
142
|
var __webpack_exports__ = {};
|
|
91
|
-
// This entry need to be wrapped in an IIFE because it need to be
|
|
143
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
92
144
|
(() => {
|
|
145
|
+
"use strict";
|
|
93
146
|
__webpack_require__.r(__webpack_exports__);
|
|
94
147
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
95
148
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
96
149
|
/* harmony export */ });
|
|
97
150
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
|
|
98
151
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
152
|
+
/* harmony import */ var _utils_performance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(342);
|
|
153
|
+
/* harmony import */ var _utils_performance__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_utils_performance__WEBPACK_IMPORTED_MODULE_1__);
|
|
154
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
99
155
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
100
156
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
101
157
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
102
158
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
103
159
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
104
160
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
161
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
162
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
163
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
164
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
165
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
166
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
167
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
168
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
169
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
170
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
171
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
172
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
173
|
+
|
|
105
174
|
|
|
175
|
+
// Fix ERROR: ResizeObserver loop completed with undelivered notifications.
|
|
176
|
+
var _ResizeObserver = window.ResizeObserver;
|
|
177
|
+
window.ResizeObserver = /*#__PURE__*/function (_ResizeObserver2) {
|
|
178
|
+
_inherits(ResizeObserver, _ResizeObserver2);
|
|
179
|
+
var _super = _createSuper(ResizeObserver);
|
|
180
|
+
function ResizeObserver(callback) {
|
|
181
|
+
_classCallCheck(this, ResizeObserver);
|
|
182
|
+
callback = (0,_utils_performance__WEBPACK_IMPORTED_MODULE_1__.debounce)(callback, 16);
|
|
183
|
+
return _super.call(this, callback);
|
|
184
|
+
}
|
|
185
|
+
return _createClass(ResizeObserver);
|
|
186
|
+
}(_ResizeObserver);
|
|
106
187
|
var HorizontalScrollContent = function HorizontalScrollContent(props) {
|
|
107
188
|
var data = props.data,
|
|
108
189
|
slideOffset = props.slideOffset,
|
|
@@ -190,6 +271,9 @@ var HorizontalScrollContent = function HorizontalScrollContent(props) {
|
|
|
190
271
|
var el = scrollContentRef.current;
|
|
191
272
|
if (el) {
|
|
192
273
|
observer.current = new ResizeObserver(function (entries) {
|
|
274
|
+
if (!Array.isArray(entries) || !entries.length) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
193
277
|
entries.forEach(function (entry) {
|
|
194
278
|
resetNextBtn();
|
|
195
279
|
});
|
package/LiveSearch/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ declare type LiveSearchProps = {
|
|
|
18
18
|
/** Set the depth value of the control to control the display of the pop-up layer appear above.
|
|
19
19
|
* Please set it when multiple controls are used at the same time. */
|
|
20
20
|
depth?: number;
|
|
21
|
+
/** Incoming data, you can set the third parameter of `onFetch` */
|
|
22
|
+
data?: any;
|
|
21
23
|
/** -- */
|
|
22
24
|
id?: string;
|
|
23
25
|
style?: React.CSSProperties;
|
package/LiveSearch/index.js
CHANGED
|
@@ -599,11 +599,13 @@ var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
|
599
599
|
var cjs = __webpack_require__(962);
|
|
600
600
|
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
601
601
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
602
|
+
var _excluded = ["wrapperClassName", "controlClassName", "appearance", "disabled", "required", "placeholder", "value", "label", "name", "id", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "maxLength", "style", "winWidth", "tabIndex", "data", "fetchAutoShow", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onSelect", "onChange", "onBlur"];
|
|
602
603
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
603
604
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
604
605
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
605
606
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
606
607
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
608
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
607
609
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
608
610
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
609
611
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -613,6 +615,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
613
615
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
614
616
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
615
617
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
618
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
619
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
616
620
|
|
|
617
621
|
|
|
618
622
|
|
|
@@ -637,6 +641,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
637
641
|
style = props.style,
|
|
638
642
|
winWidth = props.winWidth,
|
|
639
643
|
tabIndex = props.tabIndex,
|
|
644
|
+
data = props.data,
|
|
640
645
|
fetchAutoShow = props.fetchAutoShow,
|
|
641
646
|
fetchNoneInfo = props.fetchNoneInfo,
|
|
642
647
|
fetchUpdate = props.fetchUpdate,
|
|
@@ -647,7 +652,8 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
647
652
|
onFetch = props.onFetch,
|
|
648
653
|
onSelect = props.onSelect,
|
|
649
654
|
onChange = props.onChange,
|
|
650
|
-
onBlur = props.onBlur
|
|
655
|
+
onBlur = props.onBlur,
|
|
656
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
651
657
|
var INPUT_MATCH_ENABLED = typeof fetchAutoShow === 'undefined' || fetchAutoShow === false ? true : false;
|
|
652
658
|
var WIN_WIDTH = typeof winWidth === 'function' ? winWidth() : winWidth ? winWidth : 'auto';
|
|
653
659
|
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)();
|
|
@@ -666,11 +672,11 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
666
672
|
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
667
673
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
668
674
|
dataInit = _useState4[0],
|
|
669
|
-
|
|
675
|
+
setOrginalDataInit = _useState4[1];
|
|
670
676
|
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
671
677
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
672
|
-
|
|
673
|
-
|
|
678
|
+
orginalData = _useState6[0],
|
|
679
|
+
setOrginalData = _useState6[1];
|
|
674
680
|
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
|
|
675
681
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
676
682
|
changedVal = _useState8[0],
|
|
@@ -851,7 +857,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
851
857
|
//
|
|
852
858
|
if (!fetchTrigger) {
|
|
853
859
|
matchData(val, fetchUpdate).then(function (response) {
|
|
854
|
-
|
|
860
|
+
setOrginalData(response);
|
|
855
861
|
|
|
856
862
|
//
|
|
857
863
|
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, response);
|
|
@@ -861,7 +867,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
861
867
|
});
|
|
862
868
|
} else {
|
|
863
869
|
//
|
|
864
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current,
|
|
870
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, orginalData);
|
|
865
871
|
}
|
|
866
872
|
} else {
|
|
867
873
|
//
|
|
@@ -890,7 +896,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
890
896
|
return matchData(changedVal, fetchUpdate);
|
|
891
897
|
case 3:
|
|
892
898
|
res = _context3.sent;
|
|
893
|
-
|
|
899
|
+
setOrginalData(res);
|
|
894
900
|
|
|
895
901
|
//
|
|
896
902
|
setIsOpen(res.length === 0 ? true : false);
|
|
@@ -935,7 +941,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
935
941
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
936
942
|
|
|
937
943
|
//
|
|
938
|
-
|
|
944
|
+
setOrginalDataInit(_ORGIN_DATA);
|
|
939
945
|
|
|
940
946
|
//
|
|
941
947
|
// window position
|
|
@@ -1005,7 +1011,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1005
1011
|
case 20:
|
|
1006
1012
|
// cancel
|
|
1007
1013
|
setIsOpen(false);
|
|
1008
|
-
|
|
1014
|
+
setOrginalData([]);
|
|
1009
1015
|
case 22:
|
|
1010
1016
|
case "end":
|
|
1011
1017
|
return _context5.stop();
|
|
@@ -1024,7 +1030,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1024
1030
|
}
|
|
1025
1031
|
function handleClick() {
|
|
1026
1032
|
if (!INPUT_MATCH_ENABLED) {
|
|
1027
|
-
|
|
1033
|
+
setOrginalData(dataInit);
|
|
1028
1034
|
setIsOpen(true);
|
|
1029
1035
|
}
|
|
1030
1036
|
|
|
@@ -1038,8 +1044,8 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1038
1044
|
if (!fetchTrigger) {
|
|
1039
1045
|
setTimeout(function () {
|
|
1040
1046
|
//
|
|
1041
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(inputRef.current,
|
|
1042
|
-
|
|
1047
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(inputRef.current, orginalData);
|
|
1048
|
+
setOrginalData([]);
|
|
1043
1049
|
}, 300);
|
|
1044
1050
|
}
|
|
1045
1051
|
}
|
|
@@ -1050,7 +1056,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1050
1056
|
if (event.target.closest(".".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'livesearch__wrapper')) === null) {
|
|
1051
1057
|
// cancel
|
|
1052
1058
|
setIsOpen(false);
|
|
1053
|
-
|
|
1059
|
+
setOrginalData([]);
|
|
1054
1060
|
}
|
|
1055
1061
|
}
|
|
1056
1062
|
function optionFocus(type) {
|
|
@@ -1201,7 +1207,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1201
1207
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1202
1208
|
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1203
1209
|
};
|
|
1204
|
-
}, [value]);
|
|
1210
|
+
}, [value, data]);
|
|
1205
1211
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, label ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1206
1212
|
className: "livesearch__wrapper__label"
|
|
1207
1213
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
|
|
@@ -1214,7 +1220,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1214
1220
|
className: "livesearch__wrapper ".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'mb-3 position-relative', " ").concat(isOpen ? 'active' : ''),
|
|
1215
1221
|
ref: rootRef,
|
|
1216
1222
|
onMouseLeave: handleMouseLeaveTrigger
|
|
1217
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
|
|
1223
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), _extends({
|
|
1218
1224
|
wrapperClassName: "",
|
|
1219
1225
|
controlClassName: controlClassName,
|
|
1220
1226
|
ref: inputRef,
|
|
@@ -1238,7 +1244,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1238
1244
|
icon: hideIcon ? '' : !fetchTrigger ? '' : icon,
|
|
1239
1245
|
btnId: btnId,
|
|
1240
1246
|
autoComplete: "off"
|
|
1241
|
-
}),
|
|
1247
|
+
}, attributes)), orginalData && orginalData.length > 0 && !hasErr ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1242
1248
|
ref: listRef,
|
|
1243
1249
|
className: "list-group position-absolute border shadow small ".concat(winWidth ? '' : 'w-100'),
|
|
1244
1250
|
style: {
|
|
@@ -1251,22 +1257,22 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1251
1257
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1252
1258
|
className: "rounded",
|
|
1253
1259
|
ref: listContentRef
|
|
1254
|
-
},
|
|
1260
|
+
}, orginalData ? orginalData.map(function (item, index) {
|
|
1255
1261
|
var startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
1256
|
-
var endItemBorder = index ===
|
|
1262
|
+
var endItemBorder = index === orginalData.length - 1 ? 'border-bottom-0' : '';
|
|
1257
1263
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1258
1264
|
tabIndex: -1,
|
|
1259
1265
|
onClick: handleSelect,
|
|
1260
1266
|
type: "button",
|
|
1261
1267
|
"data-index": index,
|
|
1262
1268
|
key: index,
|
|
1263
|
-
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder),
|
|
1269
|
+
className: "list-group-item list-group-item-action border-start-0 border-end-0 border-top-0 border-bottom-0 ".concat(startItemBorder, " ").concat(endItemBorder),
|
|
1264
1270
|
"data-value": "".concat(item.value),
|
|
1265
1271
|
"data-label": "".concat(item.label),
|
|
1266
1272
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
1267
1273
|
role: "tab"
|
|
1268
1274
|
}, item.label);
|
|
1269
|
-
}) : null))) : null,
|
|
1275
|
+
}) : null))) : null, orginalData && orginalData.length === 0 && !hasErr && isOpen ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1270
1276
|
ref: listRef,
|
|
1271
1277
|
className: "list-group position-absolute border shadow small ".concat(winWidth ? '' : 'w-100'),
|
|
1272
1278
|
style: {
|
|
@@ -1282,7 +1288,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1282
1288
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1283
1289
|
tabIndex: -1,
|
|
1284
1290
|
type: "button",
|
|
1285
|
-
className: "list-group-item list-group-item-action no-match",
|
|
1291
|
+
className: "list-group-item list-group-item-action border-top-0 border-bottom-0 no-match",
|
|
1286
1292
|
disabled: true
|
|
1287
1293
|
}, fetchNoneInfo || 'No match yet')))) : null, hideIcon ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, !fetchTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1288
1294
|
className: "livesearch__wrapper-searchbtn position-absolute top-0 end-0"
|
|
@@ -702,12 +702,12 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
702
702
|
var optionsRes = options ? isJSON(options) ? JSON.parse(options) : options : [];
|
|
703
703
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
704
704
|
_useState2 = _slicedToArray(_useState, 2),
|
|
705
|
-
|
|
706
|
-
|
|
705
|
+
valData = _useState2[0],
|
|
706
|
+
setValData = _useState2[1];
|
|
707
707
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
708
708
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
valSelected = _useState4[0],
|
|
710
|
+
setValSelected = _useState4[1];
|
|
711
711
|
var _inline = typeof inline === 'undefined' ? true : inline;
|
|
712
712
|
|
|
713
713
|
// Determine whether it is in JSON format
|
|
@@ -733,15 +733,15 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
733
733
|
function initDefaultValue(defaultValue) {
|
|
734
734
|
// change the value to trigger component rendering
|
|
735
735
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
736
|
-
|
|
736
|
+
setValSelected([]);
|
|
737
737
|
} else {
|
|
738
738
|
var _val = VALUE_BY_BRACKETS ? (0,_utils_extract__WEBPACK_IMPORTED_MODULE_2__.extractContentsOfBrackets)(defaultValue) : defaultValue.trim().replace(/^\,|\,$/g, '').split(',');
|
|
739
739
|
if (Array.isArray(_val)) {
|
|
740
|
-
|
|
740
|
+
setValSelected(_val.filter(function (v) {
|
|
741
741
|
return v !== '';
|
|
742
742
|
}));
|
|
743
743
|
} else {
|
|
744
|
-
|
|
744
|
+
setValSelected([]);
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
}
|
|
@@ -752,7 +752,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
752
752
|
|
|
753
753
|
// Initialize options
|
|
754
754
|
//--------------
|
|
755
|
-
|
|
755
|
+
setValData(optionsRes);
|
|
756
756
|
}, [value, options]);
|
|
757
757
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
758
758
|
className: wrapperClassName || wrapperClassName === '' ? "multiple-checkboxes__wrapper ".concat(wrapperClassName) : "multiple-checkboxes__wrapper mb-3 position-relative",
|
|
@@ -766,7 +766,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
766
766
|
})) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
767
767
|
className: "multiple-checkboxes__control-wrapper",
|
|
768
768
|
style: style
|
|
769
|
-
},
|
|
769
|
+
}, valData ? valData.map(function (item, i) {
|
|
770
770
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
771
771
|
key: 'checkbox' + i,
|
|
772
772
|
className: "multiple-checkboxes__control ".concat(_inline ? 'd-inline-block' : '', " pe-3"),
|
|
@@ -780,18 +780,18 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
780
780
|
value: item.value,
|
|
781
781
|
disabled: disabled || null,
|
|
782
782
|
onChange: function onChange(e, val) {
|
|
783
|
-
|
|
783
|
+
setValSelected(function (prevState) {
|
|
784
784
|
var newData = JSON.parse(JSON.stringify(prevState));
|
|
785
785
|
var index = newData.findIndex(function (item) {
|
|
786
786
|
return item == e.target.value;
|
|
787
787
|
});
|
|
788
788
|
if (index !== -1) newData.splice(index, 1);
|
|
789
789
|
var _res = val ? Array.from(new Set([e.target.value].concat(_toConsumableArray(newData)))) : newData;
|
|
790
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','));
|
|
790
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e.target, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','));
|
|
791
791
|
return _res;
|
|
792
792
|
});
|
|
793
793
|
},
|
|
794
|
-
checked:
|
|
794
|
+
checked: valSelected.includes(item.value)
|
|
795
795
|
}));
|
|
796
796
|
}) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
797
797
|
ref: inputRef,
|
|
@@ -799,7 +799,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
799
799
|
type: "hidden",
|
|
800
800
|
id: idRes,
|
|
801
801
|
name: name,
|
|
802
|
-
value: VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(
|
|
802
|
+
value: VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(valSelected) : valSelected.join(','),
|
|
803
803
|
required: required || null
|
|
804
804
|
}, attributes))), required ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
805
805
|
className: "position-absolute end-0 top-0 my-2 mx-2"
|