@kingteza/crud-component 1.23.1 → 1.24.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.
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),jt=require("antd"),yt=require("@dnd-kit/core"),ht=require("@dnd-kit/modifiers"),qt=require("@dnd-kit/utilities"),d=require("@dnd-kit/sortable"),Ct=require("../../common/button/Button.cjs.js"),lt=require("../../common/button/RefreshButton.cjs.js"),It=require("../../common/button/ViewButtonTable.cjs.js"),St=require("../actions/index.cjs.js"),Rt=require("../../common/table/table.cjs.js"),s=require("react"),Mt=require("../../locale/index.cjs.js"),dt=require("../CrudSearchComponent.cjs.js"),Tt=require("./CrudDecListView.cjs.js"),et=require("./CrudViewerUtil.cjs.js"),Vt=require("@ant-design/icons"),nt=require("../../util/CrudUtil.cjs.js"),Bt=require("../../common/layout/VerticalSpace.cjs.js"),Dt=s.memo(Rt);function Nt({idField:o="id",loadingData:h,fields:m,isDeleting:T,isHiding:R,viewable:c=!1,paginateProps:x,onDelete:q,onHide:V,onUpdate:C,data:l=[],extraAction:B,onClickUpdate:D,minusHeight:k,scroll:O,onClickClone:v,className:z,expandable:$,size:A,bordered:_,descListColumn:st,extraView:E,decListLayout:rt,scrollToTop:Lt,onClickRefresh:G,closeViewOnClickUpdate:J,onExport:K,confirmHiding:Q,confirmDeleting:X,rowClassName:Y,actionWidth:Z=190,draggable:t,rowSelection:W,...ct}){const{t:p}=Mt.useTranslationLib(),P=s.useMemo(()=>m.map(({hideInTable:e,hidden:r,width:u,label:f,halign:I,...S})=>{const N=nt.getRealName(S.name);return{title:f,width:u,key:N,dataIndex:N,hidden:e||r,align:I??(S.type==="number"?"right":void 0),render:et.getRendererValueCrudViewer(S),sorter:S.sorter}}),[m]),[i,M]=s.useState(),[H,U]=s.useState(),[y,w]=s.useState([]),ut=s.useCallback(e=>{M(e)},[]);s.useEffect(()=>{l&&w(l)},[l]),s.useEffect(()=>{l&&M(e=>{if(e)return l.find(r=>r[o]===e[o])})},[l,o,i]);const a=s.useCallback(e=>{var f;const{active:r,over:u}=e;if(t!=null&&t.onDragEnd&&(t==null||t.onDragEnd(e)),r.id!==(u==null?void 0:u.id)){const I=y.findIndex(j=>j[o]===r.id),S=y.findIndex(j=>j[o]===(u==null?void 0:u.id)),N=d.arrayMove(y,I,S);w(j=>{const xt=j.findIndex(L=>L[o]===(r==null?void 0:r.id)),ft=j.findIndex(L=>L[o]===(u==null?void 0:u.id));return d.arrayMove(j,xt,ft)}),(f=t==null?void 0:t.onDrag)==null||f.call(t,{newOrder:N.map(j=>j[o])})}},[y,o,t]),it=s.useMemo(()=>{let e=typeof c=="string"?i==null?void 0:i[c]:void 0;if(typeof e=="object"){const r=m.find(u=>nt.getRealName(u.name)===c);e=et.getRendererValueCrudViewer(r)(e,i,0)}return e},[c,i,m]),F=s.useMemo(()=>({rowSelection:W,rowClassName:Y,className:z,scroll:O??(k?{y:`calc(100vh - ${k})`}:void 0),id:"crud-table",bordered:_,size:A,expandable:$}),[W,Y,z,O,k,_,A,$]),b=s.useMemo(()=>x?{...x,total:x.count,onChange:x.setPage,current:x.page,pageSize:x.pageSize}:void 0,[x]),g=s.useMemo(()=>{const e=C||D||q||B||c,r=[];return t&&r.push({key:"key",align:"center",width:5,title:t==null?void 0:t.columnLabel,render:()=>n.jsx(kt,{tooltip:t==null?void 0:t.tooltip})}),r.push(...P),e&&e&&r.push({title:p("str.action"),fixed:"right",width:Z,render:(u,f)=>n.jsxs(n.Fragment,{children:[c&&n.jsx(It,{value:f,onClick:typeof c=="object"?()=>{var I;return(I=c.onClick)==null?void 0:I.call(c,f)}:ut}),n.jsx(St,{data:f,idField:o,extraAction:B,onUpdate:C,onClickUpdate:D,onClickClone:v,onDelete:q,onHide:V,onExport:K,isHiding:R,isDeleting:T,confirmHiding:Q,confirmDeleting:X,closeViewOnClickUpdate:J,recentUpdateOrDeleteId:H,setRecentUpdateOrDeleteId:U,setOpenView:M})]})}),r},[P,C,D,q,B,c,p,Z]),tt=s.useMemo(()=>y.map(e=>e[o]),[y,o]),mt=s.useCallback(()=>{const e=n.jsx(Dt,{...F,dataSource:y,loading:h,components:t?{body:{row:Et}}:void 0,pagination:b,columns:g});return t?n.jsx(yt.DndContext,{modifiers:[ht.restrictToVerticalAxis],onDragEnd:a,children:n.jsx(d.SortableContext,{items:tt,strategy:d.verticalListSortingStrategy,children:e})}):e},[F,y,h,b,g,t,tt,a]);return n.jsxs("div",{children:[(typeof c=="boolean"||typeof c=="string")&&n.jsx(jt.Modal,{width:"100%",open:!!i,title:it??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>M(void 0),children:!!i&&n.jsxs("div",{children:[n.jsx(Tt.CrudDecListView,{layout:rt,descListColumn:st,data:i,fields:m,idField:o,extraAction:B,onUpdate:C,onClickUpdate:D,onClickClone:v,onDelete:q,onHide:V,onExport:K,isHiding:R,isDeleting:T,confirmHiding:Q,confirmDeleting:X,closeViewOnClickUpdate:J,recentUpdateOrDeleteId:H,setRecentUpdateOrDeleteId:U,setOpenView:M}),E==null?void 0:E(i)]},i==null?void 0:i[o])}),n.jsx(dt,{fields:m,...ct}),n.jsxs(Bt,{children:[!!G&&n.jsx(lt.RefreshButton,{onClick:G}),mt()]})]})}const ot=s.createContext({}),kt=({tooltip:o})=>{const{setActivatorNodeRef:h,listeners:m}=s.useContext(ot);return n.jsx(Ct,{type:"text",size:"small",tooltip:o,icon:n.jsx(Vt.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:h,...m})},Et=o=>{const{attributes:h,listeners:m,setNodeRef:T,setActivatorNodeRef:R,transform:c,transition:x,isDragging:q}=d.useSortable({id:o["data-row-key"]}),V={...o.style,transform:qt.CSS.Translate.toString(c),transition:x,...q?{position:"relative",zIndex:9999}:{}},C=s.useMemo(()=>({setActivatorNodeRef:R,listeners:m}),[R,m]);return n.jsx(ot.Provider,{value:C,children:n.jsx("tr",{...o,ref:T,style:V,...h})})};module.exports=Nt;
1
+ "use strict";const n=require("react/jsx-runtime"),yt=require("antd"),ht=require("@dnd-kit/core"),qt=require("@dnd-kit/modifiers"),Ct=require("@dnd-kit/utilities"),d=require("@dnd-kit/sortable"),lt=require("../../common/button/Button.cjs.js"),It=require("../../common/button/RefreshButton.cjs.js"),St=require("../../common/button/ViewButtonTable.cjs.js"),Rt=require("../actions/index.cjs.js"),Mt=require("../../common/table/table.cjs.js"),s=require("react"),dt=require("../../locale/index.cjs.js"),Tt=require("../CrudSearchComponent.cjs.js"),Vt=require("./CrudDecListView.cjs.js"),nt=require("./CrudViewerUtil.cjs.js"),Bt=require("@ant-design/icons"),ot=require("../../util/CrudUtil.cjs.js"),Dt=require("../../common/layout/VerticalSpace.cjs.js"),Nt=s.memo(Mt);function kt({summary:h,idField:o="id",loadingData:q,fields:j,isDeleting:R,isHiding:T,viewable:c=!1,paginateProps:m,onDelete:C,onHide:V,onUpdate:B,data:l=[],extraAction:D,onClickUpdate:N,minusHeight:E,scroll:v,onClickClone:z,className:$,expandable:A,size:_,bordered:G,descListColumn:rt,extraView:L,decListLayout:ct,scrollToTop:Ot,onClickRefresh:J,closeViewOnClickUpdate:K,onExport:Q,confirmHiding:X,confirmDeleting:Y,rowClassName:Z,actionWidth:W=190,draggable:t,rowSelection:p,...ut}){const{t:P}=dt.useTranslationLib(),H=s.useMemo(()=>j.map(({hideInTable:e,hidden:r,width:u,label:x,halign:I,...S})=>{const k=ot.getRealName(S.name);return{title:x,width:u,key:k,dataIndex:k,hidden:e||r,align:I??(S.type==="number"?"right":void 0),render:nt.getRendererValueCrudViewer(S),sorter:S.sorter}}),[j]),[i,M]=s.useState(),[U,w]=s.useState(),[y,a]=s.useState([]),it=s.useCallback(e=>{M(e)},[]);s.useEffect(()=>{l&&a(l)},[l]),s.useEffect(()=>{l&&M(e=>{if(e)return l.find(r=>r[o]===e[o])})},[l,o,i]);const F=s.useCallback(e=>{var x;const{active:r,over:u}=e;if(t!=null&&t.onDragEnd&&(t==null||t.onDragEnd(e)),r.id!==(u==null?void 0:u.id)){const I=y.findIndex(f=>f[o]===r.id),S=y.findIndex(f=>f[o]===(u==null?void 0:u.id)),k=d.arrayMove(y,I,S);a(f=>{const ft=f.findIndex(O=>O[o]===(r==null?void 0:r.id)),jt=f.findIndex(O=>O[o]===(u==null?void 0:u.id));return d.arrayMove(f,ft,jt)}),(x=t==null?void 0:t.onDrag)==null||x.call(t,{newOrder:k.map(f=>f[o])})}},[y,o,t]),mt=s.useMemo(()=>{let e=typeof c=="string"?i==null?void 0:i[c]:void 0;if(typeof e=="object"){const r=j.find(u=>ot.getRealName(u.name)===c);e=nt.getRendererValueCrudViewer(r)(e,i,0)}return e},[c,i,j]),b=s.useMemo(()=>({rowSelection:p,rowClassName:Z,className:$,scroll:v??(E?{y:`calc(100vh - ${E})`}:void 0),id:"crud-table",bordered:G,size:_,expandable:A}),[p,Z,$,v,E,G,_,A]),g=s.useMemo(()=>m?{...m,total:m.count,onChange:m.setPage,current:m.page,pageSize:m.pageSize}:void 0,[m]),tt=s.useMemo(()=>{const e=B||N||C||D||c,r=[];return t&&r.push({key:"key",align:"center",width:5,title:t==null?void 0:t.columnLabel,render:()=>n.jsx(Et,{tooltip:t==null?void 0:t.tooltip})}),r.push(...H),e&&e&&r.push({title:P("str.action"),fixed:"right",width:W,render:(u,x)=>n.jsxs(n.Fragment,{children:[c&&n.jsx(St,{value:x,onClick:typeof c=="object"?()=>{var I;return(I=c.onClick)==null?void 0:I.call(c,x)}:it}),n.jsx(Rt,{data:x,idField:o,extraAction:D,onUpdate:B,onClickUpdate:N,onClickClone:z,onDelete:C,onHide:V,onExport:Q,isHiding:T,isDeleting:R,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:U,setRecentUpdateOrDeleteId:w,setOpenView:M})]})}),r},[H,B,N,C,D,c,P,W]),et=s.useMemo(()=>y.map(e=>e[o]),[y,o]),xt=s.useCallback(()=>{const e=n.jsx(Nt,{...b,summary:h,dataSource:y,loading:q,components:t?{body:{row:Lt}}:void 0,pagination:g,columns:tt});return t?n.jsx(ht.DndContext,{modifiers:[qt.restrictToVerticalAxis],onDragEnd:F,children:n.jsx(d.SortableContext,{items:et,strategy:d.verticalListSortingStrategy,children:e})}):e},[b,y,q,g,tt,t,et,F]);return n.jsxs("div",{children:[(typeof c=="boolean"||typeof c=="string")&&n.jsx(yt.Modal,{width:"100%",open:!!i,title:mt??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>M(void 0),children:!!i&&n.jsxs("div",{children:[n.jsx(Vt.CrudDecListView,{layout:ct,descListColumn:rt,data:i,fields:j,idField:o,extraAction:D,onUpdate:B,onClickUpdate:N,onClickClone:z,onDelete:C,onHide:V,onExport:Q,isHiding:T,isDeleting:R,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:U,setRecentUpdateOrDeleteId:w,setOpenView:M}),L==null?void 0:L(i)]},i==null?void 0:i[o])}),n.jsx(Tt,{fields:j,...ut}),n.jsxs(Dt,{children:[!!J&&n.jsx(It.RefreshButton,{onClick:J}),xt()]})]})}const st=s.createContext({}),Et=({tooltip:h})=>{const{setActivatorNodeRef:o,listeners:q}=s.useContext(st);return n.jsx(lt,{type:"text",size:"small",tooltip:h,icon:n.jsx(Bt.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:o,...q})},Lt=h=>{const{attributes:o,listeners:q,setNodeRef:j,setActivatorNodeRef:R,transform:T,transition:c,isDragging:m}=d.useSortable({id:h["data-row-key"]}),C={...h.style,transform:Ct.CSS.Translate.toString(T),transition:c,...m?{position:"relative",zIndex:9999}:{}},V=s.useMemo(()=>({setActivatorNodeRef:R,listeners:q}),[R,q]);return n.jsx(st.Provider,{value:V,children:n.jsx("tr",{...h,ref:j,style:C,...o})})};module.exports=kt;
@@ -20,6 +20,7 @@ export type CrudViewableProps<T> = boolean | keyof T | {
20
20
  onClick: (t: T) => void;
21
21
  };
22
22
  export type CrudViewerProps<T, FormType> = {
23
+ summary?: TableProps<T>["summary"];
23
24
  fields: CrudFieldProps<T>[];
24
25
  decListLayout?: "horizontal" | "vertical";
25
26
  viewable?: CrudViewableProps<T>;
@@ -41,5 +42,5 @@ export type CrudViewerProps<T, FormType> = {
41
42
  actionWidth?: string | number;
42
43
  draggable?: CrudDragableProps<T>;
43
44
  } & CrudActionsProps<T, FormType> & CrudSearchComponentProps<T, FormType>;
44
- declare function CrudViewer<T, FormType = T>({ idField, loadingData, fields, isDeleting, isHiding, viewable, paginateProps, onDelete, onHide, onUpdate, data, extraAction, onClickUpdate, minusHeight, scroll, onClickClone, className, expandable, size, bordered, descListColumn, extraView, decListLayout, scrollToTop, onClickRefresh, closeViewOnClickUpdate, onExport, confirmHiding, confirmDeleting, rowClassName, actionWidth, draggable, rowSelection, ...props }: CrudViewerProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
45
+ declare function CrudViewer<T, FormType = T>({ summary, idField, loadingData, fields, isDeleting, isHiding, viewable, paginateProps, onDelete, onHide, onUpdate, data, extraAction, onClickUpdate, minusHeight, scroll, onClickClone, className, expandable, size, bordered, descListColumn, extraView, decListLayout, scrollToTop, onClickRefresh, closeViewOnClickUpdate, onExport, confirmHiding, confirmDeleting, rowClassName, actionWidth, draggable, rowSelection, ...props }: CrudViewerProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
45
46
  export default CrudViewer;
@@ -1,319 +1,321 @@
1
- import { jsx as e, jsxs as E, Fragment as rt } from "react/jsx-runtime";
2
- import { Modal as Tt } from "antd";
3
- import { DndContext as Rt } from "@dnd-kit/core";
4
- import { restrictToVerticalAxis as lt } from "@dnd-kit/modifiers";
5
- import { CSS as Bt } from "@dnd-kit/utilities";
6
- import { arrayMove as et, SortableContext as Dt, verticalListSortingStrategy as Nt, useSortable as Ot } from "@dnd-kit/sortable";
7
- import dt from "../../common/button/Button.es.js";
8
- import { RefreshButton as jt } from "../../common/button/RefreshButton.es.js";
9
- import Et from "../../common/button/ViewButtonTable.es.js";
10
- import Lt from "../actions/index.es.js";
11
- import Mt from "../../common/table/table.es.js";
12
- import ut, { useMemo as p, useState as k, useCallback as z, useEffect as ct, useContext as Vt } from "react";
13
- import { useTranslationLib as kt } from "../../locale/index.es.js";
14
- import zt from "../CrudSearchComponent.es.js";
15
- import { CrudDecListView as vt } from "./CrudDecListView.es.js";
16
- import { getRendererValueCrudViewer as st } from "./CrudViewerUtil.es.js";
17
- import { HolderOutlined as At } from "@ant-design/icons";
18
- import mt from "../../util/CrudUtil.es.js";
19
- import _t from "../../common/layout/VerticalSpace.es.js";
20
- const $t = ut.memo(Mt);
21
- function co({
1
+ import { jsx as e, jsxs as L, Fragment as et } from "react/jsx-runtime";
2
+ import { Modal as Rt } from "antd";
3
+ import { DndContext as lt } from "@dnd-kit/core";
4
+ import { restrictToVerticalAxis as Bt } from "@dnd-kit/modifiers";
5
+ import { CSS as Dt } from "@dnd-kit/utilities";
6
+ import { arrayMove as ct, SortableContext as Nt, verticalListSortingStrategy as Ot, useSortable as dt } from "@dnd-kit/sortable";
7
+ import jt from "../../common/button/Button.es.js";
8
+ import { RefreshButton as Et } from "../../common/button/RefreshButton.es.js";
9
+ import Lt from "../../common/button/ViewButtonTable.es.js";
10
+ import Mt from "../actions/index.es.js";
11
+ import Vt from "../../common/table/table.es.js";
12
+ import ft, { useMemo as x, useState as z, useCallback as v, useEffect as st, useContext as kt } from "react";
13
+ import { useTranslationLib as zt } from "../../locale/index.es.js";
14
+ import vt from "../CrudSearchComponent.es.js";
15
+ import { CrudDecListView as At } from "./CrudDecListView.es.js";
16
+ import { getRendererValueCrudViewer as mt } from "./CrudViewerUtil.es.js";
17
+ import { HolderOutlined as _t } from "@ant-design/icons";
18
+ import ut from "../../util/CrudUtil.es.js";
19
+ import $t from "../../common/layout/VerticalSpace.es.js";
20
+ const qt = ft.memo(Vt);
21
+ function so({
22
+ summary: p,
22
23
  idField: n = "id",
23
24
  loadingData: C,
24
- fields: u,
25
- isDeleting: D,
26
- isHiding: l,
25
+ fields: y,
26
+ isDeleting: l,
27
+ isHiding: D,
27
28
  viewable: c = !1,
28
- paginateProps: f,
29
- onDelete: x,
29
+ paginateProps: u,
30
+ onDelete: I,
30
31
  onHide: N,
31
- onUpdate: I,
32
+ onUpdate: O,
32
33
  data: S = [],
33
- extraAction: O,
34
- onClickUpdate: d,
35
- minusHeight: L,
36
- scroll: v,
37
- onClickClone: A,
38
- className: _,
39
- expandable: $,
40
- size: q,
41
- bordered: G,
42
- descListColumn: it,
43
- extraView: M,
44
- decListLayout: yt,
45
- scrollToTop: Jt,
46
- onClickRefresh: J,
47
- closeViewOnClickUpdate: K,
48
- onExport: Q,
49
- confirmHiding: X,
50
- confirmDeleting: Y,
51
- rowClassName: Z,
52
- actionWidth: W = 190,
34
+ extraAction: d,
35
+ onClickUpdate: j,
36
+ minusHeight: M,
37
+ scroll: A,
38
+ onClickClone: _,
39
+ className: $,
40
+ expandable: q,
41
+ size: G,
42
+ bordered: J,
43
+ descListColumn: yt,
44
+ extraView: V,
45
+ decListLayout: ht,
46
+ scrollToTop: Kt,
47
+ onClickRefresh: K,
48
+ closeViewOnClickUpdate: Q,
49
+ onExport: X,
50
+ confirmHiding: Y,
51
+ confirmDeleting: Z,
52
+ rowClassName: W,
53
+ actionWidth: P = 190,
53
54
  draggable: t,
54
- rowSelection: P,
55
- ...ht
55
+ rowSelection: H,
56
+ ...pt
56
57
  }) {
57
- const { t: H } = kt(), U = p(
58
- () => u.map(({ hideInTable: o, hidden: r, width: s, label: i, halign: T, ...R }) => {
59
- const j = mt.getRealName(R.name);
58
+ const { t: U } = zt(), w = x(
59
+ () => y.map(({ hideInTable: o, hidden: r, width: s, label: f, halign: T, ...R }) => {
60
+ const E = ut.getRealName(R.name);
60
61
  return {
61
- title: i,
62
+ title: f,
62
63
  width: s,
63
- key: j,
64
- dataIndex: j,
64
+ key: E,
65
+ dataIndex: E,
65
66
  hidden: o || r,
66
67
  align: T ?? (R.type === "number" ? "right" : void 0),
67
- render: st(R),
68
+ render: mt(R),
68
69
  sorter: R.sorter
69
70
  };
70
71
  }),
71
- [u]
72
- ), [m, B] = k(), [w, F] = k(), [h, a] = k([]), pt = z((o) => {
72
+ [y]
73
+ ), [m, B] = z(), [F, a] = z(), [h, b] = z([]), Ct = v((o) => {
73
74
  B(o);
74
75
  }, []);
75
- ct(() => {
76
- S && a(S);
77
- }, [S]), ct(() => {
76
+ st(() => {
77
+ S && b(S);
78
+ }, [S]), st(() => {
78
79
  S && B((o) => {
79
80
  if (o)
80
81
  return S.find((r) => r[n] === o[n]);
81
82
  });
82
83
  }, [S, n, m]);
83
- const b = z(
84
+ const g = v(
84
85
  (o) => {
85
- var i;
86
+ var f;
86
87
  const { active: r, over: s } = o;
87
88
  if (t != null && t.onDragEnd && (t == null || t.onDragEnd(o)), r.id !== (s == null ? void 0 : s.id)) {
88
89
  const T = h.findIndex(
89
- (y) => y[n] === r.id
90
+ (i) => i[n] === r.id
90
91
  ), R = h.findIndex(
91
- (y) => y[n] === (s == null ? void 0 : s.id)
92
- ), j = et(h, T, R);
93
- a((y) => {
94
- const It = y.findIndex(
95
- (V) => V[n] === (r == null ? void 0 : r.id)
96
- ), St = y.findIndex(
97
- (V) => V[n] === (s == null ? void 0 : s.id)
92
+ (i) => i[n] === (s == null ? void 0 : s.id)
93
+ ), E = ct(h, T, R);
94
+ b((i) => {
95
+ const St = i.findIndex(
96
+ (k) => k[n] === (r == null ? void 0 : r.id)
97
+ ), Tt = i.findIndex(
98
+ (k) => k[n] === (s == null ? void 0 : s.id)
98
99
  );
99
- return et(y, It, St);
100
- }), (i = t == null ? void 0 : t.onDrag) == null || i.call(t, {
101
- newOrder: j.map((y) => y[n])
100
+ return ct(i, St, Tt);
101
+ }), (f = t == null ? void 0 : t.onDrag) == null || f.call(t, {
102
+ newOrder: E.map((i) => i[n])
102
103
  });
103
104
  }
104
105
  },
105
106
  [h, n, t]
106
- ), Ct = p(() => {
107
+ ), xt = x(() => {
107
108
  let o = typeof c == "string" ? m == null ? void 0 : m[c] : void 0;
108
109
  if (typeof o == "object") {
109
- const r = u.find((s) => mt.getRealName(s.name) === c);
110
- o = st(r)(
110
+ const r = y.find((s) => ut.getRealName(s.name) === c);
111
+ o = mt(r)(
111
112
  o,
112
113
  m,
113
114
  0
114
115
  );
115
116
  }
116
117
  return o;
117
- }, [c, m, u]), g = p(
118
+ }, [c, m, y]), tt = x(
118
119
  () => ({
119
- rowSelection: P,
120
- rowClassName: Z,
121
- className: _,
122
- scroll: v ?? (L ? { y: `calc(100vh - ${L})` } : void 0),
120
+ rowSelection: H,
121
+ rowClassName: W,
122
+ className: $,
123
+ scroll: A ?? (M ? { y: `calc(100vh - ${M})` } : void 0),
123
124
  id: "crud-table",
124
- bordered: G,
125
- size: q,
126
- expandable: $
125
+ bordered: J,
126
+ size: G,
127
+ expandable: q
127
128
  }),
128
129
  [
129
- P,
130
- Z,
131
- _,
132
- v,
133
- L,
130
+ H,
131
+ W,
132
+ $,
133
+ A,
134
+ M,
135
+ J,
134
136
  G,
135
- q,
136
- $
137
+ q
137
138
  ]
138
- ), tt = p(
139
- () => f ? {
140
- ...f,
141
- total: f.count,
142
- onChange: f.setPage,
143
- current: f.page,
144
- pageSize: f.pageSize
139
+ ), ot = x(
140
+ () => u ? {
141
+ ...u,
142
+ total: u.count,
143
+ onChange: u.setPage,
144
+ current: u.page,
145
+ pageSize: u.pageSize
145
146
  } : void 0,
146
- [f]
147
- ), ot = p(() => {
148
- const o = I || d || x || O || c, r = [];
147
+ [u]
148
+ ), nt = x(() => {
149
+ const o = O || j || I || d || c, r = [];
149
150
  return t && r.push({
150
151
  key: "key",
151
152
  align: "center",
152
153
  width: 5,
153
154
  title: t == null ? void 0 : t.columnLabel,
154
- render: () => /* @__PURE__ */ e(qt, { tooltip: t == null ? void 0 : t.tooltip })
155
- }), r.push(...U), o && o && r.push({
156
- title: H("str.action"),
155
+ render: () => /* @__PURE__ */ e(Gt, { tooltip: t == null ? void 0 : t.tooltip })
156
+ }), r.push(...w), o && o && r.push({
157
+ title: U("str.action"),
157
158
  fixed: "right",
158
- width: W,
159
- render: (s, i) => /* @__PURE__ */ E(rt, { children: [
159
+ width: P,
160
+ render: (s, f) => /* @__PURE__ */ L(et, { children: [
160
161
  c && /* @__PURE__ */ e(
161
- Et,
162
+ Lt,
162
163
  {
163
- value: i,
164
+ value: f,
164
165
  onClick: typeof c == "object" ? () => {
165
166
  var T;
166
- return (T = c.onClick) == null ? void 0 : T.call(c, i);
167
- } : pt
167
+ return (T = c.onClick) == null ? void 0 : T.call(c, f);
168
+ } : Ct
168
169
  }
169
170
  ),
170
171
  /* @__PURE__ */ e(
171
- Lt,
172
+ Mt,
172
173
  {
173
- data: i,
174
+ data: f,
174
175
  idField: n,
175
- extraAction: O,
176
- onUpdate: I,
177
- onClickUpdate: d,
178
- onClickClone: A,
179
- onDelete: x,
176
+ extraAction: d,
177
+ onUpdate: O,
178
+ onClickUpdate: j,
179
+ onClickClone: _,
180
+ onDelete: I,
180
181
  onHide: N,
181
- onExport: Q,
182
- isHiding: l,
183
- isDeleting: D,
184
- confirmHiding: X,
185
- confirmDeleting: Y,
186
- closeViewOnClickUpdate: K,
187
- recentUpdateOrDeleteId: w,
188
- setRecentUpdateOrDeleteId: F,
182
+ onExport: X,
183
+ isHiding: D,
184
+ isDeleting: l,
185
+ confirmHiding: Y,
186
+ confirmDeleting: Z,
187
+ closeViewOnClickUpdate: Q,
188
+ recentUpdateOrDeleteId: F,
189
+ setRecentUpdateOrDeleteId: a,
189
190
  setOpenView: B
190
191
  }
191
192
  )
192
193
  ] })
193
194
  }), r;
194
195
  }, [
195
- U,
196
+ w,
197
+ O,
198
+ j,
196
199
  I,
197
200
  d,
198
- x,
199
- O,
200
201
  c,
201
- H,
202
- W
203
- ]), nt = p(
202
+ U,
203
+ P
204
+ ]), rt = x(
204
205
  () => h.map((o) => o[n]),
205
206
  [h, n]
206
- ), xt = z(() => {
207
+ ), It = v(() => {
207
208
  const o = /* @__PURE__ */ e(
208
- $t,
209
+ qt,
209
210
  {
210
- ...g,
211
+ ...tt,
212
+ summary: p,
211
213
  dataSource: h,
212
214
  loading: C,
213
- components: t ? { body: { row: Gt } } : void 0,
214
- pagination: tt,
215
- columns: ot
215
+ components: t ? { body: { row: Jt } } : void 0,
216
+ pagination: ot,
217
+ columns: nt
216
218
  }
217
219
  );
218
- return t ? /* @__PURE__ */ e(Rt, { modifiers: [lt], onDragEnd: b, children: /* @__PURE__ */ e(
219
- Dt,
220
+ return t ? /* @__PURE__ */ e(lt, { modifiers: [Bt], onDragEnd: g, children: /* @__PURE__ */ e(
221
+ Nt,
220
222
  {
221
- items: nt,
222
- strategy: Nt,
223
+ items: rt,
224
+ strategy: Ot,
223
225
  children: o
224
226
  }
225
227
  ) }) : o;
226
228
  }, [
227
- g,
229
+ tt,
228
230
  h,
229
231
  C,
230
- tt,
231
232
  ot,
232
- t,
233
233
  nt,
234
- b
234
+ t,
235
+ rt,
236
+ g
235
237
  ]);
236
- return /* @__PURE__ */ E("div", { children: [
238
+ return /* @__PURE__ */ L("div", { children: [
237
239
  (typeof c == "boolean" || typeof c == "string") && /* @__PURE__ */ e(
238
- Tt,
240
+ Rt,
239
241
  {
240
242
  width: "100%",
241
243
  open: !!m,
242
- title: Ct ?? /* @__PURE__ */ e("div", { children: " " }),
243
- footer: /* @__PURE__ */ e(rt, {}),
244
+ title: xt ?? /* @__PURE__ */ e("div", { children: " " }),
245
+ footer: /* @__PURE__ */ e(et, {}),
244
246
  closable: !0,
245
247
  onCancel: () => B(void 0),
246
- children: !!m && /* @__PURE__ */ E("div", { children: [
248
+ children: !!m && /* @__PURE__ */ L("div", { children: [
247
249
  /* @__PURE__ */ e(
248
- vt,
250
+ At,
249
251
  {
250
- layout: yt,
251
- descListColumn: it,
252
+ layout: ht,
253
+ descListColumn: yt,
252
254
  data: m,
253
- fields: u,
255
+ fields: y,
254
256
  idField: n,
255
- extraAction: O,
256
- onUpdate: I,
257
- onClickUpdate: d,
258
- onClickClone: A,
259
- onDelete: x,
257
+ extraAction: d,
258
+ onUpdate: O,
259
+ onClickUpdate: j,
260
+ onClickClone: _,
261
+ onDelete: I,
260
262
  onHide: N,
261
- onExport: Q,
262
- isHiding: l,
263
- isDeleting: D,
264
- confirmHiding: X,
265
- confirmDeleting: Y,
266
- closeViewOnClickUpdate: K,
267
- recentUpdateOrDeleteId: w,
268
- setRecentUpdateOrDeleteId: F,
263
+ onExport: X,
264
+ isHiding: D,
265
+ isDeleting: l,
266
+ confirmHiding: Y,
267
+ confirmDeleting: Z,
268
+ closeViewOnClickUpdate: Q,
269
+ recentUpdateOrDeleteId: F,
270
+ setRecentUpdateOrDeleteId: a,
269
271
  setOpenView: B
270
272
  }
271
273
  ),
272
- M == null ? void 0 : M(m)
274
+ V == null ? void 0 : V(m)
273
275
  ] }, m == null ? void 0 : m[n])
274
276
  }
275
277
  ),
276
- /* @__PURE__ */ e(zt, { fields: u, ...ht }),
277
- /* @__PURE__ */ E(_t, { children: [
278
- !!J && /* @__PURE__ */ e(jt, { onClick: J }),
279
- xt()
278
+ /* @__PURE__ */ e(vt, { fields: y, ...pt }),
279
+ /* @__PURE__ */ L($t, { children: [
280
+ !!K && /* @__PURE__ */ e(Et, { onClick: K }),
281
+ It()
280
282
  ] })
281
283
  ] });
282
284
  }
283
- const ft = ut.createContext({}), qt = ({ tooltip: n }) => {
284
- const { setActivatorNodeRef: C, listeners: u } = Vt(ft);
285
+ const it = ft.createContext({}), Gt = ({ tooltip: p }) => {
286
+ const { setActivatorNodeRef: n, listeners: C } = kt(it);
285
287
  return /* @__PURE__ */ e(
286
- dt,
288
+ jt,
287
289
  {
288
290
  type: "text",
289
291
  size: "small",
290
- tooltip: n,
291
- icon: /* @__PURE__ */ e(At, {}),
292
+ tooltip: p,
293
+ icon: /* @__PURE__ */ e(_t, {}),
292
294
  style: { cursor: "move", border: "none" },
293
- ref: C,
294
- ...u
295
+ ref: n,
296
+ ...C
295
297
  }
296
298
  );
297
- }, Gt = (n) => {
299
+ }, Jt = (p) => {
298
300
  const {
299
- attributes: C,
300
- listeners: u,
301
- setNodeRef: D,
301
+ attributes: n,
302
+ listeners: C,
303
+ setNodeRef: y,
302
304
  setActivatorNodeRef: l,
303
- transform: c,
304
- transition: f,
305
- isDragging: x
306
- } = Ot({ id: n["data-row-key"] }), N = {
307
- ...n.style,
308
- transform: Bt.Translate.toString(c),
309
- transition: f,
310
- ...x ? { position: "relative", zIndex: 9999 } : {}
311
- }, I = p(
312
- () => ({ setActivatorNodeRef: l, listeners: u }),
313
- [l, u]
305
+ transform: D,
306
+ transition: c,
307
+ isDragging: u
308
+ } = dt({ id: p["data-row-key"] }), I = {
309
+ ...p.style,
310
+ transform: Dt.Translate.toString(D),
311
+ transition: c,
312
+ ...u ? { position: "relative", zIndex: 9999 } : {}
313
+ }, N = x(
314
+ () => ({ setActivatorNodeRef: l, listeners: C }),
315
+ [l, C]
314
316
  );
315
- return /* @__PURE__ */ e(ft.Provider, { value: I, children: /* @__PURE__ */ e("tr", { ...n, ref: D, style: N, ...C }) });
317
+ return /* @__PURE__ */ e(it.Provider, { value: N, children: /* @__PURE__ */ e("tr", { ...p, ref: y, style: I, ...n }) });
316
318
  };
317
319
  export {
318
- co as default
320
+ so as default
319
321
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.23.1",
4
+ "version": "1.24.0",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",