@fe-free/core 2.6.1 → 2.6.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 2.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: crud
8
+ - @fe-free/tool@2.6.2
9
+
3
10
  ## 2.6.1
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -41,7 +41,7 @@
41
41
  "remark-gfm": "^4.0.1",
42
42
  "vanilla-jsoneditor": "^0.23.1",
43
43
  "zustand": "^4.5.4",
44
- "@fe-free/tool": "2.6.1"
44
+ "@fe-free/tool": "2.6.2"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@ant-design/pro-components": "2.8.9",
@@ -51,7 +51,7 @@ export const Basic: Story = {
51
51
 
52
52
  return (
53
53
  <CRUDOfPure
54
- actions={['delete']}
54
+ actions={['create', 'delete']}
55
55
  tableProps={{
56
56
  columns,
57
57
  request: fakeRequest,
@@ -201,3 +201,57 @@ export const NoSearch: Story = {
201
201
  );
202
202
  },
203
203
  };
204
+
205
+ export const SpecialToolbar: Story = {
206
+ render: () => {
207
+ const columns = [
208
+ {
209
+ title: 'id',
210
+ dataIndex: 'id',
211
+ search: true,
212
+ },
213
+ {
214
+ title: '名字(省略)',
215
+ dataIndex: 'name',
216
+ search: true,
217
+ ellipsis: true,
218
+ },
219
+ {
220
+ title: 'city',
221
+ dataIndex: 'city',
222
+ },
223
+ {
224
+ title: 'area',
225
+ dataIndex: 'area',
226
+ },
227
+ ];
228
+
229
+ return (
230
+ <CRUDOfPure
231
+ actions={['create', 'delete']}
232
+ tableProps={{
233
+ columns,
234
+ request: fakeRequest,
235
+ pagination: false,
236
+ }}
237
+ requestDeleteByRecord={fakeDeleteByRecord}
238
+ deleteProps={{
239
+ nameIndex: 'id',
240
+ }}
241
+ detailForm={() => (
242
+ <>
243
+ <ProFormText
244
+ name="name"
245
+ label="名字"
246
+ required
247
+ rules={[{ required: true }]}
248
+ extra="extra extra extra extra"
249
+ />
250
+ </>
251
+ )}
252
+ requestCreateByValues={fakeCreate}
253
+ specialToolbar
254
+ />
255
+ );
256
+ },
257
+ };
@@ -9,7 +9,8 @@ interface CRUDOfPureProps<
9
9
  DataSource extends Record<string, any> = any,
10
10
  Key extends string | number = string,
11
11
  > extends CRUDProps<DataSource, Key> {
12
- // nothing
12
+ /** 特殊位置的 toolbar */
13
+ specialToolbar?: boolean;
13
14
  }
14
15
 
15
16
  function CRUDOfPureComponent(props: CRUDOfPureProps, ref: React.ForwardedRef<CRUDMethods>) {
@@ -43,6 +44,7 @@ function CRUDOfPureComponent(props: CRUDOfPureProps, ref: React.ForwardedRef<CRU
43
44
  'fec-crud-of-pure-no-search': noSearch,
44
45
  // 先这样实现
45
46
  'fec-crud-of-pure-no-toolbar': !props.actions.includes('create'),
47
+ 'fec-crud-of-pure-special-toolbar': props.specialToolbar,
46
48
  })}
47
49
  >
48
50
  <CRUD
@@ -54,4 +54,15 @@
54
54
  padding-block: 0;
55
55
  }
56
56
  }
57
+
58
+ &.fec-crud-of-pure-special-toolbar {
59
+ .ant-pro-table-list-toolbar {
60
+ margin-top: -48px;
61
+ pointer-events: none;
62
+
63
+ .ant-pro-table-list-toolbar-right > div {
64
+ pointer-events: auto;
65
+ }
66
+ }
67
+ }
57
68
  }