@fe-free/core 6.0.4 → 6.0.6

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,21 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 6.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: mobile scrollbar
8
+ - @fe-free/icons@6.0.6
9
+ - @fe-free/tool@6.0.6
10
+
11
+ ## 6.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - feat: crud ui
16
+ - @fe-free/icons@6.0.5
17
+ - @fe-free/tool@6.0.5
18
+
3
19
  ## 6.0.4
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "6.0.4",
3
+ "version": "6.0.6",
4
4
  "description": "",
5
- "main": "./src/index.ts",
6
- "author": "",
7
5
  "license": "ISC",
6
+ "author": "",
7
+ "main": "./src/index.ts",
8
8
  "publishConfig": {
9
9
  "access": "public",
10
10
  "registry": "https://registry.npmjs.org/"
11
11
  },
12
12
  "dependencies": {
13
- "@ant-design/x-markdown": "^2.1.3",
14
13
  "@ant-design/x": "^2.1.3",
14
+ "@ant-design/x-markdown": "^2.1.3",
15
15
  "@codemirror/lang-html": "^6.4.9",
16
16
  "@codemirror/lang-javascript": "^6.2.4",
17
17
  "@codemirror/lang-json": "^6.0.1",
@@ -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/icons": "6.0.6",
56
+ "@fe-free/tool": "6.0.6"
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
  }
@@ -1,6 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import { Fragment, useMemo } from 'react';
3
3
  import { useSearchParams } from 'react-router-dom';
4
+
4
5
  import type { TabsProps } from '../tabs';
5
6
  import { Tabs } from '../tabs';
6
7
 
