@fe-free/core 3.0.22 → 3.0.24
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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/form/form.stories.tsx +6 -2
- package/src/form/form_list/form_list.tsx +45 -33
- package/src/form/index.tsx +8 -1
- package/src/index.ts +3 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"safe-stable-stringify": "^2.5.0",
|
|
42
42
|
"vanilla-jsoneditor": "^0.23.1",
|
|
43
43
|
"zustand": "^4.5.4",
|
|
44
|
-
"@fe-free/tool": "3.0.
|
|
44
|
+
"@fe-free/tool": "3.0.24"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@ant-design/pro-components": "2.8.9",
|
|
@@ -169,8 +169,12 @@ export const ProFormSwitchOptionsComponent: Story = {
|
|
|
169
169
|
export const ProFormListTextComponent: Story = {
|
|
170
170
|
render: () => (
|
|
171
171
|
<ProFormBase>
|
|
172
|
-
<ProFormListText name="listText" />
|
|
173
|
-
<ProFormListText
|
|
172
|
+
<ProFormListText name="listText" label="listText" required={false} />
|
|
173
|
+
<ProFormListText
|
|
174
|
+
name="listText_isValueLabel"
|
|
175
|
+
label="listText_isValueLabel"
|
|
176
|
+
fieldProps={{ isValueLabel: true }}
|
|
177
|
+
/>
|
|
174
178
|
</ProFormBase>
|
|
175
179
|
),
|
|
176
180
|
};
|
|
@@ -115,26 +115,29 @@ function ProFormListText(props: ProFormItemProps<ListTextProps>) {
|
|
|
115
115
|
required={props.required ?? true}
|
|
116
116
|
rules={[
|
|
117
117
|
...(props.rules || []),
|
|
118
|
-
|
|
118
|
+
{ required: props.required ?? true },
|
|
119
119
|
{
|
|
120
120
|
validator: async (_, value) => {
|
|
121
|
-
if (
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
121
|
+
if (value) {
|
|
122
|
+
if (fieldProps?.isValueLabel) {
|
|
123
|
+
if (value?.some((item) => item.value === undefined || item.value === '')) {
|
|
124
|
+
return Promise.reject('存在空选项');
|
|
125
|
+
}
|
|
126
|
+
// 不能有重复的 value
|
|
127
|
+
if (uniqBy(value, 'value').length !== value.length) {
|
|
128
|
+
return Promise.reject('不能有重复');
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
if (value?.some((item) => item === undefined || item === '')) {
|
|
132
|
+
return Promise.reject('存在空选项');
|
|
133
|
+
}
|
|
134
|
+
// 不能有重复的 value
|
|
135
|
+
if (uniq(value).length !== value.length) {
|
|
136
|
+
return Promise.reject('不能有重复');
|
|
137
|
+
}
|
|
136
138
|
}
|
|
137
139
|
}
|
|
140
|
+
|
|
138
141
|
return Promise.resolve();
|
|
139
142
|
},
|
|
140
143
|
},
|
|
@@ -154,24 +157,26 @@ function ProFormListNumber(props: ProFormItemProps<ListNumberProps>) {
|
|
|
154
157
|
required={props.required ?? true}
|
|
155
158
|
rules={[
|
|
156
159
|
...(props.rules || []),
|
|
157
|
-
|
|
160
|
+
{ required: props.required ?? true },
|
|
158
161
|
{
|
|
159
162
|
validator: async (_, value) => {
|
|
160
|
-
if (
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
if (value) {
|
|
164
|
+
if (fieldProps?.isValueLabel) {
|
|
165
|
+
if (value?.some((item) => item.value === undefined || item.value === null)) {
|
|
166
|
+
return Promise.reject('存在空选项');
|
|
167
|
+
}
|
|
168
|
+
// 不能有重复的 value
|
|
169
|
+
if (uniqBy(value, 'value').length !== value.length) {
|
|
170
|
+
return Promise.reject('不能有重复');
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
if (value?.some((item) => item === undefined || item === null)) {
|
|
174
|
+
return Promise.reject('存在空选项');
|
|
175
|
+
}
|
|
176
|
+
// 不能有重复的 value
|
|
177
|
+
if (uniq(value).length !== value.length) {
|
|
178
|
+
return Promise.reject('不能有重复');
|
|
179
|
+
}
|
|
175
180
|
}
|
|
176
181
|
}
|
|
177
182
|
return Promise.resolve();
|
|
@@ -193,4 +198,11 @@ function ProFormListBoolean(props: ProFormItemProps<ListBooleanProps>) {
|
|
|
193
198
|
);
|
|
194
199
|
}
|
|
195
200
|
|
|
196
|
-
export {
|
|
201
|
+
export {
|
|
202
|
+
ListBoolean,
|
|
203
|
+
ListNumber,
|
|
204
|
+
ListText,
|
|
205
|
+
ProFormListBoolean,
|
|
206
|
+
ProFormListNumber,
|
|
207
|
+
ProFormListText,
|
|
208
|
+
};
|
package/src/form/index.tsx
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
ListBoolean,
|
|
3
|
+
ListNumber,
|
|
4
|
+
ListText,
|
|
5
|
+
ProFormListBoolean,
|
|
6
|
+
ProFormListNumber,
|
|
7
|
+
ProFormListText,
|
|
8
|
+
} from './form_list/form_list';
|
|
2
9
|
export { ProFormListHelper } from './form_list/form_list_helper';
|
|
3
10
|
export { ProFormListModalHelper } from './form_list/form_list_modal_helper';
|
|
4
11
|
export { ProFormEditor } from './pro_form_editor';
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,9 @@ export { EditorMention } from './editor_mention';
|
|
|
24
24
|
export type { EditorMentionProps } from './editor_mention';
|
|
25
25
|
export { FileCard } from './file';
|
|
26
26
|
export {
|
|
27
|
+
ListBoolean,
|
|
28
|
+
ListNumber,
|
|
29
|
+
ListText,
|
|
27
30
|
ProFormAvatarImageUpload,
|
|
28
31
|
ProFormEditor,
|
|
29
32
|
ProFormImageUpload,
|