@sunggang/ui-lib 0.4.60 → 0.4.61
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 +233 -1
- package/Form.esm.js +234 -2
- package/index.cjs.css +38 -0
- package/index.esm.css +38 -0
- package/package.json +1 -1
- package/src/lib/Form/index.d.ts +4 -0
- package/src/lib/Form/types.d.ts +40 -0
package/Form.cjs.js
CHANGED
|
@@ -8030,6 +8030,233 @@ var Textarea = function(param) {
|
|
|
8030
8030
|
]
|
|
8031
8031
|
});
|
|
8032
8032
|
};
|
|
8033
|
+
var FieldArray = function(param) {
|
|
8034
|
+
var item = param.item;
|
|
8035
|
+
var _useFormContext = index_esm.useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors, getValues = _useFormContext.getValues;
|
|
8036
|
+
var _useFieldArray = index_esm.useFieldArray({
|
|
8037
|
+
control: control,
|
|
8038
|
+
name: item.name
|
|
8039
|
+
}), fields = _useFieldArray.fields, append = _useFieldArray.append, remove = _useFieldArray.remove;
|
|
8040
|
+
var config = item === null || item === void 0 ? void 0 : item.fieldArrayConfig;
|
|
8041
|
+
var fieldConfigs = (config === null || config === void 0 ? void 0 : config.fields) || [];
|
|
8042
|
+
var addButtonText = (config === null || config === void 0 ? void 0 : config.addButtonText) || "新增";
|
|
8043
|
+
var removeButtonText = (config === null || config === void 0 ? void 0 : config.removeButtonText) || "刪除";
|
|
8044
|
+
var maxItems = config === null || config === void 0 ? void 0 : config.maxItems;
|
|
8045
|
+
var minItems = (config === null || config === void 0 ? void 0 : config.minItems) || 0;
|
|
8046
|
+
var defaultItemCount = (config === null || config === void 0 ? void 0 : config.defaultItemCount) || 1;
|
|
8047
|
+
var addButtonPosition = (config === null || config === void 0 ? void 0 : config.addButtonPosition) || "bottom";
|
|
8048
|
+
var canAdd = !maxItems || fields.length < maxItems;
|
|
8049
|
+
var canRemove = fields.length > minItems;
|
|
8050
|
+
// 初始化:確保至少有 defaultItemCount 個項目
|
|
8051
|
+
React__default["default"].useEffect(function() {
|
|
8052
|
+
var currentValues = getValues(item.name);
|
|
8053
|
+
if (!currentValues || currentValues.length === 0) {
|
|
8054
|
+
var _loop = function(i) {
|
|
8055
|
+
var newItem = {};
|
|
8056
|
+
fieldConfigs.forEach(function(field) {
|
|
8057
|
+
newItem[field.name] = "";
|
|
8058
|
+
});
|
|
8059
|
+
append(newItem);
|
|
8060
|
+
};
|
|
8061
|
+
var itemsToAdd = defaultItemCount;
|
|
8062
|
+
for(var i = 0; i < itemsToAdd; i++)_loop(i);
|
|
8063
|
+
}
|
|
8064
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8065
|
+
}, []);
|
|
8066
|
+
var handleAdd = function() {
|
|
8067
|
+
if (canAdd) {
|
|
8068
|
+
var newItem = {};
|
|
8069
|
+
fieldConfigs.forEach(function(field) {
|
|
8070
|
+
newItem[field.name] = "";
|
|
8071
|
+
});
|
|
8072
|
+
append(newItem);
|
|
8073
|
+
}
|
|
8074
|
+
};
|
|
8075
|
+
var handleRemove = function(index) {
|
|
8076
|
+
if (canRemove) {
|
|
8077
|
+
remove(index);
|
|
8078
|
+
}
|
|
8079
|
+
};
|
|
8080
|
+
var getFieldError = function(index, fieldName) {
|
|
8081
|
+
var fieldPath = "".concat(item.name, ".").concat(index, ".").concat(fieldName);
|
|
8082
|
+
var pathParts = fieldPath.split(".");
|
|
8083
|
+
var error = errors;
|
|
8084
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8085
|
+
try {
|
|
8086
|
+
for(var _iterator = pathParts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8087
|
+
var part = _step.value;
|
|
8088
|
+
if (error && error[part]) {
|
|
8089
|
+
error = error[part];
|
|
8090
|
+
} else {
|
|
8091
|
+
return null;
|
|
8092
|
+
}
|
|
8093
|
+
}
|
|
8094
|
+
} catch (err) {
|
|
8095
|
+
_didIteratorError = true;
|
|
8096
|
+
_iteratorError = err;
|
|
8097
|
+
} finally{
|
|
8098
|
+
try {
|
|
8099
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8100
|
+
_iterator.return();
|
|
8101
|
+
}
|
|
8102
|
+
} finally{
|
|
8103
|
+
if (_didIteratorError) {
|
|
8104
|
+
throw _iteratorError;
|
|
8105
|
+
}
|
|
8106
|
+
}
|
|
8107
|
+
}
|
|
8108
|
+
return error;
|
|
8109
|
+
};
|
|
8110
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8111
|
+
className: [
|
|
8112
|
+
(item === null || item === void 0 ? void 0 : item.className) || "w-full"
|
|
8113
|
+
].join(" "),
|
|
8114
|
+
children: [
|
|
8115
|
+
/*#__PURE__*/ jsxRuntime.jsx(FieldLabel.FieldLabel, {
|
|
8116
|
+
item: item
|
|
8117
|
+
}),
|
|
8118
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8119
|
+
className: "space-y-4",
|
|
8120
|
+
children: [
|
|
8121
|
+
fields.map(function(field, index) {
|
|
8122
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
8123
|
+
className: "border border-[#C8C8C8] rounded-xl p-4 bg-white overflow-scroll",
|
|
8124
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8125
|
+
className: "flex items-start gap-2 flex-wrap lg:flex-nowrap",
|
|
8126
|
+
children: [
|
|
8127
|
+
fieldConfigs.map(function(fieldConfig, fieldIndex) {
|
|
8128
|
+
var _fieldConfig_validateOption;
|
|
8129
|
+
var fieldName = "".concat(item.name, ".").concat(index, ".").concat(fieldConfig.name);
|
|
8130
|
+
var fieldError = getFieldError(index, fieldConfig.name);
|
|
8131
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8132
|
+
className: "flex-1 min-w-[200px]",
|
|
8133
|
+
children: [
|
|
8134
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8135
|
+
className: "font-medium mb-2 text-sm",
|
|
8136
|
+
children: [
|
|
8137
|
+
fieldConfig.label,
|
|
8138
|
+
(fieldConfig === null || fieldConfig === void 0 ? void 0 : (_fieldConfig_validateOption = fieldConfig.validateOption) === null || _fieldConfig_validateOption === void 0 ? void 0 : _fieldConfig_validateOption.required) && /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
8139
|
+
className: "pl-1 text-[#EF5533] font-bold",
|
|
8140
|
+
children: "*"
|
|
8141
|
+
})
|
|
8142
|
+
]
|
|
8143
|
+
}),
|
|
8144
|
+
/*#__PURE__*/ jsxRuntime.jsx(index_esm.Controller, {
|
|
8145
|
+
name: fieldName,
|
|
8146
|
+
control: control,
|
|
8147
|
+
rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.validateOption,
|
|
8148
|
+
render: function(param) {
|
|
8149
|
+
var controllerField = param.field;
|
|
8150
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8151
|
+
className: "relative",
|
|
8152
|
+
children: [
|
|
8153
|
+
/*#__PURE__*/ jsxRuntime.jsx("input", _object_spread_props(_object_spread({}, controllerField), {
|
|
8154
|
+
list: "".concat(fieldName, "-datalist"),
|
|
8155
|
+
type: "text",
|
|
8156
|
+
className: [
|
|
8157
|
+
(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]",
|
|
8158
|
+
"w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
|
|
8159
|
+
].join(" "),
|
|
8160
|
+
placeholder: fieldConfig.placeholder || fieldConfig.label,
|
|
8161
|
+
disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
|
|
8162
|
+
})),
|
|
8163
|
+
fieldConfig.options && fieldConfig.options.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("datalist", {
|
|
8164
|
+
id: "".concat(fieldName, "-datalist"),
|
|
8165
|
+
children: fieldConfig.options.map(function(option, optIndex) {
|
|
8166
|
+
return /*#__PURE__*/ jsxRuntime.jsx("option", {
|
|
8167
|
+
value: option.value || option.name,
|
|
8168
|
+
children: option.name
|
|
8169
|
+
}, optIndex);
|
|
8170
|
+
})
|
|
8171
|
+
})
|
|
8172
|
+
]
|
|
8173
|
+
});
|
|
8174
|
+
}
|
|
8175
|
+
}),
|
|
8176
|
+
(fieldError === null || fieldError === void 0 ? void 0 : fieldError.message) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8177
|
+
className: "pt-1 text-xs text-[#EF5533]",
|
|
8178
|
+
children: [
|
|
8179
|
+
"*",
|
|
8180
|
+
String(fieldError.message)
|
|
8181
|
+
]
|
|
8182
|
+
})
|
|
8183
|
+
]
|
|
8184
|
+
}, fieldIndex);
|
|
8185
|
+
}),
|
|
8186
|
+
addButtonPosition === "inline" && canAdd && index === fields.length - 1 && /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
8187
|
+
type: "button",
|
|
8188
|
+
onClick: handleAdd,
|
|
8189
|
+
className: [
|
|
8190
|
+
"h-11 px-4 rounded-2xl border border-solid border-[#6f6f6f]",
|
|
8191
|
+
"text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
|
|
8192
|
+
"transition-colors duration-200",
|
|
8193
|
+
"flex items-center gap-2 whitespace-nowrap",
|
|
8194
|
+
"mt-[30px]"
|
|
8195
|
+
].join(" "),
|
|
8196
|
+
children: [
|
|
8197
|
+
/*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
|
|
8198
|
+
icon: "mdi:plus",
|
|
8199
|
+
className: "w-5 h-5"
|
|
8200
|
+
}),
|
|
8201
|
+
addButtonText
|
|
8202
|
+
]
|
|
8203
|
+
}),
|
|
8204
|
+
canRemove && /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
8205
|
+
type: "button",
|
|
8206
|
+
onClick: function() {
|
|
8207
|
+
return handleRemove(index);
|
|
8208
|
+
},
|
|
8209
|
+
className: [
|
|
8210
|
+
"h-11 px-4 rounded-2xl border border-solid border-[#EF5533]",
|
|
8211
|
+
"text-[#EF5533] bg-white hover:bg-[#FFF5F3]",
|
|
8212
|
+
"transition-colors duration-200",
|
|
8213
|
+
"flex items-center gap-2 whitespace-nowrap",
|
|
8214
|
+
"mt-[30px]"
|
|
8215
|
+
].join(" "),
|
|
8216
|
+
children: [
|
|
8217
|
+
/*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
|
|
8218
|
+
icon: "mdi:delete-outline",
|
|
8219
|
+
className: "w-5 h-5"
|
|
8220
|
+
}),
|
|
8221
|
+
removeButtonText
|
|
8222
|
+
]
|
|
8223
|
+
})
|
|
8224
|
+
]
|
|
8225
|
+
})
|
|
8226
|
+
}, field.id);
|
|
8227
|
+
}),
|
|
8228
|
+
addButtonPosition === "bottom" && canAdd && /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
8229
|
+
type: "button",
|
|
8230
|
+
onClick: handleAdd,
|
|
8231
|
+
className: [
|
|
8232
|
+
"h-11 px-6 rounded-2xl border border-solid border-[#6f6f6f]",
|
|
8233
|
+
"text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
|
|
8234
|
+
"transition-colors duration-200",
|
|
8235
|
+
"flex items-center gap-2"
|
|
8236
|
+
].join(" "),
|
|
8237
|
+
children: [
|
|
8238
|
+
/*#__PURE__*/ jsxRuntime.jsx(react$1.Icon, {
|
|
8239
|
+
icon: "mdi:plus",
|
|
8240
|
+
className: "w-5 h-5"
|
|
8241
|
+
}),
|
|
8242
|
+
addButtonText
|
|
8243
|
+
]
|
|
8244
|
+
}),
|
|
8245
|
+
maxItems && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8246
|
+
className: "text-xs text-[#777777]",
|
|
8247
|
+
children: [
|
|
8248
|
+
"已新增 ",
|
|
8249
|
+
fields.length,
|
|
8250
|
+
" / ",
|
|
8251
|
+
maxItems,
|
|
8252
|
+
" 項"
|
|
8253
|
+
]
|
|
8254
|
+
})
|
|
8255
|
+
]
|
|
8256
|
+
})
|
|
8257
|
+
]
|
|
8258
|
+
});
|
|
8259
|
+
};
|
|
8033
8260
|
var Fields = function(param) {
|
|
8034
8261
|
var formConfig = param.formConfig, _param_fieldsClass = param.fieldsClass, fieldsClass = _param_fieldsClass === void 0 ? "gap-2" : _param_fieldsClass;
|
|
8035
8262
|
return !!(formConfig === null || formConfig === void 0 ? void 0 : formConfig.length) && (formConfig === null || formConfig === void 0 ? void 0 : formConfig.map(function(item, index) {
|
|
@@ -8160,6 +8387,10 @@ var Row = function(param) {
|
|
|
8160
8387
|
return /*#__PURE__*/ React.createElement(FlatpickrField, _object_spread_props(_object_spread({}, baseConfig), {
|
|
8161
8388
|
key: "rowField-".concat(index)
|
|
8162
8389
|
}));
|
|
8390
|
+
case "fieldArray":
|
|
8391
|
+
return /*#__PURE__*/ React.createElement(FieldArray, _object_spread_props(_object_spread({}, baseConfig), {
|
|
8392
|
+
key: "rowField-".concat(index)
|
|
8393
|
+
}));
|
|
8163
8394
|
default:
|
|
8164
8395
|
return null;
|
|
8165
8396
|
}
|
|
@@ -8180,7 +8411,8 @@ var Form = {
|
|
|
8180
8411
|
CheckboxField: CheckboxField,
|
|
8181
8412
|
BaseCkeditor: BaseCkeditor,
|
|
8182
8413
|
Dropdown: DropdownList,
|
|
8183
|
-
FlatpickrField: FlatpickrField
|
|
8414
|
+
FlatpickrField: FlatpickrField,
|
|
8415
|
+
FieldArray: FieldArray
|
|
8184
8416
|
};
|
|
8185
8417
|
|
|
8186
8418
|
function _array_like_to_array$1(arr, len) {
|
package/Form.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { keyframes, jsx, css as css$2 } from '@emotion/react';
|
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { Icon } from '@iconify/react';
|
|
9
9
|
import { Checkbox, RadioGroup, FormControlLabel, Radio } from '@mui/material';
|
|
10
|
-
import { a as useFormContext, C as Controller } from './index.esm.esm.js';
|
|
10
|
+
import { a as useFormContext, C as Controller, c as useFieldArray } from './index.esm.esm.js';
|
|
11
11
|
import { d as dt } from './styled-components.esm.esm.js';
|
|
12
12
|
import { _, v as validateMsg } from './common.esm.js';
|
|
13
13
|
import { F as FieldLabel } from './FieldLabel.esm.js';
|
|
@@ -8003,6 +8003,233 @@ var Textarea = function(param) {
|
|
|
8003
8003
|
]
|
|
8004
8004
|
});
|
|
8005
8005
|
};
|
|
8006
|
+
var FieldArray = function(param) {
|
|
8007
|
+
var item = param.item;
|
|
8008
|
+
var _useFormContext = useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors, getValues = _useFormContext.getValues;
|
|
8009
|
+
var _useFieldArray = useFieldArray({
|
|
8010
|
+
control: control,
|
|
8011
|
+
name: item.name
|
|
8012
|
+
}), fields = _useFieldArray.fields, append = _useFieldArray.append, remove = _useFieldArray.remove;
|
|
8013
|
+
var config = item === null || item === void 0 ? void 0 : item.fieldArrayConfig;
|
|
8014
|
+
var fieldConfigs = (config === null || config === void 0 ? void 0 : config.fields) || [];
|
|
8015
|
+
var addButtonText = (config === null || config === void 0 ? void 0 : config.addButtonText) || "新增";
|
|
8016
|
+
var removeButtonText = (config === null || config === void 0 ? void 0 : config.removeButtonText) || "刪除";
|
|
8017
|
+
var maxItems = config === null || config === void 0 ? void 0 : config.maxItems;
|
|
8018
|
+
var minItems = (config === null || config === void 0 ? void 0 : config.minItems) || 0;
|
|
8019
|
+
var defaultItemCount = (config === null || config === void 0 ? void 0 : config.defaultItemCount) || 1;
|
|
8020
|
+
var addButtonPosition = (config === null || config === void 0 ? void 0 : config.addButtonPosition) || "bottom";
|
|
8021
|
+
var canAdd = !maxItems || fields.length < maxItems;
|
|
8022
|
+
var canRemove = fields.length > minItems;
|
|
8023
|
+
// 初始化:確保至少有 defaultItemCount 個項目
|
|
8024
|
+
React__default.useEffect(function() {
|
|
8025
|
+
var currentValues = getValues(item.name);
|
|
8026
|
+
if (!currentValues || currentValues.length === 0) {
|
|
8027
|
+
var _loop = function(i) {
|
|
8028
|
+
var newItem = {};
|
|
8029
|
+
fieldConfigs.forEach(function(field) {
|
|
8030
|
+
newItem[field.name] = "";
|
|
8031
|
+
});
|
|
8032
|
+
append(newItem);
|
|
8033
|
+
};
|
|
8034
|
+
var itemsToAdd = defaultItemCount;
|
|
8035
|
+
for(var i = 0; i < itemsToAdd; i++)_loop(i);
|
|
8036
|
+
}
|
|
8037
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8038
|
+
}, []);
|
|
8039
|
+
var handleAdd = function() {
|
|
8040
|
+
if (canAdd) {
|
|
8041
|
+
var newItem = {};
|
|
8042
|
+
fieldConfigs.forEach(function(field) {
|
|
8043
|
+
newItem[field.name] = "";
|
|
8044
|
+
});
|
|
8045
|
+
append(newItem);
|
|
8046
|
+
}
|
|
8047
|
+
};
|
|
8048
|
+
var handleRemove = function(index) {
|
|
8049
|
+
if (canRemove) {
|
|
8050
|
+
remove(index);
|
|
8051
|
+
}
|
|
8052
|
+
};
|
|
8053
|
+
var getFieldError = function(index, fieldName) {
|
|
8054
|
+
var fieldPath = "".concat(item.name, ".").concat(index, ".").concat(fieldName);
|
|
8055
|
+
var pathParts = fieldPath.split(".");
|
|
8056
|
+
var error = errors;
|
|
8057
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8058
|
+
try {
|
|
8059
|
+
for(var _iterator = pathParts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8060
|
+
var part = _step.value;
|
|
8061
|
+
if (error && error[part]) {
|
|
8062
|
+
error = error[part];
|
|
8063
|
+
} else {
|
|
8064
|
+
return null;
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
} catch (err) {
|
|
8068
|
+
_didIteratorError = true;
|
|
8069
|
+
_iteratorError = err;
|
|
8070
|
+
} finally{
|
|
8071
|
+
try {
|
|
8072
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8073
|
+
_iterator.return();
|
|
8074
|
+
}
|
|
8075
|
+
} finally{
|
|
8076
|
+
if (_didIteratorError) {
|
|
8077
|
+
throw _iteratorError;
|
|
8078
|
+
}
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
return error;
|
|
8082
|
+
};
|
|
8083
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
8084
|
+
className: [
|
|
8085
|
+
(item === null || item === void 0 ? void 0 : item.className) || "w-full"
|
|
8086
|
+
].join(" "),
|
|
8087
|
+
children: [
|
|
8088
|
+
/*#__PURE__*/ jsx$1(FieldLabel, {
|
|
8089
|
+
item: item
|
|
8090
|
+
}),
|
|
8091
|
+
/*#__PURE__*/ jsxs("div", {
|
|
8092
|
+
className: "space-y-4",
|
|
8093
|
+
children: [
|
|
8094
|
+
fields.map(function(field, index) {
|
|
8095
|
+
return /*#__PURE__*/ jsx$1("div", {
|
|
8096
|
+
className: "border border-[#C8C8C8] rounded-xl p-4 bg-white overflow-scroll",
|
|
8097
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
8098
|
+
className: "flex items-start gap-2 flex-wrap lg:flex-nowrap",
|
|
8099
|
+
children: [
|
|
8100
|
+
fieldConfigs.map(function(fieldConfig, fieldIndex) {
|
|
8101
|
+
var _fieldConfig_validateOption;
|
|
8102
|
+
var fieldName = "".concat(item.name, ".").concat(index, ".").concat(fieldConfig.name);
|
|
8103
|
+
var fieldError = getFieldError(index, fieldConfig.name);
|
|
8104
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
8105
|
+
className: "flex-1 min-w-[200px]",
|
|
8106
|
+
children: [
|
|
8107
|
+
/*#__PURE__*/ jsxs("div", {
|
|
8108
|
+
className: "font-medium mb-2 text-sm",
|
|
8109
|
+
children: [
|
|
8110
|
+
fieldConfig.label,
|
|
8111
|
+
(fieldConfig === null || fieldConfig === void 0 ? void 0 : (_fieldConfig_validateOption = fieldConfig.validateOption) === null || _fieldConfig_validateOption === void 0 ? void 0 : _fieldConfig_validateOption.required) && /*#__PURE__*/ jsx$1("span", {
|
|
8112
|
+
className: "pl-1 text-[#EF5533] font-bold",
|
|
8113
|
+
children: "*"
|
|
8114
|
+
})
|
|
8115
|
+
]
|
|
8116
|
+
}),
|
|
8117
|
+
/*#__PURE__*/ jsx$1(Controller, {
|
|
8118
|
+
name: fieldName,
|
|
8119
|
+
control: control,
|
|
8120
|
+
rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.validateOption,
|
|
8121
|
+
render: function(param) {
|
|
8122
|
+
var controllerField = param.field;
|
|
8123
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
8124
|
+
className: "relative",
|
|
8125
|
+
children: [
|
|
8126
|
+
/*#__PURE__*/ jsx$1("input", _object_spread_props(_object_spread({}, controllerField), {
|
|
8127
|
+
list: "".concat(fieldName, "-datalist"),
|
|
8128
|
+
type: "text",
|
|
8129
|
+
className: [
|
|
8130
|
+
(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]",
|
|
8131
|
+
"w-full h-11 rounded-2xl px-4 border border-solid border-[#B4B4B4]"
|
|
8132
|
+
].join(" "),
|
|
8133
|
+
placeholder: fieldConfig.placeholder || fieldConfig.label,
|
|
8134
|
+
disabled: (item === null || item === void 0 ? void 0 : item.disable) || (item === null || item === void 0 ? void 0 : item.disabled)
|
|
8135
|
+
})),
|
|
8136
|
+
fieldConfig.options && fieldConfig.options.length > 0 && /*#__PURE__*/ jsx$1("datalist", {
|
|
8137
|
+
id: "".concat(fieldName, "-datalist"),
|
|
8138
|
+
children: fieldConfig.options.map(function(option, optIndex) {
|
|
8139
|
+
return /*#__PURE__*/ jsx$1("option", {
|
|
8140
|
+
value: option.value || option.name,
|
|
8141
|
+
children: option.name
|
|
8142
|
+
}, optIndex);
|
|
8143
|
+
})
|
|
8144
|
+
})
|
|
8145
|
+
]
|
|
8146
|
+
});
|
|
8147
|
+
}
|
|
8148
|
+
}),
|
|
8149
|
+
(fieldError === null || fieldError === void 0 ? void 0 : fieldError.message) && /*#__PURE__*/ jsxs("div", {
|
|
8150
|
+
className: "pt-1 text-xs text-[#EF5533]",
|
|
8151
|
+
children: [
|
|
8152
|
+
"*",
|
|
8153
|
+
String(fieldError.message)
|
|
8154
|
+
]
|
|
8155
|
+
})
|
|
8156
|
+
]
|
|
8157
|
+
}, fieldIndex);
|
|
8158
|
+
}),
|
|
8159
|
+
addButtonPosition === "inline" && canAdd && index === fields.length - 1 && /*#__PURE__*/ jsxs("button", {
|
|
8160
|
+
type: "button",
|
|
8161
|
+
onClick: handleAdd,
|
|
8162
|
+
className: [
|
|
8163
|
+
"h-11 px-4 rounded-2xl border border-solid border-[#6f6f6f]",
|
|
8164
|
+
"text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
|
|
8165
|
+
"transition-colors duration-200",
|
|
8166
|
+
"flex items-center gap-2 whitespace-nowrap",
|
|
8167
|
+
"mt-[30px]"
|
|
8168
|
+
].join(" "),
|
|
8169
|
+
children: [
|
|
8170
|
+
/*#__PURE__*/ jsx$1(Icon, {
|
|
8171
|
+
icon: "mdi:plus",
|
|
8172
|
+
className: "w-5 h-5"
|
|
8173
|
+
}),
|
|
8174
|
+
addButtonText
|
|
8175
|
+
]
|
|
8176
|
+
}),
|
|
8177
|
+
canRemove && /*#__PURE__*/ jsxs("button", {
|
|
8178
|
+
type: "button",
|
|
8179
|
+
onClick: function() {
|
|
8180
|
+
return handleRemove(index);
|
|
8181
|
+
},
|
|
8182
|
+
className: [
|
|
8183
|
+
"h-11 px-4 rounded-2xl border border-solid border-[#EF5533]",
|
|
8184
|
+
"text-[#EF5533] bg-white hover:bg-[#FFF5F3]",
|
|
8185
|
+
"transition-colors duration-200",
|
|
8186
|
+
"flex items-center gap-2 whitespace-nowrap",
|
|
8187
|
+
"mt-[30px]"
|
|
8188
|
+
].join(" "),
|
|
8189
|
+
children: [
|
|
8190
|
+
/*#__PURE__*/ jsx$1(Icon, {
|
|
8191
|
+
icon: "mdi:delete-outline",
|
|
8192
|
+
className: "w-5 h-5"
|
|
8193
|
+
}),
|
|
8194
|
+
removeButtonText
|
|
8195
|
+
]
|
|
8196
|
+
})
|
|
8197
|
+
]
|
|
8198
|
+
})
|
|
8199
|
+
}, field.id);
|
|
8200
|
+
}),
|
|
8201
|
+
addButtonPosition === "bottom" && canAdd && /*#__PURE__*/ jsxs("button", {
|
|
8202
|
+
type: "button",
|
|
8203
|
+
onClick: handleAdd,
|
|
8204
|
+
className: [
|
|
8205
|
+
"h-11 px-6 rounded-2xl border border-solid border-[#6f6f6f]",
|
|
8206
|
+
"text-[#6f6f6f] bg-white hover:bg-[#F5F5F5]",
|
|
8207
|
+
"transition-colors duration-200",
|
|
8208
|
+
"flex items-center gap-2"
|
|
8209
|
+
].join(" "),
|
|
8210
|
+
children: [
|
|
8211
|
+
/*#__PURE__*/ jsx$1(Icon, {
|
|
8212
|
+
icon: "mdi:plus",
|
|
8213
|
+
className: "w-5 h-5"
|
|
8214
|
+
}),
|
|
8215
|
+
addButtonText
|
|
8216
|
+
]
|
|
8217
|
+
}),
|
|
8218
|
+
maxItems && /*#__PURE__*/ jsxs("div", {
|
|
8219
|
+
className: "text-xs text-[#777777]",
|
|
8220
|
+
children: [
|
|
8221
|
+
"已新增 ",
|
|
8222
|
+
fields.length,
|
|
8223
|
+
" / ",
|
|
8224
|
+
maxItems,
|
|
8225
|
+
" 項"
|
|
8226
|
+
]
|
|
8227
|
+
})
|
|
8228
|
+
]
|
|
8229
|
+
})
|
|
8230
|
+
]
|
|
8231
|
+
});
|
|
8232
|
+
};
|
|
8006
8233
|
var Fields = function(param) {
|
|
8007
8234
|
var formConfig = param.formConfig, _param_fieldsClass = param.fieldsClass, fieldsClass = _param_fieldsClass === void 0 ? "gap-2" : _param_fieldsClass;
|
|
8008
8235
|
return !!(formConfig === null || formConfig === void 0 ? void 0 : formConfig.length) && (formConfig === null || formConfig === void 0 ? void 0 : formConfig.map(function(item, index) {
|
|
@@ -8133,6 +8360,10 @@ var Row = function(param) {
|
|
|
8133
8360
|
return /*#__PURE__*/ createElement(FlatpickrField, _object_spread_props(_object_spread({}, baseConfig), {
|
|
8134
8361
|
key: "rowField-".concat(index)
|
|
8135
8362
|
}));
|
|
8363
|
+
case "fieldArray":
|
|
8364
|
+
return /*#__PURE__*/ createElement(FieldArray, _object_spread_props(_object_spread({}, baseConfig), {
|
|
8365
|
+
key: "rowField-".concat(index)
|
|
8366
|
+
}));
|
|
8136
8367
|
default:
|
|
8137
8368
|
return null;
|
|
8138
8369
|
}
|
|
@@ -8153,7 +8384,8 @@ var Form = {
|
|
|
8153
8384
|
CheckboxField: CheckboxField,
|
|
8154
8385
|
BaseCkeditor: BaseCkeditor,
|
|
8155
8386
|
Dropdown: DropdownList,
|
|
8156
|
-
FlatpickrField: FlatpickrField
|
|
8387
|
+
FlatpickrField: FlatpickrField,
|
|
8388
|
+
FieldArray: FieldArray
|
|
8157
8389
|
};
|
|
8158
8390
|
|
|
8159
8391
|
function _array_like_to_array$1(arr, len) {
|
package/index.cjs.css
CHANGED
|
@@ -1635,6 +1635,9 @@ video {
|
|
|
1635
1635
|
.mt-5 {
|
|
1636
1636
|
margin-top: 1.25rem;
|
|
1637
1637
|
}
|
|
1638
|
+
.mt-\[30px\] {
|
|
1639
|
+
margin-top: 30px;
|
|
1640
|
+
}
|
|
1638
1641
|
.\!block {
|
|
1639
1642
|
display: block !important;
|
|
1640
1643
|
}
|
|
@@ -1902,6 +1905,9 @@ video {
|
|
|
1902
1905
|
.min-w-\[16rem\] {
|
|
1903
1906
|
min-width: 16rem;
|
|
1904
1907
|
}
|
|
1908
|
+
.min-w-\[200px\] {
|
|
1909
|
+
min-width: 200px;
|
|
1910
|
+
}
|
|
1905
1911
|
.min-w-\[2rem\] {
|
|
1906
1912
|
min-width: 2rem;
|
|
1907
1913
|
}
|
|
@@ -2184,6 +2190,11 @@ video {
|
|
|
2184
2190
|
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|
|
2185
2191
|
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
|
2186
2192
|
}
|
|
2193
|
+
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
|
|
2194
|
+
--tw-space-y-reverse: 0;
|
|
2195
|
+
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
2196
|
+
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
|
2197
|
+
}
|
|
2187
2198
|
.space-y-8 > :not([hidden]) ~ :not([hidden]) {
|
|
2188
2199
|
--tw-space-y-reverse: 0;
|
|
2189
2200
|
margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -2198,6 +2209,9 @@ video {
|
|
|
2198
2209
|
.overflow-hidden {
|
|
2199
2210
|
overflow: hidden;
|
|
2200
2211
|
}
|
|
2212
|
+
.overflow-scroll {
|
|
2213
|
+
overflow: scroll;
|
|
2214
|
+
}
|
|
2201
2215
|
.overflow-y-auto {
|
|
2202
2216
|
overflow-y: auto;
|
|
2203
2217
|
}
|
|
@@ -2313,6 +2327,10 @@ video {
|
|
|
2313
2327
|
--tw-border-opacity: 1;
|
|
2314
2328
|
border-color: rgb(101 101 101 / var(--tw-border-opacity, 1));
|
|
2315
2329
|
}
|
|
2330
|
+
.border-\[\#6f6f6f\] {
|
|
2331
|
+
--tw-border-opacity: 1;
|
|
2332
|
+
border-color: rgb(111 111 111 / var(--tw-border-opacity, 1));
|
|
2333
|
+
}
|
|
2316
2334
|
.border-\[\#777777\] {
|
|
2317
2335
|
--tw-border-opacity: 1;
|
|
2318
2336
|
border-color: rgb(119 119 119 / var(--tw-border-opacity, 1));
|
|
@@ -2337,6 +2355,10 @@ video {
|
|
|
2337
2355
|
--tw-border-opacity: 1;
|
|
2338
2356
|
border-color: rgb(217 217 217 / var(--tw-border-opacity, 1));
|
|
2339
2357
|
}
|
|
2358
|
+
.border-\[\#EF5533\] {
|
|
2359
|
+
--tw-border-opacity: 1;
|
|
2360
|
+
border-color: rgb(239 85 51 / var(--tw-border-opacity, 1));
|
|
2361
|
+
}
|
|
2340
2362
|
.border-\[\#ccc\] {
|
|
2341
2363
|
--tw-border-opacity: 1;
|
|
2342
2364
|
border-color: rgb(204 204 204 / var(--tw-border-opacity, 1));
|
|
@@ -2478,6 +2500,10 @@ video {
|
|
|
2478
2500
|
--tw-bg-opacity: 1;
|
|
2479
2501
|
background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1));
|
|
2480
2502
|
}
|
|
2503
|
+
.bg-blue-600 {
|
|
2504
|
+
--tw-bg-opacity: 1;
|
|
2505
|
+
background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
|
|
2506
|
+
}
|
|
2481
2507
|
.bg-cyan-500 {
|
|
2482
2508
|
--tw-bg-opacity: 1;
|
|
2483
2509
|
background-color: rgb(6 182 212 / var(--tw-bg-opacity, 1));
|
|
@@ -3565,6 +3591,14 @@ video {
|
|
|
3565
3591
|
--tw-bg-opacity: 1;
|
|
3566
3592
|
background-color: rgb(217 217 217 / var(--tw-bg-opacity, 1));
|
|
3567
3593
|
}
|
|
3594
|
+
.hover\:bg-\[\#F5F5F5\]:hover {
|
|
3595
|
+
--tw-bg-opacity: 1;
|
|
3596
|
+
background-color: rgb(245 245 245 / var(--tw-bg-opacity, 1));
|
|
3597
|
+
}
|
|
3598
|
+
.hover\:bg-\[\#FFF5F3\]:hover {
|
|
3599
|
+
--tw-bg-opacity: 1;
|
|
3600
|
+
background-color: rgb(255 245 243 / var(--tw-bg-opacity, 1));
|
|
3601
|
+
}
|
|
3568
3602
|
.hover\:bg-\[\#d9d9e2\]:hover {
|
|
3569
3603
|
--tw-bg-opacity: 1;
|
|
3570
3604
|
background-color: rgb(217 217 226 / var(--tw-bg-opacity, 1));
|
|
@@ -3584,6 +3618,10 @@ video {
|
|
|
3584
3618
|
--tw-bg-opacity: 1;
|
|
3585
3619
|
background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
|
|
3586
3620
|
}
|
|
3621
|
+
.hover\:bg-blue-700:hover {
|
|
3622
|
+
--tw-bg-opacity: 1;
|
|
3623
|
+
background-color: rgb(29 78 216 / var(--tw-bg-opacity, 1));
|
|
3624
|
+
}
|
|
3587
3625
|
.hover\:bg-cyan-100:hover {
|
|
3588
3626
|
--tw-bg-opacity: 1;
|
|
3589
3627
|
background-color: rgb(207 250 254 / var(--tw-bg-opacity, 1));
|
package/index.esm.css
CHANGED
|
@@ -1635,6 +1635,9 @@ video {
|
|
|
1635
1635
|
.mt-5 {
|
|
1636
1636
|
margin-top: 1.25rem;
|
|
1637
1637
|
}
|
|
1638
|
+
.mt-\[30px\] {
|
|
1639
|
+
margin-top: 30px;
|
|
1640
|
+
}
|
|
1638
1641
|
.\!block {
|
|
1639
1642
|
display: block !important;
|
|
1640
1643
|
}
|
|
@@ -1902,6 +1905,9 @@ video {
|
|
|
1902
1905
|
.min-w-\[16rem\] {
|
|
1903
1906
|
min-width: 16rem;
|
|
1904
1907
|
}
|
|
1908
|
+
.min-w-\[200px\] {
|
|
1909
|
+
min-width: 200px;
|
|
1910
|
+
}
|
|
1905
1911
|
.min-w-\[2rem\] {
|
|
1906
1912
|
min-width: 2rem;
|
|
1907
1913
|
}
|
|
@@ -2184,6 +2190,11 @@ video {
|
|
|
2184
2190
|
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|
|
2185
2191
|
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
|
2186
2192
|
}
|
|
2193
|
+
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
|
|
2194
|
+
--tw-space-y-reverse: 0;
|
|
2195
|
+
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
2196
|
+
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
|
2197
|
+
}
|
|
2187
2198
|
.space-y-8 > :not([hidden]) ~ :not([hidden]) {
|
|
2188
2199
|
--tw-space-y-reverse: 0;
|
|
2189
2200
|
margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -2198,6 +2209,9 @@ video {
|
|
|
2198
2209
|
.overflow-hidden {
|
|
2199
2210
|
overflow: hidden;
|
|
2200
2211
|
}
|
|
2212
|
+
.overflow-scroll {
|
|
2213
|
+
overflow: scroll;
|
|
2214
|
+
}
|
|
2201
2215
|
.overflow-y-auto {
|
|
2202
2216
|
overflow-y: auto;
|
|
2203
2217
|
}
|
|
@@ -2313,6 +2327,10 @@ video {
|
|
|
2313
2327
|
--tw-border-opacity: 1;
|
|
2314
2328
|
border-color: rgb(101 101 101 / var(--tw-border-opacity, 1));
|
|
2315
2329
|
}
|
|
2330
|
+
.border-\[\#6f6f6f\] {
|
|
2331
|
+
--tw-border-opacity: 1;
|
|
2332
|
+
border-color: rgb(111 111 111 / var(--tw-border-opacity, 1));
|
|
2333
|
+
}
|
|
2316
2334
|
.border-\[\#777777\] {
|
|
2317
2335
|
--tw-border-opacity: 1;
|
|
2318
2336
|
border-color: rgb(119 119 119 / var(--tw-border-opacity, 1));
|
|
@@ -2337,6 +2355,10 @@ video {
|
|
|
2337
2355
|
--tw-border-opacity: 1;
|
|
2338
2356
|
border-color: rgb(217 217 217 / var(--tw-border-opacity, 1));
|
|
2339
2357
|
}
|
|
2358
|
+
.border-\[\#EF5533\] {
|
|
2359
|
+
--tw-border-opacity: 1;
|
|
2360
|
+
border-color: rgb(239 85 51 / var(--tw-border-opacity, 1));
|
|
2361
|
+
}
|
|
2340
2362
|
.border-\[\#ccc\] {
|
|
2341
2363
|
--tw-border-opacity: 1;
|
|
2342
2364
|
border-color: rgb(204 204 204 / var(--tw-border-opacity, 1));
|
|
@@ -2478,6 +2500,10 @@ video {
|
|
|
2478
2500
|
--tw-bg-opacity: 1;
|
|
2479
2501
|
background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1));
|
|
2480
2502
|
}
|
|
2503
|
+
.bg-blue-600 {
|
|
2504
|
+
--tw-bg-opacity: 1;
|
|
2505
|
+
background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
|
|
2506
|
+
}
|
|
2481
2507
|
.bg-cyan-500 {
|
|
2482
2508
|
--tw-bg-opacity: 1;
|
|
2483
2509
|
background-color: rgb(6 182 212 / var(--tw-bg-opacity, 1));
|
|
@@ -3565,6 +3591,14 @@ video {
|
|
|
3565
3591
|
--tw-bg-opacity: 1;
|
|
3566
3592
|
background-color: rgb(217 217 217 / var(--tw-bg-opacity, 1));
|
|
3567
3593
|
}
|
|
3594
|
+
.hover\:bg-\[\#F5F5F5\]:hover {
|
|
3595
|
+
--tw-bg-opacity: 1;
|
|
3596
|
+
background-color: rgb(245 245 245 / var(--tw-bg-opacity, 1));
|
|
3597
|
+
}
|
|
3598
|
+
.hover\:bg-\[\#FFF5F3\]:hover {
|
|
3599
|
+
--tw-bg-opacity: 1;
|
|
3600
|
+
background-color: rgb(255 245 243 / var(--tw-bg-opacity, 1));
|
|
3601
|
+
}
|
|
3568
3602
|
.hover\:bg-\[\#d9d9e2\]:hover {
|
|
3569
3603
|
--tw-bg-opacity: 1;
|
|
3570
3604
|
background-color: rgb(217 217 226 / var(--tw-bg-opacity, 1));
|
|
@@ -3584,6 +3618,10 @@ video {
|
|
|
3584
3618
|
--tw-bg-opacity: 1;
|
|
3585
3619
|
background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
|
|
3586
3620
|
}
|
|
3621
|
+
.hover\:bg-blue-700:hover {
|
|
3622
|
+
--tw-bg-opacity: 1;
|
|
3623
|
+
background-color: rgb(29 78 216 / var(--tw-bg-opacity, 1));
|
|
3624
|
+
}
|
|
3587
3625
|
.hover\:bg-cyan-100:hover {
|
|
3588
3626
|
--tw-bg-opacity: 1;
|
|
3589
3627
|
background-color: rgb(207 250 254 / var(--tw-bg-opacity, 1));
|
package/package.json
CHANGED
package/src/lib/Form/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { FormItem, FormType } from './types';
|
|
3
4
|
interface CkEditorConfig {
|
|
4
5
|
uploadUrl?: string;
|
|
@@ -54,6 +55,9 @@ export interface FormModule {
|
|
|
54
55
|
FlatpickrField: FC<{
|
|
55
56
|
item: FormItem;
|
|
56
57
|
}>;
|
|
58
|
+
FieldArray: FC<{
|
|
59
|
+
item: FormItem;
|
|
60
|
+
}>;
|
|
57
61
|
}
|
|
58
62
|
export declare const City: React.FC<FormType>;
|
|
59
63
|
export declare const Textarea: React.FC<FormType>;
|
package/src/lib/Form/types.d.ts
CHANGED
|
@@ -9,6 +9,37 @@ export interface OptionGroup {
|
|
|
9
9
|
value?: string;
|
|
10
10
|
name?: string;
|
|
11
11
|
}
|
|
12
|
+
export interface FieldArrayField {
|
|
13
|
+
name: string;
|
|
14
|
+
label: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
options?: Option[];
|
|
17
|
+
validateOption?: {
|
|
18
|
+
pattern?: RegExp | {
|
|
19
|
+
value: RegExp;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
validateMsg?: string;
|
|
23
|
+
required?: boolean | string;
|
|
24
|
+
validate?: any;
|
|
25
|
+
min?: number | {
|
|
26
|
+
value: number;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
max?: number | {
|
|
30
|
+
value: number;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
33
|
+
minLength?: number | {
|
|
34
|
+
value: number;
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
maxLength?: number | {
|
|
38
|
+
value: number;
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
12
43
|
interface RadioOption {
|
|
13
44
|
label?: string;
|
|
14
45
|
value?: string;
|
|
@@ -137,6 +168,15 @@ export interface FormItem {
|
|
|
137
168
|
flatpickrOptions?: FlatpickrOptions;
|
|
138
169
|
flatpickrType?: 'time';
|
|
139
170
|
onChange?: (value: any) => void;
|
|
171
|
+
fieldArrayConfig?: {
|
|
172
|
+
fields: FieldArrayField[];
|
|
173
|
+
addButtonText?: string;
|
|
174
|
+
removeButtonText?: string;
|
|
175
|
+
maxItems?: number;
|
|
176
|
+
minItems?: number;
|
|
177
|
+
defaultItemCount?: number;
|
|
178
|
+
addButtonPosition?: 'inline' | 'bottom';
|
|
179
|
+
};
|
|
140
180
|
}
|
|
141
181
|
export interface FormType {
|
|
142
182
|
item: FormItem;
|