@base-stone/hooks 0.7.7 → 0.8.0

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.
@@ -60,14 +60,14 @@ declare type SelectOption<T extends string | number = string | number> = {
60
60
  data?: Record<string, unknown>;
61
61
  };
62
62
 
63
- declare type SelectOptionsResult<K extends string, T extends string | number> = {
63
+ declare type SelectOptionsResult<K extends string, T extends string | number> = Readonly<{
64
64
  loading: boolean;
65
65
  refresh: () => void;
66
66
  } & {
67
67
  [P in `${K}Options`]: (SelectOption<T> & Record<string, any>)[];
68
68
  } & {
69
69
  [P in `${K}Map`]: MapData<T>;
70
- };
70
+ }>;
71
71
 
72
72
  declare interface SuccessFn {
73
73
  (data: Record<string, any>): void;
@@ -113,7 +113,7 @@ declare interface TableResponse<T> {
113
113
  * @param suffixes 模态框后缀数组
114
114
  * @returns 包含所有模态框实例的对象,以及统一的 toggle/open/close 函数
115
115
  */
116
- export declare function useCreateModal<T extends readonly string[] = readonly string[]>(suffixes: T): Record<`${T[number]}Modal`, ModalInstance> & {
116
+ export declare function useCreateModal<const T extends readonly string[] = readonly string[]>(suffixes: T): Record<`${T[number]}Modal`, ModalInstance> & {
117
117
  toggle: (type: string, data?: any) => void;
118
118
  open: (type: string, data?: any) => void;
119
119
  close: (type: string) => void;
@@ -121,8 +121,8 @@ export declare function useCreateModal<T extends readonly string[] = readonly st
121
121
 
122
122
  export declare function useFormSubmit(requestFn: RequestFn, successFn: SuccessFn): FormSubmitResult;
123
123
 
124
- export declare function useSelectOptions<K extends string = string, T extends string | number = string | number>(getRequestFn: (params: Record<string, any>) => Promise<any>, selectConfig: SelectConfig<K>): SelectOptionsResult<K, T>;
124
+ export declare function useSelectOptions<T extends string | number = string | number, K extends string = string>(getRequestFn: (params: Record<string, any>) => Promise<any>, selectConfig: SelectConfig<K>): SelectOptionsResult<K, T>;
125
125
 
126
- export declare function useTableList<T>(getRequestFn: (data: QueryParamsData) => Promise<TableResponse<T>>, initParams?: Record<string, any>): TableListResult<T>;
126
+ export declare function useTableList<T extends Record<string, any> = Record<string, any>>(getRequestFn: (data: QueryParamsData) => Promise<TableResponse<T>>, initParams?: Record<string, any>): TableListResult<T>;
127
127
 
128
128
  export { }
@@ -1,13 +1,13 @@
1
- import { useState as M, useRef as J, useMemo as j, useCallback as m, useEffect as C, useId as W } from "react";
1
+ import { useState as M, useRef as J, useMemo as j, useCallback as m, useEffect as L, useId as W } from "react";
2
2
  import { Empty as q, App as X } from "antd";
3
3
  import { create as K } from "zustand";
4
- var k = { exports: {} }, x = {};
4
+ var P = { exports: {} }, x = {};
5
5
  var D;
6
6
  function ee() {
7
7
  if (D) return x;
8
8
  D = 1;
9
- var i = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
10
- function a(e, s, n) {
9
+ var i = /* @__PURE__ */ Symbol.for("react.transitional.element"), a = /* @__PURE__ */ Symbol.for("react.fragment");
10
+ function r(e, s, n) {
11
11
  var d = null;
12
12
  if (n !== void 0 && (d = "" + n), s.key !== void 0 && (d = "" + s.key), "key" in s) {
13
13
  n = {};
@@ -22,11 +22,11 @@ function ee() {
22
22
  props: n
23
23
  };
24
24
  }
25
- return x.Fragment = r, x.jsx = a, x.jsxs = a, x;
25
+ return x.Fragment = a, x.jsx = r, x.jsxs = r, x;
26
26
  }
27
27
  var I;
28
28
  function te() {
29
- return I || (I = 1, k.exports = ee()), k.exports;
29
+ return I || (I = 1, P.exports = ee()), P.exports;
30
30
  }
31
31
  var oe = te();
32
32
  const b = {
@@ -35,12 +35,12 @@ const b = {
35
35
  pageSize: 10
36
36
  };
37
37
  function ie(i) {
38
- Object.keys(i).forEach((r) => {
39
- b[r] = i[r];
38
+ Object.keys(i).forEach((a) => {
39
+ b[a] = i[a];
40
40
  });
41
41
  }
42
- function le(i, r = {}) {
43
- const { rowSelection: a, ...e } = r, s = b.pageSize, [n, d] = M({
42
+ function le(i, a = {}) {
43
+ const { rowSelection: r, ...e } = a, s = b.pageSize, [n, d] = M({
44
44
  pagination: {
45
45
  showSizeChanger: !0,
46
46
  showQuickJumper: !0,
@@ -55,12 +55,12 @@ function le(i, r = {}) {
55
55
  ...e
56
56
  }
57
57
  }), { pagination: l, list: o, queryParams: t } = n, { pageNo: p, pageSize: u } = t, [f, R] = M(!0), $ = J(t), [y, h] = M([]), E = j(() => {
58
- if (a)
58
+ if (r)
59
59
  return {
60
60
  selectedRowKeys: y,
61
61
  onChange: (c) => h(c)
62
62
  };
63
- }, [a, y]), v = m(
63
+ }, [r, y]), v = m(
64
64
  (c) => `共 ${c} 条记录 第 ${p}/${Math.ceil(c / u)} 页 `,
65
65
  [p, u]
66
66
  ), g = m(
@@ -69,20 +69,20 @@ function le(i, r = {}) {
69
69
  R(!0);
70
70
  const S = { ...e, pageSize: u, ...c };
71
71
  c.pageNo === void 0 && (S.pageNo = 1), c.pageSize === void 0 && (S.pageSize = u);
72
- const { data: z } = await i(S), { list: w = [], totalCount: P = 0 } = z || {};
73
- a && h([]), d({
74
- list: w,
72
+ const { data: z } = await i(S), { list: k = [], totalCount: w = 0 } = z || {};
73
+ r && h([]), d({
74
+ list: k,
75
75
  queryParams: S,
76
76
  pagination: {
77
77
  ...l,
78
78
  current: _,
79
79
  pageSize: S.pageSize,
80
- total: P
80
+ total: w
81
81
  }
82
82
  }), R(!1);
83
83
  },
84
- [t, e, a, u, i, l]
85
- ), L = m(
84
+ [t, e, r, u, i, l]
85
+ ), C = m(
86
86
  (c) => {
87
87
  g({ ...t, ...c, pageNo: 1 });
88
88
  },
@@ -99,13 +99,13 @@ function le(i, r = {}) {
99
99
  [g, u]
100
100
  ), N = m(
101
101
  (c, _, S, z) => {
102
- const { action: w } = z;
103
- if (["paginate", "sort"].includes(w)) {
104
- const { current: P, pageSize: V } = c, { field: Q, order: A } = S, [Y, Z] = b.sortField, [B, H] = b.sortOrder, U = {
102
+ const { action: k } = z;
103
+ if (["paginate", "sort"].includes(k)) {
104
+ const { current: w, pageSize: V } = c, { field: Q, order: A } = S, [Y, Z] = b.sortField, [B, H] = b.sortOrder, U = {
105
105
  ...t,
106
106
  [Y]: A ? A === "ascend" ? B : H : void 0,
107
107
  [Z]: Q,
108
- pageNo: P,
108
+ pageNo: w,
109
109
  pageSize: V
110
110
  };
111
111
  g(U);
@@ -125,11 +125,11 @@ function le(i, r = {}) {
125
125
  emptyText: f ? "" : /* @__PURE__ */ oe.jsx(q, { image: q.PRESENTED_IMAGE_SIMPLE })
126
126
  }
127
127
  }), [E, l, v, f, o, N]);
128
- return C(() => {
129
- L($.current);
128
+ return L(() => {
129
+ C($.current);
130
130
  }, []), {
131
131
  queryParams: t,
132
- reload: L,
132
+ reload: C,
133
133
  refresh: O,
134
134
  reset: F,
135
135
  selectedRowKeys: y,
@@ -138,53 +138,53 @@ function le(i, r = {}) {
138
138
  }
139
139
  const T = K((i) => ({
140
140
  modals: {},
141
- toggleModal: (r, a) => i((e) => {
142
- const n = e.modals[r]?.visible || !1;
141
+ toggleModal: (a, r) => i((e) => {
142
+ const n = e.modals[a]?.visible || !1;
143
143
  return {
144
144
  modals: {
145
145
  ...e.modals,
146
- [r]: {
146
+ [a]: {
147
147
  visible: !n,
148
- data: n ? {} : a || {}
148
+ data: n ? {} : r || {}
149
149
  }
150
150
  }
151
151
  };
152
152
  }),
153
- setModal: (r, a, e) => i((s) => ({
153
+ setModal: (a, r, e) => i((s) => ({
154
154
  modals: {
155
155
  ...s.modals,
156
- [r]: {
157
- visible: a,
158
- data: a ? e || {} : {}
156
+ [a]: {
157
+ visible: r,
158
+ data: r ? e || {} : {}
159
159
  }
160
160
  }
161
161
  })),
162
- clearModals: (r) => i((a) => {
163
- const e = { ...a.modals };
164
- return r.forEach((s) => {
162
+ clearModals: (a) => i((r) => {
163
+ const e = { ...r.modals };
164
+ return a.forEach((s) => {
165
165
  delete e[s];
166
166
  }), { modals: e };
167
167
  })
168
168
  }));
169
169
  function ce(i) {
170
- const r = T((o) => o.modals), a = T((o) => o.toggleModal), e = T((o) => o.setModal), s = T((o) => o.clearModals), n = W(), d = J(i.map((o) => `${n}-${o}`));
171
- C(() => () => {
170
+ const a = T((o) => o.modals), r = T((o) => o.toggleModal), e = T((o) => o.setModal), s = T((o) => o.clearModals), n = W(), d = J(i.map((o) => `${n}-${o}`));
171
+ L(() => () => {
172
172
  s(d.current);
173
173
  }, []);
174
174
  const l = {};
175
175
  for (const o of i) {
176
- const t = `${n}-${o}`, u = r[t] ?? { visible: !1, data: {} };
176
+ const t = `${n}-${o}`, u = a[t] ?? { visible: !1, data: {} };
177
177
  l[`${o}Modal`] = {
178
178
  visible: u.visible,
179
179
  data: u.data,
180
- toggle: (f) => a(t, f),
180
+ toggle: (f) => r(t, f),
181
181
  open: (f) => e(t, !0, f),
182
182
  close: () => e(t, !1)
183
183
  };
184
184
  }
185
185
  return l.toggle = (o, t) => {
186
186
  const p = `${n}-${o}`;
187
- a(p, t);
187
+ r(p, t);
188
188
  }, l.open = (o, t) => {
189
189
  const p = `${n}-${o}`;
190
190
  e(p, !0, t);
@@ -193,13 +193,13 @@ function ce(i) {
193
193
  e(t, !1);
194
194
  }, l;
195
195
  }
196
- const se = (i, r = "value", a = "label") => new Map(i.map((e) => [e[r], e[a]]));
197
- function ue(i, r) {
198
- const [a, e] = M([]), [s, n] = M(/* @__PURE__ */ new Map()), [d, l] = M(!0), { params: o, selectKey: t, fieldNames: p } = r, u = async () => {
196
+ const se = (i, a = "value", r = "label") => new Map(i.map((e) => [e[a], e[r]]));
197
+ function ue(i, a) {
198
+ const [r, e] = M([]), [s, n] = M(/* @__PURE__ */ new Map()), [d, l] = M(!0), { params: o, fieldNames: t } = a, p = a.selectKey, u = async () => {
199
199
  l(!0);
200
200
  const { data: R } = await i(o), $ = R || [];
201
- if (p) {
202
- const { label: y, value: h } = p, E = $.map((v) => ({
201
+ if (t) {
202
+ const { label: y, value: h } = t, E = $.map((v) => ({
203
203
  data: v,
204
204
  label: v[y],
205
205
  value: v[h]
@@ -211,28 +211,28 @@ function ue(i, r) {
211
211
  }, f = m(() => {
212
212
  u();
213
213
  }, [u]);
214
- return C(() => {
214
+ return L(() => {
215
215
  f();
216
216
  }, []), {
217
217
  loading: d,
218
218
  refresh: f,
219
- [`${t}Options`]: a,
220
- [`${t}Map`]: s
219
+ [`${p}Options`]: r,
220
+ [`${p}Map`]: s
221
221
  };
222
222
  }
223
- function de(i, r) {
224
- const [a, e] = M(!1), { message: s } = X.useApp(), n = m(async (d) => {
223
+ function de(i, a) {
224
+ const [r, e] = M(!1), { message: s } = X.useApp(), n = m(async (d) => {
225
225
  try {
226
226
  const l = await i(d);
227
227
  e(!0);
228
228
  const { status: o, info: t } = l;
229
- o == "success" && (r(l), s.success(t));
229
+ o == "success" && (a(l), s.success(t));
230
230
  } catch {
231
231
  }
232
232
  e(!1);
233
- }, [i, r, s]);
233
+ }, [i, a, s]);
234
234
  return {
235
- loading: a,
235
+ loading: r,
236
236
  submit: n
237
237
  };
238
238
  }
@@ -1 +1 @@
1
- (function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react"),require("antd"),require("zustand")):typeof define=="function"&&define.amd?define(["exports","react","antd","zustand"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.DesignReact={},d.React,d.antd,d.zustand))})(this,(function(d,e,z,O){"use strict";var $={exports:{}},b={};var L;function D(){if(L)return b;L=1;var l=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function n(t,a,i){var f=null;if(i!==void 0&&(f=""+i),a.key!==void 0&&(f=""+a.key),"key"in a){i={};for(var u in a)u!=="key"&&(i[u]=a[u])}else i=a;return a=i.ref,{$$typeof:l,type:t,key:f,ref:a!==void 0?a:null,props:i}}return b.Fragment=r,b.jsx=n,b.jsxs=n,b}var N;function F(){return N||(N=1,$.exports=D()),$.exports}var I=F();const C={sortField:["orderType","orderField"],sortOrder:["ASC","DESC"],pageSize:10};function J(l){Object.keys(l).forEach(r=>{C[r]=l[r]})}function G(l,r={}){const{rowSelection:n,...t}=r,a=C.pageSize,[i,f]=e.useState({pagination:{showSizeChanger:!0,showQuickJumper:!0,total:0,pageSize:a,current:1},list:[],queryParams:{pageNo:1,pageSize:a,...t}}),{pagination:u,list:o,queryParams:s}=i,{pageNo:g,pageSize:p}=s,[S,T]=e.useState(!0),h=e.useRef(s),[E,k]=e.useState([]),v=e.useMemo(()=>{if(n)return{selectedRowKeys:E,onChange:c=>k(c)}},[n,E]),y=e.useCallback(c=>`共 ${c} 条记录 第 ${g}/${Math.ceil(c/p)} 页 `,[g,p]),m=e.useCallback(async c=>{const{pageNo:q}=c;T(!0);const M={...t,pageSize:p,...c};c.pageNo===void 0&&(M.pageNo=1),c.pageSize===void 0&&(M.pageSize=p);const{data:x}=await l(M),{list:P=[],totalCount:w=0}=x||{};n&&k([]),f({list:P,queryParams:M,pagination:{...u,current:q,pageSize:M.pageSize,total:w}}),T(!1)},[s,t,n,p,l,u]),_=e.useCallback(c=>{m({...s,...c,pageNo:1})},[m,s]),B=e.useCallback(c=>{m({...s,...c})},[m,s]),H=e.useCallback(c=>{m({...c,pageSize:p,pageNo:1})},[m,p]),j=e.useCallback((c,q,M,x)=>{const{action:P}=x;if(["paginate","sort"].includes(P)){const{current:w,pageSize:W}=c,{field:X,order:A}=M,[K,ee]=C.sortField,[te,se]=C.sortOrder,oe={...s,[K]:A?A==="ascend"?te:se:void 0,[ee]:X,pageNo:w,pageSize:W};m(oe)}},[s,m]),U=e.useMemo(()=>({bordered:!0,size:"middle",sticky:!0,rowSelection:v,pagination:{...u,showTotal:y},loading:S,dataSource:o,onChange:j,locale:{emptyText:S?"":I.jsx(z.Empty,{image:z.Empty.PRESENTED_IMAGE_SIMPLE})}}),[v,u,y,S,o,j]);return e.useEffect(()=>{_(h.current)},[]),{queryParams:s,reload:_,refresh:B,reset:H,selectedRowKeys:E,tableProps:U}}const R=O.create(l=>({modals:{},toggleModal:(r,n)=>l(t=>{const i=t.modals[r]?.visible||!1;return{modals:{...t.modals,[r]:{visible:!i,data:i?{}:n||{}}}}}),setModal:(r,n,t)=>l(a=>({modals:{...a.modals,[r]:{visible:n,data:n?t||{}:{}}}})),clearModals:r=>l(n=>{const t={...n.modals};return r.forEach(a=>{delete t[a]}),{modals:t}})}));function V(l){const r=R(o=>o.modals),n=R(o=>o.toggleModal),t=R(o=>o.setModal),a=R(o=>o.clearModals),i=e.useId(),f=e.useRef(l.map(o=>`${i}-${o}`));e.useEffect(()=>()=>{a(f.current)},[]);const u={};for(const o of l){const s=`${i}-${o}`,p=r[s]??{visible:!1,data:{}};u[`${o}Modal`]={visible:p.visible,data:p.data,toggle:S=>n(s,S),open:S=>t(s,!0,S),close:()=>t(s,!1)}}return u.toggle=(o,s)=>{const g=`${i}-${o}`;n(g,s)},u.open=(o,s)=>{const g=`${i}-${o}`;t(g,!0,s)},u.close=o=>{const s=`${i}-${o}`;t(s,!1)},u}const Q=(l,r="value",n="label")=>new Map(l.map(t=>[t[r],t[n]]));function Y(l,r){const[n,t]=e.useState([]),[a,i]=e.useState(new Map),[f,u]=e.useState(!0),{params:o,selectKey:s,fieldNames:g}=r,p=async()=>{u(!0);const{data:T}=await l(o),h=T||[];if(g){const{label:E,value:k}=g,v=h.map(y=>({data:y,label:y[E],value:y[k]}));t(v),i(Q(v))}else t(h);u(!1)},S=e.useCallback(()=>{p()},[p]);return e.useEffect(()=>{S()},[]),{loading:f,refresh:S,[`${s}Options`]:n,[`${s}Map`]:a}}function Z(l,r){const[n,t]=e.useState(!1),{message:a}=z.App.useApp(),i=e.useCallback(async f=>{try{const u=await l(f);t(!0);const{status:o,info:s}=u;o=="success"&&(r(u),a.success(s))}catch{}t(!1)},[l,r,a]);return{loading:n,submit:i}}d.configureTableOption=J,d.useCreateModal=V,d.useFormSubmit=Z,d.useSelectOptions=Y,d.useTableList=G,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react"),require("antd"),require("zustand")):typeof define=="function"&&define.amd?define(["exports","react","antd","zustand"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.DesignReact={},d.React,d.antd,d.zustand))})(this,(function(d,e,z,O){"use strict";var $={exports:{}},b={};var L;function D(){if(L)return b;L=1;var l=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(t,a,i){var f=null;if(i!==void 0&&(f=""+i),a.key!==void 0&&(f=""+a.key),"key"in a){i={};for(var u in a)u!=="key"&&(i[u]=a[u])}else i=a;return a=i.ref,{$$typeof:l,type:t,key:f,ref:a!==void 0?a:null,props:i}}return b.Fragment=n,b.jsx=r,b.jsxs=r,b}var N;function F(){return N||(N=1,$.exports=D()),$.exports}var I=F();const k={sortField:["orderType","orderField"],sortOrder:["ASC","DESC"],pageSize:10};function J(l){Object.keys(l).forEach(n=>{k[n]=l[n]})}function G(l,n={}){const{rowSelection:r,...t}=n,a=k.pageSize,[i,f]=e.useState({pagination:{showSizeChanger:!0,showQuickJumper:!0,total:0,pageSize:a,current:1},list:[],queryParams:{pageNo:1,pageSize:a,...t}}),{pagination:u,list:o,queryParams:s}=i,{pageNo:g,pageSize:p}=s,[S,T]=e.useState(!0),h=e.useRef(s),[E,C]=e.useState([]),v=e.useMemo(()=>{if(r)return{selectedRowKeys:E,onChange:c=>C(c)}},[r,E]),y=e.useCallback(c=>`共 ${c} 条记录 第 ${g}/${Math.ceil(c/p)} 页 `,[g,p]),m=e.useCallback(async c=>{const{pageNo:q}=c;T(!0);const M={...t,pageSize:p,...c};c.pageNo===void 0&&(M.pageNo=1),c.pageSize===void 0&&(M.pageSize=p);const{data:x}=await l(M),{list:P=[],totalCount:w=0}=x||{};r&&C([]),f({list:P,queryParams:M,pagination:{...u,current:q,pageSize:M.pageSize,total:w}}),T(!1)},[s,t,r,p,l,u]),_=e.useCallback(c=>{m({...s,...c,pageNo:1})},[m,s]),B=e.useCallback(c=>{m({...s,...c})},[m,s]),H=e.useCallback(c=>{m({...c,pageSize:p,pageNo:1})},[m,p]),j=e.useCallback((c,q,M,x)=>{const{action:P}=x;if(["paginate","sort"].includes(P)){const{current:w,pageSize:W}=c,{field:X,order:A}=M,[K,ee]=k.sortField,[te,se]=k.sortOrder,oe={...s,[K]:A?A==="ascend"?te:se:void 0,[ee]:X,pageNo:w,pageSize:W};m(oe)}},[s,m]),U=e.useMemo(()=>({bordered:!0,size:"middle",sticky:!0,rowSelection:v,pagination:{...u,showTotal:y},loading:S,dataSource:o,onChange:j,locale:{emptyText:S?"":I.jsx(z.Empty,{image:z.Empty.PRESENTED_IMAGE_SIMPLE})}}),[v,u,y,S,o,j]);return e.useEffect(()=>{_(h.current)},[]),{queryParams:s,reload:_,refresh:B,reset:H,selectedRowKeys:E,tableProps:U}}const R=O.create(l=>({modals:{},toggleModal:(n,r)=>l(t=>{const i=t.modals[n]?.visible||!1;return{modals:{...t.modals,[n]:{visible:!i,data:i?{}:r||{}}}}}),setModal:(n,r,t)=>l(a=>({modals:{...a.modals,[n]:{visible:r,data:r?t||{}:{}}}})),clearModals:n=>l(r=>{const t={...r.modals};return n.forEach(a=>{delete t[a]}),{modals:t}})}));function V(l){const n=R(o=>o.modals),r=R(o=>o.toggleModal),t=R(o=>o.setModal),a=R(o=>o.clearModals),i=e.useId(),f=e.useRef(l.map(o=>`${i}-${o}`));e.useEffect(()=>()=>{a(f.current)},[]);const u={};for(const o of l){const s=`${i}-${o}`,p=n[s]??{visible:!1,data:{}};u[`${o}Modal`]={visible:p.visible,data:p.data,toggle:S=>r(s,S),open:S=>t(s,!0,S),close:()=>t(s,!1)}}return u.toggle=(o,s)=>{const g=`${i}-${o}`;r(g,s)},u.open=(o,s)=>{const g=`${i}-${o}`;t(g,!0,s)},u.close=o=>{const s=`${i}-${o}`;t(s,!1)},u}const Q=(l,n="value",r="label")=>new Map(l.map(t=>[t[n],t[r]]));function Y(l,n){const[r,t]=e.useState([]),[a,i]=e.useState(new Map),[f,u]=e.useState(!0),{params:o,fieldNames:s}=n,g=n.selectKey,p=async()=>{u(!0);const{data:T}=await l(o),h=T||[];if(s){const{label:E,value:C}=s,v=h.map(y=>({data:y,label:y[E],value:y[C]}));t(v),i(Q(v))}else t(h);u(!1)},S=e.useCallback(()=>{p()},[p]);return e.useEffect(()=>{S()},[]),{loading:f,refresh:S,[`${g}Options`]:r,[`${g}Map`]:a}}function Z(l,n){const[r,t]=e.useState(!1),{message:a}=z.App.useApp(),i=e.useCallback(async f=>{try{const u=await l(f);t(!0);const{status:o,info:s}=u;o=="success"&&(n(u),a.success(s))}catch{}t(!1)},[l,n,a]);return{loading:r,submit:i}}d.configureTableOption=J,d.useCreateModal=V,d.useFormSubmit=Z,d.useSelectOptions=Y,d.useTableList=G,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@base-stone/hooks",
3
3
  "license": "MIT",
4
- "version": "0.7.7",
4
+ "version": "0.8.0",
5
5
  "author": {
6
6
  "name": "yeliang",
7
7
  "email": "leafront@126.com"