@@ -53,7 +54,7 @@ function PageLayout({
53
54
  className={classNames(
54
55
  {
55
56
  'flex-none': !equalParts,
56
- 'min-w-0 flex-1 flex-shrink-0 overflow-auto': equalParts,
57
+ 'min-w-0 flex-1 shrink-0 overflow-auto': equalParts,
57
58
  },
58
59
  startClassName,
59
60
  )}
@@ -66,7 +67,7 @@ function PageLayout({
66
67
  className={classNames(
67
68
  'flex-1 overflow-auto',
68
69
  {
69
- 'min-w-0 flex-shrink-0': equalParts,
70
+ 'min-w-0 shrink-0': equalParts,
70
71
  },
71
72
  childrenClassName,
72
73
  )}
@@ -79,7 +80,7 @@ function PageLayout({
79
80
  className={classNames(
80
81
  {
81
82
  'flex-none': !equalParts,
82
- 'min-w-0 flex-1 flex-shrink-0 overflow-auto': equalParts,
83
+ 'min-w-0 flex-1 shrink-0 overflow-auto': equalParts,
83
84
  },
84
85
  endClassName,
85
86
  )}
@@ -11,39 +11,86 @@ export default meta;
11
11
  type Story = StoryObj<typeof PageLayout>;
12
12
 
13
13
  export const Default: Story = {
14
- args: {
15
- start: <div className="h-[100px] w-[100px] bg-red-500">start</div>,
16
- children: <div className="h-[100px] bg-blue-500">children</div>,
17
- end: <div className="h-[100px] w-[100px] bg-green-500">end</div>,
14
+ render: () => {
15
+ return (
16
+ <div className="flex flex-col gap-4">
17
+ <div className="h-[200px] w-[500px]">
18
+ <PageLayout
19
+ start={<div className="h-full w-[100px] bg-red-500">start</div>}
20
+ end={<div className="h-full w-[100px] bg-green-500">end</div>}
21
+ >
22
+ <div className="h-full bg-blue-500">children</div>
23
+ </PageLayout>
24
+ </div>
25
+
26
+ <div className="h-[200px] w-[500px]">
27
+ <PageLayout
28
+ start={<div className="h-full w-[100px] bg-red-500">start</div>}
29
+ end={<div className="h-full w-[100px] bg-green-500">end</div>}
30
+ >
31
+ <div className="h-full w-[2000px] bg-blue-500">children</div>
32
+ </PageLayout>
33
+ </div>
34
+ </div>
35
+ );
18
36
  },
19
37
  };
20
38
 
21
39
  export const DirectionVertical: Story = {
22
- args: {
23
- direction: 'vertical',
24
- start: <div className="h-[100px] bg-red-500">start</div>,
25
- children: <div className="h-[100px] bg-blue-500">children</div>,
26
- end: <div className="h-[100px] bg-green-500">end</div>,
40
+ render: () => {
41
+ return (
42
+ <div className="flex gap-4">
43
+ <div className="h-[500px] w-[200px]">
44
+ <PageLayout
45
+ direction="vertical"
46
+ start={<div className="h-[100px] w-full bg-red-500">start</div>}
47
+ end={<div className="h-[100px] w-full bg-green-500">end</div>}
48
+ >
49
+ <div className="h-full bg-blue-500">children</div>
50
+ </PageLayout>
51
+ </div>
52
+
53
+ <div className="h-[500px] w-[200px]">
54
+ <PageLayout
55
+ direction="vertical"
56
+ start={<div className="h-[100px] w-full bg-red-500">start</div>}
57
+ end={<div className="h-[100px] w-full bg-green-500">end</div>}
58
+ >
59
+ <div className="h-[2000px] w-full bg-blue-500">children</div>
60
+ </PageLayout>
61
+ </div>
62
+ </div>
63
+ );
27
64
  },
28
65
  };
29
66
 
30
67
  export const EqualParts: Story = {
31
- args: {
32
- className: '!w-[800px] !h-[200px] bg-gray-200',
33
- equalParts: true,
34
- // start: <div className="h-[100px] bg-red-500">start</div>,
35
- children: <div className="h-[100px] bg-blue-500">children</div>,
36
- end: <div className="h-[100px] w-[600px] bg-green-500">end</div>,
68
+ render: () => {
69
+ return (
70
+ <div className="h-[200px] w-[500px]">
71
+ <PageLayout equalParts={true} className="bg-gray-200">
72
+ <div className="h-full bg-blue-500">children</div>
73
+ <div className="h-full w-[600px] bg-green-500">end</div>
74
+ </PageLayout>
75
+ </div>
76
+ );
37
77
  },
38
78
  };
39
- export const ClassName: Story = {
40
- args: {
41
- className: '!w-[500px] !h-[500px]',
42
- startClassName: 'p-4 bg-red-200',
43
- childrenClassName: 'p-4 bg-blue-200',
44
- endClassName: 'p-4 bg-green-200',
45
- start: <div className="h-full w-[100px] bg-red-500">start</div>,
46
- children: <div className="h-full bg-blue-500">children</div>,
47
- end: <div className="h-full w-[100px] bg-green-500">end</div>,
79
+
80
+ export const ClassNamePadding: Story = {
81
+ render: () => {
82
+ return (
83
+ <div className="h-[200px] w-[500px]">
84
+ <PageLayout
85
+ startClassName="p-4 bg-red-200"
86
+ childrenClassName="p-4 bg-blue-200"
87
+ endClassName="p-4 bg-green-200"
88
+ start={<div className="h-full w-[100px] bg-red-500">start</div>}
89
+ end={<div className="h-full w-[100px] bg-green-500">end</div>}
90
+ >
91
+ <div className="h-full bg-blue-500">children</div>
92
+ </PageLayout>
93
+ </div>
94
+ );
48
95
  },
49
96
  };
package/src/tailwind.css CHANGED
@@ -38,17 +38,20 @@
38
38
  -webkit-font-smoothing: antialiased;
39
39
  }
40
40
 
41
- ::-webkit-scrollbar {
42
- width: 8px;
43
- height: 8px;
44
- }
41
+ /* 仅 PC 端显示自定义滚动条 */
42
+ @media (width >= 768px) {
43
+ ::-webkit-scrollbar {
44
+ width: 8px;
45
+ height: 8px;
46
+ }
45
47
 
46
- ::-webkit-scrollbar-thumb {
47
- background: #ccc;
48
- border-radius: 2px;
49
- }
48
+ ::-webkit-scrollbar-thumb {
49
+ background: #ccc;
50
+ border-radius: 2px;
51
+ }
50
52
 
51
- ::-webkit-scrollbar-track {
52
- background: transparent;
53
+ ::-webkit-scrollbar-track {
54
+ background: transparent;
55
+ }
53
56
  }
54
57
  }