@kingteza/crud-component 1.15.1 → 1.16.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.
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),j=require("antd"),n=require("react"),H=require("./modal/index.cjs.js"),J=require("./import/CrudImportButton.cjs.js"),K=require("./view/CrudViewer.cjs.js"),L=require("../common/button/NewButton.cjs.js"),Q=require("../common/button/PrintButton.cjs.js");function T({idField:o="id",onCreate:f,onDelete:m,onHide:h,onUpdate:l,onClickUpdate:u,fields:r,data:q,grid:N,isHiding:v,isCreating:R,isDeleting:g,isUpdating:y,paginateProps:b,onPrint:C,printing:B,viewable:S,loadingData:w,formBuilder:I,extraAction:M,minusHeight:O,cloneable:V,fullWidthModal:W=!0,wizard:_,extraView:p,importable:d,onClickNew:x,newButtonProps:s,size:z,...A}){const t=n.useRef(null),D=n.useCallback(()=>{var c;(c=t.current)==null||c.create()},[]),i=n.useCallback(async(c,a=!0,G=!1)=>{var k;await((k=t.current)==null?void 0:k.update(c,a,G))},[]),E=n.useCallback(async c=>{i(c,!1,!0)},[i]),{onClick:X,...F}=n.useMemo(()=>s||{},[s]);return e.jsxs(e.Fragment,{children:[e.jsxs(j.Space,{direction:"vertical",className:"w-100",children:[e.jsxs("div",{className:"w-100 d-flex",children:[e.jsx("div",{style:{flex:1},children:e.jsx(L.NewButton,{onClick:(c,a)=>{x?x():s!=null&&s.onClick?s.onClick(a):D()},className:"flex-1",...F})}),e.jsxs(j.Space,{children:[!!C&&e.jsx(Q.PrintButton,{className:"float-right",loading:B,onClick:C}),!!d&&e.jsx(J,{fields:r,importProps:d})]})]}),e.jsx(K,{...A,minusHeight:O,data:q,size:z,fields:r,extraAction:M,idField:o,isDeleting:g,loadingData:w,onClickUpdate:u||(l?i:void 0),onHide:h,isHiding:v,onDelete:m,onUpdate:l,onClickClone:V?E:void 0,paginateProps:b,viewable:S,extraView:p})]}),e.jsx(H,{ref:t,fields:r,wizard:_,grid:N,fullWidthModal:W,isCreating:R,isUpdating:y,onCreate:f,onUpdate:l,idField:o,formBuilder:I})]})}module.exports=T;
1
+ "use strict";const e=require("react/jsx-runtime"),q=require("antd"),n=require("react"),Q=require("./modal/index.cjs.js"),T=require("./import/CrudImportButton.cjs.js"),X=require("./view/CrudViewer.cjs.js"),Y=require("../common/button/NewButton.cjs.js"),Z=require("../common/button/PrintButton.cjs.js");function $({idField:x="id",onCreate:h,onDelete:N,onHide:v,onUpdate:t,onClickUpdate:d,fields:r,data:b,grid:g,isHiding:R,isCreating:y,isDeleting:B,isUpdating:M,paginateProps:S,onPrint:k,printing:I,viewable:O,loadingData:V,formBuilder:W,extraAction:_,minusHeight:w,cloneable:z,fullWidthModal:A=!0,wizard:D,extraView:E,importable:j,onClickNew:l,newButtonProps:c,size:F,headerRender:i,...G}){const a=n.useRef(null),H=n.useCallback(()=>{var s;(s=a.current)==null||s.create()},[]),o=n.useCallback(async(s,C=!0,L=!1)=>{var f;await((f=a.current)==null?void 0:f.update(s,C,L))},[]),J=n.useCallback(async s=>{o(s,!1,!0)},[o]),{onClick:p,...m}=n.useMemo(()=>c||{},[c]),u=n.useMemo(()=>e.jsx(Y.NewButton,{onClick:(s,C)=>{l?l():c!=null&&c.onClick?c.onClick(C):H()},className:"flex-1",...m}),[l,c,m]),K=n.useCallback(()=>i?i({newButton:u}):u,[u,i]);return e.jsxs(e.Fragment,{children:[e.jsxs(q.Space,{direction:"vertical",className:"w-100",children:[e.jsxs("div",{className:"w-100 d-flex",children:[e.jsx("div",{children:K()}),e.jsxs(q.Space,{children:[!!k&&e.jsx(Z.PrintButton,{className:"float-right",loading:I,onClick:k}),!!j&&e.jsx(T,{fields:r,importProps:j})]})]}),e.jsx(X,{...G,minusHeight:w,data:b,size:F,fields:r,extraAction:_,idField:x,isDeleting:B,loadingData:V,onClickUpdate:d||(t?o:void 0),onHide:v,isHiding:R,onDelete:N,onUpdate:t,onClickClone:z?J:void 0,paginateProps:S,viewable:O,extraView:E})]}),e.jsx(Q,{ref:a,fields:r,wizard:D,grid:g,fullWidthModal:A,isCreating:y,isUpdating:M,onCreate:h,onUpdate:t,idField:x,formBuilder:W})]})}module.exports=$;
@@ -54,7 +54,7 @@ export interface InitialCrudField<T> {
54
54
  hidden?: boolean;
55
55
  };
