@canlooks/can-ui 0.0.157 → 0.0.159
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.
|
@@ -36,7 +36,7 @@ export type CurdRef<R extends RowType = RowType, F extends FormValue = FormValue
|
|
|
36
36
|
selectSingle(): Promise<R> | undefined;
|
|
37
37
|
selectMultiple(selected?: Id[]): Promise<Id[]> | undefined;
|
|
38
38
|
};
|
|
39
|
-
export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue = FormValue> extends Omit<DataGridBaseProps<R>, 'ref' | 'columns' | 'filterPredicate'> {
|
|
39
|
+
export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue = FormValue> extends Omit<DataGridBaseProps<R>, 'ref' | 'columns' | 'filterPredicate' | 'onLoad'> {
|
|
40
40
|
ref?: Ref<CurdRef<R, F>>;
|
|
41
41
|
/** 默认属性会传递给DataGrid组件,外层包裹元素的属性使用wrapperProps */
|
|
42
42
|
wrapperProps?: DivProps;
|
|
@@ -51,6 +51,7 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
|
|
|
51
51
|
type: OrderType;
|
|
52
52
|
}): LoadRowsReturn<R> | Promise<LoadRowsReturn<R>>;
|
|
53
53
|
}['bivarianceHack'];
|
|
54
|
+
onLoad?(rowsReturn: LoadRowsReturn<R>): void;
|
|
54
55
|
columns?: (CurdColumn<R> | symbol)[];
|
|
55
56
|
toolbarLeft?: ReactNode;
|
|
56
57
|
toolbarRight?: ReactNode;
|
|
@@ -99,9 +100,9 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
|
|
|
99
100
|
formProps?: FormProps<F>;
|
|
100
101
|
formRef?: Ref<FormRef<F>>;
|
|
101
102
|
}
|
|
102
|
-
interface CurdSingleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridSingleProps<R, V>, 'ref' | 'columns'>, CurdBaseProps<R, F> {
|
|
103
|
+
interface CurdSingleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridSingleProps<R, V>, 'ref' | 'columns' | 'onLoad'>, CurdBaseProps<R, F> {
|
|
103
104
|
}
|
|
104
|
-
interface CurdMultipleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridMultipleProps<R, V>, 'ref' | 'columns'>, CurdBaseProps<R, F> {
|
|
105
|
+
interface CurdMultipleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridMultipleProps<R, V>, 'ref' | 'columns' | 'onLoad'>, CurdBaseProps<R, F> {
|
|
105
106
|
}
|
|
106
107
|
export type CurdProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> = CurdSingleProps<R, F, V> | CurdMultipleProps<R, F, V>;
|
|
107
108
|
export declare const Curd: {
|
|
@@ -24,7 +24,7 @@ const faPenToSquare_1 = require("@fortawesome/free-regular-svg-icons/faPenToSqua
|
|
|
24
24
|
const faPlus_1 = require("@fortawesome/free-solid-svg-icons/faPlus");
|
|
25
25
|
const faRotateRight_1 = require("@fortawesome/free-solid-svg-icons/faRotateRight");
|
|
26
26
|
exports.Curd = (0, react_1.memo)((props) => {
|
|
27
|
-
const { ref, wrapperProps, variant = 'standard', loadRows, columns, toolbarLeft, toolbarRight, reloadable = true, onReload, resizable = true, columnConfigurable = true, filterProps, initialFilterValue, onFilter, filterableProps, renderFilterable, renderFilterConditions, copyable, creatable = true, updatable = true, deletable = true, createButtonProps, updateButtonProps, deleteButtonProps, deleteConfirmProps, controlColumnTitle = '操作', renderExtraControl, titleKey, dataName = '', createName = '添加', updateName = '编辑', deleteName = '删除', onCreate, onUpdate, onDelete, rowToForm, dialogProps, formProps, formRef, onChange, ...dataGridProps } = props;
|
|
27
|
+
const { ref, wrapperProps, variant = 'standard', loadRows, onLoad, columns, toolbarLeft, toolbarRight, reloadable = true, onReload, resizable = true, columnConfigurable = true, filterProps, initialFilterValue, onFilter, filterableProps, renderFilterable, renderFilterConditions, copyable, creatable = true, updatable = true, deletable = true, createButtonProps, updateButtonProps, deleteButtonProps, deleteConfirmProps, controlColumnTitle = '操作', renderExtraControl, titleKey, dataName = '', createName = '添加', updateName = '编辑', deleteName = '删除', onCreate, onUpdate, onDelete, rowToForm, dialogProps, formProps, formRef, onChange, ...dataGridProps } = props;
|
|
28
28
|
/**
|
|
29
29
|
* -------------------------------------------------------------
|
|
30
30
|
* ref
|
|
@@ -167,6 +167,12 @@ exports.Curd = (0, react_1.memo)((props) => {
|
|
|
167
167
|
onReload?.();
|
|
168
168
|
innerLoadRows().then();
|
|
169
169
|
};
|
|
170
|
+
(0, react_1.useEffect)(() => {
|
|
171
|
+
onLoad?.({
|
|
172
|
+
rows: innerRows.current,
|
|
173
|
+
total: innerTotal.current
|
|
174
|
+
});
|
|
175
|
+
}, [innerRows.current, innerTotal.current]);
|
|
170
176
|
/**
|
|
171
177
|
* -------------------------------------------------------------
|
|
172
178
|
* 弹窗与曾删改部分
|
|
@@ -36,7 +36,7 @@ export type CurdRef<R extends RowType = RowType, F extends FormValue = FormValue
|
|
|
36
36
|
selectSingle(): Promise<R> | undefined;
|
|
37
37
|
selectMultiple(selected?: Id[]): Promise<Id[]> | undefined;
|
|
38
38
|
};
|
|
39
|
-
export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue = FormValue> extends Omit<DataGridBaseProps<R>, 'ref' | 'columns' | 'filterPredicate'> {
|
|
39
|
+
export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue = FormValue> extends Omit<DataGridBaseProps<R>, 'ref' | 'columns' | 'filterPredicate' | 'onLoad'> {
|
|
40
40
|
ref?: Ref<CurdRef<R, F>>;
|
|
41
41
|
/** 默认属性会传递给DataGrid组件,外层包裹元素的属性使用wrapperProps */
|
|
42
42
|
wrapperProps?: DivProps;
|
|
@@ -51,6 +51,7 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
|
|
|
51
51
|
type: OrderType;
|
|
52
52
|
}): LoadRowsReturn<R> | Promise<LoadRowsReturn<R>>;
|
|
53
53
|
}['bivarianceHack'];
|
|
54
|
+
onLoad?(rowsReturn: LoadRowsReturn<R>): void;
|
|
54
55
|
columns?: (CurdColumn<R> | symbol)[];
|
|
55
56
|
toolbarLeft?: ReactNode;
|
|
56
57
|
toolbarRight?: ReactNode;
|
|
@@ -99,9 +100,9 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
|
|
|
99
100
|
formProps?: FormProps<F>;
|
|
100
101
|
formRef?: Ref<FormRef<F>>;
|
|
101
102
|
}
|
|
102
|
-
interface CurdSingleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridSingleProps<R, V>, 'ref' | 'columns'>, CurdBaseProps<R, F> {
|
|
103
|
+
interface CurdSingleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridSingleProps<R, V>, 'ref' | 'columns' | 'onLoad'>, CurdBaseProps<R, F> {
|
|
103
104
|
}
|
|
104
|
-
interface CurdMultipleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridMultipleProps<R, V>, 'ref' | 'columns'>, CurdBaseProps<R, F> {
|
|
105
|
+
interface CurdMultipleProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> extends Omit<DataGridMultipleProps<R, V>, 'ref' | 'columns' | 'onLoad'>, CurdBaseProps<R, F> {
|
|
105
106
|
}
|
|
106
107
|
export type CurdProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> = CurdSingleProps<R, F, V> | CurdMultipleProps<R, F, V>;
|
|
107
108
|
export declare const Curd: {
|
|
@@ -21,7 +21,7 @@ import { faPenToSquare } from '@fortawesome/free-regular-svg-icons/faPenToSquare
|
|
|
21
21
|
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
|
|
22
22
|
import { faRotateRight } from '@fortawesome/free-solid-svg-icons/faRotateRight';
|
|
23
23
|
export const Curd = memo((props) => {
|
|
24
|
-
const { ref, wrapperProps, variant = 'standard', loadRows, columns, toolbarLeft, toolbarRight, reloadable = true, onReload, resizable = true, columnConfigurable = true, filterProps, initialFilterValue, onFilter, filterableProps, renderFilterable, renderFilterConditions, copyable, creatable = true, updatable = true, deletable = true, createButtonProps, updateButtonProps, deleteButtonProps, deleteConfirmProps, controlColumnTitle = '操作', renderExtraControl, titleKey, dataName = '', createName = '添加', updateName = '编辑', deleteName = '删除', onCreate, onUpdate, onDelete, rowToForm, dialogProps, formProps, formRef, onChange, ...dataGridProps } = props;
|
|
24
|
+
const { ref, wrapperProps, variant = 'standard', loadRows, onLoad, columns, toolbarLeft, toolbarRight, reloadable = true, onReload, resizable = true, columnConfigurable = true, filterProps, initialFilterValue, onFilter, filterableProps, renderFilterable, renderFilterConditions, copyable, creatable = true, updatable = true, deletable = true, createButtonProps, updateButtonProps, deleteButtonProps, deleteConfirmProps, controlColumnTitle = '操作', renderExtraControl, titleKey, dataName = '', createName = '添加', updateName = '编辑', deleteName = '删除', onCreate, onUpdate, onDelete, rowToForm, dialogProps, formProps, formRef, onChange, ...dataGridProps } = props;
|
|
25
25
|
/**
|
|
26
26
|
* -------------------------------------------------------------
|
|
27
27
|
* ref
|
|
@@ -164,6 +164,12 @@ export const Curd = memo((props) => {
|
|
|
164
164
|
onReload?.();
|
|
165
165
|
innerLoadRows().then();
|
|
166
166
|
};
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
onLoad?.({
|
|
169
|
+
rows: innerRows.current,
|
|
170
|
+
total: innerTotal.current
|
|
171
|
+
});
|
|
172
|
+
}, [innerRows.current, innerTotal.current]);
|
|
167
173
|
/**
|
|
168
174
|
* -------------------------------------------------------------
|
|
169
175
|
* 弹窗与曾删改部分
|