listpage_cli 0.0.321 → 0.0.323

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage_cli",
3
- "version": "0.0.321",
3
+ "version": "0.0.323",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "listpage_cli": "bin/cli.js"
@@ -10,8 +10,8 @@
10
10
  "preview": "rsbuild preview"
11
11
  },
12
12
  "dependencies": {
13
- "listpage-http": "0.0.321",
14
- "listpage-components": "0.0.321",
13
+ "listpage-http": "0.0.323",
14
+ "listpage-components": "0.0.323",
15
15
  "antd": "6.3.1",
16
16
  "ahooks": "^3.9.5",
17
17
  "@ant-design/icons": "~6.0.2",
@@ -134,8 +134,8 @@ type FloatItem = {
134
134
  type FloatComponentProps<T = any> = {
135
135
  record: T;
136
136
  visible: boolean;
137
- onClose: (code?: number) => void | (() => void);
138
- // (code?: number) => void:onClose() 取消不刷新,onClose(1) 确认并刷新
137
+ onClose: (refresh?: any) => void;
138
+ // onClose(true) 强制刷新;onClose() 根据 showFloat 第三参 onCloseCallback 处理
139
139
  };
140
140
  ```
141
141
 
@@ -160,5 +160,5 @@ type FloatComponentProps<T = any> = {
160
160
  | `updatePagination` | 更新分页 `(page, pageSize)` |
161
161
  | `updateSort` | 更新排序 `(field?, order?)` |
162
162
  | `showFloat` | 打开浮窗 `(key, record, onCloseCallback?: true \| (() => void))` |
163
- | `hideFloat` | 关闭浮窗 |
163
+ | `hideFloat` | 关闭浮窗 `(refresh?: any)`,传真值强制刷新 |
164
164
  | `onSelectionChange` | 选中变更 `(keys, rows)` |
@@ -65,7 +65,7 @@ export default function Page() {
65
65
 
66
66
  ## 2. 复杂用法(内置渲染器、toolbar、多浮窗)
67
67
 
68
- 内置列渲染器:`text`、`ellipsis`、`tag`、`badge`、`date`、`datetime`、`number`、`money`、`percent`、`boolean`、`link`、`enum`、`copyable`、`avatar`、`image`。浮窗 `onClose(1)` 表示确认并刷新,`onClose()` 表示取消。
68
+ 内置列渲染器:`text`、`ellipsis`、`tag`、`badge`、`date`、`datetime`、`number`、`money`、`percent`、`boolean`、`link`、`enum`、`copyable`、`avatar`、`image`。浮窗 `onClose(true)` 强制刷新;`onClose()` 根据 `onCloseCallback` 处理。Modal/Drawer 的 `onCancel` 请用 `() => onClose()`。
69
69
 
70
70
  ```tsx
71
71
  import { ListPage } from "listpage-components";
@@ -88,7 +88,7 @@ const request = async (pageParams, filterValues) => {
88
88
  };
89
89
 
90
90
  const DetailModal = ({ record, visible, onClose }) => (
91
- <Modal open={visible} title="详情" onCancel={onClose} footer={null}>
91
+ <Modal open={visible} title="详情" onCancel={() => onClose()} footer={null}>
92
92
  <p>姓名:{record?.name}</p>
93
93
  </Modal>
94
94
  );
@@ -97,10 +97,10 @@ const EditModal = ({ record, visible, onClose }) => (
97
97
  <Modal
98
98
  open={visible}
99
99
  title="编辑"
100
- onCancel={onClose}
100
+ onCancel={() => onClose()}
101
101
  onOk={() => {
102
102
  message.success("保存成功");
103
- onClose(1);
103
+ onClose(true);
104
104
  }}
105
105
  >
106
106
  <Input defaultValue={record?.name} />
@@ -114,7 +114,7 @@ const CreateDrawer = ({ record, visible, onClose }) => (
114
114
  type="primary"
115
115
  onClick={() => {
116
116
  message.success("新建成功");
117
- onClose(1);
117
+ onClose(true);
118
118
  }}
119
119
  >
120
120
  保存
@@ -388,7 +388,7 @@ export const ContractTypeFormFloat = (
388
388
  } else {
389
389
  await api.contractType.create(values);
390
390
  }
391
- onClose(1); // 1 表示刷新列表
391
+ onClose(true); // 强制刷新列表
392
392
  };
393
393
 
394
394
  return (