crud-page-react 0.1.3 → 0.1.4
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/README.md +1 -1
- package/dist/index.esm.js +9 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -253,24 +253,13 @@ function DynamicTable({ schema, data, loading, pagination, onView, onEdit, onDel
|
|
|
253
253
|
// 分离基础操作和自定义操作
|
|
254
254
|
const basicActions = actions.filter(action => action.type === 'view' || action.type === 'edit' || action.type === 'delete');
|
|
255
255
|
const customActions = actions.filter(action => action.type === 'custom');
|
|
256
|
-
//
|
|
257
|
-
const dropdownItems =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
})),
|
|
264
|
-
...(customActions.length > 0 ? [{
|
|
265
|
-
type: 'divider',
|
|
266
|
-
}] : []),
|
|
267
|
-
{
|
|
268
|
-
key: 'copy-json',
|
|
269
|
-
label: '复制 JSON',
|
|
270
|
-
icon: jsxRuntime.jsx(icons.CopyOutlined, {}),
|
|
271
|
-
onClick: () => copyJson(record),
|
|
272
|
-
}
|
|
273
|
-
];
|
|
256
|
+
// 构建下拉菜单项(仅包含自定义操作)
|
|
257
|
+
const dropdownItems = customActions.map(action => ({
|
|
258
|
+
key: action.key,
|
|
259
|
+
label: action.label,
|
|
260
|
+
onClick: () => onCustomAction === null || onCustomAction === void 0 ? void 0 : onCustomAction(action.key, record),
|
|
261
|
+
danger: action.danger,
|
|
262
|
+
}));
|
|
274
263
|
return (jsxRuntime.jsxs(antd.Space, { size: 4, children: [basicActions.map((action) => {
|
|
275
264
|
var _a, _b, _c;
|
|
276
265
|
if (action.type === 'view') {
|
|
@@ -283,7 +272,7 @@ function DynamicTable({ schema, data, loading, pagination, onView, onEdit, onDel
|
|
|
283
272
|
return (jsxRuntime.jsx(antd.Popconfirm, { title: (_b = (_a = action.confirm) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '确定删除?', description: (_c = action.confirm) === null || _c === void 0 ? void 0 : _c.content, onConfirm: () => onDelete(record), okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88", okButtonProps: { danger: true }, children: jsxRuntime.jsx(antd.Tooltip, { title: action.label, children: jsxRuntime.jsx(antd.Button, { type: "link", size: "small", danger: true, icon: jsxRuntime.jsx(icons.DeleteOutlined, {}) }) }) }, action.key));
|
|
284
273
|
}
|
|
285
274
|
return null;
|
|
286
|
-
}), jsxRuntime.jsx(antd.Dropdown, { menu: { items: dropdownItems }, trigger: ['click'], placement: "bottomRight", children: jsxRuntime.jsx(antd.Tooltip, { title: "\u5176\u5B83\u64CD\u4F5C", children: jsxRuntime.jsx(antd.Button, { type: "link", size: "small", icon: jsxRuntime.jsx(icons.MoreOutlined, {}) }) }) })] }));
|
|
275
|
+
}), customActions.length > 0 && (jsxRuntime.jsx(antd.Dropdown, { menu: { items: dropdownItems }, trigger: ['click'], placement: "bottomRight", children: jsxRuntime.jsx(antd.Tooltip, { title: "\u5176\u5B83\u64CD\u4F5C", children: jsxRuntime.jsx(antd.Button, { type: "link", size: "small", icon: jsxRuntime.jsx(icons.MoreOutlined, {}) }) }) })), jsxRuntime.jsx(antd.Tooltip, { title: "\u590D\u5236 JSON", children: jsxRuntime.jsx(antd.Button, { type: "link", size: "small", icon: jsxRuntime.jsx(icons.CopyOutlined, {}), onClick: () => copyJson(record) }) })] }));
|
|
287
276
|
},
|
|
288
277
|
});
|
|
289
278
|
return (jsxRuntime.jsx(antd.Table, { rowKey: (_a = schema.rowKey) !== null && _a !== void 0 ? _a : 'id', columns: columns, dataSource: data, loading: loading, scroll: { x: 'max-content' }, pagination: {
|