@sunggang/ui-lib 0.4.62 → 0.4.64

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.esm.js CHANGED
@@ -253,16 +253,16 @@ function getFrameElement(win) {
253
253
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
254
254
  }
255
255
 
256
- function _array_like_to_array$7(arr, len) {
256
+ function _array_like_to_array$8(arr, len) {
257
257
  if (len == null || len > arr.length) len = arr.length;
258
258
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
259
259
  return arr2;
260
260
  }
261
- function _array_with_holes$7(arr) {
261
+ function _array_with_holes$8(arr) {
262
262
  if (Array.isArray(arr)) return arr;
263
263
  }
264
264
  function _array_without_holes(arr) {
265
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
265
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
266
266
  }
267
267
  function _define_property$3(obj, key, value) {
268
268
  if (key in obj) {
@@ -280,7 +280,7 @@ function _define_property$3(obj, key, value) {
280
280
  function _iterable_to_array(iter) {
281
281
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
282
282
  }
283
- function _iterable_to_array_limit$7(arr, i) {
283
+ function _iterable_to_array_limit$8(arr, i) {
284
284
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
285
285
  if (_i == null) return;
286
286
  var _arr = [];
@@ -304,7 +304,7 @@ function _iterable_to_array_limit$7(arr, i) {
304
304
  }
305
305
  return _arr;
306
306
  }
307
- function _non_iterable_rest$7() {
307
+ function _non_iterable_rest$8() {
308
308
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
309
309
  }
310
310
  function _non_iterable_spread() {
@@ -349,19 +349,19 @@ function _object_spread_props$3(target, source) {
349
349
  }
350
350
  return target;
351
351
  }
352
- function _sliced_to_array$7(arr, i) {
353
- return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
352
+ function _sliced_to_array$8(arr, i) {
353
+ return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
354
354
  }
355
355
  function _to_consumable_array(arr) {
356
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread();
356
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread();
357
357
  }
358
- function _unsupported_iterable_to_array$7(o, minLen) {
358
+ function _unsupported_iterable_to_array$8(o, minLen) {
359
359
  if (!o) return;
360
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
360
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
361
361
  var n = Object.prototype.toString.call(o).slice(8, -1);
362
362
  if (n === "Object" && o.constructor) n = o.constructor.name;
363
363
  if (n === "Map" || n === "Set") return Array.from(n);
364
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
364
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
365
365
  }
366
366
  function getCssDimensions(element) {
367
367
  var css = getComputedStyle$1(element);
@@ -587,7 +587,7 @@ function observeMove(element, onMove) {
587
587
  var resizeObserver = null;
588
588
  if (elementResize) {
589
589
  resizeObserver = new ResizeObserver(function(_ref) {
590
- var _$_ref = _sliced_to_array$7(_ref, 1), firstEntry = _$_ref[0];
590
+ var _$_ref = _sliced_to_array$8(_ref, 1), firstEntry = _$_ref[0];
591
591
  if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
592
592
  // Prevent update loops when using the `size` middleware.
593
593
  // https://github.com/floating-ui/floating-ui/issues/1740
@@ -6105,12 +6105,12 @@ dt.div(_templateObject4(), function(props) {
6105
6105
  });
6106
6106
  var StyleText = dt.div(_templateObject5());
6107
6107
 
6108
- /* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$6(arr, len) {
6108
+ /* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$7(arr, len) {
6109
6109
  if (len == null || len > arr.length) len = arr.length;
6110
6110
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6111
6111
  return arr2;
6112
6112
  }
6113
- function _array_with_holes$6(arr) {
6113
+ function _array_with_holes$7(arr) {
6114
6114
  if (Array.isArray(arr)) return arr;
6115
6115
  }
6116
6116
  function _define_property$2(obj, key, value) {
@@ -6126,7 +6126,7 @@ function _define_property$2(obj, key, value) {
6126
6126
  }
6127
6127
  return obj;
6128
6128
  }
6129
- function _iterable_to_array_limit$6(arr, i) {
6129
+ function _iterable_to_array_limit$7(arr, i) {
6130
6130
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6131
6131
  if (_i == null) return;
6132
6132
  var _arr = [];
@@ -6150,7 +6150,7 @@ function _iterable_to_array_limit$6(arr, i) {
6150
6150
  }
6151
6151
  return _arr;
6152
6152
  }
6153
- function _non_iterable_rest$6() {
6153
+ function _non_iterable_rest$7() {
6154
6154
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6155
6155
  }
6156
6156
  function _object_spread$2(target) {
@@ -6192,16 +6192,16 @@ function _object_spread_props$2(target, source) {
6192
6192
  }
6193
6193
  return target;
6194
6194
  }
6195
- function _sliced_to_array$6(arr, i) {
6196
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
6195
+ function _sliced_to_array$7(arr, i) {
6196
+ return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
6197
6197
  }
6198
- function _unsupported_iterable_to_array$6(o, minLen) {
6198
+ function _unsupported_iterable_to_array$7(o, minLen) {
6199
6199
  if (!o) return;
6200
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
6200
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
6201
6201
  var n = Object.prototype.toString.call(o).slice(8, -1);
6202
6202
  if (n === "Object" && o.constructor) n = o.constructor.name;
6203
6203
  if (n === "Map" || n === "Set") return Array.from(n);
6204
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
6204
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
6205
6205
  }
6206
6206
  // interface CityDistrictProps {
6207
6207
  // item?: {
@@ -6230,9 +6230,9 @@ var CityDistrict = function(param) {
6230
6230
  var item = param.item;
6231
6231
  var _errors_city, _errors_district;
6232
6232
  var _useFormContext = useFormContext(), register = _useFormContext.register, setValue = _useFormContext.setValue, getValues = _useFormContext.getValues, errors = _useFormContext.formState.errors;
6233
- var _useState = _sliced_to_array$6(useState(null), 2), currentCity = _useState[0], setCurrentCity = _useState[1];
6234
- var _useState1 = _sliced_to_array$6(useState(DistrictData), 1), city = _useState1[0];
6235
- var _useState2 = _sliced_to_array$6(useState([]), 2), district = _useState2[0], setDistrict = _useState2[1];
6233
+ var _useState = _sliced_to_array$7(useState(null), 2), currentCity = _useState[0], setCurrentCity = _useState[1];
6234
+ var _useState1 = _sliced_to_array$7(useState(DistrictData), 1), city = _useState1[0];
6235
+ var _useState2 = _sliced_to_array$7(useState([]), 2), district = _useState2[0], setDistrict = _useState2[1];
6236
6236
  var cityValue = getValues().city;
6237
6237
  var districtValue = getValues().district;
6238
6238
  useEffect(function() {
@@ -6368,15 +6368,15 @@ var CityDistrict = function(param) {
6368
6368
  }, v4());
6369
6369
  };
6370
6370
 
6371
- function _array_like_to_array$5(arr, len) {
6371
+ function _array_like_to_array$6(arr, len) {
6372
6372
  if (len == null || len > arr.length) len = arr.length;
6373
6373
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6374
6374
  return arr2;
6375
6375
  }
6376
- function _array_with_holes$5(arr) {
6376
+ function _array_with_holes$6(arr) {
6377
6377
  if (Array.isArray(arr)) return arr;
6378
6378
  }
6379
- function _iterable_to_array_limit$5(arr, i) {
6379
+ function _iterable_to_array_limit$6(arr, i) {
6380
6380
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6381
6381
  if (_i == null) return;
6382
6382
  var _arr = [];
@@ -6400,23 +6400,23 @@ function _iterable_to_array_limit$5(arr, i) {
6400
6400
  }
6401
6401
  return _arr;
6402
6402
  }
6403
- function _non_iterable_rest$5() {
6403
+ function _non_iterable_rest$6() {
6404
6404
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6405
6405
  }
6406
- function _sliced_to_array$5(arr, i) {
6407
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
6406
+ function _sliced_to_array$6(arr, i) {
6407
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
6408
6408
  }
6409
- function _unsupported_iterable_to_array$5(o, minLen) {
6409
+ function _unsupported_iterable_to_array$6(o, minLen) {
6410
6410
  if (!o) return;
6411
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6411
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
6412
6412
  var n = Object.prototype.toString.call(o).slice(8, -1);
6413
6413
  if (n === "Object" && o.constructor) n = o.constructor.name;
6414
6414
  if (n === "Map" || n === "Set") return Array.from(n);
6415
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
6415
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
6416
6416
  }
6417
6417
  var BaseTemplate$1 = function(param) {
6418
6418
  var item = param.item, file = param.file, imageUrl = param.imageUrl, field = param.field;
6419
- var _useState = _sliced_to_array$5(useState(null), 2), tempImage = _useState[0], setTempImage = _useState[1];
6419
+ var _useState = _sliced_to_array$6(useState(null), 2), tempImage = _useState[0], setTempImage = _useState[1];
6420
6420
  useEffect(function() {
6421
6421
  var fileReader;
6422
6422
  var isCancel = false;
@@ -6550,12 +6550,12 @@ var BaseTemplate$1 = function(param) {
6550
6550
  });
6551
6551
  };
6552
6552
 
6553
- function _array_like_to_array$4(arr, len) {
6553
+ function _array_like_to_array$5(arr, len) {
6554
6554
  if (len == null || len > arr.length) len = arr.length;
6555
6555
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6556
6556
  return arr2;
6557
6557
  }
6558
- function _array_with_holes$4(arr) {
6558
+ function _array_with_holes$5(arr) {
6559
6559
  if (Array.isArray(arr)) return arr;
6560
6560
  }
6561
6561
  function _instanceof(left, right) {
@@ -6565,7 +6565,7 @@ function _instanceof(left, right) {
6565
6565
  return left instanceof right;
6566
6566
  }
6567
6567
  }
6568
- function _iterable_to_array_limit$4(arr, i) {
6568
+ function _iterable_to_array_limit$5(arr, i) {
6569
6569
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6570
6570
  if (_i == null) return;
6571
6571
  var _arr = [];
@@ -6589,25 +6589,25 @@ function _iterable_to_array_limit$4(arr, i) {
6589
6589
  }
6590
6590
  return _arr;
6591
6591
  }
6592
- function _non_iterable_rest$4() {
6592
+ function _non_iterable_rest$5() {
6593
6593
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6594
6594
  }
6595
- function _sliced_to_array$4(arr, i) {
6596
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
6595
+ function _sliced_to_array$5(arr, i) {
6596
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
6597
6597
  }
6598
- function _unsupported_iterable_to_array$4(o, minLen) {
6598
+ function _unsupported_iterable_to_array$5(o, minLen) {
6599
6599
  if (!o) return;
6600
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6600
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6601
6601
  var n = Object.prototype.toString.call(o).slice(8, -1);
6602
6602
  if (n === "Object" && o.constructor) n = o.constructor.name;
6603
6603
  if (n === "Map" || n === "Set") return Array.from(n);
6604
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6604
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
6605
6605
  }
6606
6606
  var CustomUpload$1 = function(param) {
6607
6607
  var item = param.item, field = param.field;
6608
6608
  var imageMimeType = /image\/(png|jpg|jpeg)/i;
6609
6609
  var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = (item === null || item === void 0 ? void 0 : item.limitSize) || 5242880;
6610
- var _useState = _sliced_to_array$4(useState(null), 2), modal = _useState[0], setModal = _useState[1];
6610
+ var _useState = _sliced_to_array$5(useState(null), 2), modal = _useState[0], setModal = _useState[1];
6611
6611
  var hiddenFileInput = useRef(null);
6612
6612
  useEffect(function() {
6613
6613
  if (modal) {
@@ -6784,15 +6784,15 @@ var BaseSelect = function(param) {
6784
6784
  });
6785
6785
  };
6786
6786
 
6787
- function _array_like_to_array$3(arr, len) {
6787
+ function _array_like_to_array$4(arr, len) {
6788
6788
  if (len == null || len > arr.length) len = arr.length;
6789
6789
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6790
6790
  return arr2;
6791
6791
  }
6792
- function _array_with_holes$3(arr) {
6792
+ function _array_with_holes$4(arr) {
6793
6793
  if (Array.isArray(arr)) return arr;
6794
6794
  }
6795
- function _iterable_to_array_limit$3(arr, i) {
6795
+ function _iterable_to_array_limit$4(arr, i) {
6796
6796
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6797
6797
  if (_i == null) return;
6798
6798
  var _arr = [];
@@ -6816,27 +6816,27 @@ function _iterable_to_array_limit$3(arr, i) {
6816
6816
  }
6817
6817
  return _arr;
6818
6818
  }
6819
- function _non_iterable_rest$3() {
6819
+ function _non_iterable_rest$4() {
6820
6820
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6821
6821
  }
6822
- function _sliced_to_array$3(arr, i) {
6823
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
6822
+ function _sliced_to_array$4(arr, i) {
6823
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
6824
6824
  }
6825
- function _unsupported_iterable_to_array$3(o, minLen) {
6825
+ function _unsupported_iterable_to_array$4(o, minLen) {
6826
6826
  if (!o) return;
6827
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
6827
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6828
6828
  var n = Object.prototype.toString.call(o).slice(8, -1);
6829
6829
  if (n === "Object" && o.constructor) n = o.constructor.name;
6830
6830
  if (n === "Map" || n === "Set") return Array.from(n);
6831
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
6831
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6832
6832
  }
6833
6833
  var DropdownList = function(param) {
6834
6834
  var item = param.item, onUtilsReady = param.onUtilsReady;
6835
6835
  var _item_option, _item_validateOption, _errors_funeralLocation;
6836
6836
  var _useFormContext = useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
6837
6837
  var dropdownRef = useRef(null);
6838
- var _useState = _sliced_to_array$3(useState(""), 2), query = _useState[0], setQuery = _useState[1];
6839
- var _useState1 = _sliced_to_array$3(useState(false), 2), open = _useState1[0], setOpen = _useState1[1];
6838
+ var _useState = _sliced_to_array$4(useState(""), 2), query = _useState[0], setQuery = _useState[1];
6839
+ var _useState1 = _sliced_to_array$4(useState(false), 2), open = _useState1[0], setOpen = _useState1[1];
6840
6840
  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) {
6841
6841
  var _opt_name;
6842
6842
  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());
@@ -7353,6 +7353,198 @@ var FlatpickrField = function(param) {
7353
7353
  });
7354
7354
  };
7355
7355
 
7356
+ function _array_like_to_array$3(arr, len) {
7357
+ if (len == null || len > arr.length) len = arr.length;
7358
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7359
+ return arr2;
7360
+ }
7361
+ function _array_with_holes$3(arr) {
7362
+ if (Array.isArray(arr)) return arr;
7363
+ }
7364
+ function _iterable_to_array_limit$3(arr, i) {
7365
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
7366
+ if (_i == null) return;
7367
+ var _arr = [];
7368
+ var _n = true;
7369
+ var _d = false;
7370
+ var _s, _e;
7371
+ try {
7372
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
7373
+ _arr.push(_s.value);
7374
+ if (i && _arr.length === i) break;
7375
+ }
7376
+ } catch (err) {
7377
+ _d = true;
7378
+ _e = err;
7379
+ } finally{
7380
+ try {
7381
+ if (!_n && _i["return"] != null) _i["return"]();
7382
+ } finally{
7383
+ if (_d) throw _e;
7384
+ }
7385
+ }
7386
+ return _arr;
7387
+ }
7388
+ function _non_iterable_rest$3() {
7389
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7390
+ }
7391
+ function _sliced_to_array$3(arr, i) {
7392
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
7393
+ }
7394
+ function _unsupported_iterable_to_array$3(o, minLen) {
7395
+ if (!o) return;
7396
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
7397
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7398
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7399
+ if (n === "Map" || n === "Set") return Array.from(n);
7400
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7401
+ }
7402
+ var EditableCombobox = function(param) {
7403
+ 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;
7404
+ var _useState = _sliced_to_array$3(useState(false), 2), isOpen = _useState[0], setIsOpen = _useState[1];
7405
+ var _useState1 = _sliced_to_array$3(useState(value), 2), inputValue = _useState1[0], setInputValue = _useState1[1];
7406
+ var _useState2 = _sliced_to_array$3(useState(false), 2), isTyping = _useState2[0], setIsTyping = _useState2[1];
7407
+ var dropdownRef = useRef(null);
7408
+ var inputRef = useRef(null);
7409
+ useEffect(function() {
7410
+ setInputValue(value);
7411
+ }, [
7412
+ value
7413
+ ]);
7414
+ useEffect(function() {
7415
+ var handleClickOutside = function(event) {
7416
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
7417
+ setIsOpen(false);
7418
+ setIsTyping(false);
7419
+ }
7420
+ };
7421
+ document.addEventListener("mousedown", handleClickOutside);
7422
+ return function() {
7423
+ return document.removeEventListener("mousedown", handleClickOutside);
7424
+ };
7425
+ }, []);
7426
+ var filteredOptions = isTyping ? options.filter(function(option) {
7427
+ var optionText = option.name || option.value || "";
7428
+ return optionText.toLowerCase().includes(inputValue.toLowerCase());
7429
+ }) : options;
7430
+ var handleSelect = function(option) {
7431
+ var _inputRef_current;
7432
+ var selectedValue = option.value || option.name;
7433
+ setInputValue(selectedValue);
7434
+ onChange(selectedValue);
7435
+ setIsOpen(false);
7436
+ setIsTyping(false);
7437
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
7438
+ };
7439
+ var handleInputChange = function(e) {
7440
+ var newValue = e.target.value;
7441
+ setInputValue(newValue);
7442
+ onChange(newValue);
7443
+ setIsTyping(true);
7444
+ if (!isOpen) {
7445
+ setIsOpen(true);
7446
+ }
7447
+ };
7448
+ var handleInputClick = function() {
7449
+ if (!disabled) {
7450
+ setIsTyping(false);
7451
+ setIsOpen(true);
7452
+ }
7453
+ };
7454
+ var handleClear = function(e) {
7455
+ var _inputRef_current;
7456
+ e.stopPropagation();
7457
+ setInputValue("");
7458
+ onChange("");
7459
+ setIsOpen(false);
7460
+ setIsTyping(false);
7461
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
7462
+ };
7463
+ var handleDropdownToggle = function(e) {
7464
+ e.stopPropagation();
7465
+ if (!disabled) {
7466
+ var _inputRef_current;
7467
+ setIsTyping(false);
7468
+ setIsOpen(!isOpen);
7469
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
7470
+ }
7471
+ };
7472
+ return /*#__PURE__*/ jsxs("div", {
7473
+ ref: dropdownRef,
7474
+ className: "relative ".concat(className),
7475
+ children: [
7476
+ /*#__PURE__*/ jsxs("div", {
7477
+ className: "relative",
7478
+ children: [
7479
+ /*#__PURE__*/ jsx$1("input", {
7480
+ ref: inputRef,
7481
+ type: "text",
7482
+ value: inputValue,
7483
+ onChange: handleInputChange,
7484
+ onClick: handleInputClick,
7485
+ placeholder: placeholder,
7486
+ disabled: disabled,
7487
+ className: [
7488
+ "w-full h-11 rounded-2xl px-4 pr-20 border border-solid border-[#B4B4B4]",
7489
+ "transition-colors duration-200",
7490
+ disabled ? "text-[#B0B0B0] bg-[#e5e7eb] cursor-not-allowed" : "bg-white text-[#6f6f6f] hover:border-[#6f6f6f] focus:border-[#6f6f6f] focus:outline-none"
7491
+ ].join(" ")
7492
+ }),
7493
+ /*#__PURE__*/ jsxs("div", {
7494
+ className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",
7495
+ children: [
7496
+ inputValue && !disabled && /*#__PURE__*/ jsx$1("button", {
7497
+ onClick: handleClear,
7498
+ className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors",
7499
+ type: "button",
7500
+ tabIndex: -1,
7501
+ children: /*#__PURE__*/ jsx$1(Icon, {
7502
+ icon: "mdi:close",
7503
+ className: "w-4 h-4"
7504
+ })
7505
+ }),
7506
+ /*#__PURE__*/ jsx$1("button", {
7507
+ onClick: handleDropdownToggle,
7508
+ className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors",
7509
+ type: "button",
7510
+ tabIndex: -1,
7511
+ disabled: disabled,
7512
+ children: /*#__PURE__*/ jsx$1(Icon, {
7513
+ icon: "mdi:chevron-down",
7514
+ className: "w-5 h-5 transition-transform duration-200 ".concat(isOpen ? "rotate-180" : "")
7515
+ })
7516
+ })
7517
+ ]
7518
+ })
7519
+ ]
7520
+ }),
7521
+ isOpen && !disabled && /*#__PURE__*/ jsx$1("div", {
7522
+ className: "absolute z-50 w-full mt-1 bg-white border border-[#B4B4B4] rounded-2xl shadow-lg max-h-60 overflow-hidden",
7523
+ children: /*#__PURE__*/ jsx$1("div", {
7524
+ className: "overflow-y-auto max-h-60",
7525
+ children: filteredOptions.length > 0 ? filteredOptions.map(function(option, index) {
7526
+ var optionValue = option.value || option.name;
7527
+ var isSelected = optionValue === inputValue;
7528
+ return /*#__PURE__*/ jsx$1("div", {
7529
+ onClick: function() {
7530
+ return handleSelect(option);
7531
+ },
7532
+ className: [
7533
+ "px-4 py-2.5 cursor-pointer transition-colors",
7534
+ isSelected ? "bg-[#F5F5F5] text-[#6f6f6f] font-medium" : "hover:bg-[#F5F5F5]"
7535
+ ].join(" "),
7536
+ children: option.name
7537
+ }, index);
7538
+ }) : /*#__PURE__*/ jsx$1("div", {
7539
+ className: "px-4 py-3 text-center text-[#B0B0B0]",
7540
+ children: "沒有符合的選項"
7541
+ })
7542
+ })
7543
+ })
7544
+ ]
7545
+ });
7546
+ };
7547
+
7356
7548
  /* eslint-disable react/no-array-index-key */ /* eslint-disable react/prop-types */ function _array_like_to_array$2(arr, len) {
7357
7549
  if (len == null || len > arr.length) len = arr.length;
7358
7550
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -7601,9 +7793,10 @@ var SingleSelect = function(param) {
7601
7793
  disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
7602
7794
  }), field), {
7603
7795
  children: item === null || item === void 0 ? void 0 : (_item_option = item.option) === null || _item_option === void 0 ? void 0 : _item_option.map(function(group) {
7604
- return "label" in group ? /*#__PURE__*/ jsx$1("optgroup", {
7796
+ var _group_options;
7797
+ return "label" in group && "options" in group ? /*#__PURE__*/ jsx$1("optgroup", {
7605
7798
  label: group.label,
7606
- children: group.options.map(function(o) {
7799
+ children: (_group_options = group.options) === null || _group_options === void 0 ? void 0 : _group_options.map(function(o) {
7607
7800
  return /*#__PURE__*/ jsx$1("option", {
7608
7801
  value: o.value,
7609
7802
  children: o.name
@@ -8011,9 +8204,12 @@ var FieldArray = function(param) {
8011
8204
  name: item.name
8012
8205
  }), fields = _useFieldArray.fields, append = _useFieldArray.append, remove = _useFieldArray.remove;
8013
8206
  var config = item === null || item === void 0 ? void 0 : item.fieldArrayConfig;
8014
- var fieldConfigs = (config === null || config === void 0 ? void 0 : config.fields) || [];
8207
+ var fieldConfigs = React__default.useMemo(function() {
8208
+ return (config === null || config === void 0 ? void 0 : config.fields) || [];
8209
+ }, [
8210
+ config === null || config === void 0 ? void 0 : config.fields
8211
+ ]);
8015
8212
  var addButtonText = (config === null || config === void 0 ? void 0 : config.addButtonText) || "新增";
8016
- (config === null || config === void 0 ? void 0 : config.removeButtonText) || "刪除";
8017
8213
  var maxItems = config === null || config === void 0 ? void 0 : config.maxItems;
8018
8214
  var minItems = (config === null || config === void 0 ? void 0 : config.minItems) || 0;
8019
8215
  var defaultItemCount = (config === null || config === void 0 ? void 0 : config.defaultItemCount) || 1;
@@ -8021,7 +8217,6 @@ var FieldArray = function(param) {
8021
8217
  var addButtonClassName = config === null || config === void 0 ? void 0 : config.addButtonClassName;
8022
8218
  var canAdd = !maxItems || fields.length < maxItems;
8023
8219
  var canRemove = fields.length > minItems;
8024
- // 初始化:確保至少有 defaultItemCount 個項目
8025
8220
  React__default.useEffect(function() {
8026
8221
  var currentValues = getValues(item.name);
8027
8222
  if (!currentValues || currentValues.length === 0) {
@@ -8035,8 +8230,13 @@ var FieldArray = function(param) {
8035
8230
  var itemsToAdd = defaultItemCount;
8036
8231
  for(var i = 0; i < itemsToAdd; i++)_loop(i);
8037
8232
  }
8038
- // eslint-disable-next-line react-hooks/exhaustive-deps
8039
- }, []);
8233
+ }, [
8234
+ append,
8235
+ defaultItemCount,
8236
+ fieldConfigs,
8237
+ getValues,
8238
+ item.name
8239
+ ]);
8040
8240
  var handleAdd = function() {
8041
8241
  if (canAdd) {
8042
8242
  var newItem = {};
@@ -8089,119 +8289,139 @@ var FieldArray = function(param) {
8089
8289
  (item === null || item === void 0 ? void 0 : item.label) && /*#__PURE__*/ jsx$1(FieldLabel, {
8090
8290
  item: item
8091
8291
  }),
8292
+ addButtonPosition === "top" && canAdd && /*#__PURE__*/ jsxs("button", {
8293
+ type: "button",
8294
+ onClick: handleAdd,
8295
+ className: addButtonClassName || [
8296
+ "h-11 px-4 rounded-2xl border border-solid border-[#6f6f6f]",
8297
+ "text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
8298
+ "transition-colors duration-200",
8299
+ "flex items-center whitespace-nowrap mb-4"
8300
+ ].join(" "),
8301
+ children: [
8302
+ "+ ",
8303
+ addButtonText
8304
+ ]
8305
+ }),
8092
8306
  /*#__PURE__*/ jsxs("div", {
8093
8307
  className: "space-y-2",
8094
8308
  children: [
8095
8309
  fields.map(function(field, index) {
8096
8310
  return /*#__PURE__*/ jsx$1("div", {
8097
- className: "bg-white overflow-scroll",
8098
- children: /*#__PURE__*/ jsxs("div", {
8099
- className: "flex items-start gap-2 flex-wrap lg:flex-nowrap h-[96px]",
8100
- children: [
8101
- fieldConfigs.map(function(fieldConfig, fieldIndex) {
8102
- var _fieldConfig_validateOption;
8103
- var fieldName = "".concat(item.name, ".").concat(index, ".").concat(fieldConfig.name);
8104
- var fieldError = getFieldError(index, fieldConfig.name);
8105
- var isLastField = fieldIndex === fieldConfigs.length - 1;
8106
- return /*#__PURE__*/ jsxs("div", {
8107
- className: [
8108
- isLastField ? "flex items-start gap-2 flex-1" : "flex-1",
8109
- "min-w-[200px]"
8110
- ].join(" "),
8111
- children: [
8112
- /*#__PURE__*/ jsxs("div", {
8113
- className: "flex-1",
8311
+ className: "bg-white",
8312
+ children: /*#__PURE__*/ jsx$1("div", {
8313
+ className: "flex items-start gap-2 flex-wrap lg:flex-nowrap",
8314
+ children: fieldConfigs.map(function(fieldConfig, fieldIndex) {
8315
+ var _fieldConfig_validateOption;
8316
+ var fieldName = "".concat(item.name, ".").concat(index, ".").concat(fieldConfig.name);
8317
+ var fieldError = getFieldError(index, fieldConfig.name);
8318
+ var isLastField = fieldIndex === fieldConfigs.length - 1;
8319
+ // 🎯 關鍵判斷:是否有選項(使用可編輯下拉選單)
8320
+ var hasOptions = fieldConfig.options && fieldConfig.options.length > 0;
8321
+ return /*#__PURE__*/ jsxs("div", {
8322
+ className: [
8323
+ isLastField ? "flex items-start gap-1 flex-1" : "flex-1",
8324
+ "min-w-[200px]"
8325
+ ].join(" "),
8326
+ children: [
8327
+ /*#__PURE__*/ jsxs("div", {
8328
+ className: "flex-1",
8329
+ children: [
8330
+ /*#__PURE__*/ jsxs("div", {
8331
+ className: "font-medium mb-2",
8332
+ children: [
8333
+ fieldConfig.label,
8334
+ (fieldConfig === null || fieldConfig === void 0 ? void 0 : (_fieldConfig_validateOption = fieldConfig.validateOption) === null || _fieldConfig_validateOption === void 0 ? void 0 : _fieldConfig_validateOption.required) && /*#__PURE__*/ jsx$1("span", {
8335
+ className: "pl-1 text-[#EF5533] font-bold",
8336
+ children: "*"
8337
+ })
8338
+ ]
8339
+ }),
8340
+ /*#__PURE__*/ jsx$1(Controller, {
8341
+ name: fieldName,
8342
+ control: control,
8343
+ rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.validateOption,
8344
+ render: function(param) {
8345
+ var controllerField = param.field;
8346
+ var _fieldConfig_options;
8347
+ return /*#__PURE__*/ jsx$1("div", {
8348
+ className: "relative",
8349
+ children: hasOptions ? // ✅ 使用可編輯下拉選單 - 既可以輸入也可以選擇
8350
+ /*#__PURE__*/ jsx$1(EditableCombobox, {
8351
+ value: controllerField.value || "",
8352
+ onChange: controllerField.onChange,
8353
+ options: (_fieldConfig_options = fieldConfig.options) === null || _fieldConfig_options === void 0 ? void 0 : _fieldConfig_options.map(function(opt) {
8354
+ var _opt_value;
8355
+ return {
8356
+ name: opt.name,
8357
+ value: String((_opt_value = opt.value) !== null && _opt_value !== void 0 ? _opt_value : opt.name)
8358
+ };
8359
+ }),
8360
+ placeholder: fieldConfig.placeholder || fieldConfig.label,
8361
+ disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
8362
+ }) : // ✅ 使用一般 input
8363
+ /*#__PURE__*/ jsx$1("input", _object_spread_props(_object_spread({}, controllerField), {
8364
+ type: "text",
8365
+ className: [
8366
+ (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]",
8367
+ "w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
8368
+ ].join(" "),
8369
+ placeholder: fieldConfig.placeholder || fieldConfig.label,
8370
+ disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
8371
+ }))
8372
+ });
8373
+ }
8374
+ }),
8375
+ fieldError && "message" in fieldError && typeof fieldError.message === "string" && /*#__PURE__*/ jsxs("div", {
8376
+ className: "pt-1 text-xs text-[#EF5533]",
8377
+ children: [
8378
+ "*",
8379
+ fieldError.message
8380
+ ]
8381
+ })
8382
+ ]
8383
+ }),
8384
+ /*#__PURE__*/ jsx$1("div", {
8385
+ className: "flex gap-1 items-center",
8386
+ children: isLastField && /*#__PURE__*/ jsxs("div", {
8387
+ className: [
8388
+ "flex items-center justify-center flex-shrink-0",
8389
+ "mt-[30px]"
8390
+ ].join(" "),
8114
8391
  children: [
8115
- /*#__PURE__*/ jsxs("div", {
8116
- className: "font-medium mb-2 text-sm",
8392
+ addButtonPosition === "inline" && canAdd && index === fields.length - 1 && /*#__PURE__*/ jsxs("button", {
8393
+ type: "button",
8394
+ onClick: handleAdd,
8395
+ className: addButtonClassName || [
8396
+ "h-11 px-4 rounded-2xl border border-solid border-[#6f6f6f]",
8397
+ "text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
8398
+ "transition-colors duration-200",
8399
+ "flex items-center gap-2 whitespace-nowrap flex-shrink-0"
8400
+ ].join(" "),
8117
8401
  children: [
8118
- fieldConfig.label,
8119
- (fieldConfig === null || fieldConfig === void 0 ? void 0 : (_fieldConfig_validateOption = fieldConfig.validateOption) === null || _fieldConfig_validateOption === void 0 ? void 0 : _fieldConfig_validateOption.required) && /*#__PURE__*/ jsx$1("span", {
8120
- className: "pl-1 text-[#EF5533] font-bold",
8121
- children: "*"
8122
- })
8402
+ /*#__PURE__*/ jsx$1(Icon, {
8403
+ icon: "mdi:plus",
8404
+ className: "w-5 h-5"
8405
+ }),
8406
+ addButtonText
8123
8407
  ]
8124
8408
  }),
8125
- /*#__PURE__*/ jsx$1(Controller, {
8126
- name: fieldName,
8127
- control: control,
8128
- rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.validateOption,
8129
- render: function(param) {
8130
- var controllerField = param.field;
8131
- return /*#__PURE__*/ jsxs("div", {
8132
- className: "relative",
8133
- children: [
8134
- /*#__PURE__*/ jsx$1("input", _object_spread_props(_object_spread({}, controllerField), {
8135
- list: "".concat(fieldName, "-datalist"),
8136
- type: "text",
8137
- className: [
8138
- (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]",
8139
- "w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
8140
- ].join(" "),
8141
- placeholder: fieldConfig.placeholder || fieldConfig.label,
8142
- disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
8143
- })),
8144
- fieldConfig.options && fieldConfig.options.length > 0 && /*#__PURE__*/ jsx$1("datalist", {
8145
- id: "".concat(fieldName, "-datalist"),
8146
- children: fieldConfig.options.map(function(option, optIndex) {
8147
- return /*#__PURE__*/ jsx$1("option", {
8148
- value: option.value || option.name,
8149
- children: option.name
8150
- }, optIndex);
8151
- })
8152
- })
8153
- ]
8154
- });
8155
- }
8156
- }),
8157
- (fieldError === null || fieldError === void 0 ? void 0 : fieldError.message) && /*#__PURE__*/ jsxs("div", {
8158
- className: "pt-1 text-xs text-[#EF5533]",
8159
- children: [
8160
- "*",
8161
- String(fieldError.message)
8162
- ]
8409
+ canRemove && fields.length > 1 && /*#__PURE__*/ jsx$1("div", {
8410
+ className: "p-2 rounded-2xl text-[#EF5533] bg-white hover:bg-[#FFF5F3] transition-colors duration-200 cursor-pointer",
8411
+ children: /*#__PURE__*/ jsx$1(Icon, {
8412
+ icon: "fluent-mdl2:delete",
8413
+ className: "w-6 h-6",
8414
+ onClick: function() {
8415
+ return handleRemove(index);
8416
+ }
8417
+ })
8163
8418
  })
8164
8419
  ]
8165
- }),
8166
- isLastField && canRemove && /*#__PURE__*/ jsx$1("button", {
8167
- type: "button",
8168
- onClick: function() {
8169
- return handleRemove(index);
8170
- },
8171
- className: [
8172
- "h-11 px-2 rounded-2xl",
8173
- "text-[#EF5533] bg-white hover:bg-[#FFF5F3]",
8174
- "transition-colors duration-200",
8175
- "flex items-center justify-center flex-shrink-0",
8176
- "mt-[30px]"
8177
- ].join(" "),
8178
- children: /*#__PURE__*/ jsx$1(Icon, {
8179
- icon: "fluent-mdl2:delete",
8180
- className: "w-6 h-6"
8181
- })
8182
8420
  })
8183
- ]
8184
- }, fieldIndex);
8185
- }),
8186
- addButtonPosition === "inline" && canAdd && index === fields.length - 1 && /*#__PURE__*/ jsxs("button", {
8187
- type: "button",
8188
- onClick: handleAdd,
8189
- className: addButtonClassName || [
8190
- "h-11 px-4 rounded-2xl border border-solid border-[#6f6f6f]",
8191
- "text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
8192
- "transition-colors duration-200",
8193
- "flex items-center gap-2 whitespace-nowrap flex-shrink-0",
8194
- "mt-[30px]"
8195
- ].join(" "),
8196
- children: [
8197
- /*#__PURE__*/ jsx$1(Icon, {
8198
- icon: "mdi:plus",
8199
- className: "w-5 h-5"
8200
- }),
8201
- addButtonText
8421
+ })
8202
8422
  ]
8203
- })
8204
- ]
8423
+ }, fieldIndex);
8424
+ })
8205
8425
  })
8206
8426
  }, field.id);
8207
8427
  }),