56
56
  hideLabel?: boolean;
57
- sorter?: ColumnType<T>['sorter'];
57
+ sorter?: ColumnType<T>["sorter"];
58
58
  }
59
59
  export type CrudFieldGrid = {
60
60
  xs?: number;
@@ -269,6 +269,9 @@ export type CrudComponentProps<T, FormType = T> = {
269
269
  newButtonProps?: ButtonProps;
270
270
  draggable?: CrudDragableProps<T>;
271
271
  size?: SizeType;
272
+ headerRender?: (props: {
273
+ newButton: JSX.Element;
274
+ }) => React.ReactElement;
272
275
  } & CrudSearchComponentProps<T, FormType>;
273
- declare function CrudComponent<T, FormType = T>({ idField, onCreate, onDelete, onHide, onUpdate, onClickUpdate, fields, data, grid, isHiding, isCreating, isDeleting, isUpdating, paginateProps, onPrint, printing, viewable, loadingData, formBuilder, extraAction, minusHeight, cloneable, fullWidthModal, wizard, extraView, importable, onClickNew, newButtonProps, size, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
276
+ declare function CrudComponent<T, FormType = T>({ idField, onCreate, onDelete, onHide, onUpdate, onClickUpdate, fields, data, grid, isHiding, isCreating, isDeleting, isUpdating, paginateProps, onPrint, printing, viewable, loadingData, formBuilder, extraAction, minusHeight, cloneable, fullWidthModal, wizard, extraView, importable, onClickNew, newButtonProps, size, headerRender, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
274
277
  export default CrudComponent;
@@ -1,125 +1,129 @@
1
- import { jsxs as l, Fragment as J, jsx as r } from "react/jsx-runtime";
2
- import { Space as h } from "antd";
3
- import { useRef as K, useCallback as m, useMemo as L } from "react";
4
- import Q from "./modal/index.es.js";
5
- import T from "./import/CrudImportButton.es.js";
6
- import X from "./view/CrudViewer.es.js";
7
- import { NewButton as Y } from "../common/button/NewButton.es.js";
8
- import { PrintButton as Z } from "../common/button/PrintButton.es.js";
9
- function te({
10
- idField: s = "id",
11
- onCreate: p,
12
- onDelete: x,
13
- onHide: N,
1
+ import { jsx as e, jsxs as l, Fragment as X } from "react/jsx-runtime";
2
+ import { Space as x } from "antd";
3
+ import { useRef as Y, useCallback as c, useMemo as N } from "react";
4
+ import Z from "./modal/index.es.js";
5
+ import $ from "./import/CrudImportButton.es.js";
6
+ import w from "./view/CrudViewer.es.js";
7
+ import { NewButton as U } from "../common/button/NewButton.es.js";
8
+ import { PrintButton as P } from "../common/button/PrintButton.es.js";
9
+ function mo({
10
+ idField: C = "id",
11
+ onCreate: g,
12
+ onDelete: j,
13
+ onHide: y,
14
14
  onUpdate: i,
15
- onClickUpdate: f,
16
- fields: c,
17
- data: v,
18
- grid: g,
19
- isHiding: y,
20
- isCreating: j,
21
- isDeleting: M,
22
- isUpdating: R,
23
- paginateProps: I,
24
- onPrint: d,
25
- printing: O,
26
- viewable: S,
27
- loadingData: V,
28
- formBuilder: W,
29
- extraAction: _,
30
- minusHeight: b,
31
- cloneable: q,
32
- fullWidthModal: w = !0,
33
- wizard: z,
34
- extraView: A,
35
- importable: C,
36
- onClickNew: u,
15
+ onClickUpdate: d,
16
+ fields: t,
17
+ data: M,
18
+ grid: I,
19
+ isHiding: O,
20
+ isCreating: R,
21
+ isDeleting: S,
22
+ isUpdating: V,
23
+ paginateProps: W,
24
+ onPrint: k,
25
+ printing: _,
26
+ viewable: b,
27
+ loadingData: q,
28
+ formBuilder: z,
29
+ extraAction: A,
30
+ minusHeight: B,
31
+ cloneable: D,
32
+ fullWidthModal: E = !0,
33
+ wizard: F,
34
+ extraView: G,
35
+ importable: h,
36
+ onClickNew: n,
37
37
  newButtonProps: o,
38
- size: B,
39
- ...D
38
+ size: H,
39
+ headerRender: a,
40
+ ...J
40
41
  }) {
41
- const t = K(null), E = m(() => {
42
- var e;
43
- (e = t.current) == null || e.create();
44
- }, []), a = m(
45
- async (e, n = !0, H = !1) => {
46
- var k;
47
- await ((k = t.current) == null ? void 0 : k.update(e, n, H));
42
+ const m = Y(null), K = c(() => {
43
+ var r;
44
+ (r = m.current) == null || r.create();
45
+ }, []), s = c(
46
+ async (r, u = !0, T = !1) => {
47
+ var v;
48
+ await ((v = m.current) == null ? void 0 : v.update(r, u, T));
48
49
  },
49
50
  []
50
- ), F = m(
51
- async (e) => {
52
- a(e, !1, !0);
51
+ ), L = c(
52
+ async (r) => {
53
+ s(r, !1, !0);
53
54
  },
54
- [a]
55
- ), { onClick: $, ...G } = L(() => o || {}, [o]);
56
- return /* @__PURE__ */ l(J, { children: [
57
- /* @__PURE__ */ l(h, { direction: "vertical", className: "w-100", children: [
55
+ [s]
56
+ ), { onClick: oo, ...p } = N(() => o || {}, [o]), f = N(
57
+ () => /* @__PURE__ */ e(
58
+ U,
59
+ {
60
+ onClick: (r, u) => {
61
+ n ? n() : o != null && o.onClick ? o.onClick(u) : K();
62
+ },
63
+ className: "flex-1",
64
+ ...p
65
+ }
66
+ ),
67
+ [n, o, p]
68
+ ), Q = c(() => a ? a({ newButton: f }) : f, [f, a]);
69
+ return /* @__PURE__ */ l(X, { children: [
70
+ /* @__PURE__ */ l(x, { direction: "vertical", className: "w-100", children: [
58
71
  /* @__PURE__ */ l("div", { className: "w-100 d-flex", children: [
59
- /* @__PURE__ */ r("div", { style: { flex: 1 }, children: /* @__PURE__ */ r(
60
- Y,
61
- {
62
- onClick: (e, n) => {
63
- u ? u() : o != null && o.onClick ? o.onClick(n) : E();
64
- },
65
- className: "flex-1",
66
- ...G
67
- }
68
- ) }),
69
- /* @__PURE__ */ l(h, { children: [
70
- !!d && /* @__PURE__ */ r(
71
- Z,
72
+ /* @__PURE__ */ e("div", { children: Q() }),
73
+ /* @__PURE__ */ l(x, { children: [
74
+ !!k && /* @__PURE__ */ e(
75
+ P,
72
76
  {
73
77
  className: "float-right",
74
- loading: O,
75
- onClick: d
78
+ loading: _,
79
+ onClick: k
76
80
  }
77
81
  ),
78
- !!C && /* @__PURE__ */ r(T, { fields: c, importProps: C })
82
+ !!h && /* @__PURE__ */ e($, { fields: t, importProps: h })
79
83
  ] })
80
84
  ] }),
81
- /* @__PURE__ */ r(
82
- X,
85
+ /* @__PURE__ */ e(
86
+ w,
83
87
  {
84
- ...D,
85
- minusHeight: b,
86
- data: v,
87
- size: B,
88
- fields: c,
89
- extraAction: _,
90
- idField: s,
91
- isDeleting: M,
92
- loadingData: V,
93
- onClickUpdate: f || (i ? a : void 0),
94
- onHide: N,
95
- isHiding: y,
96
- onDelete: x,
88
+ ...J,
89
+ minusHeight: B,
90
+ data: M,
91
+ size: H,
92
+ fields: t,
93
+ extraAction: A,
94
+ idField: C,
95
+ isDeleting: S,
96
+ loadingData: q,
97
+ onClickUpdate: d || (i ? s : void 0),
98
+ onHide: y,
99
+ isHiding: O,
100
+ onDelete: j,
97
101
  onUpdate: i,
98
- onClickClone: q ? F : void 0,
99
- paginateProps: I,
100
- viewable: S,
101
- extraView: A
102
+ onClickClone: D ? L : void 0,
103
+ paginateProps: W,
104
+ viewable: b,
105
+ extraView: G
102
106
  }
103
107
  )
104
108
  ] }),
105
- /* @__PURE__ */ r(
106
- Q,
109
+ /* @__PURE__ */ e(
110
+ Z,
107
111
  {
108
- ref: t,
109
- fields: c,
110
- wizard: z,
111
- grid: g,
112
- fullWidthModal: w,
113
- isCreating: j,
114
- isUpdating: R,
115
- onCreate: p,
112
+ ref: m,
113
+ fields: t,
114
+ wizard: F,
115
+ grid: I,
116
+ fullWidthModal: E,
117
+ isCreating: R,
118
+ isUpdating: V,
119
+ onCreate: g,
116
120
  onUpdate: i,
117
- idField: s,
118
- formBuilder: W
121
+ idField: C,
122
+ formBuilder: z
119
123
  }
120
124
  )
121
125
  ] });
122
126
  }
123
127
  export {
124
- te as default
128
+ mo as default
125
129
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),m=require("antd"),j=require("./CrudField.cjs.js"),b=require("../util/CrudUtil.cjs.js");function v({form:i,purpose:y="new",...g}){return e.jsx(m.Form,{form:i,layout:"vertical",children:e.jsx(x,{...g,purpose:y})})}function x({fields:i,formBuilder:y,grid:g,onDeleteFile:d,onUploadFile:u,purpose:s}){const p=c.useMemo(()=>i.filter(t=>!t.readonly).map(t=>{const a={onUploading:t.type==="image"||t.type==="file"?r=>{var n;t.onUploading&&((n=t.onUploading)==null||n.call(t,r)),u==null||u(r)}:void 0,onDelete:t.type==="image"||t.type==="file"?r=>{var n;t.onUploading&&((n=t.onDelete)==null||n.call(t,r)),d==null||d(r)}:void 0};return e.jsx(c.Fragment,{children:t.grid&&g?e.jsx(m.Col,{...t.grid,children:c.createElement(j.default,{...t,...a,key:typeof t.name=="string"?t.name:String(t.name),updatable:s!=="update"?!0:t.updatable})}):c.createElement(j.default,{...t,...a,key:typeof t.name=="string"?t.name:String(t.name),updatable:s!=="update"?!0:t.updatable})},t.name)}),[i,g,d,u,s]),C=c.useCallback((t,a={})=>{const r=i.find(n=>b.getRealName(n.name)===t);if(r!=null&&r.hidden)return e.jsx(e.Fragment,{});if(r){const n={onUploading:r.type==="image"||r.type==="file"?o=>{var f;r.onUploading&&((f=r.onUploading)==null||f.call(r,o)),u==null||u(o)}:void 0,onDelete:r.type==="image"||r.type==="file"?o=>{var f;r.onUploading&&((f=r.onDelete)==null||f.call(r,o)),d==null||d(o)}:void 0},l=b.getRealName(r.name),h=c.createElement(j.default,{...r,...a,...n,key:typeof l=="string"?l:String(l),updatable:s!=="update"?!0:r.updatable});return a.render?a.render(h):h}return e.jsx(e.Fragment,{})},[i,s]);return e.jsx(e.Fragment,{children:y?e.jsxs(e.Fragment,{children:[y(C,{isAnyFieldHidden(...t){const a=Array.isArray(t)?t:[t];return i.filter(n=>a.includes(n.name)).some(n=>n.hidden)},isAllFieldsHidden(...t){const a=Array.isArray(t)?t:[t];return i.filter(n=>a.includes(n.name)).every(n=>n.hidden)},purpose:s}),e.jsxs(m.Form.Item,{hidden:!0,noStyle:!0,children:[e.jsx(m.Input,{name:"id"}),e.jsx(m.Input,{})]})]}):g?e.jsx(m.Row,{gutter:[8,8],children:p}):p})}exports.CrudForm=v;exports.CrudFormFields=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),m=require("antd"),j=require("./CrudField.cjs.js"),b=require("../util/CrudUtil.cjs.js");function v({form:i,purpose:y="new",...o}){return e.jsx(m.Form,{form:i,layout:"vertical",children:e.jsx(x,{...o,purpose:y})})}function x({fields:i,formBuilder:y,grid:o,onDeleteFile:d,onUploadFile:u,purpose:c}){const p=s.useMemo(()=>i.filter(t=>!t.readonly&&(t.type!=="object"||typeof t.customFormFieldRender=="function")).map(t=>{const a={onUploading:t.type==="image"||t.type==="file"?r=>{var n;t.onUploading&&((n=t.onUploading)==null||n.call(t,r)),u==null||u(r)}:void 0,onDelete:t.type==="image"||t.type==="file"?r=>{var n;t.onUploading&&((n=t.onDelete)==null||n.call(t,r)),d==null||d(r)}:void 0};return e.jsx(s.Fragment,{children:t.grid&&o?e.jsx(m.Col,{...t.grid,children:s.createElement(j.default,{...t,...a,key:typeof t.name=="string"?t.name:String(t.name),updatable:c!=="update"?!0:t.updatable})}):s.createElement(j.default,{...t,...a,key:typeof t.name=="string"?t.name:String(t.name),updatable:c!=="update"?!0:t.updatable})},t.name)}),[i,o,d,u,c]),C=s.useCallback((t,a={})=>{const r=i.find(n=>b.getRealName(n.name)===t);if(r!=null&&r.hidden)return e.jsx(e.Fragment,{});if(r){const n={onUploading:r.type==="image"||r.type==="file"?g=>{var f;r.onUploading&&((f=r.onUploading)==null||f.call(r,g)),u==null||u(g)}:void 0,onDelete:r.type==="image"||r.type==="file"?g=>{var f;r.onUploading&&((f=r.onDelete)==null||f.call(r,g)),d==null||d(g)}:void 0},l=b.getRealName(r.name),h=s.createElement(j.default,{...r,...a,...n,key:typeof l=="string"?l:String(l),updatable:c!=="update"?!0:r.updatable});return a.render?a.render(h):h}return e.jsx(e.Fragment,{})},[i,c]);return e.jsx(e.Fragment,{children:y?e.jsxs(e.Fragment,{children:[y(C,{isAnyFieldHidden(...t){const a=Array.isArray(t)?t:[t];return i.filter(n=>a.includes(n.name)).some(n=>n.hidden)},isAllFieldsHidden(...t){const a=Array.isArray(t)?t:[t];return i.filter(n=>a.includes(n.name)).every(n=>n.hidden)},purpose:c}),e.jsxs(m.Form.Item,{hidden:!0,noStyle:!0,children:[e.jsx(m.Input,{name:"id"}),e.jsx(m.Input,{})]})]}):o?e.jsx(m.Row,{gutter:[8,8],children:p}):p})}exports.CrudForm=v;exports.CrudFormFields=x;
@@ -1,101 +1,105 @@
1
- import { jsx as a, Fragment as y, jsxs as v } from "react/jsx-runtime";
2
- import S, { useMemo as N, createElement as p, useCallback as j } from "react";
3
- import { Form as k, Col as w, Input as A, Row as H } from "antd";
1
+ import { jsx as a, Fragment as g, jsxs as v } from "react/jsx-runtime";
2
+ import S, { useMemo as j, createElement as p, useCallback as N } from "react";
3
+ import { Form as R, Col as w, Input as A, Row as H } from "antd";
4
4
  import l from "./CrudField.es.js";
5
5
  import C from "../util/CrudUtil.es.js";
6
6
  function z({
7
7
  form: d,
8
- purpose: g = "new",
9
- ...c
8
+ purpose: y = "new",
9
+ ...o
10
10
  }) {
11
- return /* @__PURE__ */ a(k, { form: d, layout: "vertical", children: /* @__PURE__ */ a(I, { ...c, purpose: g }) });
11
+ return /* @__PURE__ */ a(R, { form: d, layout: "vertical", children: /* @__PURE__ */ a(I, { ...o, purpose: y }) });
12
12
  }
13
13
  function I({
14
14
  fields: d,
15
- formBuilder: g,
16
- grid: c,
15
+ formBuilder: y,
16
+ grid: o,
17
17
  onDeleteFile: m,
18
18
  onUploadFile: e,
19
19
  purpose: u
20
20
  }) {
21
- const h = N(
22
- () => d.filter((r) => !r.readonly).map((r) => {
21
+ const h = j(
22
+ () => d.filter(
23
+ (t) => !t.readonly && (t.type !== "object" || typeof t.customFormFieldRender == "function")
24
+ ).map((t) => {
23
25
  const i = {
24
- onUploading: r.type === "image" || r.type === "file" ? (t) => {
26
+ onUploading: t.type === "image" || t.type === "file" ? (r) => {
25
27
  var n;
26
- r.onUploading && ((n = r.onUploading) == null || n.call(r, t)), e == null || e(t);
28
+ t.onUploading && ((n = t.onUploading) == null || n.call(t, r)), e == null || e(r);
27
29
  } : void 0,
28
- onDelete: r.type === "image" || r.type === "file" ? (t) => {
30
+ onDelete: t.type === "image" || t.type === "file" ? (r) => {
29
31
  var n;
30
- r.onUploading && ((n = r.onDelete) == null || n.call(r, t)), m == null || m(t);
32
+ t.onUploading && ((n = t.onDelete) == null || n.call(t, r)), m == null || m(r);
31
33
  } : void 0
32
34
  };
33
- return /* @__PURE__ */ a(S.Fragment, { children: r.grid && c ? /* @__PURE__ */ a(w, { ...r.grid, children: /* @__PURE__ */ p(
35
+ return /* @__PURE__ */ a(S.Fragment, { children: t.grid && o ? /* @__PURE__ */ a(w, { ...t.grid, children: /* @__PURE__ */ p(
34
36
  l,
35
37
  {
36
- ...r,
38
+ ...t,
37
39
  ...i,
38
- key: typeof r.name == "string" ? r.name : String(r.name),
39
- updatable: u !== "update" ? !0 : r.updatable
40
+ key: typeof t.name == "string" ? t.name : String(t.name),
41
+ updatable: u !== "update" ? !0 : t.updatable
40
42
  }
41
43
  ) }) : /* @__PURE__ */ p(
42
44
  l,
43
45
  {
44
- ...r,
46
+ ...t,
45
47
  ...i,
46
- key: typeof r.name == "string" ? r.name : String(r.name),
47
- updatable: u !== "update" ? !0 : r.updatable
48
+ key: typeof t.name == "string" ? t.name : String(t.name),
49
+ updatable: u !== "update" ? !0 : t.updatable
48
50
  }
49
- ) }, r.name);
51
+ ) }, t.name);
50
52
  }),
51
- [d, c, m, e, u]
52
- ), R = j(
53
- (r, i = {}) => {
54
- const t = d.find((n) => C.getRealName(n.name) === r);
55
- if (t != null && t.hidden) return /* @__PURE__ */ a(y, {});
56
- if (t) {
53
+ [d, o, m, e, u]
54
+ ), k = N(
55
+ (t, i = {}) => {
56
+ const r = d.find(
57
+ (n) => C.getRealName(n.name) === t
58
+ );
59
+ if (r != null && r.hidden) return /* @__PURE__ */ a(g, {});
60
+ if (r) {
57
61
  const n = {
58
- onUploading: t.type === "image" || t.type === "file" ? (o) => {
62
+ onUploading: r.type === "image" || r.type === "file" ? (c) => {
59
63
  var f;
60
- t.onUploading && ((f = t.onUploading) == null || f.call(t, o)), e == null || e(o);
64
+ r.onUploading && ((f = r.onUploading) == null || f.call(r, c)), e == null || e(c);
61
65
  } : void 0,
62
- onDelete: t.type === "image" || t.type === "file" ? (o) => {
66
+ onDelete: r.type === "image" || r.type === "file" ? (c) => {
63
67
  var f;
64
- t.onUploading && ((f = t.onDelete) == null || f.call(t, o)), m == null || m(o);
68
+ r.onUploading && ((f = r.onDelete) == null || f.call(r, c)), m == null || m(c);
65
69
  } : void 0
66
- }, s = C.getRealName(t.name), b = /* @__PURE__ */ p(
70
+ }, s = C.getRealName(r.name), b = /* @__PURE__ */ p(
67
71
  l,
68
72
  {
69
- ...t,
73
+ ...r,
70
74
  ...i,
71
75
  ...n,
72
76
  key: typeof s == "string" ? s : String(s),
73
- updatable: u !== "update" ? !0 : t.updatable
77
+ updatable: u !== "update" ? !0 : r.updatable
74
78
  }
75
79
  );
76
80
  return i.render ? i.render(b) : b;
77
81
  }
78
- return /* @__PURE__ */ a(y, {});
82
+ return /* @__PURE__ */ a(g, {});
79
83
  },
80
84
  [d, u]
81
85
  );
82
- return /* @__PURE__ */ a(y, { children: g ? /* @__PURE__ */ v(y, { children: [
83
- g(R, {
84
- isAnyFieldHidden(...r) {
85
- const i = Array.isArray(r) ? r : [r];
86
+ return /* @__PURE__ */ a(g, { children: y ? /* @__PURE__ */ v(g, { children: [
87
+ y(k, {
88
+ isAnyFieldHidden(...t) {
89
+ const i = Array.isArray(t) ? t : [t];
86
90
  return d.filter((n) => i.includes(n.name)).some((n) => n.hidden);
87
91
  },
88
- isAllFieldsHidden(...r) {
89
- const i = Array.isArray(r) ? r : [r];
92
+ isAllFieldsHidden(...t) {
93
+ const i = Array.isArray(t) ? t : [t];
90
94
  return d.filter((n) => i.includes(n.name)).every((n) => n.hidden);
91
95
  },
92
96
  purpose: u
93
97
  }),
94
- /* @__PURE__ */ v(k.Item, { hidden: !0, noStyle: !0, children: [
98
+ /* @__PURE__ */ v(R.Item, { hidden: !0, noStyle: !0, children: [
95
99
  /* @__PURE__ */ a(A, { name: "id" }),
96
100
  /* @__PURE__ */ a(A, {})
97
101
  ] })
98
- ] }) : c ? /* @__PURE__ */ a(H, { gutter: [8, 8], children: h }) : h });
102
+ ] }) : o ? /* @__PURE__ */ a(H, { gutter: [8, 8], children: h }) : h });
99
103
  }
100
104
  export {
101
105
  z as CrudForm,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.15.1",
4
+ "version": "1.16.0",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",