@fe-free/core 6.0.4 → 6.0.5

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 6.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: crud ui
8
+ - @fe-free/icons@6.0.5
9
+ - @fe-free/tool@6.0.5
10
+
3
11
  ## 6.0.4
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "6.0.4",
3
+ "version": "6.0.5",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -52,8 +52,8 @@
52
52
  "i18next-icu": "^2.4.1",
53
53
  "react": "^19.2.0",
54
54
  "react-i18next": "^16.4.0",
55
- "@fe-free/tool": "6.0.4",
56
- "@fe-free/icons": "6.0.4"
55
+ "@fe-free/tool": "6.0.5",
56
+ "@fe-free/icons": "6.0.5"
57
57
  },
58
58
  "scripts": {
59
59
  "i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
@@ -262,6 +262,61 @@ export const SpecialToolbar: Story = {
262
262
  },
263
263
  };
264
264
 
265
+ export const SpecialToolbarEmpty: Story = {
266
+ render: () => {
267
+ const columns = [
268
+ {
269
+ title: 'id',
270
+ dataIndex: 'id',
271
+ search: true,
272
+ },
273
+ {
274
+ title: '名字(省略)',
275
+ dataIndex: 'name',
276
+ search: true,
277
+ ellipsis: true,
278
+ },
279
+ {
280
+ title: 'city',
281
+ dataIndex: 'city',
282
+ },
283
+ {
284
+ title: 'area',
285
+ dataIndex: 'area',
286
+ },
287
+ ];
288
+
289
+ return (
290
+ <CRUDOfPure
291
+ specialToolbar="empty"
292
+ actions={['delete']}
293
+ tableProps={{
294
+ rowKey: 'id',
295
+ columns,
296
+ request: fakeRequest,
297
+ pagination: false,
298
+ }}
299
+ requestDeleteByRecord={fakeDeleteByRecord}
300
+ deleteProps={{
301
+ nameIndex: 'id',
302
+ }}
303
+ detailForm={() => (
304
+ <>
305
+ <ProFormText
306
+ name="name"
307
+ label="名字"
308
+ required
309
+ rules={[{ required: true }]}
310
+ extra="extra extra extra extra"
311
+ />
312
+ </>
313
+ )}
314
+ requestCreateByValues={fakeCreate}
315
+ />
316
+ );
317
+ },
318
+ };
319
+
265
320
  export const SpecialToolbarWithToolBarRender: Story = {
266
321
  render: () => {
267
322
  const columns = [
@@ -10,11 +10,20 @@ interface CRUDOfPureProps<
10
10
  DataSource extends Record<string, any> = any,
11
11
  Key extends string | number = string,
12
12
  > extends CRUDProps<DataSource, Key> {
13
- /** 特殊位置的 toolbar,向上 margin,是的 search 和 toolbar 一起。仅适用于 search 很少的情况。 */
14
- specialToolbar?: boolean;
13
+ /**
14
+ * 特殊位置的 toolbar,margin 为 -48px,使得 search 和 toolbar 一起。
15
+ * empty 表示toolbar 为空的情况,margin 为 -16px。
16
+ * */
17
+ specialToolbar?: boolean | 'empty';
15
18
  }
16
19
 
17
- function useSpecialToolbar({ specialToolbar, id }: { specialToolbar?: boolean; id: string }) {
20
+ function useSpecialToolbar({
21
+ specialToolbar,
22
+ id,
23
+ }: {
24
+ specialToolbar?: boolean | 'empty';
25
+ id: string;
26
+ }) {
18
27
  useEffect(() => {
19
28
  if (!specialToolbar) return;
20
29
 
@@ -107,6 +116,7 @@ function CRUDOfPure<
107
116
  {
108
117
  'fec-crud-of-pure-no-search': noSearch,
109
118
  'fec-crud-of-pure-special-toolbar': props.specialToolbar,
119
+ 'fec-crud-of-pure-special-toolbar-empty': props.specialToolbar === 'empty',
110
120
  },
111
121
  props.className,
112
122
  )}
@@ -77,5 +77,11 @@
77
77
  pointer-events: auto;
78
78
  }
79
79
  }
80
+
81
+ &.fec-crud-of-pure-special-toolbar-empty {
82
+ .ant-pro-card:not(.ant-pro-table-search) {
83
+ margin-top: -16px;
84
+ }
85
+ }
80
86
  }
81
87
  }