@kingteza/crud-component 1.34.1 → 1.35.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/actions/index.cjs.js +1 -1
- package/dist/crud/actions/index.d.ts +4 -1
- package/dist/crud/actions/index.es.js +82 -63
- package/dist/crud/view/CrudDecListView.cjs.js +1 -1
- package/dist/crud/view/CrudDecListView.es.js +40 -36
- package/dist/crud/view/CrudViewer.cjs.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/util/crud/crud-action.util.cjs.js +1 -0
- package/dist/util/crud/crud-action.util.d.ts +2 -0
- package/dist/util/crud/crud-action.util.es.js +20 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),b=require("react"),$=require("../../common/button/CloneButtonTable.cjs.js"),H=require("../../common/button/DeleteButtonTable.cjs.js"),w=require("../../common/button/ExportButton.cjs.js"),B=require("../../common/button/HideButtonTable.cjs.js"),C=require("../../common/button/UpdateButtonTable.cjs.js"),k=require("../../util/crud/crud-action.util.cjs.js"),V=require("../modal/index.cjs.js");function K({data:u,idField:r="id",extraAction:c,onUpdate:L,onClickUpdate:v,onClickClone:m,onDelete:y,onHide:g,onExport:_,isHiding:o,isDeleting:S,confirmHiding:N,confirmDeleting:Q,closeViewOnClickUpdate:n,recentUpdateOrDeleteId:A,setRecentUpdateOrDeleteId:j,setOpenView:x,inBuiltModalProps:q,updatable:T,deletable:h}){const W=c==null?void 0:c(u),E=b.useRef(null),z=b.useCallback((f,Z=!0,G=!1)=>{var J;j==null||j(f[r]),q?(J=E.current)==null||J.update(f,Z,G):G?m==null||m(f):v==null||v(f),n&&(x==null||x(void 0))},[r,q,m,v,n,x,j]),X=b.useMemo(()=>!!(!T||T(u)),[T,u]),Y=b.useMemo(()=>!!(!h||h(u)),[h,u]);return s.jsxs(s.Fragment,{children:[q&&s.jsx(V,{ref:E,...q}),W,(L||v||(q==null?void 0:q.onUpdate))&&X&&s.jsx(C,{value:u,onClick:f=>z(f)}),(m||(q==null?void 0:q.onCreate))&&s.jsx($,{value:u,onClick:f=>z(f,!1,!0)}),_&&s.jsx(w.ExportButton,{value:u,onClick:async f=>await _(f)}),g&&s.jsx(B,{value:u,disabled:o,shouldConfirm:N,loading:o&&u[r]===A,onClick:async f=>{j==null||j(f[r]),await g({[r]:f[r]})}}),y&&Y&&s.jsx(H,{value:u,disabled:S,shouldConfirm:Q,loading:S&&u[r]===A,onClick:async f=>{j==null||j(f[r]),await y({[r]:f[r]})}})]})}function F(u){if(k.hasCrudActions(u,u.data))return s.jsx(K,{...u})}exports.CrudActionsInternal=K;exports.default=F;
|
|
@@ -22,7 +22,10 @@ export interface CrudActionsProps<T, FormType> {
|
|
|
22
22
|
setOpenView?: (data: T | undefined) => void;
|
|
23
23
|
inBuiltModalProps?: CrudModalProps<T, FormType>;
|
|
24
24
|
}
|
|
25
|
-
declare function
|
|
25
|
+
export declare function CrudActionsInternal<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> & {
|
|
26
|
+
data: T;
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function CrudActions<T, FormType>(props: CrudActionsProps<T, FormType> & {
|
|
26
29
|
data: T;
|
|
27
30
|
}): import("react/jsx-runtime").JSX.Element | undefined;
|
|
28
31
|
export default CrudActions;
|
|
@@ -1,85 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { ExportButton as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as h, jsxs as w, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as k, useCallback as B, useMemo as W } from "react";
|
|
3
|
+
import V from "../../common/button/CloneButtonTable.es.js";
|
|
4
|
+
import F from "../../common/button/DeleteButtonTable.es.js";
|
|
5
|
+
import { ExportButton as c } from "../../common/button/ExportButton.es.js";
|
|
6
|
+
import M from "../../common/button/HideButtonTable.es.js";
|
|
7
|
+
import s from "../../common/button/UpdateButtonTable.es.js";
|
|
8
|
+
import { hasCrudActions as P } from "../../util/crud/crud-action.util.es.js";
|
|
9
|
+
import R from "../modal/index.es.js";
|
|
10
|
+
function I({
|
|
11
|
+
data: f,
|
|
12
|
+
idField: u = "id",
|
|
13
|
+
extraAction: y,
|
|
14
|
+
onUpdate: X,
|
|
14
15
|
onClickUpdate: T,
|
|
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:
|
|
28
|
-
updatable:
|
|
29
|
-
deletable:
|
|
16
|
+
onClickClone: b,
|
|
17
|
+
onDelete: q,
|
|
18
|
+
onHide: x,
|
|
19
|
+
onExport: z,
|
|
20
|
+
isHiding: E,
|
|
21
|
+
isDeleting: G,
|
|
22
|
+
confirmHiding: Y,
|
|
23
|
+
confirmDeleting: Z,
|
|
24
|
+
closeViewOnClickUpdate: J,
|
|
25
|
+
recentUpdateOrDeleteId: K,
|
|
26
|
+
setRecentUpdateOrDeleteId: r,
|
|
27
|
+
setOpenView: o,
|
|
28
|
+
inBuiltModalProps: v,
|
|
29
|
+
updatable: j,
|
|
30
|
+
deletable: g
|
|
30
31
|
}) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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));
|
|
32
|
+
const _ = y == null ? void 0 : y(f), L = k(null), N = B(
|
|
33
|
+
(m, H = !0, Q = !1) => {
|
|
34
|
+
var S;
|
|
35
|
+
r == null || r(m[u]), v ? (S = L.current) == null || S.update(m, H, Q) : Q ? b == null || b(m) : T == null || T(m), J && (o == null || o(void 0));
|
|
36
36
|
},
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
[
|
|
38
|
+
u,
|
|
39
|
+
v,
|
|
40
|
+
b,
|
|
41
|
+
T,
|
|
42
|
+
J,
|
|
43
|
+
o,
|
|
44
|
+
r
|
|
45
|
+
]
|
|
46
|
+
), $ = W(
|
|
47
|
+
() => !!(!j || j(f)),
|
|
48
|
+
[j, f]
|
|
49
|
+
), A = W(
|
|
50
|
+
() => !!(!g || g(f)),
|
|
51
|
+
[g, f]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ w(C, { children: [
|
|
54
|
+
v && /* @__PURE__ */ h(R, { ref: L, ...v }),
|
|
55
|
+
_,
|
|
56
|
+
(X || T || (v == null ? void 0 : v.onUpdate)) && $ && /* @__PURE__ */ h(s, { value: f, onClick: (m) => N(m) }),
|
|
57
|
+
(b || (v == null ? void 0 : v.onCreate)) && /* @__PURE__ */ h(
|
|
58
|
+
V,
|
|
45
59
|
{
|
|
46
|
-
value:
|
|
47
|
-
onClick: (m) =>
|
|
60
|
+
value: f,
|
|
61
|
+
onClick: (m) => N(m, !1, !0)
|
|
48
62
|
}
|
|
49
63
|
),
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
z && /* @__PURE__ */ h(
|
|
65
|
+
c,
|
|
52
66
|
{
|
|
53
|
-
value:
|
|
54
|
-
onClick: async (m) => await
|
|
67
|
+
value: f,
|
|
68
|
+
onClick: async (m) => await z(m)
|
|
55
69
|
}
|
|
56
70
|
),
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
x && /* @__PURE__ */ h(
|
|
72
|
+
M,
|
|
59
73
|
{
|
|
60
|
-
value:
|
|
61
|
-
disabled:
|
|
62
|
-
shouldConfirm:
|
|
63
|
-
loading:
|
|
74
|
+
value: f,
|
|
75
|
+
disabled: E,
|
|
76
|
+
shouldConfirm: Y,
|
|
77
|
+
loading: E && f[u] === K,
|
|
64
78
|
onClick: async (m) => {
|
|
65
|
-
|
|
79
|
+
r == null || r(m[u]), await x({ [u]: m[u] });
|
|
66
80
|
}
|
|
67
81
|
}
|
|
68
82
|
),
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
q && A && /* @__PURE__ */ h(
|
|
84
|
+
F,
|
|
71
85
|
{
|
|
72
|
-
value:
|
|
73
|
-
disabled:
|
|
74
|
-
shouldConfirm:
|
|
75
|
-
loading:
|
|
86
|
+
value: f,
|
|
87
|
+
disabled: G,
|
|
88
|
+
shouldConfirm: Z,
|
|
89
|
+
loading: G && f[u] === K,
|
|
76
90
|
onClick: async (m) => {
|
|
77
|
-
|
|
91
|
+
r == null || r(m[u]), await q({ [u]: m[u] });
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
94
|
)
|
|
81
|
-
] })
|
|
95
|
+
] });
|
|
96
|
+
}
|
|
97
|
+
function d(f) {
|
|
98
|
+
if (P(f, f.data))
|
|
99
|
+
return /* @__PURE__ */ h(I, { ...f });
|
|
82
100
|
}
|
|
83
101
|
export {
|
|
84
|
-
|
|
102
|
+
I as CrudActionsInternal,
|
|
103
|
+
d as default
|
|
85
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("../../common/description/DescList.cjs.js"),h=require("react"),x=require("../../locale/index.cjs.js"),j=require("./CrudViewerUtil.cjs.js"),w=require("../../util/CrudUtil.cjs.js"),V=require("../actions/index.cjs.js"),v=require("../../util/ObjectUtil.cjs.js"),f=require("../../util/crud/crud-action.util.cjs.js");function L({className:a,fields:n,data:e,descListColumn:d={xs:1,md:3,sm:2,lg:4},layout:m,keepEmptyValues:q,inBuiltModalProps:o,...i}){const{t:s}=x.useTranslationLib(),b=h.useMemo(()=>{const c=n.filter(({hidden:t,hideInDescList:u})=>!t&&!u).map((t,u)=>{const g=w.getRealName(t.name);return{label:t.label,noFormatting:!0,value:j.getRendererValueCrudViewer(t)(v.getValueByPath(e,g),e,u)}}),l=f.hasCrudActions(i,e)?r.jsx(V.CrudActionsInternal,{data:e,...i,inBuiltModalProps:o?{...o,fields:n}:void 0}):void 0;return l&&c.push({label:s("str.action"),value:l}),c},[e,n,s,i]);return e?r.jsx(C,{keepEmptyValues:q,bordered:!0,column:d,className:a,layout:m,list:b}):r.jsx(r.Fragment,{})}exports.CrudDecListView=L;
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
import { jsx as m, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { useTranslationLib as
|
|
5
|
-
import { getRendererValueCrudViewer as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getValueByPath as
|
|
1
|
+
import { jsx as m, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import C from "../../common/description/DescList.es.js";
|
|
3
|
+
import { useMemo as b } from "react";
|
|
4
|
+
import { useTranslationLib as v } from "../../locale/index.es.js";
|
|
5
|
+
import { getRendererValueCrudViewer as w } from "./CrudViewerUtil.es.js";
|
|
6
|
+
import V from "../../util/CrudUtil.es.js";
|
|
7
|
+
import { CrudActionsInternal as x } from "../actions/index.es.js";
|
|
8
|
+
import { getValueByPath as F } from "../../util/ObjectUtil.es.js";
|
|
9
|
+
import { hasCrudActions as L } from "../../util/crud/crud-action.util.es.js";
|
|
9
10
|
function T({
|
|
10
|
-
className:
|
|
11
|
+
className: c,
|
|
11
12
|
fields: t,
|
|
12
|
-
data:
|
|
13
|
+
data: o,
|
|
13
14
|
descListColumn: f = { xs: 1, md: 3, sm: 2, lg: 4 },
|
|
14
|
-
layout:
|
|
15
|
+
layout: p,
|
|
15
16
|
keepEmptyValues: a,
|
|
16
|
-
inBuiltModalProps:
|
|
17
|
-
...
|
|
17
|
+
inBuiltModalProps: n,
|
|
18
|
+
...e
|
|
18
19
|
}) {
|
|
19
|
-
const { t:
|
|
20
|
-
const l = t.filter(({ hidden:
|
|
21
|
-
const
|
|
20
|
+
const { t: s } = v(), h = b(() => {
|
|
21
|
+
const l = t.filter(({ hidden: r, hideInDescList: i }) => !r && !i).map((r, i) => {
|
|
22
|
+
const d = V.getRealName(r.name);
|
|
22
23
|
return {
|
|
23
|
-
label:
|
|
24
|
+
label: r.label,
|
|
24
25
|
noFormatting: !0,
|
|
25
|
-
value:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
value: w(r)(
|
|
27
|
+
F(o, d),
|
|
28
|
+
o,
|
|
29
|
+
i
|
|
29
30
|
)
|
|
30
31
|
};
|
|
31
|
-
}),
|
|
32
|
-
|
|
32
|
+
}), u = L(
|
|
33
|
+
e,
|
|
34
|
+
o
|
|
35
|
+
) ? /* @__PURE__ */ m(
|
|
36
|
+
x,
|
|
33
37
|
{
|
|
34
|
-
data:
|
|
35
|
-
...
|
|
36
|
-
inBuiltModalProps:
|
|
38
|
+
data: o,
|
|
39
|
+
...e,
|
|
40
|
+
inBuiltModalProps: n ? { ...n, fields: t } : void 0
|
|
37
41
|
}
|
|
38
42
|
) : void 0;
|
|
39
|
-
return
|
|
40
|
-
label:
|
|
41
|
-
value:
|
|
43
|
+
return u && l.push({
|
|
44
|
+
label: s("str.action"),
|
|
45
|
+
value: u
|
|
42
46
|
}), l;
|
|
43
|
-
}, [
|
|
44
|
-
return
|
|
45
|
-
|
|
47
|
+
}, [o, t, s, e]);
|
|
48
|
+
return o ? /* @__PURE__ */ m(
|
|
49
|
+
C,
|
|
46
50
|
{
|
|
47
51
|
keepEmptyValues: a,
|
|
48
52
|
bordered: !0,
|
|
49
53
|
column: f,
|
|
50
|
-
className:
|
|
51
|
-
layout:
|
|
52
|
-
list:
|
|
54
|
+
className: c,
|
|
55
|
+
layout: p,
|
|
56
|
+
list: h
|
|
53
57
|
}
|
|
54
|
-
) : /* @__PURE__ */ m(
|
|
58
|
+
) : /* @__PURE__ */ m(g, {});
|
|
55
59
|
}
|
|
56
60
|
export {
|
|
57
61
|
T as CrudDecListView
|
|
@@ -1 +1 @@
|
|
|
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"),
|
|
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"),dt=require("../../common/button/ViewButtonTable.cjs.js"),Mt=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:d,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,M]=s.useState(),[F,a]=s.useState(),[y,b]=s.useState([]),mt=s.useCallback(e=>{M(e)},[]);s.useEffect(()=>{I&&b(I)},[I]),s.useEffect(()=>{I&&M(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(dt,{value:m,onClick:typeof c=="object"?()=>{var R;return(R=c.onClick)==null?void 0:R.call(c,m)}:mt}),n.jsx(Mt.default,{data:m,idField:o,extraAction:D,onUpdate:B,onClickUpdate:O,onClickClone:A,onDelete:S,deletable:d,updatable:k,onHide:z,onExport:Y,isHiding:V,isDeleting:l,confirmHiding:Z,confirmDeleting:W,closeViewOnClickUpdate:X,recentUpdateOrDeleteId:F,setRecentUpdateOrDeleteId:a,setOpenView:M})]})}),r},[p,B,O,S,d,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:()=>M(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:d,updatable:k,onHide:z,onExport:Y,isHiding:V,isDeleting:l,confirmHiding:Z,confirmDeleting:W,closeViewOnClickUpdate:X,recentUpdateOrDeleteId:F,setRecentUpdateOrDeleteId:a,setOpenView:M}),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}:{}},d=s.useMemo(()=>({setActivatorNodeRef:l,listeners:q}),[l,q]);return n.jsx(ct.Provider,{value:d,children:n.jsx("tr",{...j,ref:h,style:S,...o})})};module.exports=Et;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const i=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const i=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),t=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),C=require("./crud/CrudFormWizard.cjs.js"),n=require("./crud/CrudReportComponent.cjs.js"),l=require("./crud/CrudSearchComponent.cjs.js"),e=require("./crud/ImageCrudField.cjs.js"),o=require("./crud/FileCrudField.cjs.js"),a=require("./crud/FileCrudDragNDropField.cjs.js"),s=require("./crud/CrudTextAreaComponent.cjs.js"),m=require("./crud/import/CrudImportComponent.cjs.js"),F=require("./crud/import/CrudImportButton.cjs.js"),p=require("./crud/actions/index.cjs.js"),c=require("./crud/view/CrudViewer.cjs.js"),q=require("./context/CrudComponentProvider.cjs.js"),d=require("./crud/CrudForm.cjs.js"),V=require("./crud/modal/index.cjs.js"),I=require("./crud/view/CrudDecListView.cjs.js"),g=require("./crud/view/CrudViewerUtil.cjs.js");exports.TRANSLATION_NAMESPACE=i.TRANSLATION_NAMESPACE;exports.setupI18n=u.setupI18n;exports.updateTranslations=u.updateTranslations;exports.CrudComponent=t;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=C;exports.CrudReportComponent=n;exports.CrudSearchComponent=l;exports.FileDownloadProvider=e.FileDownloadProvider;exports.FileUploadProvider=e.FileUploadProvider;exports.ImageCellValue=e.ImageCellValue;exports.ImageCrudCellValue=e.ImageCrudCellValue;exports.ImageCrudField=e.default;exports.FileCellValue=o.FileCellValue;exports.FileCrudCellValue=o.FileCrudCellValue;exports.FileCrudField=o.default;exports.FileCrudDragNDropField=a;exports.CrudTextAreaComponent=s;exports.CrudImportComponent=m;exports.CrudImportButton=F;exports.CrudActions=p.default;exports.CrudViewer=c;exports.CrudComponentProvider=q.CrudComponentProvider;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.CrudModal=V;exports.CrudDecListView=I.CrudDecListView;exports.getRendererValueCrudViewer=g.getRendererValueCrudViewer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(a,n){const{extraAction:t,onUpdate:l,onClickUpdate:s,onClickClone:u,onDelete:C,onHide:d,onExport:f,inBuiltModalProps:e,updatable:r,deletable:c}=a;if(!n)return!1;const o=t==null?void 0:t(n),i=r?r(n):!0,b=c?c(n):!0;return!!((Array.isArray(o)?o.filter(Boolean).length:o)||l||i&&s||e!=null&&e.onUpdate||u||e!=null&&e.onCreate||b&&C||f||d)}exports.hasCrudActions=p;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function d(a, n) {
|
|
2
|
+
const {
|
|
3
|
+
extraAction: t,
|
|
4
|
+
onUpdate: l,
|
|
5
|
+
onClickUpdate: s,
|
|
6
|
+
onClickClone: C,
|
|
7
|
+
onDelete: f,
|
|
8
|
+
onHide: p,
|
|
9
|
+
onExport: u,
|
|
10
|
+
inBuiltModalProps: e,
|
|
11
|
+
updatable: r,
|
|
12
|
+
deletable: c
|
|
13
|
+
} = a;
|
|
14
|
+
if (!n) return !1;
|
|
15
|
+
const o = t == null ? void 0 : t(n), U = r ? r(n) : !0, b = c ? c(n) : !0;
|
|
16
|
+
return !!((Array.isArray(o) ? o.filter(Boolean).length : o) || l || U && s || e != null && e.onUpdate || C || e != null && e.onCreate || b && f || u || p);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
d as hasCrudActions
|
|
20
|
+
};
|