@kingteza/crud-component 1.27.2 → 1.29.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.
- package/dist/crud/CrudComponent.cjs.js +1 -1
- package/dist/crud/CrudComponent.d.ts +14 -5
- package/dist/crud/CrudComponent.es.js +73 -69
- package/dist/crud/CrudField.cjs.js +1 -1
- package/dist/crud/CrudField.es.js +302 -286
- package/dist/crud/actions/index.cjs.js +1 -1
- package/dist/crud/actions/index.d.ts +3 -1
- package/dist/crud/actions/index.es.js +63 -61
- package/dist/crud/modal/index.cjs.js +1 -1
- package/dist/crud/modal/index.es.js +1 -1
- package/dist/crud/view/CrudViewer.cjs.js +1 -1
- package/dist/crud/view/CrudViewer.d.ts +1 -1
- package/dist/crud/view/CrudViewer.es.js +190 -182
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const v=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const v=require("react/jsx-runtime"),z=require("react"),b=require("../../common/button/CloneButtonTable.cjs.js"),r=require("../../common/button/DeleteButtonTable.cjs.js"),k=require("../../common/button/ExportButton.cjs.js"),C=require("../../common/button/HideButtonTable.cjs.js"),F=require("../../common/button/UpdateButtonTable.cjs.js"),R=require("../modal/index.cjs.js");function B({data:q,idField:u="id",extraAction:E,onUpdate:N,onClickUpdate:x,onClickClone:h,onDelete:G,onHide:J,onExport:K,isHiding:Q,isDeleting:S,confirmHiding:A,confirmDeleting:s,closeViewOnClickUpdate:H,recentUpdateOrDeleteId:W,setRecentUpdateOrDeleteId:m,setOpenView:L,inBuiltModalProps:f,updatable:T,deletable:g}){var $;const y=E==null?void 0:E(q),X=z.useRef(null),Y=z.useCallback((j,V=!0,c=!1)=>{var w;m==null||m(j[u]),f?(w=X.current)==null||w.update(j,V,c):c?h==null||h(j):x==null||x(j),H&&(L==null||L(void 0))},[f,x]),Z=z.useMemo(()=>!!(!T||T!=null&&T(q)),[T,q]),_=z.useMemo(()=>!!(!g||g!=null&&g(q)),[g,q]);return(Array.isArray(y)?($=y==null?void 0:y.filter(Boolean))!=null&&$.length:y)||N||Z&&x||f!=null&&f.onUpdate||h||f!=null&&f.onCreate||_&&G||K||J?v.jsxs(v.Fragment,{children:[f&&v.jsx(R,{ref:X,...f}),y,(N||x||(f==null?void 0:f.onUpdate))&&Z&&v.jsx(F,{value:q,onClick:j=>Y(j)}),(h||(f==null?void 0:f.onCreate))&&v.jsx(b,{value:q,onClick:j=>Y(j,!1,!0)}),K&&v.jsx(k.ExportButton,{value:q,onClick:async j=>await K(j)}),J&&v.jsx(C,{value:q,disabled:Q,shouldConfirm:A,loading:Q&&q[u]===W,onClick:async j=>{m==null||m(j[u]),await J({[u]:j[u]})}}),G&&_&&v.jsx(r,{value:q,disabled:S,shouldConfirm:s,loading:S&&q[u]===W,onClick:async j=>{m==null||m(j[u]),await G({[u]:j[u]})}})]}):void 0}module.exports=B;
|
|
@@ -8,6 +8,8 @@ export interface CrudActionsProps<T, FormType> {
|
|
|
8
8
|
onClickUpdate?: (t: T) => void;
|
|
9
9
|
onClickClone?: (t: T) => Promise<any>;
|
|
10
10
|
onDelete?: (id: any) => Promise<any>;
|
|
11
|
+
updatable?: (t: T) => boolean;
|
|
12
|
+
deletable?: (t: T) => boolean;
|
|
11
13
|
onHide?: (id: any) => Promise<any>;
|
|
12
14
|
onExport?: (t: T) => Promise<any>;
|
|
13
15
|
isHiding?: boolean;
|
|
@@ -20,7 +22,7 @@ export interface CrudActionsProps<T, FormType> {
|
|
|
20
22
|
setOpenView?: (data: T | undefined) => void;
|
|
21
23
|
inBuiltModalProps?: CrudModalProps<T, FormType>;
|
|
22
24
|
}
|
|
23
|
-
declare function CrudActions<T, FormType>({ data, idField, extraAction, onUpdate, onClickUpdate, onClickClone, onDelete, onHide, onExport, isHiding, isDeleting, confirmHiding, confirmDeleting, closeViewOnClickUpdate, recentUpdateOrDeleteId, setRecentUpdateOrDeleteId, setOpenView, inBuiltModalProps, }: CrudActionsProps<T, FormType> & {
|
|
25
|
+
declare function CrudActions<T, FormType>({ data, idField, extraAction, onUpdate, onClickUpdate, onClickClone, onDelete, onHide, onExport, isHiding, isDeleting, confirmHiding, confirmDeleting, closeViewOnClickUpdate, recentUpdateOrDeleteId, setRecentUpdateOrDeleteId, setOpenView, inBuiltModalProps, updatable, deletable, }: CrudActionsProps<T, FormType> & {
|
|
24
26
|
data: T;
|
|
25
27
|
}): import("react/jsx-runtime").JSX.Element | undefined;
|
|
26
28
|
export default CrudActions;
|
|
@@ -1,83 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { ExportButton as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
function
|
|
10
|
-
data:
|
|
11
|
-
idField:
|
|
12
|
-
extraAction:
|
|
13
|
-
onUpdate:
|
|
14
|
-
onClickUpdate:
|
|
15
|
-
onClickClone:
|
|
16
|
-
onDelete:
|
|
17
|
-
onHide:
|
|
18
|
-
onExport:
|
|
19
|
-
isHiding:
|
|
20
|
-
isDeleting:
|
|
21
|
-
confirmHiding:
|
|
22
|
-
confirmDeleting:
|
|
23
|
-
closeViewOnClickUpdate:
|
|
24
|
-
recentUpdateOrDeleteId:
|
|
25
|
-
setRecentUpdateOrDeleteId:
|
|
26
|
-
setOpenView:
|
|
27
|
-
inBuiltModalProps: f
|
|
1
|
+
import { jsxs as r, Fragment as C, jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as F, useCallback as c, useMemo as H } from "react";
|
|
3
|
+
import R from "../../common/button/CloneButtonTable.es.js";
|
|
4
|
+
import B from "../../common/button/DeleteButtonTable.es.js";
|
|
5
|
+
import { ExportButton as I } from "../../common/button/ExportButton.es.js";
|
|
6
|
+
import D from "../../common/button/HideButtonTable.es.js";
|
|
7
|
+
import U from "../../common/button/UpdateButtonTable.es.js";
|
|
8
|
+
import s from "../modal/index.es.js";
|
|
9
|
+
function l({
|
|
10
|
+
data: v,
|
|
11
|
+
idField: y = "id",
|
|
12
|
+
extraAction: J,
|
|
13
|
+
onUpdate: S,
|
|
14
|
+
onClickUpdate: T,
|
|
15
|
+
onClickClone: q,
|
|
16
|
+
onDelete: K,
|
|
17
|
+
onHide: L,
|
|
18
|
+
onExport: N,
|
|
19
|
+
isHiding: W,
|
|
20
|
+
isDeleting: X,
|
|
21
|
+
confirmHiding: x,
|
|
22
|
+
confirmDeleting: V,
|
|
23
|
+
closeViewOnClickUpdate: b,
|
|
24
|
+
recentUpdateOrDeleteId: Y,
|
|
25
|
+
setRecentUpdateOrDeleteId: h,
|
|
26
|
+
setOpenView: Q,
|
|
27
|
+
inBuiltModalProps: f,
|
|
28
|
+
updatable: z,
|
|
29
|
+
deletable: G
|
|
28
30
|
}) {
|
|
29
|
-
var
|
|
30
|
-
const
|
|
31
|
-
(m,
|
|
32
|
-
var
|
|
33
|
-
|
|
31
|
+
var A;
|
|
32
|
+
const g = J == null ? void 0 : J(v), Z = F(null), _ = c(
|
|
33
|
+
(m, k = !0, E = !1) => {
|
|
34
|
+
var u;
|
|
35
|
+
h == null || h(m[y]), f ? (u = Z.current) == null || u.update(m, k, E) : E ? q == null || q(m) : T == null || T(m), b && (Q == null || Q(void 0));
|
|
34
36
|
},
|
|
35
|
-
[f,
|
|
36
|
-
);
|
|
37
|
-
return (Array.isArray(
|
|
38
|
-
f && /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
(
|
|
41
|
-
(
|
|
42
|
-
|
|
37
|
+
[f, T]
|
|
38
|
+
), $ = H(() => !!(!z || z != null && z(v)), [z, v]), w = H(() => !!(!G || G != null && G(v)), [G, v]);
|
|
39
|
+
return (Array.isArray(g) ? (A = g == null ? void 0 : g.filter(Boolean)) != null && A.length : g) || S || $ && T || f != null && f.onUpdate || q || f != null && f.onCreate || w && K || N || L ? /* @__PURE__ */ r(C, { children: [
|
|
40
|
+
f && /* @__PURE__ */ j(s, { ref: Z, ...f }),
|
|
41
|
+
g,
|
|
42
|
+
(S || T || (f == null ? void 0 : f.onUpdate)) && $ && /* @__PURE__ */ j(U, { value: v, onClick: (m) => _(m) }),
|
|
43
|
+
(q || (f == null ? void 0 : f.onCreate)) && /* @__PURE__ */ j(
|
|
44
|
+
R,
|
|
43
45
|
{
|
|
44
|
-
value:
|
|
45
|
-
onClick: (m) =>
|
|
46
|
+
value: v,
|
|
47
|
+
onClick: (m) => _(m, !1, !0)
|
|
46
48
|
}
|
|
47
49
|
),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
N && /* @__PURE__ */ j(
|
|
51
|
+
I,
|
|
50
52
|
{
|
|
51
|
-
value:
|
|
52
|
-
onClick: async (m) => await
|
|
53
|
+
value: v,
|
|
54
|
+
onClick: async (m) => await N(m)
|
|
53
55
|
}
|
|
54
56
|
),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
L && /* @__PURE__ */ j(
|
|
58
|
+
D,
|
|
57
59
|
{
|
|
58
|
-
value:
|
|
59
|
-
disabled:
|
|
60
|
-
shouldConfirm:
|
|
61
|
-
loading:
|
|
60
|
+
value: v,
|
|
61
|
+
disabled: W,
|
|
62
|
+
shouldConfirm: x,
|
|
63
|
+
loading: W && v[y] === Y,
|
|
62
64
|
onClick: async (m) => {
|
|
63
|
-
|
|
65
|
+
h == null || h(m[y]), await L({ [y]: m[y] });
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
K && w && /* @__PURE__ */ j(
|
|
70
|
+
B,
|
|
69
71
|
{
|
|
70
|
-
value:
|
|
71
|
-
disabled:
|
|
72
|
-
shouldConfirm:
|
|
73
|
-
loading:
|
|
72
|
+
value: v,
|
|
73
|
+
disabled: X,
|
|
74
|
+
shouldConfirm: V,
|
|
75
|
+
loading: X && v[y] === Y,
|
|
74
76
|
onClick: async (m) => {
|
|
75
|
-
|
|
77
|
+
h == null || h(m[y]), await K({ [y]: m[y] });
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
)
|
|
79
81
|
] }) : void 0;
|
|
80
82
|
}
|
|
81
83
|
export {
|
|
82
|
-
|
|
84
|
+
l as default
|
|
83
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const g=require("react/jsx-runtime"),B=require("antd"),t=require("react"),J=require("../CrudForm.cjs.js"),K=require("../CrudFormWizard.cjs.js"),Q=require("../../locale/index.cjs.js"),I=require("../../util/CrudUtil.cjs.js"),X=require("dayjs"),Y=({fields:u,wizard:l,grid:M,fullWidthModal:T,isCreating:h,isUpdating:j,onCreate:b,onUpdate:v,idField:k="id",formBuilder:W,onValuesChange:q},_)=>{const[s]=B.Form.useForm(),{t:S}=Q.useTranslationLib(),[C,m]=t.useState(!1),[p,N]=t.useState("new"),[f,F]=t.useState(),[A,y]=t.useState(),[L,V]=t.useState(!1),[E,x]=t.useState(!1),[$,P]=t.useState(!1),R=t.useCallback(async c=>{var n;const d=l?c:await s.validateFields(),i=u.filter(a=>a.type==="color"),o={};for(const a of i){const e=I.getRealName(a.name,"upsertFieldName"),r=s.getFieldValue(e);o[e]=typeof r=="string"?r:(n=r==null?void 0:r.toHexString())==null?void 0:n.toUpperCase()}Object.assign(d,o),f&&v?(await v({...d,[k]:f[k]}),F(void 0)):!f&&b&&await b(d),y(void 0),s.resetFields(),m(!1)},[u,s,k,b,v,f,l]),U=t.useCallback(async c=>{V(c),x(!0)},[]),O=t.useCallback(async()=>{x(!0)},[]),D=t.useCallback(()=>{m(!0),N("new"),s.resetFields(),F(void 0),y(void 0)},[s]),H=t.useCallback(async(c,d=!0,i=!1)=>{try{P(!0),m(!0),N(i?"clone":"update");const o={};for(const n of u){const a=I.getRealName(n.name,"upsertFieldName"),e=c[a];if(i&&n.type==="image"){const r=e;try{const G=await n.provider.clone(r);o[a]=G;continue}catch{continue}}n.type==="date"||n.type==="time"?e&&(o[a]=X(e)):n.type==="select"?n.multiple&&Array.isArray(e)?o[a]=e.map(r=>r[n.innerFieldId??"id"]):e&&typeof e=="object"?o[a]=e[n.innerFieldId??"id"]:(e&&typeof e=="string"||typeof e=="number")&&(o[a]=e):o[a]=e}s.setFieldsValue(o),y(o),d&&F(c)}finally{P(!1)}},[u,s]);t.useImperativeHandle(_,()=>({create:D,update:H}),[D,H]),t.useEffect(()=>{C&&(V(!1),x(!1))},[C]);const w=t.useCallback(async()=>{try{if(p==="clone"){const c=l?f:s.getFieldsValue(),d=u.filter(i=>i.type==="image");for(const i of d)c[i.name]&&i.provider.delete(c[i.name])}}finally{}l||s.resetFields(),y(void 0),F(void 0),m(!1)},[p,l,s,f,u]);return g.jsx(B.Modal,{width:T?"100%":void 0,title:S(p??"new"),open:C,confirmLoading:h||j,okText:S("str."+(p==="update"?"update":"save")),cancelText:S("str.cancel"),cancelButtonProps:{disabled:E,hidden:!!l},okButtonProps:{disabled:L,hidden:!!l},onCancel:w,onOk:()=>R(),destroyOnHidden:!0,children:g.jsxs(B.Spin,{spinning:$,children:[l?null:g.jsx(J.CrudForm,{purpose:p,fields:u,form:s,formBuilder:W,grid:M,onDeleteFile:O,onUploadFile:U,onValuesChange:q}),l&&g.jsx(K,{submitting:h||j,className:"mt-2",onSave:R,updatingValue:A,fields:u,onDeleteFile:O,onUploadFile:U,purpose:p,wizard:l,onValuesChange:q})]})})},Z=t.forwardRef(Y);module.exports=Z;
|
|
1
|
+
"use strict";const g=require("react/jsx-runtime"),B=require("antd"),t=require("react"),J=require("../CrudForm.cjs.js"),K=require("../CrudFormWizard.cjs.js"),Q=require("../../locale/index.cjs.js"),I=require("../../util/CrudUtil.cjs.js"),X=require("dayjs"),Y=({fields:u,wizard:l,grid:M,fullWidthModal:T,isCreating:h,isUpdating:j,onCreate:b,onUpdate:v,idField:k="id",formBuilder:W,onValuesChange:q},_)=>{const[s]=B.Form.useForm(),{t:S}=Q.useTranslationLib(),[C,m]=t.useState(!1),[p,N]=t.useState("new"),[f,F]=t.useState(),[A,y]=t.useState(),[L,V]=t.useState(!1),[E,x]=t.useState(!1),[$,P]=t.useState(!1),R=t.useCallback(async c=>{var n;const d=l?c:await s.validateFields(),i=u.filter(a=>a.type==="color"),o={};for(const a of i){const e=I.getRealName(a.name,"upsertFieldName"),r=s.getFieldValue(e);o[e]=typeof r=="string"?r:(n=r==null?void 0:r.toHexString())==null?void 0:n.toUpperCase()}Object.assign(d,o),f&&v?(await v({...d,[k]:f[k]}),F(void 0)):!f&&b&&await b(d),y(void 0),s.resetFields(),m(!1)},[u,s,k,b,v,f,l]),U=t.useCallback(async c=>{V(c),x(!0)},[]),O=t.useCallback(async()=>{x(!0)},[]),D=t.useCallback(()=>{m(!0),N("new"),s.resetFields(),F(void 0),y(void 0)},[s]),H=t.useCallback(async(c,d=!0,i=!1)=>{try{P(!0),m(!0),N(i?"clone":"update");const o={};for(const n of u){const a=I.getRealName(n.name,"upsertFieldName"),e=c[a];if(i&&n.type==="image"){const r=e;try{const G=await n.provider.clone(r);o[a]=G;continue}catch{continue}}n.type==="date"||n.type==="time"?e&&(o[a]=X(e)):n.type==="select"?n.multiple&&Array.isArray(e)?o[a]=e.map(r=>r[n.innerFieldId??"id"]):e&&typeof e=="object"?o[a]=e[n.innerFieldId??"id"]:(e&&typeof e=="string"||typeof e=="number")&&(o[a]=e):o[a]=e}s.setFieldsValue(o),y(o),d&&F(c)}finally{P(!1)}},[u,s]);t.useImperativeHandle(_,()=>({create:D,update:H}),[D,H]),t.useEffect(()=>{C&&(V(!1),x(!1))},[C]);const w=t.useCallback(async()=>{try{if(p==="clone"){const c=l?f:s.getFieldsValue(),d=u.filter(i=>i.type==="image");for(const i of d)c[i.name]&&i.provider.delete(c[i.name])}}finally{}l||s.resetFields(),y(void 0),F(void 0),m(!1)},[p,l,s,f,u]);return g.jsx(B.Modal,{width:T?"100%":void 0,title:S("str."+(p??"new")),open:C,confirmLoading:h||j,okText:S("str."+(p==="update"?"update":"save")),cancelText:S("str.cancel"),cancelButtonProps:{disabled:E,hidden:!!l},okButtonProps:{disabled:L,hidden:!!l},onCancel:w,onOk:()=>R(),destroyOnHidden:!0,children:g.jsxs(B.Spin,{spinning:$,children:[l?null:g.jsx(J.CrudForm,{purpose:p,fields:u,form:s,formBuilder:W,grid:M,onDeleteFile:O,onUploadFile:U,onValuesChange:q}),l&&g.jsx(K,{submitting:h||j,className:"mt-2",onSave:R,updatingValue:A,fields:u,onDeleteFile:O,onUploadFile:U,purpose:p,wizard:l,onValuesChange:q})]})})},Z=t.forwardRef(Y);module.exports=Z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),qt=require("antd"),Ct=require("@dnd-kit/core"),St=require("@dnd-kit/modifiers"),It=require("@dnd-kit/utilities"),T=require("@dnd-kit/sortable"),Rt=require("../../common/button/Button.cjs.js"),lt=require("../../common/button/RefreshButton.cjs.js"),Mt=require("../../common/button/ViewButtonTable.cjs.js"),dt=require("../actions/index.cjs.js"),Tt=require("../../common/table/table.cjs.js"),s=require("react"),Vt=require("../../locale/index.cjs.js"),Bt=require("../CrudSearchComponent.cjs.js"),Dt=require("./CrudDecListView.cjs.js"),st=require("./CrudViewerUtil.cjs.js"),Ot=require("@ant-design/icons"),rt=require("../../util/CrudUtil.cjs.js"),Nt=require("../../common/layout/VerticalSpace.cjs.js"),kt=s.memo(Tt);function Et({summary:j,idField:o="id",loadingData:q,fields:h,isDeleting:l,isHiding:V,viewable:c=!1,paginateProps:f,onDelete:S,deletable:M,updatable:k,onHide:z,onUpdate:B,data:I=[],extraAction:D,onClickUpdate:O,minusHeight:E,scroll:$,onClickClone:A,className:_,expandable:G,size:J,bordered:K,descListColumn:ut,extraView:L,decListLayout:it,scrollToTop:zt,onClickRefresh:Q,closeViewOnClickUpdate:X,onExport:Y,confirmHiding:Z,confirmDeleting:W,rowClassName:P,actionWidth:H=190,draggable:t,rowSelection:U,...ft}){const{t:w}=Vt.useTranslationLib(),p=s.useMemo(()=>h.map(({hideInTable:e,hidden:r,width:u,label:m,halign:R,...C})=>{const N=rt.getRealName(C.name);return{title:m,width:u,key:N,dataIndex:N,hidden:e||r,align:R??(C.type==="number"?"right":void 0),render:st.getRendererValueCrudViewer(C),sorter:C.sorter,defaultSortOrder:C.defaultSortOrder}}),[h]),[i,d]=s.useState(),[F,a]=s.useState(),[y,b]=s.useState([]),mt=s.useCallback(e=>{d(e)},[]);s.useEffect(()=>{I&&b(I)},[I]),s.useEffect(()=>{I&&d(e=>{if(e)return I.find(r=>r[o]===e[o])})},[I,o,i]);const g=s.useCallback(e=>{var m;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 R=y.findIndex(x=>x[o]===r.id),C=y.findIndex(x=>x[o]===(u==null?void 0:u.id)),N=T.arrayMove(y,R,C);b(x=>{const ht=x.findIndex(v=>v[o]===(r==null?void 0:r.id)),yt=x.findIndex(v=>v[o]===(u==null?void 0:u.id));return T.arrayMove(x,ht,yt)}),(m=t==null?void 0:t.onDrag)==null||m.call(t,{newOrder:N.map(x=>x[o])})}},[y,o,t]),xt=s.useMemo(()=>{let e=typeof c=="string"?i==null?void 0:i[c]:void 0;if(typeof e=="object"){const r=h.find(u=>rt.getRealName(u.name)===c);e=st.getRendererValueCrudViewer(r)(e,i,0)}return e},[c,i,h]),tt=s.useMemo(()=>({rowSelection:U,rowClassName:P,className:_,scroll:$??(E?{y:`calc(100vh - ${E})`}:void 0),id:"crud-table",bordered:K,size:J,expandable:G}),[U,P,_,$,E,K,J,G]),et=s.useMemo(()=>f?{...f,total:f.count,onChange:f.setPage,current:f.page,pageSize:f.pageSize}:void 0,[f]),nt=s.useMemo(()=>{const e=B||O||S||D||c,r=[];return t&&r.push({key:"key",align:"center",width:5,title:t==null?void 0:t.columnLabel,render:()=>n.jsx(Lt,{tooltip:t==null?void 0:t.tooltip})}),r.push(...p),e&&e&&r.push({title:w("str.action"),fixed:"right",width:H,render:(u,m)=>n.jsxs(n.Fragment,{children:[c&&n.jsx(Mt,{value:m,onClick:typeof c=="object"?()=>{var R;return(R=c.onClick)==null?void 0:R.call(c,m)}:mt}),n.jsx(dt,{data:m,idField:o,extraAction:D,onUpdate:B,onClickUpdate:O,onClickClone:A,onDelete:S,deletable:M,updatable:k,onHide:z,onExport:Y,isHiding:V,isDeleting:l,confirmHiding:Z,confirmDeleting:W,closeViewOnClickUpdate:X,recentUpdateOrDeleteId:F,setRecentUpdateOrDeleteId:a,setOpenView:d})]})}),r},[p,B,O,S,M,k,D,c,w,H]),ot=s.useMemo(()=>y.map(e=>e[o]),[y,o]),jt=s.useCallback(()=>{const e=n.jsx(kt,{...tt,summary:j,dataSource:y,loading:q,components:t?{body:{row:vt}}:void 0,pagination:et,columns:nt});return t?n.jsx(Ct.DndContext,{modifiers:[St.restrictToVerticalAxis],onDragEnd:g,children:n.jsx(T.SortableContext,{items:ot,strategy:T.verticalListSortingStrategy,children:e})}):e},[tt,y,q,et,nt,j,t,ot,g]);return n.jsxs("div",{children:[(typeof c=="boolean"||typeof c=="string")&&n.jsx(qt.Modal,{width:"100%",open:!!i,title:xt??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>d(void 0),children:!!i&&n.jsxs("div",{children:[n.jsx(Dt.CrudDecListView,{layout:it,descListColumn:ut,data:i,fields:h,idField:o,extraAction:D,onUpdate:B,onClickUpdate:O,onClickClone:A,onDelete:S,deletable:M,updatable:k,onHide:z,onExport:Y,isHiding:V,isDeleting:l,confirmHiding:Z,confirmDeleting:W,closeViewOnClickUpdate:X,recentUpdateOrDeleteId:F,setRecentUpdateOrDeleteId:a,setOpenView:d}),L==null?void 0:L(i)]},i==null?void 0:i[o])}),n.jsx(Bt,{fields:h,...ft}),n.jsxs(Nt,{children:[!!Q&&n.jsx(lt.RefreshButton,{onClick:Q}),jt()]})]})}const ct=s.createContext({}),Lt=({tooltip:j})=>{const{setActivatorNodeRef:o,listeners:q}=s.useContext(ct);return n.jsx(Rt,{type:"text",size:"small",tooltip:j,icon:n.jsx(Ot.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:o,...q})},vt=j=>{const{attributes:o,listeners:q,setNodeRef:h,setActivatorNodeRef:l,transform:V,transition:c,isDragging:f}=T.useSortable({id:j["data-row-key"]}),S={...j.style,transform:It.CSS.Translate.toString(V),transition:c,...f?{position:"relative",zIndex:9999}:{}},M=s.useMemo(()=>({setActivatorNodeRef:l,listeners:q}),[l,q]);return n.jsx(ct.Provider,{value:M,children:n.jsx("tr",{...j,ref:h,style:S,...o})})};module.exports=Et;
|
|
@@ -42,5 +42,5 @@ export type CrudViewerProps<T, FormType> = {
|
|
|
42
42
|
actionWidth?: string | number;
|
|
43
43
|
draggable?: CrudDragableProps<T>;
|
|
44
44
|
} & CrudActionsProps<T, FormType> & CrudSearchComponentProps<T, FormType>;
|
|
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
|
+
declare function CrudViewer<T, FormType = T>({ summary, idField, loadingData, fields, isDeleting, isHiding, viewable, paginateProps, onDelete, deletable, updatable, 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;
|
|
46
46
|
export default CrudViewer;
|