@base-stone/hooks 1.2.2 → 1.2.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/dist/design-hooks.es.prod.d.ts +17 -16
- package/dist/design-hooks.es.prod.js +190 -192
- package/package.json +6 -6
|
@@ -33,7 +33,7 @@ declare interface GlobalTableConfig {
|
|
|
33
33
|
pageSize: number;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
declare type MapData<
|
|
36
|
+
declare type MapData<K extends string | number = string | number> = Map<K, string | number | undefined>;
|
|
37
37
|
|
|
38
38
|
declare interface ModalConfig<T = Record<string, any>> {
|
|
39
39
|
width: number;
|
|
@@ -72,11 +72,11 @@ declare type PickFunction<T extends noop> = (this: ThisParameterType<T>, ...args
|
|
|
72
72
|
|
|
73
73
|
declare type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
74
74
|
|
|
75
|
-
declare interface QueryOptions<
|
|
75
|
+
declare interface QueryOptions<T = Record<string, any>> {
|
|
76
76
|
queryFn: (data: QueryParamsData_2) => Promise<QueryResponse_2<T>>;
|
|
77
77
|
params?: Record<string, any> | undefined;
|
|
78
78
|
dataType: DataType;
|
|
79
|
-
dataKey:
|
|
79
|
+
dataKey: string;
|
|
80
80
|
transform?: (result: Record<string, any>) => Record<string, any>[];
|
|
81
81
|
initialValue?: Record<string, any> | Record<string, any>[];
|
|
82
82
|
}
|
|
@@ -101,11 +101,11 @@ declare interface QueryResponse_2<T> {
|
|
|
101
101
|
data: T;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
declare type QueryResult<
|
|
104
|
+
declare type QueryResult<T = Record<string, any>> = {
|
|
105
105
|
loading: boolean;
|
|
106
106
|
refresh: (params?: Record<string, any> | undefined) => void;
|
|
107
107
|
} & {
|
|
108
|
-
[P in
|
|
108
|
+
[P in string]?: T;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
declare interface RequestFn {
|
|
@@ -115,31 +115,31 @@ declare interface RequestFn {
|
|
|
115
115
|
}>;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
declare interface SelectConfig
|
|
118
|
+
declare interface SelectConfig {
|
|
119
119
|
queryFn: (data: Record<string, any>) => Promise<QueryResponse>;
|
|
120
120
|
params?: Record<string, any>;
|
|
121
|
-
dataKey:
|
|
121
|
+
dataKey: string;
|
|
122
122
|
transform?: (result: Record<string, any>) => Record<string, any>[];
|
|
123
|
-
fieldNames
|
|
123
|
+
fieldNames: {
|
|
124
124
|
label: string;
|
|
125
125
|
value: string;
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
declare type SelectOption<
|
|
129
|
+
declare type SelectOption<K extends string | number = string | number> = {
|
|
130
130
|
label: string;
|
|
131
|
-
value:
|
|
131
|
+
value: K;
|
|
132
132
|
data?: Record<string, unknown>;
|
|
133
133
|
[key: string]: any;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
declare type SelectOptionsResult<K extends string
|
|
136
|
+
declare type SelectOptionsResult<K extends string | number> = Readonly<{
|
|
137
137
|
loading: boolean;
|
|
138
138
|
refresh: () => void;
|
|
139
139
|
} & {
|
|
140
|
-
[P in `${K}Options`]: (SelectOption<
|
|
140
|
+
[P in `${K}Options`]: (SelectOption<K> & Record<string, any>)[];
|
|
141
141
|
} & {
|
|
142
|
-
[P in `${K}Map`]?: MapData<
|
|
142
|
+
[P in `${K}Map`]?: MapData<K>;
|
|
143
143
|
}>;
|
|
144
144
|
|
|
145
145
|
declare interface SuccessFn {
|
|
@@ -149,6 +149,7 @@ declare interface SuccessFn {
|
|
|
149
149
|
declare interface TableOptions<T, P = Record<string, any>> {
|
|
150
150
|
queryFn: (data: QueryParamsData) => Promise<TableResponse<T>>;
|
|
151
151
|
params?: P;
|
|
152
|
+
transform?: (result: TableResponse<T>['data']) => TableResponse<T>['data'];
|
|
152
153
|
rowSelection?: boolean;
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -199,10 +200,10 @@ export declare function useFormSubmit(requestFn: RequestFn, successFn: SuccessFn
|
|
|
199
200
|
|
|
200
201
|
export declare function useMemoizedFn<T extends noop>(fn: T): PickFunction<T>;
|
|
201
202
|
|
|
202
|
-
export declare function useRequestQuery<
|
|
203
|
+
export declare function useRequestQuery<T = Record<string, any> | Record<string, any>[] | undefined>({ queryFn, params, dataType, dataKey, initialValue, transform }: QueryOptions<T>): QueryResult<T>;
|
|
203
204
|
|
|
204
|
-
export declare function useSelectOptions<
|
|
205
|
+
export declare function useSelectOptions<K extends string | number = string | number>({ queryFn, params, dataKey, fieldNames, transform }: SelectConfig): SelectOptionsResult<K>;
|
|
205
206
|
|
|
206
|
-
export declare function useTableList<T extends Record<string, any> = Record<string, any>>({ queryFn, params: initParams, rowSelection }: TableOptions<T>): TableResult<T>;
|
|
207
|
+
export declare function useTableList<T extends Record<string, any> = Record<string, any>>({ queryFn, params: initParams, transform, rowSelection }: TableOptions<T>): TableResult<T>;
|
|
207
208
|
|
|
208
209
|
export { }
|
|
@@ -1,281 +1,279 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { Empty as
|
|
3
|
-
import { create as
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
function t
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
for (var
|
|
15
|
-
|
|
16
|
-
} else
|
|
17
|
-
return
|
|
18
|
-
$$typeof:
|
|
19
|
-
type:
|
|
20
|
-
key:
|
|
21
|
-
ref:
|
|
22
|
-
props:
|
|
1
|
+
import { useRef as _, useMemo as I, useState as v, useEffectEvent as j, useEffect as T, useId as W, useCallback as X } from "react";
|
|
2
|
+
import { Empty as q, App as K } from "antd";
|
|
3
|
+
import { create as ee } from "zustand";
|
|
4
|
+
var F = { exports: {} }, C = {};
|
|
5
|
+
var J;
|
|
6
|
+
function te() {
|
|
7
|
+
if (J) return C;
|
|
8
|
+
J = 1;
|
|
9
|
+
var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), o = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10
|
+
function s(t, a, n) {
|
|
11
|
+
var p = null;
|
|
12
|
+
if (n !== void 0 && (p = "" + n), a.key !== void 0 && (p = "" + a.key), "key" in a) {
|
|
13
|
+
n = {};
|
|
14
|
+
for (var c in a)
|
|
15
|
+
c !== "key" && (n[c] = a[c]);
|
|
16
|
+
} else n = a;
|
|
17
|
+
return a = n.ref, {
|
|
18
|
+
$$typeof: r,
|
|
19
|
+
type: t,
|
|
20
|
+
key: p,
|
|
21
|
+
ref: a !== void 0 ? a : null,
|
|
22
|
+
props: n
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
return C.Fragment =
|
|
25
|
+
return C.Fragment = o, C.jsx = s, C.jsxs = s, C;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
27
|
+
var H;
|
|
28
|
+
function ae() {
|
|
29
|
+
return H || (H = 1, F.exports = te()), F.exports;
|
|
30
30
|
}
|
|
31
|
-
var
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
return
|
|
38
|
-
}),
|
|
31
|
+
var oe = ae();
|
|
32
|
+
function E(r) {
|
|
33
|
+
const o = _(r);
|
|
34
|
+
o.current = I(() => r, [r]);
|
|
35
|
+
const s = _(void 0);
|
|
36
|
+
return s.current || (s.current = function(...t) {
|
|
37
|
+
return o.current.apply(this, t);
|
|
38
|
+
}), s.current;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const w = {
|
|
41
41
|
sortField: ["orderType", "orderField"],
|
|
42
42
|
sortOrder: ["ASC", "DESC"],
|
|
43
43
|
pageSize: 10
|
|
44
44
|
};
|
|
45
|
-
function ie(
|
|
46
|
-
Object.keys(
|
|
47
|
-
|
|
45
|
+
function ie(r) {
|
|
46
|
+
Object.keys(r).forEach((o) => {
|
|
47
|
+
w[o] = r[o];
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
function ce({
|
|
51
|
-
queryFn:
|
|
52
|
-
params:
|
|
51
|
+
queryFn: r,
|
|
52
|
+
params: o,
|
|
53
|
+
transform: s,
|
|
53
54
|
rowSelection: t
|
|
54
55
|
}) {
|
|
55
|
-
const
|
|
56
|
+
const a = w.pageSize, [n, p] = v({
|
|
56
57
|
pagination: {
|
|
57
58
|
showSizeChanger: !0,
|
|
58
59
|
showQuickJumper: !0,
|
|
59
60
|
total: 0,
|
|
60
|
-
pageSize:
|
|
61
|
+
pageSize: a,
|
|
61
62
|
current: 1
|
|
62
63
|
},
|
|
63
64
|
list: [],
|
|
64
65
|
queryParams: {
|
|
65
66
|
pageNo: 1,
|
|
66
|
-
pageSize:
|
|
67
|
-
...
|
|
67
|
+
pageSize: a,
|
|
68
|
+
...o
|
|
68
69
|
}
|
|
69
|
-
}), { pagination:
|
|
70
|
+
}), { pagination: c, list: f, queryParams: e } = n, { pageNo: l, pageSize: u } = e, [i, m] = v(!0), [g, y] = v([]), b = I(() => {
|
|
70
71
|
if (t)
|
|
71
72
|
return {
|
|
72
|
-
selectedRowKeys:
|
|
73
|
-
onChange: (d) =>
|
|
73
|
+
selectedRowKeys: g,
|
|
74
|
+
onChange: (d) => y(d)
|
|
74
75
|
};
|
|
75
|
-
}, [t,
|
|
76
|
-
(d) => `共 ${d} 条记录 第 ${
|
|
77
|
-
),
|
|
78
|
-
const { pageNo:
|
|
79
|
-
|
|
80
|
-
const M = { ...
|
|
81
|
-
d.pageNo === void 0 && (M.pageNo = 1), d.pageSize === void 0 && (M.pageSize =
|
|
82
|
-
const { data:
|
|
83
|
-
t &&
|
|
84
|
-
list:
|
|
76
|
+
}, [t, g]), R = E(
|
|
77
|
+
(d) => `共 ${d} 条记录 第 ${l}/${Math.ceil(d / u)} 页 `
|
|
78
|
+
), S = async (d) => {
|
|
79
|
+
const { pageNo: A } = d;
|
|
80
|
+
m(!0);
|
|
81
|
+
const M = { ...o, pageSize: u, ...d };
|
|
82
|
+
d.pageNo === void 0 && (M.pageNo = 1), d.pageSize === void 0 && (M.pageSize = u);
|
|
83
|
+
const { data: D } = await r(M), k = s ? s(D) : D, { list: N = [], totalCount: O = 0 } = k || {};
|
|
84
|
+
t && y([]), p({
|
|
85
|
+
list: N,
|
|
85
86
|
queryParams: M,
|
|
86
87
|
pagination: {
|
|
87
|
-
...
|
|
88
|
-
current:
|
|
88
|
+
...c,
|
|
89
|
+
current: A,
|
|
89
90
|
pageSize: M.pageSize,
|
|
90
|
-
total:
|
|
91
|
+
total: O
|
|
91
92
|
}
|
|
92
|
-
}),
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
}, w = (d) => {
|
|
98
|
-
v({ ...l, ...d });
|
|
93
|
+
}), m(!1);
|
|
94
|
+
}, x = j(() => {
|
|
95
|
+
S({ ...e, pageNo: 1 });
|
|
96
|
+
}), P = (d) => {
|
|
97
|
+
S({ ...e, ...d, pageNo: 1 });
|
|
99
98
|
}, h = (d) => {
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
99
|
+
S({ ...e, ...d });
|
|
100
|
+
}, z = (d) => {
|
|
101
|
+
S({ ...d, pageSize: u, pageNo: 1 });
|
|
102
|
+
}, V = (d, A, M, D) => {
|
|
103
|
+
const { action: k } = D;
|
|
104
|
+
if (["paginate", "sort"].includes(k)) {
|
|
105
|
+
const { current: N, pageSize: O } = d, { field: G, order: L } = M, [Q, Y] = w.sortField, [Z, B] = w.sortOrder, U = {
|
|
106
|
+
...e,
|
|
107
|
+
[Q]: L ? L === "ascend" ? Z : B : void 0,
|
|
108
|
+
[Y]: G,
|
|
109
|
+
pageNo: N,
|
|
110
|
+
pageSize: O
|
|
110
111
|
};
|
|
111
|
-
|
|
112
|
+
S(U);
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
|
-
return
|
|
115
|
-
|
|
115
|
+
return T(() => {
|
|
116
|
+
x();
|
|
116
117
|
}, []), {
|
|
117
|
-
queryParams:
|
|
118
|
-
search:
|
|
119
|
-
refresh:
|
|
120
|
-
reset:
|
|
121
|
-
selectedRowKeys:
|
|
118
|
+
queryParams: e,
|
|
119
|
+
search: E(P),
|
|
120
|
+
refresh: E(h),
|
|
121
|
+
reset: E(z),
|
|
122
|
+
selectedRowKeys: g,
|
|
122
123
|
tableProps: {
|
|
123
124
|
bordered: !0,
|
|
124
125
|
size: "middle",
|
|
125
126
|
sticky: !0,
|
|
126
127
|
rowSelection: b,
|
|
127
|
-
loading:
|
|
128
|
-
dataSource:
|
|
129
|
-
pagination: { ...
|
|
130
|
-
onChange:
|
|
128
|
+
loading: i,
|
|
129
|
+
dataSource: f,
|
|
130
|
+
pagination: { ...c, showTotal: R },
|
|
131
|
+
onChange: E(V),
|
|
131
132
|
locale: {
|
|
132
|
-
emptyText:
|
|
133
|
+
emptyText: i ? "" : /* @__PURE__ */ oe.jsx(q, { image: q.PRESENTED_IMAGE_SIMPLE })
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
|
-
const
|
|
138
|
+
const $ = ee((r) => ({
|
|
138
139
|
modals: {},
|
|
139
|
-
toggleModal: (
|
|
140
|
-
const
|
|
140
|
+
toggleModal: (o, s) => r((t) => {
|
|
141
|
+
const n = t.modals[o]?.visible || !1;
|
|
141
142
|
return {
|
|
142
143
|
modals: {
|
|
143
|
-
...
|
|
144
|
-
[
|
|
145
|
-
visible: !
|
|
146
|
-
data:
|
|
144
|
+
...t.modals,
|
|
145
|
+
[o]: {
|
|
146
|
+
visible: !n,
|
|
147
|
+
data: n ? {} : s || {}
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
};
|
|
150
151
|
}),
|
|
151
|
-
setModal: (
|
|
152
|
+
setModal: (o, s, t) => r((a) => ({
|
|
152
153
|
modals: {
|
|
153
|
-
...
|
|
154
|
-
[
|
|
155
|
-
visible:
|
|
156
|
-
data:
|
|
154
|
+
...a.modals,
|
|
155
|
+
[o]: {
|
|
156
|
+
visible: s,
|
|
157
|
+
data: s ? t || {} : {}
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
})),
|
|
160
|
-
clearModals: (
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
delete
|
|
164
|
-
}), { modals:
|
|
161
|
+
clearModals: (o) => r((s) => {
|
|
162
|
+
const t = { ...s.modals };
|
|
163
|
+
return o.forEach((a) => {
|
|
164
|
+
delete t[a];
|
|
165
|
+
}), { modals: t };
|
|
165
166
|
})
|
|
166
167
|
}));
|
|
167
|
-
function le(
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
(
|
|
168
|
+
function le(r) {
|
|
169
|
+
const o = $((e) => e.modals), s = $((e) => e.toggleModal), t = $((e) => e.setModal), a = $((e) => e.clearModals), n = W(), p = _([]), c = Object.keys(r);
|
|
170
|
+
T(() => (p.current = c.map(
|
|
171
|
+
(e) => `${n}-${e}`
|
|
171
172
|
), () => {
|
|
172
|
-
|
|
173
|
+
a(p.current);
|
|
173
174
|
}), []);
|
|
174
|
-
const
|
|
175
|
-
return
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
visible:
|
|
179
|
-
data:
|
|
175
|
+
const f = {};
|
|
176
|
+
return c.forEach((e) => {
|
|
177
|
+
const l = `${n}-${e}`, u = o[l] ?? { visible: !1, data: {} }, i = r[e], m = typeof i.title == "function" ? i.title(u.data) : i.title;
|
|
178
|
+
f[`${e}Modal`] = {
|
|
179
|
+
visible: u.visible,
|
|
180
|
+
data: u.data,
|
|
180
181
|
modalProps: {
|
|
181
|
-
width:
|
|
182
|
+
width: i.width,
|
|
182
183
|
title: m,
|
|
183
|
-
open:
|
|
184
|
-
maskClosable:
|
|
185
|
-
centered:
|
|
186
|
-
destroyOnHidden:
|
|
187
|
-
onCancel:
|
|
184
|
+
open: u.visible,
|
|
185
|
+
maskClosable: i.maskClosable ?? !1,
|
|
186
|
+
centered: i.centered ?? !0,
|
|
187
|
+
destroyOnHidden: i.destroyOnHidden ?? !0,
|
|
188
|
+
onCancel: i.onCancel ?? (() => t(l, !1))
|
|
188
189
|
},
|
|
189
190
|
drawerProps: {
|
|
190
|
-
size:
|
|
191
|
+
size: i.width,
|
|
191
192
|
title: m,
|
|
192
|
-
open:
|
|
193
|
-
maskClosable:
|
|
194
|
-
destroyOnHidden:
|
|
195
|
-
placement:
|
|
196
|
-
onClose:
|
|
193
|
+
open: u.visible,
|
|
194
|
+
maskClosable: i.maskClosable ?? !0,
|
|
195
|
+
destroyOnHidden: i.destroyOnHidden ?? !0,
|
|
196
|
+
placement: i.placement ?? "right",
|
|
197
|
+
onClose: i.onClose ?? (() => t(l, !1))
|
|
197
198
|
},
|
|
198
|
-
toggle: (g) =>
|
|
199
|
-
open: (g) =>
|
|
200
|
-
close: () =>
|
|
199
|
+
toggle: (g) => s(l, g),
|
|
200
|
+
open: (g) => t(l, !0, g),
|
|
201
|
+
close: () => t(l, !1)
|
|
201
202
|
};
|
|
202
|
-
}),
|
|
203
|
-
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
},
|
|
203
|
+
}), f.toggle = (e, l) => {
|
|
204
|
+
s(`${n}-${e}`, l);
|
|
205
|
+
}, f.open = (e, l) => {
|
|
206
|
+
t(`${n}-${e}`, !0, l);
|
|
207
|
+
}, f.close = (e) => {
|
|
208
|
+
t(`${n}-${e}`, !1);
|
|
209
|
+
}, f;
|
|
209
210
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const [r, u] = S({
|
|
211
|
+
function de({ queryFn: r, params: o, dataKey: s, fieldNames: t, transform: a }) {
|
|
212
|
+
const [n, p] = v({
|
|
213
213
|
list: [],
|
|
214
214
|
mapData: /* @__PURE__ */ new Map()
|
|
215
|
-
}), [
|
|
216
|
-
|
|
217
|
-
const { data: g } = await
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}, i = N(o), f = y(() => {
|
|
229
|
-
o();
|
|
215
|
+
}), [c, f] = v(!0), e = async () => {
|
|
216
|
+
f(!0);
|
|
217
|
+
const { data: g } = await r(o), b = (a ? a(g) : g) || [], { label: R, value: S } = t, x = /* @__PURE__ */ new Map([]), P = b.map((h) => {
|
|
218
|
+
const z = h[S];
|
|
219
|
+
return x.set(z, R), {
|
|
220
|
+
label: h[R],
|
|
221
|
+
value: z,
|
|
222
|
+
data: h
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
p((h) => ({ ...h, list: P, mapData: x })), f(!1);
|
|
226
|
+
}, l = j(e), u = E(() => {
|
|
227
|
+
e();
|
|
230
228
|
});
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
T(() => {
|
|
230
|
+
l();
|
|
233
231
|
}, []);
|
|
234
|
-
const { list:
|
|
232
|
+
const { list: i, mapData: m } = n;
|
|
235
233
|
return {
|
|
236
|
-
loading:
|
|
237
|
-
refresh:
|
|
238
|
-
[`${
|
|
239
|
-
[`${
|
|
234
|
+
loading: c,
|
|
235
|
+
refresh: u,
|
|
236
|
+
[`${s}Options`]: i,
|
|
237
|
+
[`${s}Map`]: m
|
|
240
238
|
};
|
|
241
239
|
}
|
|
242
|
-
function ue(
|
|
243
|
-
const [
|
|
240
|
+
function ue(r, o) {
|
|
241
|
+
const [s, t] = v(!1), { message: a } = K.useApp(), n = X(async (p) => {
|
|
244
242
|
try {
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
243
|
+
t(!0);
|
|
244
|
+
const c = await r(p), { status: f, info: e } = c;
|
|
245
|
+
f == "success" && (o(c), a.success(e));
|
|
248
246
|
} catch {
|
|
249
247
|
}
|
|
250
|
-
|
|
251
|
-
}, [
|
|
248
|
+
t(!1);
|
|
249
|
+
}, [r, o, a]);
|
|
252
250
|
return {
|
|
253
|
-
loading:
|
|
254
|
-
submit:
|
|
251
|
+
loading: s,
|
|
252
|
+
submit: n
|
|
255
253
|
};
|
|
256
254
|
}
|
|
257
255
|
function pe({
|
|
258
|
-
queryFn:
|
|
259
|
-
params:
|
|
260
|
-
dataType:
|
|
261
|
-
dataKey:
|
|
262
|
-
initialValue:
|
|
263
|
-
transform:
|
|
256
|
+
queryFn: r,
|
|
257
|
+
params: o,
|
|
258
|
+
dataType: s,
|
|
259
|
+
dataKey: t,
|
|
260
|
+
initialValue: a,
|
|
261
|
+
transform: n
|
|
264
262
|
}) {
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
const { data:
|
|
268
|
-
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
|
|
263
|
+
const p = a || (s === "Array" ? [] : /* @__PURE__ */ Object.create({})), [c, f] = v(p), [e, l] = v(!1), u = async (g) => {
|
|
264
|
+
l(!0);
|
|
265
|
+
const { data: y } = await r(g ?? o), b = n ? n(y) : y;
|
|
266
|
+
f(b), l(!1);
|
|
267
|
+
}, i = j(u);
|
|
268
|
+
T(() => {
|
|
269
|
+
i();
|
|
272
270
|
}, []);
|
|
273
|
-
const m =
|
|
274
|
-
|
|
271
|
+
const m = E((g) => {
|
|
272
|
+
u(g);
|
|
275
273
|
});
|
|
276
274
|
return {
|
|
277
|
-
[
|
|
278
|
-
loading:
|
|
275
|
+
[t]: c,
|
|
276
|
+
loading: e,
|
|
279
277
|
refresh: m
|
|
280
278
|
};
|
|
281
279
|
}
|
|
@@ -283,7 +281,7 @@ export {
|
|
|
283
281
|
ie as configureTableOption,
|
|
284
282
|
le as useCreateModal,
|
|
285
283
|
ue as useFormSubmit,
|
|
286
|
-
|
|
284
|
+
E as useMemoizedFn,
|
|
287
285
|
pe as useRequestQuery,
|
|
288
286
|
de as useSelectOptions,
|
|
289
287
|
ce as useTableList
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base-stone/hooks",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "leafront",
|
|
7
7
|
"email": "leafront@126.com"
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@eslint/js": "^9.39.2",
|
|
40
|
-
"@types/node": "^25.0.
|
|
40
|
+
"@types/node": "^25.0.9",
|
|
41
41
|
"@types/react": "^19.2.8",
|
|
42
42
|
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
43
43
|
"classnames": "^2.5.1",
|
|
44
44
|
"eslint": "^9.39.2",
|
|
45
|
-
"eslint-plugin-prettier": "^5.5.
|
|
45
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
46
46
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
47
47
|
"eslint-plugin-react-refresh": "^0.4.26",
|
|
48
|
-
"prettier": "^3.
|
|
48
|
+
"prettier": "^3.8.0",
|
|
49
49
|
"rollup-plugin-shell": "^1.0.9",
|
|
50
50
|
"typescript": "^5.9.3",
|
|
51
|
-
"typescript-eslint": "^8.
|
|
51
|
+
"typescript-eslint": "^8.53.0",
|
|
52
52
|
"vite": "^7.3.1",
|
|
53
53
|
"vite-plugin-dts": "^4.5.4"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"antd": "^6.
|
|
56
|
+
"antd": "^6.2.0",
|
|
57
57
|
"react": "^19.2.3",
|
|
58
58
|
"zustand": "^5.0.10"
|
|
59
59
|
}
|