@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 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"),W=require("react"),$=require("../../common/button/CloneButtonTable.cjs.js"),w=require("../../common/button/DeleteButtonTable.cjs.js"),A=require("../../common/button/ExportButton.cjs.js"),H=require("../../common/button/HideButtonTable.cjs.js"),V=require("../../common/button/UpdateButtonTable.cjs.js"),c=require("../modal/index.cjs.js");function k({data:b,idField:j="id",extraAction:h,onUpdate:r,onClickUpdate:x,onClickClone:y,onDelete:s,onHide:g,onExport:E,isHiding:z,isDeleting:G,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:Z,recentUpdateOrDeleteId:J,setRecentUpdateOrDeleteId:q,setOpenView:T,inBuiltModalProps:f}){var N;const m=h==null?void 0:h(b),K=W.useRef(null),L=W.useCallback((u,_=!0,Q=!1)=>{var S;q==null||q(u[j]),f?(S=K.current)==null||S.update(u,_,Q):Q?y==null||y(u):x==null||x(u),Z&&(T==null||T(void 0))},[f,x]);return(Array.isArray(m)?(N=m==null?void 0:m.filter(Boolean))!=null&&N.length:m)||r||x||y||s?v.jsxs(v.Fragment,{children:[f&&v.jsx(c,{ref:K,...f}),m,(r||x||(f==null?void 0:f.onUpdate))&&v.jsx(V,{value:b,onClick:u=>L(u)}),(y||(f==null?void 0:f.onCreate))&&v.jsx($,{value:b,onClick:u=>L(u,!1,!0)}),E&&v.jsx(A.ExportButton,{value:b,onClick:async u=>await E(u)}),g&&v.jsx(H,{value:b,disabled:z,shouldConfirm:X,loading:z&&b[j]===J,onClick:async u=>{q==null||q(u[j]),await g({[j]:u[j]})}}),s&&v.jsx(w,{value:b,disabled:G,shouldConfirm:Y,loading:G&&b[j]===J,onClick:async u=>{q==null||q(u[j]),await s({[j]:u[j]})}})]}):void 0}module.exports=k;
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;
@@ -1,83 +1,88 @@
1
- import { jsxs as w, Fragment as A, jsx as T } from "react/jsx-runtime";
2
- import { useRef as H, useCallback as x } from "react";
3
- import V from "../../common/button/CloneButtonTable.es.js";
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 o } from "../../common/button/ExportButton.es.js";
6
- import B from "../../common/button/HideButtonTable.es.js";
7
- import C from "../../common/button/UpdateButtonTable.es.js";
8
- import F from "../modal/index.es.js";
9
- function O({
10
- data: v,
11
- idField: u = "id",
12
- extraAction: j,
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: y,
15
- onClickClone: g,
16
- onDelete: r,
17
- onHide: E,
18
- onExport: G,
19
- isHiding: J,
20
- isDeleting: K,
21
- confirmHiding: Y,
22
- confirmDeleting: Z,
23
- closeViewOnClickUpdate: _,
24
- recentUpdateOrDeleteId: L,
25
- setRecentUpdateOrDeleteId: b,
26
- setOpenView: q,
27
- inBuiltModalProps: m
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 S;
30
- const h = j == null ? void 0 : j(v), N = H(null), Q = x(
31
- (f, $ = !0, W = !1) => {
32
- var X;
33
- b == null || b(f[u]), m ? (X = N.current) == null || X.update(f, $, W) : W ? g == null || g(f) : y == null || y(f), _ && (q == null || q(void 0));
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
- [m, y]
35
+ [f, h]
36
36
  );
37
- return (Array.isArray(h) ? (S = h == null ? void 0 : h.filter(Boolean)) != null && S.length : h) || z || y || g || r ? /* @__PURE__ */ w(A, { children: [
38
- m && /* @__PURE__ */ T(F, { ref: N, ...m }),
39
- h,
40
- (z || y || (m == null ? void 0 : m.onUpdate)) && /* @__PURE__ */ T(C, { value: v, onClick: (f) => Q(f) }),
41
- (g || (m == null ? void 0 : m.onCreate)) && /* @__PURE__ */ T(
42
- V,
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: v,
45
- onClick: (f) => Q(f, !1, !0)
49
+ value: y,
50
+ onClick: (m) => W(m, !1, !0)
46
51
  }
47
52
  ),
48
- G && /* @__PURE__ */ T(
49
- o,
53
+ J && /* @__PURE__ */ j(
54
+ r,
50
55
  {
51
- value: v,
52
- onClick: async (f) => await G(f)
56
+ value: y,
57
+ onClick: async (m) => await J(m)
53
58
  }
54
59
  ),
55
- E && /* @__PURE__ */ T(
56
- B,
60
+ G && /* @__PURE__ */ j(
61
+ C,
57
62
  {
58
- value: v,
59
- disabled: J,
60
- shouldConfirm: Y,
61
- loading: J && v[u] === L,
62
- onClick: async (f) => {
63
- b == null || b(f[u]), await E({ [u]: f[u] });
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
- r && /* @__PURE__ */ T(
72
+ u && /* @__PURE__ */ j(
68
73
  k,
69
74
  {
70
- value: v,
71
- disabled: K,
72
- shouldConfirm: Z,
73
- loading: K && v[u] === L,
74
- onClick: async (f) => {
75
- b == null || b(f[u]), await r({ [u]: f[u] });
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
- O as default
87
+ a as default
83
88
  };
@@ -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 o;const d=l?c:await s.validateFields(),i=u.filter(a=>a.type==="color"),n={};for(const a of i){const e=H.getRealName(a.name,"upsertFieldName"),r=s.getFieldValue(e);n[e]=typeof r=="string"?r:(o=r==null?void 0:r.toHexString())==null?void 0:o.toUpperCase()}Object.assign(d,n),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 n={};for(const o of u){const a=H.getRealName(o.name,"upsertFieldName"),e=c[a];if(i&&o.type==="image"){const r=e;try{const w=await o.provider.clone(r);n[a]=w;continue}catch{continue}}o.type==="date"?e&&(n[a]=Q(e)):o.type==="select"?o.multiple&&Array.isArray(e)?n[a]=e.map(r=>r[o.innerFieldId??"id"]):e&&typeof e=="object"?n[a]=e[o.innerFieldId??"id"]:(e&&typeof e=="string"||typeof e=="number")&&(n[a]=e):n[a]=e}s.setFieldsValue(n),y(n),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;
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;
@@ -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), [f, x] = u("new"), [p, y] = u(), [A, g] = u(), [L, j] = u(!1), [E, C] = u(!1), [$, P] = u(!1), U = m(
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 n;
24
- const d = l ? i : await t.validateFields(), a = c.filter((s) => s.type === "color"), o = {};
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
- o[e] = typeof r == "string" ? r : (n = r == null ? void 0 : r.toHexString()) == null ? void 0 : n.toUpperCase();
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, o), p && b ? (await b({
29
+ Object.assign(d, n), f && b ? (await b({
30
30
  ...d,
31
- [B]: p[B]
32
- }), y(void 0)) : !p && v && await v(d), g(void 0), t.resetFields(), F(!1);
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, p, l]
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 o = {};
46
- for (const n of c) {
45
+ const n = {};
46
+ for (const o of c) {
47
47
  const s = M.getRealName(
48
- n.name,
48
+ o.name,
49
49
  "upsertFieldName"
50
50
  ), e = i[s];
51
- if (a && n.type === "image") {
51
+ if (a && o.type === "image") {
52
52
  const r = e;
53
53
  try {
54
- const w = await n.provider.clone(r);
55
- o[s] = w;
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
- n.type === "date" ? e && (o[s] = oe(e)) : n.type === "select" ? n.multiple && Array.isArray(e) ? o[s] = e.map(
62
- (r) => r[n.innerFieldId ?? "id"]
63
- ) : e && typeof e == "object" ? o[s] = e[n.innerFieldId ?? "id"] : (e && typeof e == "string" || typeof e == "number") && (o[s] = e) : o[s] = e;
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(o), g(o), d && y(i);
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 (f === "clone") {
85
- const i = l ? p : t.getFieldsValue(), d = c.filter((a) => a.type === "image");
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
- }, [f, l, t, p, c]);
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(f ?? "new"),
97
+ title: h(p ?? "new"),
98
98
  open: k,
99
99
  confirmLoading: S || V,
100
- okText: h("str." + (f === "update" ? "update" : "save")),
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: f,
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: f,
136
+ purpose: p,
137
137
  wizard: l
138
138
  }
139
139
  )
140
140
  ] })
141
141
  }
142
142
  );
143
- }, fe = X(ne);
143
+ }, pe = X(ne);
144
144
  export {
145
- fe as default
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"),f=require("react"),j=require("../../locale/index.cjs.js"),V=require("./CrudViewerUtil.cjs.js"),p=require("../../util/CrudUtil.cjs.js"),v=require("../actions/index.cjs.js");function w({className:c,fields:n,data:e,descListColumn:m={xs:1,md:3,sm:2,lg:4},layout:b,keepEmptyValues:g,inBuiltModalProps:q,...s}){const{t:u}=j.useTranslationLib(),x=f.useMemo(()=>{const o=n.filter(({hidden:r,hideInDescList:i})=>!r&&!i).map((r,i)=>{const C=p.getRealName(r.name);return{label:r.label,noFormatting:!0,value:V.getRendererValueCrudViewer(r)(e==null?void 0:e[C],e,i)}}),l=e?t.jsx(v,{data:e,...s,inBuiltModalProps:q}):void 0;return l&&o.push({label:u("str.action"),value:l}),o},[e,n,u,s]);return e?t.jsx(d,{keepEmptyValues:g,bordered:!0,column:m,className:c,layout:b,list:x}):t.jsx(t.Fragment,{})}exports.CrudDecListView=w;
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 t, Fragment as v } from "react/jsx-runtime";
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: u,
10
- fields: i,
9
+ className: p,
10
+ fields: o,
11
11
  data: r,
12
- descListColumn: f = { xs: 1, md: 3, sm: 2, lg: 4 },
13
- layout: p,
14
- keepEmptyValues: c,
15
- inBuiltModalProps: b,
16
- ...m
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: n } = L(), g = F(() => {
19
- const l = i.filter(({ hidden: e, hideInDescList: o }) => !e && !o).map((e, o) => {
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
- o
27
+ t
28
28
  )
29
29
  };
30
- }), s = r ? /* @__PURE__ */ t(
30
+ }), s = r ? /* @__PURE__ */ i(
31
31
  D,
32
32
  {
33
33
  data: r,
34
- ...m,
35
- inBuiltModalProps: b
34
+ ...n,
35
+ inBuiltModalProps: m ? { ...m, fields: o } : void 0
36
36
  }
37
37
  ) : void 0;
38
38
  return s && l.push({
39
- label: n("str.action"),
39
+ label: u("str.action"),
40
40
  value: s
41
41
  }), l;
42
- }, [r, i, n, m]);
43
- return r ? /* @__PURE__ */ t(
42
+ }, [r, o, u, n]);
43
+ return r ? /* @__PURE__ */ i(
44
44
  x,
45
45
  {
46
- keepEmptyValues: c,
46
+ keepEmptyValues: b,
47
47
  bordered: !0,
48
- column: f,
49
- className: u,
50
- layout: p,
48
+ column: c,
49
+ className: p,
50
+ layout: f,
51
51
  list: g
52
52
  }
53
- ) : /* @__PURE__ */ t(v, {});
53
+ ) : /* @__PURE__ */ i(v, {});
54
54
  }
55
55
  export {
56
56
  _ as CrudDecListView
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.65",
4
+ "version": "1.0.66",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",