zy-react-library 1.0.149 → 1.0.151
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.
|
@@ -52,7 +52,7 @@ export interface FormListUniqueProps {
|
|
|
52
52
|
/** 删除按钮的文本,默认 '删除' */
|
|
53
53
|
removeButtonText?: string;
|
|
54
54
|
/** 表单配置项 */
|
|
55
|
-
options: (field: FormListFieldData) => FormOption[];
|
|
55
|
+
options: (field: FormListFieldData, index: number) => FormOption[];
|
|
56
56
|
/** 点击新增按钮时的默认值 */
|
|
57
57
|
addDefaultValue?: FormValues;
|
|
58
58
|
/** 点击新增按钮时插入的索引位置 */
|
|
@@ -159,7 +159,7 @@ const FormItemsRenderer = ({
|
|
|
159
159
|
rules.push({ pattern: /^(\d+)(\.\d{1,2})?$/, message: "请输入正确的数字,最多保留两位小数" });
|
|
160
160
|
rules.push({
|
|
161
161
|
validator: (_, value) => {
|
|
162
|
-
if (value && Math.abs(Number.parseFloat(value)) >
|
|
162
|
+
if (value && Math.abs(Number.parseFloat(value)) > 999999999) {
|
|
163
163
|
return Promise.reject("输入数值超出安全范围");
|
|
164
164
|
}
|
|
165
165
|
return Promise.resolve();
|
|
@@ -169,7 +169,7 @@ const FormItemsRenderer = ({
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
if (!useAutoGenerateRequired)
|
|
172
|
-
return option.rules ? (Array.isArray(option.rules) ? [...option.rules, ...rules] : [option.rules, ...rules]) :
|
|
172
|
+
return option.rules ? (Array.isArray(option.rules) ? [...option.rules, ...rules] : [option.rules, ...rules]) : rules;
|
|
173
173
|
|
|
174
174
|
if (getRequired(option.required)) {
|
|
175
175
|
const isBlurTrigger = !option.render || [
|
|
@@ -193,7 +193,7 @@ const FormItemsRenderer = ({
|
|
|
193
193
|
return rules;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
return option.rules ? (Array.isArray(option.rules) ? [...option.rules, ...rules] : [option.rules, ...rules]) :
|
|
196
|
+
return option.rules ? (Array.isArray(option.rules) ? [...option.rules, ...rules] : [option.rules, ...rules]) : rules;
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
// 获取key
|
|
@@ -223,9 +223,9 @@ const FormItemsRenderer = ({
|
|
|
223
223
|
};
|
|
224
224
|
|
|
225
225
|
// 获取 listOptions
|
|
226
|
-
const getListOptions = (listOptions, field) => {
|
|
226
|
+
const getListOptions = (listOptions, field, fieldIndex) => {
|
|
227
227
|
return typeof listOptions === "function"
|
|
228
|
-
? listOptions(field)
|
|
228
|
+
? listOptions(field, fieldIndex)
|
|
229
229
|
: (listOptions ?? []);
|
|
230
230
|
};
|
|
231
231
|
|
|
@@ -452,7 +452,7 @@ const FormItemsRenderer = ({
|
|
|
452
452
|
{(fields, { add, remove }) => (
|
|
453
453
|
<>
|
|
454
454
|
{fields.map((field, fieldIndex) => {
|
|
455
|
-
const listOptions = getListOptions(option.formListUniqueProps.options, field);
|
|
455
|
+
const listOptions = getListOptions(option.formListUniqueProps.options, field, fieldIndex);
|
|
456
456
|
return (
|
|
457
457
|
<Row gutter={gutter} key={field.key}>
|
|
458
458
|
{listOptions.map((listOption, listIndex) => {
|