@sunggang/ui-lib 0.4.63 → 0.4.65
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/Form.cjs.js +301 -88
- package/Form.esm.js +301 -88
- package/index.cjs.css +25 -6
- package/index.esm.css +25 -6
- package/package.json +1 -1
- package/src/lib/Form/EditableCombobox.d.ts +14 -0
package/Form.cjs.js
CHANGED
|
@@ -280,16 +280,16 @@ function getFrameElement(win) {
|
|
|
280
280
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
function _array_like_to_array$
|
|
283
|
+
function _array_like_to_array$8(arr, len) {
|
|
284
284
|
if (len == null || len > arr.length) len = arr.length;
|
|
285
285
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
286
286
|
return arr2;
|
|
287
287
|
}
|
|
288
|
-
function _array_with_holes$
|
|
288
|
+
function _array_with_holes$8(arr) {
|
|
289
289
|
if (Array.isArray(arr)) return arr;
|
|
290
290
|
}
|
|
291
291
|
function _array_without_holes(arr) {
|
|
292
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
292
|
+
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
293
293
|
}
|
|
294
294
|
function _define_property$3(obj, key, value) {
|
|
295
295
|
if (key in obj) {
|
|
@@ -307,7 +307,7 @@ function _define_property$3(obj, key, value) {
|
|
|
307
307
|
function _iterable_to_array(iter) {
|
|
308
308
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
309
309
|
}
|
|
310
|
-
function _iterable_to_array_limit$
|
|
310
|
+
function _iterable_to_array_limit$8(arr, i) {
|
|
311
311
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
312
312
|
if (_i == null) return;
|
|
313
313
|
var _arr = [];
|
|
@@ -331,7 +331,7 @@ function _iterable_to_array_limit$7(arr, i) {
|
|
|
331
331
|
}
|
|
332
332
|
return _arr;
|
|
333
333
|
}
|
|
334
|
-
function _non_iterable_rest$
|
|
334
|
+
function _non_iterable_rest$8() {
|
|
335
335
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
336
336
|
}
|
|
337
337
|
function _non_iterable_spread() {
|
|
@@ -376,19 +376,19 @@ function _object_spread_props$3(target, source) {
|
|
|
376
376
|
}
|
|
377
377
|
return target;
|
|
378
378
|
}
|
|
379
|
-
function _sliced_to_array$
|
|
380
|
-
return _array_with_holes$
|
|
379
|
+
function _sliced_to_array$8(arr, i) {
|
|
380
|
+
return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
|
|
381
381
|
}
|
|
382
382
|
function _to_consumable_array(arr) {
|
|
383
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$
|
|
383
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread();
|
|
384
384
|
}
|
|
385
|
-
function _unsupported_iterable_to_array$
|
|
385
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
386
386
|
if (!o) return;
|
|
387
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
387
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
388
388
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
389
389
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
390
390
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
391
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
391
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
392
392
|
}
|
|
393
393
|
function getCssDimensions(element) {
|
|
394
394
|
var css = getComputedStyle$1(element);
|
|
@@ -614,7 +614,7 @@ function observeMove(element, onMove) {
|
|
|
614
614
|
var resizeObserver = null;
|
|
615
615
|
if (elementResize) {
|
|
616
616
|
resizeObserver = new ResizeObserver(function(_ref) {
|
|
617
|
-
var _$_ref = _sliced_to_array$
|
|
617
|
+
var _$_ref = _sliced_to_array$8(_ref, 1), firstEntry = _$_ref[0];
|
|
618
618
|
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
619
619
|
// Prevent update loops when using the `size` middleware.
|
|
620
620
|
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
@@ -6132,12 +6132,12 @@ styledComponents_esm.dt.div(_templateObject4(), function(props) {
|
|
|
6132
6132
|
});
|
|
6133
6133
|
var StyleText = styledComponents_esm.dt.div(_templateObject5());
|
|
6134
6134
|
|
|
6135
|
-
/* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$
|
|
6135
|
+
/* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$7(arr, len) {
|
|
6136
6136
|
if (len == null || len > arr.length) len = arr.length;
|
|
6137
6137
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6138
6138
|
return arr2;
|
|
6139
6139
|
}
|
|
6140
|
-
function _array_with_holes$
|
|
6140
|
+
function _array_with_holes$7(arr) {
|
|
6141
6141
|
if (Array.isArray(arr)) return arr;
|
|
6142
6142
|
}
|
|
6143
6143
|
function _define_property$2(obj, key, value) {
|
|
@@ -6153,7 +6153,7 @@ function _define_property$2(obj, key, value) {
|
|
|
6153
6153
|
}
|
|
6154
6154
|
return obj;
|
|
6155
6155
|
}
|
|
6156
|
-
function _iterable_to_array_limit$
|
|
6156
|
+
function _iterable_to_array_limit$7(arr, i) {
|
|
6157
6157
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6158
6158
|
if (_i == null) return;
|
|
6159
6159
|
var _arr = [];
|
|
@@ -6177,7 +6177,7 @@ function _iterable_to_array_limit$6(arr, i) {
|
|
|
6177
6177
|
}
|
|
6178
6178
|
return _arr;
|
|
6179
6179
|
}
|
|
6180
|
-
function _non_iterable_rest$
|
|
6180
|
+
function _non_iterable_rest$7() {
|
|
6181
6181
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6182
6182
|
}
|
|
6183
6183
|
function _object_spread$2(target) {
|
|
@@ -6219,16 +6219,16 @@ function _object_spread_props$2(target, source) {
|
|
|
6219
6219
|
}
|
|
6220
6220
|
return target;
|
|
6221
6221
|
}
|
|
6222
|
-
function _sliced_to_array$
|
|
6223
|
-
return _array_with_holes$
|
|
6222
|
+
function _sliced_to_array$7(arr, i) {
|
|
6223
|
+
return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
|
|
6224
6224
|
}
|
|
6225
|
-
function _unsupported_iterable_to_array$
|
|
6225
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
6226
6226
|
if (!o) return;
|
|
6227
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6227
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
6228
6228
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6229
6229
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6230
6230
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6231
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6231
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
6232
6232
|
}
|
|
6233
6233
|
// interface CityDistrictProps {
|
|
6234
6234
|
// item?: {
|
|
@@ -6257,9 +6257,9 @@ var CityDistrict = function(param) {
|
|
|
6257
6257
|
var item = param.item;
|
|
6258
6258
|
var _errors_city, _errors_district;
|
|
6259
6259
|
var _useFormContext = index_esm.useFormContext(), register = _useFormContext.register, setValue = _useFormContext.setValue, getValues = _useFormContext.getValues, errors = _useFormContext.formState.errors;
|
|
6260
|
-
var _useState = _sliced_to_array$
|
|
6261
|
-
var _useState1 = _sliced_to_array$
|
|
6262
|
-
var _useState2 = _sliced_to_array$
|
|
6260
|
+
var _useState = _sliced_to_array$7(React.useState(null), 2), currentCity = _useState[0], setCurrentCity = _useState[1];
|
|
6261
|
+
var _useState1 = _sliced_to_array$7(React.useState(DistrictData), 1), city = _useState1[0];
|
|
6262
|
+
var _useState2 = _sliced_to_array$7(React.useState([]), 2), district = _useState2[0], setDistrict = _useState2[1];
|
|
6263
6263
|
var cityValue = getValues().city;
|
|
6264
6264
|
var districtValue = getValues().district;
|
|
6265
6265
|
React.useEffect(function() {
|
|
@@ -6395,15 +6395,15 @@ var CityDistrict = function(param) {
|
|
|
6395
6395
|
}, Modal.v4());
|
|
6396
6396
|
};
|
|
6397
6397
|
|
|
6398
|
-
function _array_like_to_array$
|
|
6398
|
+
function _array_like_to_array$6(arr, len) {
|
|
6399
6399
|
if (len == null || len > arr.length) len = arr.length;
|
|
6400
6400
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6401
6401
|
return arr2;
|
|
6402
6402
|
}
|
|
6403
|
-
function _array_with_holes$
|
|
6403
|
+
function _array_with_holes$6(arr) {
|
|
6404
6404
|
if (Array.isArray(arr)) return arr;
|
|
6405
6405
|
}
|
|
6406
|
-
function _iterable_to_array_limit$
|
|
6406
|
+
function _iterable_to_array_limit$6(arr, i) {
|
|
6407
6407
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6408
6408
|
if (_i == null) return;
|
|
6409
6409
|
var _arr = [];
|
|
@@ -6427,23 +6427,23 @@ function _iterable_to_array_limit$5(arr, i) {
|
|
|
6427
6427
|
}
|
|
6428
6428
|
return _arr;
|
|
6429
6429
|
}
|
|
6430
|
-
function _non_iterable_rest$
|
|
6430
|
+
function _non_iterable_rest$6() {
|
|
6431
6431
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6432
6432
|
}
|
|
6433
|
-
function _sliced_to_array$
|
|
6434
|
-
return _array_with_holes$
|
|
6433
|
+
function _sliced_to_array$6(arr, i) {
|
|
6434
|
+
return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
|
|
6435
6435
|
}
|
|
6436
|
-
function _unsupported_iterable_to_array$
|
|
6436
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
6437
6437
|
if (!o) return;
|
|
6438
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6438
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
6439
6439
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6440
6440
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6441
6441
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6442
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6442
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
6443
6443
|
}
|
|
6444
6444
|
var BaseTemplate$1 = function(param) {
|
|
6445
6445
|
var item = param.item, file = param.file, imageUrl = param.imageUrl, field = param.field;
|
|
6446
|
-
var _useState = _sliced_to_array$
|
|
6446
|
+
var _useState = _sliced_to_array$6(React.useState(null), 2), tempImage = _useState[0], setTempImage = _useState[1];
|
|
6447
6447
|
React.useEffect(function() {
|
|
6448
6448
|
var fileReader;
|
|
6449
6449
|
var isCancel = false;
|
|
@@ -6577,12 +6577,12 @@ var BaseTemplate$1 = function(param) {
|
|
|
6577
6577
|
});
|
|
6578
6578
|
};
|
|
6579
6579
|
|
|
6580
|
-
function _array_like_to_array$
|
|
6580
|
+
function _array_like_to_array$5(arr, len) {
|
|
6581
6581
|
if (len == null || len > arr.length) len = arr.length;
|
|
6582
6582
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6583
6583
|
return arr2;
|
|
6584
6584
|
}
|
|
6585
|
-
function _array_with_holes$
|
|
6585
|
+
function _array_with_holes$5(arr) {
|
|
6586
6586
|
if (Array.isArray(arr)) return arr;
|
|
6587
6587
|
}
|
|
6588
6588
|
function _instanceof(left, right) {
|
|
@@ -6592,7 +6592,7 @@ function _instanceof(left, right) {
|
|
|
6592
6592
|
return left instanceof right;
|
|
6593
6593
|
}
|
|
6594
6594
|
}
|
|
6595
|
-
function _iterable_to_array_limit$
|
|
6595
|
+
function _iterable_to_array_limit$5(arr, i) {
|
|
6596
6596
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6597
6597
|
if (_i == null) return;
|
|
6598
6598
|
var _arr = [];
|
|
@@ -6616,25 +6616,25 @@ function _iterable_to_array_limit$4(arr, i) {
|
|
|
6616
6616
|
}
|
|
6617
6617
|
return _arr;
|
|
6618
6618
|
}
|
|
6619
|
-
function _non_iterable_rest$
|
|
6619
|
+
function _non_iterable_rest$5() {
|
|
6620
6620
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6621
6621
|
}
|
|
6622
|
-
function _sliced_to_array$
|
|
6623
|
-
return _array_with_holes$
|
|
6622
|
+
function _sliced_to_array$5(arr, i) {
|
|
6623
|
+
return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
|
|
6624
6624
|
}
|
|
6625
|
-
function _unsupported_iterable_to_array$
|
|
6625
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
6626
6626
|
if (!o) return;
|
|
6627
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6627
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
6628
6628
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6629
6629
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6630
6630
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6631
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6631
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
6632
6632
|
}
|
|
6633
6633
|
var CustomUpload$1 = function(param) {
|
|
6634
6634
|
var item = param.item, field = param.field;
|
|
6635
6635
|
var imageMimeType = /image\/(png|jpg|jpeg)/i;
|
|
6636
6636
|
var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = (item === null || item === void 0 ? void 0 : item.limitSize) || 5242880;
|
|
6637
|
-
var _useState = _sliced_to_array$
|
|
6637
|
+
var _useState = _sliced_to_array$5(React.useState(null), 2), modal = _useState[0], setModal = _useState[1];
|
|
6638
6638
|
var hiddenFileInput = React.useRef(null);
|
|
6639
6639
|
React.useEffect(function() {
|
|
6640
6640
|
if (modal) {
|
|
@@ -6811,15 +6811,15 @@ var BaseSelect = function(param) {
|
|
|
6811
6811
|
});
|
|
6812
6812
|
};
|
|
6813
6813
|
|
|
6814
|
-
function _array_like_to_array$
|
|
6814
|
+
function _array_like_to_array$4(arr, len) {
|
|
6815
6815
|
if (len == null || len > arr.length) len = arr.length;
|
|
6816
6816
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6817
6817
|
return arr2;
|
|
6818
6818
|
}
|
|
6819
|
-
function _array_with_holes$
|
|
6819
|
+
function _array_with_holes$4(arr) {
|
|
6820
6820
|
if (Array.isArray(arr)) return arr;
|
|
6821
6821
|
}
|
|
6822
|
-
function _iterable_to_array_limit$
|
|
6822
|
+
function _iterable_to_array_limit$4(arr, i) {
|
|
6823
6823
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6824
6824
|
if (_i == null) return;
|
|
6825
6825
|
var _arr = [];
|
|
@@ -6843,27 +6843,27 @@ function _iterable_to_array_limit$3(arr, i) {
|
|
|
6843
6843
|
}
|
|
6844
6844
|
return _arr;
|
|
6845
6845
|
}
|
|
6846
|
-
function _non_iterable_rest$
|
|
6846
|
+
function _non_iterable_rest$4() {
|
|
6847
6847
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6848
6848
|
}
|
|
6849
|
-
function _sliced_to_array$
|
|
6850
|
-
return _array_with_holes$
|
|
6849
|
+
function _sliced_to_array$4(arr, i) {
|
|
6850
|
+
return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
|
|
6851
6851
|
}
|
|
6852
|
-
function _unsupported_iterable_to_array$
|
|
6852
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
6853
6853
|
if (!o) return;
|
|
6854
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6854
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
6855
6855
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6856
6856
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6857
6857
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6858
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6858
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
6859
6859
|
}
|
|
6860
6860
|
var DropdownList = function(param) {
|
|
6861
6861
|
var item = param.item, onUtilsReady = param.onUtilsReady;
|
|
6862
6862
|
var _item_option, _item_validateOption, _errors_funeralLocation;
|
|
6863
6863
|
var _useFormContext = index_esm.useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
|
|
6864
6864
|
var dropdownRef = React.useRef(null);
|
|
6865
|
-
var _useState = _sliced_to_array$
|
|
6866
|
-
var _useState1 = _sliced_to_array$
|
|
6865
|
+
var _useState = _sliced_to_array$4(React.useState(""), 2), query = _useState[0], setQuery = _useState[1];
|
|
6866
|
+
var _useState1 = _sliced_to_array$4(React.useState(false), 2), open = _useState1[0], setOpen = _useState1[1];
|
|
6867
6867
|
var filtered = (item === null || item === void 0 ? void 0 : (_item_option = item.option) === null || _item_option === void 0 ? void 0 : _item_option.filter(function(opt) {
|
|
6868
6868
|
var _opt_name;
|
|
6869
6869
|
return opt === null || opt === void 0 ? void 0 : (_opt_name = opt.name) === null || _opt_name === void 0 ? void 0 : _opt_name.toLowerCase().includes(query.toLowerCase());
|
|
@@ -7380,6 +7380,205 @@ var FlatpickrField = function(param) {
|
|
|
7380
7380
|
});
|
|
7381
7381
|
};
|
|
7382
7382
|
|
|
7383
|
+
function _array_like_to_array$3(arr, len) {
|
|
7384
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7385
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7386
|
+
return arr2;
|
|
7387
|
+
}
|
|
7388
|
+
function _array_with_holes$3(arr) {
|
|
7389
|
+
if (Array.isArray(arr)) return arr;
|
|
7390
|
+
}
|
|
7391
|
+
function _iterable_to_array_limit$3(arr, i) {
|
|
7392
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
7393
|
+
if (_i == null) return;
|
|
7394
|
+
var _arr = [];
|
|
7395
|
+
var _n = true;
|
|
7396
|
+
var _d = false;
|
|
7397
|
+
var _s, _e;
|
|
7398
|
+
try {
|
|
7399
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
7400
|
+
_arr.push(_s.value);
|
|
7401
|
+
if (i && _arr.length === i) break;
|
|
7402
|
+
}
|
|
7403
|
+
} catch (err) {
|
|
7404
|
+
_d = true;
|
|
7405
|
+
_e = err;
|
|
7406
|
+
} finally{
|
|
7407
|
+
try {
|
|
7408
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
7409
|
+
} finally{
|
|
7410
|
+
if (_d) throw _e;
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
return _arr;
|
|
7414
|
+
}
|
|
7415
|
+
function _non_iterable_rest$3() {
|
|
7416
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7417
|
+
}
|
|
7418
|
+
function _sliced_to_array$3(arr, i) {
|
|
7419
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
|
|
7420
|
+
}
|
|
7421
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
7422
|
+
if (!o) return;
|
|
7423
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
7424
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7425
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7426
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7427
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
7428
|
+
}
|
|
7429
|
+
var EditableCombobox = function(param) {
|
|
7430
|
+
var _param_value = param.value, value = _param_value === void 0 ? "" : _param_value, onChange = param.onChange, _param_options = param.options, options = _param_options === void 0 ? [] : _param_options, _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "請輸入或選擇" : _param_placeholder, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
|
|
7431
|
+
var _useState = _sliced_to_array$3(React.useState(false), 2), isOpen = _useState[0], setIsOpen = _useState[1];
|
|
7432
|
+
var _useState1 = _sliced_to_array$3(React.useState(value), 2), inputValue = _useState1[0], setInputValue = _useState1[1];
|
|
7433
|
+
var _useState2 = _sliced_to_array$3(React.useState(false), 2), isTyping = _useState2[0], setIsTyping = _useState2[1];
|
|
7434
|
+
var _useState3 = _sliced_to_array$3(React.useState(false), 2), isHovered = _useState3[0], setIsHovered = _useState3[1];
|
|
7435
|
+
var dropdownRef = React.useRef(null);
|
|
7436
|
+
var inputRef = React.useRef(null);
|
|
7437
|
+
React.useEffect(function() {
|
|
7438
|
+
setInputValue(value);
|
|
7439
|
+
}, [
|
|
7440
|
+
value
|
|
7441
|
+
]);
|
|
7442
|
+
React.useEffect(function() {
|
|
7443
|
+
var handleClickOutside = function(event) {
|
|
7444
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
7445
|
+
setIsOpen(false);
|
|
7446
|
+
setIsTyping(false);
|
|
7447
|
+
}
|
|
7448
|
+
};
|
|
7449
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
7450
|
+
return function() {
|
|
7451
|
+
return document.removeEventListener("mousedown", handleClickOutside);
|
|
7452
|
+
};
|
|
7453
|
+
}, []);
|
|
7454
|
+
var filteredOptions = isTyping ? options.filter(function(option) {
|
|
7455
|
+
var optionText = option.name || option.value || "";
|
|
7456
|
+
return optionText.toLowerCase().includes(inputValue.toLowerCase());
|
|
7457
|
+
}) : options;
|
|
7458
|
+
var handleSelect = function(option) {
|
|
7459
|
+
var _inputRef_current;
|
|
7460
|
+
var selectedValue = option.value || option.name;
|
|
7461
|
+
setInputValue(selectedValue);
|
|
7462
|
+
onChange(selectedValue);
|
|
7463
|
+
setIsOpen(false);
|
|
7464
|
+
setIsTyping(false);
|
|
7465
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
7466
|
+
};
|
|
7467
|
+
var handleInputChange = function(e) {
|
|
7468
|
+
var newValue = e.target.value;
|
|
7469
|
+
setInputValue(newValue);
|
|
7470
|
+
onChange(newValue);
|
|
7471
|
+
setIsTyping(true);
|
|
7472
|
+
if (!isOpen) {
|
|
7473
|
+
setIsOpen(true);
|
|
7474
|
+
}
|
|
7475
|
+
};
|
|
7476
|
+
var handleInputClick = function() {
|
|
7477
|
+
if (!disabled) {
|
|
7478
|
+
setIsTyping(false);
|
|
7479
|
+
setIsOpen(true);
|
|
7480
|
+
}
|
|
7481
|
+
};
|
|
7482
|
+
var handleClear = function(e) {
|
|
7483
|
+
var _inputRef_current;
|
|
7484
|
+
e.stopPropagation();
|
|
7485
|
+
setInputValue("");
|
|
7486
|
+
onChange("");
|
|
7487
|
+
setIsOpen(false);
|
|
7488
|
+
setIsTyping(false);
|
|
7489
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
7490
|
+
};
|
|
7491
|
+
var handleDropdownToggle = function(e) {
|
|
7492
|
+
e.stopPropagation();
|
|
7493
|
+
if (!disabled) {
|
|
7494
|
+
var _inputRef_current;
|
|
7495
|
+
setIsTyping(false);
|
|
7496
|
+
setIsOpen(!isOpen);
|
|
7497
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
7498
|
+
}
|
|
7499
|
+
};
|
|
7500
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7501
|
+
ref: dropdownRef,
|
|
7502
|
+
className: "relative ".concat(className),
|
|
7503
|
+
children: [
|
|
7504
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7505
|
+
className: "relative",
|
|
7506
|
+
onMouseEnter: function() {
|
|
7507
|
+
return setIsHovered(true);
|
|
7508
|
+
},
|
|
7509
|
+
onMouseLeave: function() {
|
|
7510
|
+
return setIsHovered(false);
|
|
7511
|
+
},
|
|
7512
|
+
children: [
|
|
7513
|
+
/*#__PURE__*/ jsxRuntime.jsx("input", {
|
|
7514
|
+
ref: inputRef,
|
|
7515
|
+
type: "text",
|
|
7516
|
+
value: inputValue,
|
|
7517
|
+
onChange: handleInputChange,
|
|
7518
|
+
onClick: handleInputClick,
|
|
7519
|
+
placeholder: placeholder,
|
|
7520
|
+
disabled: disabled,
|
|
7521
|
+
className: [
|
|
7522
|
+
"w-full h-11 rounded-2xl px-4 pr-20 border border-solid border-[#B4B4B4]",
|
|
7523
|
+
"transition-colors duration-200",
|
|
7524
|
+
disabled ? "text-[#B0B0B0] bg-[#e5e7eb] cursor-not-allowed" : "bg-white text-[#6f6f6f] hover:border-[#6f6f6f] focus:border-[#6f6f6f] focus:outline-none"
|
|
7525
|
+
].join(" ")
|
|
7526
|
+
}),
|
|
7527
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7528
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",
|
|
7529
|
+
children: [
|
|
7530
|
+
inputValue && !disabled && isHovered && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
7531
|
+
onClick: handleClear,
|
|
7532
|
+
className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors",
|
|
7533
|
+
type: "button",
|
|
7534
|
+
tabIndex: -1,
|
|
7535
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
|
|
7536
|
+
icon: "mdi:close",
|
|
7537
|
+
className: "w-4 h-4"
|
|
7538
|
+
})
|
|
7539
|
+
}),
|
|
7540
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
7541
|
+
onClick: handleDropdownToggle,
|
|
7542
|
+
className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors",
|
|
7543
|
+
type: "button",
|
|
7544
|
+
tabIndex: -1,
|
|
7545
|
+
disabled: disabled,
|
|
7546
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
|
|
7547
|
+
icon: "mdi:chevron-down",
|
|
7548
|
+
className: "w-5 h-5 transition-transform duration-200 ".concat(isOpen ? "rotate-180" : "")
|
|
7549
|
+
})
|
|
7550
|
+
})
|
|
7551
|
+
]
|
|
7552
|
+
})
|
|
7553
|
+
]
|
|
7554
|
+
}),
|
|
7555
|
+
isOpen && !disabled && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7556
|
+
className: "absolute z-50 w-full mt-1 bg-white border border-[#B4B4B4] rounded-2xl shadow-lg max-h-60 overflow-hidden",
|
|
7557
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7558
|
+
className: "overflow-y-auto max-h-60",
|
|
7559
|
+
children: filteredOptions.length > 0 ? filteredOptions.map(function(option, index) {
|
|
7560
|
+
var optionValue = option.value || option.name;
|
|
7561
|
+
var isSelected = optionValue === inputValue;
|
|
7562
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7563
|
+
onClick: function() {
|
|
7564
|
+
return handleSelect(option);
|
|
7565
|
+
},
|
|
7566
|
+
className: [
|
|
7567
|
+
"px-4 py-2.5 cursor-pointer transition-colors",
|
|
7568
|
+
isSelected ? "bg-[#F5F5F5] text-[#6f6f6f] font-medium" : "hover:bg-[#F5F5F5]"
|
|
7569
|
+
].join(" "),
|
|
7570
|
+
children: option.name
|
|
7571
|
+
}, index);
|
|
7572
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7573
|
+
className: "px-4 py-3 text-center text-[#B0B0B0]",
|
|
7574
|
+
children: "沒有符合的選項"
|
|
7575
|
+
})
|
|
7576
|
+
})
|
|
7577
|
+
})
|
|
7578
|
+
]
|
|
7579
|
+
});
|
|
7580
|
+
};
|
|
7581
|
+
|
|
7383
7582
|
/* eslint-disable react/no-array-index-key */ /* eslint-disable react/prop-types */ function _array_like_to_array$2(arr, len) {
|
|
7384
7583
|
if (len == null || len > arr.length) len = arr.length;
|
|
7385
7584
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -7628,9 +7827,10 @@ var SingleSelect = function(param) {
|
|
|
7628
7827
|
disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
|
|
7629
7828
|
}), field), {
|
|
7630
7829
|
children: item === null || item === void 0 ? void 0 : (_item_option = item.option) === null || _item_option === void 0 ? void 0 : _item_option.map(function(group) {
|
|
7631
|
-
|
|
7830
|
+
var _group_options;
|
|
7831
|
+
return "label" in group && "options" in group ? /*#__PURE__*/ jsxRuntime.jsx("optgroup", {
|
|
7632
7832
|
label: group.label,
|
|
7633
|
-
children: group.options.map(function(o) {
|
|
7833
|
+
children: (_group_options = group.options) === null || _group_options === void 0 ? void 0 : _group_options.map(function(o) {
|
|
7634
7834
|
return /*#__PURE__*/ jsxRuntime.jsx("option", {
|
|
7635
7835
|
value: o.value,
|
|
7636
7836
|
children: o.name
|
|
@@ -8038,7 +8238,11 @@ var FieldArray = function(param) {
|
|
|
8038
8238
|
name: item.name
|
|
8039
8239
|
}), fields = _useFieldArray.fields, append = _useFieldArray.append, remove = _useFieldArray.remove;
|
|
8040
8240
|
var config = item === null || item === void 0 ? void 0 : item.fieldArrayConfig;
|
|
8041
|
-
var fieldConfigs = (
|
|
8241
|
+
var fieldConfigs = React__default["default"].useMemo(function() {
|
|
8242
|
+
return (config === null || config === void 0 ? void 0 : config.fields) || [];
|
|
8243
|
+
}, [
|
|
8244
|
+
config === null || config === void 0 ? void 0 : config.fields
|
|
8245
|
+
]);
|
|
8042
8246
|
var addButtonText = (config === null || config === void 0 ? void 0 : config.addButtonText) || "新增";
|
|
8043
8247
|
var maxItems = config === null || config === void 0 ? void 0 : config.maxItems;
|
|
8044
8248
|
var minItems = (config === null || config === void 0 ? void 0 : config.minItems) || 0;
|
|
@@ -8047,7 +8251,6 @@ var FieldArray = function(param) {
|
|
|
8047
8251
|
var addButtonClassName = config === null || config === void 0 ? void 0 : config.addButtonClassName;
|
|
8048
8252
|
var canAdd = !maxItems || fields.length < maxItems;
|
|
8049
8253
|
var canRemove = fields.length > minItems;
|
|
8050
|
-
// 初始化:確保至少有 defaultItemCount 個項目
|
|
8051
8254
|
React__default["default"].useEffect(function() {
|
|
8052
8255
|
var currentValues = getValues(item.name);
|
|
8053
8256
|
if (!currentValues || currentValues.length === 0) {
|
|
@@ -8061,8 +8264,13 @@ var FieldArray = function(param) {
|
|
|
8061
8264
|
var itemsToAdd = defaultItemCount;
|
|
8062
8265
|
for(var i = 0; i < itemsToAdd; i++)_loop(i);
|
|
8063
8266
|
}
|
|
8064
|
-
|
|
8065
|
-
|
|
8267
|
+
}, [
|
|
8268
|
+
append,
|
|
8269
|
+
defaultItemCount,
|
|
8270
|
+
fieldConfigs,
|
|
8271
|
+
getValues,
|
|
8272
|
+
item.name
|
|
8273
|
+
]);
|
|
8066
8274
|
var handleAdd = function() {
|
|
8067
8275
|
if (canAdd) {
|
|
8068
8276
|
var newItem = {};
|
|
@@ -8134,14 +8342,16 @@ var FieldArray = function(param) {
|
|
|
8134
8342
|
children: [
|
|
8135
8343
|
fields.map(function(field, index) {
|
|
8136
8344
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
8137
|
-
className: "bg-white
|
|
8345
|
+
className: "bg-white",
|
|
8138
8346
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
8139
|
-
className: "flex items-start gap-2 flex-wrap lg:flex-nowrap
|
|
8347
|
+
className: "flex items-start gap-2 flex-wrap lg:flex-nowrap",
|
|
8140
8348
|
children: fieldConfigs.map(function(fieldConfig, fieldIndex) {
|
|
8141
8349
|
var _fieldConfig_validateOption;
|
|
8142
8350
|
var fieldName = "".concat(item.name, ".").concat(index, ".").concat(fieldConfig.name);
|
|
8143
8351
|
var fieldError = getFieldError(index, fieldConfig.name);
|
|
8144
8352
|
var isLastField = fieldIndex === fieldConfigs.length - 1;
|
|
8353
|
+
// 🎯 關鍵判斷:是否有選項(使用可編輯下拉選單)
|
|
8354
|
+
var hasOptions = fieldConfig.options && fieldConfig.options.length > 0;
|
|
8145
8355
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8146
8356
|
className: [
|
|
8147
8357
|
isLastField ? "flex items-start gap-1 flex-1" : "flex-1",
|
|
@@ -8167,37 +8377,40 @@ var FieldArray = function(param) {
|
|
|
8167
8377
|
rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.validateOption,
|
|
8168
8378
|
render: function(param) {
|
|
8169
8379
|
var controllerField = param.field;
|
|
8170
|
-
|
|
8380
|
+
var _fieldConfig_options;
|
|
8381
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
8171
8382
|
className: "relative",
|
|
8172
|
-
children:
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
})
|
|
8183
|
-
fieldConfig.
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8383
|
+
children: hasOptions ? // ✅ 使用可編輯下拉選單 - 既可以輸入也可以選擇
|
|
8384
|
+
/*#__PURE__*/ jsxRuntime.jsx(EditableCombobox, {
|
|
8385
|
+
value: controllerField.value || "",
|
|
8386
|
+
onChange: controllerField.onChange,
|
|
8387
|
+
options: (_fieldConfig_options = fieldConfig.options) === null || _fieldConfig_options === void 0 ? void 0 : _fieldConfig_options.map(function(opt) {
|
|
8388
|
+
var _opt_value;
|
|
8389
|
+
return {
|
|
8390
|
+
name: opt.name,
|
|
8391
|
+
value: String((_opt_value = opt.value) !== null && _opt_value !== void 0 ? _opt_value : opt.name)
|
|
8392
|
+
};
|
|
8393
|
+
}),
|
|
8394
|
+
placeholder: fieldConfig.placeholder || fieldConfig.label,
|
|
8395
|
+
disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
|
|
8396
|
+
}) : // ✅ 使用一般 input
|
|
8397
|
+
/*#__PURE__*/ jsxRuntime.jsx("input", _object_spread_props(_object_spread({}, controllerField), {
|
|
8398
|
+
type: "text",
|
|
8399
|
+
className: [
|
|
8400
|
+
(item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled) ? "text-[#B0B0B0] bg-[#e5e7eb] cursor-not-allowed" : "bg-white text-[#6f6f6f]",
|
|
8401
|
+
"w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
|
|
8402
|
+
].join(" "),
|
|
8403
|
+
placeholder: fieldConfig.placeholder || fieldConfig.label,
|
|
8404
|
+
disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
|
|
8405
|
+
}))
|
|
8193
8406
|
});
|
|
8194
8407
|
}
|
|
8195
8408
|
}),
|
|
8196
|
-
|
|
8409
|
+
fieldError && "message" in fieldError && typeof fieldError.message === "string" && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8197
8410
|
className: "pt-1 text-xs text-[#EF5533]",
|
|
8198
8411
|
children: [
|
|
8199
8412
|
"*",
|
|
8200
|
-
|
|
8413
|
+
fieldError.message
|
|
8201
8414
|
]
|
|
8202
8415
|
})
|
|
8203
8416
|
]
|
|
@@ -8228,7 +8441,7 @@ var FieldArray = function(param) {
|
|
|
8228
8441
|
]
|
|
8229
8442
|
}),
|
|
8230
8443
|
canRemove && fields.length > 1 && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
8231
|
-
className: "p-2 rounded-2xl text-[#EF5533] bg-white hover:bg-[#FFF5F3] transition-colors duration-200",
|
|
8444
|
+
className: "p-2 rounded-2xl text-[#EF5533] bg-white hover:bg-[#FFF5F3] transition-colors duration-200 cursor-pointer",
|
|
8232
8445
|
children: /*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
|
|
8233
8446
|
icon: "fluent-mdl2:delete",
|
|
8234
8447
|
className: "w-6 h-6",
|