funda-ui 1.0.280 → 1.0.285
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.js +0 -20
- package/CascadingSelectE2E/index.js +0 -20
- package/ColorPicker/index.js +0 -20
- package/DynamicFields/index.d.ts +8 -5
- package/DynamicFields/index.js +61 -210
- package/Input/index.js +0 -20
- package/MultiFuncSelect/index.js +0 -29
- package/README.md +1 -1
- package/RangeSlider/index.js +0 -43
- package/TagInput/index.js +0 -20
- package/Textarea/index.js +0 -20
- package/lib/cjs/CascadingSelect/index.js +0 -20
- package/lib/cjs/CascadingSelectE2E/index.js +0 -20
- package/lib/cjs/ColorPicker/index.js +0 -20
- package/lib/cjs/DynamicFields/index.d.ts +8 -5
- package/lib/cjs/DynamicFields/index.js +61 -210
- package/lib/cjs/Input/index.js +0 -20
- package/lib/cjs/MultiFuncSelect/index.js +0 -29
- package/lib/cjs/RangeSlider/index.js +0 -43
- package/lib/cjs/TagInput/index.js +0 -20
- package/lib/cjs/Textarea/index.js +0 -20
- package/lib/esm/CascadingSelect/index.tsx +0 -21
- package/lib/esm/CascadingSelectE2E/index.tsx +0 -21
- package/lib/esm/ColorPicker/index.tsx +0 -21
- package/lib/esm/DynamicFields/index.tsx +84 -274
- package/lib/esm/Input/index.tsx +0 -22
- package/lib/esm/MultiFuncSelect/index.tsx +0 -32
- package/lib/esm/RangeSlider/index.tsx +0 -24
- package/lib/esm/TagInput/index.tsx +0 -23
- package/lib/esm/Textarea/index.tsx +0 -22
- package/package.json +1 -1
package/CascadingSelect/index.js
CHANGED
|
@@ -817,23 +817,6 @@ var CascadingSelect = function CascadingSelect(props) {
|
|
|
817
817
|
//--------------
|
|
818
818
|
initDefaultValue(value);
|
|
819
819
|
|
|
820
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
821
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
822
|
-
var timer = null;
|
|
823
|
-
var initTimes = 0;
|
|
824
|
-
var hasValue = false;
|
|
825
|
-
timer = setInterval(function () {
|
|
826
|
-
if (initTimes > 5 || hasValue) {
|
|
827
|
-
clearInterval(timer);
|
|
828
|
-
} else {
|
|
829
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
830
|
-
initDefaultValue(valRef.current.value);
|
|
831
|
-
hasValue = true;
|
|
832
|
-
}
|
|
833
|
-
initTimes++;
|
|
834
|
-
}
|
|
835
|
-
}, 500);
|
|
836
|
-
|
|
837
820
|
//
|
|
838
821
|
//--------------
|
|
839
822
|
document.removeEventListener('pointerdown', handleClickOutside);
|
|
@@ -850,9 +833,6 @@ var CascadingSelect = function CascadingSelect(props) {
|
|
|
850
833
|
document.removeEventListener('pointerdown', handleClickOutside);
|
|
851
834
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
852
835
|
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
853
|
-
|
|
854
|
-
//
|
|
855
|
-
clearInterval(timer);
|
|
856
836
|
};
|
|
857
837
|
}, [value]);
|
|
858
838
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
@@ -985,23 +985,6 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
985
985
|
//--------------
|
|
986
986
|
initDefaultValue(value);
|
|
987
987
|
|
|
988
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
989
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
990
|
-
var timer = null;
|
|
991
|
-
var initTimes = 0;
|
|
992
|
-
var hasValue = false;
|
|
993
|
-
timer = setInterval(function () {
|
|
994
|
-
if (initTimes > 5 || hasValue) {
|
|
995
|
-
clearInterval(timer);
|
|
996
|
-
} else {
|
|
997
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
998
|
-
initDefaultValue(valRef.current.value);
|
|
999
|
-
hasValue = true;
|
|
1000
|
-
}
|
|
1001
|
-
initTimes++;
|
|
1002
|
-
}
|
|
1003
|
-
}, 500);
|
|
1004
|
-
|
|
1005
988
|
//
|
|
1006
989
|
//--------------
|
|
1007
990
|
document.removeEventListener('pointerdown', handleClickOutside);
|
|
@@ -1018,9 +1001,6 @@ var CascadingSelectE2E = function CascadingSelectE2E(props) {
|
|
|
1018
1001
|
document.removeEventListener('pointerdown', handleClickOutside);
|
|
1019
1002
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1020
1003
|
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1021
|
-
|
|
1022
|
-
//
|
|
1023
|
-
clearInterval(timer);
|
|
1024
1004
|
};
|
|
1025
1005
|
}, [value]);
|
|
1026
1006
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
package/ColorPicker/index.js
CHANGED
|
@@ -180,26 +180,6 @@ var ColorPicker = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)
|
|
|
180
180
|
// update default value
|
|
181
181
|
//--------------
|
|
182
182
|
setChangedVal(value || '');
|
|
183
|
-
|
|
184
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
185
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
186
|
-
var timer = null;
|
|
187
|
-
var initTimes = 0;
|
|
188
|
-
var hasValue = false;
|
|
189
|
-
timer = setInterval(function () {
|
|
190
|
-
if (initTimes > 5 || hasValue) {
|
|
191
|
-
clearInterval(timer);
|
|
192
|
-
} else {
|
|
193
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
194
|
-
setChangedVal(valRef.current.value);
|
|
195
|
-
hasValue = true;
|
|
196
|
-
}
|
|
197
|
-
initTimes++;
|
|
198
|
-
}
|
|
199
|
-
}, 500);
|
|
200
|
-
return function () {
|
|
201
|
-
clearInterval(timer);
|
|
202
|
-
};
|
|
203
183
|
}, [value]);
|
|
204
184
|
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", {
|
|
205
185
|
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
package/DynamicFields/index.d.ts
CHANGED
|
@@ -4,23 +4,26 @@ declare module 'react' {
|
|
|
4
4
|
children?: any;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
declare type DynamicFieldsValueProps = {
|
|
8
|
+
init: React.ReactNode[];
|
|
9
|
+
tmpl: React.ReactNode;
|
|
10
|
+
};
|
|
7
11
|
declare type DynamicFieldsProps = {
|
|
8
12
|
wrapperClassName?: string;
|
|
9
13
|
value?: string;
|
|
10
14
|
label?: React.ReactNode | string;
|
|
11
|
-
|
|
15
|
+
data: DynamicFieldsValueProps | null;
|
|
12
16
|
maxFields?: any;
|
|
13
17
|
confirmText?: string;
|
|
18
|
+
doNotRemoveDom?: boolean;
|
|
14
19
|
iconAddBefore?: React.ReactNode | string;
|
|
15
20
|
iconAddAfter?: React.ReactNode | string;
|
|
16
21
|
iconAdd?: React.ReactNode | string;
|
|
17
22
|
iconRemove?: React.ReactNode | string;
|
|
18
|
-
startFromZero?: boolean;
|
|
19
23
|
/** -- */
|
|
20
24
|
id?: string;
|
|
21
|
-
onAdd?: () => void;
|
|
22
|
-
onRemove?: () => void;
|
|
23
|
-
onComplete?: () => void;
|
|
25
|
+
onAdd?: (items: HTMLDivElement[]) => void;
|
|
26
|
+
onRemove?: (items: HTMLDivElement[], key: number | string, index: number | string) => void;
|
|
24
27
|
};
|
|
25
28
|
declare const DynamicFields: (props: DynamicFieldsProps) => JSX.Element;
|
|
26
29
|
export default DynamicFields;
|
package/DynamicFields/index.js
CHANGED
|
@@ -109,20 +109,19 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
109
109
|
|
|
110
110
|
var DynamicFields = function DynamicFields(props) {
|
|
111
111
|
var wrapperClassName = props.wrapperClassName,
|
|
112
|
-
value = props.value,
|
|
113
112
|
label = props.label,
|
|
114
|
-
|
|
113
|
+
data = props.data,
|
|
115
114
|
maxFields = props.maxFields,
|
|
116
115
|
iconAddBefore = props.iconAddBefore,
|
|
117
116
|
iconAddAfter = props.iconAddAfter,
|
|
118
117
|
iconAdd = props.iconAdd,
|
|
119
118
|
iconRemove = props.iconRemove,
|
|
120
|
-
|
|
119
|
+
doNotRemoveDom = props.doNotRemoveDom,
|
|
121
120
|
id = props.id,
|
|
122
121
|
confirmText = props.confirmText,
|
|
123
122
|
onAdd = props.onAdd,
|
|
124
|
-
onRemove = props.onRemove
|
|
125
|
-
|
|
123
|
+
onRemove = props.onRemove;
|
|
124
|
+
var DO_NOT_REMOVE_DOM = typeof doNotRemoveDom === 'undefined' ? false : true;
|
|
126
125
|
var uniqueID = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)().replace(/\:/g, "-");
|
|
127
126
|
var idRes = id || uniqueID;
|
|
128
127
|
var rootRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
@@ -130,158 +129,12 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
130
129
|
var addBtnRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
131
130
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
132
131
|
_useState2 = _slicedToArray(_useState, 2),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
var startTimer = function startTimer() {
|
|
140
|
-
return new Promise(function (resolve, reject) {
|
|
141
|
-
//
|
|
142
|
-
timeoutIdRef.current = setTimeout(function () {
|
|
143
|
-
if (fieldsRef.current !== null) {
|
|
144
|
-
var _val = value ? JSON.parse('[' + value + ']') : [];
|
|
145
|
-
var controls = [].slice.call(document.querySelectorAll("#".concat(fieldsRef.current.id, " > .dynamic-fields__append [name]")));
|
|
146
|
-
var integratedControls = [];
|
|
147
|
-
var hasRadio = false;
|
|
148
|
-
controls.forEach(function (node, i) {
|
|
149
|
-
var controlType = '';
|
|
150
|
-
if (node.tagName == "INPUT" || node.tagName == "TEXTARTA") {
|
|
151
|
-
//not `radio`, `checkbox`
|
|
152
|
-
if (node.type != 'checkbox' && node.type != 'radio') {
|
|
153
|
-
controlType = 'input-textarea';
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
//`checkbox`
|
|
157
|
-
if (node.type == 'checkbox') {
|
|
158
|
-
controlType = 'checkbox';
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
//`radio`
|
|
162
|
-
if (node.type == 'radio') {
|
|
163
|
-
controlType = 'radio';
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
//`select`
|
|
168
|
-
if (node.tagName == "SELECT") {
|
|
169
|
-
controlType = 'select';
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
if (controlType === 'radio') {
|
|
174
|
-
hasRadio = true;
|
|
175
|
-
}
|
|
176
|
-
integratedControls.push({
|
|
177
|
-
target: node,
|
|
178
|
-
type: controlType
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// replace placeholder string
|
|
182
|
-
replacePlaceholderStr(node);
|
|
183
|
-
});
|
|
184
|
-
if (hasRadio) {
|
|
185
|
-
console.error('<DynamicFields /> cannot use the "radio" type, because it will have multiple duplicate names! \nThe following components are recommended: <Input />, <Textarea />, <Checkbox />, <Switch />, <MultiFuncSelect />, <Select />, <CascadingSelectE2E />, <CascadingSelect />, <TagInput />, <RangeSlider />.');
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
var resControls = groupByNum(integratedControls, Math.floor(integratedControls.length / _val.length));
|
|
189
|
-
_val.forEach(function (row, i) {
|
|
190
|
-
row.forEach(function (val, j) {
|
|
191
|
-
if (typeof resControls[i] !== 'undefined' && typeof resControls[i][j] !== 'undefined') {
|
|
192
|
-
var _control = resControls[i][j];
|
|
193
|
-
|
|
194
|
-
// set default value
|
|
195
|
-
// It is generally used for `<CascadingSelect />` and cascading `<Select />`
|
|
196
|
-
_control.target.dataset.value = val;
|
|
197
|
-
switch (_control.type) {
|
|
198
|
-
case "input-textarea":
|
|
199
|
-
// normal
|
|
200
|
-
_control.target.value = val;
|
|
201
|
-
|
|
202
|
-
// if it is checkbox
|
|
203
|
-
if (val === true) {
|
|
204
|
-
var _checkbox = _control.target.parentElement.querySelector('[data-checkbox]');
|
|
205
|
-
_checkbox.checked = val == true ? true : false;
|
|
206
|
-
_control.target.value = _checkbox.value;
|
|
207
|
-
}
|
|
208
|
-
break;
|
|
209
|
-
case "checkbox":
|
|
210
|
-
_control.target.checked = val == true ? true : false;
|
|
211
|
-
break;
|
|
212
|
-
case "select":
|
|
213
|
-
_control.target.value = val;
|
|
214
|
-
_control.target.dispatchEvent(new Event('change'));
|
|
215
|
-
break;
|
|
216
|
-
default:
|
|
217
|
-
_control.target.value = val;
|
|
218
|
-
} //end switch
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
//button status
|
|
224
|
-
checkMaxStatus();
|
|
225
|
-
|
|
226
|
-
//
|
|
227
|
-
resolve(timeoutIdRef.current);
|
|
228
|
-
}
|
|
229
|
-
}, controlRefreshValDelay);
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
var stopTimer = function stopTimer() {
|
|
233
|
-
clearTimeout(timeoutIdRef.current);
|
|
234
|
-
timeoutIdRef.current = null;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
//timer add
|
|
238
|
-
var timeoutAddIdRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
239
|
-
var startTimerAdd = function startTimerAdd() {
|
|
240
|
-
timeoutAddIdRef.current = setTimeout(function () {
|
|
241
|
-
if (fieldsRef.current !== null) {
|
|
242
|
-
var controls = [].slice.call(document.querySelectorAll("#".concat(fieldsRef.current.id, " > .dynamic-fields__append [name]")));
|
|
243
|
-
controls.forEach(function (node, i) {
|
|
244
|
-
// replace placeholder string
|
|
245
|
-
replacePlaceholderStr(node);
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}, controlRefreshValDelay);
|
|
249
|
-
};
|
|
250
|
-
var stopTimerAdd = function stopTimerAdd() {
|
|
251
|
-
clearTimeout(timeoutAddIdRef.current);
|
|
252
|
-
timeoutAddIdRef.current = null;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
//timer onComplete
|
|
256
|
-
var timeoutHandleCompleteIdRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
257
|
-
var startTimerHandleComplete = function startTimerHandleComplete() {
|
|
258
|
-
timeoutHandleCompleteIdRef.current = setTimeout(function () {
|
|
259
|
-
// Call a function when all dynamic components are rendered.
|
|
260
|
-
// It is usually used for cascading asynchronous components (can be triggered by routing updates)
|
|
261
|
-
onComplete === null || onComplete === void 0 ? void 0 : onComplete();
|
|
262
|
-
}, 500);
|
|
263
|
-
};
|
|
264
|
-
var stopTimerHandleComplete = function stopTimerHandleComplete() {
|
|
265
|
-
clearTimeout(timeoutHandleCompleteIdRef.current);
|
|
266
|
-
timeoutHandleCompleteIdRef.current = null;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
//
|
|
270
|
-
function replacePlaceholderStr(node) {
|
|
271
|
-
var _wapper = node.closest('.dynamic-fields__tmpl__wrapper');
|
|
272
|
-
if (_wapper === null) return;
|
|
273
|
-
var perKey = _wapper.dataset.key;
|
|
274
|
-
if (typeof node.id !== 'undefined') node.id = node.id.replace('%i%', perKey);
|
|
275
|
-
if (typeof node.name !== 'undefined') node.name = node.name.replace('%i%', perKey);
|
|
276
|
-
if (typeof node.dataset.id !== 'undefined') node.dataset.id = node.dataset.id.replace('%i%', perKey);
|
|
277
|
-
if (typeof node.dataset.name !== 'undefined') node.dataset.name = node.dataset.name.replace('%i%', perKey);
|
|
278
|
-
}
|
|
279
|
-
function groupByNum(arr, n) {
|
|
280
|
-
if (n === 0 || n === Infinity) return false;
|
|
281
|
-
var result = [];
|
|
282
|
-
for (var i = 0; i < arr.length; i += n) result.push(arr.slice(i, i + n));
|
|
283
|
-
return result;
|
|
284
|
-
}
|
|
132
|
+
val = _useState2[0],
|
|
133
|
+
setVal = _useState2[1];
|
|
134
|
+
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
135
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
136
|
+
tmpl = _useState4[0],
|
|
137
|
+
setTmpl = _useState4[1];
|
|
285
138
|
function checkMaxStatus() {
|
|
286
139
|
//button status
|
|
287
140
|
if (rootRef.current.querySelector('.dynamic-fields__append').children.length + 1 >= parseFloat(maxFields)) {
|
|
@@ -295,60 +148,58 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
295
148
|
checkMaxStatus();
|
|
296
149
|
|
|
297
150
|
//
|
|
298
|
-
|
|
299
|
-
return [].concat(_toConsumableArray(prevState),
|
|
151
|
+
setVal(function (prevState) {
|
|
152
|
+
return [].concat(_toConsumableArray(prevState), _toConsumableArray(generateGroup(tmpl)));
|
|
300
153
|
});
|
|
301
154
|
|
|
302
155
|
//
|
|
303
|
-
|
|
156
|
+
setTimeout(function () {
|
|
157
|
+
var perRow = [].slice.call(rootRef.current.querySelector('.dynamic-fields__append').children);
|
|
158
|
+
|
|
159
|
+
// update index
|
|
160
|
+
perRow.forEach(function (el, i) {
|
|
161
|
+
el.dataset.index = i.toString();
|
|
162
|
+
});
|
|
304
163
|
|
|
305
|
-
|
|
306
|
-
|
|
164
|
+
//
|
|
165
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(perRow);
|
|
166
|
+
}, 0);
|
|
307
167
|
}
|
|
308
|
-
function handleClickRemove(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
168
|
+
function handleClickRemove(e) {
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
var curKey = e.currentTarget.closest('.dynamic-fields__data__wrapper').dataset.key;
|
|
171
|
+
if (confirm(confirmText || '')) {
|
|
172
|
+
//button status
|
|
173
|
+
if (rootRef.current.querySelector('.dynamic-fields__append').children.length <= parseFloat(maxFields)) {
|
|
174
|
+
addBtnRef.current.style.setProperty('display', 'inline', 'important');
|
|
175
|
+
}
|
|
176
|
+
var curItem = rootRef.current.querySelector(".dynamic-fields__append [data-key=\"".concat(curKey, "\"]"));
|
|
177
|
+
var curIndex = curItem.dataset.index;
|
|
178
|
+
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove();
|
|
318
179
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
180
|
+
//
|
|
181
|
+
setTimeout(function () {
|
|
182
|
+
var perRow = [].slice.call(rootRef.current.querySelector('.dynamic-fields__append').children);
|
|
183
|
+
|
|
184
|
+
// update index
|
|
185
|
+
perRow.forEach(function (el, i) {
|
|
186
|
+
el.dataset.index = i.toString();
|
|
187
|
+
});
|
|
324
188
|
|
|
325
189
|
//
|
|
326
|
-
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function updateDisplayedControls() {
|
|
331
|
-
// update values for all displayed controls
|
|
332
|
-
// You need to wait for the asynchronous component to render
|
|
333
|
-
startTimer().then(function () {
|
|
334
|
-
startTimerHandleComplete();
|
|
335
|
-
});
|
|
190
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove(perRow, curKey, curIndex);
|
|
191
|
+
}, 0);
|
|
192
|
+
}
|
|
336
193
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"data-key": i
|
|
343
|
-
}, el.map(function (data, index) {
|
|
344
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), {
|
|
345
|
-
key: index
|
|
346
|
-
}, tempHtmlString);
|
|
347
|
-
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
194
|
+
function generateGroup(inputData) {
|
|
195
|
+
var isNew = !Array.isArray(inputData);
|
|
196
|
+
var _data = Array.isArray(inputData) ? inputData : [inputData];
|
|
197
|
+
return _data.map(function (item, i) {
|
|
198
|
+
var addBtn = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
348
199
|
href: "#",
|
|
349
200
|
tabIndex: -1,
|
|
350
201
|
className: "dynamic-fields__removebtn align-middle",
|
|
351
|
-
onClick: handleClickRemove
|
|
202
|
+
onClick: handleClickRemove
|
|
352
203
|
}, iconRemove ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, iconRemove) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
|
|
353
204
|
width: "20px",
|
|
354
205
|
height: "20px",
|
|
@@ -360,19 +211,19 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
360
211
|
d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z",
|
|
361
212
|
fill: "#000"
|
|
362
213
|
})))));
|
|
214
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
215
|
+
key: 'tmpl-' + i
|
|
216
|
+
}, isNew ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, item, addBtn) : /*#__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", {
|
|
217
|
+
className: "dynamic-fields__data__wrapper position-relative",
|
|
218
|
+
"data-key": i,
|
|
219
|
+
"data-index": i
|
|
220
|
+
}, item, addBtn)));
|
|
363
221
|
});
|
|
364
222
|
}
|
|
365
223
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
updateDisplayedControls();
|
|
370
|
-
return function () {
|
|
371
|
-
stopTimer();
|
|
372
|
-
stopTimerAdd();
|
|
373
|
-
stopTimerHandleComplete();
|
|
374
|
-
};
|
|
375
|
-
}, [value]);
|
|
224
|
+
setVal(data ? data.init : []);
|
|
225
|
+
setTmpl(data ? data.tmpl : null);
|
|
226
|
+
}, [data]);
|
|
376
227
|
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", {
|
|
377
228
|
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
|
378
229
|
ref: rootRef
|
|
@@ -385,7 +236,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
385
236
|
id: idRes
|
|
386
237
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
387
238
|
className: "dynamic-fields__append"
|
|
388
|
-
},
|
|
239
|
+
}, generateGroup(val)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
389
240
|
className: "dynamic-fields__btns"
|
|
390
241
|
}, iconAddBefore ? iconAddBefore : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
391
242
|
ref: addBtnRef,
|
package/Input/index.js
CHANGED
|
@@ -200,26 +200,6 @@ var Input = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(funct
|
|
|
200
200
|
// update default value
|
|
201
201
|
//--------------
|
|
202
202
|
setChangedVal(value || '');
|
|
203
|
-
|
|
204
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
205
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
206
|
-
var timer = null;
|
|
207
|
-
var initTimes = 0;
|
|
208
|
-
var hasValue = false;
|
|
209
|
-
timer = setInterval(function () {
|
|
210
|
-
if (initTimes > 5 || hasValue) {
|
|
211
|
-
clearInterval(timer);
|
|
212
|
-
} else {
|
|
213
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
214
|
-
setChangedVal(valRef.current.value);
|
|
215
|
-
hasValue = true;
|
|
216
|
-
}
|
|
217
|
-
initTimes++;
|
|
218
|
-
}
|
|
219
|
-
}, 500);
|
|
220
|
-
return function () {
|
|
221
|
-
clearInterval(timer);
|
|
222
|
-
};
|
|
223
203
|
}, [value]);
|
|
224
204
|
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", {
|
|
225
205
|
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
package/MultiFuncSelect/index.js
CHANGED
|
@@ -1417,32 +1417,6 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1417
1417
|
});
|
|
1418
1418
|
fetchData(_params.join(','), value);
|
|
1419
1419
|
|
|
1420
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
1421
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
1422
|
-
var timer = null;
|
|
1423
|
-
var initTimes = 0;
|
|
1424
|
-
var hasValue = false;
|
|
1425
|
-
timer = setInterval(function () {
|
|
1426
|
-
if (initTimes > 5 || hasValue) {
|
|
1427
|
-
clearInterval(timer);
|
|
1428
|
-
} else {
|
|
1429
|
-
// get value if the attribute `data-value` of component exists
|
|
1430
|
-
// Using `<DynamicFields />` will assign values according to `data-value`
|
|
1431
|
-
var incomingOptionsData = valueInputRef.current.dataset.options;
|
|
1432
|
-
if (valueInputRef.current !== null && typeof incomingOptionsData !== 'undefined' && typeof valueInputRef.current.dataset.value !== 'undefined' && valueInputRef.current.dataset.value !== '') {
|
|
1433
|
-
fetchData(_params.join(','), valueInputRef.current.dataset.value);
|
|
1434
|
-
hasValue = true;
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
//
|
|
1438
|
-
if (valueInputRef.current !== null && valueInputRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
1439
|
-
fetchData(_params.join(','), valueInputRef.current.value);
|
|
1440
|
-
hasValue = true;
|
|
1441
|
-
}
|
|
1442
|
-
initTimes++;
|
|
1443
|
-
}
|
|
1444
|
-
}, 500);
|
|
1445
|
-
|
|
1446
1420
|
// keyboard listener
|
|
1447
1421
|
//--------------
|
|
1448
1422
|
var listener = /*#__PURE__*/function () {
|
|
@@ -1549,9 +1523,6 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1549
1523
|
document.removeEventListener('pointerdown', handleClose);
|
|
1550
1524
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1551
1525
|
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1552
|
-
|
|
1553
|
-
//
|
|
1554
|
-
clearInterval(timer);
|
|
1555
1526
|
};
|
|
1556
1527
|
}, [value, options, data]);
|
|
1557
1528
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, label ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Here is a table of the components and their status.
|
|
|
39
39
|
| [Pagination ✅](packages/Pagination/README.md) | [Number ❏](packages/Number/README.md) | | |
|
|
40
40
|
| [Table ✅](packages/Table/README.md) | [SearchBar ✅](packages/SearchBar/README.md) | | |
|
|
41
41
|
| [Periodical Scroll ❏](packages/PeriodicalScroll/README.md) | [Switch ✅](packages/Switch/README.md) | | |
|
|
42
|
-
| [Progress Bar ❏](packages/ProgressBar/README.md) | [Dynamic Fields
|
|
42
|
+
| [Progress Bar ❏](packages/ProgressBar/README.md) | [Dynamic Fields ✅🔥](packages/DynamicFields/README.md) | | |
|
|
43
43
|
| [Rating ❏](packages/Rating/README.md) | [File ✅](packages/File/README.md) | | |
|
|
44
44
|
| [Seamless Scrolling Element ❏](packages/SeamlessScrollingElement/README.md) | [File Field ❏](packages/FileField/README.md) | | |
|
|
45
45
|
| [Show More Less ✅](packages/ShowMoreLess/README.md) | [Range Slider ✅](packages/RangeSlider/README.md) | | |
|
package/RangeSlider/index.js
CHANGED
|
@@ -342,26 +342,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
342
342
|
// update default value
|
|
343
343
|
//--------------
|
|
344
344
|
setChangedVal(value || '');
|
|
345
|
-
|
|
346
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
347
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
348
|
-
var timer = null;
|
|
349
|
-
var initTimes = 0;
|
|
350
|
-
var hasValue = false;
|
|
351
|
-
timer = setInterval(function () {
|
|
352
|
-
if (initTimes > 5 || hasValue) {
|
|
353
|
-
clearInterval(timer);
|
|
354
|
-
} else {
|
|
355
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
356
|
-
setChangedVal(valRef.current.value);
|
|
357
|
-
hasValue = true;
|
|
358
|
-
}
|
|
359
|
-
initTimes++;
|
|
360
|
-
}
|
|
361
|
-
}, 500);
|
|
362
|
-
return function () {
|
|
363
|
-
clearInterval(timer);
|
|
364
|
-
};
|
|
365
345
|
}, [value]);
|
|
366
346
|
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", {
|
|
367
347
|
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
|
@@ -623,29 +603,6 @@ var RangeSlider = function RangeSlider(props) {
|
|
|
623
603
|
// update default value
|
|
624
604
|
//--------------
|
|
625
605
|
initDefaultValue(value);
|
|
626
|
-
|
|
627
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
628
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
629
|
-
var timer = null;
|
|
630
|
-
var initTimes = 0;
|
|
631
|
-
var hasValue = false;
|
|
632
|
-
timer = setInterval(function () {
|
|
633
|
-
if (initTimes > 5 || hasValue) {
|
|
634
|
-
clearInterval(timer);
|
|
635
|
-
} else {
|
|
636
|
-
if (typeof value === 'undefined' || value === '') {
|
|
637
|
-
if (valMinRef.current !== null && valMaxRef.current !== null && valMinRef.current.value !== '' && valMaxRef.current.value !== '') initDefaultValue({
|
|
638
|
-
min: valMinRef.current.value,
|
|
639
|
-
max: valMaxRef.current.value
|
|
640
|
-
});
|
|
641
|
-
hasValue = true;
|
|
642
|
-
}
|
|
643
|
-
initTimes++;
|
|
644
|
-
}
|
|
645
|
-
}, 500);
|
|
646
|
-
return function () {
|
|
647
|
-
clearInterval(timer);
|
|
648
|
-
};
|
|
649
606
|
}, [value]);
|
|
650
607
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, label ? /*#__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", {
|
|
651
608
|
className: "range-slider__label"
|
package/TagInput/index.js
CHANGED
|
@@ -262,26 +262,6 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
262
262
|
// update default value
|
|
263
263
|
//--------------
|
|
264
264
|
initDefaultValue(value);
|
|
265
|
-
|
|
266
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
267
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
268
|
-
var timer = null;
|
|
269
|
-
var initTimes = 0;
|
|
270
|
-
var hasValue = false;
|
|
271
|
-
timer = setInterval(function () {
|
|
272
|
-
if (initTimes > 5 || hasValue) {
|
|
273
|
-
clearInterval(timer);
|
|
274
|
-
} else {
|
|
275
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
276
|
-
initDefaultValue(valRef.current.value);
|
|
277
|
-
hasValue = true;
|
|
278
|
-
}
|
|
279
|
-
initTimes++;
|
|
280
|
-
}
|
|
281
|
-
}, 500);
|
|
282
|
-
return function () {
|
|
283
|
-
clearInterval(timer);
|
|
284
|
-
};
|
|
285
265
|
}, [value]);
|
|
286
266
|
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", {
|
|
287
267
|
className: wrapperClassName || wrapperClassName === '' ? "tag-input__wrapper ".concat(wrapperClassName) : "tag-input__wrapper mb-3 position-relative",
|
package/Textarea/index.js
CHANGED
|
@@ -173,26 +173,6 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
173
173
|
// update default value
|
|
174
174
|
//--------------
|
|
175
175
|
setChangedVal(value || '');
|
|
176
|
-
|
|
177
|
-
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
178
|
-
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
179
|
-
var timer = null;
|
|
180
|
-
var initTimes = 0;
|
|
181
|
-
var hasValue = false;
|
|
182
|
-
timer = setInterval(function () {
|
|
183
|
-
if (initTimes > 5 || hasValue) {
|
|
184
|
-
clearInterval(timer);
|
|
185
|
-
} else {
|
|
186
|
-
if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
187
|
-
setChangedVal(valRef.current.value);
|
|
188
|
-
hasValue = true;
|
|
189
|
-
}
|
|
190
|
-
initTimes++;
|
|
191
|
-
}
|
|
192
|
-
}, 500);
|
|
193
|
-
return function () {
|
|
194
|
-
clearInterval(timer);
|
|
195
|
-
};
|
|
196
176
|
}, [value]);
|
|
197
177
|
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", {
|
|
198
178
|
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|