antd-crud-table 0.0.11 → 0.0.13

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.
@@ -0,0 +1 @@
1
+ "use strict";const o=require("./jsx-runtime-qcKc-DpB.cjs"),f=require("react"),n=require("./CrudTable-ck226KHr.cjs"),z=require("./useCrudTable.cjs"),T=require("./index-DygfPlBI.cjs"),_=w=>{const{columns:x,rowKey:d,title:I,defaultPageSize:y=10,hookConfig:k,enableBulkOperations:R=!1,customActions:h}=w,i=z.useCrudTable(d,{defaultPageSize:y,...k}),[v,j]=f.useState(!1),[m,S]=f.useState(null),[u,g]=f.useState([]),[p]=n.Form.useForm();f.useEffect(()=>{i.refresh()},[]);const E=x.map(e=>{const t={...e,dataIndex:e.dataIndex,title:e.title,search:e.searchable!==!1};switch(e.fieldType){case"date":return{...t,valueType:"dateTime",render:(r,s)=>{const a=s[e.dataIndex];if(!a)return"-";try{return o.jsxRuntimeExports.jsx("span",{children:n.format(n.parseISO(a),"yyyy-MM-dd HH:mm")})}catch{return o.jsxRuntimeExports.jsx("span",{children:a})}}};case"enum":return{...t,valueType:"select",valueEnum:e.enumOptions,render:(r,s)=>{var c;const a=s[e.dataIndex],l=(c=e.enumOptions)==null?void 0:c[a];return l?o.jsxRuntimeExports.jsx(n.Tag,{color:l.color,children:l.text}):a}};case"number":return{...t,valueType:"digit",render:(r,s)=>{const a=s[e.dataIndex];return typeof a=="number"?a.toLocaleString():a}};case"boolean":return{...t,valueType:"switch",render:(r,s)=>o.jsxRuntimeExports.jsx(n.Tag,{color:s[e.dataIndex]?"green":"red",children:s[e.dataIndex]?"Yes":"No"})};case"custom":return{...t,render:(r,s)=>{var a;return(a=e.customRender)==null?void 0:a.call(e,s[e.dataIndex],s)}};default:return t}});E.push({title:"Actions",valueType:"option",width:200,render:(e,t)=>{const r=[o.jsxRuntimeExports.jsx(n.Button,{type:"link",size:"small",onClick:()=>b(t),children:"Edit"},"edit"),o.jsxRuntimeExports.jsx(n.Button,{type:"link",size:"small",danger:!0,onClick:()=>q(t[d]),children:"Delete"},"delete")],s=(h==null?void 0:h(t,i))||[];return[...r,...s]}});const F=async(e,t,r)=>{try{const s={current:e.current,pageSize:e.pageSize,sortBy:Object.keys(t)[0],sortOrder:Object.values(t)[0],...r,...e},a=i.operations;if(a!=null&&a.getList){const l=await a.getList(s);return{data:l.data,success:!0,total:l.total}}return{data:i.state.data,success:!0,total:i.state.total}}catch{return T.staticMethods.error("Failed to fetch data"),{data:[],success:!1,total:0}}},b=e=>{if(S(e||null),e){const t={...e};x.forEach(r=>{const s=r.dataIndex;if(r.fieldType==="date"&&t[s])try{t[s]=n.dayjs(t[s])}catch{}}),p.setFieldsValue(t)}else p.resetFields();j(!0)},O=async()=>{var e;try{const t=await p.validateFields(),r={...t};x.forEach(s=>{var l;const a=s.dataIndex;if(s.fieldType==="date"&&t[a])try{r[a]=n.formatISO(t[a])}catch{}(l=s.formConfig)!=null&&l.transform&&(r[a]=s.formConfig.transform(t[a]))}),m&&m[d]?await i.update(m[d],r):await i.create(r),j(!1),(e=i.actionRef.current)==null||e.reload()}catch(t){console.error("Form validation failed:",t)}},q=async e=>{n.Modal.confirm({title:"Are you sure?",content:"This action cannot be undone.",okText:"Yes, Delete",okType:"danger",cancelText:"Cancel",onOk:async()=>{var r;await i.delete(e)&&((r=i.actionRef.current)==null||r.reload())}})},D=async()=>{if(u.length===0){T.staticMethods.warning("Please select items to delete");return}n.Modal.confirm({title:`Delete ${u.length} items?`,content:"This action cannot be undone.",okText:"Yes, Delete All",okType:"danger",cancelText:"Cancel",onOk:async()=>{var t;const e=u.map(r=>i.delete(r));await Promise.allSettled(e),g([]),(t=i.actionRef.current)==null||t.reload()}})},B=R?{selectedRowKeys:u,onChange:g}:void 0;return o.jsxRuntimeExports.jsxs(n.ProConfigProvider,{needDeps:!0,children:[o.jsxRuntimeExports.jsx(n.ProviderTableContainer,{headerTitle:I,rowKey:d,rowClassName:(e,t)=>t%2===0?"row-differentiator":"",actionRef:i.actionRef,columns:E,request:F,search:{labelWidth:"auto"},pagination:{pageSize:y,showSizeChanger:!0,showQuickJumper:!0},loading:i.state.loading,rowSelection:B,toolBarRender:()=>[o.jsxRuntimeExports.jsx(n.Button,{type:"primary",icon:o.jsxRuntimeExports.jsx(n.RefIcon,{}),onClick:()=>b(),children:"New"},"add"),...R&&u.length>0?[o.jsxRuntimeExports.jsxs(n.Button,{danger:!0,onClick:D,children:["Delete Selected (",u.length,")"]},"bulk-delete")]:[],o.jsxRuntimeExports.jsx(n.Dropdown,{menu:{items:[{key:"export",label:"Export",disabled:!0},{key:"refresh",label:"Refresh",onClick:()=>i.refresh()}]},children:o.jsxRuntimeExports.jsx(n.Button,{children:o.jsxRuntimeExports.jsx(n.RefIcon$1,{})})},"menu")],options:{setting:{listsHeight:400},reload:()=>i.refresh()},dateFormatter:"string"}),o.jsxRuntimeExports.jsx(n.Modal,{title:m?"Edit Item":"Create Item",open:v,onOk:O,onCancel:()=>j(!1),destroyOnClose:!0,width:600,children:o.jsxRuntimeExports.jsx(n.Form,{form:p,layout:"vertical",children:x.map(e=>{var l,c,C;if(!e.dataIndex)return null;const t=e.dataIndex,r=e.title,s=!(e.fieldEditable??!0),a=((l=e.formConfig)==null?void 0:l.rules)||((c=e.formConfig)!=null&&c.required?[{required:!0,message:`${r} is required`}]:[]);if((C=e.formConfig)!=null&&C.component)return o.jsxRuntimeExports.jsx(n.Form.Item,{name:t,label:r,rules:a,children:e.formConfig.component},t);switch(e.fieldType){case"string":return o.jsxRuntimeExports.jsx(n.Form.Item,{name:t,label:r,rules:a,children:o.jsxRuntimeExports.jsx(n.Input,{disabled:s})},t);case"number":return o.jsxRuntimeExports.jsx(n.Form.Item,{name:t,label:r,rules:a,children:o.jsxRuntimeExports.jsx(n.TypedInputNumber,{style:{width:"100%"},disabled:s})},t);case"date":return o.jsxRuntimeExports.jsx(n.Form.Item,{name:t,label:r,rules:a,children:o.jsxRuntimeExports.jsx(n.DatePicker,{style:{width:"100%"},showTime:!0,disabled:s})},t);case"boolean":return o.jsxRuntimeExports.jsx(n.Form.Item,{name:t,label:r,valuePropName:"checked",children:o.jsxRuntimeExports.jsx(n.Switch,{disabled:s})},t);case"enum":return o.jsxRuntimeExports.jsx(n.Form.Item,{name:t,label:r,rules:a,children:o.jsxRuntimeExports.jsx(n.Select,{disabled:s,placeholder:`Select ${r.toLowerCase()}`,options:Object.entries(e.enumOptions||{}).map(([M,P])=>({label:P.text,value:M}))})},t);default:return null}})})})]})};module.exports=_;
@@ -0,0 +1,34 @@
1
+ import { ProColumns } from '@ant-design/pro-components';
2
+ import { UseCrudTableConfig, CrudTableActions } from './hooks/useCrudTable';
3
+ type DataType = Record<string, any>;
4
+ type FieldType = 'string' | 'number' | 'date' | 'boolean' | 'enum' | 'custom';
5
+ interface CrudColumn<T extends DataType> extends ProColumns<T> {
6
+ fieldType?: FieldType;
7
+ enumOptions?: Record<string, {
8
+ text: string;
9
+ [key: string]: any;
10
+ }>;
11
+ customRender?: (value: any, record: T) => React.ReactNode;
12
+ formConfig?: {
13
+ required?: boolean;
14
+ component?: React.ReactNode;
15
+ transform?: (value: any) => any;
16
+ rules?: any[];
17
+ };
18
+ fieldEditable?: boolean;
19
+ searchable?: boolean;
20
+ }
21
+ interface EnhancedCrudTableConfig<T extends DataType> {
22
+ columns: CrudColumn<T>[];
23
+ rowKey: keyof T;
24
+ title: string;
25
+ defaultPageSize?: number;
26
+ hookConfig: UseCrudTableConfig<T>;
27
+ enableBulkOperations?: boolean;
28
+ enableColumnSettings?: boolean;
29
+ enableExport?: boolean;
30
+ customActions?: (record: T, actions: CrudTableActions<T>) => React.ReactNode[];
31
+ }
32
+ declare const CrudTableExperimental: <T extends DataType>(config: EnhancedCrudTableConfig<T>) => import("react/jsx-runtime").JSX.Element;
33
+ export default CrudTableExperimental;
34
+ export type { EnhancedCrudTableConfig, CrudColumn, DataType };
@@ -0,0 +1,373 @@
1
+ import { j as r } from "./jsx-runtime-Drh4NO5G.js";
2
+ import { useState as g, useEffect as A } from "react";
3
+ import { F as l, T as v, f as L, p as V, P as $, a as H, B as f, R as K, D as Y, b as J, M as b, S as Q, c as W, e as G, g as U, I as X, d as Z, h as ee } from "./CrudTable-W5dD5mDc.js";
4
+ import { useCrudTable as te } from "./useCrudTable.js";
5
+ import { s as R } from "./index-DNXRWKhU.js";
6
+ const oe = (S) => {
7
+ const { columns: m, rowKey: c, title: O, defaultPageSize: j = 10, hookConfig: D, enableBulkOperations: C = !1, customActions: x } = S, i = te(c, {
8
+ defaultPageSize: j,
9
+ ...D
10
+ }), [E, y] = g(!1), [h, F] = g(null), [d, w] = g([]), [p] = l.useForm();
11
+ A(() => {
12
+ i.refresh();
13
+ }, []);
14
+ const I = m.map((e) => {
15
+ const t = {
16
+ ...e,
17
+ dataIndex: e.dataIndex,
18
+ title: e.title,
19
+ search: e.searchable !== !1
20
+ // Default to searchable
21
+ };
22
+ switch (e.fieldType) {
23
+ case "date":
24
+ return {
25
+ ...t,
26
+ valueType: "dateTime",
27
+ render: (a, n) => {
28
+ const s = n[e.dataIndex];
29
+ if (!s) return "-";
30
+ try {
31
+ return /* @__PURE__ */ r.jsx("span", { children: L(V(s), "yyyy-MM-dd HH:mm") });
32
+ } catch {
33
+ return /* @__PURE__ */ r.jsx("span", { children: s });
34
+ }
35
+ }
36
+ };
37
+ case "enum":
38
+ return {
39
+ ...t,
40
+ valueType: "select",
41
+ valueEnum: e.enumOptions,
42
+ render: (a, n) => {
43
+ var u;
44
+ const s = n[e.dataIndex], o = (u = e.enumOptions) == null ? void 0 : u[s];
45
+ return o ? /* @__PURE__ */ r.jsx(v, { color: o.color, children: o.text }) : s;
46
+ }
47
+ };
48
+ case "number":
49
+ return {
50
+ ...t,
51
+ valueType: "digit",
52
+ render: (a, n) => {
53
+ const s = n[e.dataIndex];
54
+ return typeof s == "number" ? s.toLocaleString() : s;
55
+ }
56
+ };
57
+ case "boolean":
58
+ return {
59
+ ...t,
60
+ valueType: "switch",
61
+ render: (a, n) => /* @__PURE__ */ r.jsx(v, { color: n[e.dataIndex] ? "green" : "red", children: n[e.dataIndex] ? "Yes" : "No" })
62
+ };
63
+ case "custom":
64
+ return {
65
+ ...t,
66
+ render: (a, n) => {
67
+ var s;
68
+ return (s = e.customRender) == null ? void 0 : s.call(e, n[e.dataIndex], n);
69
+ }
70
+ };
71
+ default:
72
+ return t;
73
+ }
74
+ });
75
+ I.push({
76
+ title: "Actions",
77
+ valueType: "option",
78
+ width: 200,
79
+ render: (e, t) => {
80
+ const a = [
81
+ /* @__PURE__ */ r.jsx(
82
+ f,
83
+ {
84
+ type: "link",
85
+ size: "small",
86
+ onClick: () => T(t),
87
+ children: "Edit"
88
+ },
89
+ "edit"
90
+ ),
91
+ /* @__PURE__ */ r.jsx(
92
+ f,
93
+ {
94
+ type: "link",
95
+ size: "small",
96
+ danger: !0,
97
+ onClick: () => M(t[c]),
98
+ children: "Delete"
99
+ },
100
+ "delete"
101
+ )
102
+ ], n = (x == null ? void 0 : x(t, i)) || [];
103
+ return [...a, ...n];
104
+ }
105
+ });
106
+ const P = async (e, t, a) => {
107
+ try {
108
+ const n = {
109
+ current: e.current,
110
+ pageSize: e.pageSize,
111
+ sortBy: Object.keys(t)[0],
112
+ sortOrder: Object.values(t)[0],
113
+ ...a,
114
+ ...e
115
+ // Include search parameters
116
+ }, s = i.operations;
117
+ if (s != null && s.getList) {
118
+ const o = await s.getList(n);
119
+ return {
120
+ data: o.data,
121
+ success: !0,
122
+ total: o.total
123
+ };
124
+ }
125
+ return {
126
+ data: i.state.data,
127
+ success: !0,
128
+ total: i.state.total
129
+ };
130
+ } catch {
131
+ return R.error("Failed to fetch data"), { data: [], success: !1, total: 0 };
132
+ }
133
+ }, T = (e) => {
134
+ if (F(e || null), e) {
135
+ const t = { ...e };
136
+ m.forEach((a) => {
137
+ const n = a.dataIndex;
138
+ if (a.fieldType === "date" && t[n])
139
+ try {
140
+ t[n] = Z(t[n]);
141
+ } catch {
142
+ }
143
+ }), p.setFieldsValue(t);
144
+ } else
145
+ p.resetFields();
146
+ y(!0);
147
+ }, z = async () => {
148
+ var e;
149
+ try {
150
+ const t = await p.validateFields(), a = { ...t };
151
+ m.forEach((n) => {
152
+ var o;
153
+ const s = n.dataIndex;
154
+ if (n.fieldType === "date" && t[s])
155
+ try {
156
+ a[s] = ee(t[s]);
157
+ } catch {
158
+ }
159
+ (o = n.formConfig) != null && o.transform && (a[s] = n.formConfig.transform(t[s]));
160
+ }), h && h[c] ? await i.update(h[c], a) : await i.create(a), y(!1), (e = i.actionRef.current) == null || e.reload();
161
+ } catch (t) {
162
+ console.error("Form validation failed:", t);
163
+ }
164
+ }, M = async (e) => {
165
+ b.confirm({
166
+ title: "Are you sure?",
167
+ content: "This action cannot be undone.",
168
+ okText: "Yes, Delete",
169
+ okType: "danger",
170
+ cancelText: "Cancel",
171
+ onOk: async () => {
172
+ var a;
173
+ await i.delete(e) && ((a = i.actionRef.current) == null || a.reload());
174
+ }
175
+ });
176
+ }, _ = async () => {
177
+ if (d.length === 0) {
178
+ R.warning("Please select items to delete");
179
+ return;
180
+ }
181
+ b.confirm({
182
+ title: `Delete ${d.length} items?`,
183
+ content: "This action cannot be undone.",
184
+ okText: "Yes, Delete All",
185
+ okType: "danger",
186
+ cancelText: "Cancel",
187
+ onOk: async () => {
188
+ var t;
189
+ const e = d.map((a) => i.delete(a));
190
+ await Promise.allSettled(e), w([]), (t = i.actionRef.current) == null || t.reload();
191
+ }
192
+ });
193
+ }, q = C ? {
194
+ selectedRowKeys: d,
195
+ onChange: w
196
+ } : void 0;
197
+ return /* @__PURE__ */ r.jsxs($, { needDeps: !0, children: [
198
+ /* @__PURE__ */ r.jsx(
199
+ H,
200
+ {
201
+ headerTitle: O,
202
+ rowKey: c,
203
+ rowClassName: (e, t) => t % 2 === 0 ? "row-differentiator" : "",
204
+ actionRef: i.actionRef,
205
+ columns: I,
206
+ request: P,
207
+ search: { labelWidth: "auto" },
208
+ pagination: {
209
+ pageSize: j,
210
+ showSizeChanger: !0,
211
+ showQuickJumper: !0
212
+ },
213
+ loading: i.state.loading,
214
+ rowSelection: q,
215
+ toolBarRender: () => [
216
+ /* @__PURE__ */ r.jsx(
217
+ f,
218
+ {
219
+ type: "primary",
220
+ icon: /* @__PURE__ */ r.jsx(K, {}),
221
+ onClick: () => T(),
222
+ children: "New"
223
+ },
224
+ "add"
225
+ ),
226
+ ...C && d.length > 0 ? [
227
+ /* @__PURE__ */ r.jsxs(
228
+ f,
229
+ {
230
+ danger: !0,
231
+ onClick: _,
232
+ children: [
233
+ "Delete Selected (",
234
+ d.length,
235
+ ")"
236
+ ]
237
+ },
238
+ "bulk-delete"
239
+ )
240
+ ] : [],
241
+ /* @__PURE__ */ r.jsx(
242
+ Y,
243
+ {
244
+ menu: {
245
+ items: [
246
+ {
247
+ key: "export",
248
+ label: "Export",
249
+ disabled: !0
250
+ // TODO: Implement export
251
+ },
252
+ {
253
+ key: "refresh",
254
+ label: "Refresh",
255
+ onClick: () => i.refresh()
256
+ }
257
+ ]
258
+ },
259
+ children: /* @__PURE__ */ r.jsx(f, { children: /* @__PURE__ */ r.jsx(J, {}) })
260
+ },
261
+ "menu"
262
+ )
263
+ ],
264
+ options: {
265
+ setting: { listsHeight: 400 },
266
+ reload: () => i.refresh()
267
+ },
268
+ dateFormatter: "string"
269
+ }
270
+ ),
271
+ /* @__PURE__ */ r.jsx(
272
+ b,
273
+ {
274
+ title: h ? "Edit Item" : "Create Item",
275
+ open: E,
276
+ onOk: z,
277
+ onCancel: () => y(!1),
278
+ destroyOnClose: !0,
279
+ width: 600,
280
+ children: /* @__PURE__ */ r.jsx(l, { form: p, layout: "vertical", children: m.map((e) => {
281
+ var o, u, k;
282
+ if (!e.dataIndex) return null;
283
+ const t = e.dataIndex, a = e.title, n = !(e.fieldEditable ?? !0), s = ((o = e.formConfig) == null ? void 0 : o.rules) || ((u = e.formConfig) != null && u.required ? [
284
+ { required: !0, message: `${a} is required` }
285
+ ] : []);
286
+ if ((k = e.formConfig) != null && k.component)
287
+ return /* @__PURE__ */ r.jsx(
288
+ l.Item,
289
+ {
290
+ name: t,
291
+ label: a,
292
+ rules: s,
293
+ children: e.formConfig.component
294
+ },
295
+ t
296
+ );
297
+ switch (e.fieldType) {
298
+ case "string":
299
+ return /* @__PURE__ */ r.jsx(
300
+ l.Item,
301
+ {
302
+ name: t,
303
+ label: a,
304
+ rules: s,
305
+ children: /* @__PURE__ */ r.jsx(X, { disabled: n })
306
+ },
307
+ t
308
+ );
309
+ case "number":
310
+ return /* @__PURE__ */ r.jsx(
311
+ l.Item,
312
+ {
313
+ name: t,
314
+ label: a,
315
+ rules: s,
316
+ children: /* @__PURE__ */ r.jsx(U, { style: { width: "100%" }, disabled: n })
317
+ },
318
+ t
319
+ );
320
+ case "date":
321
+ return /* @__PURE__ */ r.jsx(
322
+ l.Item,
323
+ {
324
+ name: t,
325
+ label: a,
326
+ rules: s,
327
+ children: /* @__PURE__ */ r.jsx(G, { style: { width: "100%" }, showTime: !0, disabled: n })
328
+ },
329
+ t
330
+ );
331
+ case "boolean":
332
+ return /* @__PURE__ */ r.jsx(
333
+ l.Item,
334
+ {
335
+ name: t,
336
+ label: a,
337
+ valuePropName: "checked",
338
+ children: /* @__PURE__ */ r.jsx(W, { disabled: n })
339
+ },
340
+ t
341
+ );
342
+ case "enum":
343
+ return /* @__PURE__ */ r.jsx(
344
+ l.Item,
345
+ {
346
+ name: t,
347
+ label: a,
348
+ rules: s,
349
+ children: /* @__PURE__ */ r.jsx(
350
+ Q,
351
+ {
352
+ disabled: n,
353
+ placeholder: `Select ${a.toLowerCase()}`,
354
+ options: Object.entries(e.enumOptions || {}).map(([B, N]) => ({
355
+ label: N.text,
356
+ value: B
357
+ }))
358
+ }
359
+ )
360
+ },
361
+ t
362
+ );
363
+ default:
364
+ return null;
365
+ }
366
+ }) })
367
+ }
368
+ )
369
+ ] });
370
+ };
371
+ export {
372
+ oe as default
373
+ };
@@ -0,0 +1,4 @@
1
+ import { EnhancedCrudTableConfig, DataType } from './CrudTableExperimental';
2
+ declare const CrudTableExperimentalLazy: <T extends DataType>(props: EnhancedCrudTableConfig<T>) => import("react/jsx-runtime").JSX.Element;
3
+ export default CrudTableExperimentalLazy;
4
+ export type { EnhancedCrudTableConfig, DataType };
@@ -0,0 +1,69 @@
1
+ import { ActionType } from '@ant-design/pro-components';
2
+ export type CrudOperation<T> = {
3
+ getList: (params: CrudParams) => Promise<CrudResponse<T>>;
4
+ create: (data: Partial<T>) => Promise<T>;
5
+ update: (id: any, data: Partial<T>) => Promise<T>;
6
+ delete: (id: any) => Promise<void>;
7
+ };
8
+ export type CrudParams = {
9
+ current?: number;
10
+ pageSize?: number;
11
+ sortBy?: string;
12
+ sortOrder?: 'ascend' | 'descend';
13
+ [key: string]: any;
14
+ };
15
+ export type CrudResponse<T> = {
16
+ data: T[];
17
+ total: number;
18
+ success?: boolean;
19
+ };
20
+ export type CrudState<T> = {
21
+ loading: boolean;
22
+ error: string | null;
23
+ data: T[];
24
+ total: number;
25
+ current: number;
26
+ pageSize: number;
27
+ };
28
+ type UseCrudTableConfigBase = {
29
+ defaultPageSize?: number;
30
+ enableCache?: boolean;
31
+ optimisticUpdates?: boolean;
32
+ onSuccess?: (operation: 'create' | 'update' | 'delete' | 'fetch', data: any) => void;
33
+ onError?: (operation: 'create' | 'update' | 'delete' | 'fetch', error: any) => void;
34
+ };
35
+ interface UseCrudTableConfigStatic<T> extends UseCrudTableConfigBase {
36
+ staticData: T[];
37
+ }
38
+ interface UseCrudTableConfigApi<T> extends UseCrudTableConfigBase {
39
+ api: {
40
+ baseUrl?: string;
41
+ endpoints?: {
42
+ list?: string;
43
+ create?: string;
44
+ update?: string;
45
+ delete?: string;
46
+ };
47
+ headers?: Record<string, string>;
48
+ transform?: {
49
+ request?: (data: any) => any;
50
+ response?: (data: any) => CrudResponse<T>;
51
+ };
52
+ };
53
+ }
54
+ interface UseCrudTableConfigCustom<T> extends UseCrudTableConfigBase {
55
+ operations: Partial<CrudOperation<T>>;
56
+ }
57
+ export type UseCrudTableConfig<T> = UseCrudTableConfigStatic<T> | UseCrudTableConfigApi<T> | UseCrudTableConfigCustom<T>;
58
+ export type CrudTableActions<T> = {
59
+ refresh: () => Promise<void>;
60
+ create: (data: Partial<T>) => Promise<T | null>;
61
+ update: (id: any, data: Partial<T>) => Promise<T | null>;
62
+ delete: (id: any) => Promise<boolean>;
63
+ setPageSize: (size: number) => void;
64
+ setCurrentPage: (page: number) => void;
65
+ state: CrudState<T>;
66
+ actionRef: React.RefObject<ActionType | null>;
67
+ };
68
+ export declare const useCrudTable: <T extends Record<string, any>>(rowKey: keyof T, config: UseCrudTableConfig<T>) => CrudTableActions<T>;
69
+ export {};