@fe-free/core 5.0.0 → 6.0.2
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 +391 -5
- package/package.json +5 -3
- package/src/copy/index.tsx +10 -5
- package/src/crud/crud.stories.tsx +13 -1
- package/src/crud/crud.tsx +5 -2
- package/src/crud/helper.tsx +10 -5
- package/src/crud/style.scss +27 -0
- package/src/crud/table/index.tsx +7 -2
- package/src/crud/table/style.scss +10 -21
- package/src/crud/use_operate.tsx +1 -1
- package/src/crud_of_list/crud_of_list.stories.tsx +42 -0
- package/src/crud_of_list/index.tsx +2 -1
- package/src/crud_of_list/style.scss +27 -0
- package/src/crud_of_pure/crud_of_pure.stories.tsx +7 -1
- package/src/crud_of_pure/index.tsx +52 -2
- package/src/crud_of_pure/style.scss +4 -0
- package/src/editor/editor.stories.tsx +8 -0
- package/src/editor/index.tsx +7 -3
- package/src/form/form_list/form_list_modal_helper.tsx +1 -0
- package/src/index.ts +4 -1
- package/src/infinite_list/index.tsx +5 -2
- package/src/markdown/chart.tsx +3 -3
- package/src/markdown/code.tsx +19 -32
- package/src/markdown/custom_markdown.stories.tsx +485 -0
- package/src/markdown/hm_chart.tsx +1 -1
- package/src/markdown/index.tsx +93 -34
- package/src/markdown/knowledge_ref.tsx +5 -5
- package/src/markdown/markdown.stories.tsx +68 -410
- package/src/markdown/messages/message_think.tsx +69 -0
- package/src/markdown/messages/svgs/think.svg +3 -0
- package/src/markdown/think.tsx +55 -0
- package/src/page_layout/index.tsx +12 -0
- package/src/scroll/helper.tsx +23 -0
- package/src/scroll/index.tsx +70 -0
- package/src/style.scss +0 -30
- package/src/tailwind.css +54 -0
- package/src/theme.ts +1 -1
- package/src/upload/index.tsx +32 -30
- package/src/value_type_map/index.tsx +7 -0
- package/src/value_type_map/json_modal.tsx +17 -15
- package/src/value_type_map/markdown_modal.tsx +45 -0
- package/src/value_type_map/value_type_map.stories.tsx +8 -0
- package/src/markdown/deep_seek.tsx +0 -53
- package/src/markdown/style.scss +0 -46
- package/src/tailwind.config.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,401 @@
|
|
|
1
1
|
# @fe-free/core
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 6.0.2
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- fix: crud ui
|
|
8
|
+
- @fe-free/icons@6.0.2
|
|
9
|
+
- @fe-free/tool@6.0.2
|
|
10
|
+
|
|
11
|
+
## 6.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- feat: tailwindcss4
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @fe-free/icons@6.0.1
|
|
18
|
+
- @fe-free/tool@6.0.1
|
|
19
|
+
|
|
20
|
+
## 4.2.4
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @fe-free/icons@4.2.4
|
|
25
|
+
- @fe-free/tool@4.2.4
|
|
26
|
+
|
|
27
|
+
## 4.2.3
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- feat: ui
|
|
32
|
+
- @fe-free/icons@4.2.3
|
|
33
|
+
- @fe-free/tool@4.2.3
|
|
34
|
+
|
|
35
|
+
## 4.2.2
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- @fe-free/icons@4.2.2
|
|
40
|
+
- @fe-free/tool@4.2.2
|
|
41
|
+
|
|
42
|
+
## 4.2.1
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- @fe-free/icons@4.2.1
|
|
47
|
+
- @fe-free/tool@4.2.1
|
|
48
|
+
|
|
49
|
+
## 4.2.0
|
|
50
|
+
|
|
51
|
+
### minor Changes
|
|
52
|
+
|
|
53
|
+
- fix: crud bug
|
|
54
|
+
- @fe-free/icons@4.2.0
|
|
55
|
+
- @fe-free/tool@4.2.0
|
|
56
|
+
|
|
57
|
+
## 4.1.47
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- @fe-free/icons@4.1.47
|
|
62
|
+
- @fe-free/tool@4.1.47
|
|
63
|
+
|
|
64
|
+
## 4.1.46
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- feat: crud ui
|
|
69
|
+
- @fe-free/icons@4.1.46
|
|
70
|
+
- @fe-free/tool@4.1.46
|
|
71
|
+
|
|
72
|
+
## 4.1.45
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- feat: curd table ui
|
|
77
|
+
- @fe-free/icons@4.1.45
|
|
78
|
+
- @fe-free/tool@4.1.45
|
|
79
|
+
|
|
80
|
+
## 4.1.44
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- feat: crud of list
|
|
85
|
+
- @fe-free/icons@4.1.44
|
|
86
|
+
- @fe-free/tool@4.1.44
|
|
87
|
+
|
|
88
|
+
## 4.1.43
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- fix: valueType
|
|
93
|
+
- @fe-free/icons@4.1.43
|
|
94
|
+
- @fe-free/tool@4.1.43
|
|
95
|
+
|
|
96
|
+
## 4.1.42
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- feat: add valueType CustomMarkdownModal
|
|
101
|
+
- @fe-free/icons@4.1.42
|
|
102
|
+
- @fe-free/tool@4.1.42
|
|
103
|
+
|
|
104
|
+
## 4.1.41
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- feat: some
|
|
109
|
+
- @fe-free/icons@4.1.41
|
|
110
|
+
- @fe-free/tool@4.1.41
|
|
111
|
+
|
|
112
|
+
## 4.1.40
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- fix: ScrollFixed
|
|
117
|
+
- @fe-free/icons@4.1.40
|
|
118
|
+
- @fe-free/tool@4.1.40
|
|
119
|
+
|
|
120
|
+
## 4.1.39
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- fix: ai
|
|
125
|
+
- @fe-free/icons@4.1.39
|
|
126
|
+
- @fe-free/tool@4.1.39
|
|
127
|
+
|
|
128
|
+
## 4.1.38
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- feat: ai
|
|
133
|
+
- @fe-free/icons@4.1.38
|
|
134
|
+
- @fe-free/tool@4.1.38
|
|
135
|
+
|
|
136
|
+
## 4.1.37
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- @fe-free/icons@4.1.37
|
|
141
|
+
- @fe-free/tool@4.1.37
|
|
142
|
+
|
|
143
|
+
## 4.1.36
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- @fe-free/icons@4.1.36
|
|
148
|
+
- @fe-free/tool@4.1.36
|
|
149
|
+
|
|
150
|
+
## 4.1.35
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- @fe-free/icons@4.1.35
|
|
155
|
+
- @fe-free/tool@4.1.35
|
|
156
|
+
|
|
157
|
+
## 4.1.34
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- @fe-free/icons@4.1.34
|
|
162
|
+
- @fe-free/tool@4.1.34
|
|
163
|
+
|
|
164
|
+
## 4.1.33
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- @fe-free/icons@4.1.33
|
|
169
|
+
- @fe-free/tool@4.1.33
|
|
170
|
+
|
|
171
|
+
## 4.1.32
|
|
172
|
+
|
|
173
|
+
### Patch Changes
|
|
174
|
+
|
|
175
|
+
- @fe-free/icons@4.1.32
|
|
176
|
+
- @fe-free/tool@4.1.32
|
|
177
|
+
|
|
178
|
+
## 4.1.31
|
|
179
|
+
|
|
180
|
+
### Patch Changes
|
|
181
|
+
|
|
182
|
+
- @fe-free/icons@4.1.31
|
|
183
|
+
- @fe-free/tool@4.1.31
|
|
184
|
+
|
|
185
|
+
## 4.1.30
|
|
186
|
+
|
|
187
|
+
### Patch Changes
|
|
188
|
+
|
|
189
|
+
- @fe-free/icons@4.1.30
|
|
190
|
+
- @fe-free/tool@4.1.30
|
|
191
|
+
|
|
192
|
+
## 4.1.29
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- @fe-free/icons@4.1.29
|
|
197
|
+
- @fe-free/tool@4.1.29
|
|
198
|
+
|
|
199
|
+
## 4.1.28
|
|
200
|
+
|
|
201
|
+
### Patch Changes
|
|
202
|
+
|
|
203
|
+
- @fe-free/icons@4.1.28
|
|
204
|
+
- @fe-free/tool@4.1.28
|
|
205
|
+
|
|
206
|
+
## 4.1.27
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- @fe-free/icons@4.1.27
|
|
211
|
+
- @fe-free/tool@4.1.27
|
|
212
|
+
|
|
213
|
+
## 4.1.26
|
|
214
|
+
|
|
215
|
+
### Patch Changes
|
|
216
|
+
|
|
217
|
+
- @fe-free/icons@4.1.26
|
|
218
|
+
- @fe-free/tool@4.1.26
|
|
219
|
+
|
|
220
|
+
## 4.1.25
|
|
221
|
+
|
|
222
|
+
### Patch Changes
|
|
223
|
+
|
|
224
|
+
- @fe-free/icons@4.1.25
|
|
225
|
+
- @fe-free/tool@4.1.25
|
|
226
|
+
|
|
227
|
+
## 4.1.24
|
|
228
|
+
|
|
229
|
+
### Patch Changes
|
|
230
|
+
|
|
231
|
+
- @fe-free/icons@4.1.24
|
|
232
|
+
- @fe-free/tool@4.1.24
|
|
233
|
+
|
|
234
|
+
## 4.1.23
|
|
235
|
+
|
|
236
|
+
### Patch Changes
|
|
237
|
+
|
|
238
|
+
- @fe-free/icons@4.1.23
|
|
239
|
+
- @fe-free/tool@4.1.23
|
|
240
|
+
|
|
241
|
+
## 4.1.22
|
|
242
|
+
|
|
243
|
+
### Patch Changes
|
|
244
|
+
|
|
245
|
+
- @fe-free/icons@4.1.22
|
|
246
|
+
- @fe-free/tool@4.1.22
|
|
247
|
+
|
|
248
|
+
## 4.1.21
|
|
249
|
+
|
|
250
|
+
### Patch Changes
|
|
251
|
+
|
|
252
|
+
- @fe-free/icons@4.1.21
|
|
253
|
+
- @fe-free/tool@4.1.21
|
|
254
|
+
|
|
255
|
+
## 4.1.20
|
|
256
|
+
|
|
257
|
+
### Patch Changes
|
|
258
|
+
|
|
259
|
+
- @fe-free/icons@4.1.20
|
|
260
|
+
- @fe-free/tool@4.1.20
|
|
261
|
+
|
|
262
|
+
## 4.1.19
|
|
263
|
+
|
|
264
|
+
### Patch Changes
|
|
265
|
+
|
|
266
|
+
- @fe-free/icons@4.1.19
|
|
267
|
+
- @fe-free/tool@4.1.19
|
|
268
|
+
|
|
269
|
+
## 4.1.18
|
|
270
|
+
|
|
271
|
+
### Patch Changes
|
|
272
|
+
|
|
273
|
+
- @fe-free/icons@4.1.18
|
|
274
|
+
- @fe-free/tool@4.1.18
|
|
275
|
+
|
|
276
|
+
## 4.1.17
|
|
277
|
+
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- @fe-free/icons@4.1.17
|
|
281
|
+
- @fe-free/tool@4.1.17
|
|
282
|
+
|
|
283
|
+
## 4.1.16
|
|
284
|
+
|
|
285
|
+
### Patch Changes
|
|
286
|
+
|
|
287
|
+
- @fe-free/icons@4.1.16
|
|
288
|
+
- @fe-free/tool@4.1.16
|
|
289
|
+
|
|
290
|
+
## 4.1.15
|
|
291
|
+
|
|
292
|
+
### Patch Changes
|
|
293
|
+
|
|
294
|
+
- @fe-free/icons@4.1.15
|
|
295
|
+
- @fe-free/tool@4.1.15
|
|
296
|
+
|
|
297
|
+
## 4.1.14
|
|
8
298
|
|
|
9
299
|
### Patch Changes
|
|
10
300
|
|
|
11
|
-
- @fe-free/icons@
|
|
12
|
-
- @fe-free/tool@
|
|
301
|
+
- @fe-free/icons@4.1.14
|
|
302
|
+
- @fe-free/tool@4.1.14
|
|
303
|
+
|
|
304
|
+
## 4.1.13
|
|
305
|
+
|
|
306
|
+
### Patch Changes
|
|
307
|
+
|
|
308
|
+
- @fe-free/icons@4.1.13
|
|
309
|
+
- @fe-free/tool@4.1.13
|
|
310
|
+
|
|
311
|
+
## 4.1.12
|
|
312
|
+
|
|
313
|
+
### Patch Changes
|
|
314
|
+
|
|
315
|
+
- @fe-free/icons@4.1.12
|
|
316
|
+
- @fe-free/tool@4.1.12
|
|
317
|
+
|
|
318
|
+
## 4.1.11
|
|
319
|
+
|
|
320
|
+
### Patch Changes
|
|
321
|
+
|
|
322
|
+
- @fe-free/icons@4.1.11
|
|
323
|
+
- @fe-free/tool@4.1.11
|
|
324
|
+
|
|
325
|
+
## 4.1.10
|
|
326
|
+
|
|
327
|
+
### Patch Changes
|
|
328
|
+
|
|
329
|
+
- feat: ai
|
|
330
|
+
- @fe-free/icons@4.1.10
|
|
331
|
+
- @fe-free/tool@4.1.10
|
|
332
|
+
|
|
333
|
+
## 4.1.9
|
|
334
|
+
|
|
335
|
+
### Patch Changes
|
|
336
|
+
|
|
337
|
+
- @fe-free/icons@4.1.9
|
|
338
|
+
- @fe-free/tool@4.1.9
|
|
339
|
+
|
|
340
|
+
## 4.1.8
|
|
341
|
+
|
|
342
|
+
### Patch Changes
|
|
343
|
+
|
|
344
|
+
- @fe-free/icons@4.1.8
|
|
345
|
+
- @fe-free/tool@4.1.8
|
|
346
|
+
|
|
347
|
+
## 4.1.7
|
|
348
|
+
|
|
349
|
+
### Patch Changes
|
|
350
|
+
|
|
351
|
+
- @fe-free/icons@4.1.7
|
|
352
|
+
- @fe-free/tool@4.1.7
|
|
353
|
+
|
|
354
|
+
## 4.1.6
|
|
355
|
+
|
|
356
|
+
### Patch Changes
|
|
357
|
+
|
|
358
|
+
- @fe-free/icons@4.1.6
|
|
359
|
+
- @fe-free/tool@4.1.6
|
|
360
|
+
|
|
361
|
+
## 4.1.5
|
|
362
|
+
|
|
363
|
+
### Patch Changes
|
|
364
|
+
|
|
365
|
+
- @fe-free/icons@4.1.5
|
|
366
|
+
- @fe-free/tool@4.1.5
|
|
367
|
+
|
|
368
|
+
## 4.1.4
|
|
369
|
+
|
|
370
|
+
### Patch Changes
|
|
371
|
+
|
|
372
|
+
- feat: editor
|
|
373
|
+
- @fe-free/icons@4.1.4
|
|
374
|
+
- @fe-free/tool@4.1.4
|
|
375
|
+
|
|
376
|
+
## 4.1.3
|
|
377
|
+
|
|
378
|
+
### Patch Changes
|
|
379
|
+
|
|
380
|
+
- fix some
|
|
381
|
+
- @fe-free/icons@4.1.3
|
|
382
|
+
- @fe-free/tool@4.1.3
|
|
383
|
+
|
|
384
|
+
## 4.1.2
|
|
385
|
+
|
|
386
|
+
### Patch Changes
|
|
387
|
+
|
|
388
|
+
- fix some
|
|
389
|
+
- @fe-free/icons@4.1.2
|
|
390
|
+
- @fe-free/tool@4.1.2
|
|
391
|
+
|
|
392
|
+
## 4.1.1
|
|
393
|
+
|
|
394
|
+
### Patch Changes
|
|
395
|
+
|
|
396
|
+
- Updated dependencies
|
|
397
|
+
- @fe-free/icons@4.1.1
|
|
398
|
+
- @fe-free/tool@4.1.1
|
|
13
399
|
|
|
14
400
|
## 4.0.5
|
|
15
401
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@ant-design/x-markdown": "^2.1.3",
|
|
14
|
+
"@ant-design/x": "^2.1.3",
|
|
13
15
|
"@codemirror/lang-html": "^6.4.9",
|
|
14
16
|
"@codemirror/lang-javascript": "^6.2.4",
|
|
15
17
|
"@codemirror/lang-json": "^6.0.1",
|
|
@@ -50,8 +52,8 @@
|
|
|
50
52
|
"i18next-icu": "^2.4.1",
|
|
51
53
|
"react": "^19.2.0",
|
|
52
54
|
"react-i18next": "^16.4.0",
|
|
53
|
-
"@fe-free/icons": "
|
|
54
|
-
"@fe-free/tool": "
|
|
55
|
+
"@fe-free/icons": "6.0.2",
|
|
56
|
+
"@fe-free/tool": "6.0.2"
|
|
55
57
|
},
|
|
56
58
|
"scripts": {
|
|
57
59
|
"i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
|
package/src/copy/index.tsx
CHANGED
|
@@ -13,10 +13,11 @@ interface CopyProps {
|
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
/** 复制成功后的回调 */
|
|
15
15
|
onCopied?: () => void;
|
|
16
|
+
className?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function Copy(props: CopyProps) {
|
|
19
|
-
const { value, showIcon, hoverIcon, children, onCopied } = props;
|
|
20
|
+
const { value, showIcon, hoverIcon, children, onCopied, className } = props;
|
|
20
21
|
|
|
21
22
|
const handleCopy = useCallback(async () => {
|
|
22
23
|
await copyToClipboard(value);
|
|
@@ -26,13 +27,17 @@ function Copy(props: CopyProps) {
|
|
|
26
27
|
if (showIcon || hoverIcon) {
|
|
27
28
|
return (
|
|
28
29
|
<div
|
|
29
|
-
className={classNames(
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
className={classNames(
|
|
31
|
+
'flex gap-1',
|
|
32
|
+
{
|
|
33
|
+
group: hoverIcon,
|
|
34
|
+
},
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
32
37
|
>
|
|
33
38
|
{children}
|
|
34
39
|
<div
|
|
35
|
-
className={classNames('cursor-pointer
|
|
40
|
+
className={classNames('cursor-pointer', {
|
|
36
41
|
hidden: hoverIcon,
|
|
37
42
|
'group-hover:block': hoverIcon,
|
|
38
43
|
})}
|
|
@@ -60,6 +60,7 @@ export const Normal: Story = {
|
|
|
60
60
|
<CRUD
|
|
61
61
|
actions={['create', 'read', 'delete', 'update']}
|
|
62
62
|
tableProps={{
|
|
63
|
+
rowKey: 'id',
|
|
63
64
|
columns,
|
|
64
65
|
request: fakeRequest,
|
|
65
66
|
}}
|
|
@@ -105,6 +106,7 @@ export const ReadDetail: Story = {
|
|
|
105
106
|
<CRUD
|
|
106
107
|
actions={['read_detail']}
|
|
107
108
|
tableProps={{
|
|
109
|
+
rowKey: 'id',
|
|
108
110
|
columns,
|
|
109
111
|
request: fakeRequest,
|
|
110
112
|
}}
|
|
@@ -119,6 +121,7 @@ export const BatchDelete: Story = {
|
|
|
119
121
|
<CRUD
|
|
120
122
|
actions={['batch_delete']}
|
|
121
123
|
tableProps={{
|
|
124
|
+
rowKey: 'id',
|
|
122
125
|
columns: [
|
|
123
126
|
{
|
|
124
127
|
title: 'id',
|
|
@@ -169,6 +172,7 @@ export const MoreCustom: Story = {
|
|
|
169
172
|
<CRUD
|
|
170
173
|
actions={['create', 'read', 'delete', 'update']}
|
|
171
174
|
tableProps={{
|
|
175
|
+
rowKey: 'id',
|
|
172
176
|
columns,
|
|
173
177
|
request: fakeRequest,
|
|
174
178
|
toolBarRender: () => {
|
|
@@ -250,7 +254,7 @@ export const MoreCustom: Story = {
|
|
|
250
254
|
|
|
251
255
|
// 表格表单和详情表单 ref
|
|
252
256
|
const FormRefComponent = () => {
|
|
253
|
-
const formRef = useRef<any>();
|
|
257
|
+
const formRef = useRef<any>(null);
|
|
254
258
|
const [detailFormInstance] = ProForm.useForm();
|
|
255
259
|
|
|
256
260
|
const columns = [
|
|
@@ -270,6 +274,7 @@ const FormRefComponent = () => {
|
|
|
270
274
|
<CRUD
|
|
271
275
|
actions={['create', 'read', 'update']}
|
|
272
276
|
tableProps={{
|
|
277
|
+
rowKey: 'id',
|
|
273
278
|
formRef,
|
|
274
279
|
columns,
|
|
275
280
|
request: fakeRequest,
|
|
@@ -322,6 +327,7 @@ const ActionRefComponent = () => {
|
|
|
322
327
|
ref={ref}
|
|
323
328
|
actions={[]}
|
|
324
329
|
tableProps={{
|
|
330
|
+
rowKey: 'id',
|
|
325
331
|
columns,
|
|
326
332
|
request: fakeRequest,
|
|
327
333
|
}}
|
|
@@ -396,6 +402,7 @@ export const RemoteData: Story = {
|
|
|
396
402
|
<CRUD
|
|
397
403
|
actions={[]}
|
|
398
404
|
tableProps={{
|
|
405
|
+
rowKey: 'id',
|
|
399
406
|
columns,
|
|
400
407
|
request: fakeRequest,
|
|
401
408
|
}}
|
|
@@ -422,6 +429,7 @@ export const NoSearch: Story = {
|
|
|
422
429
|
<CRUD
|
|
423
430
|
actions={[]}
|
|
424
431
|
tableProps={{
|
|
432
|
+
rowKey: 'id',
|
|
425
433
|
columns,
|
|
426
434
|
request: fakeRequest,
|
|
427
435
|
search: false,
|
|
@@ -451,6 +459,7 @@ export const CustomText: Story = {
|
|
|
451
459
|
<CRUD
|
|
452
460
|
actions={['create', 'read', 'delete', 'update']}
|
|
453
461
|
tableProps={{
|
|
462
|
+
rowKey: 'id',
|
|
454
463
|
columns,
|
|
455
464
|
request: fakeRequest,
|
|
456
465
|
}}
|
|
@@ -495,6 +504,7 @@ export const RowSelection: Story = {
|
|
|
495
504
|
<CRUD
|
|
496
505
|
actions={[]}
|
|
497
506
|
tableProps={{
|
|
507
|
+
rowKey: 'id',
|
|
498
508
|
columns: [
|
|
499
509
|
{
|
|
500
510
|
title: 'id',
|
|
@@ -552,6 +562,7 @@ export const ExpandedRowRender: Story = {
|
|
|
552
562
|
<CRUD
|
|
553
563
|
actions={['create', 'read', 'delete', 'update']}
|
|
554
564
|
tableProps={{
|
|
565
|
+
rowKey: 'id',
|
|
555
566
|
columns,
|
|
556
567
|
request: fakeRequest,
|
|
557
568
|
defaultExpandAllRows: true,
|
|
@@ -614,6 +625,7 @@ export const FullPage: Story = {
|
|
|
614
625
|
fullPage
|
|
615
626
|
actions={['create', 'read', 'delete', 'update']}
|
|
616
627
|
tableProps={{
|
|
628
|
+
rowKey: 'id',
|
|
617
629
|
columns,
|
|
618
630
|
request: fakeRequest,
|
|
619
631
|
}}
|
package/src/crud/crud.tsx
CHANGED
|
@@ -129,6 +129,7 @@ function CRUD<DataSource extends Record<string, any> = any, Key extends string |
|
|
|
129
129
|
if (fullPage) {
|
|
130
130
|
return {
|
|
131
131
|
...tableProps,
|
|
132
|
+
rowKey: tableProps.rowKey || 'id',
|
|
132
133
|
scroll: {
|
|
133
134
|
...getTableScroll(newColumns),
|
|
134
135
|
y: '100%',
|
|
@@ -136,7 +137,10 @@ function CRUD<DataSource extends Record<string, any> = any, Key extends string |
|
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
return
|
|
140
|
+
return {
|
|
141
|
+
...tableProps,
|
|
142
|
+
rowKey: tableProps.rowKey || 'id',
|
|
143
|
+
};
|
|
140
144
|
}, [fullPage, tableProps, newColumns]);
|
|
141
145
|
|
|
142
146
|
return (
|
|
@@ -150,7 +154,6 @@ function CRUD<DataSource extends Record<string, any> = any, Key extends string |
|
|
|
150
154
|
)}
|
|
151
155
|
>
|
|
152
156
|
<Table<DataSource>
|
|
153
|
-
rowKey="id"
|
|
154
157
|
{...newTableProps}
|
|
155
158
|
actionRef={actionRef}
|
|
156
159
|
toolBarRender={toolBarRender}
|
package/src/crud/helper.tsx
CHANGED
|
@@ -15,11 +15,13 @@ function OperateBtn({
|
|
|
15
15
|
}) {
|
|
16
16
|
if (disabled) {
|
|
17
17
|
if (operateText) {
|
|
18
|
-
return <span className="cursor-not-allowed text-
|
|
18
|
+
return <span className="fec-crud-operate-btn cursor-not-allowed text-03">{operateText}</span>;
|
|
19
19
|
} else {
|
|
20
20
|
return (
|
|
21
21
|
<Tooltip title={title}>
|
|
22
|
-
<span className="cursor-not-allowed text-lg text-03">
|
|
22
|
+
<span className="fec-crud-operate-btn fec-crud-operate-btn-icon cursor-not-allowed text-lg text-03">
|
|
23
|
+
{icon}
|
|
24
|
+
</span>
|
|
23
25
|
</Tooltip>
|
|
24
26
|
);
|
|
25
27
|
}
|
|
@@ -27,7 +29,7 @@ function OperateBtn({
|
|
|
27
29
|
|
|
28
30
|
if (operateText) {
|
|
29
31
|
return (
|
|
30
|
-
<span className="cursor-pointer text-
|
|
32
|
+
<span className="fec-crud-operate-btn cursor-pointer text-primary" onClick={onClick}>
|
|
31
33
|
{operateText}
|
|
32
34
|
</span>
|
|
33
35
|
);
|
|
@@ -35,8 +37,11 @@ function OperateBtn({
|
|
|
35
37
|
|
|
36
38
|
return (
|
|
37
39
|
<Tooltip title={title}>
|
|
38
|
-
<span
|
|
39
|
-
|
|
40
|
+
<span
|
|
41
|
+
className="fec-crud-operate-btn fec-crud-operate-btn-icon cursor-pointer text-lg text-primary"
|
|
42
|
+
onClick={onClick}
|
|
43
|
+
>
|
|
44
|
+
{icon}
|
|
40
45
|
</span>
|
|
41
46
|
</Tooltip>
|
|
42
47
|
);
|
package/src/crud/style.scss
CHANGED
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.fec-crud {
|
|
13
|
+
// 只有 icon 才设置大小
|
|
14
|
+
.fec-crud-operate-btn.fec-crud-operate-btn-icon {
|
|
15
|
+
font-size: 20px;
|
|
16
|
+
line-height: 22px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
.fec-crud.fec-crud-full-page {
|
|
13
21
|
height: 100%;
|
|
14
22
|
display: flex;
|
|
@@ -67,6 +75,25 @@
|
|
|
67
75
|
scrollbar-width: thin;
|
|
68
76
|
}
|
|
69
77
|
}
|
|
78
|
+
|
|
79
|
+
&.ant-table-bordered {
|
|
80
|
+
.ant-table-container {
|
|
81
|
+
border-inline-start: none !important;
|
|
82
|
+
border-bottom: 1px solid var(--ant-table-border-color) !important;
|
|
83
|
+
|
|
84
|
+
.ant-table-thead {
|
|
85
|
+
& > tr > th:first-child {
|
|
86
|
+
border-inline-start: 1px solid var(--ant-table-border-color) !important;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ant-table-row {
|
|
91
|
+
& > td:first-child {
|
|
92
|
+
border-inline-start: 1px solid var(--ant-table-border-color) !important;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
70
97
|
}
|
|
71
98
|
}
|
|
72
99
|
}
|
package/src/crud/table/index.tsx
CHANGED
|
@@ -4,8 +4,13 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import './style.scss';
|
|
6
6
|
|
|
7
|
-
interface TableProps<DataSource = any, Params = any, ValueType = 'text'>
|
|
8
|
-
|
|
7
|
+
interface TableProps<DataSource = any, Params = any, ValueType = 'text'> extends ProTableProps<
|
|
8
|
+
DataSource,
|
|
9
|
+
Params,
|
|
10
|
+
ValueType
|
|
11
|
+
> {
|
|
12
|
+
// 要求 rowKey 必须存在
|
|
13
|
+
rowKey: string;
|
|
9
14
|
/** 区别 ProTable columns,默认 search: false */
|
|
10
15
|
columns?: ProTableProps<DataSource, Params, ValueType>['columns'];
|
|
11
16
|
}
|