@kingteza/crud-component 1.17.0 → 1.17.2

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