funda-ui 4.7.335 → 4.7.445
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/CascadingSelect/index.css +88 -87
- package/CascadingSelect/index.d.ts +21 -4
- package/CascadingSelect/index.js +209 -53
- package/CascadingSelectE2E/index.css +88 -87
- package/CascadingSelectE2E/index.d.ts +22 -5
- package/CascadingSelectE2E/index.js +233 -69
- package/MultipleCheckboxes/index.js +71 -0
- package/MultipleSelect/index.js +71 -0
- package/Table/index.js +16 -1
- package/TagInput/index.js +71 -0
- package/Utils/extract.d.ts +39 -1
- package/Utils/extract.js +65 -0
- package/Utils/useDragDropPosition.d.ts +0 -3
- package/Utils/useDragDropPosition.js +0 -3
- package/lib/cjs/CascadingSelect/index.d.ts +21 -4
- package/lib/cjs/CascadingSelect/index.js +209 -53
- package/lib/cjs/CascadingSelectE2E/index.d.ts +22 -5
- package/lib/cjs/CascadingSelectE2E/index.js +233 -69
- package/lib/cjs/MultipleCheckboxes/index.js +71 -0
- package/lib/cjs/MultipleSelect/index.js +71 -0
- package/lib/cjs/Table/index.js +16 -1
- package/lib/cjs/TagInput/index.js +71 -0
- package/lib/cjs/Utils/extract.d.ts +39 -1
- package/lib/cjs/Utils/extract.js +65 -0
- package/lib/cjs/Utils/useDragDropPosition.d.ts +0 -3
- package/lib/cjs/Utils/useDragDropPosition.js +0 -3
- package/lib/css/CascadingSelect/index.css +88 -87
- package/lib/css/CascadingSelectE2E/index.css +88 -87
- package/lib/esm/CascadingSelect/Group.tsx +4 -3
- package/lib/esm/CascadingSelect/index.scss +69 -66
- package/lib/esm/CascadingSelect/index.tsx +201 -60
- package/lib/esm/CascadingSelectE2E/Group.tsx +3 -3
- package/lib/esm/CascadingSelectE2E/index.scss +69 -66
- package/lib/esm/CascadingSelectE2E/index.tsx +235 -79
- package/lib/esm/Table/Table.tsx +1 -0
- package/lib/esm/Table/TableCell.tsx +0 -1
- package/lib/esm/Table/utils/SortSprite.tsx +3 -0
- package/lib/esm/Table/utils/hooks/useTableSort.tsx +16 -1
- package/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -3
- package/lib/esm/Utils/libs/extract.ts +77 -3
- package/package.json +1 -1
|
@@ -462,6 +462,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
462
462
|
return (/* binding */_extractContentsOfBrackets
|
|
463
463
|
);
|
|
464
464
|
},
|
|
465
|
+
/* harmony export */"extractContentsOfMixedCharactersWithBraces": function extractContentsOfMixedCharactersWithBraces() {
|
|
466
|
+
return (/* binding */_extractContentsOfMixedCharactersWithBraces
|
|
467
|
+
);
|
|
468
|
+
},
|
|
469
|
+
/* harmony export */"extractContentsOfMixedCharactersWithComma": function extractContentsOfMixedCharactersWithComma() {
|
|
470
|
+
return (/* binding */_extractContentsOfMixedCharactersWithComma
|
|
471
|
+
);
|
|
472
|
+
},
|
|
465
473
|
/* harmony export */"extractContentsOfParentheses": function extractContentsOfParentheses() {
|
|
466
474
|
return (/* binding */_extractContentsOfParentheses
|
|
467
475
|
);
|
|
@@ -545,6 +553,69 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
545
553
|
}
|
|
546
554
|
}
|
|
547
555
|
|
|
556
|
+
/**
|
|
557
|
+
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
|
|
558
|
+
*
|
|
559
|
+
* Example:
|
|
560
|
+
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
|
|
561
|
+
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
|
|
562
|
+
*
|
|
563
|
+
* Output: [
|
|
564
|
+
* { label: "Poor", value: "c" },
|
|
565
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
566
|
+
* { label: "Empty", value: "" }
|
|
567
|
+
* ]
|
|
568
|
+
*
|
|
569
|
+
* @param {string} str - The input string containing one or more `{label[value]}` segments.
|
|
570
|
+
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
|
|
571
|
+
*/
|
|
572
|
+
function _extractContentsOfMixedCharactersWithBraces(str) {
|
|
573
|
+
// Fix the extra '{' at the beginning
|
|
574
|
+
var cleaned = str.replace(/^{{/, '{');
|
|
575
|
+
|
|
576
|
+
// Remove empty {} or {[]} tail
|
|
577
|
+
var trimmed = cleaned.replace(/\{\[\]\}$/, '');
|
|
578
|
+
|
|
579
|
+
// The match is like {label[value]}
|
|
580
|
+
var pattern = /\{(.*?)\[(.*?)\]\}/g;
|
|
581
|
+
var matches = Array.from(trimmed.matchAll(pattern));
|
|
582
|
+
return matches.map(function (match) {
|
|
583
|
+
return {
|
|
584
|
+
label: match[1],
|
|
585
|
+
value: match[2]
|
|
586
|
+
};
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
|
|
592
|
+
*
|
|
593
|
+
* Example:
|
|
594
|
+
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
|
|
595
|
+
* Output: [
|
|
596
|
+
* { label: "Poor", value: "c" },
|
|
597
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
598
|
+
* { label: "Empty", value: "" }
|
|
599
|
+
* ]
|
|
600
|
+
*
|
|
601
|
+
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
|
|
602
|
+
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
|
|
603
|
+
*/
|
|
604
|
+
function _extractContentsOfMixedCharactersWithComma(str) {
|
|
605
|
+
return str.split(",").map(function (item) {
|
|
606
|
+
return item.trim();
|
|
607
|
+
}).map(function (item) {
|
|
608
|
+
var match = item.match(/^(.*?)\[(.*?)\]$/);
|
|
609
|
+
if (match) {
|
|
610
|
+
return {
|
|
611
|
+
label: match[1],
|
|
612
|
+
value: match[2]
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
return null;
|
|
616
|
+
}).filter(Boolean);
|
|
617
|
+
}
|
|
618
|
+
|
|
548
619
|
/******/
|
|
549
620
|
return __webpack_exports__;
|
|
550
621
|
/******/
|
package/MultipleSelect/index.js
CHANGED
|
@@ -2269,6 +2269,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
2269
2269
|
return (/* binding */_extractContentsOfBrackets
|
|
2270
2270
|
);
|
|
2271
2271
|
},
|
|
2272
|
+
/* harmony export */"extractContentsOfMixedCharactersWithBraces": function extractContentsOfMixedCharactersWithBraces() {
|
|
2273
|
+
return (/* binding */_extractContentsOfMixedCharactersWithBraces
|
|
2274
|
+
);
|
|
2275
|
+
},
|
|
2276
|
+
/* harmony export */"extractContentsOfMixedCharactersWithComma": function extractContentsOfMixedCharactersWithComma() {
|
|
2277
|
+
return (/* binding */_extractContentsOfMixedCharactersWithComma
|
|
2278
|
+
);
|
|
2279
|
+
},
|
|
2272
2280
|
/* harmony export */"extractContentsOfParentheses": function extractContentsOfParentheses() {
|
|
2273
2281
|
return (/* binding */_extractContentsOfParentheses
|
|
2274
2282
|
);
|
|
@@ -2352,6 +2360,69 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
2352
2360
|
}
|
|
2353
2361
|
}
|
|
2354
2362
|
|
|
2363
|
+
/**
|
|
2364
|
+
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
|
|
2365
|
+
*
|
|
2366
|
+
* Example:
|
|
2367
|
+
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
|
|
2368
|
+
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
|
|
2369
|
+
*
|
|
2370
|
+
* Output: [
|
|
2371
|
+
* { label: "Poor", value: "c" },
|
|
2372
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
2373
|
+
* { label: "Empty", value: "" }
|
|
2374
|
+
* ]
|
|
2375
|
+
*
|
|
2376
|
+
* @param {string} str - The input string containing one or more `{label[value]}` segments.
|
|
2377
|
+
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
|
|
2378
|
+
*/
|
|
2379
|
+
function _extractContentsOfMixedCharactersWithBraces(str) {
|
|
2380
|
+
// Fix the extra '{' at the beginning
|
|
2381
|
+
var cleaned = str.replace(/^{{/, '{');
|
|
2382
|
+
|
|
2383
|
+
// Remove empty {} or {[]} tail
|
|
2384
|
+
var trimmed = cleaned.replace(/\{\[\]\}$/, '');
|
|
2385
|
+
|
|
2386
|
+
// The match is like {label[value]}
|
|
2387
|
+
var pattern = /\{(.*?)\[(.*?)\]\}/g;
|
|
2388
|
+
var matches = Array.from(trimmed.matchAll(pattern));
|
|
2389
|
+
return matches.map(function (match) {
|
|
2390
|
+
return {
|
|
2391
|
+
label: match[1],
|
|
2392
|
+
value: match[2]
|
|
2393
|
+
};
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
|
|
2399
|
+
*
|
|
2400
|
+
* Example:
|
|
2401
|
+
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
|
|
2402
|
+
* Output: [
|
|
2403
|
+
* { label: "Poor", value: "c" },
|
|
2404
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
2405
|
+
* { label: "Empty", value: "" }
|
|
2406
|
+
* ]
|
|
2407
|
+
*
|
|
2408
|
+
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
|
|
2409
|
+
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
|
|
2410
|
+
*/
|
|
2411
|
+
function _extractContentsOfMixedCharactersWithComma(str) {
|
|
2412
|
+
return str.split(",").map(function (item) {
|
|
2413
|
+
return item.trim();
|
|
2414
|
+
}).map(function (item) {
|
|
2415
|
+
var match = item.match(/^(.*?)\[(.*?)\]$/);
|
|
2416
|
+
if (match) {
|
|
2417
|
+
return {
|
|
2418
|
+
label: match[1],
|
|
2419
|
+
value: match[2]
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
return null;
|
|
2423
|
+
}).filter(Boolean);
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2355
2426
|
/******/
|
|
2356
2427
|
return __webpack_exports__;
|
|
2357
2428
|
/******/
|
package/Table/index.js
CHANGED
|
@@ -2087,6 +2087,8 @@ function useTableSort(_ref, deps) {
|
|
|
2087
2087
|
data = _ref.data,
|
|
2088
2088
|
spyElement = _ref.spyElement,
|
|
2089
2089
|
fieldType = _ref.fieldType,
|
|
2090
|
+
_ref$isReverse = _ref.isReverse,
|
|
2091
|
+
isReverse = _ref$isReverse === void 0 ? false : _ref$isReverse,
|
|
2090
2092
|
onColSort = _ref.onColSort,
|
|
2091
2093
|
onClick = _ref.onClick;
|
|
2092
2094
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
@@ -2125,7 +2127,17 @@ function useTableSort(_ref, deps) {
|
|
|
2125
2127
|
node.classList.add('newsort');
|
|
2126
2128
|
});
|
|
2127
2129
|
setInverse(!inverse);
|
|
2128
|
-
|
|
2130
|
+
|
|
2131
|
+
// result
|
|
2132
|
+
if (filterType == 'text') {
|
|
2133
|
+
return isReverse ? txt1.localeCompare(txt2, 'zh-CN', {
|
|
2134
|
+
sensitivity: 'base'
|
|
2135
|
+
}) : txt2.localeCompare(txt1, 'zh-CN', {
|
|
2136
|
+
sensitivity: 'base'
|
|
2137
|
+
});
|
|
2138
|
+
} else {
|
|
2139
|
+
return isReverse ? txt1 < txt2 ? -1 : txt1 > txt2 ? 1 : 0 : txt2 < txt1 ? -1 : txt2 > txt1 ? 1 : 0;
|
|
2140
|
+
}
|
|
2129
2141
|
};
|
|
2130
2142
|
targetComparator.sort(sortBy);
|
|
2131
2143
|
|
|
@@ -2177,6 +2189,8 @@ var SortSprite = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_re
|
|
|
2177
2189
|
var fieldType = props.fieldType,
|
|
2178
2190
|
className = props.className,
|
|
2179
2191
|
icon = props.icon,
|
|
2192
|
+
_props$isReverse = props.isReverse,
|
|
2193
|
+
isReverse = _props$isReverse === void 0 ? false : _props$isReverse,
|
|
2180
2194
|
onClick = props.onClick;
|
|
2181
2195
|
var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(TableContext),
|
|
2182
2196
|
originData = _useContext.originData,
|
|
@@ -2191,6 +2205,7 @@ var SortSprite = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_re
|
|
|
2191
2205
|
spyElement: rootRef.current,
|
|
2192
2206
|
fieldType: fieldType,
|
|
2193
2207
|
onColSort: onColSort,
|
|
2208
|
+
isReverse: isReverse,
|
|
2194
2209
|
onClick: onClick
|
|
2195
2210
|
}, [rootRef]),
|
|
2196
2211
|
handleSortList = _useTableSort.handleSortList;
|
package/TagInput/index.js
CHANGED
|
@@ -462,6 +462,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
462
462
|
return (/* binding */_extractContentsOfBrackets
|
|
463
463
|
);
|
|
464
464
|
},
|
|
465
|
+
/* harmony export */"extractContentsOfMixedCharactersWithBraces": function extractContentsOfMixedCharactersWithBraces() {
|
|
466
|
+
return (/* binding */_extractContentsOfMixedCharactersWithBraces
|
|
467
|
+
);
|
|
468
|
+
},
|
|
469
|
+
/* harmony export */"extractContentsOfMixedCharactersWithComma": function extractContentsOfMixedCharactersWithComma() {
|
|
470
|
+
return (/* binding */_extractContentsOfMixedCharactersWithComma
|
|
471
|
+
);
|
|
472
|
+
},
|
|
465
473
|
/* harmony export */"extractContentsOfParentheses": function extractContentsOfParentheses() {
|
|
466
474
|
return (/* binding */_extractContentsOfParentheses
|
|
467
475
|
);
|
|
@@ -545,6 +553,69 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
545
553
|
}
|
|
546
554
|
}
|
|
547
555
|
|
|
556
|
+
/**
|
|
557
|
+
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
|
|
558
|
+
*
|
|
559
|
+
* Example:
|
|
560
|
+
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
|
|
561
|
+
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
|
|
562
|
+
*
|
|
563
|
+
* Output: [
|
|
564
|
+
* { label: "Poor", value: "c" },
|
|
565
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
566
|
+
* { label: "Empty", value: "" }
|
|
567
|
+
* ]
|
|
568
|
+
*
|
|
569
|
+
* @param {string} str - The input string containing one or more `{label[value]}` segments.
|
|
570
|
+
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
|
|
571
|
+
*/
|
|
572
|
+
function _extractContentsOfMixedCharactersWithBraces(str) {
|
|
573
|
+
// Fix the extra '{' at the beginning
|
|
574
|
+
var cleaned = str.replace(/^{{/, '{');
|
|
575
|
+
|
|
576
|
+
// Remove empty {} or {[]} tail
|
|
577
|
+
var trimmed = cleaned.replace(/\{\[\]\}$/, '');
|
|
578
|
+
|
|
579
|
+
// The match is like {label[value]}
|
|
580
|
+
var pattern = /\{(.*?)\[(.*?)\]\}/g;
|
|
581
|
+
var matches = Array.from(trimmed.matchAll(pattern));
|
|
582
|
+
return matches.map(function (match) {
|
|
583
|
+
return {
|
|
584
|
+
label: match[1],
|
|
585
|
+
value: match[2]
|
|
586
|
+
};
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
|
|
592
|
+
*
|
|
593
|
+
* Example:
|
|
594
|
+
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
|
|
595
|
+
* Output: [
|
|
596
|
+
* { label: "Poor", value: "c" },
|
|
597
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
598
|
+
* { label: "Empty", value: "" }
|
|
599
|
+
* ]
|
|
600
|
+
*
|
|
601
|
+
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
|
|
602
|
+
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
|
|
603
|
+
*/
|
|
604
|
+
function _extractContentsOfMixedCharactersWithComma(str) {
|
|
605
|
+
return str.split(",").map(function (item) {
|
|
606
|
+
return item.trim();
|
|
607
|
+
}).map(function (item) {
|
|
608
|
+
var match = item.match(/^(.*?)\[(.*?)\]$/);
|
|
609
|
+
if (match) {
|
|
610
|
+
return {
|
|
611
|
+
label: match[1],
|
|
612
|
+
value: match[2]
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
return null;
|
|
616
|
+
}).filter(Boolean);
|
|
617
|
+
}
|
|
618
|
+
|
|
548
619
|
/******/
|
|
549
620
|
return __webpack_exports__;
|
|
550
621
|
/******/
|
package/Utils/extract.d.ts
CHANGED
|
@@ -25,4 +25,42 @@ declare function extractContentsOfBraces(str: string, commaSeparated?: boolean):
|
|
|
25
25
|
* @returns {Array<string>|string} such as: ['1,2','f','c']
|
|
26
26
|
*/
|
|
27
27
|
declare function extractContentsOfParentheses(str: string, commaSeparated?: boolean): Array<string> | string;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
|
|
30
|
+
*
|
|
31
|
+
* Example:
|
|
32
|
+
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
|
|
33
|
+
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
|
|
34
|
+
*
|
|
35
|
+
* Output: [
|
|
36
|
+
* { label: "Poor", value: "c" },
|
|
37
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
38
|
+
* { label: "Empty", value: "" }
|
|
39
|
+
* ]
|
|
40
|
+
*
|
|
41
|
+
* @param {string} str - The input string containing one or more `{label[value]}` segments.
|
|
42
|
+
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
|
|
43
|
+
*/
|
|
44
|
+
declare function extractContentsOfMixedCharactersWithBraces(str: string): {
|
|
45
|
+
label: string;
|
|
46
|
+
value: string | number;
|
|
47
|
+
}[];
|
|
48
|
+
/**
|
|
49
|
+
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
|
|
50
|
+
*
|
|
51
|
+
* Example:
|
|
52
|
+
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
|
|
53
|
+
* Output: [
|
|
54
|
+
* { label: "Poor", value: "c" },
|
|
55
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
56
|
+
* { label: "Empty", value: "" }
|
|
57
|
+
* ]
|
|
58
|
+
*
|
|
59
|
+
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
|
|
60
|
+
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
|
|
61
|
+
*/
|
|
62
|
+
declare function extractContentsOfMixedCharactersWithComma(str: string): {
|
|
63
|
+
label: string;
|
|
64
|
+
value: string | number;
|
|
65
|
+
}[];
|
|
66
|
+
export { extractorExist, extractContentsOfBrackets, extractContentsOfBraces, extractContentsOfParentheses, extractContentsOfMixedCharactersWithBraces, extractContentsOfMixedCharactersWithComma };
|
package/Utils/extract.js
CHANGED
|
@@ -48,6 +48,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
48
48
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
49
49
|
/* harmony export */ "extractContentsOfBraces": () => (/* binding */ extractContentsOfBraces),
|
|
50
50
|
/* harmony export */ "extractContentsOfBrackets": () => (/* binding */ extractContentsOfBrackets),
|
|
51
|
+
/* harmony export */ "extractContentsOfMixedCharactersWithBraces": () => (/* binding */ extractContentsOfMixedCharactersWithBraces),
|
|
52
|
+
/* harmony export */ "extractContentsOfMixedCharactersWithComma": () => (/* binding */ extractContentsOfMixedCharactersWithComma),
|
|
51
53
|
/* harmony export */ "extractContentsOfParentheses": () => (/* binding */ extractContentsOfParentheses),
|
|
52
54
|
/* harmony export */ "extractorExist": () => (/* binding */ extractorExist)
|
|
53
55
|
/* harmony export */ });
|
|
@@ -124,6 +126,69 @@ function extractContentsOfParentheses(str) {
|
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
|
|
131
|
+
*
|
|
132
|
+
* Example:
|
|
133
|
+
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
|
|
134
|
+
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
|
|
135
|
+
*
|
|
136
|
+
* Output: [
|
|
137
|
+
* { label: "Poor", value: "c" },
|
|
138
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
139
|
+
* { label: "Empty", value: "" }
|
|
140
|
+
* ]
|
|
141
|
+
*
|
|
142
|
+
* @param {string} str - The input string containing one or more `{label[value]}` segments.
|
|
143
|
+
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
|
|
144
|
+
*/
|
|
145
|
+
function extractContentsOfMixedCharactersWithBraces(str) {
|
|
146
|
+
// Fix the extra '{' at the beginning
|
|
147
|
+
var cleaned = str.replace(/^{{/, '{');
|
|
148
|
+
|
|
149
|
+
// Remove empty {} or {[]} tail
|
|
150
|
+
var trimmed = cleaned.replace(/\{\[\]\}$/, '');
|
|
151
|
+
|
|
152
|
+
// The match is like {label[value]}
|
|
153
|
+
var pattern = /\{(.*?)\[(.*?)\]\}/g;
|
|
154
|
+
var matches = Array.from(trimmed.matchAll(pattern));
|
|
155
|
+
return matches.map(function (match) {
|
|
156
|
+
return {
|
|
157
|
+
label: match[1],
|
|
158
|
+
value: match[2]
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
|
|
165
|
+
*
|
|
166
|
+
* Example:
|
|
167
|
+
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
|
|
168
|
+
* Output: [
|
|
169
|
+
* { label: "Poor", value: "c" },
|
|
170
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
171
|
+
* { label: "Empty", value: "" }
|
|
172
|
+
* ]
|
|
173
|
+
*
|
|
174
|
+
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
|
|
175
|
+
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
|
|
176
|
+
*/
|
|
177
|
+
function extractContentsOfMixedCharactersWithComma(str) {
|
|
178
|
+
return str.split(",").map(function (item) {
|
|
179
|
+
return item.trim();
|
|
180
|
+
}).map(function (item) {
|
|
181
|
+
var match = item.match(/^(.*?)\[(.*?)\]$/);
|
|
182
|
+
if (match) {
|
|
183
|
+
return {
|
|
184
|
+
label: match[1],
|
|
185
|
+
value: match[2]
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}).filter(Boolean);
|
|
190
|
+
}
|
|
191
|
+
|
|
127
192
|
/******/ return __webpack_exports__;
|
|
128
193
|
/******/ })()
|
|
129
194
|
;
|
|
@@ -101,9 +101,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
101
101
|
*
|
|
102
102
|
* @usage:
|
|
103
103
|
|
|
104
|
-
import { useState, useCallback } from 'react';
|
|
105
|
-
import { useDragDropPosition } from '@/utils/hooks/useDragDropPosition';
|
|
106
|
-
|
|
107
104
|
const App = () => {
|
|
108
105
|
|
|
109
106
|
const [show, setShow] = useState<boolean>(false);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare type CascadingSelectOptionChangeFnType = (input: any, currentData: any, index: any, depth: any, value:
|
|
2
|
+
export declare type CascadingSelectOptionChangeFnType = (input: any, currentData: any, index: any, depth: any, value: string, closeFunc: any) => void;
|
|
3
3
|
export declare type CascadingSelectProps = {
|
|
4
4
|
popupRef?: React.ForwardedRef<any>;
|
|
5
5
|
wrapperClassName?: string;
|
|
6
6
|
controlClassName?: string;
|
|
7
7
|
controlExClassName?: string;
|
|
8
|
+
controlGroupWrapperClassName?: string;
|
|
9
|
+
controlGroupTextClassName?: string;
|
|
8
10
|
searchable?: boolean;
|
|
9
11
|
searchPlaceholder?: string;
|
|
10
12
|
perColumnHeadersShow?: boolean;
|
|
@@ -13,8 +15,15 @@ export declare type CascadingSelectProps = {
|
|
|
13
15
|
label?: React.ReactNode | string;
|
|
14
16
|
name?: string;
|
|
15
17
|
placeholder?: string;
|
|
18
|
+
readOnly?: any;
|
|
16
19
|
disabled?: any;
|
|
17
20
|
required?: any;
|
|
21
|
+
requiredLabel?: React.ReactNode | string;
|
|
22
|
+
units?: React.ReactNode | string;
|
|
23
|
+
iconLeft?: React.ReactNode | string;
|
|
24
|
+
iconRight?: React.ReactNode | string;
|
|
25
|
+
minLength?: any;
|
|
26
|
+
maxLength?: any;
|
|
18
27
|
/** Whether to use curly braces to save result and initialize default value */
|
|
19
28
|
extractValueByBraces?: boolean;
|
|
20
29
|
/** Set headers for each column group */
|
|
@@ -31,8 +40,8 @@ export declare type CascadingSelectProps = {
|
|
|
31
40
|
/** Set a loader component to show while the component waits for the next load of data.
|
|
32
41
|
* e.g. `<span>Loading...</span>` or any fancy loader element */
|
|
33
42
|
loader?: React.ReactNode;
|
|
34
|
-
/** Whether
|
|
35
|
-
|
|
43
|
+
/** Whether it can be modified in the input box */
|
|
44
|
+
inputable?: boolean;
|
|
36
45
|
/** Set an arrow of breadcrumb result */
|
|
37
46
|
displayResultArrow?: React.ReactNode;
|
|
38
47
|
/** Set an arrow of control */
|
|
@@ -58,6 +67,14 @@ export declare type CascadingSelectProps = {
|
|
|
58
67
|
onChange?: CascadingSelectOptionChangeFnType | null;
|
|
59
68
|
onBlur?: (e: any) => void;
|
|
60
69
|
onFocus?: (e: any) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Customize the function of formatting the value of the input input box, and the parameters are labels, values, and queryIds
|
|
72
|
+
* Returns a string as the value of the input
|
|
73
|
+
*/
|
|
74
|
+
formatInputResult?: (param: Array<{
|
|
75
|
+
label: string;
|
|
76
|
+
value: string | number;
|
|
77
|
+
}>) => string;
|
|
61
78
|
};
|
|
62
|
-
declare const CascadingSelect:
|
|
79
|
+
declare const CascadingSelect: React.ForwardRefExoticComponent<CascadingSelectProps & React.RefAttributes<unknown>>;
|
|
63
80
|
export default CascadingSelect;
|