@sunggang/ui-lib 0.4.63 → 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.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$7(arr, len) {
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$7(arr) {
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$7(arr);
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$7(arr, i) {
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$7() {
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$7(arr, i) {
380
- return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
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$7(arr) || _non_iterable_spread();
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$7(o, minLen) {
385
+ function _unsupported_iterable_to_array$8(o, minLen) {
386
386
  if (!o) return;
387
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
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$7(o, minLen);
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$7(_ref, 1), firstEntry = _$_ref[0];
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$6(arr, len) {
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$6(arr) {
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$6(arr, i) {
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$6() {
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$6(arr, i) {
6223
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
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$6(o, minLen) {
6225
+ function _unsupported_iterable_to_array$7(o, minLen) {
6226
6226
  if (!o) return;
6227
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
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$6(o, minLen);
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$6(React.useState(null), 2), currentCity = _useState[0], setCurrentCity = _useState[1];
6261
- var _useState1 = _sliced_to_array$6(React.useState(DistrictData), 1), city = _useState1[0];
6262
- var _useState2 = _sliced_to_array$6(React.useState([]), 2), district = _useState2[0], setDistrict = _useState2[1];
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$5(arr, len) {
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$5(arr) {
6403
+ function _array_with_holes$6(arr) {
6404
6404
  if (Array.isArray(arr)) return arr;
6405
6405
  }
6406
- function _iterable_to_array_limit$5(arr, i) {
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$5() {
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$5(arr, i) {
6434
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
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$5(o, minLen) {
6436
+ function _unsupported_iterable_to_array$6(o, minLen) {
6437
6437
  if (!o) return;
6438
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
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$5(o, minLen);
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$5(React.useState(null), 2), tempImage = _useState[0], setTempImage = _useState[1];
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$4(arr, len) {
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$4(arr) {
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$4(arr, i) {
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$4() {
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$4(arr, i) {
6623
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
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$4(o, minLen) {
6625
+ function _unsupported_iterable_to_array$5(o, minLen) {
6626
6626
  if (!o) return;
6627
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
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$4(o, minLen);
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$4(React.useState(null), 2), modal = _useState[0], setModal = _useState[1];
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$3(arr, len) {
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$3(arr) {
6819
+ function _array_with_holes$4(arr) {
6820
6820
  if (Array.isArray(arr)) return arr;
6821
6821
  }
6822
- function _iterable_to_array_limit$3(arr, i) {
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$3() {
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$3(arr, i) {
6850
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
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$3(o, minLen) {
6852
+ function _unsupported_iterable_to_array$4(o, minLen) {
6853
6853
  if (!o) return;
6854
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
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$3(o, minLen);
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$3(React.useState(""), 2), query = _useState[0], setQuery = _useState[1];
6866
- var _useState1 = _sliced_to_array$3(React.useState(false), 2), open = _useState1[0], setOpen = _useState1[1];
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,198 @@ 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 dropdownRef = React.useRef(null);
7435
+ var inputRef = React.useRef(null);
7436
+ React.useEffect(function() {
7437
+ setInputValue(value);
7438
+ }, [
7439
+ value
7440
+ ]);
7441
+ React.useEffect(function() {
7442
+ var handleClickOutside = function(event) {
7443
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
7444
+ setIsOpen(false);
7445
+ setIsTyping(false);
7446
+ }
7447
+ };
7448
+ document.addEventListener("mousedown", handleClickOutside);
7449
+ return function() {
7450
+ return document.removeEventListener("mousedown", handleClickOutside);
7451
+ };
7452
+ }, []);
7453
+ var filteredOptions = isTyping ? options.filter(function(option) {
7454
+ var optionText = option.name || option.value || "";
7455
+ return optionText.toLowerCase().includes(inputValue.toLowerCase());
7456
+ }) : options;
7457
+ var handleSelect = function(option) {
7458
+ var _inputRef_current;
7459
+ var selectedValue = option.value || option.name;
7460
+ setInputValue(selectedValue);
7461
+ onChange(selectedValue);
7462
+ setIsOpen(false);
7463
+ setIsTyping(false);
7464
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
7465
+ };
7466
+ var handleInputChange = function(e) {
7467
+ var newValue = e.target.value;
7468
+ setInputValue(newValue);
7469
+ onChange(newValue);
7470
+ setIsTyping(true);
7471
+ if (!isOpen) {
7472
+ setIsOpen(true);
7473
+ }
7474
+ };
7475
+ var handleInputClick = function() {
7476
+ if (!disabled) {
7477
+ setIsTyping(false);
7478
+ setIsOpen(true);
7479
+ }
7480
+ };
7481
+ var handleClear = function(e) {
7482
+ var _inputRef_current;
7483
+ e.stopPropagation();
7484
+ setInputValue("");
7485
+ onChange("");
7486
+ setIsOpen(false);
7487
+ setIsTyping(false);
7488
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
7489
+ };
7490
+ var handleDropdownToggle = function(e) {
7491
+ e.stopPropagation();
7492
+ if (!disabled) {
7493
+ var _inputRef_current;
7494
+ setIsTyping(false);
7495
+ setIsOpen(!isOpen);
7496
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
7497
+ }
7498
+ };
7499
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
7500
+ ref: dropdownRef,
7501
+ className: "relative ".concat(className),
7502
+ children: [
7503
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
7504
+ className: "relative",
7505
+ children: [
7506
+ /*#__PURE__*/ jsxRuntime.jsx("input", {
7507
+ ref: inputRef,
7508
+ type: "text",
7509
+ value: inputValue,
7510
+ onChange: handleInputChange,
7511
+ onClick: handleInputClick,
7512
+ placeholder: placeholder,
7513
+ disabled: disabled,
7514
+ className: [
7515
+ "w-full h-11 rounded-2xl px-4 pr-20 border border-solid border-[#B4B4B4]",
7516
+ "transition-colors duration-200",
7517
+ disabled ? "text-[#B0B0B0] bg-[#e5e7eb] cursor-not-allowed" : "bg-white text-[#6f6f6f] hover:border-[#6f6f6f] focus:border-[#6f6f6f] focus:outline-none"
7518
+ ].join(" ")
7519
+ }),
7520
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
7521
+ className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",
7522
+ children: [
7523
+ inputValue && !disabled && /*#__PURE__*/ jsxRuntime.jsx("button", {
7524
+ onClick: handleClear,
7525
+ className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors",
7526
+ type: "button",
7527
+ tabIndex: -1,
7528
+ children: /*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
7529
+ icon: "mdi:close",
7530
+ className: "w-4 h-4"
7531
+ })
7532
+ }),
7533
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
7534
+ onClick: handleDropdownToggle,
7535
+ className: "p-1.5 hover:bg-gray-100 rounded-full transition-colors",
7536
+ type: "button",
7537
+ tabIndex: -1,
7538
+ disabled: disabled,
7539
+ children: /*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
7540
+ icon: "mdi:chevron-down",
7541
+ className: "w-5 h-5 transition-transform duration-200 ".concat(isOpen ? "rotate-180" : "")
7542
+ })
7543
+ })
7544
+ ]
7545
+ })
7546
+ ]
7547
+ }),
7548
+ isOpen && !disabled && /*#__PURE__*/ jsxRuntime.jsx("div", {
7549
+ className: "absolute z-50 w-full mt-1 bg-white border border-[#B4B4B4] rounded-2xl shadow-lg max-h-60 overflow-hidden",
7550
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
7551
+ className: "overflow-y-auto max-h-60",
7552
+ children: filteredOptions.length > 0 ? filteredOptions.map(function(option, index) {
7553
+ var optionValue = option.value || option.name;
7554
+ var isSelected = optionValue === inputValue;
7555
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
7556
+ onClick: function() {
7557
+ return handleSelect(option);
7558
+ },
7559
+ className: [
7560
+ "px-4 py-2.5 cursor-pointer transition-colors",
7561
+ isSelected ? "bg-[#F5F5F5] text-[#6f6f6f] font-medium" : "hover:bg-[#F5F5F5]"
7562
+ ].join(" "),
7563
+ children: option.name
7564
+ }, index);
7565
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
7566
+ className: "px-4 py-3 text-center text-[#B0B0B0]",
7567
+ children: "沒有符合的選項"
7568
+ })
7569
+ })
7570
+ })
7571
+ ]
7572
+ });
7573
+ };
7574
+
7383
7575
  /* eslint-disable react/no-array-index-key */ /* eslint-disable react/prop-types */ function _array_like_to_array$2(arr, len) {
7384
7576
  if (len == null || len > arr.length) len = arr.length;
7385
7577
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -7628,9 +7820,10 @@ var SingleSelect = function(param) {
7628
7820
  disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
7629
7821
  }), field), {
7630
7822
  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
- return "label" in group ? /*#__PURE__*/ jsxRuntime.jsx("optgroup", {
7823
+ var _group_options;
7824
+ return "label" in group && "options" in group ? /*#__PURE__*/ jsxRuntime.jsx("optgroup", {
7632
7825
  label: group.label,
7633
- children: group.options.map(function(o) {
7826
+ children: (_group_options = group.options) === null || _group_options === void 0 ? void 0 : _group_options.map(function(o) {
7634
7827
  return /*#__PURE__*/ jsxRuntime.jsx("option", {
7635
7828
  value: o.value,
7636
7829
  children: o.name
@@ -8038,7 +8231,11 @@ var FieldArray = function(param) {
8038
8231
  name: item.name
8039
8232
  }), fields = _useFieldArray.fields, append = _useFieldArray.append, remove = _useFieldArray.remove;
8040
8233
  var config = item === null || item === void 0 ? void 0 : item.fieldArrayConfig;
8041
- var fieldConfigs = (config === null || config === void 0 ? void 0 : config.fields) || [];
8234
+ var fieldConfigs = React__default["default"].useMemo(function() {
8235
+ return (config === null || config === void 0 ? void 0 : config.fields) || [];
8236
+ }, [
8237
+ config === null || config === void 0 ? void 0 : config.fields
8238
+ ]);
8042
8239
  var addButtonText = (config === null || config === void 0 ? void 0 : config.addButtonText) || "新增";
8043
8240
  var maxItems = config === null || config === void 0 ? void 0 : config.maxItems;
8044
8241
  var minItems = (config === null || config === void 0 ? void 0 : config.minItems) || 0;
@@ -8047,7 +8244,6 @@ var FieldArray = function(param) {
8047
8244
  var addButtonClassName = config === null || config === void 0 ? void 0 : config.addButtonClassName;
8048
8245
  var canAdd = !maxItems || fields.length < maxItems;
8049
8246
  var canRemove = fields.length > minItems;
8050
- // 初始化:確保至少有 defaultItemCount 個項目
8051
8247
  React__default["default"].useEffect(function() {
8052
8248
  var currentValues = getValues(item.name);
8053
8249
  if (!currentValues || currentValues.length === 0) {
@@ -8061,8 +8257,13 @@ var FieldArray = function(param) {
8061
8257
  var itemsToAdd = defaultItemCount;
8062
8258
  for(var i = 0; i < itemsToAdd; i++)_loop(i);
8063
8259
  }
8064
- // eslint-disable-next-line react-hooks/exhaustive-deps
8065
- }, []);
8260
+ }, [
8261
+ append,
8262
+ defaultItemCount,
8263
+ fieldConfigs,
8264
+ getValues,
8265
+ item.name
8266
+ ]);
8066
8267
  var handleAdd = function() {
8067
8268
  if (canAdd) {
8068
8269
  var newItem = {};
@@ -8134,14 +8335,16 @@ var FieldArray = function(param) {
8134
8335
  children: [
8135
8336
  fields.map(function(field, index) {
8136
8337
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
8137
- className: "bg-white overflow-scroll",
8338
+ className: "bg-white",
8138
8339
  children: /*#__PURE__*/ jsxRuntime.jsx("div", {
8139
- className: "flex items-start gap-2 flex-wrap lg:flex-nowrap h-[96px]",
8340
+ className: "flex items-start gap-2 flex-wrap lg:flex-nowrap",
8140
8341
  children: fieldConfigs.map(function(fieldConfig, fieldIndex) {
8141
8342
  var _fieldConfig_validateOption;
8142
8343
  var fieldName = "".concat(item.name, ".").concat(index, ".").concat(fieldConfig.name);
8143
8344
  var fieldError = getFieldError(index, fieldConfig.name);
8144
8345
  var isLastField = fieldIndex === fieldConfigs.length - 1;
8346
+ // 🎯 關鍵判斷:是否有選項(使用可編輯下拉選單)
8347
+ var hasOptions = fieldConfig.options && fieldConfig.options.length > 0;
8145
8348
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
8146
8349
  className: [
8147
8350
  isLastField ? "flex items-start gap-1 flex-1" : "flex-1",
@@ -8167,37 +8370,40 @@ var FieldArray = function(param) {
8167
8370
  rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.validateOption,
8168
8371
  render: function(param) {
8169
8372
  var controllerField = param.field;
8170
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
8373
+ var _fieldConfig_options;
8374
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
8171
8375
  className: "relative",
8172
- children: [
8173
- /*#__PURE__*/ jsxRuntime.jsx("input", _object_spread_props(_object_spread({}, controllerField), {
8174
- list: "".concat(fieldName, "-datalist"),
8175
- type: "text",
8176
- className: [
8177
- (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]",
8178
- "w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
8179
- ].join(" "),
8180
- placeholder: fieldConfig.placeholder || fieldConfig.label,
8181
- disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
8182
- })),
8183
- fieldConfig.options && fieldConfig.options.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("datalist", {
8184
- id: "".concat(fieldName, "-datalist"),
8185
- children: fieldConfig.options.map(function(option, optIndex) {
8186
- return /*#__PURE__*/ jsxRuntime.jsx("option", {
8187
- value: option.value || option.name,
8188
- children: option.name
8189
- }, optIndex);
8190
- })
8191
- })
8192
- ]
8376
+ children: hasOptions ? // ✅ 使用可編輯下拉選單 - 既可以輸入也可以選擇
8377
+ /*#__PURE__*/ jsxRuntime.jsx(EditableCombobox, {
8378
+ value: controllerField.value || "",
8379
+ onChange: controllerField.onChange,
8380
+ options: (_fieldConfig_options = fieldConfig.options) === null || _fieldConfig_options === void 0 ? void 0 : _fieldConfig_options.map(function(opt) {
8381
+ var _opt_value;
8382
+ return {
8383
+ name: opt.name,
8384
+ value: String((_opt_value = opt.value) !== null && _opt_value !== void 0 ? _opt_value : opt.name)
8385
+ };
8386
+ }),
8387
+ placeholder: fieldConfig.placeholder || fieldConfig.label,
8388
+ disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
8389
+ }) : // 使用一般 input
8390
+ /*#__PURE__*/ jsxRuntime.jsx("input", _object_spread_props(_object_spread({}, controllerField), {
8391
+ type: "text",
8392
+ className: [
8393
+ (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]",
8394
+ "w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
8395
+ ].join(" "),
8396
+ placeholder: fieldConfig.placeholder || fieldConfig.label,
8397
+ disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
8398
+ }))
8193
8399
  });
8194
8400
  }
8195
8401
  }),
8196
- (fieldError === null || fieldError === void 0 ? void 0 : fieldError.message) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
8402
+ fieldError && "message" in fieldError && typeof fieldError.message === "string" && /*#__PURE__*/ jsxRuntime.jsxs("div", {
8197
8403
  className: "pt-1 text-xs text-[#EF5533]",
8198
8404
  children: [
8199
8405
  "*",
8200
- String(fieldError.message)
8406
+ fieldError.message
8201
8407
  ]
8202
8408
  })
8203
8409
  ]
@@ -8228,7 +8434,7 @@ var FieldArray = function(param) {
8228
8434
  ]
8229
8435
  }),
8230
8436
  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",
8437
+ className: "p-2 rounded-2xl text-[#EF5533] bg-white hover:bg-[#FFF5F3] transition-colors duration-200 cursor-pointer",
8232
8438
  children: /*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
8233
8439
  icon: "fluent-mdl2:delete",
8234
8440
  className: "w-6 h-6",