funda-ui 1.0.512 → 1.0.516
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/CascadingSelectE2E/index.js +0 -11
- package/DropdownMenu/index.d.ts +2 -2
- package/DropdownMenu/index.js +13 -5
- package/LiveSearch/index.js +87 -43
- package/MultiFuncSelect/index.js +69 -54
- package/lib/cjs/CascadingSelectE2E/index.js +0 -11
- package/lib/cjs/DropdownMenu/index.d.ts +2 -2
- package/lib/cjs/DropdownMenu/index.js +13 -5
- package/lib/cjs/LiveSearch/index.js +87 -43
- package/lib/cjs/MultiFuncSelect/index.js +69 -54
- package/lib/esm/CascadingSelectE2E/index.tsx +0 -6
- package/lib/esm/DropdownMenu/Option.tsx +18 -4
- package/lib/esm/DropdownMenu/index.tsx +6 -6
- package/lib/esm/LiveSearch/index.tsx +51 -12
- package/lib/esm/LiveSearch/utils/useDebounce.js +42 -0
- package/lib/esm/MultiFuncSelect/index.tsx +28 -24
- package/lib/esm/MultiFuncSelect/utils/useDebounce.js +42 -0
- package/package.json +1 -1
|
@@ -743,17 +743,6 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
743
743
|
_valueData.splice(level, 1, resValue.id);
|
|
744
744
|
_labelData.splice(level, 1, resValue.name);
|
|
745
745
|
_queryIdsData.splice(level, 1, resValue.queryId);
|
|
746
|
-
console.log('****', {
|
|
747
|
-
labels: _labelData.filter(function (v) {
|
|
748
|
-
return v != '';
|
|
749
|
-
}),
|
|
750
|
-
values: _valueData.filter(function (v) {
|
|
751
|
-
return v.toString().indexOf('$EMPTY_ID_') < 0;
|
|
752
|
-
}),
|
|
753
|
-
queryIds: _queryIdsData.filter(function (v) {
|
|
754
|
-
return v != undefined;
|
|
755
|
-
})
|
|
756
|
-
});
|
|
757
746
|
return {
|
|
758
747
|
labels: _labelData.filter(function (v) {
|
|
759
748
|
return v != '';
|
package/DropdownMenu/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare type OptionChangeFnType = (arg1: any) => void;
|
|
3
3
|
interface OptionConfig {
|
|
4
4
|
value?: string | undefined;
|
|
5
|
-
label?: string | undefined;
|
|
5
|
+
label?: string | React.ReactNode | undefined;
|
|
6
6
|
}
|
|
7
7
|
declare type DropdownMenuProps = {
|
|
8
8
|
wrapperClassName?: string;
|
package/DropdownMenu/index.js
CHANGED
|
@@ -104,22 +104,30 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__
|
|
|
104
104
|
;// CONCATENATED MODULE: ./src/Option.tsx
|
|
105
105
|
|
|
106
106
|
function Option(props) {
|
|
107
|
-
var
|
|
107
|
+
var option = props.option;
|
|
108
|
+
var _label = option ? option.label : '';
|
|
109
|
+
var _value = option ? option.value : '';
|
|
108
110
|
function handleSelect(e) {
|
|
109
111
|
e.preventDefault();
|
|
110
112
|
var fn = props.onSelect;
|
|
111
113
|
fn(props.option);
|
|
112
114
|
}
|
|
113
|
-
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
115
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof _label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
114
116
|
className: props.hyperlinkClassName,
|
|
115
|
-
"data-value":
|
|
117
|
+
"data-value": _value,
|
|
116
118
|
href: "#",
|
|
117
119
|
tabIndex: -1,
|
|
118
120
|
onClick: handleSelect,
|
|
119
121
|
dangerouslySetInnerHTML: {
|
|
120
|
-
__html: "".concat(
|
|
122
|
+
__html: "".concat(_label)
|
|
121
123
|
}
|
|
122
|
-
}))
|
|
124
|
+
}))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
125
|
+
className: props.hyperlinkClassName,
|
|
126
|
+
"data-value": _value,
|
|
127
|
+
href: "#",
|
|
128
|
+
tabIndex: -1,
|
|
129
|
+
onClick: handleSelect
|
|
130
|
+
}, _label))));
|
|
123
131
|
}
|
|
124
132
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
125
133
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
package/LiveSearch/index.js
CHANGED
|
@@ -552,15 +552,15 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_re
|
|
|
552
552
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
553
553
|
// EXTERNAL MODULE: ./src/utils/performance.js
|
|
554
554
|
var performance = __webpack_require__(342);
|
|
555
|
-
;// CONCATENATED MODULE: ./src/utils/
|
|
555
|
+
;// CONCATENATED MODULE: ./src/utils/useDebounce.js
|
|
556
556
|
/**
|
|
557
|
-
*
|
|
557
|
+
* Delay the execution of function or state update
|
|
558
558
|
*
|
|
559
559
|
* @usage:
|
|
560
560
|
|
|
561
561
|
const App = () => {
|
|
562
562
|
const [count, setCount] = useState(0);
|
|
563
|
-
const handleClick =
|
|
563
|
+
const handleClick = useDebounce(() => setCount(count + 1), 500, [count]);
|
|
564
564
|
|
|
565
565
|
return (
|
|
566
566
|
<div className="app">
|
|
@@ -572,19 +572,25 @@ const App = () => {
|
|
|
572
572
|
|
|
573
573
|
*/
|
|
574
574
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
});
|
|
575
|
+
|
|
576
|
+
var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
577
|
+
var ref = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
579
578
|
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
580
|
-
var
|
|
581
|
-
|
|
582
|
-
fn.apply(void 0, arguments);
|
|
583
|
-
ref.current.lastTime = now;
|
|
579
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
580
|
+
args[_key] = arguments[_key];
|
|
584
581
|
}
|
|
582
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
583
|
+
clearTimeout(ref.current);
|
|
584
|
+
ref.current = null;
|
|
585
|
+
|
|
586
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
587
|
+
// Execute fn after another delay milliseconds
|
|
588
|
+
ref.current = setTimeout(function () {
|
|
589
|
+
fn.apply(void 0, args);
|
|
590
|
+
}, delay);
|
|
585
591
|
}, dependence);
|
|
586
592
|
};
|
|
587
|
-
/* harmony default export */ const
|
|
593
|
+
/* harmony default export */ const utils_useDebounce = (useDebounce);
|
|
588
594
|
// EXTERNAL MODULE: ../SearchBar/dist/cjs/index.js
|
|
589
595
|
var cjs = __webpack_require__(962);
|
|
590
596
|
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
@@ -672,9 +678,9 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
672
678
|
setHasErr = _useState12[1];
|
|
673
679
|
|
|
674
680
|
//performance
|
|
675
|
-
var handleChangeFetchSafe =
|
|
681
|
+
var handleChangeFetchSafe = utils_useDebounce(function (e) {
|
|
676
682
|
handleChange(e);
|
|
677
|
-
},
|
|
683
|
+
}, 350, [dataInit]);
|
|
678
684
|
|
|
679
685
|
/**
|
|
680
686
|
* Check if an element is in the viewport
|
|
@@ -827,6 +833,9 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
827
833
|
//
|
|
828
834
|
setIsOpen(true);
|
|
829
835
|
});
|
|
836
|
+
} else {
|
|
837
|
+
//
|
|
838
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, data);
|
|
830
839
|
}
|
|
831
840
|
|
|
832
841
|
// window position
|
|
@@ -976,6 +985,13 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
976
985
|
function handleMouseLeaveTrigger() {
|
|
977
986
|
setIsOpen(false);
|
|
978
987
|
}
|
|
988
|
+
function handleClose(event) {
|
|
989
|
+
if (event.target.closest(".".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'livesearch__wrapper')) === null) {
|
|
990
|
+
// cancel
|
|
991
|
+
setIsOpen(false);
|
|
992
|
+
setData([]);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
979
995
|
function optionFocus(type) {
|
|
980
996
|
return new Promise(function (resolve) {
|
|
981
997
|
// Determine the "active" class name to avoid listening to other unused components of the same type
|
|
@@ -1016,7 +1032,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1016
1032
|
//--------------
|
|
1017
1033
|
var _oparams = fetchFuncMethodParams || [];
|
|
1018
1034
|
var _params = _oparams.map(function (item) {
|
|
1019
|
-
return item !== '$QUERY_STRING' ? item : fetchTrigger ? '
|
|
1035
|
+
return item !== '$QUERY_STRING' ? item : fetchTrigger && !fetchUpdate ? '' : fetchUpdate ? '------' : fetchTrigger ? '------' : '';
|
|
1020
1036
|
});
|
|
1021
1037
|
if (!firstFetch) {
|
|
1022
1038
|
fetchData(_params.join(','));
|
|
@@ -1033,7 +1049,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1033
1049
|
case 0:
|
|
1034
1050
|
res = null;
|
|
1035
1051
|
if (!(event.code === "Enter" || event.code === "NumpadEnter")) {
|
|
1036
|
-
_context.next =
|
|
1052
|
+
_context.next = 6;
|
|
1037
1053
|
break;
|
|
1038
1054
|
}
|
|
1039
1055
|
if (!(listRef.current === null || !rootRef.current.classList.contains('active'))) {
|
|
@@ -1042,17 +1058,15 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1042
1058
|
}
|
|
1043
1059
|
return _context.abrupt("return");
|
|
1044
1060
|
case 4:
|
|
1045
|
-
if (!fetchTrigger) {
|
|
1046
|
-
_context.next = 7;
|
|
1047
|
-
break;
|
|
1048
|
-
}
|
|
1049
|
-
handleFetch();
|
|
1050
|
-
return _context.abrupt("return");
|
|
1051
|
-
case 7:
|
|
1052
1061
|
if (listRef.current !== null) {
|
|
1053
1062
|
currentData = listRef.current.dataset.data;
|
|
1054
1063
|
if (typeof currentData !== 'undefined') {
|
|
1055
1064
|
handleSelect(null, currentData);
|
|
1065
|
+
|
|
1066
|
+
//
|
|
1067
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, JSON.parse(currentData));
|
|
1068
|
+
|
|
1069
|
+
//
|
|
1056
1070
|
options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.no-match)'));
|
|
1057
1071
|
options.forEach(function (node) {
|
|
1058
1072
|
node.classList.remove('active');
|
|
@@ -1060,34 +1074,34 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1060
1074
|
}
|
|
1061
1075
|
}
|
|
1062
1076
|
return _context.abrupt("return");
|
|
1063
|
-
case
|
|
1077
|
+
case 6:
|
|
1064
1078
|
_context.t0 = event.code;
|
|
1065
|
-
_context.next = _context.t0 === "ArrowLeft" ?
|
|
1079
|
+
_context.next = _context.t0 === "ArrowLeft" ? 9 : _context.t0 === "ArrowRight" ? 10 : _context.t0 === "ArrowUp" ? 11 : _context.t0 === "ArrowDown" ? 15 : 19;
|
|
1066
1080
|
break;
|
|
1067
|
-
case
|
|
1068
|
-
return _context.abrupt("break",
|
|
1069
|
-
case
|
|
1070
|
-
return _context.abrupt("break",
|
|
1071
|
-
case
|
|
1072
|
-
_context.next =
|
|
1081
|
+
case 9:
|
|
1082
|
+
return _context.abrupt("break", 19);
|
|
1083
|
+
case 10:
|
|
1084
|
+
return _context.abrupt("break", 19);
|
|
1085
|
+
case 11:
|
|
1086
|
+
_context.next = 13;
|
|
1073
1087
|
return optionFocus('decrease');
|
|
1074
|
-
case
|
|
1088
|
+
case 13:
|
|
1075
1089
|
res = _context.sent;
|
|
1076
|
-
return _context.abrupt("break",
|
|
1077
|
-
case
|
|
1078
|
-
_context.next =
|
|
1090
|
+
return _context.abrupt("break", 19);
|
|
1091
|
+
case 15:
|
|
1092
|
+
_context.next = 17;
|
|
1079
1093
|
return optionFocus('increase');
|
|
1080
|
-
case
|
|
1094
|
+
case 17:
|
|
1081
1095
|
res = _context.sent;
|
|
1082
|
-
return _context.abrupt("break",
|
|
1083
|
-
case
|
|
1096
|
+
return _context.abrupt("break", 19);
|
|
1097
|
+
case 19:
|
|
1084
1098
|
// temporary data
|
|
1085
1099
|
if (res !== null) listRef.current.dataset.data = JSON.stringify({
|
|
1086
1100
|
value: res.dataset.value,
|
|
1087
1101
|
label: res.dataset.label,
|
|
1088
1102
|
queryString: res.dataset.querystring
|
|
1089
1103
|
});
|
|
1090
|
-
case
|
|
1104
|
+
case 20:
|
|
1091
1105
|
case "end":
|
|
1092
1106
|
return _context.stop();
|
|
1093
1107
|
}
|
|
@@ -1100,6 +1114,10 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1100
1114
|
document.removeEventListener("keydown", listener);
|
|
1101
1115
|
document.addEventListener("keydown", listener);
|
|
1102
1116
|
|
|
1117
|
+
//--------------
|
|
1118
|
+
document.removeEventListener('pointerdown', handleClose);
|
|
1119
|
+
document.addEventListener('pointerdown', handleClose);
|
|
1120
|
+
|
|
1103
1121
|
// Add function to the element that should be used as the scrollable area.
|
|
1104
1122
|
//--------------
|
|
1105
1123
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
@@ -1112,11 +1130,20 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1112
1130
|
//--------------
|
|
1113
1131
|
return function () {
|
|
1114
1132
|
document.removeEventListener("keydown", listener);
|
|
1133
|
+
document.removeEventListener('pointerdown', handleClose);
|
|
1115
1134
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1116
1135
|
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1117
1136
|
};
|
|
1118
1137
|
}, [value]);
|
|
1119
|
-
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1138
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, label ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1139
|
+
className: "livesearch__wrapper__label"
|
|
1140
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
|
|
1141
|
+
htmlFor: "label-".concat(idRes),
|
|
1142
|
+
className: "form-label",
|
|
1143
|
+
dangerouslySetInnerHTML: {
|
|
1144
|
+
__html: "".concat(label)
|
|
1145
|
+
}
|
|
1146
|
+
}))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1120
1147
|
className: "livesearch__wrapper ".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'mb-3 position-relative', " ").concat(isOpen ? 'active' : ''),
|
|
1121
1148
|
ref: rootRef,
|
|
1122
1149
|
onMouseLeave: handleMouseLeaveTrigger
|
|
@@ -1125,7 +1152,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1125
1152
|
controlClassName: controlClassName,
|
|
1126
1153
|
ref: inputRef,
|
|
1127
1154
|
value: changedVal,
|
|
1128
|
-
label:
|
|
1155
|
+
label: "",
|
|
1129
1156
|
tabIndex: tabIndex,
|
|
1130
1157
|
id: idRes,
|
|
1131
1158
|
name: name,
|
|
@@ -1168,7 +1195,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1168
1195
|
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder),
|
|
1169
1196
|
"data-value": "".concat(item.value),
|
|
1170
1197
|
"data-label": "".concat(item.label),
|
|
1171
|
-
"data-querystring": "".concat(item.queryString),
|
|
1198
|
+
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
1172
1199
|
role: "tab"
|
|
1173
1200
|
}, item.label);
|
|
1174
1201
|
}) : null))) : null, data && data.length === 0 && !hasErr && isOpen ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
@@ -1189,7 +1216,24 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1189
1216
|
type: "button",
|
|
1190
1217
|
className: "list-group-item list-group-item-action no-match",
|
|
1191
1218
|
disabled: true
|
|
1192
|
-
}, fetchNoneInfo || 'No match yet')))) : null))
|
|
1219
|
+
}, fetchNoneInfo || 'No match yet')))) : null, !fetchTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1220
|
+
className: "livesearch__wrapper-searchbtn position-absolute top-0 end-0"
|
|
1221
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1222
|
+
tabIndex: -1,
|
|
1223
|
+
type: "button",
|
|
1224
|
+
className: "btn border-end-0 rounded-pill",
|
|
1225
|
+
style: {
|
|
1226
|
+
pointerEvents: 'none'
|
|
1227
|
+
}
|
|
1228
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1229
|
+
width: "1em",
|
|
1230
|
+
height: "1em",
|
|
1231
|
+
fill: "#a5a5a5",
|
|
1232
|
+
viewBox: "0 0 16 16"
|
|
1233
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1234
|
+
d: "M12.027 9.92L16 13.95 14 16l-4.075-3.976A6.465 6.465 0 0 1 6.5 13C2.91 13 0 10.083 0 6.5 0 2.91 2.917 0 6.5 0 10.09 0 13 2.917 13 6.5a6.463 6.463 0 0 1-.973 3.42zM1.997 6.452c0 2.48 2.014 4.5 4.5 4.5 2.48 0 4.5-2.015 4.5-4.5 0-2.48-2.015-4.5-4.5-4.5-2.48 0-4.5 2.014-4.5 4.5z",
|
|
1235
|
+
fillRule: "evenodd"
|
|
1236
|
+
}))))) : null));
|
|
1193
1237
|
};
|
|
1194
1238
|
/* harmony default export */ const src = (LiveSearch);
|
|
1195
1239
|
})();
|
package/MultiFuncSelect/index.js
CHANGED
|
@@ -305,15 +305,15 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_re
|
|
|
305
305
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
306
306
|
// EXTERNAL MODULE: ./src/utils/performance.js
|
|
307
307
|
var performance = __webpack_require__(342);
|
|
308
|
-
;// CONCATENATED MODULE: ./src/utils/
|
|
308
|
+
;// CONCATENATED MODULE: ./src/utils/useDebounce.js
|
|
309
309
|
/**
|
|
310
|
-
*
|
|
310
|
+
* Delay the execution of function or state update
|
|
311
311
|
*
|
|
312
312
|
* @usage:
|
|
313
313
|
|
|
314
314
|
const App = () => {
|
|
315
315
|
const [count, setCount] = useState(0);
|
|
316
|
-
const handleClick =
|
|
316
|
+
const handleClick = useDebounce(() => setCount(count + 1), 500, [count]);
|
|
317
317
|
|
|
318
318
|
return (
|
|
319
319
|
<div className="app">
|
|
@@ -325,19 +325,25 @@ const App = () => {
|
|
|
325
325
|
|
|
326
326
|
*/
|
|
327
327
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
});
|
|
328
|
+
|
|
329
|
+
var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
330
|
+
var ref = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
332
331
|
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
fn.apply(void 0, arguments);
|
|
336
|
-
ref.current.lastTime = now;
|
|
332
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
333
|
+
args[_key] = arguments[_key];
|
|
337
334
|
}
|
|
335
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
336
|
+
clearTimeout(ref.current);
|
|
337
|
+
ref.current = null;
|
|
338
|
+
|
|
339
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
340
|
+
// Execute fn after another delay milliseconds
|
|
341
|
+
ref.current = setTimeout(function () {
|
|
342
|
+
fn.apply(void 0, args);
|
|
343
|
+
}, delay);
|
|
338
344
|
}, dependence);
|
|
339
345
|
};
|
|
340
|
-
/* harmony default export */ const
|
|
346
|
+
/* harmony default export */ const utils_useDebounce = (useDebounce);
|
|
341
347
|
;// CONCATENATED MODULE: ./src/plugins/BSL/bodyScrollLock.es6.js
|
|
342
348
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
343
349
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -740,7 +746,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
740
746
|
};
|
|
741
747
|
|
|
742
748
|
//performance
|
|
743
|
-
var handleChangeFetchSafe =
|
|
749
|
+
var handleChangeFetchSafe = utils_useDebounce(function (val) {
|
|
744
750
|
var _orginalData = [];
|
|
745
751
|
var update = function update(inputData) {
|
|
746
752
|
var filterRes = function filterRes(data) {
|
|
@@ -769,7 +775,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
769
775
|
_orginalData = orginalData;
|
|
770
776
|
update(_orginalData);
|
|
771
777
|
}
|
|
772
|
-
},
|
|
778
|
+
}, 350, [optionsData]);
|
|
773
779
|
|
|
774
780
|
/**
|
|
775
781
|
* Format indent value
|
|
@@ -1664,7 +1670,6 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1664
1670
|
return new Promise(function (resolve) {
|
|
1665
1671
|
// Determine the "active" class name to avoid listening to other unused components of the same type
|
|
1666
1672
|
if (listRef.current === null || !rootRef.current.classList.contains('active')) return;
|
|
1667
|
-
if (fetchTrigger) return;
|
|
1668
1673
|
var options = [].slice.call(listRef.current.querySelectorAll('.list-group-item'));
|
|
1669
1674
|
var currentIndex = options.findIndex(function (e) {
|
|
1670
1675
|
return e === listRef.current.querySelector('.list-group-item.active');
|
|
@@ -1705,7 +1710,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1705
1710
|
//--------------
|
|
1706
1711
|
var _oparams = fetchFuncMethodParams || [];
|
|
1707
1712
|
var _params = _oparams.map(function (item) {
|
|
1708
|
-
return item !== '$QUERY_STRING' ? item : fetchTrigger ? '
|
|
1713
|
+
return item !== '$QUERY_STRING' ? item : fetchTrigger ? '------' : '';
|
|
1709
1714
|
});
|
|
1710
1715
|
fetchData(_params.join(','), value);
|
|
1711
1716
|
|
|
@@ -1719,7 +1724,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1719
1724
|
case 0:
|
|
1720
1725
|
res = null;
|
|
1721
1726
|
if (!(event.code === "Enter" || event.code === "NumpadEnter")) {
|
|
1722
|
-
_context.next =
|
|
1727
|
+
_context.next = 10;
|
|
1723
1728
|
break;
|
|
1724
1729
|
}
|
|
1725
1730
|
if (!(listRef.current === null || !rootRef.current.classList.contains('active'))) {
|
|
@@ -1728,20 +1733,13 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1728
1733
|
}
|
|
1729
1734
|
return _context.abrupt("return");
|
|
1730
1735
|
case 4:
|
|
1731
|
-
if (!fetchTrigger) {
|
|
1732
|
-
_context.next = 7;
|
|
1733
|
-
break;
|
|
1734
|
-
}
|
|
1735
|
-
handleFetch();
|
|
1736
|
-
return _context.abrupt("return");
|
|
1737
|
-
case 7:
|
|
1738
1736
|
if (!(listRef.current !== null)) {
|
|
1739
|
-
_context.next =
|
|
1737
|
+
_context.next = 9;
|
|
1740
1738
|
break;
|
|
1741
1739
|
}
|
|
1742
|
-
_context.next =
|
|
1740
|
+
_context.next = 7;
|
|
1743
1741
|
return listRef.current.dataset.data;
|
|
1744
|
-
case
|
|
1742
|
+
case 7:
|
|
1745
1743
|
currentData = _context.sent;
|
|
1746
1744
|
if (typeof currentData !== 'undefined') {
|
|
1747
1745
|
currentControlValueArr = [];
|
|
@@ -1755,37 +1753,48 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1755
1753
|
}
|
|
1756
1754
|
});
|
|
1757
1755
|
handleSelect(null, currentData, currentControlValueArr, currentControlLabelArr);
|
|
1756
|
+
|
|
1757
|
+
//
|
|
1758
|
+
if (typeof onChange === 'function') {
|
|
1759
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? JSON.parse(currentData) : {
|
|
1760
|
+
labels: currentControlLabelArr.map(function (v) {
|
|
1761
|
+
return v.toString();
|
|
1762
|
+
}),
|
|
1763
|
+
values: currentControlValueArr.map(function (v) {
|
|
1764
|
+
return v.toString();
|
|
1765
|
+
})
|
|
1766
|
+
});
|
|
1767
|
+
|
|
1768
|
+
//
|
|
1769
|
+
selectInputRef.current.blur();
|
|
1770
|
+
}
|
|
1758
1771
|
}
|
|
1759
|
-
case
|
|
1772
|
+
case 9:
|
|
1760
1773
|
return _context.abrupt("return");
|
|
1761
|
-
case
|
|
1774
|
+
case 10:
|
|
1762
1775
|
_context.t0 = event.code;
|
|
1763
|
-
_context.next = _context.t0 === "ArrowLeft" ?
|
|
1776
|
+
_context.next = _context.t0 === "ArrowLeft" ? 13 : _context.t0 === "ArrowRight" ? 14 : _context.t0 === "ArrowUp" ? 15 : _context.t0 === "ArrowDown" ? 19 : 23;
|
|
1764
1777
|
break;
|
|
1765
|
-
case
|
|
1766
|
-
return _context.abrupt("break",
|
|
1767
|
-
case
|
|
1768
|
-
return _context.abrupt("break",
|
|
1769
|
-
case
|
|
1770
|
-
_context.next =
|
|
1778
|
+
case 13:
|
|
1779
|
+
return _context.abrupt("break", 23);
|
|
1780
|
+
case 14:
|
|
1781
|
+
return _context.abrupt("break", 23);
|
|
1782
|
+
case 15:
|
|
1783
|
+
_context.next = 17;
|
|
1771
1784
|
return optionFocus('decrease');
|
|
1772
|
-
case
|
|
1785
|
+
case 17:
|
|
1773
1786
|
res = _context.sent;
|
|
1774
|
-
return _context.abrupt("break",
|
|
1775
|
-
case
|
|
1776
|
-
_context.next =
|
|
1787
|
+
return _context.abrupt("break", 23);
|
|
1788
|
+
case 19:
|
|
1789
|
+
_context.next = 21;
|
|
1777
1790
|
return optionFocus('increase');
|
|
1778
|
-
case
|
|
1791
|
+
case 21:
|
|
1779
1792
|
res = _context.sent;
|
|
1780
|
-
return _context.abrupt("break",
|
|
1781
|
-
case
|
|
1793
|
+
return _context.abrupt("break", 23);
|
|
1794
|
+
case 23:
|
|
1782
1795
|
// temporary data
|
|
1783
|
-
if (res !== null) listRef.current.dataset.data =
|
|
1784
|
-
|
|
1785
|
-
label: res.dataset.label,
|
|
1786
|
-
queryString: res.dataset.querystring
|
|
1787
|
-
});
|
|
1788
|
-
case 27:
|
|
1796
|
+
if (res !== null) listRef.current.dataset.data = res.dataset.itemdata;
|
|
1797
|
+
case 24:
|
|
1789
1798
|
case "end":
|
|
1790
1799
|
return _context.stop();
|
|
1791
1800
|
}
|
|
@@ -1905,9 +1914,12 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1905
1914
|
})))))), fetchTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1906
1915
|
className: "multifunc-select-multi__control-searchbtn position-absolute top-0 end-0"
|
|
1907
1916
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1917
|
+
tabIndex: -1,
|
|
1908
1918
|
type: "button",
|
|
1909
|
-
className:
|
|
1910
|
-
|
|
1919
|
+
className: "btn border-end-0 rounded-pill",
|
|
1920
|
+
style: {
|
|
1921
|
+
pointerEvents: 'none'
|
|
1922
|
+
}
|
|
1911
1923
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1912
1924
|
width: "1em",
|
|
1913
1925
|
height: "1em",
|
|
@@ -1970,8 +1982,9 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1970
1982
|
})))))), fetchTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1971
1983
|
className: "multifunc-select-multi__control-searchbtn position-absolute top-0 end-0"
|
|
1972
1984
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1985
|
+
tabIndex: -1,
|
|
1973
1986
|
type: "button",
|
|
1974
|
-
className:
|
|
1987
|
+
className: "btn border-end-0 rounded-pill",
|
|
1975
1988
|
onClick: handleFetch
|
|
1976
1989
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1977
1990
|
width: "1em",
|
|
@@ -2033,7 +2046,8 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
2033
2046
|
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder, " border-bottom-0"),
|
|
2034
2047
|
"data-value": "".concat(item.value),
|
|
2035
2048
|
"data-label": "".concat(item.label),
|
|
2036
|
-
"data-querystring": "".concat(item.queryString),
|
|
2049
|
+
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
2050
|
+
"data-itemdata": JSON.stringify(item),
|
|
2037
2051
|
role: "tab",
|
|
2038
2052
|
dangerouslySetInnerHTML: {
|
|
2039
2053
|
__html: item.label
|
|
@@ -2053,7 +2067,8 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
2053
2067
|
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder, " border-bottom-0 ").concat(itemSelected ? 'list-group-item-secondary item-selected' : ''),
|
|
2054
2068
|
"data-value": "".concat(item.value),
|
|
2055
2069
|
"data-label": "".concat(item.label),
|
|
2056
|
-
"data-querystring": "".concat(item.queryString),
|
|
2070
|
+
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
2071
|
+
"data-itemdata": JSON.stringify(item),
|
|
2057
2072
|
role: "tab"
|
|
2058
2073
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
2059
2074
|
className: "d-inline-block me-1 "
|
|
@@ -743,17 +743,6 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
743
743
|
_valueData.splice(level, 1, resValue.id);
|
|
744
744
|
_labelData.splice(level, 1, resValue.name);
|
|
745
745
|
_queryIdsData.splice(level, 1, resValue.queryId);
|
|
746
|
-
console.log('****', {
|
|
747
|
-
labels: _labelData.filter(function (v) {
|
|
748
|
-
return v != '';
|
|
749
|
-
}),
|
|
750
|
-
values: _valueData.filter(function (v) {
|
|
751
|
-
return v.toString().indexOf('$EMPTY_ID_') < 0;
|
|
752
|
-
}),
|
|
753
|
-
queryIds: _queryIdsData.filter(function (v) {
|
|
754
|
-
return v != undefined;
|
|
755
|
-
})
|
|
756
|
-
});
|
|
757
746
|
return {
|
|
758
747
|
labels: _labelData.filter(function (v) {
|
|
759
748
|
return v != '';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare type OptionChangeFnType = (arg1: any) => void;
|
|
3
3
|
interface OptionConfig {
|
|
4
4
|
value?: string | undefined;
|
|
5
|
-
label?: string | undefined;
|
|
5
|
+
label?: string | React.ReactNode | undefined;
|
|
6
6
|
}
|
|
7
7
|
declare type DropdownMenuProps = {
|
|
8
8
|
wrapperClassName?: string;
|
|
@@ -104,22 +104,30 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__
|
|
|
104
104
|
;// CONCATENATED MODULE: ./src/Option.tsx
|
|
105
105
|
|
|
106
106
|
function Option(props) {
|
|
107
|
-
var
|
|
107
|
+
var option = props.option;
|
|
108
|
+
var _label = option ? option.label : '';
|
|
109
|
+
var _value = option ? option.value : '';
|
|
108
110
|
function handleSelect(e) {
|
|
109
111
|
e.preventDefault();
|
|
110
112
|
var fn = props.onSelect;
|
|
111
113
|
fn(props.option);
|
|
112
114
|
}
|
|
113
|
-
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
115
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof _label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
114
116
|
className: props.hyperlinkClassName,
|
|
115
|
-
"data-value":
|
|
117
|
+
"data-value": _value,
|
|
116
118
|
href: "#",
|
|
117
119
|
tabIndex: -1,
|
|
118
120
|
onClick: handleSelect,
|
|
119
121
|
dangerouslySetInnerHTML: {
|
|
120
|
-
__html: "".concat(
|
|
122
|
+
__html: "".concat(_label)
|
|
121
123
|
}
|
|
122
|
-
}))
|
|
124
|
+
}))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
125
|
+
className: props.hyperlinkClassName,
|
|
126
|
+
"data-value": _value,
|
|
127
|
+
href: "#",
|
|
128
|
+
tabIndex: -1,
|
|
129
|
+
onClick: handleSelect
|
|
130
|
+
}, _label))));
|
|
123
131
|
}
|
|
124
132
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
125
133
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|