@fe-free/core 4.1.42 → 4.1.44

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
+ ## 4.1.44
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: crud of list
8
+ - @fe-free/icons@4.1.44
9
+ - @fe-free/tool@4.1.44
10
+
11
+ ## 4.1.43
12
+
13
+ ### Patch Changes
14
+
15
+ - fix: valueType
16
+ - @fe-free/icons@4.1.43
17
+ - @fe-free/tool@4.1.43
18
+
3
19
  ## 4.1.42
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "4.1.42",
3
+ "version": "4.1.44",
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/icons": "4.1.42",
56
- "@fe-free/tool": "4.1.42"
55
+ "@fe-free/icons": "4.1.44",
56
+ "@fe-free/tool": "4.1.44"
57
57
  },
58
58
  "scripts": {
59
59
  "i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
@@ -15,11 +15,17 @@ function OperateBtn({
15
15
  }) {
16
16
  if (disabled) {
17
17
  if (operateText) {
18
- return <span className="cursor-not-allowed text-03">{operateText}</span>;
18
+ return (
19
+ <span className="fec-crud-of-list-operate-btn cursor-not-allowed text-03">
20
+ {operateText}
21
+ </span>
22
+ );
19
23
  } else {
20
24
  return (
21
25
  <Tooltip title={title}>
22
- <span className="cursor-not-allowed text-lg text-03">{icon}</span>
26
+ <span className="fec-crud-of-list-operate-btn cursor-not-allowed text-lg text-03">
27
+ {icon}
28
+ </span>
23
29
  </Tooltip>
24
30
  );
25
31
  }
@@ -27,7 +33,7 @@ function OperateBtn({
27
33
 
28
34
  if (operateText) {
29
35
  return (
30
- <span className="cursor-pointer text-primary" onClick={onClick}>
36
+ <span className="fec-crud-of-list-operate-btn cursor-pointer text-primary" onClick={onClick}>
31
37
  {operateText}
32
38
  </span>
33
39
  );
@@ -35,7 +41,10 @@ function OperateBtn({
35
41
 
36
42
  return (
37
43
  <Tooltip title={title}>
38
- <span className="cursor-pointer text-lg text-primary" onClick={onClick}>
44
+ <span
45
+ className="fec-crud-of-list-operate-btn cursor-pointer text-lg text-primary"
46
+ onClick={onClick}
47
+ >
39
48
  {icon}
40
49
  </span>
41
50
  </Tooltip>
@@ -54,6 +54,7 @@ export const Basic: Story = {
54
54
  ref={ref}
55
55
  actions={[]}
56
56
  tableProps={{
57
+ rowKey: 'id',
57
58
  columns,
58
59
  request: fakeRequest,
59
60
  }}
@@ -88,6 +89,42 @@ export const WithSearch: Story = {
88
89
  <CRUDOfList
89
90
  actions={['delete']}
90
91
  tableProps={{
92
+ rowKey: 'id',
93
+ columns,
94
+ request: fakeRequest,
95
+ }}
96
+ requestDeleteByRecord={fakeDeleteByRecord}
97
+ deleteProps={{
98
+ nameIndex: 'name',
99
+ }}
100
+ detailForm={() => (
101
+ <>
102
+ <ProFormText name="name" label="名字" required rules={[{ required: true }]} />
103
+ </>
104
+ )}
105
+ requestCreateByValues={fakeCreate}
106
+ />
107
+ );
108
+ },
109
+ };
110
+
111
+ export const WithToolbarSticky: Story = {
112
+ render: () => {
113
+ const columns = [
114
+ {
115
+ title: '名字(省略)',
116
+ dataIndex: 'name',
117
+ search: true,
118
+ ellipsis: true,
119
+ },
120
+ ];
121
+
122
+ return (
123
+ <CRUDOfList
124
+ toolbarSticky
125
+ actions={['delete']}
126
+ tableProps={{
127
+ rowKey: 'id',
91
128
  columns,
92
129
  request: fakeRequest,
93
130
  }}
@@ -121,6 +158,7 @@ export const WithCreateDelete: Story = {
121
158
  <CRUDOfList
122
159
  actions={['create', 'delete']}
123
160
  tableProps={{
161
+ rowKey: 'id',
124
162
  columns,
125
163
  request: fakeRequest,
126
164
  }}
@@ -153,6 +191,7 @@ export const NoSearch: Story = {
153
191
  <CRUDOfList
154
192
  actions={['create', 'delete']}
155
193
  tableProps={{
194
+ rowKey: 'id',
156
195
  columns,
157
196
  request: fakeRequest,
158
197
  }}
@@ -12,7 +12,7 @@ interface CRUDOfListProps<
12
12
  DataSource extends Record<string, any> = any,
13
13
  Key extends string | number = string,
14
14
  > extends CRUDProps<DataSource, Key> {
15
- // nothing
15
+ toolbarSticky?: boolean;
16
16
  }
17
17
 
18
18
  function useTips(props) {
@@ -104,6 +104,7 @@ function CRUDOfList(props: CRUDOfListProps) {
104
104
  {
105
105
  // 先这样实现
106
106
  'fec-crud-of-list-no-toolbar': !searchDataIndex && !props.actions.includes('create'),
107
+ 'fec-crud-of-list-toolbar-sticky': props.toolbarSticky,
107
108
  },
108
109
  props.className,
109
110
  )}
@@ -34,4 +34,31 @@
34
34
  padding-block: 0;
35
35
  }
36
36
  }
37
+
38
+ &.fec-crud-of-list-toolbar-sticky {
39
+ .ant-pro-table-list-toolbar {
40
+ position: sticky;
41
+ top: 0;
42
+ z-index: 10;
43
+ background-color: #fff;
44
+ }
45
+ }
46
+
47
+ .fec-crud-of-list-operate-btn {
48
+ font-size: 14px !important;
49
+ line-height: var(--ant-line-height) !important;
50
+ }
51
+
52
+ .ant-table-bordered {
53
+ .ant-table-container {
54
+ border-top: none !important;
55
+ border-left: none !important;
56
+
57
+ .ant-table-row {
58
+ .ant-table-cell {
59
+ border-inline-end: none !important;
60
+ }
61
+ }
62
+ }
63
+ }
37
64
  }
@@ -43,7 +43,7 @@ function Render(text, props: ProFormItemProps<JSONModalProps>) {
43
43
  },
44
44
  }}
45
45
  >
46
- <div className="h-[500px]">
46
+ <div>
47
47
  <EditorJSON value={jsonText} readonly />
48
48
  </div>
49
49
  </Modal>
@@ -12,8 +12,8 @@ function Render(text) {
12
12
  return (
13
13
  <>
14
14
  <div onClick={() => setShow(true)} className="flex cursor-pointer items-center">
15
- <div className="truncate">{text}</div>
16
- <span className="text-primary">查看</span>
15
+ <div className="flex-1 truncate">{text}</div>
16
+ <span className="min-w-0 text-primary">查看</span>
17
17
  </div>
18
18
  {show && (
19
19
  <Modal
@@ -26,8 +26,9 @@ function Render(text) {
26
26
  display: 'none',
27
27
  },
28
28
  }}
29
+ width={900}
29
30
  >
30
- <div className="h-[500px]">
31
+ <div>
31
32
  <Markdown content={text} />
32
33
  </div>
33
34
  </Modal>