@kingteza/crud-component 1.7.2 → 1.8.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"),x=require("antd"),t=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"),M=require("../common/button/PrintButton.cjs.js");function O({idField:l="id",onCreate:C,onDelete:j,onHide:f,onUpdate:n,fields:r,data:m,grid:k,isHiding:q,isCreating:h,isDeleting:p,isUpdating:B,paginateProps:w,onPrint:a,printing:N,viewable:v,loadingData:R,formBuilder:g,extraAction:y,minusHeight:b,cloneable:P,fullWidthModal:S=!0,wizard:I,extraView:V,importable:i,onClickNew:u,size:z,...A}){const c=t.useRef(null),D=t.useCallback(()=>{var s;(s=c.current)==null||s.create()},[]),o=t.useCallback(async(s,F=!0,G=!1)=>{var d;await((d=c.current)==null?void 0:d.update(s,F,G))},[]),E=t.useCallback(async s=>{o(s,!1,!0)},[o]);return e.jsxs(e.Fragment,{children:[e.jsxs(x.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:()=>{u?u():D()},className:"flex-1"})}),e.jsxs(x.Space,{children:[!!a&&e.jsx(M.PrintButton,{className:"float-right",loading:N,onClick:a}),!!i&&e.jsx(J,{fields:r,importProps:i})]})]}),e.jsx(K,{...A,minusHeight:b,data:m,size:z,fields:r,extraAction:y,idField:l,isDeleting:p,loadingData:R,onClickUpdate:n?o:void 0,onHide:f,isHiding:q,onDelete:j,onUpdate:n,onClickClone:P?E:void 0,paginateProps:w,viewable:v,extraView:V})]}),e.jsx(H,{ref:c,fields:r,wizard:I,grid:k,fullWidthModal:S,isCreating:h,isUpdating:B,onCreate:C,onUpdate:n,idField:l,formBuilder:g})]})}module.exports=O;
1
+ "use strict";const e=require("react/jsx-runtime"),C=require("antd"),t=require("react"),J=require("./modal/index.cjs.js"),K=require("./import/CrudImportButton.cjs.js"),L=require("./view/CrudViewer.cjs.js"),M=require("../common/button/NewButton.cjs.js"),O=require("../common/button/PrintButton.cjs.js");function Q({idField:l="id",onCreate:j,onDelete:f,onHide:m,onUpdate:n,onClickUpdate:a,fields:r,data:q,grid:h,isHiding:k,isCreating:B,isDeleting:p,isUpdating:w,paginateProps:N,onPrint:i,printing:v,viewable:R,loadingData:g,formBuilder:y,extraAction:b,minusHeight:P,cloneable:S,fullWidthModal:I=!0,wizard:V,extraView:z,importable:u,onClickNew:d,size:A,...D}){const c=t.useRef(null),E=t.useCallback(()=>{var s;(s=c.current)==null||s.create()},[]),o=t.useCallback(async(s,G=!0,H=!1)=>{var x;await((x=c.current)==null?void 0:x.update(s,G,H))},[]),F=t.useCallback(async s=>{o(s,!1,!0)},[o]);return e.jsxs(e.Fragment,{children:[e.jsxs(C.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(M.NewButton,{onClick:()=>{d?d():E()},className:"flex-1"})}),e.jsxs(C.Space,{children:[!!i&&e.jsx(O.PrintButton,{className:"float-right",loading:v,onClick:i}),!!u&&e.jsx(K,{fields:r,importProps:u})]})]}),e.jsx(L,{...D,minusHeight:P,data:q,size:A,fields:r,extraAction:b,idField:l,isDeleting:p,loadingData:g,onClickUpdate:a||(n?o:void 0),onHide:m,isHiding:k,onDelete:f,onUpdate:n,onClickClone:S?F:void 0,paginateProps:N,viewable:R,extraView:z})]}),e.jsx(J,{ref:c,fields:r,wizard:V,grid:h,fullWidthModal:I,isCreating:B,isUpdating:w,onCreate:j,onUpdate:n,idField:l,formBuilder:y})]})}module.exports=Q;
@@ -244,6 +244,7 @@ export type CrudComponentProps<T, FormType = T> = {
244
244
  onHide?: (id: any) => Promise<any>;
245
245
  onDelete?: (id: any) => Promise<any>;
246
246
  onUpdate?: (t: FormType & IdProps) => Promise<any>;
247
+ onClickUpdate?: (t: T) => Promise<any>;
247
248
  loadingData?: boolean;
248
249
  isCreating?: boolean;
249
250
  isHiding?: boolean;
@@ -263,5 +264,5 @@ export type CrudComponentProps<T, FormType = T> = {
263
264
  draggable?: CrudDragableProps<T>;
264
265
  size?: SizeType;
265
266
  } & CrudSearchComponentProps<T, FormType>;
266
- declare function CrudComponent<T, FormType = T>({ idField, onCreate, onDelete, onHide, onUpdate, fields, data, grid, isHiding, isCreating, isDeleting, isUpdating, paginateProps, onPrint, printing, viewable, loadingData, formBuilder, extraAction, minusHeight, cloneable, fullWidthModal, wizard, extraView, importable, onClickNew, size, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
267
+ 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, size, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
267
268
  export default CrudComponent;
@@ -1,122 +1,123 @@
1
- import { jsxs as e, Fragment as H, jsx as r } from "react/jsx-runtime";
2
- import { Space as f } from "antd";
3
- import { useRef as J, useCallback as c } from "react";
4
- import K from "./modal/index.es.js";
5
- import L from "./import/CrudImportButton.es.js";
6
- import O from "./view/CrudViewer.es.js";
7
- import { NewButton as Q } from "../common/button/NewButton.es.js";
8
- import { PrintButton as T } from "../common/button/PrintButton.es.js";
9
- function ro({
1
+ import { jsxs as e, Fragment as J, jsx as o } from "react/jsx-runtime";
2
+ import { Space as p } from "antd";
3
+ import { useRef as K, useCallback as c } from "react";
4
+ import L from "./modal/index.es.js";
5
+ import O from "./import/CrudImportButton.es.js";
6
+ import Q from "./view/CrudViewer.es.js";
7
+ import { NewButton as T } from "../common/button/NewButton.es.js";
8
+ import { PrintButton as W } from "../common/button/PrintButton.es.js";
9
+ function er({
10
10
  idField: i = "id",
11
- onCreate: p,
12
- onDelete: C,
13
- onHide: h,
11
+ onCreate: C,
12
+ onDelete: h,
13
+ onHide: x,
14
14
  onUpdate: t,
15
+ onClickUpdate: m,
15
16
  fields: l,
16
17
  data: k,
17
- grid: x,
18
- isHiding: v,
19
- isCreating: w,
20
- isDeleting: B,
21
- isUpdating: N,
22
- paginateProps: g,
23
- onPrint: m,
24
- printing: y,
25
- viewable: j,
26
- loadingData: R,
27
- formBuilder: I,
28
- extraAction: M,
29
- minusHeight: P,
30
- cloneable: S,
31
- fullWidthModal: V = !0,
32
- wizard: b,
33
- extraView: q,
34
- importable: s,
35
- onClickNew: u,
36
- size: z,
37
- ...A
18
+ grid: v,
19
+ isHiding: w,
20
+ isCreating: B,
21
+ isDeleting: N,
22
+ isUpdating: g,
23
+ paginateProps: y,
24
+ onPrint: s,
25
+ printing: j,
26
+ viewable: R,
27
+ loadingData: I,
28
+ formBuilder: M,
29
+ extraAction: P,
30
+ minusHeight: S,
31
+ cloneable: V,
32
+ fullWidthModal: b = !0,
33
+ wizard: q,
34
+ extraView: z,
35
+ importable: u,
36
+ onClickNew: f,
37
+ size: A,
38
+ ...D
38
39
  }) {
39
- const n = J(null), D = c(() => {
40
- var o;
41
- (o = n.current) == null || o.create();
40
+ const n = K(null), E = c(() => {
41
+ var r;
42
+ (r = n.current) == null || r.create();
42
43
  }, []), a = c(
43
- async (o, F = !0, G = !1) => {
44
+ async (r, G = !0, H = !1) => {
44
45
  var d;
45
- await ((d = n.current) == null ? void 0 : d.update(o, F, G));
46
+ await ((d = n.current) == null ? void 0 : d.update(r, G, H));
46
47
  },
47
48
  []
48
- ), E = c(
49
- async (o) => {
50
- a(o, !1, !0);
49
+ ), F = c(
50
+ async (r) => {
51
+ a(r, !1, !0);
51
52
  },
52
53
  [a]
53
54
  );
54
- return /* @__PURE__ */ e(H, { children: [
55
- /* @__PURE__ */ e(f, { direction: "vertical", className: "w-100", children: [
55
+ return /* @__PURE__ */ e(J, { children: [
56
+ /* @__PURE__ */ e(p, { direction: "vertical", className: "w-100", children: [
56
57
  /* @__PURE__ */ e("div", { className: "w-100 d-flex", children: [
57
- /* @__PURE__ */ r("div", { style: { flex: 1 }, children: /* @__PURE__ */ r(
58
- Q,
58
+ /* @__PURE__ */ o("div", { style: { flex: 1 }, children: /* @__PURE__ */ o(
59
+ T,
59
60
  {
60
61
  onClick: () => {
61
- u ? u() : D();
62
+ f ? f() : E();
62
63
  },
63
64
  className: "flex-1"
64
65
  }
65
66
  ) }),
66
- /* @__PURE__ */ e(f, { children: [
67
- !!m && /* @__PURE__ */ r(
68
- T,
67
+ /* @__PURE__ */ e(p, { children: [
68
+ !!s && /* @__PURE__ */ o(
69
+ W,
69
70
  {
70
71
  className: "float-right",
71
- loading: y,
72
- onClick: m
72
+ loading: j,
73
+ onClick: s
73
74
  }
74
75
  ),
75
- !!s && /* @__PURE__ */ r(L, { fields: l, importProps: s })
76
+ !!u && /* @__PURE__ */ o(O, { fields: l, importProps: u })
76
77
  ] })
77
78
  ] }),
78
- /* @__PURE__ */ r(
79
- O,
79
+ /* @__PURE__ */ o(
80
+ Q,
80
81
  {
81
- ...A,
82
- minusHeight: P,
82
+ ...D,
83
+ minusHeight: S,
83
84
  data: k,
84
- size: z,
85
+ size: A,
85
86
  fields: l,
86
- extraAction: M,
87
+ extraAction: P,
87
88
  idField: i,
88
- isDeleting: B,
89
- loadingData: R,
90
- onClickUpdate: t ? a : void 0,
91
- onHide: h,
92
- isHiding: v,
93
- onDelete: C,
89
+ isDeleting: N,
90
+ loadingData: I,
91
+ onClickUpdate: m || (t ? a : void 0),
92
+ onHide: x,
93
+ isHiding: w,
94
+ onDelete: h,
94
95
  onUpdate: t,
95
- onClickClone: S ? E : void 0,
96
- paginateProps: g,
97
- viewable: j,
98
- extraView: q
96
+ onClickClone: V ? F : void 0,
97
+ paginateProps: y,
98
+ viewable: R,
99
+ extraView: z
99
100
  }
100
101
  )
101
102
  ] }),
102
- /* @__PURE__ */ r(
103
- K,
103
+ /* @__PURE__ */ o(
104
+ L,
104
105
  {
105
106
  ref: n,
106
107
  fields: l,
107
- wizard: b,
108
- grid: x,
109
- fullWidthModal: V,
110
- isCreating: w,
111
- isUpdating: N,
112
- onCreate: p,
108
+ wizard: q,
109
+ grid: v,
110
+ fullWidthModal: b,
111
+ isCreating: B,
112
+ isUpdating: g,
113
+ onCreate: C,
113
114
  onUpdate: t,
114
115
  idField: i,
115
- formBuilder: I
116
+ formBuilder: M
116
117
  }
117
118
  )
118
119
  ] });
119
120
  }
120
121
  export {
121
- ro as default
122
+ er as default
122
123
  };
@@ -1,6 +1,6 @@
1
1
  import { InitialCrudField } from './CrudComponent';
2
2
  import { FormInstance } from 'antd/lib';
3
- import { Copyable } from '.';
3
+ import { Copyable } from '../util/CopyUtilComponent';
4
4
  interface InitialTextAreaProps<T> extends InitialCrudField<T> {
5
5
  type: "textarea";
6
6
  onChange?: (value: string, form: FormInstance<T>) => void;
@@ -22,5 +22,4 @@ export { default as CrudActions } from './actions';
22
22
  export type { CrudActionsProps } from './actions';
23
23
  export { default as CrudModal } from './modal';
24
24
  export type { CrudModalProps, CrudModalRef } from './modal';
25
- export type * from 'src/util';
26
25
  export * from './view';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.7.2",
4
+ "version": "1.8.0",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",