@hzab/list-render 1.12.3-alpha.3 → 1.12.4
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 +0 -6
- package/README.md +612 -0
- package/docs/effect.md +2 -0
- package/docs/form-linkage.md +293 -0
- package/docs/remote-data.md +124 -0
- package/docs/table.md +86 -0
- package/package.json +73 -77
- package/src/FilterTag/index.tsx +5 -4
- package/src/FormModal/index.tsx +1 -1
- package/src/components/Formily/FormilyEditTable.tsx +3 -3
- package/src/components/Formily/FormilyField.tsx +4 -5
- package/src/components/PrefixNode/index.tsx +4 -4
- package/src/components/Tags/index.tsx +4 -4
- package/LICENSE +0 -21
- package/dist/FilterTag/index.d.ts +0 -3
- package/dist/FormModal/index.d.ts +0 -19
- package/dist/common/cloneSchema.d.ts +0 -7
- package/dist/common/constant.d.ts +0 -2
- package/dist/common/handleQuerySchema.d.ts +0 -165
- package/dist/components/Formily/FormilyEditTable.d.ts +0 -94
- package/dist/components/Formily/FormilyField.d.ts +0 -10
- package/dist/components/PrefixNode/index.d.ts +0 -21
- package/dist/components/Tags/index.d.ts +0 -16
- package/dist/index.cjs +0 -1
- package/dist/index.css +0 -2
- package/dist/index.js +0 -1660
- package/src/vite-env.d.ts +0 -1
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# 表单联动
|
|
2
|
+
|
|
3
|
+
- 通过 配置响应器 实现
|
|
4
|
+
|
|
5
|
+
#### 表单项显隐
|
|
6
|
+
|
|
7
|
+
1. Schema JSON 配置页面
|
|
8
|
+
2. 选中需要控制显隐的表单项
|
|
9
|
+
3. 点击属性配置 -> 字段属性 -> 配置响应器
|
|
10
|
+
4. 按需选择依赖字段 menuType(需要监听的字段,可根据该字段的值改变显隐状态)
|
|
11
|
+
5. 属性响应器 -> 显示/隐藏 -> 输入框中输入 $deps.menuType === 'C' ($deps 表示表单中的字段,$deps.menuType 表示监听 menuType 表单项,如果 menuType 的值为 'C' 时展示当前表单项,否时隐藏当前表单项(perms))
|
|
12
|
+
|
|
13
|
+
- test.schema.json
|
|
14
|
+
|
|
15
|
+
```JSON
|
|
16
|
+
{
|
|
17
|
+
"form": {
|
|
18
|
+
"labelCol": 6,
|
|
19
|
+
"wrapperCol": 12
|
|
20
|
+
},
|
|
21
|
+
"schema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"menuType": {
|
|
25
|
+
"type": "string | number",
|
|
26
|
+
"title": "菜单类型",
|
|
27
|
+
"x-decorator": "FormItem",
|
|
28
|
+
"x-component": "Radio.Group",
|
|
29
|
+
"enum": [
|
|
30
|
+
{
|
|
31
|
+
"children": [],
|
|
32
|
+
"label": "目录",
|
|
33
|
+
"value": "M"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"children": [],
|
|
37
|
+
"label": "菜单",
|
|
38
|
+
"value": "C"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"children": [],
|
|
42
|
+
"label": "按钮",
|
|
43
|
+
"value": "F"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"x-validator": [],
|
|
47
|
+
"x-component-props": {},
|
|
48
|
+
"x-decorator-props": {},
|
|
49
|
+
"name": "menuType",
|
|
50
|
+
"default": "M",
|
|
51
|
+
"x-designable-id": "5gkoosg4b2k",
|
|
52
|
+
"x-index": 0,
|
|
53
|
+
"inTable": false
|
|
54
|
+
},
|
|
55
|
+
"perms": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"title": "权限字符",
|
|
58
|
+
"x-decorator": "FormItem",
|
|
59
|
+
"x-component": "Input",
|
|
60
|
+
"x-validator": [],
|
|
61
|
+
"x-component-props": {},
|
|
62
|
+
"x-decorator-props": {},
|
|
63
|
+
"name": "perms",
|
|
64
|
+
"required": true,
|
|
65
|
+
"x-designable-id": "xzy6veht5hc",
|
|
66
|
+
"x-index": 1,
|
|
67
|
+
"x-reactions": {
|
|
68
|
+
"dependencies": [
|
|
69
|
+
{
|
|
70
|
+
"property": "value",
|
|
71
|
+
"type": "string | number",
|
|
72
|
+
"source": "menuType",
|
|
73
|
+
"name": "menuType"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"fulfill": {
|
|
77
|
+
"state": {
|
|
78
|
+
"visible": "{{$deps.menuType === \"C\"}}"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"x-designable-id": "ivyw5onkhz8"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### 表单项数据
|
|
90
|
+
|
|
91
|
+
##### 根据其他表单项改变当前表单项数值
|
|
92
|
+
|
|
93
|
+
```JSON
|
|
94
|
+
{
|
|
95
|
+
"form": {},
|
|
96
|
+
"schema": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"test": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"title": "test",
|
|
102
|
+
"x-decorator": "FormItem",
|
|
103
|
+
"x-component": "Input",
|
|
104
|
+
"x-validator": [],
|
|
105
|
+
"x-component-props": {},
|
|
106
|
+
"x-decorator-props": {},
|
|
107
|
+
"x-reactions": {},
|
|
108
|
+
"x-designable-id": "1zlm9bu3fpg",
|
|
109
|
+
"x-index": 0,
|
|
110
|
+
"name": "test",
|
|
111
|
+
"x-display": "visible"
|
|
112
|
+
},
|
|
113
|
+
"watch": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"title": "watch",
|
|
116
|
+
"x-decorator": "FormItem",
|
|
117
|
+
"x-component": "Input",
|
|
118
|
+
"x-validator": [],
|
|
119
|
+
"x-component-props": {},
|
|
120
|
+
"x-decorator-props": {},
|
|
121
|
+
"name": "watch",
|
|
122
|
+
"x-reactions": {
|
|
123
|
+
"dependencies": [
|
|
124
|
+
{
|
|
125
|
+
"property": "value",
|
|
126
|
+
"type": "string",
|
|
127
|
+
"source": "test",
|
|
128
|
+
"name": "test"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"fulfill": {
|
|
132
|
+
"state": {
|
|
133
|
+
"value": "{{$deps.test + 10}}"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"x-designable-id": "ri912mmvcz2",
|
|
138
|
+
"x-index": 1
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"x-designable-id": "ldzb3lu81dx"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
##### 根据其他表单项改变当前 select 数据
|
|
147
|
+
|
|
148
|
+
```JSX
|
|
149
|
+
// RemoteData
|
|
150
|
+
import listSchema from "./list.schema.json";
|
|
151
|
+
|
|
152
|
+
const schemaScope = {
|
|
153
|
+
// 动态获取 select 数据
|
|
154
|
+
fetchSelectOptions(field, query) {
|
|
155
|
+
field.loading = true;
|
|
156
|
+
fetch(
|
|
157
|
+
`//some.domain/getSomething?test=${query.test}`
|
|
158
|
+
)
|
|
159
|
+
.then((response) => response.json())
|
|
160
|
+
.then(
|
|
161
|
+
({ data }) => {
|
|
162
|
+
// field 目标组件的 配置参数
|
|
163
|
+
console.log("fetchSelectOptions field", field);
|
|
164
|
+
// 通过 select 可直接通过 field.dataSource 进行选项数据的配置
|
|
165
|
+
field.dataSource = data;
|
|
166
|
+
field.loading = false;
|
|
167
|
+
},
|
|
168
|
+
() => {
|
|
169
|
+
field.loading = false;
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
},
|
|
173
|
+
// 动态获取 treeSelect 数据
|
|
174
|
+
fetchMenuTree(field, query) {
|
|
175
|
+
field.loading = true;
|
|
176
|
+
fetch(
|
|
177
|
+
`//some.domain/getSomething?test=${query.test}`
|
|
178
|
+
)
|
|
179
|
+
.then((response) => response.json())
|
|
180
|
+
.then(
|
|
181
|
+
({ data }) => {
|
|
182
|
+
// field 目标组件的 配置参数
|
|
183
|
+
console.log("fetchMenuTree field", field);
|
|
184
|
+
// 通过 field.component[1] 可以动态配置目标组件的 props
|
|
185
|
+
console.log("fetchMenuTree field.component[1]", field.component[1]);
|
|
186
|
+
// 树选择器 数据源,需要通过 field.component[1] 进行配置
|
|
187
|
+
field.component[1].treeData = data;
|
|
188
|
+
field.loading = false;
|
|
189
|
+
},
|
|
190
|
+
() => {
|
|
191
|
+
field.loading = false;
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
function RemoteData() {
|
|
198
|
+
const listDM = useMemo(
|
|
199
|
+
() =>
|
|
200
|
+
new DataModule({
|
|
201
|
+
getListApi: "/api/v1/user/list",
|
|
202
|
+
getApi: "/api/v1/user/list/:id",
|
|
203
|
+
createApi: "/api/v1/user/list",
|
|
204
|
+
updateApi: "/api/v1/user/list/:id",
|
|
205
|
+
deleteApi: "/api/v1/user/list/:id",
|
|
206
|
+
}),
|
|
207
|
+
[]
|
|
208
|
+
);
|
|
209
|
+
return (
|
|
210
|
+
<ListRender model={listDM} schema={listSchema} schemaScope={schemaScope} />
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export default RemoteData;
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```JSON
|
|
219
|
+
{
|
|
220
|
+
"form": {
|
|
221
|
+
"labelCol": 6,
|
|
222
|
+
"wrapperCol": 12
|
|
223
|
+
},
|
|
224
|
+
"schema": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"test": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"title": "test",
|
|
230
|
+
"x-decorator": "FormItem",
|
|
231
|
+
"x-component": "Input",
|
|
232
|
+
"x-validator": [],
|
|
233
|
+
"x-component-props": {},
|
|
234
|
+
"x-decorator-props": {},
|
|
235
|
+
"x-reactions": {},
|
|
236
|
+
"x-designable-id": "1zlm9bu3fpg",
|
|
237
|
+
"x-index": 0,
|
|
238
|
+
"name": "test",
|
|
239
|
+
"x-display": "visible"
|
|
240
|
+
},
|
|
241
|
+
"watch": {
|
|
242
|
+
"title": "watch",
|
|
243
|
+
"x-decorator": "FormItem",
|
|
244
|
+
"x-component": "Select",
|
|
245
|
+
"x-validator": [],
|
|
246
|
+
"x-component-props": {},
|
|
247
|
+
"x-decorator-props": {},
|
|
248
|
+
"name": "watch",
|
|
249
|
+
"x-designable-id": "jvjf7fkpke9",
|
|
250
|
+
"x-index": 1,
|
|
251
|
+
"x-reactions": {
|
|
252
|
+
"dependencies": [
|
|
253
|
+
{
|
|
254
|
+
"property": "value",
|
|
255
|
+
"type": "string",
|
|
256
|
+
"source": "test",
|
|
257
|
+
"name": "test"
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"fulfill": {
|
|
261
|
+
"run": "$effect(() => {\n try {\n fetchSelectOptions && fetchSelectOptions($self, { test: $deps.test })\n } catch (e) {}\n}, [$deps.test])\n"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"treeSelect": {
|
|
266
|
+
"title": "TreeSelect",
|
|
267
|
+
"x-decorator": "FormItem",
|
|
268
|
+
"x-component": "TreeSelect",
|
|
269
|
+
"x-validator": [],
|
|
270
|
+
"x-component-props": {},
|
|
271
|
+
"x-decorator-props": {},
|
|
272
|
+
"x-designable-id": "303l866v0lj",
|
|
273
|
+
"x-index": 2,
|
|
274
|
+
"name": "treeSelect",
|
|
275
|
+
"x-reactions": {
|
|
276
|
+
"dependencies": [
|
|
277
|
+
{
|
|
278
|
+
"property": "value",
|
|
279
|
+
"type": "string",
|
|
280
|
+
"source": "test",
|
|
281
|
+
"name": "test"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"fulfill": {
|
|
285
|
+
"run": "$effect(() => {\r\n try {\r\n fetchMenuTree && fetchMenuTree($self, { test: $deps.test })\r\n } catch (e) {}\r\n}, [$deps.test])\r\n"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"x-designable-id": "ldzb3lu81dx"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# 远程数据源
|
|
2
|
+
|
|
3
|
+
#### select 数据源
|
|
4
|
+
|
|
5
|
+
- RemoteData.jsx
|
|
6
|
+
|
|
7
|
+
```JSX
|
|
8
|
+
// RemoteData
|
|
9
|
+
import listSchema from "./list.schema.json";
|
|
10
|
+
|
|
11
|
+
const schemaScope = {
|
|
12
|
+
// 动态获取 select 数据
|
|
13
|
+
fetchSelectOptions(field, query) {
|
|
14
|
+
field.loading = true;
|
|
15
|
+
fetch(
|
|
16
|
+
`//some.domain/getSomething?test=${query.test}`
|
|
17
|
+
)
|
|
18
|
+
.then((response) => response.json())
|
|
19
|
+
.then(
|
|
20
|
+
({ data }) => {
|
|
21
|
+
// field 目标组件的 配置参数
|
|
22
|
+
console.log("fetchSelectOptions field", field);
|
|
23
|
+
// 通过 select 可直接通过 field.dataSource 进行选项数据的配置
|
|
24
|
+
field.dataSource = data;
|
|
25
|
+
field.loading = false;
|
|
26
|
+
},
|
|
27
|
+
() => {
|
|
28
|
+
field.loading = false;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
// 动态获取 treeSelect 数据
|
|
33
|
+
fetchMenuTree(field, query) {
|
|
34
|
+
field.loading = true;
|
|
35
|
+
fetch(
|
|
36
|
+
`//some.domain/getSomething?test=${query.test}`
|
|
37
|
+
)
|
|
38
|
+
.then((response) => response.json())
|
|
39
|
+
.then(
|
|
40
|
+
({ data }) => {
|
|
41
|
+
// field 目标组件的 配置参数
|
|
42
|
+
console.log("fetchMenuTree field", field);
|
|
43
|
+
// 通过 field.component[1] 可以动态配置目标组件的 props
|
|
44
|
+
console.log("fetchMenuTree field.component[1]", field.component[1]);
|
|
45
|
+
// 树选择器 数据源,需要通过 field.component[1] 进行配置
|
|
46
|
+
field.component[1].treeData = data;
|
|
47
|
+
field.loading = false;
|
|
48
|
+
},
|
|
49
|
+
() => {
|
|
50
|
+
field.loading = false;
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function RemoteData() {
|
|
57
|
+
const listDM = useMemo(
|
|
58
|
+
() =>
|
|
59
|
+
new DataModule({
|
|
60
|
+
getListApi: "/api/v1/user/list",
|
|
61
|
+
getApi: "/api/v1/user/list/:id",
|
|
62
|
+
createApi: "/api/v1/user/list",
|
|
63
|
+
updateApi: "/api/v1/user/list/:id",
|
|
64
|
+
deleteApi: "/api/v1/user/list/:id",
|
|
65
|
+
}),
|
|
66
|
+
[]
|
|
67
|
+
);
|
|
68
|
+
return (
|
|
69
|
+
<ListRender model={listDM} schema={listSchema} schemaScope={schemaScope} />
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default RemoteData;
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- list.schema.json
|
|
78
|
+
|
|
79
|
+
```JSON
|
|
80
|
+
{
|
|
81
|
+
"form": {},
|
|
82
|
+
"schema": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"properties": {
|
|
85
|
+
"parentId": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"title": "上级菜单",
|
|
88
|
+
"x-decorator": "FormItem",
|
|
89
|
+
"x-component": "TreeSelect",
|
|
90
|
+
"x-validator": [],
|
|
91
|
+
"x-component-props": {},
|
|
92
|
+
"x-decorator-props": {},
|
|
93
|
+
"x-reactions": {
|
|
94
|
+
"fulfill": {
|
|
95
|
+
"run": "try {fetchMenuTree && fetchMenuTree($self);}catch(e){}"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"name": "parentId",
|
|
99
|
+
"x-designable-id": "i012z5nbd5z",
|
|
100
|
+
"x-index": 0
|
|
101
|
+
},
|
|
102
|
+
"select": {
|
|
103
|
+
"title": "select",
|
|
104
|
+
"x-decorator": "FormItem",
|
|
105
|
+
"x-component": "Select",
|
|
106
|
+
"x-validator": [],
|
|
107
|
+
"x-component-props": {},
|
|
108
|
+
"x-decorator-props": {},
|
|
109
|
+
"name": "select",
|
|
110
|
+
"x-designable-id": "jvjf7fkpke9",
|
|
111
|
+
"x-index": 1,
|
|
112
|
+
"x-reactions": {
|
|
113
|
+
"dependencies": [],
|
|
114
|
+
"fulfill": {
|
|
115
|
+
"run": "$effect(() => {\n try {\n fetchSelectOptions && fetchSelectOptions($self);\n } catch (e) {}\n}, [])\n"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"x-designable-id": "ldzb3lu81dx"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
```
|
package/docs/table.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# 表格相关
|
|
2
|
+
|
|
3
|
+
## query 相关
|
|
4
|
+
|
|
5
|
+
#### 设置过滤项
|
|
6
|
+
|
|
7
|
+
```JSX
|
|
8
|
+
<ListRender
|
|
9
|
+
schema={schema}
|
|
10
|
+
model={listDM}
|
|
11
|
+
// 字段为 search 的 query
|
|
12
|
+
search="模糊搜索"
|
|
13
|
+
// 传入 schema 中所需表单项的 name
|
|
14
|
+
filters={["userId"]}
|
|
15
|
+
/>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
#### 开启重置按钮
|
|
19
|
+
|
|
20
|
+
```JSX
|
|
21
|
+
<ListRender
|
|
22
|
+
schema={schema}
|
|
23
|
+
model={listDM}
|
|
24
|
+
// 字段为 search 的 query
|
|
25
|
+
search="模糊搜索"
|
|
26
|
+
// 传入 schema 中所需表单项的 name
|
|
27
|
+
filters={["userId"]}
|
|
28
|
+
queryConf={{
|
|
29
|
+
hasReset: true
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 顶部操作栏(新增按钮附近)
|
|
35
|
+
|
|
36
|
+
#### 新增按钮右侧添加其他组件
|
|
37
|
+
|
|
38
|
+
- 使用 Slots 实现
|
|
39
|
+
|
|
40
|
+
```JSX
|
|
41
|
+
const Slots = {
|
|
42
|
+
headerActionSuffix() {
|
|
43
|
+
return (<div>headerActionPrefix</div>)
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
<ListRender schema={schema} model={listDM} Slots={Slots} />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## table 相关
|
|
51
|
+
|
|
52
|
+
#### 手动发起请求
|
|
53
|
+
|
|
54
|
+
```JSX
|
|
55
|
+
|
|
56
|
+
// 手动发起请求
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
// 重置 pageNum 为1,并发起请求
|
|
59
|
+
listRef.current?.onSearch();
|
|
60
|
+
// 请求当前页数据
|
|
61
|
+
listRef.current?.getList();
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
<ListRender
|
|
65
|
+
ref={listRef}
|
|
66
|
+
schema={schema}
|
|
67
|
+
model={listDM}
|
|
68
|
+
// 关闭自动发起请求
|
|
69
|
+
closeAutoRequest={false}
|
|
70
|
+
/>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### 编辑按钮左侧添加组件
|
|
74
|
+
|
|
75
|
+
```JSX
|
|
76
|
+
const Slots = {
|
|
77
|
+
actionPrefixSlot(props) {
|
|
78
|
+
const { text, record, index, onEdit, onDel } = props;
|
|
79
|
+
return (<div>actionPrefixSlot</div>)
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
<ListRender schema={schema} model={listDM} Slots={Slots} />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 新增、编辑表单相关
|
package/package.json
CHANGED
|
@@ -1,77 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hzab/list-render",
|
|
3
|
-
"version": "1.12.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
],
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@formily/
|
|
51
|
-
"@formily/react": "2.3.1",
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"react
|
|
63
|
-
"react-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"test": "vitest run --passWithNoTests",
|
|
75
|
-
"test:watch": "vitest"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@hzab/list-render",
|
|
3
|
+
"version": "1.12.4",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "src",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "webpack serve -c ./config/webpack.config.js --env local",
|
|
8
|
+
"build": "webpack -c ./config/webpack.config.js --env production",
|
|
9
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
10
|
+
"publish:alpha": "npm publish --tag alpha",
|
|
11
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
12
|
+
"publish:beta": "npm publish --tag beta",
|
|
13
|
+
"version:patch": "npm version patch",
|
|
14
|
+
"version:minior": "npm version minor",
|
|
15
|
+
"version:major": "npm version major",
|
|
16
|
+
"publish:stable": "npm publish --access public"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"src",
|
|
20
|
+
"docs",
|
|
21
|
+
"CHANGELOG.md"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"author": "CaiYansong",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@ant-design/icons": "^4.8.1",
|
|
28
|
+
"@hzab/data-model": "^1.7.4",
|
|
29
|
+
"@hzab/form-render": "^1.6.12",
|
|
30
|
+
"@hzab/formily-result-utils": "^1.2.0",
|
|
31
|
+
"@hzab/permissions": "^1.0.0",
|
|
32
|
+
"@hzab/schema-descriptions": "^1.3.0",
|
|
33
|
+
"@hzab/utils": "^1.0.7",
|
|
34
|
+
"@hzab/webpack-config": "^0.7.2",
|
|
35
|
+
"@types/react": "^17.0.62",
|
|
36
|
+
"@types/react-dom": "^17.0.20",
|
|
37
|
+
"antd": "^4.24.12",
|
|
38
|
+
"axios": "^1.4.0",
|
|
39
|
+
"eslint": "^8.30.0",
|
|
40
|
+
"less": "^4.1.3",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
42
|
+
"mobx": "^6.7.0",
|
|
43
|
+
"mobx-react": "^7.6.0",
|
|
44
|
+
"react": "^17.0.2",
|
|
45
|
+
"react-dom": "^17.0.2",
|
|
46
|
+
"react-router-dom": "^6.8.1",
|
|
47
|
+
"typescript": "^4.9.4"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@formily/core": "2.3.1",
|
|
51
|
+
"@formily/react": "2.3.1",
|
|
52
|
+
"@formily/reactive-react": "2.3.1",
|
|
53
|
+
"@hzab/data-model": ">=1.7.4",
|
|
54
|
+
"@hzab/form-render": ">=1.0.0",
|
|
55
|
+
"@hzab/formily-result-utils": ">=1.2.0",
|
|
56
|
+
"@hzab/schema-descriptions": ">=1.0.0",
|
|
57
|
+
"@hzab/utils": ">=1.0.7",
|
|
58
|
+
"antd": "4.x",
|
|
59
|
+
"axios": ">=1.4.0",
|
|
60
|
+
"c-formily-antd": "2.3.1",
|
|
61
|
+
"lodash": ">=4.17.21",
|
|
62
|
+
"react": ">=16.8.0",
|
|
63
|
+
"react-dom": ">=16.8.0",
|
|
64
|
+
"@hzab/edit-table": ">=0.1.2"
|
|
65
|
+
},
|
|
66
|
+
"directories": {
|
|
67
|
+
"lib": "lib"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"array-move": "^4.0.0",
|
|
71
|
+
"react-sortable-hoc": "^2.0.0"
|
|
72
|
+
}
|
|
73
|
+
}
|
package/src/FilterTag/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
import { Tag } from "antd";
|
|
4
|
-
import { getVal } from "@hzab/
|
|
4
|
+
import { getVal } from "@hzab/list-render/src/common/utils";
|
|
5
5
|
function hasValue(val) {
|
|
6
6
|
return val !== null && val !== undefined;
|
|
7
7
|
}
|
|
@@ -12,12 +12,13 @@ const FilterTag = (props: any) => {
|
|
|
12
12
|
if (queryRef) {
|
|
13
13
|
const list = [];
|
|
14
14
|
const fieldSchemas = queryRef.current?.formRef?.current?.formRender?.fields;
|
|
15
|
-
for (
|
|
15
|
+
for (let key in schema?.schema?.properties) {
|
|
16
16
|
const field = schema?.schema?.properties[key];
|
|
17
17
|
if (hasValue(searchQuery[key])) {
|
|
18
|
-
|
|
18
|
+
let val = getVal({ ...field, ...fieldSchemas[field?.name] }, searchQuery, {
|
|
19
19
|
fieldSchema: fieldSchemas?.[field?.name],
|
|
20
20
|
});
|
|
21
|
+
|
|
21
22
|
list.push({
|
|
22
23
|
label: field?.title,
|
|
23
24
|
value: val,
|
|
@@ -26,7 +27,7 @@ const FilterTag = (props: any) => {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
setWorldList(list);
|
|
30
|
+
setWorldList(list?.filter((el) => el?.value));
|
|
30
31
|
}
|
|
31
32
|
}, [searchQuery, schema, queryRef]);
|
|
32
33
|
const onClose = (e, item) => {
|