@sunggang/ui-lib 0.4.6 → 0.4.8
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 +0 -2
- package/BaseCkeditor.esm.js +0 -2
- package/CkEditor.cjs.js +0 -2
- package/CkEditor.esm.js +0 -2
- package/Form.cjs.js +0 -2
- package/Form.esm.js +0 -2
- package/baseSwitch.cjs.js +387 -69
- package/baseSwitch.esm.js +387 -68
- package/index.cjs.css +16 -0
- package/index.cjs.js +0 -2
- package/index.esm.css +16 -0
- package/index.esm.js +0 -2
- package/package.json +1 -1
- package/src/lib/Form/DynamicLoader.d.ts +10 -0
- package/src/lib/Form/FlatpickrField/index.d.ts +1 -1
- package/src/lib/Form/demo-test.d.ts +66 -0
- package/src/lib/Form/index.d.ts +5 -2
package/baseSwitch.cjs.js
CHANGED
|
@@ -5,7 +5,6 @@ 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');
|
|
9
8
|
var setPrototypeOf = require('./setPrototypeOf.cjs.js');
|
|
10
9
|
var memoizeOne_esm = require('./memoize-one.esm.cjs.js');
|
|
11
10
|
var react = require('@emotion/react');
|
|
@@ -19,7 +18,6 @@ var SelectPrimitive = require('@radix-ui/react-select');
|
|
|
19
18
|
var reactIcons = require('@radix-ui/react-icons');
|
|
20
19
|
var flatpickr = require('flatpickr');
|
|
21
20
|
var Mandarin = require('flatpickr/dist/l10n/zh-tw.js');
|
|
22
|
-
require('flatpickr/dist/flatpickr.min.css');
|
|
23
21
|
|
|
24
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
23
|
|
|
@@ -44,7 +42,6 @@ function _interopNamespace(e) {
|
|
|
44
42
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
45
43
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
46
44
|
var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
|
|
47
|
-
var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
|
|
48
45
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
49
46
|
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
50
47
|
var Mandarin__default = /*#__PURE__*/_interopDefaultLegacy(Mandarin);
|
|
@@ -273,16 +270,16 @@ function getFrameElement(win) {
|
|
|
273
270
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
274
271
|
}
|
|
275
272
|
|
|
276
|
-
function _array_like_to_array$
|
|
273
|
+
function _array_like_to_array$6(arr, len) {
|
|
277
274
|
if (len == null || len > arr.length) len = arr.length;
|
|
278
275
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
279
276
|
return arr2;
|
|
280
277
|
}
|
|
281
|
-
function _array_with_holes$
|
|
278
|
+
function _array_with_holes$6(arr) {
|
|
282
279
|
if (Array.isArray(arr)) return arr;
|
|
283
280
|
}
|
|
284
281
|
function _array_without_holes(arr) {
|
|
285
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
282
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
286
283
|
}
|
|
287
284
|
function _define_property$5(obj, key, value) {
|
|
288
285
|
if (key in obj) {
|
|
@@ -300,7 +297,7 @@ function _define_property$5(obj, key, value) {
|
|
|
300
297
|
function _iterable_to_array(iter) {
|
|
301
298
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
302
299
|
}
|
|
303
|
-
function _iterable_to_array_limit$
|
|
300
|
+
function _iterable_to_array_limit$6(arr, i) {
|
|
304
301
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
305
302
|
if (_i == null) return;
|
|
306
303
|
var _arr = [];
|
|
@@ -324,7 +321,7 @@ function _iterable_to_array_limit$5(arr, i) {
|
|
|
324
321
|
}
|
|
325
322
|
return _arr;
|
|
326
323
|
}
|
|
327
|
-
function _non_iterable_rest$
|
|
324
|
+
function _non_iterable_rest$6() {
|
|
328
325
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
329
326
|
}
|
|
330
327
|
function _non_iterable_spread() {
|
|
@@ -369,19 +366,19 @@ function _object_spread_props$5(target, source) {
|
|
|
369
366
|
}
|
|
370
367
|
return target;
|
|
371
368
|
}
|
|
372
|
-
function _sliced_to_array$
|
|
373
|
-
return _array_with_holes$
|
|
369
|
+
function _sliced_to_array$6(arr, i) {
|
|
370
|
+
return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
|
|
374
371
|
}
|
|
375
372
|
function _to_consumable_array(arr) {
|
|
376
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$
|
|
373
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread();
|
|
377
374
|
}
|
|
378
|
-
function _unsupported_iterable_to_array$
|
|
375
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
379
376
|
if (!o) return;
|
|
380
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
377
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
381
378
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
382
379
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
383
380
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
384
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
381
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
385
382
|
}
|
|
386
383
|
function getCssDimensions(element) {
|
|
387
384
|
var css = getComputedStyle$1(element);
|
|
@@ -607,7 +604,7 @@ function observeMove(element, onMove) {
|
|
|
607
604
|
var resizeObserver = null;
|
|
608
605
|
if (elementResize) {
|
|
609
606
|
resizeObserver = new ResizeObserver(function(_ref) {
|
|
610
|
-
var _$_ref = _sliced_to_array$
|
|
607
|
+
var _$_ref = _sliced_to_array$6(_ref, 1), firstEntry = _$_ref[0];
|
|
611
608
|
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
612
609
|
// Prevent update loops when using the `size` middleware.
|
|
613
610
|
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
@@ -21167,12 +21164,12 @@ var validateMsg = function(errors, item) {
|
|
|
21167
21164
|
return errorMsg;
|
|
21168
21165
|
};
|
|
21169
21166
|
|
|
21170
|
-
/* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$
|
|
21167
|
+
/* eslint-disable react/jsx-props-no-spreading */ function _array_like_to_array$5(arr, len) {
|
|
21171
21168
|
if (len == null || len > arr.length) len = arr.length;
|
|
21172
21169
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21173
21170
|
return arr2;
|
|
21174
21171
|
}
|
|
21175
|
-
function _array_with_holes$
|
|
21172
|
+
function _array_with_holes$5(arr) {
|
|
21176
21173
|
if (Array.isArray(arr)) return arr;
|
|
21177
21174
|
}
|
|
21178
21175
|
function _define_property$4(obj, key, value) {
|
|
@@ -21188,7 +21185,7 @@ function _define_property$4(obj, key, value) {
|
|
|
21188
21185
|
}
|
|
21189
21186
|
return obj;
|
|
21190
21187
|
}
|
|
21191
|
-
function _iterable_to_array_limit$
|
|
21188
|
+
function _iterable_to_array_limit$5(arr, i) {
|
|
21192
21189
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
21193
21190
|
if (_i == null) return;
|
|
21194
21191
|
var _arr = [];
|
|
@@ -21212,7 +21209,7 @@ function _iterable_to_array_limit$4(arr, i) {
|
|
|
21212
21209
|
}
|
|
21213
21210
|
return _arr;
|
|
21214
21211
|
}
|
|
21215
|
-
function _non_iterable_rest$
|
|
21212
|
+
function _non_iterable_rest$5() {
|
|
21216
21213
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21217
21214
|
}
|
|
21218
21215
|
function _object_spread$4(target) {
|
|
@@ -21254,16 +21251,16 @@ function _object_spread_props$4(target, source) {
|
|
|
21254
21251
|
}
|
|
21255
21252
|
return target;
|
|
21256
21253
|
}
|
|
21257
|
-
function _sliced_to_array$
|
|
21258
|
-
return _array_with_holes$
|
|
21254
|
+
function _sliced_to_array$5(arr, i) {
|
|
21255
|
+
return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
|
|
21259
21256
|
}
|
|
21260
|
-
function _unsupported_iterable_to_array$
|
|
21257
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
21261
21258
|
if (!o) return;
|
|
21262
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
21259
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
21263
21260
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21264
21261
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21265
21262
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21266
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
21263
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
21267
21264
|
}
|
|
21268
21265
|
// interface CityDistrictProps {
|
|
21269
21266
|
// item?: {
|
|
@@ -21292,9 +21289,9 @@ var CityDistrict = function(param) {
|
|
|
21292
21289
|
var item = param.item;
|
|
21293
21290
|
var _errors_city, _errors_district;
|
|
21294
21291
|
var _useFormContext = index_esm.useFormContext(), register = _useFormContext.register, setValue = _useFormContext.setValue, getValues = _useFormContext.getValues, errors = _useFormContext.formState.errors;
|
|
21295
|
-
var _useState = _sliced_to_array$
|
|
21296
|
-
var _useState1 = _sliced_to_array$
|
|
21297
|
-
var _useState2 = _sliced_to_array$
|
|
21292
|
+
var _useState = _sliced_to_array$5(React.useState(null), 2), currentCity = _useState[0], setCurrentCity = _useState[1];
|
|
21293
|
+
var _useState1 = _sliced_to_array$5(React.useState(DistrictData), 1), city = _useState1[0];
|
|
21294
|
+
var _useState2 = _sliced_to_array$5(React.useState([]), 2), district = _useState2[0], setDistrict = _useState2[1];
|
|
21298
21295
|
var cityValue = getValues().city;
|
|
21299
21296
|
var districtValue = getValues().district;
|
|
21300
21297
|
React.useEffect(function() {
|
|
@@ -21430,15 +21427,15 @@ var CityDistrict = function(param) {
|
|
|
21430
21427
|
}, Modal.v4());
|
|
21431
21428
|
};
|
|
21432
21429
|
|
|
21433
|
-
function _array_like_to_array$
|
|
21430
|
+
function _array_like_to_array$4(arr, len) {
|
|
21434
21431
|
if (len == null || len > arr.length) len = arr.length;
|
|
21435
21432
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21436
21433
|
return arr2;
|
|
21437
21434
|
}
|
|
21438
|
-
function _array_with_holes$
|
|
21435
|
+
function _array_with_holes$4(arr) {
|
|
21439
21436
|
if (Array.isArray(arr)) return arr;
|
|
21440
21437
|
}
|
|
21441
|
-
function _iterable_to_array_limit$
|
|
21438
|
+
function _iterable_to_array_limit$4(arr, i) {
|
|
21442
21439
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
21443
21440
|
if (_i == null) return;
|
|
21444
21441
|
var _arr = [];
|
|
@@ -21462,23 +21459,23 @@ function _iterable_to_array_limit$3(arr, i) {
|
|
|
21462
21459
|
}
|
|
21463
21460
|
return _arr;
|
|
21464
21461
|
}
|
|
21465
|
-
function _non_iterable_rest$
|
|
21462
|
+
function _non_iterable_rest$4() {
|
|
21466
21463
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21467
21464
|
}
|
|
21468
|
-
function _sliced_to_array$
|
|
21469
|
-
return _array_with_holes$
|
|
21465
|
+
function _sliced_to_array$4(arr, i) {
|
|
21466
|
+
return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
|
|
21470
21467
|
}
|
|
21471
|
-
function _unsupported_iterable_to_array$
|
|
21468
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
21472
21469
|
if (!o) return;
|
|
21473
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
21470
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
21474
21471
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21475
21472
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21476
21473
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21477
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
21474
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
21478
21475
|
}
|
|
21479
21476
|
var BaseTemplate = function(param) {
|
|
21480
21477
|
var item = param.item, file = param.file, imageUrl = param.imageUrl, field = param.field;
|
|
21481
|
-
var _useState = _sliced_to_array$
|
|
21478
|
+
var _useState = _sliced_to_array$4(React.useState(null), 2), tempImage = _useState[0], setTempImage = _useState[1];
|
|
21482
21479
|
React.useEffect(function() {
|
|
21483
21480
|
var fileReader;
|
|
21484
21481
|
var isCancel = false;
|
|
@@ -21612,12 +21609,12 @@ var BaseTemplate = function(param) {
|
|
|
21612
21609
|
});
|
|
21613
21610
|
};
|
|
21614
21611
|
|
|
21615
|
-
function _array_like_to_array$
|
|
21612
|
+
function _array_like_to_array$3(arr, len) {
|
|
21616
21613
|
if (len == null || len > arr.length) len = arr.length;
|
|
21617
21614
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21618
21615
|
return arr2;
|
|
21619
21616
|
}
|
|
21620
|
-
function _array_with_holes$
|
|
21617
|
+
function _array_with_holes$3(arr) {
|
|
21621
21618
|
if (Array.isArray(arr)) return arr;
|
|
21622
21619
|
}
|
|
21623
21620
|
function _instanceof(left, right) {
|
|
@@ -21627,7 +21624,7 @@ function _instanceof(left, right) {
|
|
|
21627
21624
|
return left instanceof right;
|
|
21628
21625
|
}
|
|
21629
21626
|
}
|
|
21630
|
-
function _iterable_to_array_limit$
|
|
21627
|
+
function _iterable_to_array_limit$3(arr, i) {
|
|
21631
21628
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
21632
21629
|
if (_i == null) return;
|
|
21633
21630
|
var _arr = [];
|
|
@@ -21651,25 +21648,25 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
21651
21648
|
}
|
|
21652
21649
|
return _arr;
|
|
21653
21650
|
}
|
|
21654
|
-
function _non_iterable_rest$
|
|
21651
|
+
function _non_iterable_rest$3() {
|
|
21655
21652
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21656
21653
|
}
|
|
21657
|
-
function _sliced_to_array$
|
|
21658
|
-
return _array_with_holes$
|
|
21654
|
+
function _sliced_to_array$3(arr, i) {
|
|
21655
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
|
|
21659
21656
|
}
|
|
21660
|
-
function _unsupported_iterable_to_array$
|
|
21657
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
21661
21658
|
if (!o) return;
|
|
21662
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
21659
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
21663
21660
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
21664
21661
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
21665
21662
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
21666
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
21663
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
21667
21664
|
}
|
|
21668
21665
|
var CustomUpload = function(param) {
|
|
21669
21666
|
var item = param.item, field = param.field;
|
|
21670
21667
|
var imageMimeType = /image\/(png|jpg|jpeg)/i;
|
|
21671
21668
|
var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = (item === null || item === void 0 ? void 0 : item.limitSize) || 5242880;
|
|
21672
|
-
var _useState = _sliced_to_array$
|
|
21669
|
+
var _useState = _sliced_to_array$3(React.useState(null), 2), modal = _useState[0], setModal = _useState[1];
|
|
21673
21670
|
var hiddenFileInput = React.useRef(null);
|
|
21674
21671
|
React.useEffect(function() {
|
|
21675
21672
|
if (modal) {
|
|
@@ -22049,15 +22046,15 @@ var BaseSelect = function(param) {
|
|
|
22049
22046
|
});
|
|
22050
22047
|
};
|
|
22051
22048
|
|
|
22052
|
-
function _array_like_to_array$
|
|
22049
|
+
function _array_like_to_array$2(arr, len) {
|
|
22053
22050
|
if (len == null || len > arr.length) len = arr.length;
|
|
22054
22051
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
22055
22052
|
return arr2;
|
|
22056
22053
|
}
|
|
22057
|
-
function _array_with_holes$
|
|
22054
|
+
function _array_with_holes$2(arr) {
|
|
22058
22055
|
if (Array.isArray(arr)) return arr;
|
|
22059
22056
|
}
|
|
22060
|
-
function _iterable_to_array_limit$
|
|
22057
|
+
function _iterable_to_array_limit$2(arr, i) {
|
|
22061
22058
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
22062
22059
|
if (_i == null) return;
|
|
22063
22060
|
var _arr = [];
|
|
@@ -22081,27 +22078,27 @@ function _iterable_to_array_limit$1(arr, i) {
|
|
|
22081
22078
|
}
|
|
22082
22079
|
return _arr;
|
|
22083
22080
|
}
|
|
22084
|
-
function _non_iterable_rest$
|
|
22081
|
+
function _non_iterable_rest$2() {
|
|
22085
22082
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
22086
22083
|
}
|
|
22087
|
-
function _sliced_to_array$
|
|
22088
|
-
return _array_with_holes$
|
|
22084
|
+
function _sliced_to_array$2(arr, i) {
|
|
22085
|
+
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
|
|
22089
22086
|
}
|
|
22090
|
-
function _unsupported_iterable_to_array$
|
|
22087
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
22091
22088
|
if (!o) return;
|
|
22092
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
22089
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
22093
22090
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22094
22091
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
22095
22092
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22096
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
22093
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
22097
22094
|
}
|
|
22098
22095
|
var DropdownList = function(param) {
|
|
22099
22096
|
var item = param.item, onUtilsReady = param.onUtilsReady;
|
|
22100
22097
|
var _item_option, _item_validateOption, _errors_funeralLocation;
|
|
22101
22098
|
var _useFormContext = index_esm.useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
|
|
22102
22099
|
var dropdownRef = React.useRef(null);
|
|
22103
|
-
var _useState = _sliced_to_array$
|
|
22104
|
-
var _useState1 = _sliced_to_array$
|
|
22100
|
+
var _useState = _sliced_to_array$2(React.useState(""), 2), query = _useState[0], setQuery = _useState[1];
|
|
22101
|
+
var _useState1 = _sliced_to_array$2(React.useState(false), 2), open = _useState1[0], setOpen = _useState1[1];
|
|
22105
22102
|
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) {
|
|
22106
22103
|
var _opt_name;
|
|
22107
22104
|
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());
|
|
@@ -22485,6 +22482,319 @@ var FlatpickrField = function(param) {
|
|
|
22485
22482
|
});
|
|
22486
22483
|
};
|
|
22487
22484
|
|
|
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
|
+
|
|
22488
22798
|
/* eslint-disable react/no-array-index-key */ /* eslint-disable react/prop-types */ function _array_like_to_array(arr, len) {
|
|
22489
22799
|
if (len == null || len > arr.length) len = arr.length;
|
|
22490
22800
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -22583,11 +22893,6 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
22583
22893
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
22584
22894
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
22585
22895
|
}
|
|
22586
|
-
var BaseCkeditor = dynamic__default["default"](function() {
|
|
22587
|
-
return Promise.resolve().then(function () { return require('./BaseCkeditor.cjs.js'); });
|
|
22588
|
-
}, {
|
|
22589
|
-
ssr: false
|
|
22590
|
-
});
|
|
22591
22896
|
var TextField = function(param) {
|
|
22592
22897
|
var item = param.item;
|
|
22593
22898
|
var _useFormContext = index_esm.useFormContext(), register = _useFormContext.register, setValue = _useFormContext.setValue, errors = _useFormContext.formState.errors;
|
|
@@ -23152,6 +23457,8 @@ var FieldLabel = function(param) {
|
|
|
23152
23457
|
};
|
|
23153
23458
|
var Fields = function(param) {
|
|
23154
23459
|
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;
|
|
23155
23462
|
return !!(formConfig === null || formConfig === void 0 ? void 0 : formConfig.length) && (formConfig === null || formConfig === void 0 ? void 0 : formConfig.map(function(item, index) {
|
|
23156
23463
|
return /*#__PURE__*/ jsxRuntime.jsx(StyleField, {
|
|
23157
23464
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -23160,7 +23467,8 @@ var Fields = function(param) {
|
|
|
23160
23467
|
"justify-start"
|
|
23161
23468
|
].join(" "),
|
|
23162
23469
|
children: /*#__PURE__*/ jsxRuntime.jsx(Row, {
|
|
23163
|
-
rowItems: item
|
|
23470
|
+
rowItems: item,
|
|
23471
|
+
loadedComponents: loadedComponents
|
|
23164
23472
|
})
|
|
23165
23473
|
})
|
|
23166
23474
|
}, "mainField-".concat(index));
|
|
@@ -23210,7 +23518,7 @@ var CustomUploadField = function(param) {
|
|
|
23210
23518
|
});
|
|
23211
23519
|
};
|
|
23212
23520
|
var Row = function(param) {
|
|
23213
|
-
var rowItems = param.rowItems;
|
|
23521
|
+
var rowItems = param.rowItems, _param_loadedComponents = param.loadedComponents, loadedComponents = _param_loadedComponents === void 0 ? {} : _param_loadedComponents;
|
|
23214
23522
|
return rowItems.map(function(item, index) {
|
|
23215
23523
|
var baseConfig = {
|
|
23216
23524
|
item: item
|
|
@@ -23269,9 +23577,16 @@ var Row = function(param) {
|
|
|
23269
23577
|
key: "rowField-".concat(index)
|
|
23270
23578
|
}));
|
|
23271
23579
|
case "ckEditor":
|
|
23272
|
-
|
|
23273
|
-
|
|
23274
|
-
|
|
23580
|
+
{
|
|
23581
|
+
var DynamicCkEditor = createDynamicComponent("ckEditor", loadedComponents);
|
|
23582
|
+
if (DynamicCkEditor) {
|
|
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
|
+
}
|
|
23275
23590
|
case "upload":
|
|
23276
23591
|
return /*#__PURE__*/ React.createElement(CustomUploadField, _object_spread_props$1(_object_spread$1({}, baseConfig), {
|
|
23277
23592
|
key: "rowField-".concat(index)
|
|
@@ -23299,7 +23614,10 @@ var Form = {
|
|
|
23299
23614
|
City: City,
|
|
23300
23615
|
CityDistrict: CityDistrict,
|
|
23301
23616
|
CheckboxField: CheckboxField,
|
|
23302
|
-
|
|
23617
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23618
|
+
BaseCkeditor: function() {
|
|
23619
|
+
return null;
|
|
23620
|
+
},
|
|
23303
23621
|
Dropdown: DropdownList,
|
|
23304
23622
|
FlatpickrField: FlatpickrField
|
|
23305
23623
|
};
|