funda-ui 4.7.333 → 4.7.345
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 +86 -86
- package/CascadingSelect/index.d.ts +21 -4
- package/CascadingSelect/index.js +209 -53
- package/CascadingSelectE2E/index.css +86 -86
- 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/Select/index.js +15 -10
- 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/Select/index.js +15 -10
- 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 +86 -86
- package/lib/css/CascadingSelectE2E/index.css +86 -86
- package/lib/esm/CascadingSelect/Group.tsx +4 -3
- package/lib/esm/CascadingSelect/index.scss +67 -65
- package/lib/esm/CascadingSelect/index.tsx +201 -60
- package/lib/esm/CascadingSelectE2E/Group.tsx +3 -3
- package/lib/esm/CascadingSelectE2E/index.scss +67 -65
- package/lib/esm/CascadingSelectE2E/index.tsx +235 -79
- package/lib/esm/Select/index.tsx +8 -8
- package/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -3
- package/lib/esm/Utils/libs/extract.ts +77 -3
- package/package.json +1 -1
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Determine whether an extractor is included
|
|
5
3
|
* @param {String} str => input string. such as 'a[1], b[2]', '{a[1]}'
|
|
@@ -78,9 +76,85 @@ function extractContentsOfParentheses(str: string, commaSeparated: boolean = fal
|
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
|
|
81
|
+
*
|
|
82
|
+
* Example:
|
|
83
|
+
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
|
|
84
|
+
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
|
|
85
|
+
*
|
|
86
|
+
* Output: [
|
|
87
|
+
* { label: "Poor", value: "c" },
|
|
88
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
89
|
+
* { label: "Empty", value: "" }
|
|
90
|
+
* ]
|
|
91
|
+
*
|
|
92
|
+
* @param {string} str - The input string containing one or more `{label[value]}` segments.
|
|
93
|
+
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
|
|
94
|
+
*/
|
|
95
|
+
function extractContentsOfMixedCharactersWithBraces(str: string): {
|
|
96
|
+
label: string;
|
|
97
|
+
value: string | number;
|
|
98
|
+
}[] {
|
|
99
|
+
// Fix the extra '{' at the beginning
|
|
100
|
+
const cleaned = str.replace(/^{{/, '{');
|
|
101
|
+
|
|
102
|
+
// Remove empty {} or {[]} tail
|
|
103
|
+
const trimmed = cleaned.replace(/\{\[\]\}$/, '');
|
|
104
|
+
|
|
105
|
+
// The match is like {label[value]}
|
|
106
|
+
const pattern = /\{(.*?)\[(.*?)\]\}/g;
|
|
107
|
+
const matches = Array.from(trimmed.matchAll(pattern));
|
|
108
|
+
|
|
109
|
+
return matches.map(match => ({
|
|
110
|
+
label: match[1],
|
|
111
|
+
value: match[2]
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
|
|
120
|
+
*
|
|
121
|
+
* Example:
|
|
122
|
+
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
|
|
123
|
+
* Output: [
|
|
124
|
+
* { label: "Poor", value: "c" },
|
|
125
|
+
* { label: "Sub-option 4", value: "c-2" },
|
|
126
|
+
* { label: "Empty", value: "" }
|
|
127
|
+
* ]
|
|
128
|
+
*
|
|
129
|
+
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
|
|
130
|
+
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
|
|
131
|
+
*/
|
|
132
|
+
function extractContentsOfMixedCharactersWithComma(str: string): {
|
|
133
|
+
label: string;
|
|
134
|
+
value: string | number;
|
|
135
|
+
}[] {
|
|
136
|
+
return str
|
|
137
|
+
.split(",")
|
|
138
|
+
.map(item => item.trim())
|
|
139
|
+
.map(item => {
|
|
140
|
+
const match = item.match(/^(.*?)\[(.*?)\]$/);
|
|
141
|
+
if (match) {
|
|
142
|
+
return {
|
|
143
|
+
label: match[1],
|
|
144
|
+
value: match[2]
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
})
|
|
149
|
+
.filter(Boolean) as { label: string; value: string | number }[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
81
153
|
export {
|
|
82
154
|
extractorExist,
|
|
83
155
|
extractContentsOfBrackets,
|
|
84
156
|
extractContentsOfBraces,
|
|
85
|
-
extractContentsOfParentheses
|
|
157
|
+
extractContentsOfParentheses,
|
|
158
|
+
extractContentsOfMixedCharactersWithBraces,
|
|
159
|
+
extractContentsOfMixedCharactersWithComma
|
|
86
160
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "4.7.
|
|
5
|
+
"version": "4.7.345",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|