@base-stone/hooks 0.8.5 → 0.8.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.
|
@@ -22,14 +22,6 @@ declare interface GlobalTableConfig {
|
|
|
22
22
|
|
|
23
23
|
declare type MapData<T extends string | number = string | number> = Map<T, string | number | undefined>;
|
|
24
24
|
|
|
25
|
-
declare interface ModalConfig {
|
|
26
|
-
width: number;
|
|
27
|
-
title: string;
|
|
28
|
-
maskClosable?: boolean;
|
|
29
|
-
centered?: boolean;
|
|
30
|
-
destroyOnHidden?: boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
25
|
declare type ModalInstance<T = any> = {
|
|
34
26
|
visible: boolean;
|
|
35
27
|
data: T;
|
|
@@ -47,6 +39,15 @@ declare type ModalInstance<T = any> = {
|
|
|
47
39
|
close: () => void;
|
|
48
40
|
};
|
|
49
41
|
|
|
42
|
+
export declare interface ModalProps {
|
|
43
|
+
width: number;
|
|
44
|
+
title: string;
|
|
45
|
+
maskClosable?: boolean;
|
|
46
|
+
centered?: boolean;
|
|
47
|
+
destroyOnHidden?: boolean;
|
|
48
|
+
onCancel?: () => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
50
51
|
export declare interface QueryParamsData {
|
|
51
52
|
pageNo: number;
|
|
52
53
|
pageSize: number;
|
|
@@ -125,7 +126,7 @@ declare interface TableResponse<T> {
|
|
|
125
126
|
};
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
export declare function useCreateModal<const T extends Record<string,
|
|
129
|
+
export declare function useCreateModal<const T extends Record<string, ModalProps>>(configs: T): {
|
|
129
130
|
[K in keyof T as `${string & K}Modal`]: ModalInstance;
|
|
130
131
|
} & {
|
|
131
132
|
open: (type: keyof T, data?: any) => void;
|
|
@@ -29,18 +29,18 @@ function te() {
|
|
|
29
29
|
return q || (q = 1, P.exports = ee()), P.exports;
|
|
30
30
|
}
|
|
31
31
|
var oe = te();
|
|
32
|
-
const
|
|
32
|
+
const C = {
|
|
33
33
|
sortField: ["orderType", "orderField"],
|
|
34
34
|
sortOrder: ["ASC", "DESC"],
|
|
35
35
|
pageSize: 10
|
|
36
36
|
};
|
|
37
37
|
function ie(n) {
|
|
38
38
|
Object.keys(n).forEach((r) => {
|
|
39
|
-
|
|
39
|
+
C[r] = n[r];
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function le(n, r = {}) {
|
|
43
|
-
const { rowSelection: a, ...t } = r, o =
|
|
43
|
+
const { rowSelection: a, ...t } = r, o = C.pageSize, [s, f] = E({
|
|
44
44
|
pagination: {
|
|
45
45
|
showSizeChanger: !0,
|
|
46
46
|
showQuickJumper: !0,
|
|
@@ -69,7 +69,7 @@ function le(n, r = {}) {
|
|
|
69
69
|
m(!0);
|
|
70
70
|
const v = { ...t, pageSize: p, ...l };
|
|
71
71
|
l.pageNo === void 0 && (v.pageNo = 1), l.pageSize === void 0 && (v.pageSize = p);
|
|
72
|
-
const { data:
|
|
72
|
+
const { data: w } = await n(v), { list: T = [], totalCount: z = 0 } = w || {};
|
|
73
73
|
a && x([]), f({
|
|
74
74
|
list: T,
|
|
75
75
|
queryParams: v,
|
|
@@ -98,10 +98,10 @@ function le(n, r = {}) {
|
|
|
98
98
|
},
|
|
99
99
|
[u, p]
|
|
100
100
|
), _ = S(
|
|
101
|
-
(l, k, v,
|
|
102
|
-
const { action: T } =
|
|
101
|
+
(l, k, v, w) => {
|
|
102
|
+
const { action: T } = w;
|
|
103
103
|
if (["paginate", "sort"].includes(T)) {
|
|
104
|
-
const { current: z, pageSize: V } = l, { field: H, order: A } = v, [Q, Y] =
|
|
104
|
+
const { current: z, pageSize: V } = l, { field: H, order: A } = v, [Q, Y] = C.sortField, [Z, B] = C.sortOrder, U = {
|
|
105
105
|
...e,
|
|
106
106
|
[Q]: A ? A === "ascend" ? Z : B : void 0,
|
|
107
107
|
[Y]: H,
|
|
@@ -186,7 +186,7 @@ function ce(n) {
|
|
|
186
186
|
maskClosable: g.maskClosable ?? !1,
|
|
187
187
|
centered: g.centered ?? !0,
|
|
188
188
|
destroyOnHidden: g.destroyOnHidden ?? !0,
|
|
189
|
-
onCancel: t(c, !1)
|
|
189
|
+
onCancel: g.onCancel ?? t(c, !1)
|
|
190
190
|
},
|
|
191
191
|
toggle: (m) => a(c, m),
|
|
192
192
|
open: (m) => t(c, !0, m),
|