@kingteza/crud-component 1.0.65 → 1.0.66
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/App.d.ts +126 -0
- package/crud/actions/index.cjs.js +1 -1
- package/crud/actions/index.es.js +64 -59
- package/crud/modal/index.cjs.js +1 -1
- package/crud/modal/index.es.js +27 -27
- package/crud/view/CrudDecListView.cjs.js +1 -1
- package/crud/view/CrudDecListView.d.ts +2 -2
- package/crud/view/CrudDecListView.es.js +22 -22
- package/package.json +1 -1
package/App.d.ts
CHANGED
|
@@ -23,3 +23,129 @@ export type Purchase = {
|
|
|
23
23
|
};
|
|
24
24
|
declare function App(): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
export default App;
|
|
26
|
+
export declare const useWorkShiftCrudComponentProps: () => {
|
|
27
|
+
onCreate: (e: any) => Promise<void>;
|
|
28
|
+
onUpdate: (e: any) => Promise<void>;
|
|
29
|
+
onDelete: (e: any) => Promise<void>;
|
|
30
|
+
isCreating: boolean;
|
|
31
|
+
isUpdating: boolean;
|
|
32
|
+
isDeleting: boolean;
|
|
33
|
+
fields: ({
|
|
34
|
+
grid: {
|
|
35
|
+
md: number;
|
|
36
|
+
xs: number;
|
|
37
|
+
};
|
|
38
|
+
name: string;
|
|
39
|
+
label: string;
|
|
40
|
+
type: string;
|
|
41
|
+
required: boolean;
|
|
42
|
+
hideInTable?: undefined;
|
|
43
|
+
format?: undefined;
|
|
44
|
+
use12Hours?: undefined;
|
|
45
|
+
readonly?: undefined;
|
|
46
|
+
int?: undefined;
|
|
47
|
+
max?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
grid: {
|
|
50
|
+
md: number;
|
|
51
|
+
xs: number;
|
|
52
|
+
};
|
|
53
|
+
name: string;
|
|
54
|
+
label: string;
|
|
55
|
+
type: string;
|
|
56
|
+
hideInTable: boolean;
|
|
57
|
+
required?: undefined;
|
|
58
|
+
format?: undefined;
|
|
59
|
+
use12Hours?: undefined;
|
|
60
|
+
readonly?: undefined;
|
|
61
|
+
int?: undefined;
|
|
62
|
+
max?: undefined;
|
|
63
|
+
} | {
|
|
64
|
+
grid: {
|
|
65
|
+
md: number;
|
|
66
|
+
xs: number;
|
|
67
|
+
};
|
|
68
|
+
name: string;
|
|
69
|
+
label: string;
|
|
70
|
+
type: string;
|
|
71
|
+
format: string;
|
|
72
|
+
use12Hours: boolean;
|
|
73
|
+
required: boolean;
|
|
74
|
+
hideInTable?: undefined;
|
|
75
|
+
readonly?: undefined;
|
|
76
|
+
int?: undefined;
|
|
77
|
+
max?: undefined;
|
|
78
|
+
} | {
|
|
79
|
+
grid: {
|
|
80
|
+
md: number;
|
|
81
|
+
xs: number;
|
|
82
|
+
};
|
|
83
|
+
name: string;
|
|
84
|
+
label: string;
|
|
85
|
+
type: string;
|
|
86
|
+
format: string;
|
|
87
|
+
use12Hours: boolean;
|
|
88
|
+
readonly: boolean;
|
|
89
|
+
required?: undefined;
|
|
90
|
+
hideInTable?: undefined;
|
|
91
|
+
int?: undefined;
|
|
92
|
+
max?: undefined;
|
|
93
|
+
} | {
|
|
94
|
+
grid: {
|
|
95
|
+
md: number;
|
|
96
|
+
xs: number;
|
|
97
|
+
};
|
|
98
|
+
name: string;
|
|
99
|
+
label: string;
|
|
100
|
+
type: string;
|
|
101
|
+
int: boolean;
|
|
102
|
+
required: boolean;
|
|
103
|
+
hideInTable: boolean;
|
|
104
|
+
format?: undefined;
|
|
105
|
+
use12Hours?: undefined;
|
|
106
|
+
readonly?: undefined;
|
|
107
|
+
max?: undefined;
|
|
108
|
+
} | {
|
|
109
|
+
grid: {
|
|
110
|
+
md: number;
|
|
111
|
+
xs: number;
|
|
112
|
+
};
|
|
113
|
+
name: string;
|
|
114
|
+
label: string;
|
|
115
|
+
type: string;
|
|
116
|
+
int: boolean;
|
|
117
|
+
required: boolean;
|
|
118
|
+
hideInTable: boolean;
|
|
119
|
+
max: number;
|
|
120
|
+
format?: undefined;
|
|
121
|
+
use12Hours?: undefined;
|
|
122
|
+
readonly?: undefined;
|
|
123
|
+
} | {
|
|
124
|
+
name: string;
|
|
125
|
+
label: string;
|
|
126
|
+
type: string;
|
|
127
|
+
int: boolean;
|
|
128
|
+
required: boolean;
|
|
129
|
+
grid?: undefined;
|
|
130
|
+
hideInTable?: undefined;
|
|
131
|
+
format?: undefined;
|
|
132
|
+
use12Hours?: undefined;
|
|
133
|
+
readonly?: undefined;
|
|
134
|
+
max?: undefined;
|
|
135
|
+
} | {
|
|
136
|
+
grid: {
|
|
137
|
+
md: number;
|
|
138
|
+
xs: number;
|
|
139
|
+
};
|
|
140
|
+
name: string;
|
|
141
|
+
label: string;
|
|
142
|
+
type: string;
|
|
143
|
+
int: boolean;
|
|
144
|
+
required: boolean;
|
|
145
|
+
hideInTable?: undefined;
|
|
146
|
+
format?: undefined;
|
|
147
|
+
use12Hours?: undefined;
|
|
148
|
+
readonly?: undefined;
|
|
149
|
+
max?: undefined;
|
|
150
|
+
})[];
|
|
151
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const v=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const v=require("react/jsx-runtime"),Y=require("react"),A=require("../../common/button/CloneButtonTable.cjs.js"),H=require("../../common/button/DeleteButtonTable.cjs.js"),V=require("../../common/button/ExportButton.cjs.js"),s=require("../../common/button/HideButtonTable.cjs.js"),c=require("../../common/button/UpdateButtonTable.cjs.js"),r=require("../modal/index.cjs.js");function F({data:b,idField:j="id",extraAction:T,onUpdate:g,onClickUpdate:m,onClickClone:x,onDelete:h,onHide:z,onExport:E,isHiding:J,isDeleting:K,confirmHiding:Z,confirmDeleting:_,closeViewOnClickUpdate:$,recentUpdateOrDeleteId:L,setRecentUpdateOrDeleteId:q,setOpenView:G,inBuiltModalProps:f}){var S;const y=T==null?void 0:T(b),N=Y.useRef(null),Q=Y.useCallback((u,w=!0,W=!1)=>{var X;q==null||q(u[j]),f?(X=N.current)==null||X.update(u,w,W):W?x==null||x(u):m==null||m(u),$&&(G==null||G(void 0))},[f,m]);return console.log({onUpdate:g,onClickUpdate:m,onClickClone:x,onDelete:h}),(Array.isArray(y)?(S=y==null?void 0:y.filter(Boolean))!=null&&S.length:y)||g||m||f!=null&&f.onUpdate||x||f!=null&&f.onCreate||h||E||z?v.jsxs(v.Fragment,{children:[f&&v.jsx(r,{ref:N,...f}),y,(g||m||(f==null?void 0:f.onUpdate))&&v.jsx(c,{value:b,onClick:u=>Q(u)}),(x||(f==null?void 0:f.onCreate))&&v.jsx(A,{value:b,onClick:u=>Q(u,!1,!0)}),E&&v.jsx(V.ExportButton,{value:b,onClick:async u=>await E(u)}),z&&v.jsx(s,{value:b,disabled:J,shouldConfirm:Z,loading:J&&b[j]===L,onClick:async u=>{q==null||q(u[j]),await z({[j]:u[j]})}}),h&&v.jsx(H,{value:b,disabled:K,shouldConfirm:_,loading:K&&b[j]===L,onClick:async u=>{q==null||q(u[j]),await h({[j]:u[j]})}})]}):void 0}module.exports=F;
|
package/crud/actions/index.es.js
CHANGED
|
@@ -1,83 +1,88 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as E, Fragment as H, jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as x, useCallback as V } from "react";
|
|
3
|
+
import F from "../../common/button/CloneButtonTable.es.js";
|
|
4
4
|
import k from "../../common/button/DeleteButtonTable.es.js";
|
|
5
|
-
import { ExportButton as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
function
|
|
10
|
-
data:
|
|
11
|
-
idField:
|
|
12
|
-
extraAction:
|
|
5
|
+
import { ExportButton as r } from "../../common/button/ExportButton.es.js";
|
|
6
|
+
import C from "../../common/button/HideButtonTable.es.js";
|
|
7
|
+
import R from "../../common/button/UpdateButtonTable.es.js";
|
|
8
|
+
import I from "../modal/index.es.js";
|
|
9
|
+
function a({
|
|
10
|
+
data: y,
|
|
11
|
+
idField: b = "id",
|
|
12
|
+
extraAction: q,
|
|
13
13
|
onUpdate: z,
|
|
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:
|
|
14
|
+
onClickUpdate: h,
|
|
15
|
+
onClickClone: T,
|
|
16
|
+
onDelete: u,
|
|
17
|
+
onHide: G,
|
|
18
|
+
onExport: J,
|
|
19
|
+
isHiding: L,
|
|
20
|
+
isDeleting: N,
|
|
21
|
+
confirmHiding: _,
|
|
22
|
+
confirmDeleting: $,
|
|
23
|
+
closeViewOnClickUpdate: w,
|
|
24
|
+
recentUpdateOrDeleteId: Q,
|
|
25
|
+
setRecentUpdateOrDeleteId: v,
|
|
26
|
+
setOpenView: K,
|
|
27
|
+
inBuiltModalProps: f
|
|
28
28
|
}) {
|
|
29
|
-
var
|
|
30
|
-
const
|
|
31
|
-
(
|
|
32
|
-
var
|
|
33
|
-
|
|
29
|
+
var X;
|
|
30
|
+
const g = q == null ? void 0 : q(y), S = x(null), W = V(
|
|
31
|
+
(m, A = !0, Y = !1) => {
|
|
32
|
+
var Z;
|
|
33
|
+
v == null || v(m[b]), f ? (Z = S.current) == null || Z.update(m, A, Y) : Y ? T == null || T(m) : h == null || h(m), w && (K == null || K(void 0));
|
|
34
34
|
},
|
|
35
|
-
[
|
|
35
|
+
[f, h]
|
|
36
36
|
);
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
h,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
return console.log({
|
|
38
|
+
onUpdate: z,
|
|
39
|
+
onClickUpdate: h,
|
|
40
|
+
onClickClone: T,
|
|
41
|
+
onDelete: u
|
|
42
|
+
}), (Array.isArray(g) ? (X = g == null ? void 0 : g.filter(Boolean)) != null && X.length : g) || z || h || f != null && f.onUpdate || T || f != null && f.onCreate || u || J || G ? /* @__PURE__ */ E(H, { children: [
|
|
43
|
+
f && /* @__PURE__ */ j(I, { ref: S, ...f }),
|
|
44
|
+
g,
|
|
45
|
+
(z || h || (f == null ? void 0 : f.onUpdate)) && /* @__PURE__ */ j(R, { value: y, onClick: (m) => W(m) }),
|
|
46
|
+
(T || (f == null ? void 0 : f.onCreate)) && /* @__PURE__ */ j(
|
|
47
|
+
F,
|
|
43
48
|
{
|
|
44
|
-
value:
|
|
45
|
-
onClick: (
|
|
49
|
+
value: y,
|
|
50
|
+
onClick: (m) => W(m, !1, !0)
|
|
46
51
|
}
|
|
47
52
|
),
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
J && /* @__PURE__ */ j(
|
|
54
|
+
r,
|
|
50
55
|
{
|
|
51
|
-
value:
|
|
52
|
-
onClick: async (
|
|
56
|
+
value: y,
|
|
57
|
+
onClick: async (m) => await J(m)
|
|
53
58
|
}
|
|
54
59
|
),
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
G && /* @__PURE__ */ j(
|
|
61
|
+
C,
|
|
57
62
|
{
|
|
58
|
-
value:
|
|
59
|
-
disabled:
|
|
60
|
-
shouldConfirm:
|
|
61
|
-
loading:
|
|
62
|
-
onClick: async (
|
|
63
|
-
|
|
63
|
+
value: y,
|
|
64
|
+
disabled: L,
|
|
65
|
+
shouldConfirm: _,
|
|
66
|
+
loading: L && y[b] === Q,
|
|
67
|
+
onClick: async (m) => {
|
|
68
|
+
v == null || v(m[b]), await G({ [b]: m[b] });
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
),
|
|
67
|
-
|
|
72
|
+
u && /* @__PURE__ */ j(
|
|
68
73
|
k,
|
|
69
74
|
{
|
|
70
|
-
value:
|
|
71
|
-
disabled:
|
|
72
|
-
shouldConfirm:
|
|
73
|
-
loading:
|
|
74
|
-
onClick: async (
|
|
75
|
-
|
|
75
|
+
value: y,
|
|
76
|
+
disabled: N,
|
|
77
|
+
shouldConfirm: $,
|
|
78
|
+
loading: N && y[b] === Q,
|
|
79
|
+
onClick: async (m) => {
|
|
80
|
+
v == null || v(m[b]), await u({ [b]: m[b] });
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
83
|
)
|
|
79
84
|
] }) : void 0;
|
|
80
85
|
}
|
|
81
86
|
export {
|
|
82
|
-
|
|
87
|
+
a as default
|
|
83
88
|
};
|
package/crud/modal/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const g=require("react/jsx-runtime"),B=require("antd"),t=require("react"),G=require("../CrudForm.cjs.js"),J=require("../CrudFormWizard.cjs.js"),K=require("../../locale/index.cjs.js"),H=require("../../util/CrudUtil.cjs.js"),Q=require("dayjs"),X=({fields:u,wizard:l,grid:I,fullWidthModal:M,isCreating:h,isUpdating:j,onCreate:b,onUpdate:v,idField:k="id",formBuilder:T},W)=>{const[s]=B.Form.useForm(),{t:C}=K.useTranslationLib(),[S,m]=t.useState(!1),[p,q]=t.useState("new"),[f,F]=t.useState(),[_,y]=t.useState(),[A,N]=t.useState(!1),[L,x]=t.useState(!1),[E,V]=t.useState(!1),P=t.useCallback(async c=>{var
|
|
1
|
+
"use strict";const g=require("react/jsx-runtime"),B=require("antd"),t=require("react"),G=require("../CrudForm.cjs.js"),J=require("../CrudFormWizard.cjs.js"),K=require("../../locale/index.cjs.js"),H=require("../../util/CrudUtil.cjs.js"),Q=require("dayjs"),X=({fields:u,wizard:l,grid:I,fullWidthModal:M,isCreating:h,isUpdating:j,onCreate:b,onUpdate:v,idField:k="id",formBuilder:T},W)=>{const[s]=B.Form.useForm(),{t:C}=K.useTranslationLib(),[S,m]=t.useState(!1),[p,q]=t.useState("new"),[f,F]=t.useState(),[_,y]=t.useState(),[A,N]=t.useState(!1),[L,x]=t.useState(!1),[E,V]=t.useState(!1),P=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=H.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]),R=t.useCallback(async c=>{N(c),x(!0)},[]),U=t.useCallback(async()=>{x(!0)},[]),O=t.useCallback(()=>{m(!0),q("new"),s.resetFields(),F(void 0),y(void 0)},[s]),D=t.useCallback(async(c,d=!0,i=!1)=>{try{V(!0),m(!0),q(i?"clone":"update");const o={};for(const n of u){const a=H.getRealName(n.name,"upsertFieldName"),e=c[a];if(i&&n.type==="image"){const r=e;try{const w=await n.provider.clone(r);o[a]=w;continue}catch{continue}}n.type==="date"||n.type==="time"?e&&(o[a]=Q(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{V(!1)}},[u,s]);t.useImperativeHandle(W,()=>({create:O,update:D}),[O,D]),t.useEffect(()=>{S&&(N(!1),x(!1))},[S]);const $=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:M?"100%":void 0,title:C(p??"new"),open:S,confirmLoading:h||j,okText:C("str."+(p==="update"?"update":"save")),cancelText:C("str.cancel"),cancelButtonProps:{disabled:L,hidden:!!l},okButtonProps:{disabled:A,hidden:!!l},onCancel:$,onOk:()=>P(),destroyOnHidden:!0,children:g.jsxs(B.Spin,{spinning:E,children:[l?null:g.jsx(G.CrudForm,{purpose:p,fields:u,form:s,formBuilder:T,grid:I,onDeleteFile:U,onUploadFile:R}),l&&g.jsx(J,{submitting:h||j,className:"mt-2",onSave:P,updatingValue:_,fields:u,onDeleteFile:U,onUploadFile:R,purpose:p,wizard:l})]})})},Y=t.forwardRef(X);module.exports=Y;
|
package/crud/modal/index.es.js
CHANGED
|
@@ -18,20 +18,20 @@ const ne = ({
|
|
|
18
18
|
idField: B = "id",
|
|
19
19
|
formBuilder: W
|
|
20
20
|
}, _) => {
|
|
21
|
-
const [t] = J.useForm(), { t: h } = te(), [k, F] = u(!1), [
|
|
21
|
+
const [t] = J.useForm(), { t: h } = te(), [k, F] = u(!1), [p, x] = u("new"), [f, y] = u(), [A, g] = u(), [L, j] = u(!1), [E, C] = u(!1), [$, P] = u(!1), U = m(
|
|
22
22
|
async (i) => {
|
|
23
|
-
var
|
|
24
|
-
const d = l ? i : await t.validateFields(), a = c.filter((s) => s.type === "color"),
|
|
23
|
+
var o;
|
|
24
|
+
const d = l ? i : await t.validateFields(), a = c.filter((s) => s.type === "color"), n = {};
|
|
25
25
|
for (const s of a) {
|
|
26
26
|
const e = M.getRealName(s.name, "upsertFieldName"), r = t.getFieldValue(e);
|
|
27
|
-
|
|
27
|
+
n[e] = typeof r == "string" ? r : (o = r == null ? void 0 : r.toHexString()) == null ? void 0 : o.toUpperCase();
|
|
28
28
|
}
|
|
29
|
-
Object.assign(d,
|
|
29
|
+
Object.assign(d, n), f && b ? (await b({
|
|
30
30
|
...d,
|
|
31
|
-
[B]:
|
|
32
|
-
}), y(void 0)) : !
|
|
31
|
+
[B]: f[B]
|
|
32
|
+
}), y(void 0)) : !f && v && await v(d), g(void 0), t.resetFields(), F(!1);
|
|
33
33
|
},
|
|
34
|
-
[c, t, B, v, b,
|
|
34
|
+
[c, t, B, v, b, f, l]
|
|
35
35
|
), O = m(async (i) => {
|
|
36
36
|
j(i), C(!0);
|
|
37
37
|
}, []), D = m(async () => {
|
|
@@ -42,27 +42,27 @@ const ne = ({
|
|
|
42
42
|
async (i, d = !0, a = !1) => {
|
|
43
43
|
try {
|
|
44
44
|
P(!0), F(!0), x(a ? "clone" : "update");
|
|
45
|
-
const
|
|
46
|
-
for (const
|
|
45
|
+
const n = {};
|
|
46
|
+
for (const o of c) {
|
|
47
47
|
const s = M.getRealName(
|
|
48
|
-
|
|
48
|
+
o.name,
|
|
49
49
|
"upsertFieldName"
|
|
50
50
|
), e = i[s];
|
|
51
|
-
if (a &&
|
|
51
|
+
if (a && o.type === "image") {
|
|
52
52
|
const r = e;
|
|
53
53
|
try {
|
|
54
|
-
const w = await
|
|
55
|
-
|
|
54
|
+
const w = await o.provider.clone(r);
|
|
55
|
+
n[s] = w;
|
|
56
56
|
continue;
|
|
57
57
|
} catch {
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
(r) => r[
|
|
63
|
-
) : e && typeof e == "object" ?
|
|
61
|
+
o.type === "date" || o.type === "time" ? e && (n[s] = oe(e)) : o.type === "select" ? o.multiple && Array.isArray(e) ? n[s] = e.map(
|
|
62
|
+
(r) => r[o.innerFieldId ?? "id"]
|
|
63
|
+
) : e && typeof e == "object" ? n[s] = e[o.innerFieldId ?? "id"] : (e && typeof e == "string" || typeof e == "number") && (n[s] = e) : n[s] = e;
|
|
64
64
|
}
|
|
65
|
-
t.setFieldsValue(
|
|
65
|
+
t.setFieldsValue(n), g(n), d && y(i);
|
|
66
66
|
} finally {
|
|
67
67
|
P(!1);
|
|
68
68
|
}
|
|
@@ -81,23 +81,23 @@ const ne = ({
|
|
|
81
81
|
}, [k]);
|
|
82
82
|
const q = m(async () => {
|
|
83
83
|
try {
|
|
84
|
-
if (
|
|
85
|
-
const i = l ?
|
|
84
|
+
if (p === "clone") {
|
|
85
|
+
const i = l ? f : t.getFieldsValue(), d = c.filter((a) => a.type === "image");
|
|
86
86
|
for (const a of d)
|
|
87
87
|
i[a.name] && a.provider.delete(i[a.name]);
|
|
88
88
|
}
|
|
89
89
|
} finally {
|
|
90
90
|
}
|
|
91
91
|
l || t.resetFields(), g(void 0), y(void 0), F(!1);
|
|
92
|
-
}, [
|
|
92
|
+
}, [p, l, t, f, c]);
|
|
93
93
|
return /* @__PURE__ */ N(
|
|
94
94
|
K,
|
|
95
95
|
{
|
|
96
96
|
width: T ? "100%" : void 0,
|
|
97
|
-
title: h(
|
|
97
|
+
title: h(p ?? "new"),
|
|
98
98
|
open: k,
|
|
99
99
|
confirmLoading: S || V,
|
|
100
|
-
okText: h("str." + (
|
|
100
|
+
okText: h("str." + (p === "update" ? "update" : "save")),
|
|
101
101
|
cancelText: h("str.cancel"),
|
|
102
102
|
cancelButtonProps: {
|
|
103
103
|
disabled: E,
|
|
@@ -114,7 +114,7 @@ const ne = ({
|
|
|
114
114
|
l ? null : /* @__PURE__ */ N(
|
|
115
115
|
z,
|
|
116
116
|
{
|
|
117
|
-
purpose:
|
|
117
|
+
purpose: p,
|
|
118
118
|
fields: c,
|
|
119
119
|
form: t,
|
|
120
120
|
formBuilder: W,
|
|
@@ -133,14 +133,14 @@ const ne = ({
|
|
|
133
133
|
fields: c,
|
|
134
134
|
onDeleteFile: D,
|
|
135
135
|
onUploadFile: O,
|
|
136
|
-
purpose:
|
|
136
|
+
purpose: p,
|
|
137
137
|
wizard: l
|
|
138
138
|
}
|
|
139
139
|
)
|
|
140
140
|
] })
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
|
-
},
|
|
143
|
+
}, pe = X(ne);
|
|
144
144
|
export {
|
|
145
|
-
|
|
145
|
+
pe as default
|
|
146
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("../../common/description/DescList.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("../../common/description/DescList.cjs.js"),j=require("react"),v=require("../../locale/index.cjs.js"),V=require("./CrudViewerUtil.cjs.js"),f=require("../../util/CrudUtil.cjs.js"),p=require("../actions/index.cjs.js");function w({className:m,fields:i,data:e,descListColumn:b={xs:1,md:3,sm:2,lg:4},layout:g,keepEmptyValues:q,inBuiltModalProps:u,...s}){const{t:o}=v.useTranslationLib(),x=j.useMemo(()=>{const l=i.filter(({hidden:r,hideInDescList:n})=>!r&&!n).map((r,n)=>{const C=f.getRealName(r.name);return{label:r.label,noFormatting:!0,value:V.getRendererValueCrudViewer(r)(e==null?void 0:e[C],e,n)}}),c=e?t.jsx(p,{data:e,...s,inBuiltModalProps:u?{...u,fields:i}:void 0}):void 0;return c&&l.push({label:o("str.action"),value:c}),l},[e,i,o,s]);return e?t.jsx(d,{keepEmptyValues:q,bordered:!0,column:b,className:m,layout:g,list:x}):t.jsx(t.Fragment,{})}exports.CrudDecListView=w;
|
|
@@ -3,13 +3,13 @@ import { CrudFieldProps } from '../CrudComponent';
|
|
|
3
3
|
import { CrudActionsProps } from '../actions';
|
|
4
4
|
import { CrudModalProps } from '../modal';
|
|
5
5
|
export type DescListColumn = number | Partial<Record<Breakpoint, number>> | undefined;
|
|
6
|
-
export interface CrudDecListViewProps<T, FormType = T> extends CrudActionsProps<T, FormType> {
|
|
6
|
+
export interface CrudDecListViewProps<T, FormType = T> extends Omit<CrudActionsProps<T, FormType>, "inBuiltModalProps"> {
|
|
7
7
|
fields: CrudFieldProps<T>[];
|
|
8
8
|
data: T | undefined;
|
|
9
9
|
className?: string;
|
|
10
10
|
descListColumn?: DescListColumn;
|
|
11
11
|
layout?: "horizontal" | "vertical";
|
|
12
12
|
keepEmptyValues?: boolean;
|
|
13
|
-
inBuiltModalProps?: CrudModalProps<T, FormType>;
|
|
13
|
+
inBuiltModalProps?: Omit<CrudModalProps<T, FormType>, "fields">;
|
|
14
14
|
}
|
|
15
15
|
export declare function CrudDecListView<T, FormType = T>({ className, fields, data, descListColumn, layout, keepEmptyValues, inBuiltModalProps, ...crudActionsProps }: Readonly<CrudDecListViewProps<T, FormType>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i, Fragment as v } from "react/jsx-runtime";
|
|
2
2
|
import x from "../../common/description/DescList.es.js";
|
|
3
3
|
import { useMemo as F } from "react";
|
|
4
4
|
import { useTranslationLib as L } from "../../locale/index.es.js";
|
|
@@ -6,17 +6,17 @@ import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.es.js";
|
|
|
6
6
|
import w from "../../util/CrudUtil.es.js";
|
|
7
7
|
import D from "../actions/index.es.js";
|
|
8
8
|
function _({
|
|
9
|
-
className:
|
|
10
|
-
fields:
|
|
9
|
+
className: p,
|
|
10
|
+
fields: o,
|
|
11
11
|
data: r,
|
|
12
|
-
descListColumn:
|
|
13
|
-
layout:
|
|
14
|
-
keepEmptyValues:
|
|
15
|
-
inBuiltModalProps:
|
|
16
|
-
...
|
|
12
|
+
descListColumn: c = { xs: 1, md: 3, sm: 2, lg: 4 },
|
|
13
|
+
layout: f,
|
|
14
|
+
keepEmptyValues: b,
|
|
15
|
+
inBuiltModalProps: m,
|
|
16
|
+
...n
|
|
17
17
|
}) {
|
|
18
|
-
const { t:
|
|
19
|
-
const l =
|
|
18
|
+
const { t: u } = L(), g = F(() => {
|
|
19
|
+
const l = o.filter(({ hidden: e, hideInDescList: t }) => !e && !t).map((e, t) => {
|
|
20
20
|
const C = w.getRealName(e.name);
|
|
21
21
|
return {
|
|
22
22
|
label: e.label,
|
|
@@ -24,33 +24,33 @@ function _({
|
|
|
24
24
|
value: V(e)(
|
|
25
25
|
r == null ? void 0 : r[C],
|
|
26
26
|
r,
|
|
27
|
-
|
|
27
|
+
t
|
|
28
28
|
)
|
|
29
29
|
};
|
|
30
|
-
}), s = r ? /* @__PURE__ */
|
|
30
|
+
}), s = r ? /* @__PURE__ */ i(
|
|
31
31
|
D,
|
|
32
32
|
{
|
|
33
33
|
data: r,
|
|
34
|
-
...
|
|
35
|
-
inBuiltModalProps:
|
|
34
|
+
...n,
|
|
35
|
+
inBuiltModalProps: m ? { ...m, fields: o } : void 0
|
|
36
36
|
}
|
|
37
37
|
) : void 0;
|
|
38
38
|
return s && l.push({
|
|
39
|
-
label:
|
|
39
|
+
label: u("str.action"),
|
|
40
40
|
value: s
|
|
41
41
|
}), l;
|
|
42
|
-
}, [r,
|
|
43
|
-
return r ? /* @__PURE__ */
|
|
42
|
+
}, [r, o, u, n]);
|
|
43
|
+
return r ? /* @__PURE__ */ i(
|
|
44
44
|
x,
|
|
45
45
|
{
|
|
46
|
-
keepEmptyValues:
|
|
46
|
+
keepEmptyValues: b,
|
|
47
47
|
bordered: !0,
|
|
48
|
-
column:
|
|
49
|
-
className:
|
|
50
|
-
layout:
|
|
48
|
+
column: c,
|
|
49
|
+
className: p,
|
|
50
|
+
layout: f,
|
|
51
51
|
list: g
|
|
52
52
|
}
|
|
53
|
-
) : /* @__PURE__ */
|
|
53
|
+
) : /* @__PURE__ */ i(v, {});
|
|
54
54
|
}
|
|
55
55
|
export {
|
|
56
56
|
_ as CrudDecListView
|