funda-ui 1.1.170 → 1.1.172
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 +39 -19
- package/MultiFuncSelect/index.js +2 -0
- package/MultipleSelect/index.css +49 -16
- package/MultipleSelect/index.d.ts +3 -1
- package/MultipleSelect/index.js +79 -19
- package/lib/cjs/CascadingSelectE2E/index.js +39 -19
- package/lib/cjs/MultiFuncSelect/index.js +2 -0
- package/lib/cjs/MultipleSelect/index.d.ts +3 -1
- package/lib/cjs/MultipleSelect/index.js +79 -19
- package/lib/css/MultipleSelect/index.css +49 -16
- package/lib/esm/CascadingSelectE2E/index.tsx +44 -21
- package/lib/esm/MultiFuncSelect/index.tsx +30 -4
- package/lib/esm/MultipleSelect/index.scss +62 -20
- package/lib/esm/MultipleSelect/index.tsx +97 -22
- package/package.json +1 -1
|
@@ -877,7 +877,7 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
877
877
|
var _queryIdsData = prevState.queryIds.slice(0, level + 1);
|
|
878
878
|
_valueData.splice(level, 1, resValue.id);
|
|
879
879
|
_labelData.splice(level, 1, resValue.name);
|
|
880
|
-
_queryIdsData.splice(level, 1, resValue.queryId);
|
|
880
|
+
if (Array.isArray(_queryIdsData)) _queryIdsData.splice(level, 1, resValue.queryId);
|
|
881
881
|
return {
|
|
882
882
|
labels: _labelData.filter(function (v) {
|
|
883
883
|
return v != '';
|
|
@@ -885,8 +885,10 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
885
885
|
values: _valueData.filter(function (v) {
|
|
886
886
|
return v.toString().indexOf('$EMPTY_ID_') < 0;
|
|
887
887
|
}),
|
|
888
|
-
queryIds: _queryIdsData.filter(function (v) {
|
|
888
|
+
queryIds: Array.isArray(_queryIdsData) ? _queryIdsData.filter(function (v) {
|
|
889
889
|
return v != undefined;
|
|
890
|
+
}) : _labelData.filter(function (v) {
|
|
891
|
+
return v != '';
|
|
890
892
|
})
|
|
891
893
|
};
|
|
892
894
|
});
|
|
@@ -1050,27 +1052,45 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
1050
1052
|
1: inputVal_1
|
|
1051
1053
|
};
|
|
1052
1054
|
}
|
|
1055
|
+
function cleanValue() {
|
|
1056
|
+
setSelectedData({
|
|
1057
|
+
labels: [],
|
|
1058
|
+
values: [],
|
|
1059
|
+
queryIds: []
|
|
1060
|
+
});
|
|
1061
|
+
setSelectedDataByClick({
|
|
1062
|
+
labels: [],
|
|
1063
|
+
values: [],
|
|
1064
|
+
queryIds: []
|
|
1065
|
+
});
|
|
1066
|
+
setAllData([]);
|
|
1067
|
+
setDictionaryData([]);
|
|
1068
|
+
setOptData([]);
|
|
1069
|
+
setData([]);
|
|
1070
|
+
setChangedVal('');
|
|
1071
|
+
setFirstDataFeched(false);
|
|
1072
|
+
}
|
|
1053
1073
|
function initDefaultValue(defaultValue) {
|
|
1054
1074
|
var _doFetch;
|
|
1075
|
+
// Determine whether the splicing value of the default value is empty
|
|
1076
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '') {
|
|
1077
|
+
var formattedDefaultValue = VALUE_BY_BRACES ? (0,extract.extractContentsOfBraces)(defaultValue) : defaultValue.split(',');
|
|
1078
|
+
var emptyDefaultValueCheck = formattedDefaultValue.every(function (item, index) {
|
|
1079
|
+
if (item !== '[]') {
|
|
1080
|
+
return false;
|
|
1081
|
+
}
|
|
1082
|
+
return true;
|
|
1083
|
+
});
|
|
1084
|
+
if (emptyDefaultValueCheck) {
|
|
1085
|
+
cleanValue();
|
|
1086
|
+
return; // required RETURN
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1055
1090
|
// change the value to trigger component rendering
|
|
1056
1091
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
values: [],
|
|
1060
|
-
queryIds: []
|
|
1061
|
-
});
|
|
1062
|
-
setSelectedDataByClick({
|
|
1063
|
-
labels: [],
|
|
1064
|
-
values: [],
|
|
1065
|
-
queryIds: []
|
|
1066
|
-
});
|
|
1067
|
-
setAllData([]);
|
|
1068
|
-
setDictionaryData([]);
|
|
1069
|
-
setOptData([]);
|
|
1070
|
-
setData([]);
|
|
1071
|
-
setChangedVal('');
|
|
1072
|
-
setFirstDataFeched(false);
|
|
1073
|
-
return;
|
|
1092
|
+
cleanValue();
|
|
1093
|
+
return; // required RETURN
|
|
1074
1094
|
} else {
|
|
1075
1095
|
setChangedVal(defaultValue);
|
|
1076
1096
|
}
|
package/MultiFuncSelect/index.js
CHANGED
|
@@ -2632,6 +2632,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
2632
2632
|
"data-label": "".concat(item.label),
|
|
2633
2633
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
2634
2634
|
"data-itemdata": JSON.stringify(item),
|
|
2635
|
+
"data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
|
|
2635
2636
|
role: "tab",
|
|
2636
2637
|
dangerouslySetInnerHTML: {
|
|
2637
2638
|
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
@@ -2652,6 +2653,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
2652
2653
|
"data-value": "".concat(item.value),
|
|
2653
2654
|
"data-label": "".concat(item.label),
|
|
2654
2655
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
2656
|
+
"data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
|
|
2655
2657
|
"data-itemdata": JSON.stringify(item),
|
|
2656
2658
|
role: "tab"
|
|
2657
2659
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
package/MultipleSelect/index.css
CHANGED
|
@@ -2,22 +2,39 @@
|
|
|
2
2
|
<!-- Multiple Select -->
|
|
3
3
|
/* ====================================================== */
|
|
4
4
|
.m-select__wrapper {
|
|
5
|
+
--m-select-wrapper-min-w: 350px;
|
|
6
|
+
--m-select-wrapper-min-h: 315px;
|
|
7
|
+
--m-select-header-font-size: 0.75rem;
|
|
8
|
+
--m-select-body-font-size: 0.75rem;
|
|
5
9
|
--m-select-scrollbar-color: rgba(0, 0, 0, 0.2);
|
|
6
10
|
--m-select-scrollbar-track: rgba(0, 0, 0, 0);
|
|
7
11
|
--m-select-scrollbar-w: 3px;
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
--m-select-search-icon-color: #333;
|
|
13
|
+
--m-select-body-bg: #fff;
|
|
14
|
+
--m-select-header-bg: #dee2e6;
|
|
15
|
+
--m-select-border-color: #dee2e6;
|
|
16
|
+
--m-select-options-item-bg: #f6f6f6;
|
|
17
|
+
--m-select-options-item-icon-color: #000;
|
|
18
|
+
--m-select-options-item-selected-bg: #0b5ed7;
|
|
19
|
+
--m-select-options-item-selected-icon-color: #fff;
|
|
20
|
+
--m-select-options-item-selected-text-color: #fff;
|
|
21
|
+
--m-select-options-item-dividingline-color: rgba(255, 255, 255, 1);
|
|
22
|
+
--m-select-search-input-w: 100px;
|
|
23
|
+
--m-select-search-input-bg: #fff;
|
|
24
|
+
--m-select-search-input-text-color: #333;
|
|
25
|
+
min-width: var(--m-select-wrapper-min-w);
|
|
26
|
+
min-height: var(--m-select-wrapper-min-h);
|
|
10
27
|
width: 100%;
|
|
11
28
|
height: 100%;
|
|
12
|
-
border: solid 1px
|
|
29
|
+
border: solid 1px var(--m-select-border-color);
|
|
13
30
|
border-radius: 0.35rem;
|
|
14
31
|
position: relative;
|
|
15
|
-
background:
|
|
32
|
+
background: var(--m-select-body-bg);
|
|
16
33
|
/*-------- List --------*/
|
|
17
34
|
}
|
|
18
35
|
.m-select__wrapper .m-select-diving-line {
|
|
19
36
|
width: 1px;
|
|
20
|
-
background-color:
|
|
37
|
+
background-color: var(--m-select-border-color);
|
|
21
38
|
left: 50%;
|
|
22
39
|
top: 0;
|
|
23
40
|
position: absolute;
|
|
@@ -28,6 +45,7 @@
|
|
|
28
45
|
display: flex;
|
|
29
46
|
font-size: 0.8em;
|
|
30
47
|
height: 100%;
|
|
48
|
+
/* Search */
|
|
31
49
|
}
|
|
32
50
|
.m-select__wrapper .m-select-inner ul,
|
|
33
51
|
.m-select__wrapper .m-select-inner li {
|
|
@@ -45,7 +63,6 @@
|
|
|
45
63
|
position: relative;
|
|
46
64
|
overflow: auto;
|
|
47
65
|
overflow-x: hidden;
|
|
48
|
-
background: #fff;
|
|
49
66
|
border: none;
|
|
50
67
|
position: relative;
|
|
51
68
|
width: 100%;
|
|
@@ -56,11 +73,11 @@
|
|
|
56
73
|
.m-select__wrapper .m-select-inner li {
|
|
57
74
|
cursor: default;
|
|
58
75
|
position: relative;
|
|
59
|
-
font-size:
|
|
76
|
+
font-size: var(--m-select-body-font-size);
|
|
60
77
|
display: flex;
|
|
61
78
|
justify-content: space-between;
|
|
62
|
-
background:
|
|
63
|
-
border-bottom: 1px solid
|
|
79
|
+
background: var(--m-select-options-item-bg);
|
|
80
|
+
border-bottom: 1px solid var(--m-select-options-item-dividingline-color);
|
|
64
81
|
}
|
|
65
82
|
.m-select__wrapper .m-select-inner li.disabled {
|
|
66
83
|
pointer-events: none;
|
|
@@ -73,11 +90,11 @@
|
|
|
73
90
|
opacity: 0.8;
|
|
74
91
|
}
|
|
75
92
|
.m-select__wrapper .m-select-inner li.selected {
|
|
76
|
-
background:
|
|
77
|
-
color:
|
|
93
|
+
background: var(--m-select-options-item-selected-bg);
|
|
94
|
+
color: var(--m-select-options-item-selected-text-color);
|
|
78
95
|
}
|
|
79
96
|
.m-select__wrapper .m-select-inner li.selected > i svg path {
|
|
80
|
-
fill:
|
|
97
|
+
fill: var(--m-select-options-item-selected-icon-color);
|
|
81
98
|
}
|
|
82
99
|
.m-select__wrapper .m-select-inner li:last-child {
|
|
83
100
|
border-bottom: none;
|
|
@@ -98,6 +115,9 @@
|
|
|
98
115
|
padding: 0.35rem 0.75rem;
|
|
99
116
|
cursor: pointer;
|
|
100
117
|
}
|
|
118
|
+
.m-select__wrapper .m-select-inner li > i svg path {
|
|
119
|
+
fill: var(--m-select-options-item-icon-color);
|
|
120
|
+
}
|
|
101
121
|
.m-select__wrapper .m-select-inner li a {
|
|
102
122
|
color: #999;
|
|
103
123
|
text-decoration: none;
|
|
@@ -118,9 +138,9 @@
|
|
|
118
138
|
}
|
|
119
139
|
.m-select__wrapper .m-select-inner .m-select__header {
|
|
120
140
|
border: none;
|
|
121
|
-
font-size:
|
|
141
|
+
font-size: var(--m-select-header-font-size);
|
|
122
142
|
margin-bottom: 1px;
|
|
123
|
-
background:
|
|
143
|
+
background: var(--m-select-header-bg);
|
|
124
144
|
display: flex;
|
|
125
145
|
justify-content: space-between;
|
|
126
146
|
align-items: center;
|
|
@@ -139,17 +159,30 @@
|
|
|
139
159
|
padding: 0.2rem;
|
|
140
160
|
font-weight: bold;
|
|
141
161
|
}
|
|
142
|
-
.m-select__wrapper .m-select-inner
|
|
162
|
+
.m-select__wrapper .m-select-inner .m-select__search__container {
|
|
163
|
+
position: relative;
|
|
164
|
+
}
|
|
165
|
+
.m-select__wrapper .m-select-inner .m-select__search__container input.m-select__search {
|
|
143
166
|
height: 14px;
|
|
144
167
|
padding: 0.1rem 0.5rem;
|
|
145
168
|
opacity: 0.5;
|
|
146
169
|
margin: 4px;
|
|
147
|
-
width:
|
|
170
|
+
width: var(--m-select-search-input-w);
|
|
171
|
+
background-color: var(--m-select-search-input-bg);
|
|
172
|
+
color: var(--m-select-search-input-text-color);
|
|
148
173
|
border-radius: 25px;
|
|
149
174
|
border: none;
|
|
150
175
|
outline: none;
|
|
151
176
|
box-shadow: none;
|
|
152
177
|
}
|
|
178
|
+
.m-select__wrapper .m-select-inner .m-select__search__container i {
|
|
179
|
+
position: absolute;
|
|
180
|
+
right: 0.6em;
|
|
181
|
+
top: 0.1em;
|
|
182
|
+
}
|
|
183
|
+
.m-select__wrapper .m-select-inner .m-select__search__container i svg {
|
|
184
|
+
fill: var(--m-select-search-icon-color);
|
|
185
|
+
}
|
|
153
186
|
.m-select__wrapper .m-select__options-contentlist {
|
|
154
187
|
position: relative;
|
|
155
188
|
width: 100%;
|
|
@@ -4,6 +4,8 @@ interface OptionConfig {
|
|
|
4
4
|
}
|
|
5
5
|
declare type MultipleSelectProps = {
|
|
6
6
|
wrapperClassName?: string;
|
|
7
|
+
wrapperMinHeight?: string;
|
|
8
|
+
wrapperMinWidth?: string;
|
|
7
9
|
availableHeaderTitle?: string;
|
|
8
10
|
selectedHeaderTitle?: string;
|
|
9
11
|
selectedHeaderNote?: string;
|
|
@@ -33,7 +35,7 @@ declare type MultipleSelectProps = {
|
|
|
33
35
|
fetchFuncMethodParams?: any[];
|
|
34
36
|
fetchCallback?: (data: any) => void;
|
|
35
37
|
onFetch?: (data: any) => void;
|
|
36
|
-
onChange?: (e: any, data: any, dataStr: any) => void;
|
|
38
|
+
onChange?: (e: any, data: any, dataStr: any, currentData: any, type: string) => void;
|
|
37
39
|
};
|
|
38
40
|
declare const MultipleSelect: React.ForwardRefExoticComponent<MultipleSelectProps & React.RefAttributes<unknown>>;
|
|
39
41
|
export default MultipleSelect;
|
package/MultipleSelect/index.js
CHANGED
|
@@ -379,7 +379,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
379
379
|
/* harmony import */ var _utils_extract__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_utils_extract__WEBPACK_IMPORTED_MODULE_2__);
|
|
380
380
|
/* harmony import */ var _utils_convert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(498);
|
|
381
381
|
/* harmony import */ var _utils_convert__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_utils_convert__WEBPACK_IMPORTED_MODULE_3__);
|
|
382
|
-
var _excluded = ["wrapperClassName", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "hierarchical", "indentation", "doubleIndent", "options", "disabled", "required", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange"];
|
|
382
|
+
var _excluded = ["wrapperClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "hierarchical", "indentation", "doubleIndent", "options", "disabled", "required", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange"];
|
|
383
383
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
384
384
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
385
385
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -403,6 +403,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
403
403
|
|
|
404
404
|
var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, _ref) {
|
|
405
405
|
var wrapperClassName = props.wrapperClassName,
|
|
406
|
+
wrapperMinHeight = props.wrapperMinHeight,
|
|
407
|
+
wrapperMinWidth = props.wrapperMinWidth,
|
|
406
408
|
availableHeaderTitle = props.availableHeaderTitle,
|
|
407
409
|
selectedHeaderTitle = props.selectedHeaderTitle,
|
|
408
410
|
selectedHeaderNote = props.selectedHeaderNote,
|
|
@@ -430,6 +432,8 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
430
432
|
onFetch = props.onFetch,
|
|
431
433
|
onChange = props.onChange,
|
|
432
434
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
435
|
+
var WRAPPER_MIN_H = typeof wrapperMinHeight === 'undefined' ? '' : wrapperMinHeight;
|
|
436
|
+
var WRAPPER_MIN_W = typeof wrapperMinWidth === 'undefined' ? '' : wrapperMinWidth;
|
|
433
437
|
var INDENT_PLACEHOLDER = doubleIndent ? " " : " ";
|
|
434
438
|
var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, " ") : '');
|
|
435
439
|
var VALUE_BY_BRACKETS = typeof extractValueByBrackets === 'undefined' ? true : extractValueByBrackets;
|
|
@@ -453,14 +457,25 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
453
457
|
var optionsDataInit = optionsRes;
|
|
454
458
|
|
|
455
459
|
//
|
|
456
|
-
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
460
|
+
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(''),
|
|
457
461
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
462
|
+
changedSearchVal = _useState6[0],
|
|
463
|
+
setChangedSearchVal = _useState6[1];
|
|
464
|
+
|
|
465
|
+
//
|
|
466
|
+
var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(optionsDataInit),
|
|
461
467
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
462
|
-
|
|
463
|
-
|
|
468
|
+
dataInit = _useState8[0],
|
|
469
|
+
setDataInit = _useState8[1];
|
|
470
|
+
var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
471
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
472
|
+
hasErr = _useState10[0],
|
|
473
|
+
setHasErr = _useState10[1];
|
|
474
|
+
var multiSelControlOptionExist = function multiSelControlOptionExist(arr, val) {
|
|
475
|
+
return arr.map(function (v) {
|
|
476
|
+
return v.toString();
|
|
477
|
+
}).includes(val.toString());
|
|
478
|
+
};
|
|
464
479
|
function fetchData(_x2) {
|
|
465
480
|
return _fetchData.apply(this, arguments);
|
|
466
481
|
} // Determine whether it is in JSON format
|
|
@@ -550,6 +565,7 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
550
565
|
// change the value to trigger component rendering
|
|
551
566
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
552
567
|
setValSelected([]);
|
|
568
|
+
setValSelectedData([]);
|
|
553
569
|
} else {
|
|
554
570
|
var _val = VALUE_BY_BRACKETS ? (0,_utils_extract__WEBPACK_IMPORTED_MODULE_2__.extractContentsOfBrackets)(defaultValue) : defaultValue.trim().replace(/^\,|\,$/g, '').split(',');
|
|
555
571
|
if (Array.isArray(_val)) {
|
|
@@ -560,10 +576,11 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
560
576
|
|
|
561
577
|
// Initialize selected options
|
|
562
578
|
setValSelectedData(options.filter(function (item) {
|
|
563
|
-
return _initVal
|
|
579
|
+
return multiSelControlOptionExist(_initVal, item.value);
|
|
564
580
|
}));
|
|
565
581
|
} else {
|
|
566
582
|
setValSelected([]);
|
|
583
|
+
setValSelectedData([]);
|
|
567
584
|
}
|
|
568
585
|
}
|
|
569
586
|
}
|
|
@@ -571,7 +588,9 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
571
588
|
if (el === null) return;
|
|
572
589
|
var _li = el;
|
|
573
590
|
var _val = _li.dataset.value;
|
|
574
|
-
var
|
|
591
|
+
var _listItemLabel = _li.dataset.listItemLabel;
|
|
592
|
+
var _label = _listItemLabel === '' ? _li.dataset.label : _listItemLabel;
|
|
593
|
+
var _data = typeof _li.dataset.itemdata !== 'undefined' ? JSON.parse(_li.dataset.itemdata) : {};
|
|
575
594
|
|
|
576
595
|
// set selected items
|
|
577
596
|
setValSelected(function (prevState) {
|
|
@@ -581,7 +600,7 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
581
600
|
});
|
|
582
601
|
if (index !== -1) newData.splice(index, 1);
|
|
583
602
|
var _res = _val ? Array.from(new Set([_val].concat(_toConsumableArray(newData)))) : newData;
|
|
584
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_li, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','));
|
|
603
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_li, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','), _data, 'add');
|
|
585
604
|
|
|
586
605
|
// hide current item
|
|
587
606
|
_li.classList.add('hide');
|
|
@@ -595,10 +614,7 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
595
614
|
return item.value == _val;
|
|
596
615
|
});
|
|
597
616
|
if (index !== -1) newData.splice(index, 1);
|
|
598
|
-
var _res = _val ? Array.from(new Set([
|
|
599
|
-
label: _label,
|
|
600
|
-
value: _val
|
|
601
|
-
}].concat(_toConsumableArray(newData)))) : newData;
|
|
617
|
+
var _res = _val ? Array.from(new Set([_data].concat(_toConsumableArray(newData)))) : newData;
|
|
602
618
|
return _res;
|
|
603
619
|
});
|
|
604
620
|
}
|
|
@@ -606,6 +622,7 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
606
622
|
if (el === null) return;
|
|
607
623
|
var _li = el;
|
|
608
624
|
var _val = _li.dataset.value;
|
|
625
|
+
var _data = typeof _li.dataset.itemdata !== 'undefined' ? JSON.parse(_li.dataset.itemdata) : {};
|
|
609
626
|
|
|
610
627
|
// set selected items
|
|
611
628
|
setValSelected(function (prevState) {
|
|
@@ -615,7 +632,7 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
615
632
|
});
|
|
616
633
|
if (index !== -1) newData.splice(index, 1);
|
|
617
634
|
var _res = newData;
|
|
618
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_li, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','));
|
|
635
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_li, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','), _data, 'remove');
|
|
619
636
|
|
|
620
637
|
// show current item
|
|
621
638
|
if (availableListRef.current) {
|
|
@@ -654,6 +671,31 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
654
671
|
removeItem(item);
|
|
655
672
|
});
|
|
656
673
|
}
|
|
674
|
+
function handleChangeSearch(event) {
|
|
675
|
+
var inputVal = event.target.value;
|
|
676
|
+
if (availableListRef.current === null) return;
|
|
677
|
+
setChangedSearchVal(inputVal);
|
|
678
|
+
var items = [].slice.call(availableListRef.current.querySelectorAll('li[data-value]'));
|
|
679
|
+
items.forEach(function (item) {
|
|
680
|
+
// Avoid fatal errors causing page crashes
|
|
681
|
+
var _label = typeof item.dataset.label !== 'undefined' && item.dataset.label !== null ? item.dataset.label : '';
|
|
682
|
+
var _queryString = typeof item.dataset.querystring !== 'undefined' && item.dataset.querystring !== null ? item.dataset.querystring : '';
|
|
683
|
+
if ((_queryString.split(',').some(function (l) {
|
|
684
|
+
return l.charAt(0) === inputVal.toLowerCase();
|
|
685
|
+
}) || _queryString.split(',').some(function (l) {
|
|
686
|
+
return l.replace(/ /g, '').indexOf(inputVal.toLowerCase()) >= 0;
|
|
687
|
+
}) || _label.toLowerCase().indexOf(inputVal.toLowerCase()) >= 0) && inputVal != '') {
|
|
688
|
+
item.classList.remove('hide');
|
|
689
|
+
} else {
|
|
690
|
+
item.classList.add('hide');
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
items.forEach(function (item) {
|
|
694
|
+
if (inputVal === '') {
|
|
695
|
+
item.classList.remove('hide');
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
}
|
|
657
699
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
658
700
|
// data init
|
|
659
701
|
//--------------
|
|
@@ -662,7 +704,11 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
662
704
|
}, [value, options, data]);
|
|
663
705
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
664
706
|
className: wrapperClassName || wrapperClassName === '' ? "m-select__wrapper ".concat(wrapperClassName) : "m-select__wrapper mb-3",
|
|
665
|
-
ref: rootRef
|
|
707
|
+
ref: rootRef,
|
|
708
|
+
style: {
|
|
709
|
+
minWidth: WRAPPER_MIN_W === '' ? 'var(--m-select-wrapper-min-w)' : WRAPPER_MIN_W,
|
|
710
|
+
minHeight: WRAPPER_MIN_H === '' ? 'var(--m-select-wrapper-min-h)' : WRAPPER_MIN_H
|
|
711
|
+
}
|
|
666
712
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
667
713
|
className: "m-select-diving-line"
|
|
668
714
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
@@ -686,10 +732,22 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
686
732
|
className: "m-select__available__container"
|
|
687
733
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
688
734
|
className: "m-select__m-select__item-actions m-select__header"
|
|
735
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
736
|
+
className: "m-select__search__container"
|
|
689
737
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
|
690
738
|
type: "text",
|
|
691
|
-
|
|
692
|
-
|
|
739
|
+
value: changedSearchVal,
|
|
740
|
+
className: "m-select__search",
|
|
741
|
+
onChange: handleChangeSearch
|
|
742
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
|
|
743
|
+
width: "0.8em",
|
|
744
|
+
height: "0.8em",
|
|
745
|
+
fill: "#ddd",
|
|
746
|
+
viewBox: "0 0 16 16"
|
|
747
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
748
|
+
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",
|
|
749
|
+
fillRule: "evenodd"
|
|
750
|
+
})))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
693
751
|
className: "m-select__title",
|
|
694
752
|
dangerouslySetInnerHTML: {
|
|
695
753
|
__html: "".concat(availableHeaderTitle || '')
|
|
@@ -704,10 +762,11 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
704
762
|
}, dataInit ? dataInit.map(function (item, i) {
|
|
705
763
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
|
|
706
764
|
key: 'item' + i,
|
|
707
|
-
className: "".concat(item.disabled ? 'disabled' : '', " ").concat(valSelected
|
|
765
|
+
className: "".concat(item.disabled ? 'disabled' : '', " ").concat(multiSelControlOptionExist(valSelected, item.value) ? 'hide' : ''),
|
|
708
766
|
"data-index": i,
|
|
709
767
|
"data-value": "".concat(item.value),
|
|
710
768
|
"data-label": "".concat(item.label),
|
|
769
|
+
"data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
|
|
711
770
|
"data-disabled": item.disabled || 'false',
|
|
712
771
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
713
772
|
"data-itemdata": JSON.stringify(item)
|
|
@@ -759,6 +818,7 @@ var MultipleSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardR
|
|
|
759
818
|
"data-index": i,
|
|
760
819
|
"data-value": "".concat(item.value),
|
|
761
820
|
"data-label": "".concat(item.label),
|
|
821
|
+
"data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
|
|
762
822
|
"data-disabled": item.disabled || 'false',
|
|
763
823
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
764
824
|
"data-itemdata": JSON.stringify(item)
|
|
@@ -877,7 +877,7 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
877
877
|
var _queryIdsData = prevState.queryIds.slice(0, level + 1);
|
|
878
878
|
_valueData.splice(level, 1, resValue.id);
|
|
879
879
|
_labelData.splice(level, 1, resValue.name);
|
|
880
|
-
_queryIdsData.splice(level, 1, resValue.queryId);
|
|
880
|
+
if (Array.isArray(_queryIdsData)) _queryIdsData.splice(level, 1, resValue.queryId);
|
|
881
881
|
return {
|
|
882
882
|
labels: _labelData.filter(function (v) {
|
|
883
883
|
return v != '';
|
|
@@ -885,8 +885,10 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
885
885
|
values: _valueData.filter(function (v) {
|
|
886
886
|
return v.toString().indexOf('$EMPTY_ID_') < 0;
|
|
887
887
|
}),
|
|
888
|
-
queryIds: _queryIdsData.filter(function (v) {
|
|
888
|
+
queryIds: Array.isArray(_queryIdsData) ? _queryIdsData.filter(function (v) {
|
|
889
889
|
return v != undefined;
|
|
890
|
+
}) : _labelData.filter(function (v) {
|
|
891
|
+
return v != '';
|
|
890
892
|
})
|
|
891
893
|
};
|
|
892
894
|
});
|
|
@@ -1050,27 +1052,45 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
1050
1052
|
1: inputVal_1
|
|
1051
1053
|
};
|
|
1052
1054
|
}
|
|
1055
|
+
function cleanValue() {
|
|
1056
|
+
setSelectedData({
|
|
1057
|
+
labels: [],
|
|
1058
|
+
values: [],
|
|
1059
|
+
queryIds: []
|
|
1060
|
+
});
|
|
1061
|
+
setSelectedDataByClick({
|
|
1062
|
+
labels: [],
|
|
1063
|
+
values: [],
|
|
1064
|
+
queryIds: []
|
|
1065
|
+
});
|
|
1066
|
+
setAllData([]);
|
|
1067
|
+
setDictionaryData([]);
|
|
1068
|
+
setOptData([]);
|
|
1069
|
+
setData([]);
|
|
1070
|
+
setChangedVal('');
|
|
1071
|
+
setFirstDataFeched(false);
|
|
1072
|
+
}
|
|
1053
1073
|
function initDefaultValue(defaultValue) {
|
|
1054
1074
|
var _doFetch;
|
|
1075
|
+
// Determine whether the splicing value of the default value is empty
|
|
1076
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '') {
|
|
1077
|
+
var formattedDefaultValue = VALUE_BY_BRACES ? (0,extract.extractContentsOfBraces)(defaultValue) : defaultValue.split(',');
|
|
1078
|
+
var emptyDefaultValueCheck = formattedDefaultValue.every(function (item, index) {
|
|
1079
|
+
if (item !== '[]') {
|
|
1080
|
+
return false;
|
|
1081
|
+
}
|
|
1082
|
+
return true;
|
|
1083
|
+
});
|
|
1084
|
+
if (emptyDefaultValueCheck) {
|
|
1085
|
+
cleanValue();
|
|
1086
|
+
return; // required RETURN
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1055
1090
|
// change the value to trigger component rendering
|
|
1056
1091
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
values: [],
|
|
1060
|
-
queryIds: []
|
|
1061
|
-
});
|
|
1062
|
-
setSelectedDataByClick({
|
|
1063
|
-
labels: [],
|
|
1064
|
-
values: [],
|
|
1065
|
-
queryIds: []
|
|
1066
|
-
});
|
|
1067
|
-
setAllData([]);
|
|
1068
|
-
setDictionaryData([]);
|
|
1069
|
-
setOptData([]);
|
|
1070
|
-
setData([]);
|
|
1071
|
-
setChangedVal('');
|
|
1072
|
-
setFirstDataFeched(false);
|
|
1073
|
-
return;
|
|
1092
|
+
cleanValue();
|
|
1093
|
+
return; // required RETURN
|
|
1074
1094
|
} else {
|
|
1075
1095
|
setChangedVal(defaultValue);
|
|
1076
1096
|
}
|
|
@@ -2632,6 +2632,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
2632
2632
|
"data-label": "".concat(item.label),
|
|
2633
2633
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
2634
2634
|
"data-itemdata": JSON.stringify(item),
|
|
2635
|
+
"data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
|
|
2635
2636
|
role: "tab",
|
|
2636
2637
|
dangerouslySetInnerHTML: {
|
|
2637
2638
|
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
@@ -2652,6 +2653,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
2652
2653
|
"data-value": "".concat(item.value),
|
|
2653
2654
|
"data-label": "".concat(item.label),
|
|
2654
2655
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
2656
|
+
"data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
|
|
2655
2657
|
"data-itemdata": JSON.stringify(item),
|
|
2656
2658
|
role: "tab"
|
|
2657
2659
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
@@ -4,6 +4,8 @@ interface OptionConfig {
|
|
|
4
4
|
}
|
|
5
5
|
declare type MultipleSelectProps = {
|
|
6
6
|
wrapperClassName?: string;
|
|
7
|
+
wrapperMinHeight?: string;
|
|
8
|
+
wrapperMinWidth?: string;
|
|
7
9
|
availableHeaderTitle?: string;
|
|
8
10
|
selectedHeaderTitle?: string;
|
|
9
11
|
selectedHeaderNote?: string;
|
|
@@ -33,7 +35,7 @@ declare type MultipleSelectProps = {
|
|
|
33
35
|
fetchFuncMethodParams?: any[];
|
|
34
36
|
fetchCallback?: (data: any) => void;
|
|
35
37
|
onFetch?: (data: any) => void;
|
|
36
|
-
onChange?: (e: any, data: any, dataStr: any) => void;
|
|
38
|
+
onChange?: (e: any, data: any, dataStr: any, currentData: any, type: string) => void;
|
|
37
39
|
};
|
|
38
40
|
declare const MultipleSelect: React.ForwardRefExoticComponent<MultipleSelectProps & React.RefAttributes<unknown>>;
|
|
39
41
|
export default MultipleSelect;
|