@pointcloud/pcloud-components 1.0.9 → 1.0.10
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/dist/esm/CRUD/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type ModalFuncProps, type ButtonProps } from 'antd';
|
|
2
|
+
import { type ModalFuncProps, type ButtonProps, type PopoverProps } from 'antd';
|
|
3
3
|
import { type DFormProps } from '../DForm';
|
|
4
4
|
import { type DTableSourceProps, type DTableProps } from '../DTable';
|
|
5
5
|
import type { DModalProps } from '../DModal/interface';
|
|
@@ -24,6 +24,16 @@ export type CRUDRefProps = {
|
|
|
24
24
|
openDetailModal: (_record?: any) => void;
|
|
25
25
|
};
|
|
26
26
|
export type MoreActionColumnRender<T = Record<string, any>> = (_text: any, _record: T) => React.ReactNode;
|
|
27
|
+
export type MoreActionProps<T = Record<string, any>> = MoreActionColumnRender<T> | {
|
|
28
|
+
/** 内容渲染函数 */
|
|
29
|
+
render: MoreActionColumnRender<T>;
|
|
30
|
+
/** Popover 属性 */
|
|
31
|
+
popoverProps?: PopoverProps;
|
|
32
|
+
/** 更多按钮文字,默认为"更多" */
|
|
33
|
+
label?: string;
|
|
34
|
+
/** 更多按钮配置 */
|
|
35
|
+
buttonProps?: ButtonProps;
|
|
36
|
+
};
|
|
27
37
|
export type CRUDProps = {
|
|
28
38
|
className?: string;
|
|
29
39
|
style?: React.CSSProperties;
|
|
@@ -33,7 +43,7 @@ export type CRUDProps = {
|
|
|
33
43
|
};
|
|
34
44
|
/** 表格配置 */
|
|
35
45
|
tableProps: DTableProps & {
|
|
36
|
-
moreActionColumn?:
|
|
46
|
+
moreActionColumn?: MoreActionProps;
|
|
37
47
|
};
|
|
38
48
|
/** 新增/编辑表单配置 */
|
|
39
49
|
modalFormProps?: {
|
|
@@ -80,13 +90,13 @@ export type CRUDProps = {
|
|
|
80
90
|
crudApi: {
|
|
81
91
|
list: (_params: any) => Promise<DTableSourceProps>;
|
|
82
92
|
/** 删除数据接口 */
|
|
83
|
-
delete?: (
|
|
93
|
+
delete?: (_currentRecord: any) => Promise<any>;
|
|
84
94
|
/** 新增数据接口 */
|
|
85
95
|
add?: (_params: any) => Promise<any>;
|
|
86
96
|
/** 编辑数据接口 */
|
|
87
|
-
edit?: (_params: any) => Promise<any>;
|
|
97
|
+
edit?: (_params: any, _currentRecord: any) => Promise<any>;
|
|
88
98
|
/** 详情数据接口 */
|
|
89
|
-
detail?: (
|
|
99
|
+
detail?: (_currentRecord: any) => Promise<any>;
|
|
90
100
|
};
|
|
91
101
|
/** 全局刷新策略 */
|
|
92
102
|
refreshStrategy?: RefreshStrategy;
|
package/dist/esm/CRUD/index.js
CHANGED
|
@@ -444,7 +444,7 @@ var forwardCRUD = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
444
444
|
break;
|
|
445
445
|
}
|
|
446
446
|
_context9.next = 4;
|
|
447
|
-
return editApi(_objectSpread(_objectSpread({}, currentRecordRef.current || {}), values));
|
|
447
|
+
return editApi(_objectSpread(_objectSpread({}, currentRecordRef.current || {}), values), currentRecordRef.current);
|
|
448
448
|
case 4:
|
|
449
449
|
handleRefresh(memoizedEditRefreshStrategy);
|
|
450
450
|
_context9.next = 11;
|
|
@@ -529,6 +529,9 @@ var forwardCRUD = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
529
529
|
var currentHandleEdit = handleEdit;
|
|
530
530
|
var currentHandleDelete = handleDelete;
|
|
531
531
|
var currentHandleView = handleView;
|
|
532
|
+
var moreActionConfig = tableProps !== null && tableProps !== void 0 && tableProps.moreActionColumn ? typeof tableProps.moreActionColumn === 'function' ? {
|
|
533
|
+
render: tableProps.moreActionColumn
|
|
534
|
+
} : tableProps.moreActionColumn : null;
|
|
532
535
|
return function (_text, record) {
|
|
533
536
|
return /*#__PURE__*/_jsxs("div", {
|
|
534
537
|
className: actionColumnClass,
|
|
@@ -560,21 +563,23 @@ var forwardCRUD = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
560
563
|
size: "small"
|
|
561
564
|
}, viewButtonProps), {}, {
|
|
562
565
|
children: viewButtonText
|
|
563
|
-
})),
|
|
566
|
+
})), moreActionConfig && /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread({
|
|
564
567
|
trigger: "click",
|
|
565
568
|
placement: "bottomRight",
|
|
566
|
-
content:
|
|
569
|
+
content: moreActionConfig.render(_text, record),
|
|
567
570
|
zIndex: 5,
|
|
568
571
|
getPopupContainer: function getPopupContainer(e) {
|
|
569
572
|
return e.parentElement || document.body;
|
|
570
|
-
}
|
|
571
|
-
|
|
573
|
+
}
|
|
574
|
+
}, moreActionConfig.popoverProps), {}, {
|
|
575
|
+
children: /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
572
576
|
type: "link",
|
|
573
577
|
icon: /*#__PURE__*/_jsx(MoreOutlined, {}),
|
|
574
|
-
size: "small"
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
+
size: "small"
|
|
579
|
+
}, moreActionConfig.buttonProps), {}, {
|
|
580
|
+
children: moreActionConfig.label || '更多'
|
|
581
|
+
}))
|
|
582
|
+
}))]
|
|
578
583
|
});
|
|
579
584
|
};
|
|
580
585
|
}, [handleEdit, handleDelete, handleView, showEdit, showDelete, showView, editButtonText, deleteButtonText, viewButtonText, tableProps === null || tableProps === void 0 ? void 0 : tableProps.moreActionColumn]);
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -65,6 +65,6 @@ export type { AnimatedScrollListProps } from './AnimatedScrollList/interface';
|
|
|
65
65
|
export { default as DRangePicker } from './DRangePicker';
|
|
66
66
|
export type { DRangePickerProps } from './DRangePicker/interface';
|
|
67
67
|
export { default as CRUD } from './CRUD';
|
|
68
|
-
export { type CRUDProps, type CRUDRefProps, type MoreActionColumnRender } from './CRUD';
|
|
68
|
+
export { type CRUDProps, type CRUDRefProps, type MoreActionProps, type MoreActionColumnRender } from './CRUD';
|
|
69
69
|
export { default as DynamicFormItem } from './DynamicFormItem';
|
|
70
70
|
export type { DynamicFormItemProps } from './DynamicFormItem';
|