@capillarytech/blaze-ui 1.0.3-alpha.13 → 1.0.3-alpha.15
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/CapUnifiedSelect/CapUnifiedSelect.d.ts +1 -21
- package/CapUnifiedSelect/CapUnifiedSelect.d.ts.map +1 -1
- package/CapUnifiedSelect/components.d.ts +9 -0
- package/CapUnifiedSelect/components.d.ts.map +1 -0
- package/CapUnifiedSelect/constants.d.ts +0 -28
- package/CapUnifiedSelect/constants.d.ts.map +1 -1
- package/CapUnifiedSelect/index.js +440 -704
- package/CapUnifiedSelect/index.js.map +1 -1
- package/CapUnifiedSelect/testData.d.ts +0 -50
- package/CapUnifiedSelect/testData.d.ts.map +1 -1
- package/CapUnifiedSelect/types.d.ts +45 -0
- package/CapUnifiedSelect/types.d.ts.map +1 -0
- package/CapUnifiedSelect/utils.d.ts +34 -0
- package/CapUnifiedSelect/utils.d.ts.map +1 -0
- package/index.js +440 -704
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -695,6 +695,102 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
|
|
|
695
695
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default()) && (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) ? (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) : undefined);
|
|
696
696
|
|
|
697
697
|
|
|
698
|
+
/***/ }),
|
|
699
|
+
|
|
700
|
+
/***/ 455:
|
|
701
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
702
|
+
|
|
703
|
+
"use strict";
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
exports.__esModule = true;
|
|
707
|
+
exports.SelectAllCheckbox = exports.NoResult = void 0;
|
|
708
|
+
var _antdV = __webpack_require__(4273);
|
|
709
|
+
var _classnames = _interopRequireDefault(__webpack_require__(6942));
|
|
710
|
+
var _react = _interopRequireDefault(__webpack_require__(9206));
|
|
711
|
+
var _CapIcon = _interopRequireDefault(__webpack_require__(8244));
|
|
712
|
+
var _CapLabel = _interopRequireDefault(__webpack_require__(3737));
|
|
713
|
+
var _CapRow = _interopRequireDefault(__webpack_require__(7375));
|
|
714
|
+
var _constants = __webpack_require__(9788);
|
|
715
|
+
var _styles = _interopRequireDefault(__webpack_require__(8263));
|
|
716
|
+
var _jsxRuntime = __webpack_require__(4848);
|
|
717
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
718
|
+
const NoResult = _ref => {
|
|
719
|
+
let {
|
|
720
|
+
noResultCustomText,
|
|
721
|
+
className,
|
|
722
|
+
showUpload,
|
|
723
|
+
options,
|
|
724
|
+
noResultCustomIcon
|
|
725
|
+
} = _ref;
|
|
726
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
727
|
+
className: (0, _classnames.default)(className, _styles.default['cap-unified-select-no-result']),
|
|
728
|
+
align: "middle",
|
|
729
|
+
gap: 8,
|
|
730
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
731
|
+
type: noResultCustomIcon,
|
|
732
|
+
size: "m"
|
|
733
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
734
|
+
className: _styles.default['cap-unified-select-no-result-text'],
|
|
735
|
+
children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : _constants.DEFAULTS.NO_RESULT_TEXT
|
|
736
|
+
})]
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* SelectAllCheckbox component for selecting/deselecting all available options
|
|
742
|
+
* Only shown for multi-select with static data
|
|
743
|
+
*/
|
|
744
|
+
exports.NoResult = NoResult;
|
|
745
|
+
const SelectAllCheckbox = _ref2 => {
|
|
746
|
+
let {
|
|
747
|
+
currentItems,
|
|
748
|
+
tempValue,
|
|
749
|
+
setTempValue,
|
|
750
|
+
processTreeData,
|
|
751
|
+
disabled = false
|
|
752
|
+
} = _ref2;
|
|
753
|
+
const {
|
|
754
|
+
leafValues = []
|
|
755
|
+
} = processTreeData ? processTreeData(currentItems) : {};
|
|
756
|
+
const totalAvailable = leafValues.length;
|
|
757
|
+
const leafSet = new Set(leafValues);
|
|
758
|
+
const selectedInScope = Array.isArray(tempValue) ? tempValue.filter(v => leafSet.has(v)).length : 0;
|
|
759
|
+
const allChecked = totalAvailable > 0 && selectedInScope === totalAvailable;
|
|
760
|
+
const indeterminate = selectedInScope > 0 && selectedInScope < totalAvailable;
|
|
761
|
+
const handleChange = e => {
|
|
762
|
+
if (disabled) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if (e.target.checked) {
|
|
766
|
+
const merged = new Set(Array.isArray(tempValue) ? tempValue : []);
|
|
767
|
+
leafValues.forEach(v => merged.add(v));
|
|
768
|
+
setTempValue(Array.from(merged));
|
|
769
|
+
} else {
|
|
770
|
+
const toRemove = new Set(leafValues);
|
|
771
|
+
const next = (Array.isArray(tempValue) ? tempValue : []).filter(v => !toRemove.has(v));
|
|
772
|
+
setTempValue(next);
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
|
|
776
|
+
className: _styles.default['cap-unified-select-select-all-container'],
|
|
777
|
+
align: "middle",
|
|
778
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Checkbox, {
|
|
779
|
+
className: _styles.default['cap-unified-select-select-all-checkbox'],
|
|
780
|
+
checked: allChecked,
|
|
781
|
+
indeterminate: indeterminate,
|
|
782
|
+
onChange: handleChange,
|
|
783
|
+
disabled: disabled,
|
|
784
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
785
|
+
type: "label14",
|
|
786
|
+
className: _styles.default['cap-unified-select-select-all-label'],
|
|
787
|
+
children: "Select all"
|
|
788
|
+
})
|
|
789
|
+
})
|
|
790
|
+
});
|
|
791
|
+
};
|
|
792
|
+
exports.SelectAllCheckbox = SelectAllCheckbox;
|
|
793
|
+
|
|
698
794
|
/***/ }),
|
|
699
795
|
|
|
700
796
|
/***/ 540:
|
|
@@ -20394,146 +20490,17 @@ var _CapRow = _interopRequireDefault(__webpack_require__(7375));
|
|
|
20394
20490
|
var _CapSpin = _interopRequireDefault(__webpack_require__(1549));
|
|
20395
20491
|
var _CapTooltip = _interopRequireDefault(__webpack_require__(5636));
|
|
20396
20492
|
var _CapTooltipWithInfo = _interopRequireDefault(__webpack_require__(2608));
|
|
20493
|
+
var _components = __webpack_require__(455);
|
|
20397
20494
|
var _constants = __webpack_require__(9788);
|
|
20398
20495
|
var _styles = _interopRequireDefault(__webpack_require__(8263));
|
|
20496
|
+
var _utils = __webpack_require__(8052);
|
|
20399
20497
|
var _jsxRuntime = __webpack_require__(4848);
|
|
20400
20498
|
const _excluded = ["type", "options", "value", "onChange", "placeholder", "className", "style", "isError", "errorMessage", "containerClassName", "popoverClassName", "allowClear", "headerLabel", "onUpload", "uploadLabel", "tooltip", "bylineText", "disabled", "showUpload", "customPopupRender", "showSearch", "searchBasedOn", "onSearch", "searchDebounce", "onConfirm", "clearText", "noResultCustomText", "noResultCustomIcon", "readOnly", "staticValue", "onFooterDownloadChange", "onPopupScroll", "hasMore", "enableVirtualization", "virtualRowHeight", "resetSearch", "resetData", "fetchMissingOptions"];
|
|
20401
20499
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20402
20500
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20501
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20403
20502
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
20404
|
-
|
|
20405
|
-
const NoResult = _ref => {
|
|
20406
|
-
let {
|
|
20407
|
-
noResultCustomText,
|
|
20408
|
-
className,
|
|
20409
|
-
showUpload,
|
|
20410
|
-
options,
|
|
20411
|
-
noResultCustomIcon
|
|
20412
|
-
} = _ref;
|
|
20413
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
20414
|
-
className: (0, _classnames.default)(className, _styles.default['cap-unified-select-no-result']),
|
|
20415
|
-
align: "middle",
|
|
20416
|
-
gap: 8,
|
|
20417
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
20418
|
-
type: noResultCustomIcon,
|
|
20419
|
-
size: "m"
|
|
20420
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
20421
|
-
className: _styles.default['cap-unified-select-no-result-text'],
|
|
20422
|
-
children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : _constants.DEFAULTS.NO_RESULT_TEXT
|
|
20423
|
-
})]
|
|
20424
|
-
});
|
|
20425
|
-
};
|
|
20426
|
-
const SelectAllCheckbox = _ref2 => {
|
|
20427
|
-
let {
|
|
20428
|
-
currentItems,
|
|
20429
|
-
tempValue,
|
|
20430
|
-
setTempValue,
|
|
20431
|
-
processTreeData
|
|
20432
|
-
} = _ref2;
|
|
20433
|
-
const {
|
|
20434
|
-
leafValues = []
|
|
20435
|
-
} = processTreeData ? processTreeData(currentItems) : {};
|
|
20436
|
-
const totalAvailable = leafValues.length;
|
|
20437
|
-
const leafSet = new Set(leafValues);
|
|
20438
|
-
const selectedInScope = Array.isArray(tempValue) ? tempValue.filter(v => leafSet.has(v)).length : 0;
|
|
20439
|
-
const allChecked = totalAvailable > 0 && selectedInScope === totalAvailable;
|
|
20440
|
-
const indeterminate = selectedInScope > 0 && selectedInScope < totalAvailable;
|
|
20441
|
-
const handleChange = e => {
|
|
20442
|
-
if (e.target.checked) {
|
|
20443
|
-
const merged = new Set(Array.isArray(tempValue) ? tempValue : []);
|
|
20444
|
-
leafValues.forEach(v => merged.add(v));
|
|
20445
|
-
setTempValue(Array.from(merged));
|
|
20446
|
-
} else {
|
|
20447
|
-
const toRemove = new Set(leafValues);
|
|
20448
|
-
const next = (Array.isArray(tempValue) ? tempValue : []).filter(v => !toRemove.has(v));
|
|
20449
|
-
setTempValue(next);
|
|
20450
|
-
}
|
|
20451
|
-
};
|
|
20452
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
|
|
20453
|
-
className: _styles.default['cap-unified-select-select-all-container'],
|
|
20454
|
-
align: "middle",
|
|
20455
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Checkbox, {
|
|
20456
|
-
className: _styles.default['cap-unified-select-select-all-checkbox'],
|
|
20457
|
-
checked: allChecked,
|
|
20458
|
-
indeterminate: indeterminate,
|
|
20459
|
-
onChange: handleChange,
|
|
20460
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
20461
|
-
type: "label14",
|
|
20462
|
-
className: _styles.default['cap-unified-select-select-all-label'],
|
|
20463
|
-
children: "Select all"
|
|
20464
|
-
})
|
|
20465
|
-
})
|
|
20466
|
-
});
|
|
20467
|
-
};
|
|
20468
|
-
const buildTreeMaps = nodes => {
|
|
20469
|
-
const result = {
|
|
20470
|
-
leafValues: [],
|
|
20471
|
-
parentChildMap: {},
|
|
20472
|
-
nodeMap: {}
|
|
20473
|
-
};
|
|
20474
|
-
if (!nodes) return result;
|
|
20475
|
-
const traverse = items => {
|
|
20476
|
-
items == null || items.forEach(item => {
|
|
20477
|
-
if (item.value !== undefined) {
|
|
20478
|
-
result.nodeMap[item.value] = item;
|
|
20479
|
-
if (item != null && item.children && item.children.length > 0) {
|
|
20480
|
-
result.parentChildMap[item.value] = item.children.map(child => child == null ? void 0 : child.value).filter(v => v !== undefined);
|
|
20481
|
-
traverse(item.children);
|
|
20482
|
-
} else {
|
|
20483
|
-
result.leafValues.push(item.value);
|
|
20484
|
-
}
|
|
20485
|
-
}
|
|
20486
|
-
});
|
|
20487
|
-
};
|
|
20488
|
-
traverse(nodes);
|
|
20489
|
-
return result;
|
|
20490
|
-
};
|
|
20491
|
-
const countSelectedLeaves = (treeMaps, selectedValues) => {
|
|
20492
|
-
var _treeMaps$leafValues;
|
|
20493
|
-
if (!Array.isArray(selectedValues) || !(selectedValues != null && selectedValues.length)) return 0;
|
|
20494
|
-
const expandedSet = new Set(selectedValues);
|
|
20495
|
-
const processNode = value => {
|
|
20496
|
-
var _treeMaps$parentChild;
|
|
20497
|
-
const children = treeMaps == null || (_treeMaps$parentChild = treeMaps.parentChildMap) == null ? void 0 : _treeMaps$parentChild[value];
|
|
20498
|
-
if (!children) return;
|
|
20499
|
-
children == null || children.forEach(childValue => {
|
|
20500
|
-
expandedSet.add(childValue);
|
|
20501
|
-
processNode(childValue);
|
|
20502
|
-
});
|
|
20503
|
-
};
|
|
20504
|
-
selectedValues == null || selectedValues.forEach(processNode);
|
|
20505
|
-
return (treeMaps == null || (_treeMaps$leafValues = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues.reduce((count, leaf) => expandedSet.has(leaf) ? count + 1 : count, 0)) || 0;
|
|
20506
|
-
};
|
|
20507
|
-
const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
|
|
20508
|
-
if (searchBasedOn === void 0) {
|
|
20509
|
-
searchBasedOn = 'label';
|
|
20510
|
-
}
|
|
20511
|
-
if (!(data != null && data.length) || !search) return data;
|
|
20512
|
-
const searchLower = search.toLowerCase();
|
|
20513
|
-
const selectedSet = new Set(selectedValues || []);
|
|
20514
|
-
const nodeMatchesSearch = node => {
|
|
20515
|
-
var _node$value, _node$key, _ref3, _node$label;
|
|
20516
|
-
const target = searchBasedOn === 'value' ? String((_node$value = node == null ? void 0 : node.value) != null ? _node$value : '') : searchBasedOn === 'key' ? String((_node$key = node == null ? void 0 : node.key) != null ? _node$key : '') : String((_ref3 = (_node$label = node == null ? void 0 : node.label) != null ? _node$label : node == null ? void 0 : node.title) != null ? _ref3 : '');
|
|
20517
|
-
return target.toLowerCase().includes(searchLower);
|
|
20518
|
-
};
|
|
20519
|
-
const isNodeSelected = node => {
|
|
20520
|
-
return node.value !== undefined && selectedSet.has(node.value);
|
|
20521
|
-
};
|
|
20522
|
-
const loop = items => items.reduce((acc, item) => {
|
|
20523
|
-
var _item$children;
|
|
20524
|
-
if (!item) return acc;
|
|
20525
|
-
const children = item != null && (_item$children = item.children) != null && _item$children.length ? loop(item.children) : [];
|
|
20526
|
-
// Include node if: matches search OR is selected OR has matching children
|
|
20527
|
-
if (nodeMatchesSearch(item) || isNodeSelected(item) || children.length) {
|
|
20528
|
-
acc.push(_extends({}, item, {
|
|
20529
|
-
children
|
|
20530
|
-
}));
|
|
20531
|
-
}
|
|
20532
|
-
return acc;
|
|
20533
|
-
}, []);
|
|
20534
|
-
return loop(data);
|
|
20535
|
-
};
|
|
20536
|
-
const CapUnifiedSelect = _ref4 => {
|
|
20503
|
+
const CapUnifiedSelect = _ref => {
|
|
20537
20504
|
let {
|
|
20538
20505
|
type = _constants.SELECT_TYPES.SELECT,
|
|
20539
20506
|
options = [],
|
|
@@ -20573,141 +20540,79 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20573
20540
|
resetSearch = true,
|
|
20574
20541
|
resetData,
|
|
20575
20542
|
fetchMissingOptions
|
|
20576
|
-
} =
|
|
20577
|
-
rest = _objectWithoutPropertiesLoose(
|
|
20543
|
+
} = _ref,
|
|
20544
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
20578
20545
|
const [searchText, setSearchText] = (0, _react.useState)('');
|
|
20579
20546
|
const [tempValue, setTempValue] = (0, _react.useState)(value);
|
|
20580
20547
|
const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
|
|
20581
20548
|
const [isSearching, setIsSearching] = (0, _react.useState)(false);
|
|
20582
20549
|
const [isLoadingOnScroll, setIsLoadingOnScroll] = (0, _react.useState)(false);
|
|
20583
20550
|
const [isResettingData, setIsResettingData] = (0, _react.useState)(false);
|
|
20584
|
-
// Store ordered options after confirm (selected items moved to top based on selection order)
|
|
20585
20551
|
const [orderedOptions, setOrderedOptions] = (0, _react.useState)(null);
|
|
20586
20552
|
const searchTimeoutRef = (0, _react.useRef)(null);
|
|
20587
20553
|
const scrollContainerRef = (0, _react.useRef)(null);
|
|
20588
20554
|
const scrollLoadingTimeoutRef = (0, _react.useRef)(null);
|
|
20589
|
-
// Track if scroll handler is currently processing to prevent duplicate calls
|
|
20590
20555
|
const isScrollProcessingRef = (0, _react.useRef)(false);
|
|
20591
|
-
// Throttle ref for scroll events
|
|
20592
20556
|
const scrollThrottleTimeoutRef = (0, _react.useRef)(null);
|
|
20593
|
-
// Ref to track options for scroll handler (avoids recreating handleScroll)
|
|
20594
20557
|
const optionsRef = (0, _react.useRef)(options);
|
|
20595
|
-
// Cache of selected items from async results to preserve them during search
|
|
20596
20558
|
const selectedItemsCacheRef = (0, _react.useRef)(new Map());
|
|
20597
|
-
// Track the last search query to detect when options update after search
|
|
20598
20559
|
const lastSearchQueryRef = (0, _react.useRef)('');
|
|
20599
|
-
// Track when search was cleared to help clear loading state
|
|
20600
20560
|
const searchClearedTimeRef = (0, _react.useRef)(null);
|
|
20601
|
-
// Track previous options to detect when they change after a search
|
|
20602
20561
|
const prevOptionsRef = (0, _react.useRef)(options);
|
|
20603
|
-
// Track previous options before resetData is called to detect when options update
|
|
20604
20562
|
const prevOptionsBeforeResetRef = (0, _react.useRef)(options);
|
|
20605
|
-
// Track previous options count to detect when options change after scroll
|
|
20606
20563
|
const prevOptionsCountRef = (0, _react.useRef)(options.length);
|
|
20607
|
-
// Track previous options to detect when options change (even if count stays same)
|
|
20608
20564
|
const prevOptionsRefForScroll = (0, _react.useRef)(options);
|
|
20609
|
-
// Track options count when scroll was triggered (for orderedOptions update)
|
|
20610
20565
|
const scrollTriggerOptionsCountRef = (0, _react.useRef)(options.length);
|
|
20611
|
-
// Track if initial sort has been done (only sort once on initial load with selected values)
|
|
20612
20566
|
const initialSortDoneRef = (0, _react.useRef)(false);
|
|
20613
|
-
// Track if user has interacted with the dropdown during current session (selected, searched, etc.)
|
|
20614
20567
|
const hasInteractedRef = (0, _react.useRef)(false);
|
|
20615
|
-
// Track the initial tempValue when dropdown opens to detect if user made changes
|
|
20616
20568
|
const initialTempValueRef = (0, _react.useRef)(value);
|
|
20617
|
-
// Track if resetData was already called in the current session to prevent duplicate calls
|
|
20618
20569
|
const resetDataCalledRef = (0, _react.useRef)(false);
|
|
20619
|
-
// Track when resetData was called to help clear loading state
|
|
20620
20570
|
const resetDataCalledTimeRef = (0, _react.useRef)(null);
|
|
20621
|
-
// Track if fetchMissingOptions was already called to prevent duplicate calls
|
|
20622
20571
|
const fetchMissingOptionsCalledRef = (0, _react.useRef)(false);
|
|
20623
|
-
// Track the last missing values that were sent to prevent duplicate calls with same values
|
|
20624
20572
|
const lastMissingValuesRef = (0, _react.useRef)('');
|
|
20625
|
-
|
|
20626
|
-
// Helper function to check if a value exists in options (recursive for tree structures)
|
|
20627
|
-
const findValueInOptions = (0, _react.useCallback)((opts, targetValue) => {
|
|
20628
|
-
for (const opt of opts) {
|
|
20629
|
-
if (opt.value === targetValue) {
|
|
20630
|
-
return true;
|
|
20631
|
-
}
|
|
20632
|
-
if (opt.children && opt.children.length > 0) {
|
|
20633
|
-
if (findValueInOptions(opt.children, targetValue)) {
|
|
20634
|
-
return true;
|
|
20635
|
-
}
|
|
20636
|
-
}
|
|
20637
|
-
}
|
|
20638
|
-
return false;
|
|
20639
|
-
}, []);
|
|
20640
|
-
|
|
20641
|
-
// Helper function to find missing selected values
|
|
20642
|
-
const findMissingValues = (0, _react.useCallback)((selectedValues, currentOptions) => {
|
|
20643
|
-
if (!selectedValues.length || !currentOptions.length) {
|
|
20644
|
-
return selectedValues;
|
|
20645
|
-
}
|
|
20646
|
-
return selectedValues.filter(val => !findValueInOptions(currentOptions, val));
|
|
20647
|
-
}, [findValueInOptions]);
|
|
20648
|
-
|
|
20649
|
-
// Check for missing options and call fetchMissingOptions if needed
|
|
20650
20573
|
(0, _react.useEffect)(() => {
|
|
20651
|
-
// Only check if fetchMissingOptions is provided
|
|
20652
20574
|
if (!fetchMissingOptions) {
|
|
20653
20575
|
return;
|
|
20654
20576
|
}
|
|
20655
|
-
|
|
20656
|
-
// Don't check for missing values if options array is empty
|
|
20657
|
-
// This prevents false positives during initial render before data is fetched
|
|
20658
|
-
// Only check once options have been loaded (options.length > 0)
|
|
20659
20577
|
if (options.length === 0) {
|
|
20660
20578
|
return;
|
|
20661
20579
|
}
|
|
20662
20580
|
|
|
20663
|
-
//
|
|
20581
|
+
// For API-driven data, don't fetch missing options during active search
|
|
20582
|
+
// Only fetch when there's no search query or search is cleared
|
|
20583
|
+
const hasActiveSearch = !staticValue && lastSearchQueryRef.current.trim().length > 0;
|
|
20584
|
+
if (hasActiveSearch) {
|
|
20585
|
+
return;
|
|
20586
|
+
}
|
|
20664
20587
|
const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
20665
20588
|
if (selectedValues.length === 0) {
|
|
20666
|
-
// No selected values, reset the tracking
|
|
20667
20589
|
fetchMissingOptionsCalledRef.current = false;
|
|
20668
20590
|
lastMissingValuesRef.current = '';
|
|
20669
20591
|
return;
|
|
20670
20592
|
}
|
|
20671
|
-
|
|
20672
|
-
// Find missing values
|
|
20673
|
-
const missingValues = findMissingValues(selectedValues, options);
|
|
20674
|
-
|
|
20675
|
-
// If no missing values, reset tracking and return
|
|
20593
|
+
const missingValues = (0, _utils.findMissingValues)(selectedValues, options);
|
|
20676
20594
|
if (missingValues.length === 0) {
|
|
20677
20595
|
fetchMissingOptionsCalledRef.current = false;
|
|
20678
20596
|
lastMissingValuesRef.current = '';
|
|
20679
20597
|
return;
|
|
20680
20598
|
}
|
|
20681
|
-
|
|
20682
|
-
// Create a sorted string representation of missing values for comparison
|
|
20683
|
-
// Use slice() to avoid mutating the original array
|
|
20684
20599
|
const missingValuesKey = [...missingValues].sort().join(',');
|
|
20685
|
-
|
|
20686
|
-
// Only call if:
|
|
20687
|
-
// 1. We haven't called it before, OR
|
|
20688
|
-
// 2. The missing values have changed (different values are missing now)
|
|
20689
20600
|
if (!fetchMissingOptionsCalledRef.current || lastMissingValuesRef.current !== missingValuesKey) {
|
|
20690
20601
|
fetchMissingOptionsCalledRef.current = true;
|
|
20691
20602
|
lastMissingValuesRef.current = missingValuesKey;
|
|
20692
|
-
// Call the developer's function with missing values (pass a copy to avoid mutation)
|
|
20693
20603
|
fetchMissingOptions([...missingValues]);
|
|
20694
20604
|
}
|
|
20695
|
-
}, [value, options, fetchMissingOptions,
|
|
20605
|
+
}, [value, options, fetchMissingOptions, staticValue]);
|
|
20696
20606
|
(0, _react.useEffect)(() => {
|
|
20697
20607
|
const isEqual = Array.isArray(value) && Array.isArray(tempValue) ? (value == null ? void 0 : value.length) === (tempValue == null ? void 0 : tempValue.length) && value.every(v => Array.isArray(tempValue) && tempValue.includes(v)) : value === tempValue;
|
|
20698
20608
|
if (!isEqual) {
|
|
20699
20609
|
setTempValue(value);
|
|
20700
|
-
// Reset ordered options when value changes from outside
|
|
20701
20610
|
setOrderedOptions(null);
|
|
20702
20611
|
}
|
|
20703
20612
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20704
20613
|
}, [value]);
|
|
20705
|
-
|
|
20706
|
-
// Cache selected items when tempValue changes
|
|
20707
20614
|
(0, _react.useEffect)(() => {
|
|
20708
20615
|
const currentSelected = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
|
|
20709
|
-
|
|
20710
|
-
// Store selected items in cache for persistence
|
|
20711
20616
|
const findAndCacheOption = (opts, val) => {
|
|
20712
20617
|
for (const opt of opts) {
|
|
20713
20618
|
if (opt.value === val) {
|
|
@@ -20727,8 +20632,6 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20727
20632
|
findAndCacheOption(options, val);
|
|
20728
20633
|
}
|
|
20729
20634
|
});
|
|
20730
|
-
|
|
20731
|
-
// Clean up cache for unselected items
|
|
20732
20635
|
const selectedSet = new Set(currentSelected);
|
|
20733
20636
|
selectedItemsCacheRef.current.forEach((_, value) => {
|
|
20734
20637
|
if (!selectedSet.has(value)) {
|
|
@@ -20736,15 +20639,9 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20736
20639
|
}
|
|
20737
20640
|
});
|
|
20738
20641
|
}, [tempValue, options]);
|
|
20739
|
-
|
|
20740
|
-
// Reset ordered options when options change, but only if it would invalidate the current ordering
|
|
20741
|
-
// This prevents resetting when options are updated via onSearch/onScroll but selected items still exist
|
|
20742
20642
|
(0, _react.useEffect)(() => {
|
|
20743
|
-
// Only reset if we have orderedOptions and the current value's items are no longer in options
|
|
20744
20643
|
if (orderedOptions) {
|
|
20745
20644
|
const currentSelected = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
|
|
20746
|
-
|
|
20747
|
-
// Check if all selected values still exist in the new options
|
|
20748
20645
|
const checkValueExists = (opts, val) => {
|
|
20749
20646
|
for (const opt of opts) {
|
|
20750
20647
|
if (opt.value === val) return true;
|
|
@@ -20754,27 +20651,16 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20754
20651
|
}
|
|
20755
20652
|
return false;
|
|
20756
20653
|
};
|
|
20757
|
-
|
|
20758
|
-
// If any selected value is missing from new options, reset ordering
|
|
20759
20654
|
const allSelectedStillExist = currentSelected.every(val => checkValueExists(options, val));
|
|
20760
20655
|
if (!allSelectedStillExist) {
|
|
20761
20656
|
setOrderedOptions(null);
|
|
20762
20657
|
}
|
|
20763
|
-
// Otherwise, keep the ordering even if options changed (e.g., via onSearch adding more items)
|
|
20764
|
-
} else {
|
|
20765
|
-
// No ordering set, nothing to reset
|
|
20766
20658
|
}
|
|
20767
20659
|
}, [options, orderedOptions, tempValue]);
|
|
20768
|
-
|
|
20769
|
-
// Extract debounce timeout (extracted early for use in useEffects)
|
|
20770
20660
|
const debounceTimeout = searchDebounce != null ? searchDebounce : _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE;
|
|
20771
|
-
|
|
20772
|
-
// Keep optionsRef in sync with options
|
|
20773
20661
|
(0, _react.useEffect)(() => {
|
|
20774
20662
|
optionsRef.current = options;
|
|
20775
20663
|
}, [options]);
|
|
20776
|
-
|
|
20777
|
-
// Cleanup timeouts on unmount
|
|
20778
20664
|
(0, _react.useEffect)(() => {
|
|
20779
20665
|
return () => {
|
|
20780
20666
|
if (searchTimeoutRef.current) {
|
|
@@ -20788,35 +20674,21 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20788
20674
|
}
|
|
20789
20675
|
};
|
|
20790
20676
|
}, []);
|
|
20791
|
-
|
|
20792
|
-
// Detect when options update after a search to clear loading state
|
|
20793
|
-
// This prevents showing "No results found" before data arrives
|
|
20794
20677
|
(0, _react.useEffect)(() => {
|
|
20795
|
-
// Only handle this for API-based searches (staticValue = false)
|
|
20796
|
-
// Check if lastSearchQueryRef has been set (including empty string for cleared search)
|
|
20797
20678
|
const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
|
|
20798
20679
|
if (staticValue || !isSearching || !hasSearchQuery) {
|
|
20799
20680
|
prevOptionsRef.current = options;
|
|
20800
20681
|
return;
|
|
20801
20682
|
}
|
|
20802
|
-
|
|
20803
|
-
// Check if options actually changed (reference or content)
|
|
20804
20683
|
const optionsChanged = prevOptionsRef.current !== options || prevOptionsRef.current.length !== options.length;
|
|
20805
|
-
|
|
20806
|
-
// Also check if search was cleared (empty string) and enough time has passed
|
|
20807
|
-
// This handles the case where clearing search reloads initial data that might be the same reference
|
|
20808
20684
|
const searchCleared = lastSearchQueryRef.current === '';
|
|
20809
20685
|
const timeSinceCleared = searchClearedTimeRef.current ? Date.now() - searchClearedTimeRef.current : Infinity;
|
|
20810
20686
|
const hasOptionsData = options.length > 0;
|
|
20811
|
-
// Wait at least SEARCH_CLEARED_TIMEOUT after search is cleared to allow API call to complete
|
|
20812
20687
|
const clearedSearchReady = searchCleared && hasOptionsData && timeSinceCleared > _constants.TIMEOUTS.SEARCH_CLEARED_TIMEOUT;
|
|
20813
20688
|
if (optionsChanged || clearedSearchReady) {
|
|
20814
|
-
// Options updated after search - data has arrived
|
|
20815
|
-
// Use a small delay to ensure state updates are processed
|
|
20816
20689
|
const timeoutId = setTimeout(() => {
|
|
20817
20690
|
setIsSearching(false);
|
|
20818
20691
|
prevOptionsRef.current = options;
|
|
20819
|
-
// Clear timestamp when search loading is cleared
|
|
20820
20692
|
if (searchCleared) {
|
|
20821
20693
|
searchClearedTimeRef.current = null;
|
|
20822
20694
|
}
|
|
@@ -20825,91 +20697,50 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20825
20697
|
}
|
|
20826
20698
|
prevOptionsRef.current = options;
|
|
20827
20699
|
}, [options, staticValue, isSearching]);
|
|
20828
|
-
|
|
20829
|
-
// Fallback: Clear searching state after a reasonable timeout to prevent infinite loading
|
|
20830
|
-
// This handles edge cases where options might not change reference but data has arrived
|
|
20831
|
-
// Also handles error cases where options don't update after search
|
|
20832
20700
|
(0, _react.useEffect)(() => {
|
|
20833
|
-
// Check if lastSearchQueryRef has been set (including empty string for cleared search)
|
|
20834
20701
|
const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
|
|
20835
20702
|
if (!isSearching || staticValue || !hasSearchQuery) {
|
|
20836
20703
|
return;
|
|
20837
20704
|
}
|
|
20838
|
-
|
|
20839
|
-
// For cleared search (empty string), use a shorter timeout since it should reload initial data quickly
|
|
20840
|
-
// For regular search, use debounce timeout + buffer
|
|
20841
20705
|
const searchCleared = lastSearchQueryRef.current === '';
|
|
20842
|
-
const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER
|
|
20843
|
-
: debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER; // Longer timeout for regular search
|
|
20844
|
-
|
|
20845
|
-
// Calculate timeout: debounce timeout + a small buffer for API response
|
|
20846
|
-
// This ensures we wait for the API call to complete before showing "No results"
|
|
20847
|
-
// For error cases where options don't update, this will clear loading state
|
|
20706
|
+
const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER : debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER;
|
|
20848
20707
|
const fallbackTimeout = setTimeout(() => {
|
|
20849
20708
|
setIsSearching(false);
|
|
20850
|
-
searchClearedTimeRef.current = null;
|
|
20709
|
+
searchClearedTimeRef.current = null;
|
|
20851
20710
|
}, timeoutDuration);
|
|
20852
20711
|
return () => clearTimeout(fallbackTimeout);
|
|
20853
20712
|
}, [isSearching, staticValue, debounceTimeout, options.length]);
|
|
20854
|
-
|
|
20855
|
-
// Detect when options update after resetData is called to clear loading state
|
|
20856
20713
|
(0, _react.useEffect)(() => {
|
|
20857
20714
|
if (!isResettingData) {
|
|
20858
|
-
// Update ref even when not resetting to keep it in sync
|
|
20859
20715
|
prevOptionsBeforeResetRef.current = options;
|
|
20860
|
-
// Clear timestamp when not resetting
|
|
20861
20716
|
resetDataCalledTimeRef.current = null;
|
|
20862
20717
|
return;
|
|
20863
20718
|
}
|
|
20864
|
-
|
|
20865
|
-
// Check if options actually changed (reference, length, or content)
|
|
20866
|
-
// Compare against the options that existed before resetData was called
|
|
20867
20719
|
const prevOptions = prevOptionsBeforeResetRef.current;
|
|
20868
20720
|
const currentOptions = options;
|
|
20869
|
-
|
|
20870
|
-
// More robust comparison: check reference, length, or any content differences
|
|
20871
|
-
const optionsChanged = prevOptions !== currentOptions || prevOptions.length !== currentOptions.length ||
|
|
20872
|
-
// Deep comparison: check if any option values or labels changed
|
|
20873
|
-
prevOptions.length === currentOptions.length && prevOptions.length > 0 && prevOptions.some((prevOpt, idx) => {
|
|
20721
|
+
const optionsChanged = prevOptions !== currentOptions || prevOptions.length !== currentOptions.length || prevOptions.length === currentOptions.length && prevOptions.length > 0 && prevOptions.some((prevOpt, idx) => {
|
|
20874
20722
|
const currentOpt = currentOptions[idx];
|
|
20875
20723
|
return !currentOpt || prevOpt.value !== currentOpt.value || prevOpt.label !== currentOpt.label;
|
|
20876
20724
|
});
|
|
20877
|
-
|
|
20878
|
-
// Additional check: if enough time has passed since resetData was called
|
|
20879
|
-
// and we have options data, assume data has loaded even if comparison didn't detect change
|
|
20880
20725
|
const timeSinceReset = resetDataCalledTimeRef.current ? Date.now() - resetDataCalledTimeRef.current : Infinity;
|
|
20881
20726
|
const hasDataAfterTimeout = currentOptions.length > 0 && timeSinceReset > _constants.TIMEOUTS.RESET_DATA_MIN_TIME && timeSinceReset < _constants.TIMEOUTS.RESET_DATA_MAX_TIME;
|
|
20882
|
-
|
|
20883
|
-
// If options changed or enough time has passed with data, clear the loading state
|
|
20884
20727
|
if (optionsChanged || hasDataAfterTimeout) {
|
|
20885
|
-
// Options updated after resetData - data has arrived
|
|
20886
|
-
// Clear immediately without delay for faster response
|
|
20887
20728
|
setIsResettingData(false);
|
|
20888
20729
|
prevOptionsBeforeResetRef.current = currentOptions;
|
|
20889
20730
|
resetDataCalledTimeRef.current = null;
|
|
20890
20731
|
}
|
|
20891
20732
|
}, [options, isResettingData]);
|
|
20892
|
-
|
|
20893
|
-
// Fallback: Clear resetData loading state after a reasonable timeout
|
|
20894
|
-
// This handles edge cases where options might not change reference but data has arrived
|
|
20895
20733
|
(0, _react.useEffect)(() => {
|
|
20896
20734
|
if (!isResettingData) {
|
|
20897
20735
|
return;
|
|
20898
20736
|
}
|
|
20899
|
-
|
|
20900
|
-
// Set a timeout to clear loading state if options don't update
|
|
20901
|
-
// Reduced timeout to 1 second for faster recovery
|
|
20902
20737
|
const fallbackTimeout = setTimeout(() => {
|
|
20903
20738
|
setIsResettingData(false);
|
|
20904
|
-
// Update ref to current options to prevent false positives in future comparisons
|
|
20905
20739
|
prevOptionsBeforeResetRef.current = options;
|
|
20906
|
-
// Clear timestamp
|
|
20907
20740
|
resetDataCalledTimeRef.current = null;
|
|
20908
20741
|
}, _constants.TIMEOUTS.RESET_DATA_TIMEOUT);
|
|
20909
20742
|
return () => clearTimeout(fallbackTimeout);
|
|
20910
20743
|
}, [isResettingData, options]);
|
|
20911
|
-
|
|
20912
|
-
// Clear loading state when hasMore becomes false (all items exhausted)
|
|
20913
20744
|
(0, _react.useEffect)(() => {
|
|
20914
20745
|
if (!hasMore && isLoadingOnScroll) {
|
|
20915
20746
|
setIsLoadingOnScroll(false);
|
|
@@ -20920,79 +20751,47 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
20920
20751
|
}
|
|
20921
20752
|
}
|
|
20922
20753
|
}, [hasMore, isLoadingOnScroll]);
|
|
20923
|
-
|
|
20924
|
-
// Detect when options change after scroll to clear loading overlay
|
|
20925
20754
|
(0, _react.useEffect)(() => {
|
|
20926
|
-
// Always update refs when options change (when not loading)
|
|
20927
|
-
// This ensures we track the current state for next scroll detection
|
|
20928
20755
|
if (!isLoadingOnScroll) {
|
|
20929
20756
|
prevOptionsCountRef.current = options.length;
|
|
20930
|
-
// Store a reference to the options array for comparison
|
|
20931
|
-
// We'll compare by length and last item to detect changes
|
|
20932
20757
|
prevOptionsRefForScroll.current = options;
|
|
20933
20758
|
}
|
|
20934
|
-
|
|
20935
|
-
// Only check for changes if we're currently loading from scroll
|
|
20936
20759
|
if (!isLoadingOnScroll || !onPopupScroll) {
|
|
20937
20760
|
return;
|
|
20938
20761
|
}
|
|
20939
|
-
|
|
20940
|
-
// Check if options count increased (new data loaded via append)
|
|
20941
20762
|
const optionsCountIncreased = options.length > prevOptionsCountRef.current;
|
|
20942
|
-
|
|
20943
|
-
// Check if options content changed (even if count is same - replacement scenario)
|
|
20944
|
-
// Compare the last option to detect if new data was appended
|
|
20945
20763
|
const optionsContentChanged = (() => {
|
|
20946
20764
|
const prevCount = prevOptionsCountRef.current;
|
|
20947
20765
|
const currentCount = options.length;
|
|
20948
|
-
|
|
20949
|
-
// If count changed, definitely content changed
|
|
20950
20766
|
if (prevCount !== currentCount) {
|
|
20951
20767
|
return true;
|
|
20952
20768
|
}
|
|
20953
|
-
|
|
20954
|
-
// If count is same, check if last option changed (indicates new data appended/replaced)
|
|
20955
20769
|
if (currentCount > 0 && prevCount > 0 && prevOptionsRefForScroll.current.length > 0) {
|
|
20956
20770
|
const prevOptions = prevOptionsRefForScroll.current;
|
|
20957
20771
|
const lastPrevOption = prevOptions[prevOptions.length - 1];
|
|
20958
20772
|
const lastCurrentOption = options[options.length - 1];
|
|
20959
|
-
|
|
20960
|
-
// If last option is different, content changed
|
|
20961
20773
|
if ((lastPrevOption == null ? void 0 : lastPrevOption.value) !== (lastCurrentOption == null ? void 0 : lastCurrentOption.value) || (lastPrevOption == null ? void 0 : lastPrevOption.label) !== (lastCurrentOption == null ? void 0 : lastCurrentOption.label)) {
|
|
20962
20774
|
return true;
|
|
20963
20775
|
}
|
|
20964
20776
|
}
|
|
20965
20777
|
return false;
|
|
20966
20778
|
})();
|
|
20967
|
-
|
|
20968
|
-
// Clear loading if options changed (either count increased or content changed)
|
|
20969
|
-
// This handles both append (count increase) and replace (content change) scenarios
|
|
20970
20779
|
if (optionsCountIncreased || optionsContentChanged) {
|
|
20971
|
-
// Options updated after scroll - data has arrived, clear loading overlay
|
|
20972
20780
|
setIsLoadingOnScroll(false);
|
|
20973
|
-
// Reset processing flag to allow next scroll event
|
|
20974
20781
|
isScrollProcessingRef.current = false;
|
|
20975
20782
|
if (scrollLoadingTimeoutRef.current) {
|
|
20976
20783
|
clearTimeout(scrollLoadingTimeoutRef.current);
|
|
20977
20784
|
scrollLoadingTimeoutRef.current = null;
|
|
20978
20785
|
}
|
|
20979
|
-
|
|
20980
|
-
// Update refs to track the new state after options change
|
|
20981
|
-
// This is critical for detecting subsequent scroll loads
|
|
20982
20786
|
prevOptionsCountRef.current = options.length;
|
|
20983
20787
|
prevOptionsRefForScroll.current = options;
|
|
20984
20788
|
}
|
|
20985
20789
|
}, [options, isLoadingOnScroll, onPopupScroll]);
|
|
20986
|
-
|
|
20987
|
-
// Handle search with debouncing
|
|
20988
20790
|
const handleSearch = (0, _react.useCallback)(query => {
|
|
20989
|
-
// Clear existing timeout
|
|
20990
20791
|
if (searchTimeoutRef.current) {
|
|
20991
20792
|
clearTimeout(searchTimeoutRef.current);
|
|
20992
20793
|
}
|
|
20993
20794
|
const trimmedQuery = query.trim();
|
|
20994
|
-
|
|
20995
|
-
// Track when search is cleared (empty string after having a query)
|
|
20996
20795
|
const wasSearching = lastSearchQueryRef.current !== '';
|
|
20997
20796
|
const isNowCleared = trimmedQuery === '';
|
|
20998
20797
|
if (wasSearching && isNowCleared) {
|
|
@@ -21000,36 +20799,19 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21000
20799
|
} else if (!isNowCleared) {
|
|
21001
20800
|
searchClearedTimeRef.current = null;
|
|
21002
20801
|
}
|
|
21003
|
-
|
|
21004
|
-
// Track the search query to detect when options update
|
|
21005
20802
|
lastSearchQueryRef.current = trimmedQuery;
|
|
21006
|
-
|
|
21007
|
-
// Mark as interacted if user typed something (even if they clear it later)
|
|
21008
20803
|
if (trimmedQuery.length > 0 || lastSearchQueryRef.current.length > 0) {
|
|
21009
20804
|
hasInteractedRef.current = true;
|
|
21010
20805
|
}
|
|
21011
|
-
|
|
21012
|
-
// For API-based searches (staticValue = false), always call onSearch
|
|
21013
|
-
// This allows the developer to reload all initial data when search is cleared
|
|
21014
20806
|
if (!staticValue && onSearch) {
|
|
21015
|
-
// Set loading state for both empty and non-empty queries
|
|
21016
20807
|
setIsSearching(true);
|
|
21017
|
-
|
|
21018
|
-
// Debounce the search callback
|
|
21019
20808
|
searchTimeoutRef.current = setTimeout(() => {
|
|
21020
|
-
// Send the search input (empty string when cleared, or the actual query)
|
|
21021
20809
|
onSearch(trimmedQuery);
|
|
21022
|
-
// For API-based searches, keep isSearching true until options update
|
|
21023
|
-
// This prevents showing "No results found" before data arrives
|
|
21024
20810
|
}, debounceTimeout);
|
|
21025
20811
|
} else if (!trimmedQuery) {
|
|
21026
|
-
// For static searches, if query is empty, just reset the state
|
|
21027
20812
|
setIsSearching(false);
|
|
21028
20813
|
} else {
|
|
21029
|
-
// For static searches with content, show brief loading indicator
|
|
21030
|
-
// Set loading state briefly to show user feedback
|
|
21031
20814
|
setIsSearching(true);
|
|
21032
|
-
// Clear loading state after a short delay (filtering is instant but we show feedback)
|
|
21033
20815
|
searchTimeoutRef.current = setTimeout(() => {
|
|
21034
20816
|
setIsSearching(false);
|
|
21035
20817
|
}, _constants.TIMEOUTS.STATIC_SEARCH_DELAY);
|
|
@@ -21037,222 +20819,78 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21037
20819
|
}, [onSearch, staticValue, debounceTimeout]);
|
|
21038
20820
|
const isMulti = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.MULTI_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
|
|
21039
20821
|
const isTree = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.TREE_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
|
|
21040
|
-
|
|
21041
|
-
// Use options directly since pagination is handled by the developer
|
|
21042
20822
|
const mergedOptions = (0, _react.useMemo)(() => {
|
|
21043
20823
|
return options;
|
|
21044
20824
|
}, [options]);
|
|
21045
|
-
|
|
21046
|
-
// Helper function to reorder options based on selection order
|
|
21047
|
-
// Selected items are moved to top in the order they were selected
|
|
21048
|
-
// For tree structures, maintains parent-child relationships
|
|
21049
|
-
// For flat lists, directly reorders items
|
|
21050
|
-
// Works for all data types: flat lists, tree structures, nested trees
|
|
21051
|
-
const reorderOptionsBySelection = (0, _react.useCallback)((opts, selectedOrder) => {
|
|
21052
|
-
if (!Array.isArray(selectedOrder) || selectedOrder.length === 0 || !(opts != null && opts.length)) {
|
|
21053
|
-
return opts;
|
|
21054
|
-
}
|
|
21055
|
-
const selectedSet = new Set(selectedOrder);
|
|
21056
|
-
const selectedItems = [];
|
|
21057
|
-
const unselectedItems = [];
|
|
21058
|
-
const processedTopLevelValues = new Set();
|
|
21059
|
-
|
|
21060
|
-
// Deep clone helper to avoid mutating original items
|
|
21061
|
-
const deepCloneItem = item => {
|
|
21062
|
-
return _extends({}, item, {
|
|
21063
|
-
children: item.children ? item.children.map(deepCloneItem) : undefined
|
|
21064
|
-
});
|
|
21065
|
-
};
|
|
21066
|
-
|
|
21067
|
-
// Find the top-level item that contains the selected value
|
|
21068
|
-
// For flat lists, returns the item itself
|
|
21069
|
-
// For tree structures, returns the top-level parent from opts
|
|
21070
|
-
const findTopLevelItem = targetValue => {
|
|
21071
|
-
// First, find which top-level item in opts contains this value
|
|
21072
|
-
for (const topLevelItem of opts) {
|
|
21073
|
-
// Check if this top-level item itself matches
|
|
21074
|
-
if (topLevelItem.value === targetValue) {
|
|
21075
|
-
return topLevelItem;
|
|
21076
|
-
}
|
|
21077
|
-
|
|
21078
|
-
// Recursively search in children
|
|
21079
|
-
const searchInChildren = items => {
|
|
21080
|
-
for (const item of items) {
|
|
21081
|
-
if (item.value === targetValue) {
|
|
21082
|
-
return true; // Found it
|
|
21083
|
-
}
|
|
21084
|
-
if (item.children && item.children.length > 0) {
|
|
21085
|
-
if (searchInChildren(item.children)) {
|
|
21086
|
-
return true;
|
|
21087
|
-
}
|
|
21088
|
-
}
|
|
21089
|
-
}
|
|
21090
|
-
return false;
|
|
21091
|
-
};
|
|
21092
|
-
|
|
21093
|
-
// If found in this top-level item's children, return the top-level item
|
|
21094
|
-
if (topLevelItem.children && topLevelItem.children.length > 0) {
|
|
21095
|
-
if (searchInChildren(topLevelItem.children)) {
|
|
21096
|
-
return topLevelItem;
|
|
21097
|
-
}
|
|
21098
|
-
}
|
|
21099
|
-
}
|
|
21100
|
-
return null;
|
|
21101
|
-
};
|
|
21102
|
-
|
|
21103
|
-
// Check if an item or any of its descendants is selected
|
|
21104
|
-
const hasSelectedDescendant = item => {
|
|
21105
|
-
if (item.value !== undefined && selectedSet.has(item.value)) {
|
|
21106
|
-
return true;
|
|
21107
|
-
}
|
|
21108
|
-
if (item.children && item.children.length > 0) {
|
|
21109
|
-
return item.children.some(child => hasSelectedDescendant(child));
|
|
21110
|
-
}
|
|
21111
|
-
return false;
|
|
21112
|
-
};
|
|
21113
|
-
|
|
21114
|
-
// Collect selected items in selection order
|
|
21115
|
-
selectedOrder.forEach(selectedVal => {
|
|
21116
|
-
const topLevelItem = findTopLevelItem(selectedVal);
|
|
21117
|
-
if (topLevelItem && topLevelItem.value !== undefined && !processedTopLevelValues.has(topLevelItem.value)) {
|
|
21118
|
-
// Clone the item to avoid mutating the original
|
|
21119
|
-
const clonedItem = deepCloneItem(topLevelItem);
|
|
21120
|
-
selectedItems.push(clonedItem);
|
|
21121
|
-
processedTopLevelValues.add(topLevelItem.value);
|
|
21122
|
-
}
|
|
21123
|
-
});
|
|
21124
|
-
|
|
21125
|
-
// Collect unselected items maintaining original order
|
|
21126
|
-
// For tree structures, only include top-level items that don't have any selected descendants
|
|
21127
|
-
opts.forEach(item => {
|
|
21128
|
-
if (item.value === undefined) {
|
|
21129
|
-
// Item without value, include as-is
|
|
21130
|
-
unselectedItems.push(deepCloneItem(item));
|
|
21131
|
-
} else if (!processedTopLevelValues.has(item.value)) {
|
|
21132
|
-
// Check if this item or any of its descendants is selected
|
|
21133
|
-
if (!hasSelectedDescendant(item)) {
|
|
21134
|
-
unselectedItems.push(deepCloneItem(item));
|
|
21135
|
-
}
|
|
21136
|
-
}
|
|
21137
|
-
});
|
|
21138
|
-
|
|
21139
|
-
// Return selected items first (in selection order), then unselected items
|
|
21140
|
-
return [...selectedItems, ...unselectedItems];
|
|
21141
|
-
}, []);
|
|
21142
|
-
|
|
21143
|
-
// Track previous options count before fetchMissingOptions to detect when missing options are added
|
|
21144
20825
|
const prevOptionsCountBeforeFetchMissingRef = (0, _react.useRef)(options.length);
|
|
21145
|
-
// Track previous options before fetchMissingOptions to detect when missing options are added
|
|
21146
20826
|
const prevOptionsBeforeFetchMissingRef = (0, _react.useRef)(options);
|
|
21147
|
-
|
|
21148
|
-
// Update orderedOptions when new options are appended via scroll (when items are selected)
|
|
21149
|
-
// This ensures new data appears even when items are selected
|
|
21150
20827
|
(0, _react.useEffect)(() => {
|
|
21151
|
-
// Only update if we have orderedOptions (items are selected), onPopupScroll is provided,
|
|
21152
|
-
// and options increased from when scroll was triggered
|
|
21153
20828
|
if (!orderedOptions || !onPopupScroll) {
|
|
21154
20829
|
return;
|
|
21155
20830
|
}
|
|
21156
20831
|
const currentOptions = options;
|
|
21157
|
-
// Compare against the count when scroll was triggered, not the current ref value
|
|
21158
|
-
// This ensures we detect increases even if refs were updated in other useEffects
|
|
21159
20832
|
const optionsCountIncreased = currentOptions.length > scrollTriggerOptionsCountRef.current;
|
|
21160
|
-
|
|
21161
|
-
// Only update if options increased from scroll trigger time
|
|
21162
|
-
// This prevents updating on other option changes (like search)
|
|
21163
20833
|
if (optionsCountIncreased && scrollTriggerOptionsCountRef.current > 0) {
|
|
21164
20834
|
const selectedValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
|
|
21165
20835
|
if (selectedValues.length > 0) {
|
|
21166
|
-
|
|
21167
|
-
// This will put selected items at top and append new unselected items at bottom
|
|
21168
|
-
const reordered = reorderOptionsBySelection(currentOptions, selectedValues);
|
|
20836
|
+
const reordered = (0, _utils.reorderOptionsBySelection)(currentOptions, selectedValues);
|
|
21169
20837
|
setOrderedOptions(reordered);
|
|
21170
|
-
// Update the scroll trigger count for next scroll detection
|
|
21171
20838
|
scrollTriggerOptionsCountRef.current = currentOptions.length;
|
|
21172
20839
|
}
|
|
21173
20840
|
}
|
|
21174
|
-
}, [options, orderedOptions, onPopupScroll, tempValue
|
|
21175
|
-
|
|
21176
|
-
// Update orderedOptions when new options are added via fetchMissingOptions (for paginated API-driven data)
|
|
21177
|
-
// This handles the case when user selects items from paginated pages and confirms
|
|
21178
|
-
// The fetchMissingOptions callback fetches the missing selected items, and we need to reorder them to top
|
|
21179
|
-
// Also handles search cases and upload cases where selected items might not be in current options
|
|
20841
|
+
}, [options, orderedOptions, onPopupScroll, tempValue]);
|
|
21180
20842
|
(0, _react.useEffect)(() => {
|
|
21181
|
-
// Only handle if fetchMissingOptions is provided (indicates API-driven pagination)
|
|
21182
20843
|
if (!fetchMissingOptions) {
|
|
21183
|
-
// Update refs even when fetchMissingOptions is not provided
|
|
21184
20844
|
prevOptionsCountBeforeFetchMissingRef.current = options.length;
|
|
21185
20845
|
prevOptionsBeforeFetchMissingRef.current = options;
|
|
21186
20846
|
return;
|
|
21187
20847
|
}
|
|
20848
|
+
|
|
20849
|
+
// For API-driven data, don't reorder options during active search
|
|
20850
|
+
// Only reorder when there's no search query or search is cleared
|
|
20851
|
+
const hasActiveSearch = !staticValue && lastSearchQueryRef.current.trim().length > 0;
|
|
20852
|
+
if (hasActiveSearch) {
|
|
20853
|
+
return;
|
|
20854
|
+
}
|
|
21188
20855
|
const currentOptions = options;
|
|
21189
20856
|
const currentSelectedValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
21190
20857
|
const tempSelectedValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
|
|
21191
|
-
// Use tempValue if available (during selection), otherwise use value (after confirm)
|
|
21192
20858
|
const selectedValues = tempSelectedValues.length > 0 ? tempSelectedValues : currentSelectedValues;
|
|
21193
20859
|
if (selectedValues.length === 0) {
|
|
21194
|
-
// No selected values, update refs and return
|
|
21195
20860
|
prevOptionsCountBeforeFetchMissingRef.current = currentOptions.length;
|
|
21196
20861
|
prevOptionsBeforeFetchMissingRef.current = currentOptions;
|
|
21197
20862
|
return;
|
|
21198
20863
|
}
|
|
21199
|
-
|
|
21200
|
-
// Check if options changed (count or content) after fetchMissingOptions was called
|
|
21201
20864
|
const prevOptions = prevOptionsBeforeFetchMissingRef.current;
|
|
21202
20865
|
const optionsCountIncreased = currentOptions.length > prevOptionsCountBeforeFetchMissingRef.current;
|
|
21203
20866
|
const optionsChanged = prevOptions !== currentOptions || optionsCountIncreased;
|
|
21204
|
-
|
|
21205
|
-
// Check if any previously missing selected values now exist in options
|
|
21206
|
-
// This handles both cases: when fetchMissingOptions was called, and when options update for any reason
|
|
21207
20867
|
const hasNewlyFetchedSelectedItems = (() => {
|
|
21208
20868
|
if (selectedValues.length === 0 || !optionsChanged) {
|
|
21209
20869
|
return false;
|
|
21210
20870
|
}
|
|
21211
|
-
|
|
21212
|
-
// Find which selected values were missing in previous options
|
|
21213
|
-
const previouslyMissingValues = selectedValues.filter(val => !findValueInOptions(prevOptions, val));
|
|
20871
|
+
const previouslyMissingValues = selectedValues.filter(val => !(0, _utils.findValueInOptions)(prevOptions, val));
|
|
21214
20872
|
if (previouslyMissingValues.length === 0) {
|
|
21215
20873
|
return false;
|
|
21216
20874
|
}
|
|
21217
|
-
|
|
21218
|
-
// Check if any of those previously missing values now exist in current options
|
|
21219
|
-
const nowPresentValues = previouslyMissingValues.filter(val => findValueInOptions(currentOptions, val));
|
|
20875
|
+
const nowPresentValues = previouslyMissingValues.filter(val => (0, _utils.findValueInOptions)(currentOptions, val));
|
|
21220
20876
|
return nowPresentValues.length > 0;
|
|
21221
20877
|
})();
|
|
21222
|
-
|
|
21223
|
-
// Update orderedOptions if:
|
|
21224
|
-
// 1. Options changed (increased or content changed) AND
|
|
21225
|
-
// 2. Previously missing selected items are now present in options
|
|
21226
|
-
// This works for both cases: when fetchMissingOptions was explicitly called, and when options update for other reasons
|
|
21227
20878
|
if (optionsChanged && hasNewlyFetchedSelectedItems) {
|
|
21228
|
-
|
|
21229
|
-
const reordered = reorderOptionsBySelection(currentOptions, selectedValues);
|
|
20879
|
+
const reordered = (0, _utils.reorderOptionsBySelection)(currentOptions, selectedValues);
|
|
21230
20880
|
setOrderedOptions(reordered);
|
|
21231
20881
|
}
|
|
21232
|
-
|
|
21233
|
-
// Always update the previous options and count for next comparison
|
|
21234
|
-
// This ensures we can detect when missing options are added in the future
|
|
21235
20882
|
prevOptionsCountBeforeFetchMissingRef.current = currentOptions.length;
|
|
21236
20883
|
prevOptionsBeforeFetchMissingRef.current = currentOptions;
|
|
21237
|
-
}, [options, value, tempValue, fetchMissingOptions,
|
|
21238
|
-
|
|
21239
|
-
// Sort selected items to top on initial load (only once)
|
|
21240
|
-
// This handles the case when user comes from another flow with pre-selected values
|
|
20884
|
+
}, [options, value, tempValue, fetchMissingOptions, staticValue]);
|
|
21241
20885
|
(0, _react.useEffect)(() => {
|
|
21242
|
-
// Only do this once, and only if we have options and selected values
|
|
21243
20886
|
if (initialSortDoneRef.current || !(options != null && options.length)) {
|
|
21244
20887
|
return;
|
|
21245
20888
|
}
|
|
21246
|
-
|
|
21247
|
-
// Check if there are selected values
|
|
21248
20889
|
const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
21249
20890
|
if (selectedValues.length === 0) {
|
|
21250
|
-
// No selected values, mark as done
|
|
21251
20891
|
initialSortDoneRef.current = true;
|
|
21252
20892
|
return;
|
|
21253
20893
|
}
|
|
21254
|
-
|
|
21255
|
-
// Check if any selected values exist in options
|
|
21256
20894
|
const checkValueExists = (opts, val) => {
|
|
21257
20895
|
for (const opt of opts) {
|
|
21258
20896
|
if (opt.value === val) return true;
|
|
@@ -21264,40 +20902,27 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21264
20902
|
};
|
|
21265
20903
|
const hasSelectedInOptions = selectedValues.some(val => checkValueExists(options, val));
|
|
21266
20904
|
if (hasSelectedInOptions) {
|
|
21267
|
-
|
|
21268
|
-
const reordered = reorderOptionsBySelection(options, selectedValues);
|
|
20905
|
+
const reordered = (0, _utils.reorderOptionsBySelection)(options, selectedValues);
|
|
21269
20906
|
setOrderedOptions(reordered);
|
|
21270
20907
|
}
|
|
21271
|
-
|
|
21272
|
-
// Mark as done - only sort once on initial load
|
|
21273
20908
|
initialSortDoneRef.current = true;
|
|
21274
|
-
}, [options, value
|
|
20909
|
+
}, [options, value]);
|
|
21275
20910
|
const dataSource = (0, _react.useMemo)(() => {
|
|
21276
|
-
// During search, use normal options (mergedOptions) to show filtered results without selected items at top
|
|
21277
|
-
// When not searching, use ordered options if available (selected items at top), otherwise use merged options
|
|
21278
20911
|
const sourceOptions = searchText.trim() ? mergedOptions : orderedOptions || mergedOptions;
|
|
21279
|
-
|
|
21280
|
-
// Get current selected values to check for missing ones
|
|
21281
|
-
// Use value prop (external state) instead of tempValue (internal state)
|
|
21282
|
-
// This ensures we only create virtual options for values that are actually selected
|
|
21283
|
-
// and not just temporarily selected during dropdown interaction
|
|
21284
20912
|
const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
21285
20913
|
const hasSearchQuery = searchText.trim().length > 0;
|
|
21286
20914
|
|
|
21287
|
-
//
|
|
21288
|
-
// Only
|
|
21289
|
-
|
|
20915
|
+
// For API-driven data, don't append virtual options during search
|
|
20916
|
+
// Only show search results when searching
|
|
20917
|
+
const shouldAppendVirtualOptions = staticValue || !hasSearchQuery;
|
|
21290
20918
|
const missingSelectedValues = [];
|
|
21291
|
-
if (selectedValues.length > 0) {
|
|
20919
|
+
if (shouldAppendVirtualOptions && selectedValues.length > 0) {
|
|
21292
20920
|
selectedValues.forEach(val => {
|
|
21293
|
-
if (!findValueInOptions(sourceOptions, val)) {
|
|
20921
|
+
if (!(0, _utils.findValueInOptions)(sourceOptions, val)) {
|
|
21294
20922
|
missingSelectedValues.push(val);
|
|
21295
20923
|
}
|
|
21296
20924
|
});
|
|
21297
20925
|
}
|
|
21298
|
-
|
|
21299
|
-
// Create virtual option nodes for missing selected values
|
|
21300
|
-
// Use cached option data if available, otherwise create a simple node with value as label
|
|
21301
20926
|
const virtualOptions = missingSelectedValues.map(val => {
|
|
21302
20927
|
const cachedOption = selectedItemsCacheRef.current.get(val);
|
|
21303
20928
|
return _extends({
|
|
@@ -21313,10 +20938,6 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21313
20938
|
children: cachedOption.children
|
|
21314
20939
|
});
|
|
21315
20940
|
});
|
|
21316
|
-
|
|
21317
|
-
// Combine source options with virtual options for missing selected values
|
|
21318
|
-
// When not searching, add virtual options at the beginning so selected items appear first
|
|
21319
|
-
// When searching, still include them if they match the search (handled by filterTreeData)
|
|
21320
20941
|
const allOptions = hasSearchQuery ? [...sourceOptions, ...virtualOptions] : [...virtualOptions, ...sourceOptions];
|
|
21321
20942
|
if (!(allOptions != null && allOptions.length)) return [];
|
|
21322
20943
|
const enhanceOptions = opts => opts.map(opt => {
|
|
@@ -21373,20 +20994,13 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21373
20994
|
}),
|
|
21374
20995
|
label: opt == null ? void 0 : opt.label
|
|
21375
20996
|
}));
|
|
21376
|
-
}, [isTree, mergedOptions, orderedOptions, searchText, value,
|
|
20997
|
+
}, [isTree, mergedOptions, orderedOptions, searchText, value, staticValue]);
|
|
21377
20998
|
const filteredTree = (0, _react.useMemo)(() => {
|
|
21378
20999
|
const selectedValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
|
|
21379
|
-
|
|
21380
|
-
// If staticValue is true, use local filtering on existing options
|
|
21381
|
-
// If staticValue is false, still use local filtering for immediate feedback,
|
|
21382
|
-
// but onSearch callback will be triggered for parent to update options
|
|
21383
|
-
// Always include selectedValues to ensure uploaded/selected items are visible
|
|
21384
|
-
// This ensures that when dev uploads values, they remain visible in the dropdown
|
|
21385
|
-
// even if they're not in the options array yet
|
|
21386
|
-
return filterTreeData(dataSource, searchText.trim(), searchBasedOn, selectedValues.length > 0 ? selectedValues : undefined);
|
|
21000
|
+
return (0, _utils.filterTreeData)(dataSource, searchText.trim(), searchBasedOn, selectedValues.length > 0 ? selectedValues : undefined);
|
|
21387
21001
|
}, [dataSource, searchText, searchBasedOn, tempValue]);
|
|
21388
|
-
const treeMaps = (0, _react.useMemo)(() => buildTreeMaps(options), [options]);
|
|
21389
|
-
const selectedLeafCount = (0, _react.useMemo)(() => countSelectedLeaves(treeMaps, Array.isArray(tempValue) ? tempValue : undefined), [treeMaps, tempValue]);
|
|
21002
|
+
const treeMaps = (0, _react.useMemo)(() => (0, _utils.buildTreeMaps)(options), [options]);
|
|
21003
|
+
const selectedLeafCount = (0, _react.useMemo)(() => (0, _utils.countSelectedLeaves)(treeMaps, Array.isArray(tempValue) ? tempValue : undefined), [treeMaps, tempValue]);
|
|
21390
21004
|
const displayValue = dropdownOpen ? tempValue : value;
|
|
21391
21005
|
const suffix = (0, _react.useMemo)(() => {
|
|
21392
21006
|
const count = Array.isArray(displayValue) ? displayValue == null ? void 0 : displayValue.length : displayValue ? 1 : 0;
|
|
@@ -21421,27 +21035,22 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21421
21035
|
if (isMulti && Array.isArray(displayValue) && (displayValue == null ? void 0 : displayValue.length) > 0) {
|
|
21422
21036
|
var _treeMaps$nodeMap;
|
|
21423
21037
|
const firstLeafValue = displayValue.find(val => {
|
|
21424
|
-
var _treeMaps$
|
|
21425
|
-
return treeMaps == null || (_treeMaps$
|
|
21038
|
+
var _treeMaps$leafValues;
|
|
21039
|
+
return treeMaps == null || (_treeMaps$leafValues = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues.includes(val);
|
|
21426
21040
|
});
|
|
21427
21041
|
return firstLeafValue ? (treeMaps == null || (_treeMaps$nodeMap = treeMaps.nodeMap) == null || (_treeMaps$nodeMap = _treeMaps$nodeMap[firstLeafValue]) == null ? void 0 : _treeMaps$nodeMap.label) || null : null;
|
|
21428
21042
|
}
|
|
21429
21043
|
return null;
|
|
21430
21044
|
}, [isMulti, displayValue, treeMaps]);
|
|
21431
21045
|
const handleConfirm = (0, _react.useCallback)(() => {
|
|
21432
|
-
// Mark as interacted since user clicked confirm (explicit action)
|
|
21433
21046
|
hasInteractedRef.current = true;
|
|
21434
|
-
|
|
21435
|
-
// Reorder options based on selection order when confirm is clicked
|
|
21436
|
-
// Use mergedOptions to include paginated options if they exist
|
|
21437
21047
|
const optionsToReorder = mergedOptions;
|
|
21438
21048
|
if (isMulti && Array.isArray(tempValue) && tempValue.length > 0) {
|
|
21439
|
-
|
|
21440
|
-
const reordered = reorderOptionsBySelection(optionsToReorder, tempValue);
|
|
21049
|
+
const reordered = (0, _utils.reorderOptionsBySelection)(optionsToReorder, tempValue);
|
|
21441
21050
|
setOrderedOptions(reordered);
|
|
21442
21051
|
} else if (!isMulti && tempValue && !Array.isArray(tempValue)) {
|
|
21443
21052
|
// For single select, move selected item to top
|
|
21444
|
-
const reordered = reorderOptionsBySelection(optionsToReorder, [tempValue]);
|
|
21053
|
+
const reordered = (0, _utils.reorderOptionsBySelection)(optionsToReorder, [tempValue]);
|
|
21445
21054
|
setOrderedOptions(reordered);
|
|
21446
21055
|
} else {
|
|
21447
21056
|
// No selection, reset to original order
|
|
@@ -21449,19 +21058,13 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21449
21058
|
}
|
|
21450
21059
|
onChange == null || onChange(tempValue);
|
|
21451
21060
|
setDropdownOpen(false);
|
|
21452
|
-
// Always clear searching state since search operation is complete
|
|
21453
21061
|
setIsSearching(false);
|
|
21454
|
-
searchClearedTimeRef.current = null;
|
|
21455
|
-
// Clear search text on confirm only if resetSearch is true
|
|
21456
|
-
// This allows users to keep their search when reopening the dropdown if desired
|
|
21062
|
+
searchClearedTimeRef.current = null;
|
|
21457
21063
|
if (resetSearch) {
|
|
21458
21064
|
setSearchText('');
|
|
21459
|
-
lastSearchQueryRef.current = '';
|
|
21065
|
+
lastSearchQueryRef.current = '';
|
|
21460
21066
|
}
|
|
21461
|
-
// Call resetData to allow developer to reload initial data
|
|
21462
|
-
// Only call if options array is not empty
|
|
21463
21067
|
if (resetData && mergedOptions.length > 0) {
|
|
21464
|
-
// Store current options before calling resetData to detect when they update
|
|
21465
21068
|
prevOptionsBeforeResetRef.current = mergedOptions;
|
|
21466
21069
|
setIsResettingData(true);
|
|
21467
21070
|
resetDataCalledRef.current = true;
|
|
@@ -21469,18 +21072,55 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21469
21072
|
resetData();
|
|
21470
21073
|
}
|
|
21471
21074
|
onConfirm == null || onConfirm(tempValue);
|
|
21472
|
-
}, [onChange, onConfirm, tempValue, resetSearch, isMulti, mergedOptions,
|
|
21075
|
+
}, [onChange, onConfirm, tempValue, resetSearch, isMulti, mergedOptions, resetData]);
|
|
21473
21076
|
const handleClearAll = (0, _react.useCallback)(() => {
|
|
21474
|
-
//
|
|
21475
|
-
hasInteractedRef.current = true;
|
|
21077
|
+
// Reset all state as if it's a fresh dropdown
|
|
21476
21078
|
const cleared = isMulti ? [] : undefined;
|
|
21079
|
+
|
|
21080
|
+
// Clear search state
|
|
21081
|
+
setSearchText('');
|
|
21082
|
+
setIsSearching(false);
|
|
21083
|
+
lastSearchQueryRef.current = '';
|
|
21084
|
+
searchClearedTimeRef.current = null;
|
|
21085
|
+
|
|
21086
|
+
// Clear timeouts
|
|
21087
|
+
if (searchTimeoutRef.current) {
|
|
21088
|
+
clearTimeout(searchTimeoutRef.current);
|
|
21089
|
+
searchTimeoutRef.current = null;
|
|
21090
|
+
}
|
|
21091
|
+
if (scrollLoadingTimeoutRef.current) {
|
|
21092
|
+
clearTimeout(scrollLoadingTimeoutRef.current);
|
|
21093
|
+
scrollLoadingTimeoutRef.current = null;
|
|
21094
|
+
}
|
|
21095
|
+
if (scrollThrottleTimeoutRef.current) {
|
|
21096
|
+
clearTimeout(scrollThrottleTimeoutRef.current);
|
|
21097
|
+
scrollThrottleTimeoutRef.current = null;
|
|
21098
|
+
}
|
|
21099
|
+
|
|
21100
|
+
// Reset scroll state
|
|
21101
|
+
setIsLoadingOnScroll(false);
|
|
21102
|
+
isScrollProcessingRef.current = false;
|
|
21103
|
+
scrollContainerRef.current = null;
|
|
21104
|
+
|
|
21105
|
+
// Reset ordered options
|
|
21106
|
+
setOrderedOptions(null);
|
|
21107
|
+
initialSortDoneRef.current = false;
|
|
21108
|
+
|
|
21109
|
+
// Reset interaction flags
|
|
21110
|
+
hasInteractedRef.current = false;
|
|
21111
|
+
resetDataCalledRef.current = false;
|
|
21112
|
+
fetchMissingOptionsCalledRef.current = false;
|
|
21113
|
+
lastMissingValuesRef.current = '';
|
|
21114
|
+
|
|
21115
|
+
// Reset temp value and call onChange (same as allowClear X button)
|
|
21477
21116
|
setTempValue(cleared);
|
|
21478
21117
|
onChange == null || onChange(cleared);
|
|
21118
|
+
|
|
21119
|
+
// Close dropdown
|
|
21479
21120
|
setDropdownOpen(false);
|
|
21480
|
-
|
|
21481
|
-
//
|
|
21121
|
+
|
|
21122
|
+
// Reset data if needed (same as allowClear X button behavior)
|
|
21482
21123
|
if (resetData && options.length > 0) {
|
|
21483
|
-
// Store current options before calling resetData to detect when they update
|
|
21484
21124
|
prevOptionsBeforeResetRef.current = options;
|
|
21485
21125
|
setIsResettingData(true);
|
|
21486
21126
|
resetDataCalledRef.current = true;
|
|
@@ -21489,25 +21129,19 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21489
21129
|
}
|
|
21490
21130
|
}, [isMulti, onChange, resetData, options]);
|
|
21491
21131
|
const handleDropdownVisibilityChange = (0, _react.useCallback)(open => {
|
|
21492
|
-
if (readOnly) {
|
|
21132
|
+
if (readOnly || disabled) {
|
|
21493
21133
|
return;
|
|
21494
21134
|
}
|
|
21495
21135
|
if (open) {
|
|
21496
|
-
// Reset interaction tracking when dropdown opens
|
|
21497
|
-
// Store initial value (not tempValue) to detect if user makes changes
|
|
21498
|
-
// This ensures we track changes from the actual selected value, not temporary state
|
|
21499
21136
|
initialTempValueRef.current = value;
|
|
21500
21137
|
hasInteractedRef.current = false;
|
|
21501
21138
|
resetDataCalledRef.current = false;
|
|
21502
|
-
// Reset fetchMissingOptions tracking to allow re-checking when dropdown opens
|
|
21503
21139
|
fetchMissingOptionsCalledRef.current = false;
|
|
21504
21140
|
lastMissingValuesRef.current = '';
|
|
21505
|
-
// Clear any pending search timeouts
|
|
21506
21141
|
if (searchTimeoutRef.current) {
|
|
21507
21142
|
clearTimeout(searchTimeoutRef.current);
|
|
21508
21143
|
searchTimeoutRef.current = null;
|
|
21509
21144
|
}
|
|
21510
|
-
// Clear any pending scroll loading timeouts
|
|
21511
21145
|
if (scrollLoadingTimeoutRef.current) {
|
|
21512
21146
|
clearTimeout(scrollLoadingTimeoutRef.current);
|
|
21513
21147
|
scrollLoadingTimeoutRef.current = null;
|
|
@@ -21516,35 +21150,27 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21516
21150
|
clearTimeout(scrollThrottleTimeoutRef.current);
|
|
21517
21151
|
scrollThrottleTimeoutRef.current = null;
|
|
21518
21152
|
}
|
|
21519
|
-
// Reset loading states
|
|
21520
21153
|
setIsSearching(false);
|
|
21521
|
-
searchClearedTimeRef.current = null;
|
|
21154
|
+
searchClearedTimeRef.current = null;
|
|
21522
21155
|
setIsLoadingOnScroll(false);
|
|
21523
21156
|
isScrollProcessingRef.current = false;
|
|
21524
|
-
// Safety check: Clear isResettingData if it's still true when opening
|
|
21525
|
-
// This handles cases where options updated while dropdown was closed
|
|
21526
21157
|
if (isResettingData) {
|
|
21527
21158
|
setIsResettingData(false);
|
|
21528
|
-
// Update ref to current options to prevent false positives
|
|
21529
21159
|
prevOptionsBeforeResetRef.current = options;
|
|
21530
|
-
// Clear timestamp
|
|
21531
21160
|
resetDataCalledTimeRef.current = null;
|
|
21532
21161
|
}
|
|
21533
21162
|
} else {
|
|
21534
|
-
// Dropdown is closing
|
|
21535
21163
|
if (!customPopupRender) {
|
|
21536
21164
|
onChange == null || onChange(tempValue);
|
|
21537
21165
|
} else {
|
|
21538
21166
|
setTempValue(value);
|
|
21539
21167
|
}
|
|
21540
|
-
// Clear search when closing (if enabled)
|
|
21541
21168
|
if (resetSearch) {
|
|
21542
21169
|
setSearchText('');
|
|
21543
21170
|
setIsSearching(false);
|
|
21544
|
-
lastSearchQueryRef.current = '';
|
|
21545
|
-
searchClearedTimeRef.current = null;
|
|
21171
|
+
lastSearchQueryRef.current = '';
|
|
21172
|
+
searchClearedTimeRef.current = null;
|
|
21546
21173
|
}
|
|
21547
|
-
// Reset scroll loading state
|
|
21548
21174
|
setIsLoadingOnScroll(false);
|
|
21549
21175
|
isScrollProcessingRef.current = false;
|
|
21550
21176
|
if (scrollLoadingTimeoutRef.current) {
|
|
@@ -21556,36 +21182,25 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21556
21182
|
scrollThrottleTimeoutRef.current = null;
|
|
21557
21183
|
}
|
|
21558
21184
|
scrollContainerRef.current = null;
|
|
21559
|
-
|
|
21560
|
-
// Only call resetData if user actually interacted (selected, searched, etc.)
|
|
21561
|
-
// and resetData hasn't been called already in this session
|
|
21562
|
-
// This prevents multiple API calls when user just opens/closes without interaction
|
|
21563
|
-
// Only call if options array is not empty
|
|
21564
21185
|
if (resetData && hasInteractedRef.current && !resetDataCalledRef.current && options.length > 0) {
|
|
21565
|
-
// Store current options before calling resetData to detect when they update
|
|
21566
21186
|
prevOptionsBeforeResetRef.current = options;
|
|
21567
21187
|
setIsResettingData(true);
|
|
21568
21188
|
resetDataCalledRef.current = true;
|
|
21569
21189
|
resetDataCalledTimeRef.current = Date.now();
|
|
21570
21190
|
resetData();
|
|
21571
21191
|
} else if (!hasInteractedRef.current) {
|
|
21572
|
-
// User did nothing - reset everything as if it's a fresh load
|
|
21573
|
-
// Clear any pending operations
|
|
21574
21192
|
if (searchTimeoutRef.current) {
|
|
21575
21193
|
clearTimeout(searchTimeoutRef.current);
|
|
21576
21194
|
searchTimeoutRef.current = null;
|
|
21577
21195
|
}
|
|
21578
21196
|
setIsSearching(false);
|
|
21579
21197
|
setIsResettingData(false);
|
|
21580
|
-
// Reset search query ref
|
|
21581
21198
|
lastSearchQueryRef.current = '';
|
|
21582
21199
|
}
|
|
21583
|
-
|
|
21584
|
-
// Reset interaction flag for next session
|
|
21585
21200
|
hasInteractedRef.current = false;
|
|
21586
21201
|
}
|
|
21587
21202
|
setDropdownOpen(open);
|
|
21588
|
-
}, [customPopupRender, value, onChange, tempValue, readOnly, resetSearch, resetData, options, isResettingData]);
|
|
21203
|
+
}, [customPopupRender, value, onChange, tempValue, readOnly, disabled, resetSearch, resetData, options, isResettingData]);
|
|
21589
21204
|
const handleFooterDownload = (0, _react.useCallback)(() => {
|
|
21590
21205
|
const currentValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
|
|
21591
21206
|
onFooterDownloadChange == null || onFooterDownloadChange(currentValues);
|
|
@@ -21597,151 +21212,80 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21597
21212
|
const handleSearchChange = (0, _react.useCallback)(e => {
|
|
21598
21213
|
const query = e.target.value;
|
|
21599
21214
|
setSearchText(query);
|
|
21600
|
-
|
|
21601
|
-
// Trigger search handler (handles debouncing and minLength check)
|
|
21602
21215
|
handleSearch(query);
|
|
21603
21216
|
}, [handleSearch]);
|
|
21604
21217
|
const handleSearchKeyDown = (0, _react.useCallback)(e => {
|
|
21605
|
-
// Stop propagation of backspace and delete keys to prevent TreeSelect from deselecting items
|
|
21606
|
-
// The input itself will handle the deletion, we just need to prevent TreeSelect from handling it
|
|
21607
21218
|
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
21608
21219
|
e.stopPropagation();
|
|
21609
21220
|
}
|
|
21610
|
-
// Also stop Escape key to prevent dropdown from closing when clearing search
|
|
21611
21221
|
if (e.key === 'Escape' && searchText.length > 0) {
|
|
21612
21222
|
e.stopPropagation();
|
|
21613
21223
|
}
|
|
21614
21224
|
}, [searchText]);
|
|
21615
|
-
|
|
21616
|
-
// Handle scroll event - automatically checks if scroll is near bottom
|
|
21617
|
-
// Developer handles hasMore and isLoading conditions in onPopupScroll callback
|
|
21618
|
-
// Using refs to avoid recreating the callback when options change
|
|
21619
21225
|
const handleScroll = (0, _react.useCallback)(event => {
|
|
21620
21226
|
if (!onPopupScroll) return;
|
|
21621
21227
|
const target = event.target;
|
|
21622
21228
|
if (!target) return;
|
|
21623
|
-
|
|
21624
|
-
// Check if scroll is near bottom
|
|
21625
21229
|
const isNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
|
|
21626
|
-
|
|
21627
|
-
// Only call onPopupScroll if scroll is near bottom
|
|
21628
|
-
// Developer will handle hasMore and isLoading checks inside the callback
|
|
21629
21230
|
if (!isNearBottom) {
|
|
21630
|
-
// Reset processing flag when not near bottom
|
|
21631
21231
|
isScrollProcessingRef.current = false;
|
|
21632
21232
|
return;
|
|
21633
21233
|
}
|
|
21634
|
-
|
|
21635
|
-
// Prevent multiple scroll triggers while already processing
|
|
21636
|
-
// This ensures we don't trigger multiple API calls simultaneously
|
|
21637
21234
|
if (isScrollProcessingRef.current) return;
|
|
21638
|
-
|
|
21639
|
-
// Prevent multiple scroll triggers while already loading
|
|
21640
|
-
// This ensures loading state is managed properly and data loading completes
|
|
21641
21235
|
if (isLoadingOnScroll) return;
|
|
21642
|
-
|
|
21643
|
-
// Don't trigger if there are no more items to load
|
|
21644
|
-
// This prevents showing loading state when all items are exhausted
|
|
21645
21236
|
if (!hasMore) {
|
|
21646
21237
|
isScrollProcessingRef.current = false;
|
|
21647
21238
|
return;
|
|
21648
21239
|
}
|
|
21649
|
-
|
|
21650
|
-
// Throttle scroll events to prevent rapid-fire API calls
|
|
21651
|
-
// Clear any existing throttle timeout
|
|
21652
21240
|
if (scrollThrottleTimeoutRef.current) {
|
|
21653
21241
|
clearTimeout(scrollThrottleTimeoutRef.current);
|
|
21654
21242
|
}
|
|
21655
|
-
|
|
21656
|
-
// Set processing flag immediately to prevent duplicate calls
|
|
21657
21243
|
isScrollProcessingRef.current = true;
|
|
21658
|
-
|
|
21659
|
-
// Throttle the actual API call to prevent multiple rapid triggers
|
|
21660
21244
|
scrollThrottleTimeoutRef.current = setTimeout(() => {
|
|
21661
|
-
// Double-check we're still near bottom and not loading
|
|
21662
21245
|
const stillNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
|
|
21663
|
-
// Also check if hasMore is still true (might have changed during throttle delay)
|
|
21664
21246
|
if (!stillNearBottom || isLoadingOnScroll || !hasMore) {
|
|
21665
21247
|
isScrollProcessingRef.current = false;
|
|
21666
21248
|
return;
|
|
21667
21249
|
}
|
|
21668
|
-
|
|
21669
|
-
// Store current options count and options reference before triggering load
|
|
21670
|
-
// This helps detect when new data arrives
|
|
21671
|
-
// Use ref to get current options without depending on options.length
|
|
21672
21250
|
const currentOptions = optionsRef.current;
|
|
21673
21251
|
prevOptionsCountRef.current = currentOptions.length;
|
|
21674
21252
|
prevOptionsRefForScroll.current = currentOptions;
|
|
21675
|
-
// Also store the count at scroll trigger time for orderedOptions update
|
|
21676
21253
|
scrollTriggerOptionsCountRef.current = currentOptions.length;
|
|
21677
|
-
|
|
21678
|
-
// Show loading indicator when scrolling near bottom
|
|
21679
|
-
// This happens before calling onPopupScroll to provide immediate feedback
|
|
21680
21254
|
setIsLoadingOnScroll(true);
|
|
21681
|
-
|
|
21682
|
-
// Clear any existing timeout
|
|
21683
21255
|
if (scrollLoadingTimeoutRef.current) {
|
|
21684
21256
|
clearTimeout(scrollLoadingTimeoutRef.current);
|
|
21685
21257
|
scrollLoadingTimeoutRef.current = null;
|
|
21686
21258
|
}
|
|
21687
|
-
|
|
21688
|
-
// Mark as interacted when user scrolls (triggers data loading)
|
|
21689
21259
|
hasInteractedRef.current = true;
|
|
21690
|
-
|
|
21691
|
-
// Call the developer's scroll handler - component already checked scroll position
|
|
21692
|
-
// Developer should check hasMore and isLoading inside the callback
|
|
21693
|
-
// This triggers the async data loading
|
|
21694
21260
|
onPopupScroll();
|
|
21695
|
-
|
|
21696
|
-
// Set a fallback timeout to clear loading if options don't change
|
|
21697
|
-
// This prevents loading from staying forever if data never arrives
|
|
21698
|
-
// Using a longer timeout (10 seconds) to give enough time for slow API calls
|
|
21699
21261
|
scrollLoadingTimeoutRef.current = setTimeout(() => {
|
|
21700
|
-
// Only clear if still loading (options change detection might have cleared it already)
|
|
21701
21262
|
setIsLoadingOnScroll(prev => {
|
|
21702
21263
|
if (prev) {
|
|
21703
|
-
// Clear the timeout reference when clearing loading state
|
|
21704
21264
|
scrollLoadingTimeoutRef.current = null;
|
|
21705
|
-
// Reset processing flag when loading times out
|
|
21706
21265
|
isScrollProcessingRef.current = false;
|
|
21707
21266
|
return false;
|
|
21708
21267
|
}
|
|
21709
21268
|
return prev;
|
|
21710
21269
|
});
|
|
21711
21270
|
}, _constants.TIMEOUTS.SCROLL_LOADING_TIMEOUT);
|
|
21712
|
-
}, 150);
|
|
21271
|
+
}, 150);
|
|
21713
21272
|
}, [onPopupScroll, isLoadingOnScroll, hasMore]);
|
|
21714
|
-
|
|
21715
|
-
// Setup scroll listener for onPopupScroll
|
|
21716
21273
|
(0, _react.useEffect)(() => {
|
|
21717
21274
|
if (!onPopupScroll || !dropdownOpen) return;
|
|
21718
|
-
|
|
21719
|
-
// Use a small delay to ensure DOM is ready
|
|
21720
21275
|
const timeoutId = setTimeout(() => {
|
|
21721
|
-
// Find the scrollable container in the dropdown
|
|
21722
21276
|
const findScrollContainer = () => {
|
|
21723
|
-
// Try to find the Ant Design dropdown scroll container
|
|
21724
|
-
// Look for dropdowns that are currently visible (not hidden)
|
|
21725
21277
|
const dropdowns = document.querySelectorAll('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
21726
21278
|
if (dropdowns.length === 0) return null;
|
|
21727
|
-
|
|
21728
|
-
// Get the last opened dropdown (most recent)
|
|
21729
21279
|
const dropdown = Array.from(dropdowns).pop();
|
|
21730
21280
|
if (!dropdown) return null;
|
|
21731
|
-
|
|
21732
|
-
// Look for the scrollable list container
|
|
21733
21281
|
const treeList = dropdown.querySelector('.ant-select-tree-list-holder');
|
|
21734
21282
|
if (treeList && treeList.scrollHeight > treeList.clientHeight) {
|
|
21735
21283
|
return treeList;
|
|
21736
21284
|
}
|
|
21737
|
-
|
|
21738
|
-
// Try alternative selectors
|
|
21739
21285
|
const virtualList = dropdown.querySelector('.rc-virtual-list-holder');
|
|
21740
21286
|
if (virtualList && virtualList.scrollHeight > virtualList.clientHeight) {
|
|
21741
21287
|
return virtualList;
|
|
21742
21288
|
}
|
|
21743
|
-
|
|
21744
|
-
// Fallback to dropdown itself if it's scrollable
|
|
21745
21289
|
if (dropdown.scrollHeight > dropdown.clientHeight) {
|
|
21746
21290
|
return dropdown;
|
|
21747
21291
|
}
|
|
@@ -21757,7 +21301,6 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21757
21301
|
}, _constants.TIMEOUTS.SCROLL_CONTAINER_DELAY);
|
|
21758
21302
|
return () => {
|
|
21759
21303
|
clearTimeout(timeoutId);
|
|
21760
|
-
// Clear throttle timeout when cleaning up
|
|
21761
21304
|
if (scrollThrottleTimeoutRef.current) {
|
|
21762
21305
|
clearTimeout(scrollThrottleTimeoutRef.current);
|
|
21763
21306
|
scrollThrottleTimeoutRef.current = null;
|
|
@@ -21766,7 +21309,6 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21766
21309
|
scrollContainerRef.current.removeEventListener('scroll', handleScroll);
|
|
21767
21310
|
scrollContainerRef.current = null;
|
|
21768
21311
|
}
|
|
21769
|
-
// Reset processing flag when listener is removed
|
|
21770
21312
|
isScrollProcessingRef.current = false;
|
|
21771
21313
|
};
|
|
21772
21314
|
}, [onPopupScroll, dropdownOpen, handleScroll]);
|
|
@@ -21814,9 +21356,10 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21814
21356
|
value: searchText,
|
|
21815
21357
|
onChange: handleSearchChange,
|
|
21816
21358
|
onKeyDown: handleSearchKeyDown,
|
|
21817
|
-
allowClear: true
|
|
21359
|
+
allowClear: true,
|
|
21360
|
+
disabled: disabled
|
|
21818
21361
|
})
|
|
21819
|
-
}), isMulti && showUpload && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
21362
|
+
}), isMulti && showUpload && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
21820
21363
|
className: _styles.default['cap-unified-select-upload-container'],
|
|
21821
21364
|
align: "middle",
|
|
21822
21365
|
onClick: handleUpload,
|
|
@@ -21829,11 +21372,12 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21829
21372
|
className: _styles.default['cap-unified-select-upload-label'],
|
|
21830
21373
|
children: uploadLabel
|
|
21831
21374
|
})]
|
|
21832
|
-
}), isMulti && staticValue && currentItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(SelectAllCheckbox, {
|
|
21375
|
+
}), isMulti && staticValue && currentItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectAllCheckbox, {
|
|
21833
21376
|
currentItems: currentItems,
|
|
21834
21377
|
tempValue: Array.isArray(tempValue) ? tempValue : undefined,
|
|
21835
21378
|
setTempValue: val => setTempValue(val),
|
|
21836
|
-
processTreeData: buildTreeMaps
|
|
21379
|
+
processTreeData: _utils.buildTreeMaps,
|
|
21380
|
+
disabled: disabled
|
|
21837
21381
|
}), currentItems.length === 0 ? isSearching || isResettingData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21838
21382
|
className: _styles.default['cap-unified-select-loading-container'],
|
|
21839
21383
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
|
|
@@ -21850,7 +21394,7 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21850
21394
|
children: "Loading..."
|
|
21851
21395
|
})
|
|
21852
21396
|
})]
|
|
21853
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoResult, {
|
|
21397
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoResult, {
|
|
21854
21398
|
noResultCustomText: noResultCustomText,
|
|
21855
21399
|
className: className,
|
|
21856
21400
|
showUpload: showUpload,
|
|
@@ -21900,15 +21444,16 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21900
21444
|
size: "small",
|
|
21901
21445
|
className: _styles.default['cap-unified-select-confirm-button'],
|
|
21902
21446
|
onClick: handleConfirm,
|
|
21903
|
-
disabled: selectedLeafCount === 0,
|
|
21447
|
+
disabled: disabled || selectedLeafCount === 0,
|
|
21904
21448
|
children: "Confirm"
|
|
21905
21449
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Button, {
|
|
21906
21450
|
type: "text",
|
|
21907
21451
|
className: _styles.default['cap-unified-select-cancel-button'],
|
|
21908
21452
|
size: "small",
|
|
21909
21453
|
onClick: handleClearAll,
|
|
21454
|
+
disabled: disabled,
|
|
21910
21455
|
children: clearText
|
|
21911
|
-
}), onFooterDownloadChange && selectedLeafCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
21456
|
+
}), onFooterDownloadChange && selectedLeafCount > 0 && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
21912
21457
|
className: _styles.default['cap-unified-select-footer-download-container'],
|
|
21913
21458
|
align: "middle",
|
|
21914
21459
|
onClick: handleFooterDownload,
|
|
@@ -21922,7 +21467,7 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21922
21467
|
})]
|
|
21923
21468
|
})]
|
|
21924
21469
|
})
|
|
21925
|
-
}), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
|
|
21470
|
+
}), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
|
|
21926
21471
|
className: _styles.default['cap-unified-select-tree-clear-container'],
|
|
21927
21472
|
onClick: handleClearAll,
|
|
21928
21473
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
@@ -21931,23 +21476,19 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21931
21476
|
})
|
|
21932
21477
|
})]
|
|
21933
21478
|
});
|
|
21934
|
-
}, [customPopupRender, filteredTree, searchText, isMulti, showUpload, uploadLabel, handleUpload, noResultCustomText, noResultCustomIcon, options, type, tempValue, handleConfirm, handleClearAll, popoverClassName, className, selectedLeafCount, clearText, allowClear, staticValue, showSearch, onFooterDownloadChange, handleFooterDownload, isSearching, handleSearchChange, handleSearchKeyDown, isLoadingOnScroll, onPopupScroll, hasMore, isResettingData]);
|
|
21479
|
+
}, [customPopupRender, filteredTree, searchText, isMulti, showUpload, uploadLabel, handleUpload, noResultCustomText, noResultCustomIcon, options, type, tempValue, handleConfirm, handleClearAll, popoverClassName, className, selectedLeafCount, clearText, allowClear, staticValue, showSearch, onFooterDownloadChange, handleFooterDownload, isSearching, handleSearchChange, handleSearchKeyDown, isLoadingOnScroll, onPopupScroll, hasMore, isResettingData, disabled]);
|
|
21935
21480
|
const combinedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(containerClassName, _styles.default['cap-unified-tree-select'], {
|
|
21936
21481
|
[_styles.default['cap-unified-tree-select-readonly']]: readOnly
|
|
21937
21482
|
}, className), [containerClassName, className, readOnly]);
|
|
21938
|
-
|
|
21939
|
-
// Handle onChange for single select - detect clear button click and call resetData
|
|
21940
21483
|
const handleSingleSelectChange = (0, _react.useCallback)(newValue => {
|
|
21941
|
-
|
|
21484
|
+
if (disabled) {
|
|
21485
|
+
return;
|
|
21486
|
+
}
|
|
21942
21487
|
if (newValue !== initialTempValueRef.current) {
|
|
21943
21488
|
hasInteractedRef.current = true;
|
|
21944
21489
|
}
|
|
21945
|
-
|
|
21946
|
-
// If value is cleared (becomes undefined), call resetData
|
|
21947
|
-
// Only call if options array is not empty
|
|
21948
21490
|
if (newValue === undefined || newValue === null) {
|
|
21949
21491
|
if (resetData && options.length > 0) {
|
|
21950
|
-
// Store current options before calling resetData to detect when they update
|
|
21951
21492
|
prevOptionsBeforeResetRef.current = options;
|
|
21952
21493
|
setIsResettingData(true);
|
|
21953
21494
|
resetDataCalledRef.current = true;
|
|
@@ -21956,21 +21497,18 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21956
21497
|
}
|
|
21957
21498
|
}
|
|
21958
21499
|
onChange == null || onChange(newValue);
|
|
21959
|
-
}, [onChange, resetData, options]);
|
|
21960
|
-
|
|
21961
|
-
// Handle onChange for multi select - detect clear and call resetData
|
|
21500
|
+
}, [onChange, resetData, options, disabled]);
|
|
21962
21501
|
const handleMultiSelectChange = (0, _react.useCallback)(newValue => {
|
|
21963
|
-
|
|
21502
|
+
if (disabled) {
|
|
21503
|
+
return;
|
|
21504
|
+
}
|
|
21964
21505
|
const initialValue = initialTempValueRef.current;
|
|
21965
21506
|
const hasChanged = Array.isArray(newValue) && Array.isArray(initialValue) ? newValue.length !== initialValue.length || !newValue.every(v => initialValue.includes(v)) || !initialValue.every(v => newValue.includes(v)) : newValue !== initialValue;
|
|
21966
21507
|
if (hasChanged) {
|
|
21967
21508
|
hasInteractedRef.current = true;
|
|
21968
21509
|
}
|
|
21969
|
-
// If value is cleared (becomes empty array or undefined), call resetData
|
|
21970
|
-
// Only call if options array is not empty
|
|
21971
21510
|
if (newValue === undefined || newValue === null || Array.isArray(newValue) && newValue.length === 0) {
|
|
21972
21511
|
if (resetData && options.length > 0) {
|
|
21973
|
-
// Store current options before calling resetData to detect when they update
|
|
21974
21512
|
prevOptionsBeforeResetRef.current = options;
|
|
21975
21513
|
setIsResettingData(true);
|
|
21976
21514
|
resetDataCalledRef.current = true;
|
|
@@ -21979,7 +21517,7 @@ const CapUnifiedSelect = _ref4 => {
|
|
|
21979
21517
|
}
|
|
21980
21518
|
}
|
|
21981
21519
|
setTempValue(newValue);
|
|
21982
|
-
}, [resetData, options]);
|
|
21520
|
+
}, [resetData, options, disabled]);
|
|
21983
21521
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
21984
21522
|
className: className,
|
|
21985
21523
|
children: [renderHeader, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.TreeSelect, _extends({
|
|
@@ -23447,6 +22985,233 @@ module.exports = domAPI;
|
|
|
23447
22985
|
|
|
23448
22986
|
/***/ }),
|
|
23449
22987
|
|
|
22988
|
+
/***/ 8052:
|
|
22989
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
22990
|
+
|
|
22991
|
+
"use strict";
|
|
22992
|
+
|
|
22993
|
+
|
|
22994
|
+
exports.__esModule = true;
|
|
22995
|
+
exports.reorderOptionsBySelection = exports.findValueInOptions = exports.findMissingValues = exports.filterTreeData = exports.countSelectedLeaves = exports.buildTreeMaps = void 0;
|
|
22996
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
22997
|
+
/**
|
|
22998
|
+
* Builds tree maps for efficient tree operations
|
|
22999
|
+
* Creates maps for leaf values, parent-child relationships, and node lookups
|
|
23000
|
+
*/
|
|
23001
|
+
const buildTreeMaps = nodes => {
|
|
23002
|
+
const result = {
|
|
23003
|
+
leafValues: [],
|
|
23004
|
+
parentChildMap: {},
|
|
23005
|
+
nodeMap: {}
|
|
23006
|
+
};
|
|
23007
|
+
if (!nodes) return result;
|
|
23008
|
+
const traverse = items => {
|
|
23009
|
+
items == null || items.forEach(item => {
|
|
23010
|
+
if (item.value !== undefined) {
|
|
23011
|
+
result.nodeMap[item.value] = item;
|
|
23012
|
+
if (item != null && item.children && item.children.length > 0) {
|
|
23013
|
+
result.parentChildMap[item.value] = item.children.map(child => child == null ? void 0 : child.value).filter(v => v !== undefined);
|
|
23014
|
+
traverse(item.children);
|
|
23015
|
+
} else {
|
|
23016
|
+
result.leafValues.push(item.value);
|
|
23017
|
+
}
|
|
23018
|
+
}
|
|
23019
|
+
});
|
|
23020
|
+
};
|
|
23021
|
+
traverse(nodes);
|
|
23022
|
+
return result;
|
|
23023
|
+
};
|
|
23024
|
+
|
|
23025
|
+
/**
|
|
23026
|
+
* Counts the number of selected leaf nodes in a tree structure
|
|
23027
|
+
* Handles parent-child relationships by expanding selected parent nodes
|
|
23028
|
+
*/
|
|
23029
|
+
exports.buildTreeMaps = buildTreeMaps;
|
|
23030
|
+
const countSelectedLeaves = (treeMaps, selectedValues) => {
|
|
23031
|
+
var _treeMaps$leafValues;
|
|
23032
|
+
if (!Array.isArray(selectedValues) || !(selectedValues != null && selectedValues.length)) return 0;
|
|
23033
|
+
const expandedSet = new Set(selectedValues);
|
|
23034
|
+
const processNode = value => {
|
|
23035
|
+
var _treeMaps$parentChild;
|
|
23036
|
+
const children = treeMaps == null || (_treeMaps$parentChild = treeMaps.parentChildMap) == null ? void 0 : _treeMaps$parentChild[value];
|
|
23037
|
+
if (!children) return;
|
|
23038
|
+
children == null || children.forEach(childValue => {
|
|
23039
|
+
expandedSet.add(childValue);
|
|
23040
|
+
processNode(childValue);
|
|
23041
|
+
});
|
|
23042
|
+
};
|
|
23043
|
+
selectedValues == null || selectedValues.forEach(processNode);
|
|
23044
|
+
return (treeMaps == null || (_treeMaps$leafValues = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues.reduce((count, leaf) => expandedSet.has(leaf) ? count + 1 : count, 0)) || 0;
|
|
23045
|
+
};
|
|
23046
|
+
|
|
23047
|
+
/**
|
|
23048
|
+
* Filters tree data based on search query
|
|
23049
|
+
* Includes nodes that match search OR are selected OR have matching children
|
|
23050
|
+
* Supports searching by label, value, or key
|
|
23051
|
+
*/
|
|
23052
|
+
exports.countSelectedLeaves = countSelectedLeaves;
|
|
23053
|
+
const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
|
|
23054
|
+
if (searchBasedOn === void 0) {
|
|
23055
|
+
searchBasedOn = 'label';
|
|
23056
|
+
}
|
|
23057
|
+
if (!(data != null && data.length) || !search) return data;
|
|
23058
|
+
const searchLower = search.toLowerCase();
|
|
23059
|
+
const selectedSet = new Set(selectedValues || []);
|
|
23060
|
+
const nodeMatchesSearch = node => {
|
|
23061
|
+
var _node$value, _node$key, _ref, _node$label;
|
|
23062
|
+
const target = searchBasedOn === 'value' ? String((_node$value = node == null ? void 0 : node.value) != null ? _node$value : '') : searchBasedOn === 'key' ? String((_node$key = node == null ? void 0 : node.key) != null ? _node$key : '') : String((_ref = (_node$label = node == null ? void 0 : node.label) != null ? _node$label : node == null ? void 0 : node.title) != null ? _ref : '');
|
|
23063
|
+
return target.toLowerCase().includes(searchLower);
|
|
23064
|
+
};
|
|
23065
|
+
const isNodeSelected = node => {
|
|
23066
|
+
return node.value !== undefined && selectedSet.has(node.value);
|
|
23067
|
+
};
|
|
23068
|
+
const loop = items => items.reduce((acc, item) => {
|
|
23069
|
+
var _item$children;
|
|
23070
|
+
if (!item) return acc;
|
|
23071
|
+
const children = item != null && (_item$children = item.children) != null && _item$children.length ? loop(item.children) : [];
|
|
23072
|
+
// Include node if: matches search OR is selected OR has matching children
|
|
23073
|
+
if (nodeMatchesSearch(item) || isNodeSelected(item) || children.length) {
|
|
23074
|
+
acc.push(_extends({}, item, {
|
|
23075
|
+
children
|
|
23076
|
+
}));
|
|
23077
|
+
}
|
|
23078
|
+
return acc;
|
|
23079
|
+
}, []);
|
|
23080
|
+
return loop(data);
|
|
23081
|
+
};
|
|
23082
|
+
|
|
23083
|
+
/**
|
|
23084
|
+
* Checks if a value exists in options (recursive for tree structures)
|
|
23085
|
+
*/
|
|
23086
|
+
exports.filterTreeData = filterTreeData;
|
|
23087
|
+
const findValueInOptions = (opts, targetValue) => {
|
|
23088
|
+
for (const opt of opts) {
|
|
23089
|
+
if (opt.value === targetValue) {
|
|
23090
|
+
return true;
|
|
23091
|
+
}
|
|
23092
|
+
if (opt.children && opt.children.length > 0) {
|
|
23093
|
+
if (findValueInOptions(opt.children, targetValue)) {
|
|
23094
|
+
return true;
|
|
23095
|
+
}
|
|
23096
|
+
}
|
|
23097
|
+
}
|
|
23098
|
+
return false;
|
|
23099
|
+
};
|
|
23100
|
+
|
|
23101
|
+
/**
|
|
23102
|
+
* Finds selected values that don't exist in the current options
|
|
23103
|
+
*/
|
|
23104
|
+
exports.findValueInOptions = findValueInOptions;
|
|
23105
|
+
const findMissingValues = (selectedValues, currentOptions) => {
|
|
23106
|
+
if (!selectedValues.length || !currentOptions.length) {
|
|
23107
|
+
return selectedValues;
|
|
23108
|
+
}
|
|
23109
|
+
return selectedValues.filter(val => !findValueInOptions(currentOptions, val));
|
|
23110
|
+
};
|
|
23111
|
+
|
|
23112
|
+
/**
|
|
23113
|
+
* Reorders options based on selection order
|
|
23114
|
+
* Selected items are moved to top in the order they were selected
|
|
23115
|
+
* For tree structures, maintains parent-child relationships
|
|
23116
|
+
* For flat lists, directly reorders items
|
|
23117
|
+
* Works for all data types: flat lists, tree structures, nested trees
|
|
23118
|
+
*/
|
|
23119
|
+
exports.findMissingValues = findMissingValues;
|
|
23120
|
+
const reorderOptionsBySelection = (opts, selectedOrder) => {
|
|
23121
|
+
if (!Array.isArray(selectedOrder) || selectedOrder.length === 0 || !(opts != null && opts.length)) {
|
|
23122
|
+
return opts;
|
|
23123
|
+
}
|
|
23124
|
+
const selectedSet = new Set(selectedOrder);
|
|
23125
|
+
const selectedItems = [];
|
|
23126
|
+
const unselectedItems = [];
|
|
23127
|
+
const processedTopLevelValues = new Set();
|
|
23128
|
+
|
|
23129
|
+
// Deep clone helper to avoid mutating original items
|
|
23130
|
+
const deepCloneItem = item => {
|
|
23131
|
+
return _extends({}, item, {
|
|
23132
|
+
children: item.children ? item.children.map(deepCloneItem) : undefined
|
|
23133
|
+
});
|
|
23134
|
+
};
|
|
23135
|
+
|
|
23136
|
+
// Find the top-level item that contains the selected value
|
|
23137
|
+
// For flat lists, returns the item itself
|
|
23138
|
+
// For tree structures, returns the top-level parent from opts
|
|
23139
|
+
const findTopLevelItem = targetValue => {
|
|
23140
|
+
// First, find which top-level item in opts contains this value
|
|
23141
|
+
for (const topLevelItem of opts) {
|
|
23142
|
+
// Check if this top-level item itself matches
|
|
23143
|
+
if (topLevelItem.value === targetValue) {
|
|
23144
|
+
return topLevelItem;
|
|
23145
|
+
}
|
|
23146
|
+
|
|
23147
|
+
// Recursively search in children
|
|
23148
|
+
const searchInChildren = items => {
|
|
23149
|
+
for (const item of items) {
|
|
23150
|
+
if (item.value === targetValue) {
|
|
23151
|
+
return true; // Found it
|
|
23152
|
+
}
|
|
23153
|
+
if (item.children && item.children.length > 0) {
|
|
23154
|
+
if (searchInChildren(item.children)) {
|
|
23155
|
+
return true;
|
|
23156
|
+
}
|
|
23157
|
+
}
|
|
23158
|
+
}
|
|
23159
|
+
return false;
|
|
23160
|
+
};
|
|
23161
|
+
|
|
23162
|
+
// If found in this top-level item's children, return the top-level item
|
|
23163
|
+
if (topLevelItem.children && topLevelItem.children.length > 0) {
|
|
23164
|
+
if (searchInChildren(topLevelItem.children)) {
|
|
23165
|
+
return topLevelItem;
|
|
23166
|
+
}
|
|
23167
|
+
}
|
|
23168
|
+
}
|
|
23169
|
+
return null;
|
|
23170
|
+
};
|
|
23171
|
+
|
|
23172
|
+
// Check if an item or any of its descendants is selected
|
|
23173
|
+
const hasSelectedDescendant = item => {
|
|
23174
|
+
if (item.value !== undefined && selectedSet.has(item.value)) {
|
|
23175
|
+
return true;
|
|
23176
|
+
}
|
|
23177
|
+
if (item.children && item.children.length > 0) {
|
|
23178
|
+
return item.children.some(child => hasSelectedDescendant(child));
|
|
23179
|
+
}
|
|
23180
|
+
return false;
|
|
23181
|
+
};
|
|
23182
|
+
|
|
23183
|
+
// Collect selected items in selection order
|
|
23184
|
+
selectedOrder.forEach(selectedVal => {
|
|
23185
|
+
const topLevelItem = findTopLevelItem(selectedVal);
|
|
23186
|
+
if (topLevelItem && topLevelItem.value !== undefined && !processedTopLevelValues.has(topLevelItem.value)) {
|
|
23187
|
+
// Clone the item to avoid mutating the original
|
|
23188
|
+
const clonedItem = deepCloneItem(topLevelItem);
|
|
23189
|
+
selectedItems.push(clonedItem);
|
|
23190
|
+
processedTopLevelValues.add(topLevelItem.value);
|
|
23191
|
+
}
|
|
23192
|
+
});
|
|
23193
|
+
|
|
23194
|
+
// Collect unselected items maintaining original order
|
|
23195
|
+
// For tree structures, only include top-level items that don't have any selected descendants
|
|
23196
|
+
opts.forEach(item => {
|
|
23197
|
+
if (item.value === undefined) {
|
|
23198
|
+
// Item without value, include as-is
|
|
23199
|
+
unselectedItems.push(deepCloneItem(item));
|
|
23200
|
+
} else if (!processedTopLevelValues.has(item.value)) {
|
|
23201
|
+
// Check if this item or any of its descendants is selected
|
|
23202
|
+
if (!hasSelectedDescendant(item)) {
|
|
23203
|
+
unselectedItems.push(deepCloneItem(item));
|
|
23204
|
+
}
|
|
23205
|
+
}
|
|
23206
|
+
});
|
|
23207
|
+
|
|
23208
|
+
// Return selected items first (in selection order), then unselected items
|
|
23209
|
+
return [...selectedItems, ...unselectedItems];
|
|
23210
|
+
};
|
|
23211
|
+
exports.reorderOptionsBySelection = reorderOptionsBySelection;
|
|
23212
|
+
|
|
23213
|
+
/***/ }),
|
|
23214
|
+
|
|
23450
23215
|
/***/ 8244:
|
|
23451
23216
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
23452
23217
|
|
|
@@ -23743,7 +23508,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(1601);
|
|
|
23743
23508
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
|
|
23744
23509
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
23745
23510
|
// Module
|
|
23746
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.blaze-ui-cap-unified-select-header-wrapper{display:flex;align-items:center}.blaze-ui-cap-unified-select-header-wrapper.blaze-ui-disabled{opacity:.5;cursor:not-allowed}.blaze-ui-cap-unified-select-header-wrapper .blaze-ui-cap-unified-select-header-label{font-family:"Roboto",sans-serif;font-weight:500;font-size:1rem;line-height:1.429rem;letter-spacing:0}.blaze-ui-cap-unified-select-header-byline-text{font-family:"Roboto",sans-serif;font-weight:400;font-size:.857rem;letter-spacing:0;color:#97a0af}.blaze-ui-cap-unified-select-container{text-align:justify;min-width:13.786rem}.blaze-ui-cap-unified-select-container.blaze-ui-disabled{cursor:not-allowed}.blaze-ui-cap-unified-select-container.ant-select-focused .ant-select-selector{border:.071rem solid #091e42 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-more-text{cursor:pointer;color:#091e42;margin-right:.286rem;position:relative}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-suffix-icon{color:#7a869a}.blaze-ui-cap-unified-select-container .blaze-ui-cap-tooltip-with-info-icon{margin-top:.143rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly{pointer-events:none}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly .blaze-ui-cap-unified-select-more-text{pointer-events:auto}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select .ant-select-tree-treenode{padding-left:.286rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-selector{background-color:#fff;border-color:#ebecf0 !important;cursor:default}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-arrow{pointer-events:auto;color:#b3bac5}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:hover .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:active .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:focus .ant-select-selector{border-color:#ebecf0 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-status{color:#ea213a}.blaze-ui-cap-unified-select-container .ant-select-outlined:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-pagination-size-changer):hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-container .ant-select-selector{background-color:#fff !important;border:.071rem solid #7a869a !important;border-radius:.286rem !important}.blaze-ui-cap-unified-select-container .ant-select-selector .ant-select-selection-placeholder{pointer-events:unset;color:#97a0af;display:flex;align-items:center}.blaze-ui-cap-unified-select-container .ant-select-prefix{font-size:1rem;font-weight:400;color:#091e42;line-height:1.429rem}.blaze-ui-cap-unified-select-container .ant-input-affix-wrapper .ant-input-prefix{left:.857rem}.blaze-ui-cap-unified-select-container .ant-select-selector{border-color:#7a869a !important;box-shadow:none !important;outline:0}.blaze-ui-cap-unified-select-container .ant-btn-variant-solid:not(:disabled):not(.ant-btn-disabled):hover{background-color:#47af46}.blaze-ui-cap-unified-select-container .ant-select-dropdown{margin-top:-0.571rem !important;border-radius:.286rem;background-color:#fff;box-shadow:0 .286rem .571rem -0.143rem rgba(9,30,66,.15),0 0 .071rem 0 rgba(9,30,66,.1);max-height:25.714rem;overflow:visible}.blaze-ui-cap-unified-select-container .ant-select-outlined.ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item,.blaze-ui-cap-unified-select-container .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap{align-self:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container{border-bottom:.071rem solid #ebecf0 !important;line-height:2.857rem !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container .blaze-ui-cap-unified-select-search-icon{color:#b3bac5}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container{padding:.643rem 1.071rem;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container .blaze-ui-cap-unified-select-select-all-checkbox{display:contents !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container{cursor:pointer;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem;padding-left:1.143rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-icon{color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-label{margin-left:.857rem;color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container{display:flex;align-items:center;height:3.429rem;padding:.5rem;border-top:.071rem solid #ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group{display:flex;padding-left:.571rem;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button{background-color:#47af46;height:2.286rem;width:6.714rem;color:#fff}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:hover{background-color:#1f9a1d}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:disabled{background-color:#a1d8a0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-cancel-button{border:rgba(0,0,0,0);box-shadow:none;width:5.714rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-selected-count{display:flex;margin-left:auto;font-size:.857rem;font-weight:400;line-height:1.143rem;color:#5e6c84}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container{display:flex;justify-content:center;align-items:center;height:2.857rem;border-top:.071rem solid #ebecf0;cursor:pointer;color:#091e42}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container:hover{background-color:#ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container .blaze-ui-cap-unified-select-tree-clear-label{font-size:1rem;font-weight:400}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container{cursor:pointer;display:flex;align-items:center;margin-left:auto;padding-right:1.143rem;gap:.857rem;flex-wrap:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container:hover{opacity:.8}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-icon{color:#2466ea;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;line-height:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-label{color:#2466ea;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:.857rem;line-height:1.143rem;letter-spacing:0;white-space:nowrap;display:inline-flex;align-items:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;color:#97a0af;font-size:1rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result .blaze-ui-cap-unified-select-no-result-text{font-weight:500}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;width:100%;gap:.571rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-more{display:flex;align-items:center;justify-content:center;padding:.857rem;border-top:.071rem solid #ebecf0;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-menu-wrapper{position:relative;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.8);z-index:10;gap:.571rem;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix{display:flex;justify-content:start;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle;flex:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{display:flex;align-items:center;flex-shrink:1;min-width:0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-end{display:flex;align-items:center;gap:.571rem;flex-shrink:0;margin-left:auto}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-suffix{display:flex;align-items:center;padding:0 .571rem;max-height:1.429rem;white-space:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon{margin-top:.357rem;color:#42526e}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon .blaze-ui-cap-icon{color:#42526e}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu{margin-top:0 !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu .ant-select-dropdown-menu-item{padding:.571rem 1.714rem !important;height:unset !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu-item-disabled{color:rgba(0,0,0,.25) !important;cursor:not-allowed !important;line-height:1.428rem !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0);height:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper:hover{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode{height:2.857rem;margin-bottom:0;display:flex;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode:hover{background-color:#fffbe6}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-selected{background-color:#f4f5f7 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled{cursor:not-allowed !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-unified-select-option-label{color:#b3bac5}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-icon{color:#b3bac5 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected{background-color:#f4f5f7}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-leaf .ant-select-tree-switcher-noop{display:none}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox{display:flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox .ant-select-tree-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem;display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner:hover{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{border-radius:0;padding-left:.214rem;width:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-title{width:100%;display:flex}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-indent{margin-left:.857rem;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher{display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher:not(.ant-select-tree-switcher-noop):hover:before{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher .ant-select-tree-switcher-icon{font-size:.857rem;margin-top:1.286rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-list-holder-inner{width:fit-content !important;min-width:100%}.blaze-ui-cap-unified-select-popup .ant-tree-select:hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-popup .ant-tree-select-focused .ant-select-selector,.blaze-ui-cap-unified-select-popup .ant-tree-select-open .ant-select-selector{border-color:#7a869a;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem}.blaze-ui-cap-unified-select-popup .ant-checkbox-wrapper:not(.ant-checkbox-wrapper-disabled):hover .ant-checkbox-checked:not(.ant-checkbox-disabled) .ant-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper{padding-left:.571rem;border:none;box-shadow:none;border-radius:0;border-bottom:.071rem solid rgba(0,0,0,0);transition:border-color .2s ease}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:hover{border-bottom:.071rem solid #7a869a !important;box-shadow:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:focus-within{border-bottom:.071rem solid #091e42 !important;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper .ant-input{border:none !important;box-shadow:none !important}`, ""]);
|
|
23511
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.blaze-ui-cap-unified-select-header-wrapper{display:flex;align-items:center}.blaze-ui-cap-unified-select-header-wrapper.blaze-ui-disabled{opacity:.5;cursor:not-allowed}.blaze-ui-cap-unified-select-header-wrapper .blaze-ui-cap-unified-select-header-label{font-family:"Roboto",sans-serif;font-weight:500;font-size:1rem;line-height:1.429rem;letter-spacing:0}.blaze-ui-cap-unified-select-header-byline-text{font-family:"Roboto",sans-serif;font-weight:400;font-size:.857rem;letter-spacing:0;color:#97a0af}.blaze-ui-cap-unified-select-container{text-align:justify;min-width:13.786rem}.blaze-ui-cap-unified-select-container.blaze-ui-disabled{cursor:not-allowed}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-more-text{cursor:pointer;color:#091e42;margin-right:.286rem;position:relative}.blaze-ui-cap-unified-select-container.ant-select-disabled .blaze-ui-cap-unified-select-more-text{color:unset !important;cursor:not-allowed}.blaze-ui-cap-unified-select-container.ant-select-focused .ant-select-selector{border:.071rem solid #091e42 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-suffix-icon{color:#7a869a}.blaze-ui-cap-unified-select-container .blaze-ui-cap-tooltip-with-info-icon{margin-top:.143rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly{pointer-events:none}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly .blaze-ui-cap-unified-select-more-text{pointer-events:auto;color:unset !important}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select .ant-select-tree-treenode{padding-left:.286rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-selector{background-color:#fff;border-color:#ebecf0 !important;cursor:default}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-arrow{pointer-events:auto;color:#b3bac5}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:hover .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:active .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:focus .ant-select-selector{border-color:#ebecf0 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-status{color:#ea213a}.blaze-ui-cap-unified-select-container .ant-select-outlined:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-pagination-size-changer):hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-container .ant-select-selector{background-color:#fff !important;border:.071rem solid #7a869a !important;border-radius:.286rem !important}.blaze-ui-cap-unified-select-container .ant-select-selector .ant-select-selection-placeholder{pointer-events:unset;color:#97a0af;display:flex;align-items:center}.blaze-ui-cap-unified-select-container .ant-select-prefix{font-size:1rem;font-weight:400;color:unset !important;line-height:1.429rem}.blaze-ui-cap-unified-select-container .ant-select-disabled .ant-select-prefix{color:unset !important}.blaze-ui-cap-unified-select-container .ant-input-affix-wrapper .ant-input-prefix{left:.857rem}.blaze-ui-cap-unified-select-container .ant-select-selector{border-color:#7a869a !important;box-shadow:none !important;outline:0}.blaze-ui-cap-unified-select-container .ant-btn-variant-solid:not(:disabled):not(.ant-btn-disabled):hover{background-color:#47af46}.blaze-ui-cap-unified-select-container .ant-select-dropdown{margin-top:-0.571rem !important;border-radius:.286rem;background-color:#fff;box-shadow:0 .286rem .571rem -0.143rem rgba(9,30,66,.15),0 0 .071rem 0 rgba(9,30,66,.1);max-height:25.714rem;overflow:visible}.blaze-ui-cap-unified-select-container .ant-select-outlined.ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item,.blaze-ui-cap-unified-select-container .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap{align-self:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container{border-bottom:.071rem solid #ebecf0 !important;line-height:2.857rem !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container .blaze-ui-cap-unified-select-search-icon{color:#b3bac5}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container{padding:.643rem 1.071rem;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container .blaze-ui-cap-unified-select-select-all-checkbox{display:contents !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container{cursor:pointer;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem;padding-left:1.143rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-icon{color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-label{margin-left:.857rem;color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container{display:flex;align-items:center;height:3.429rem;padding:.5rem;border-top:.071rem solid #ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group{display:flex;padding-left:.571rem;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button{background-color:#47af46;height:2.286rem;width:6.714rem;color:#fff}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:hover{background-color:#1f9a1d}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:disabled{background-color:#a1d8a0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-cancel-button{border:rgba(0,0,0,0);box-shadow:none;width:5.714rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-selected-count{display:flex;margin-left:auto;font-size:.857rem;font-weight:400;line-height:1.143rem;color:#5e6c84}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container{display:flex;justify-content:center;align-items:center;height:2.857rem;border-top:.071rem solid #ebecf0;cursor:pointer;color:#091e42}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container:hover{background-color:#ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container .blaze-ui-cap-unified-select-tree-clear-label{font-size:1rem;font-weight:400}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container{cursor:pointer;display:flex;align-items:center;margin-left:auto;padding-right:1.143rem;gap:.857rem;flex-wrap:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container:hover{opacity:.8}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-icon{color:#2466ea;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;line-height:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-label{color:#2466ea;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:.857rem;line-height:1.143rem;letter-spacing:0;white-space:nowrap;display:inline-flex;align-items:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;color:#97a0af;font-size:1rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result .blaze-ui-cap-unified-select-no-result-text{font-weight:500}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;width:100%;gap:.571rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-more{display:flex;align-items:center;justify-content:center;padding:.857rem;border-top:.071rem solid #ebecf0;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-menu-wrapper{position:relative;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.8);z-index:10;gap:.571rem;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix{display:flex;justify-content:start;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle;flex:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{display:flex;align-items:center;flex-shrink:1;min-width:0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-end{display:flex;align-items:center;gap:.571rem;flex-shrink:0;margin-left:auto}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-suffix{display:flex;align-items:center;padding:0 .571rem;max-height:1.429rem;white-space:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon{margin-top:.357rem;color:#42526e}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon .blaze-ui-cap-icon{color:#42526e}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu{margin-top:0 !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu .ant-select-dropdown-menu-item{padding:.571rem 1.714rem !important;height:unset !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu-item-disabled{color:rgba(0,0,0,.25) !important;cursor:not-allowed !important;line-height:1.428rem !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0);height:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper:hover{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-active .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0) !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode{height:2.857rem;margin-bottom:0;display:flex;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode:hover{background-color:#fffbe6}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-selected{background-color:#f4f5f7 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled{cursor:not-allowed !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-unified-select-option-label{color:#b3bac5}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-icon{color:#b3bac5 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected{background-color:#f4f5f7}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-leaf .ant-select-tree-switcher-noop{display:none}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox{display:flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox .ant-select-tree-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem;display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner:hover{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{border-radius:0;padding-left:.214rem;width:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-title{width:100%;display:flex}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-indent{margin-left:.857rem;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher{display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher:not(.ant-select-tree-switcher-noop):hover:before{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher .ant-select-tree-switcher-icon{font-size:.857rem;margin-top:1.286rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-list-holder-inner{width:fit-content !important;min-width:100%}.blaze-ui-cap-unified-select-popup .ant-tree-select:hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-popup .ant-tree-select-focused .ant-select-selector,.blaze-ui-cap-unified-select-popup .ant-tree-select-open .ant-select-selector{border-color:#7a869a;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem}.blaze-ui-cap-unified-select-popup .ant-checkbox-wrapper:not(.ant-checkbox-wrapper-disabled):hover .ant-checkbox-checked:not(.ant-checkbox-disabled) .ant-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper{padding-left:.571rem;border:none;box-shadow:none;border-radius:0;border-bottom:.071rem solid rgba(0,0,0,0);transition:border-color .2s ease}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:hover{border-bottom:.071rem solid #7a869a !important;box-shadow:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:focus-within{border-bottom:.071rem solid #091e42 !important;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper .ant-input{border:none !important;box-shadow:none !important}`, ""]);
|
|
23747
23512
|
// Exports
|
|
23748
23513
|
___CSS_LOADER_EXPORT___.locals = {
|
|
23749
23514
|
"cap-unified-select-header-wrapper": `blaze-ui-cap-unified-select-header-wrapper`,
|
|
@@ -23801,62 +23566,33 @@ module.exports = ___CSS_LOADER_EXPORT___;
|
|
|
23801
23566
|
|
|
23802
23567
|
exports.__esModule = true;
|
|
23803
23568
|
exports.TIMEOUTS = exports.SELECT_TYPES = exports.DEFAULTS = void 0;
|
|
23804
|
-
/**
|
|
23805
|
-
* Select type constants for CapUnifiedSelect component
|
|
23806
|
-
*/
|
|
23807
23569
|
const SELECT_TYPES = exports.SELECT_TYPES = {
|
|
23808
23570
|
SELECT: 'select',
|
|
23809
23571
|
MULTI_SELECT: 'multiSelect',
|
|
23810
23572
|
TREE_SELECT: 'treeSelect',
|
|
23811
23573
|
MULTI_TREE_SELECT: 'multiTreeSelect'
|
|
23812
23574
|
};
|
|
23813
|
-
/**
|
|
23814
|
-
* Timeout constants (in milliseconds)
|
|
23815
|
-
*/
|
|
23816
23575
|
const TIMEOUTS = exports.TIMEOUTS = {
|
|
23817
|
-
/** Default search debounce timeout */
|
|
23818
23576
|
DEFAULT_SEARCH_DEBOUNCE: 300,
|
|
23819
|
-
/** Delay for state updates after search */
|
|
23820
23577
|
SEARCH_STATE_UPDATE_DELAY: 100,
|
|
23821
|
-
/** Minimum time since search was cleared to consider data ready */
|
|
23822
23578
|
SEARCH_CLEARED_TIMEOUT: 200,
|
|
23823
|
-
/** Buffer time added to debounce for cleared search */
|
|
23824
23579
|
SEARCH_CLEARED_BUFFER: 300,
|
|
23825
|
-
/** Buffer time added to debounce for regular search */
|
|
23826
23580
|
SEARCH_REGULAR_BUFFER: 500,
|
|
23827
|
-
/** Brief delay to show loading indicator for static search */
|
|
23828
23581
|
STATIC_SEARCH_DELAY: 150,
|
|
23829
|
-
/** Timeout for resetData fallback (1 second) */
|
|
23830
23582
|
RESET_DATA_TIMEOUT: 1000,
|
|
23831
|
-
/** Minimum time since resetData was called to consider data ready */
|
|
23832
23583
|
RESET_DATA_MIN_TIME: 300,
|
|
23833
|
-
/** Maximum time since resetData was called to consider data ready */
|
|
23834
23584
|
RESET_DATA_MAX_TIME: 2000,
|
|
23835
|
-
/** Fallback timeout for scroll loading (10 seconds) */
|
|
23836
23585
|
SCROLL_LOADING_TIMEOUT: 10000,
|
|
23837
|
-
/** Delay before setting up scroll container listener */
|
|
23838
23586
|
SCROLL_CONTAINER_DELAY: 100
|
|
23839
23587
|
};
|
|
23840
|
-
|
|
23841
|
-
/**
|
|
23842
|
-
* Default values for component props
|
|
23843
|
-
*/
|
|
23844
23588
|
const DEFAULTS = exports.DEFAULTS = {
|
|
23845
|
-
/** Default placeholder text */
|
|
23846
23589
|
PLACEHOLDER: 'Select an option',
|
|
23847
|
-
/** Default upload button label */
|
|
23848
23590
|
UPLOAD_LABEL: 'Upload',
|
|
23849
|
-
/** Default clear button text */
|
|
23850
23591
|
CLEAR_TEXT: 'Clear',
|
|
23851
|
-
/** Default no results message */
|
|
23852
23592
|
NO_RESULT_TEXT: 'No results found',
|
|
23853
|
-
/** Default no results icon */
|
|
23854
23593
|
NO_RESULT_ICON: 'warning',
|
|
23855
|
-
/** Default virtual row height in pixels */
|
|
23856
23594
|
VIRTUAL_ROW_HEIGHT: 32,
|
|
23857
|
-
/** Default list height in pixels */
|
|
23858
23595
|
LIST_HEIGHT: 256,
|
|
23859
|
-
/** Default search input placeholder */
|
|
23860
23596
|
SEARCH_PLACEHOLDER: 'Search'
|
|
23861
23597
|
};
|
|
23862
23598
|
|