@fe-free/core 3.0.5 → 3.0.7

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,19 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 3.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: crud
8
+ - @fe-free/tool@3.0.7
9
+
10
+ ## 3.0.6
11
+
12
+ ### Patch Changes
13
+
14
+ - fix: pro component
15
+ - @fe-free/tool@3.0.6
16
+
3
17
  ## 3.0.5
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -41,7 +41,7 @@
41
41
  "safe-stable-stringify": "^2.5.0",
42
42
  "vanilla-jsoneditor": "^0.23.1",
43
43
  "zustand": "^4.5.4",
44
- "@fe-free/tool": "3.0.5"
44
+ "@fe-free/tool": "3.0.7"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@ant-design/pro-components": "2.8.9",
@@ -228,6 +228,7 @@ export const SpecialToolbar: Story = {
228
228
 
229
229
  return (
230
230
  <CRUDOfPure
231
+ specialToolbar
231
232
  actions={['create', 'delete']}
232
233
  tableProps={{
233
234
  columns,
@@ -250,7 +251,63 @@ export const SpecialToolbar: Story = {
250
251
  </>
251
252
  )}
252
253
  requestCreateByValues={fakeCreate}
254
+ />
255
+ );
256
+ },
257
+ };
258
+
259
+ export const SpecialToolbar2: Story = {
260
+ render: () => {
261
+ const columns = [
262
+ {
263
+ title: 'id',
264
+ dataIndex: 'id',
265
+ search: true,
266
+ },
267
+ {
268
+ title: '名字(省略)',
269
+ dataIndex: 'name',
270
+ search: true,
271
+ ellipsis: true,
272
+ },
273
+ {
274
+ title: 'city',
275
+ dataIndex: 'city',
276
+ },
277
+ {
278
+ title: 'area',
279
+ dataIndex: 'area',
280
+ },
281
+ ];
282
+
283
+ return (
284
+ <CRUDOfPure
253
285
  specialToolbar
286
+ actions={['delete']}
287
+ tableProps={{
288
+ columns,
289
+ request: fakeRequest,
290
+ pagination: false,
291
+ toolBarRender: () => {
292
+ return [<Button key="custom1">自定义1</Button>];
293
+ },
294
+ }}
295
+ requestDeleteByRecord={fakeDeleteByRecord}
296
+ deleteProps={{
297
+ nameIndex: 'id',
298
+ }}
299
+ detailForm={() => (
300
+ <>
301
+ <ProFormText
302
+ name="name"
303
+ label="名字"
304
+ required
305
+ rules={[{ required: true }]}
306
+ extra="extra extra extra extra"
307
+ />
308
+ </>
309
+ )}
310
+ requestCreateByValues={fakeCreate}
254
311
  />
255
312
  );
256
313
  },
@@ -9,7 +9,7 @@ interface CRUDOfPureProps<
9
9
  DataSource extends Record<string, any> = any,
10
10
  Key extends string | number = string,
11
11
  > extends CRUDProps<DataSource, Key> {
12
- /** 特殊位置的 toolbar */
12
+ /** 特殊位置的 toolbar,向上 margin,是的 search 和 toolbar 一起。仅适用于 search 很少的情况。 */
13
13
  specialToolbar?: boolean;
14
14
  }
15
15
 
@@ -42,8 +42,6 @@ function CRUDOfPureComponent(props: CRUDOfPureProps, ref: React.ForwardedRef<CRU
42
42
  <div
43
43
  className={classNames('fec-crud-of-pure', {
44
44
  'fec-crud-of-pure-no-search': noSearch,
45
- // 先这样实现
46
- 'fec-crud-of-pure-no-toolbar': !props.actions.includes('create'),
47
45
  'fec-crud-of-pure-special-toolbar': props.specialToolbar,
48
46
  })}
49
47
  >
@@ -54,6 +52,14 @@ function CRUDOfPureComponent(props: CRUDOfPureProps, ref: React.ForwardedRef<CRU
54
52
  cardBordered: false,
55
53
  ...props.tableProps,
56
54
  columns: newColumns,
55
+ toolBarRender: (...args) => {
56
+ let originRender: React.ReactNode[] = [];
57
+
58
+ if (typeof props.tableProps.toolBarRender === 'function') {
59
+ originRender = props.tableProps.toolBarRender(...args);
60
+ }
61
+ return [...originRender, <div key="fake" style={{ height: '32px' }} />];
62
+ },
57
63
  }}
58
64
  />
59
65
  </div>
@@ -49,11 +49,11 @@
49
49
  }
50
50
  }
51
51
 
52
- &.fec-crud-of-pure-no-toolbar {
53
- .ant-pro-table-list-toolbar-container {
54
- padding-block: 0;
55
- }
56
- }
52
+ // &.fec-crud-of-pure-no-toolbar {
53
+ // .ant-pro-table-list-toolbar-container {
54
+ // padding-block: 0;
55
+ // }
56
+ // }
57
57
 
58
58
  &.fec-crud-of-pure-special-toolbar {
59
59
  .ant-pro-table-list-toolbar {
package/src/style.scss CHANGED
@@ -12,3 +12,9 @@
12
12
 
13
13
  /* stylelint-disable-next-line at-rule-no-unknown */
14
14
  @tailwind utilities;
15
+
16
+ // fix
17
+ // ant-pro-card-border 有个 transition 导致颜色会变化,所以就写死个。
18
+ .ant-pro-card-border {
19
+ border: 1px solid #e2e7f0;
20
+ }