@sunggang/ui-lib 0.4.8 → 0.4.9
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/BaseCkeditor.cjs.js +1 -0
- package/BaseCkeditor.esm.js +1 -0
- package/CkEditor.cjs.js +1 -0
- package/CkEditor.esm.js +1 -0
- package/Form.cjs.js +1 -0
- package/Form.esm.js +1 -0
- package/baseSwitch.cjs.js +73 -389
- package/baseSwitch.esm.js +72 -389
- package/index.cjs.css +0 -3
- package/index.cjs.js +1 -0
- package/index.esm.css +0 -3
- package/index.esm.js +1 -0
- package/package.json +1 -1
- package/src/lib/Form/demo.d.ts +33 -1
- package/src/lib/Form/index.d.ts +2 -5
- package/src/lib/Form/DynamicLoader.d.ts +0 -10
- package/src/lib/Form/demo-test.d.ts +0 -66
package/baseSwitch.cjs.js
CHANGED
|
@@ -5,6 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var SwitchPrimitives = require('@radix-ui/react-switch');
|
|
6
6
|
var utils = require('./utils.cjs.js');
|
|
7
7
|
var index_esm = require('./index.esm.cjs.js');
|
|
8
|
+
var dynamic = require('next/dynamic');
|
|
8
9
|
var setPrototypeOf = require('./setPrototypeOf.cjs.js');
|
|
9
10
|
var memoizeOne_esm = require('./memoize-one.esm.cjs.js');
|
|
10
11
|
var react = require('@emotion/react');
|
|
@@ -42,6 +43,7 @@ function _interopNamespace(e) {
|
|
|
42
43
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
43
44
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
44
45
|
var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
|
|
46
|
+
var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
|
|
45
47
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
46
48
|
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
47
49
|
var Mandarin__default = /*#__PURE__*/_interopDefaultLegacy(Mandarin);
|
|
@@ -270,16 +272,16 @@ function getFrameElement(win) {
|
|
|
270
272
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
|
-
function _array_like_to_array$
|
|
275
|
+
function _array_like_to_array$5(arr, len) {
|
|
274
276
|
if (len == null || len > arr.length) len = arr.length;
|
|
275
277
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
276
278
|
return arr2;
|
|
277
279
|
}
|
|
278
|
-
function _array_with_holes$
|
|
280
|
+
function _array_with_holes$5(arr) {
|
|
279
281
|
if (Array.isArray(arr)) return arr;
|
|
280
282
|
}
|
|
281
283
|
function _array_without_holes(arr) {
|
|
282
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
284
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
283
285
|
}
|
|
284
286
|
function _define_property$5(obj, key, value) {
|
|
285
287
|
if (key in obj) {
|
|
@@ -297,7 +299,7 @@ function _define_property$5(obj, key, value) {
|
|
|
297
299
|
function _iterable_to_array(iter) {
|
|
298
300
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
299
301
|
}
|
|
300
|
-
function _iterable_to_array_limit$
|
|
302
|
+
function _iterable_to_array_limit$5(arr, i) {
|
|
301
303
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
302
304
|
if (_i == null) return;
|
|
303
305
|
var _arr = [];
|
|
@@ -321,7 +323,7 @@ function _iterable_to_array_limit$6(arr, i) {
|
|
|
321
323
|
}
|
|
322
324
|
return _arr;
|
|
323
325
|
}
|
|
324
|
-
function _non_iterable_rest$
|
|
326
|
+
function _non_iterable_rest$5() {
|
|
325
327
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
326
328
|
}
|
|
327
329
|
function _non_iterable_spread() {
|
|
@@ -366,19 +368,19 @@ function _object_spread_props$5(target, source) {
|
|
|
366
368
|
}
|
|
367
369
|
return target;
|
|
368
370
|
}
|
|
369
|
-
function _sliced_to_array$
|
|
370
|
-
return _array_with_holes$
|
|
371
|
+
function _sliced_to_array$5(arr, i) {
|
|
372
|
+
return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
|
|
371
373
|
}
|
|
372
374
|
function _to_consumable_array(arr) {
|
|
373
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$
|
|
375
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread();
|
|
374
376
|
}
|
|
375
|
-
function _unsupported_iterable_to_array$
|
|
377
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
376
378
|
if (!o) return;
|
|
377
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
379
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
378
380
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
379
381
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
380
382
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
381
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
383
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
382
384
|
}
|
|
383
385
|
function getCssDimensions(element) {
|
|
384
386
|
var css = getComputedStyle$1(element);
|
|
@@ -604,7 +606,7 @@ function observeMove(element, onMove) {
|
|
|
604
606
|
var resizeObserver = null;
|
|
605
607
|
if (elementResize) {
|
|
606
608
|
resizeObserver = new ResizeObserver(function(_ref) {
|
|
607
|
-
var _$_ref = _sliced_to_array$
|
|
609
|
+
var _$_ref = _sliced_to_array$5(_ref, 1), firstEntry = _$_ref[0];
|
|
608
610
|
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
609
611
|
// Prevent update loops when using the `size` middleware.
|
|
610
612
|
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
@@ -21164,12 +21166,12 @@ var validateMsg = function(errors, item) {
|
|
|
21164
21166
|
return errorMsg;
|
|
21165
21167
|
};
|
|
21166
21168
|
|
|
21167
|
-
/* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$
|
|
21169
|
+
/* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$4(arr, len) {
|
|
21168
21170
|
if (len == null || len > arr.length) len = arr.length;
|
|
21169
21171
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21170
21172
|
return arr2;
|
|
21171
21173
|
}
|
|
21172
|
-
function _array_with_holes$
|
|
21174
|
+
function _array_with_holes$4(arr) {
|
|
21173
21175
|
if (Array.isArray(arr)) return arr;
|
|
21174
21176
|
}
|
|
21175
21177
|
function _define_property$4(obj, key, value) {
|
|
@@ -21185,7 +21187,7 @@ function _define_property$4(obj, key, value) {
|
|
|
21185
21187
|
}
|
|
21186
21188
|
return obj;
|
|
21187
21189
|
}
|
|
21188
|
-
function _iterable_to_array_limit$
|
|
21190
|
+
function _iterable_to_array_limit$4(arr, i) {
|
|
21189
21191
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
21190
21192
|
if (_i == null) return;
|
|
21191
21193
|
var _arr = [];
|
|
@@ -21209,7 +21211,7 @@ function _iterable_to_array_limit$5(arr, i) {
|
|
|
21209
21211
|
}
|
|
21210
21212
|
return _arr;
|
|
21211
21213
|
}
|
|
21212
|
-
function _non_iterable_rest$
|
|
21214
|
+
function _non_iterable_rest$4() {
|
|
21213
21215
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21214
21216
|
}
|
|
21215
21217
|
function _object_spread$4(target) {
|
|
@@ -21251,16 +21253,16 @@ function _object_spread_props$4(target, source) {
|
|
|
21251
21253
|
}
|
|
21252
21254
|
return target;
|
|
21253
21255
|
}
|
|
21254
|
-
function _sliced_to_array$
|
|
21255
|
-
return _array_with_holes$
|
|
21256
|
+
function _sliced_to_array$4(arr, i) {
|
|
21257
|
+
return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
|
|
21256
21258
|
}
|
|
21257
|
-
function _unsupported_iterable_to_array$
|
|
21259
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
21258
21260
|
if (!o) return;
|
|
21259
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
21261
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
21260
21262
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21261
21263
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21262
21264
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21263
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
21265
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
21264
21266
|
}
|
|
21265
21267
|
// interface CityDistrictProps {
|
|
21266
21268
|
// item?: {
|
|
@@ -21289,9 +21291,9 @@ var CityDistrict = function(param) {
|
|
|
21289
21291
|
var item = param.item;
|
|
21290
21292
|
var _errors_city, _errors_district;
|
|
21291
21293
|
var _useFormContext = index_esm.useFormContext(), register = _useFormContext.register, setValue = _useFormContext.setValue, getValues = _useFormContext.getValues, errors = _useFormContext.formState.errors;
|
|
21292
|
-
var _useState = _sliced_to_array$
|
|
21293
|
-
var _useState1 = _sliced_to_array$
|
|
21294
|
-
var _useState2 = _sliced_to_array$
|
|
21294
|
+
var _useState = _sliced_to_array$4(React.useState(null), 2), currentCity = _useState[0], setCurrentCity = _useState[1];
|
|
21295
|
+
var _useState1 = _sliced_to_array$4(React.useState(DistrictData), 1), city = _useState1[0];
|
|
21296
|
+
var _useState2 = _sliced_to_array$4(React.useState([]), 2), district = _useState2[0], setDistrict = _useState2[1];
|
|
21295
21297
|
var cityValue = getValues().city;
|
|
21296
21298
|
var districtValue = getValues().district;
|
|
21297
21299
|
React.useEffect(function() {
|
|
@@ -21427,15 +21429,15 @@ var CityDistrict = function(param) {
|
|
|
21427
21429
|
}, Modal.v4());
|
|
21428
21430
|
};
|
|
21429
21431
|
|
|
21430
|
-
function _array_like_to_array$
|
|
21432
|
+
function _array_like_to_array$3(arr, len) {
|
|
21431
21433
|
if (len == null || len > arr.length) len = arr.length;
|
|
21432
21434
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21433
21435
|
return arr2;
|
|
21434
21436
|
}
|
|
21435
|
-
function _array_with_holes$
|
|
21437
|
+
function _array_with_holes$3(arr) {
|
|
21436
21438
|
if (Array.isArray(arr)) return arr;
|
|
21437
21439
|
}
|
|
21438
|
-
function _iterable_to_array_limit$
|
|
21440
|
+
function _iterable_to_array_limit$3(arr, i) {
|
|
21439
21441
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
21440
21442
|
if (_i == null) return;
|
|
21441
21443
|
var _arr = [];
|
|
@@ -21459,23 +21461,23 @@ function _iterable_to_array_limit$4(arr, i) {
|
|
|
21459
21461
|
}
|
|
21460
21462
|
return _arr;
|
|
21461
21463
|
}
|
|
21462
|
-
function _non_iterable_rest$
|
|
21464
|
+
function _non_iterable_rest$3() {
|
|
21463
21465
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21464
21466
|
}
|
|
21465
|
-
function _sliced_to_array$
|
|
21466
|
-
return _array_with_holes$
|
|
21467
|
+
function _sliced_to_array$3(arr, i) {
|
|
21468
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
|
|
21467
21469
|
}
|
|
21468
|
-
function _unsupported_iterable_to_array$
|
|
21470
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
21469
21471
|
if (!o) return;
|
|
21470
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
21472
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
21471
21473
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21472
21474
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21473
21475
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21474
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
21476
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
21475
21477
|
}
|
|
21476
21478
|
var BaseTemplate = function(param) {
|
|
21477
21479
|
var item = param.item, file = param.file, imageUrl = param.imageUrl, field = param.field;
|
|
21478
|
-
var _useState = _sliced_to_array$
|
|
21480
|
+
var _useState = _sliced_to_array$3(React.useState(null), 2), tempImage = _useState[0], setTempImage = _useState[1];
|
|
21479
21481
|
React.useEffect(function() {
|
|
21480
21482
|
var fileReader;
|
|
21481
21483
|
var isCancel = false;
|
|
@@ -21609,12 +21611,12 @@ var BaseTemplate = function(param) {
|
|
|
21609
21611
|
});
|
|
21610
21612
|
};
|
|
21611
21613
|
|
|
21612
|
-
function _array_like_to_array$
|
|
21614
|
+
function _array_like_to_array$2(arr, len) {
|
|
21613
21615
|
if (len == null || len > arr.length) len = arr.length;
|
|
21614
21616
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21615
21617
|
return arr2;
|
|
21616
21618
|
}
|
|
21617
|
-
function _array_with_holes$
|
|
21619
|
+
function _array_with_holes$2(arr) {
|
|
21618
21620
|
if (Array.isArray(arr)) return arr;
|
|
21619
21621
|
}
|
|
21620
21622
|
function _instanceof(left, right) {
|
|
@@ -21624,7 +21626,7 @@ function _instanceof(left, right) {
|
|
|
21624
21626
|
return left instanceof right;
|
|
21625
21627
|
}
|
|
21626
21628
|
}
|
|
21627
|
-
function _iterable_to_array_limit$
|
|
21629
|
+
function _iterable_to_array_limit$2(arr, i) {
|
|
21628
21630
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
21629
21631
|
if (_i == null) return;
|
|
21630
21632
|
var _arr = [];
|
|
@@ -21648,25 +21650,25 @@ function _iterable_to_array_limit$3(arr, i) {
|
|
|
21648
21650
|
}
|
|
21649
21651
|
return _arr;
|
|
21650
21652
|
}
|
|
21651
|
-
function _non_iterable_rest$
|
|
21653
|
+
function _non_iterable_rest$2() {
|
|
21652
21654
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21653
21655
|
}
|
|
21654
|
-
function _sliced_to_array$
|
|
21655
|
-
return _array_with_holes$
|
|
21656
|
+
function _sliced_to_array$2(arr, i) {
|
|
21657
|
+
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
|
|
21656
21658
|
}
|
|
21657
|
-
function _unsupported_iterable_to_array$
|
|
21659
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
21658
21660
|
if (!o) return;
|
|
21659
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
21661
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
21660
21662
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21661
21663
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21662
21664
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21663
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
21665
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
21664
21666
|
}
|
|
21665
21667
|
var CustomUpload = function(param) {
|
|
21666
21668
|
var item = param.item, field = param.field;
|
|
21667
21669
|
var imageMimeType = /image\/(png|jpg|jpeg)/i;
|
|
21668
21670
|
var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = (item === null || item === void 0 ? void 0 : item.limitSize) || 5242880;
|
|
21669
|
-
var _useState = _sliced_to_array$
|
|
21671
|
+
var _useState = _sliced_to_array$2(React.useState(null), 2), modal = _useState[0], setModal = _useState[1];
|
|
21670
21672
|
var hiddenFileInput = React.useRef(null);
|
|
21671
21673
|
React.useEffect(function() {
|
|
21672
21674
|
if (modal) {
|
|
@@ -22046,15 +22048,15 @@ var BaseSelect = function(param) {
|
|
|
22046
22048
|
});
|
|
22047
22049
|
};
|
|
22048
22050
|
|
|
22049
|
-
function _array_like_to_array$
|
|
22051
|
+
function _array_like_to_array$1(arr, len) {
|
|
22050
22052
|
if (len == null || len > arr.length) len = arr.length;
|
|
22051
22053
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
22052
22054
|
return arr2;
|
|
22053
22055
|
}
|
|
22054
|
-
function _array_with_holes$
|
|
22056
|
+
function _array_with_holes$1(arr) {
|
|
22055
22057
|
if (Array.isArray(arr)) return arr;
|
|
22056
22058
|
}
|
|
22057
|
-
function _iterable_to_array_limit$
|
|
22059
|
+
function _iterable_to_array_limit$1(arr, i) {
|
|
22058
22060
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
22059
22061
|
if (_i == null) return;
|
|
22060
22062
|
var _arr = [];
|
|
@@ -22078,27 +22080,27 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
22078
22080
|
}
|
|
22079
22081
|
return _arr;
|
|
22080
22082
|
}
|
|
22081
|
-
function _non_iterable_rest$
|
|
22083
|
+
function _non_iterable_rest$1() {
|
|
22082
22084
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22083
22085
|
}
|
|
22084
|
-
function _sliced_to_array$
|
|
22085
|
-
return _array_with_holes$
|
|
22086
|
+
function _sliced_to_array$1(arr, i) {
|
|
22087
|
+
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
|
|
22086
22088
|
}
|
|
22087
|
-
function _unsupported_iterable_to_array$
|
|
22089
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
22088
22090
|
if (!o) return;
|
|
22089
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
22091
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
22090
22092
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22091
22093
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
22092
22094
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22093
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
22095
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
22094
22096
|
}
|
|
22095
22097
|
var DropdownList = function(param) {
|
|
22096
22098
|
var item = param.item, onUtilsReady = param.onUtilsReady;
|
|
22097
22099
|
var _item_option, _item_validateOption, _errors_funeralLocation;
|
|
22098
22100
|
var _useFormContext = index_esm.useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
|
|
22099
22101
|
var dropdownRef = React.useRef(null);
|
|
22100
|
-
var _useState = _sliced_to_array$
|
|
22101
|
-
var _useState1 = _sliced_to_array$
|
|
22102
|
+
var _useState = _sliced_to_array$1(React.useState(""), 2), query = _useState[0], setQuery = _useState[1];
|
|
22103
|
+
var _useState1 = _sliced_to_array$1(React.useState(false), 2), open = _useState1[0], setOpen = _useState1[1];
|
|
22102
22104
|
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) {
|
|
22103
22105
|
var _opt_name;
|
|
22104
22106
|
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());
|
|
@@ -22350,7 +22352,9 @@ var FlatpickrInput = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
22350
22352
|
instance.close();
|
|
22351
22353
|
}, 50);
|
|
22352
22354
|
}
|
|
22353
|
-
} else if (mode === "multiple" || (item === null || item === void 0 ? void 0 : item.flatpickrType) === "time")
|
|
22355
|
+
} else if (mode === "multiple" || (item === null || item === void 0 ? void 0 : item.flatpickrType) === "time") {
|
|
22356
|
+
onChange(selectedDates);
|
|
22357
|
+
} else {
|
|
22354
22358
|
// Single mode: 返回單一日期,預設行為會自動關閉
|
|
22355
22359
|
onChange(selectedDates.length > 0 ? selectedDates[0] : null);
|
|
22356
22360
|
}
|
|
@@ -22427,7 +22431,8 @@ var FlatpickrInput = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
22427
22431
|
placeholder: (item === null || item === void 0 ? void 0 : item.placeholder) || "請選擇日期",
|
|
22428
22432
|
style: item === null || item === void 0 ? void 0 : item.style,
|
|
22429
22433
|
disabled: isDisabled,
|
|
22430
|
-
readOnly: true
|
|
22434
|
+
readOnly: true,
|
|
22435
|
+
autoComplete: "off"
|
|
22431
22436
|
}),
|
|
22432
22437
|
(item === null || item === void 0 ? void 0 : item.icon) && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
22433
22438
|
className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none",
|
|
@@ -22482,319 +22487,6 @@ var FlatpickrField = function(param) {
|
|
|
22482
22487
|
});
|
|
22483
22488
|
};
|
|
22484
22489
|
|
|
22485
|
-
function _array_like_to_array$1(arr, len) {
|
|
22486
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
22487
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
22488
|
-
return arr2;
|
|
22489
|
-
}
|
|
22490
|
-
function _array_with_holes$1(arr) {
|
|
22491
|
-
if (Array.isArray(arr)) return arr;
|
|
22492
|
-
}
|
|
22493
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
22494
|
-
try {
|
|
22495
|
-
var info = gen[key](arg);
|
|
22496
|
-
var value = info.value;
|
|
22497
|
-
} catch (error) {
|
|
22498
|
-
reject(error);
|
|
22499
|
-
return;
|
|
22500
|
-
}
|
|
22501
|
-
if (info.done) {
|
|
22502
|
-
resolve(value);
|
|
22503
|
-
} else {
|
|
22504
|
-
Promise.resolve(value).then(_next, _throw);
|
|
22505
|
-
}
|
|
22506
|
-
}
|
|
22507
|
-
function _async_to_generator(fn) {
|
|
22508
|
-
return function() {
|
|
22509
|
-
var self = this, args = arguments;
|
|
22510
|
-
return new Promise(function(resolve, reject) {
|
|
22511
|
-
var gen = fn.apply(self, args);
|
|
22512
|
-
function _next(value) {
|
|
22513
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22514
|
-
}
|
|
22515
|
-
function _throw(err) {
|
|
22516
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
22517
|
-
}
|
|
22518
|
-
_next(undefined);
|
|
22519
|
-
});
|
|
22520
|
-
};
|
|
22521
|
-
}
|
|
22522
|
-
function _iterable_to_array_limit$1(arr, i) {
|
|
22523
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
22524
|
-
if (_i == null) return;
|
|
22525
|
-
var _arr = [];
|
|
22526
|
-
var _n = true;
|
|
22527
|
-
var _d = false;
|
|
22528
|
-
var _s, _e;
|
|
22529
|
-
try {
|
|
22530
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
22531
|
-
_arr.push(_s.value);
|
|
22532
|
-
if (i && _arr.length === i) break;
|
|
22533
|
-
}
|
|
22534
|
-
} catch (err) {
|
|
22535
|
-
_d = true;
|
|
22536
|
-
_e = err;
|
|
22537
|
-
} finally{
|
|
22538
|
-
try {
|
|
22539
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
22540
|
-
} finally{
|
|
22541
|
-
if (_d) throw _e;
|
|
22542
|
-
}
|
|
22543
|
-
}
|
|
22544
|
-
return _arr;
|
|
22545
|
-
}
|
|
22546
|
-
function _non_iterable_rest$1() {
|
|
22547
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22548
|
-
}
|
|
22549
|
-
function _sliced_to_array$1(arr, i) {
|
|
22550
|
-
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
|
|
22551
|
-
}
|
|
22552
|
-
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
22553
|
-
if (!o) return;
|
|
22554
|
-
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
22555
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22556
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
22557
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22558
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
22559
|
-
}
|
|
22560
|
-
function _ts_generator(thisArg, body) {
|
|
22561
|
-
var f, y, t, g, _ = {
|
|
22562
|
-
label: 0,
|
|
22563
|
-
sent: function() {
|
|
22564
|
-
if (t[0] & 1) throw t[1];
|
|
22565
|
-
return t[1];
|
|
22566
|
-
},
|
|
22567
|
-
trys: [],
|
|
22568
|
-
ops: []
|
|
22569
|
-
};
|
|
22570
|
-
return g = {
|
|
22571
|
-
next: verb(0),
|
|
22572
|
-
"throw": verb(1),
|
|
22573
|
-
"return": verb(2)
|
|
22574
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
22575
|
-
return this;
|
|
22576
|
-
}), g;
|
|
22577
|
-
function verb(n) {
|
|
22578
|
-
return function(v) {
|
|
22579
|
-
return step([
|
|
22580
|
-
n,
|
|
22581
|
-
v
|
|
22582
|
-
]);
|
|
22583
|
-
};
|
|
22584
|
-
}
|
|
22585
|
-
function step(op) {
|
|
22586
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
22587
|
-
while(_)try {
|
|
22588
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
22589
|
-
if (y = 0, t) op = [
|
|
22590
|
-
op[0] & 2,
|
|
22591
|
-
t.value
|
|
22592
|
-
];
|
|
22593
|
-
switch(op[0]){
|
|
22594
|
-
case 0:
|
|
22595
|
-
case 1:
|
|
22596
|
-
t = op;
|
|
22597
|
-
break;
|
|
22598
|
-
case 4:
|
|
22599
|
-
_.label++;
|
|
22600
|
-
return {
|
|
22601
|
-
value: op[1],
|
|
22602
|
-
done: false
|
|
22603
|
-
};
|
|
22604
|
-
case 5:
|
|
22605
|
-
_.label++;
|
|
22606
|
-
y = op[1];
|
|
22607
|
-
op = [
|
|
22608
|
-
0
|
|
22609
|
-
];
|
|
22610
|
-
continue;
|
|
22611
|
-
case 7:
|
|
22612
|
-
op = _.ops.pop();
|
|
22613
|
-
_.trys.pop();
|
|
22614
|
-
continue;
|
|
22615
|
-
default:
|
|
22616
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
22617
|
-
_ = 0;
|
|
22618
|
-
continue;
|
|
22619
|
-
}
|
|
22620
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
22621
|
-
_.label = op[1];
|
|
22622
|
-
break;
|
|
22623
|
-
}
|
|
22624
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
22625
|
-
_.label = t[1];
|
|
22626
|
-
t = op;
|
|
22627
|
-
break;
|
|
22628
|
-
}
|
|
22629
|
-
if (t && _.label < t[2]) {
|
|
22630
|
-
_.label = t[2];
|
|
22631
|
-
_.ops.push(op);
|
|
22632
|
-
break;
|
|
22633
|
-
}
|
|
22634
|
-
if (t[2]) _.ops.pop();
|
|
22635
|
-
_.trys.pop();
|
|
22636
|
-
continue;
|
|
22637
|
-
}
|
|
22638
|
-
op = body.call(thisArg, _);
|
|
22639
|
-
} catch (e) {
|
|
22640
|
-
op = [
|
|
22641
|
-
6,
|
|
22642
|
-
e
|
|
22643
|
-
];
|
|
22644
|
-
y = 0;
|
|
22645
|
-
} finally{
|
|
22646
|
-
f = t = 0;
|
|
22647
|
-
}
|
|
22648
|
-
if (op[0] & 5) throw op[1];
|
|
22649
|
-
return {
|
|
22650
|
-
value: op[0] ? op[1] : void 0,
|
|
22651
|
-
done: true
|
|
22652
|
-
};
|
|
22653
|
-
}
|
|
22654
|
-
}
|
|
22655
|
-
// 動態組件載入映射表 - 使用 webpack 魔法註釋進行條件載入
|
|
22656
|
-
var componentLoaders = {
|
|
22657
|
-
ckEditor: /*#__PURE__*/ _async_to_generator(function() {
|
|
22658
|
-
var module;
|
|
22659
|
-
return _ts_generator(this, function(_state) {
|
|
22660
|
-
switch(_state.label){
|
|
22661
|
-
case 0:
|
|
22662
|
-
return [
|
|
22663
|
-
4,
|
|
22664
|
-
Promise.resolve().then(function () { return require(/* webpackChunkName: "ck-editor" */ /* webpackPreload: false */ './BaseCkeditor.cjs.js'); })
|
|
22665
|
-
];
|
|
22666
|
-
case 1:
|
|
22667
|
-
module = _state.sent();
|
|
22668
|
-
return [
|
|
22669
|
-
2,
|
|
22670
|
-
module.default || module
|
|
22671
|
-
];
|
|
22672
|
-
}
|
|
22673
|
-
});
|
|
22674
|
-
})
|
|
22675
|
-
};
|
|
22676
|
-
// 分析配置中實際使用的類型
|
|
22677
|
-
function analyzeUsedTypes(formConfig) {
|
|
22678
|
-
var usedTypes = new Set();
|
|
22679
|
-
var traverseConfig = function(items) {
|
|
22680
|
-
if (Array.isArray(items)) {
|
|
22681
|
-
if (items.length > 0 && Array.isArray(items[0])) {
|
|
22682
|
-
// 這是 FormItem[][]
|
|
22683
|
-
items.forEach(function(row) {
|
|
22684
|
-
return traverseConfig(row);
|
|
22685
|
-
});
|
|
22686
|
-
} else {
|
|
22687
|
-
// 這是 FormItem[]
|
|
22688
|
-
items.forEach(function(item) {
|
|
22689
|
-
return traverseConfig(item);
|
|
22690
|
-
});
|
|
22691
|
-
}
|
|
22692
|
-
} else if (items && typeof items === "object") {
|
|
22693
|
-
if (items.type) {
|
|
22694
|
-
usedTypes.add(items.type);
|
|
22695
|
-
}
|
|
22696
|
-
}
|
|
22697
|
-
};
|
|
22698
|
-
traverseConfig(formConfig);
|
|
22699
|
-
return usedTypes;
|
|
22700
|
-
}
|
|
22701
|
-
// 動態載入 Hook
|
|
22702
|
-
function useDynamicComponents(formConfig) {
|
|
22703
|
-
var _useState = _sliced_to_array$1(React.useState({}), 2), loadedComponents = _useState[0], setLoadedComponents = _useState[1];
|
|
22704
|
-
var _useState1 = _sliced_to_array$1(React.useState(true), 2), isLoading = _useState1[0], setIsLoading = _useState1[1];
|
|
22705
|
-
React.useEffect(function() {
|
|
22706
|
-
var usedTypes = analyzeUsedTypes(formConfig);
|
|
22707
|
-
// 如果配置中沒有需要動態載入的組件,直接結束
|
|
22708
|
-
var needToLoad = Object.keys(componentLoaders).filter(function(key) {
|
|
22709
|
-
return usedTypes.has(key);
|
|
22710
|
-
});
|
|
22711
|
-
if (needToLoad.length === 0) {
|
|
22712
|
-
setIsLoading(false);
|
|
22713
|
-
return;
|
|
22714
|
-
}
|
|
22715
|
-
// 記錄哪些組件類型需要載入
|
|
22716
|
-
console.log("需要動態載入的組件類型:", needToLoad);
|
|
22717
|
-
// 載入需要的組件
|
|
22718
|
-
var loadPromises = needToLoad.map(function() {
|
|
22719
|
-
var _ref = _async_to_generator(function(key) {
|
|
22720
|
-
var component, error;
|
|
22721
|
-
return _ts_generator(this, function(_state) {
|
|
22722
|
-
switch(_state.label){
|
|
22723
|
-
case 0:
|
|
22724
|
-
_state.trys.push([
|
|
22725
|
-
0,
|
|
22726
|
-
2,
|
|
22727
|
-
,
|
|
22728
|
-
3
|
|
22729
|
-
]);
|
|
22730
|
-
console.log("開始載入組件: ".concat(key));
|
|
22731
|
-
return [
|
|
22732
|
-
4,
|
|
22733
|
-
componentLoaders[key]()
|
|
22734
|
-
];
|
|
22735
|
-
case 1:
|
|
22736
|
-
component = _state.sent();
|
|
22737
|
-
console.log("成功載入組件: ".concat(key));
|
|
22738
|
-
return [
|
|
22739
|
-
2,
|
|
22740
|
-
{
|
|
22741
|
-
key: key,
|
|
22742
|
-
component: component
|
|
22743
|
-
}
|
|
22744
|
-
];
|
|
22745
|
-
case 2:
|
|
22746
|
-
error = _state.sent();
|
|
22747
|
-
console.error("Failed to load component ".concat(key, ":"), error);
|
|
22748
|
-
return [
|
|
22749
|
-
2,
|
|
22750
|
-
{
|
|
22751
|
-
key: key,
|
|
22752
|
-
component: null
|
|
22753
|
-
}
|
|
22754
|
-
];
|
|
22755
|
-
case 3:
|
|
22756
|
-
return [
|
|
22757
|
-
2
|
|
22758
|
-
];
|
|
22759
|
-
}
|
|
22760
|
-
});
|
|
22761
|
-
});
|
|
22762
|
-
return function(key) {
|
|
22763
|
-
return _ref.apply(this, arguments);
|
|
22764
|
-
};
|
|
22765
|
-
}());
|
|
22766
|
-
Promise.all(loadPromises).then(function(results) {
|
|
22767
|
-
var loadedMap = {};
|
|
22768
|
-
results.forEach(function(param) {
|
|
22769
|
-
var key = param.key, component = param.component;
|
|
22770
|
-
if (component) {
|
|
22771
|
-
loadedMap[key] = component;
|
|
22772
|
-
}
|
|
22773
|
-
});
|
|
22774
|
-
console.log("所有動態組件載入完成:", Object.keys(loadedMap));
|
|
22775
|
-
setLoadedComponents(loadedMap);
|
|
22776
|
-
setIsLoading(false);
|
|
22777
|
-
}).catch(function(error) {
|
|
22778
|
-
console.error("Failed to load dynamic components:", error);
|
|
22779
|
-
setIsLoading(false);
|
|
22780
|
-
});
|
|
22781
|
-
}, [
|
|
22782
|
-
formConfig
|
|
22783
|
-
]);
|
|
22784
|
-
return {
|
|
22785
|
-
loadedComponents: loadedComponents,
|
|
22786
|
-
isLoading: isLoading
|
|
22787
|
-
};
|
|
22788
|
-
}
|
|
22789
|
-
// 創建一個動態組件渲染器
|
|
22790
|
-
function createDynamicComponent(type, loadedComponents) {
|
|
22791
|
-
if (type === "ckEditor" && loadedComponents.ckEditor) {
|
|
22792
|
-
return loadedComponents.ckEditor;
|
|
22793
|
-
}
|
|
22794
|
-
// 如果組件沒有載入,返回 null
|
|
22795
|
-
return null;
|
|
22796
|
-
}
|
|
22797
|
-
|
|
22798
22490
|
/* eslint-disable react/no-array-index-key */ /* eslint-disable react/prop-types */ function _array_like_to_array(arr, len) {
|
|
22799
22491
|
if (len == null || len > arr.length) len = arr.length;
|
|
22800
22492
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -22893,6 +22585,11 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
22893
22585
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22894
22586
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
22895
22587
|
}
|
|
22588
|
+
var BaseCkeditor = dynamic__default["default"](function() {
|
|
22589
|
+
return Promise.resolve().then(function () { return require('./BaseCkeditor.cjs.js'); });
|
|
22590
|
+
}, {
|
|
22591
|
+
ssr: false
|
|
22592
|
+
});
|
|
22896
22593
|
var TextField = function(param) {
|
|
22897
22594
|
var item = param.item;
|
|
22898
22595
|
var _useFormContext = index_esm.useFormContext(), register = _useFormContext.register, setValue = _useFormContext.setValue, errors = _useFormContext.formState.errors;
|
|
@@ -23457,8 +23154,6 @@ var FieldLabel = function(param) {
|
|
|
23457
23154
|
};
|
|
23458
23155
|
var Fields = function(param) {
|
|
23459
23156
|
var formConfig = param.formConfig, _param_fieldsClass = param.fieldsClass, fieldsClass = _param_fieldsClass === void 0 ? "gap-2" : _param_fieldsClass;
|
|
23460
|
-
var _useDynamicComponents = useDynamicComponents(formConfig), loadedComponents = _useDynamicComponents.loadedComponents, isLoading = _useDynamicComponents.isLoading;
|
|
23461
|
-
if (isLoading) return null;
|
|
23462
23157
|
return !!(formConfig === null || formConfig === void 0 ? void 0 : formConfig.length) && (formConfig === null || formConfig === void 0 ? void 0 : formConfig.map(function(item, index) {
|
|
23463
23158
|
return /*#__PURE__*/ jsxRuntime.jsx(StyleField, {
|
|
23464
23159
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -23467,8 +23162,7 @@ var Fields = function(param) {
|
|
|
23467
23162
|
"justify-start"
|
|
23468
23163
|
].join(" "),
|
|
23469
23164
|
children: /*#__PURE__*/ jsxRuntime.jsx(Row, {
|
|
23470
|
-
rowItems: item
|
|
23471
|
-
loadedComponents: loadedComponents
|
|
23165
|
+
rowItems: item
|
|
23472
23166
|
})
|
|
23473
23167
|
})
|
|
23474
23168
|
}, "mainField-".concat(index));
|
|
@@ -23518,7 +23212,7 @@ var CustomUploadField = function(param) {
|
|
|
23518
23212
|
});
|
|
23519
23213
|
};
|
|
23520
23214
|
var Row = function(param) {
|
|
23521
|
-
var rowItems = param.rowItems
|
|
23215
|
+
var rowItems = param.rowItems;
|
|
23522
23216
|
return rowItems.map(function(item, index) {
|
|
23523
23217
|
var baseConfig = {
|
|
23524
23218
|
item: item
|
|
@@ -23577,16 +23271,9 @@ var Row = function(param) {
|
|
|
23577
23271
|
key: "rowField-".concat(index)
|
|
23578
23272
|
}));
|
|
23579
23273
|
case "ckEditor":
|
|
23580
|
-
{
|
|
23581
|
-
|
|
23582
|
-
|
|
23583
|
-
return /*#__PURE__*/ React.createElement(DynamicCkEditor, _object_spread_props$1(_object_spread$1({}, baseConfig), {
|
|
23584
|
-
key: "rowField-".concat(index)
|
|
23585
|
-
}));
|
|
23586
|
-
}
|
|
23587
|
-
// 如果 CkEditor 沒有載入,顯示佔位符
|
|
23588
|
-
return null;
|
|
23589
|
-
}
|
|
23274
|
+
return /*#__PURE__*/ React.createElement(BaseCkeditor, _object_spread_props$1(_object_spread$1({}, baseConfig), {
|
|
23275
|
+
key: "rowField-".concat(index)
|
|
23276
|
+
}));
|
|
23590
23277
|
case "upload":
|
|
23591
23278
|
return /*#__PURE__*/ React.createElement(CustomUploadField, _object_spread_props$1(_object_spread$1({}, baseConfig), {
|
|
23592
23279
|
key: "rowField-".concat(index)
|
|
@@ -23614,10 +23301,7 @@ var Form = {
|
|
|
23614
23301
|
City: City,
|
|
23615
23302
|
CityDistrict: CityDistrict,
|
|
23616
23303
|
CheckboxField: CheckboxField,
|
|
23617
|
-
|
|
23618
|
-
BaseCkeditor: function() {
|
|
23619
|
-
return null;
|
|
23620
|
-
},
|
|
23304
|
+
BaseCkeditor: BaseCkeditor,
|
|
23621
23305
|
Dropdown: DropdownList,
|
|
23622
23306
|
FlatpickrField: FlatpickrField
|
|
23623
23307
|
};
|