funda-ui 1.0.607 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/index.js +82 -75
- package/CascadingSelect/index.d.ts +2 -0
- package/CascadingSelect/index.js +132 -4
- package/CascadingSelectE2E/index.d.ts +2 -0
- package/CascadingSelectE2E/index.js +142 -7
- package/MultipleCheckboxes/index.d.ts +3 -1
- package/MultipleCheckboxes/index.js +131 -4
- package/TagInput/index.d.ts +3 -1
- package/TagInput/index.js +145 -7
- package/lib/cjs/Accordion/index.js +82 -75
- package/lib/cjs/CascadingSelect/index.d.ts +2 -0
- package/lib/cjs/CascadingSelect/index.js +132 -4
- package/lib/cjs/CascadingSelectE2E/index.d.ts +2 -0
- package/lib/cjs/CascadingSelectE2E/index.js +142 -7
- package/lib/cjs/MultipleCheckboxes/index.d.ts +3 -1
- package/lib/cjs/MultipleCheckboxes/index.js +131 -4
- package/lib/cjs/TagInput/index.d.ts +3 -1
- package/lib/cjs/TagInput/index.js +145 -7
- package/lib/esm/Accordion/AccordionItem.tsx +1 -1
- package/lib/esm/Accordion/utils/anim.js +2 -94
- package/lib/esm/Accordion/utils/init-default-options.js +98 -0
- package/lib/esm/CascadingSelect/index.tsx +15 -3
- package/lib/esm/CascadingSelect/utils/convert.js +55 -0
- package/lib/esm/CascadingSelect/utils/extract.js +57 -0
- package/lib/esm/CascadingSelectE2E/index.tsx +125 -119
- package/lib/esm/CascadingSelectE2E/utils/convert.js +55 -0
- package/lib/esm/CascadingSelectE2E/utils/extract.js +57 -0
- package/lib/esm/MultipleCheckboxes/index.tsx +10 -4
- package/lib/esm/MultipleCheckboxes/utils/convert.js +55 -0
- package/lib/esm/MultipleCheckboxes/utils/extract.js +57 -0
- package/lib/esm/TagInput/index.tsx +12 -5
- package/lib/esm/TagInput/utils/convert.js +55 -0
- package/lib/esm/TagInput/utils/extract.js +57 -0
- package/package.json +1 -1
package/Accordion/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var _require = __webpack_require__(711),
|
|
|
20
20
|
easeInQuad = _require.easeInQuad,
|
|
21
21
|
easeOutQuad = _require.easeOutQuad,
|
|
22
22
|
easeInOutQuad = _require.easeInOutQuad;
|
|
23
|
+
var setDefaultOptions = __webpack_require__(337);
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Element Animate
|
|
@@ -98,80 +99,6 @@ function animateStyles(curElement, config) {
|
|
|
98
99
|
};
|
|
99
100
|
requestId = window.requestAnimationFrame(loop);
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Check if a string is a valid number
|
|
104
|
-
* @private
|
|
105
|
-
*/
|
|
106
|
-
function isValidNumeric(str) {
|
|
107
|
-
if (typeof str != "string") return false; // we only process strings!
|
|
108
|
-
if (!isNaN(str) &&
|
|
109
|
-
// use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)
|
|
110
|
-
!isNaN(parseFloat(str)) // ensure strings of whitespace fail
|
|
111
|
-
) {
|
|
112
|
-
return true;
|
|
113
|
-
} else {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Determine whether it is in JSON format
|
|
120
|
-
* @private
|
|
121
|
-
*/
|
|
122
|
-
function isJSON(str) {
|
|
123
|
-
if (typeof str === 'string' && str.length > 0) {
|
|
124
|
-
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
125
|
-
return false;
|
|
126
|
-
} else {
|
|
127
|
-
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
128
|
-
return true;
|
|
129
|
-
} else {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
135
|
-
return true;
|
|
136
|
-
} else {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Set a default JSON format configuration
|
|
144
|
-
* @private
|
|
145
|
-
*
|
|
146
|
-
* @param {JSON} props - Set some default keys and values.
|
|
147
|
-
* @param {JSON} options - A JSON variable passed in from outside, including key and value.
|
|
148
|
-
* @return {JSON} - Merge the new and old values.
|
|
149
|
-
*/
|
|
150
|
-
function setDefaultOptions(props, options) {
|
|
151
|
-
if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
|
|
152
|
-
//Set a default configuration
|
|
153
|
-
if (isJSON(props)) {
|
|
154
|
-
var defaultConfigValues = Object.values(props);
|
|
155
|
-
Object.keys(props).forEach(function (prop, index) {
|
|
156
|
-
// Well-formed string type
|
|
157
|
-
Object.keys(options).forEach(function (prop2, index2) {
|
|
158
|
-
if (prop2 === prop) {
|
|
159
|
-
var _v = options[prop2];
|
|
160
|
-
if (_v == 'true') _v = true;
|
|
161
|
-
if (_v == 'false') _v = false;
|
|
162
|
-
if (isValidNumeric(_v)) _v = parseFloat(_v);
|
|
163
|
-
if (isJSON(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
|
|
164
|
-
options[prop2] = _v;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
//
|
|
169
|
-
if (_typeof(options[prop]) === ( true ? "undefined" : 0) || options[prop] === null) options[prop] = defaultConfigValues[index];
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
return options;
|
|
173
|
-
}
|
|
174
|
-
;
|
|
175
102
|
module.exports = animateStyles;
|
|
176
103
|
|
|
177
104
|
/***/ }),
|
|
@@ -348,6 +275,86 @@ module.exports = {
|
|
|
348
275
|
|
|
349
276
|
/***/ }),
|
|
350
277
|
|
|
278
|
+
/***/ 337:
|
|
279
|
+
/***/ ((module) => {
|
|
280
|
+
|
|
281
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
282
|
+
/**
|
|
283
|
+
* Set a default JSON format configuration
|
|
284
|
+
* @public
|
|
285
|
+
*
|
|
286
|
+
* @param {JSON} props - Set some default keys and values.
|
|
287
|
+
* @param {JSON} options - A JSON variable passed in from outside, including key and value.
|
|
288
|
+
* @return {JSON} - Merge the new and old values.
|
|
289
|
+
*/
|
|
290
|
+
function setDefaultOptions(props, options) {
|
|
291
|
+
if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
|
|
292
|
+
//Set a default configuration
|
|
293
|
+
if (isJSON(props)) {
|
|
294
|
+
var defaultConfigValues = Object.values(props);
|
|
295
|
+
Object.keys(props).forEach(function (prop, index) {
|
|
296
|
+
// Well-formed string type
|
|
297
|
+
Object.keys(options).forEach(function (prop2, index2) {
|
|
298
|
+
if (prop2 === prop) {
|
|
299
|
+
var _v = options[prop2];
|
|
300
|
+
if (_v == 'true') _v = true;
|
|
301
|
+
if (_v == 'false') _v = false;
|
|
302
|
+
if (isValidNumeric(_v)) _v = parseFloat(_v);
|
|
303
|
+
if (isJSON(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
|
|
304
|
+
options[prop2] = _v;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
//
|
|
309
|
+
if (_typeof(options[prop]) === ( true ? "undefined" : 0) || options[prop] === null) options[prop] = defaultConfigValues[index];
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return options;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Check if a string is a valid number
|
|
317
|
+
* @private
|
|
318
|
+
*/
|
|
319
|
+
function isValidNumeric(str) {
|
|
320
|
+
if (typeof str != "string") return false; // we only process strings!
|
|
321
|
+
if (!isNaN(str) &&
|
|
322
|
+
// use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)
|
|
323
|
+
!isNaN(parseFloat(str)) // ensure strings of whitespace fail
|
|
324
|
+
) {
|
|
325
|
+
return true;
|
|
326
|
+
} else {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Determine whether it is in JSON format
|
|
333
|
+
* @private
|
|
334
|
+
*/
|
|
335
|
+
function isJSON(str) {
|
|
336
|
+
if (typeof str === 'string' && str.length > 0) {
|
|
337
|
+
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
338
|
+
return false;
|
|
339
|
+
} else {
|
|
340
|
+
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
341
|
+
return true;
|
|
342
|
+
} else {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
348
|
+
return true;
|
|
349
|
+
} else {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
module.exports = setDefaultOptions;
|
|
355
|
+
|
|
356
|
+
/***/ }),
|
|
357
|
+
|
|
351
358
|
/***/ 787:
|
|
352
359
|
/***/ ((module) => {
|
|
353
360
|
|
|
@@ -470,7 +477,7 @@ var AccordionItem = function AccordionItem(props) {
|
|
|
470
477
|
var _contentPadding = window.getComputedStyle(contentRef.current).getPropertyValue('padding-bottom');
|
|
471
478
|
observer.current = new ResizeObserver(function (entries) {
|
|
472
479
|
entries.forEach(function (entry) {
|
|
473
|
-
contentWrapperRef.current.style.height = entry.contentRect.bottom + parseFloat(_contentPadding) + 'px';
|
|
480
|
+
if (contentWrapperRef.current !== null) contentWrapperRef.current.style.height = entry.contentRect.bottom + parseFloat(_contentPadding) + 'px';
|
|
474
481
|
});
|
|
475
482
|
});
|
|
476
483
|
observer.current.observe(contentRef.current);
|
|
@@ -14,6 +14,8 @@ declare type CascadingSelectProps = {
|
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
disabled?: any;
|
|
16
16
|
required?: any;
|
|
17
|
+
/** Whether to use square brackets to save result and initialize default value */
|
|
18
|
+
extractValueByBrackets?: boolean;
|
|
17
19
|
/** Set headers for each column group */
|
|
18
20
|
columnTitle?: any[];
|
|
19
21
|
/** Set whether to use "label" or "value" for the value of this form, they will be separated by commas, such as `Text 1,Text 1_1,Text 1_1_1` or `1,1_1,1_1_1`.
|
package/CascadingSelect/index.js
CHANGED
|
@@ -11,6 +11,125 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
+
/***/ 498:
|
|
15
|
+
/***/ ((module) => {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convert value to string separated by square brackets
|
|
19
|
+
* @param {String} str such as: 1,2,3
|
|
20
|
+
* @returns {String} such as: [1][2][3]
|
|
21
|
+
*/
|
|
22
|
+
function convertStringByCommaToValByBrackets(str) {
|
|
23
|
+
if (typeof str === 'undefined') return '';
|
|
24
|
+
if (str.length === 0) return '';
|
|
25
|
+
return str.split(',').map(function (v) {
|
|
26
|
+
return v.includes('[') && v.includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
27
|
+
}).join('');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Convert array value to string separated by square brackets
|
|
32
|
+
* @param {Array} arr such as: ['1','2','3']
|
|
33
|
+
* @returns {String} such as: [1][2][3]
|
|
34
|
+
*/
|
|
35
|
+
function convertArrToValByBrackets(arr) {
|
|
36
|
+
if (!Array.isArray(arr)) return '';
|
|
37
|
+
return arr.map(function (v) {
|
|
38
|
+
return v.includes('[') && v.includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
39
|
+
}).join('');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Convert value to string separated by curly braces
|
|
44
|
+
* @param {String} str such as: 1,2,3
|
|
45
|
+
* @returns {String} such as: {1}{2}{3}
|
|
46
|
+
*/
|
|
47
|
+
function convertStringByCommaToValByBraces(str) {
|
|
48
|
+
if (typeof str === 'undefined') return '';
|
|
49
|
+
if (str.length === 0) return '';
|
|
50
|
+
return str.split(',').map(function (v) {
|
|
51
|
+
return v.includes('{') && v.includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
52
|
+
}).join('');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Convert array value to string separated by curly braces
|
|
57
|
+
* @param {Array} arr such as: ['1','2','3']
|
|
58
|
+
* @returns {String} such as: {1}{2}{3}
|
|
59
|
+
*/
|
|
60
|
+
function convertArrToValByBraces(arr) {
|
|
61
|
+
if (!Array.isArray(arr)) return '';
|
|
62
|
+
return arr.map(function (v) {
|
|
63
|
+
return v.includes('{') && v.includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
64
|
+
}).join('');
|
|
65
|
+
}
|
|
66
|
+
module.exports = {
|
|
67
|
+
convertStringByCommaToValByBrackets: convertStringByCommaToValByBrackets,
|
|
68
|
+
convertArrToValByBrackets: convertArrToValByBrackets,
|
|
69
|
+
convertStringByCommaToValByBraces: convertStringByCommaToValByBraces,
|
|
70
|
+
convertArrToValByBraces: convertArrToValByBraces
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/***/ }),
|
|
74
|
+
|
|
75
|
+
/***/ 368:
|
|
76
|
+
/***/ ((module) => {
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Extract the contents of square brackets
|
|
80
|
+
* @param {String} str => input string. such as '[1,2] [f][c]'
|
|
81
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
82
|
+
*/
|
|
83
|
+
function extractContentsOfBrackets(str) {
|
|
84
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
85
|
+
if (typeof str === 'undefined') return '';
|
|
86
|
+
var res = str.match(/[^\[]+(?=(\[ \])|\])/g);
|
|
87
|
+
if (commaSeparated) {
|
|
88
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
89
|
+
} else {
|
|
90
|
+
return res === null ? '' : res;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Extract the contents of curly braces
|
|
96
|
+
* @param {String} str => input string. such as '{1,2} {f}{c}'
|
|
97
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
98
|
+
*/
|
|
99
|
+
function extractContentsOfBraces(str) {
|
|
100
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
101
|
+
if (typeof str === 'undefined') return '';
|
|
102
|
+
var res = str.match(/[^\{]+(?=(\{ \})|\})/g);
|
|
103
|
+
if (commaSeparated) {
|
|
104
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
105
|
+
} else {
|
|
106
|
+
return res === null ? '' : res;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Extract the contents of parentheses
|
|
112
|
+
* @param {String} str => input string. such as '(1,2) (f)(c)'
|
|
113
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
114
|
+
*/
|
|
115
|
+
function extractContentsOfParentheses(str) {
|
|
116
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
117
|
+
if (typeof str === 'undefined') return '';
|
|
118
|
+
var res = str.match(/[^\(]+(?=(\( \))|\))/g);
|
|
119
|
+
if (commaSeparated) {
|
|
120
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
121
|
+
} else {
|
|
122
|
+
return res === null ? '' : res;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
module.exports = {
|
|
126
|
+
extractContentsOfBrackets: extractContentsOfBrackets,
|
|
127
|
+
extractContentsOfBraces: extractContentsOfBraces,
|
|
128
|
+
extractContentsOfParentheses: extractContentsOfParentheses
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/***/ }),
|
|
132
|
+
|
|
14
133
|
/***/ 342:
|
|
15
134
|
/***/ ((module) => {
|
|
16
135
|
|
|
@@ -193,8 +312,12 @@ function Group(props) {
|
|
|
193
312
|
}
|
|
194
313
|
}));
|
|
195
314
|
}
|
|
315
|
+
// EXTERNAL MODULE: ./src/utils/extract.js
|
|
316
|
+
var extract = __webpack_require__(368);
|
|
317
|
+
// EXTERNAL MODULE: ./src/utils/convert.js
|
|
318
|
+
var convert = __webpack_require__(498);
|
|
196
319
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
197
|
-
var _excluded = ["wrapperClassName", "controlClassName", "disabled", "required", "value", "label", "placeholder", "name", "id", "columnTitle", "depth", "loader", "displayResult", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur", "onFocus"];
|
|
320
|
+
var _excluded = ["wrapperClassName", "controlClassName", "disabled", "required", "value", "label", "placeholder", "name", "id", "extractValueByBrackets", "columnTitle", "depth", "loader", "displayResult", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur", "onFocus"];
|
|
198
321
|
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; }
|
|
199
322
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
200
323
|
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."); }
|
|
@@ -215,6 +338,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
215
338
|
|
|
216
339
|
|
|
217
340
|
|
|
341
|
+
|
|
342
|
+
|
|
218
343
|
var CascadingSelect = function CascadingSelect(props) {
|
|
219
344
|
var wrapperClassName = props.wrapperClassName,
|
|
220
345
|
controlClassName = props.controlClassName,
|
|
@@ -225,6 +350,7 @@ var CascadingSelect = function CascadingSelect(props) {
|
|
|
225
350
|
placeholder = props.placeholder,
|
|
226
351
|
name = props.name,
|
|
227
352
|
id = props.id,
|
|
353
|
+
extractValueByBrackets = props.extractValueByBrackets,
|
|
228
354
|
columnTitle = props.columnTitle,
|
|
229
355
|
depth = props.depth,
|
|
230
356
|
loader = props.loader,
|
|
@@ -246,6 +372,7 @@ var CascadingSelect = function CascadingSelect(props) {
|
|
|
246
372
|
onBlur = props.onBlur,
|
|
247
373
|
onFocus = props.onFocus,
|
|
248
374
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
375
|
+
var VALUE_BY_BRACKETS = typeof extractValueByBrackets === 'undefined' ? true : extractValueByBrackets;
|
|
249
376
|
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)();
|
|
250
377
|
var idRes = id || uniqueID;
|
|
251
378
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
@@ -533,8 +660,8 @@ var CascadingSelect = function CascadingSelect(props) {
|
|
|
533
660
|
|
|
534
661
|
// update selected data
|
|
535
662
|
//////////////////////////////////////////
|
|
536
|
-
var inputVal_0 = _valueData.join(',');
|
|
537
|
-
var inputVal_1 = _labelData.join(',');
|
|
663
|
+
var inputVal_0 = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(_valueData) : _valueData.join(',');
|
|
664
|
+
var inputVal_1 = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(_labelData) : _labelData.join(',');
|
|
538
665
|
if (valueType === 'value') {
|
|
539
666
|
if (inputEl !== null) setChangedVal(inputVal_0);
|
|
540
667
|
} else {
|
|
@@ -565,7 +692,8 @@ var CascadingSelect = function CascadingSelect(props) {
|
|
|
565
692
|
var _data = response[1];
|
|
566
693
|
if (defaultValue) {
|
|
567
694
|
var rowQueryAttr = valueType === 'value' ? 'id' : 'name';
|
|
568
|
-
var targetVal = defaultValue.split(',');
|
|
695
|
+
var targetVal = VALUE_BY_BRACKETS ? (0,extract.extractContentsOfBrackets)(defaultValue) : defaultValue.split(',');
|
|
696
|
+
|
|
569
697
|
//
|
|
570
698
|
var _allColumnsData = [];
|
|
571
699
|
var _allLables = [];
|
|
@@ -23,6 +23,8 @@ declare type CascadingSelectE2EProps = {
|
|
|
23
23
|
placeholder?: string;
|
|
24
24
|
disabled?: any;
|
|
25
25
|
required?: any;
|
|
26
|
+
/** Whether to use curly braces to save result and initialize default value */
|
|
27
|
+
extractValueByBraces?: boolean;
|
|
26
28
|
/** Instead of using `parent_id` of response to match child and parent data
|
|
27
29
|
* (very useful for multiple fetch requests with no directly related fields),
|
|
28
30
|
* this operation will directly use the click event to modify the result. */
|
|
@@ -11,6 +11,125 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
+
/***/ 498:
|
|
15
|
+
/***/ ((module) => {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convert value to string separated by square brackets
|
|
19
|
+
* @param {String} str such as: 1,2,3
|
|
20
|
+
* @returns {String} such as: [1][2][3]
|
|
21
|
+
*/
|
|
22
|
+
function convertStringByCommaToValByBrackets(str) {
|
|
23
|
+
if (typeof str === 'undefined') return '';
|
|
24
|
+
if (str.length === 0) return '';
|
|
25
|
+
return str.split(',').map(function (v) {
|
|
26
|
+
return v.includes('[') && v.includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
27
|
+
}).join('');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Convert array value to string separated by square brackets
|
|
32
|
+
* @param {Array} arr such as: ['1','2','3']
|
|
33
|
+
* @returns {String} such as: [1][2][3]
|
|
34
|
+
*/
|
|
35
|
+
function convertArrToValByBrackets(arr) {
|
|
36
|
+
if (!Array.isArray(arr)) return '';
|
|
37
|
+
return arr.map(function (v) {
|
|
38
|
+
return v.includes('[') && v.includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
39
|
+
}).join('');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Convert value to string separated by curly braces
|
|
44
|
+
* @param {String} str such as: 1,2,3
|
|
45
|
+
* @returns {String} such as: {1}{2}{3}
|
|
46
|
+
*/
|
|
47
|
+
function convertStringByCommaToValByBraces(str) {
|
|
48
|
+
if (typeof str === 'undefined') return '';
|
|
49
|
+
if (str.length === 0) return '';
|
|
50
|
+
return str.split(',').map(function (v) {
|
|
51
|
+
return v.includes('{') && v.includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
52
|
+
}).join('');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Convert array value to string separated by curly braces
|
|
57
|
+
* @param {Array} arr such as: ['1','2','3']
|
|
58
|
+
* @returns {String} such as: {1}{2}{3}
|
|
59
|
+
*/
|
|
60
|
+
function convertArrToValByBraces(arr) {
|
|
61
|
+
if (!Array.isArray(arr)) return '';
|
|
62
|
+
return arr.map(function (v) {
|
|
63
|
+
return v.includes('{') && v.includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
64
|
+
}).join('');
|
|
65
|
+
}
|
|
66
|
+
module.exports = {
|
|
67
|
+
convertStringByCommaToValByBrackets: convertStringByCommaToValByBrackets,
|
|
68
|
+
convertArrToValByBrackets: convertArrToValByBrackets,
|
|
69
|
+
convertStringByCommaToValByBraces: convertStringByCommaToValByBraces,
|
|
70
|
+
convertArrToValByBraces: convertArrToValByBraces
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/***/ }),
|
|
74
|
+
|
|
75
|
+
/***/ 368:
|
|
76
|
+
/***/ ((module) => {
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Extract the contents of square brackets
|
|
80
|
+
* @param {String} str => input string. such as '[1,2] [f][c]'
|
|
81
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
82
|
+
*/
|
|
83
|
+
function extractContentsOfBrackets(str) {
|
|
84
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
85
|
+
if (typeof str === 'undefined') return '';
|
|
86
|
+
var res = str.match(/[^\[]+(?=(\[ \])|\])/g);
|
|
87
|
+
if (commaSeparated) {
|
|
88
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
89
|
+
} else {
|
|
90
|
+
return res === null ? '' : res;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Extract the contents of curly braces
|
|
96
|
+
* @param {String} str => input string. such as '{1,2} {f}{c}'
|
|
97
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
98
|
+
*/
|
|
99
|
+
function extractContentsOfBraces(str) {
|
|
100
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
101
|
+
if (typeof str === 'undefined') return '';
|
|
102
|
+
var res = str.match(/[^\{]+(?=(\{ \})|\})/g);
|
|
103
|
+
if (commaSeparated) {
|
|
104
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
105
|
+
} else {
|
|
106
|
+
return res === null ? '' : res;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Extract the contents of parentheses
|
|
112
|
+
* @param {String} str => input string. such as '(1,2) (f)(c)'
|
|
113
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
114
|
+
*/
|
|
115
|
+
function extractContentsOfParentheses(str) {
|
|
116
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
117
|
+
if (typeof str === 'undefined') return '';
|
|
118
|
+
var res = str.match(/[^\(]+(?=(\( \))|\))/g);
|
|
119
|
+
if (commaSeparated) {
|
|
120
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
121
|
+
} else {
|
|
122
|
+
return res === null ? '' : res;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
module.exports = {
|
|
126
|
+
extractContentsOfBrackets: extractContentsOfBrackets,
|
|
127
|
+
extractContentsOfBraces: extractContentsOfBraces,
|
|
128
|
+
extractContentsOfParentheses: extractContentsOfParentheses
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/***/ }),
|
|
132
|
+
|
|
14
133
|
/***/ 342:
|
|
15
134
|
/***/ ((module) => {
|
|
16
135
|
|
|
@@ -344,10 +463,14 @@ function Group(props) {
|
|
|
344
463
|
}
|
|
345
464
|
}));
|
|
346
465
|
}
|
|
466
|
+
// EXTERNAL MODULE: ./src/utils/extract.js
|
|
467
|
+
var extract = __webpack_require__(368);
|
|
468
|
+
// EXTERNAL MODULE: ./src/utils/convert.js
|
|
469
|
+
var convert = __webpack_require__(498);
|
|
347
470
|
// EXTERNAL MODULE: ./src/utils/tree.js
|
|
348
471
|
var tree = __webpack_require__(602);
|
|
349
472
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
350
|
-
var _excluded = ["wrapperClassName", "controlClassName", "disabled", "required", "value", "label", "placeholder", "name", "id", "destroyParentIdMatch", "columnTitle", "depth", "loader", "displayResult", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "fetchArray", "onFetch", "onChange", "onBlur", "onFocus"];
|
|
473
|
+
var _excluded = ["wrapperClassName", "controlClassName", "disabled", "required", "value", "label", "placeholder", "name", "id", "extractValueByBraces", "destroyParentIdMatch", "columnTitle", "depth", "loader", "displayResult", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "fetchArray", "onFetch", "onChange", "onBlur", "onFocus"];
|
|
351
474
|
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; }
|
|
352
475
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
353
476
|
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."); }
|
|
@@ -369,6 +492,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
369
492
|
|
|
370
493
|
|
|
371
494
|
|
|
495
|
+
|
|
496
|
+
|
|
372
497
|
var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
373
498
|
var wrapperClassName = props.wrapperClassName,
|
|
374
499
|
controlClassName = props.controlClassName,
|
|
@@ -379,6 +504,7 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
379
504
|
placeholder = props.placeholder,
|
|
380
505
|
name = props.name,
|
|
381
506
|
id = props.id,
|
|
507
|
+
extractValueByBraces = props.extractValueByBraces,
|
|
382
508
|
destroyParentIdMatch = props.destroyParentIdMatch,
|
|
383
509
|
columnTitle = props.columnTitle,
|
|
384
510
|
depth = props.depth,
|
|
@@ -398,6 +524,7 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
398
524
|
onBlur = props.onBlur,
|
|
399
525
|
onFocus = props.onFocus,
|
|
400
526
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
527
|
+
var VALUE_BY_BRACES = typeof extractValueByBraces === 'undefined' ? true : extractValueByBraces;
|
|
401
528
|
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)();
|
|
402
529
|
var idRes = id || uniqueID;
|
|
403
530
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
@@ -895,10 +1022,14 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
895
1022
|
_labelData = selectedDataByClick.labels;
|
|
896
1023
|
_queryIdsData = selectedDataByClick.queryIds;
|
|
897
1024
|
}
|
|
898
|
-
var inputVal_0 = _valueData.map(function (item, i) {
|
|
1025
|
+
var inputVal_0 = VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(_valueData.map(function (item, i) {
|
|
1026
|
+
return "".concat(item, "[").concat(_queryIdsData[i], "]");
|
|
1027
|
+
})) : _valueData.map(function (item, i) {
|
|
899
1028
|
return "".concat(item, "[").concat(_queryIdsData[i], "]");
|
|
900
1029
|
}).join(',');
|
|
901
|
-
var inputVal_1 = _labelData.map(function (item, i) {
|
|
1030
|
+
var inputVal_1 = VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(_labelData.map(function (item, i) {
|
|
1031
|
+
return "".concat(item, "[").concat(_queryIdsData[i], "]");
|
|
1032
|
+
})) : _labelData.map(function (item, i) {
|
|
902
1033
|
return "".concat(item, "[").concat(_queryIdsData[i], "]");
|
|
903
1034
|
}).join(',');
|
|
904
1035
|
if (valueType === 'value') {
|
|
@@ -945,9 +1076,9 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
945
1076
|
var allFetch = [];
|
|
946
1077
|
var rowQueryAttr = valueType === 'value' ? 'id' : 'name';
|
|
947
1078
|
var targetVal = defaultValue.match(/(\[.*?\])/gi).map(function (item, i) {
|
|
948
|
-
return defaultValue.split(',')[i].replace(item, '');
|
|
1079
|
+
return VALUE_BY_BRACES ? (0,extract.extractContentsOfBraces)(defaultValue)[i].replace(item, '') : defaultValue.split(',')[i].replace(item, '');
|
|
949
1080
|
});
|
|
950
|
-
var queryIds =
|
|
1081
|
+
var queryIds = (0,extract.extractContentsOfBrackets)(defaultValue);
|
|
951
1082
|
|
|
952
1083
|
//
|
|
953
1084
|
var _TEMP_ALL_DATA = [];
|
|
@@ -1311,9 +1442,13 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
1311
1442
|
name: name,
|
|
1312
1443
|
className: controlClassName || controlClassName === '' ? controlClassName : "form-control",
|
|
1313
1444
|
placeholder: placeholder,
|
|
1314
|
-
value: destroyParentIdMatch ? valueType === 'value' ? selectedDataByClick.values.map(function (item, i) {
|
|
1445
|
+
value: destroyParentIdMatch ? valueType === 'value' ? VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(selectedDataByClick.values.map(function (item, i) {
|
|
1446
|
+
return "".concat(item, "[").concat(selectedDataByClick.queryIds[i], "]");
|
|
1447
|
+
})) : selectedDataByClick.values.map(function (item, i) {
|
|
1448
|
+
return "".concat(item, "[").concat(selectedDataByClick.queryIds[i], "]");
|
|
1449
|
+
}).join(',') : VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(selectedDataByClick.labels.map(function (item, i) {
|
|
1315
1450
|
return "".concat(item, "[").concat(selectedDataByClick.queryIds[i], "]");
|
|
1316
|
-
})
|
|
1451
|
+
})) : selectedDataByClick.labels.map(function (item, i) {
|
|
1317
1452
|
return "".concat(item, "[").concat(selectedDataByClick.queryIds[i], "]");
|
|
1318
1453
|
}).join(',') : changedVal // placeholder will not change if defaultValue is used
|
|
1319
1454
|
,
|