@kingteza/crud-component 1.19.0 → 1.20.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"),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=$;
1
+ "use strict";const e=require("react/jsx-runtime"),q=require("antd"),n=require("react"),T=require("./modal/index.cjs.js"),X=require("./import/CrudImportButton.cjs.js"),Y=require("./view/CrudViewer.cjs.js"),Z=require("../common/button/NewButton.cjs.js"),$=require("../common/button/PrintButton.cjs.js");function p({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,scroll:z,cloneable:A,fullWidthModal:D=!0,wizard:E,extraView:F,importable:j,onClickNew:l,newButtonProps:c,size:G,headerRender:i,...H}){const a=n.useRef(null),J=n.useCallback(()=>{var s;(s=a.current)==null||s.create()},[]),o=n.useCallback(async(s,C=!0,Q=!1)=>{var f;await((f=a.current)==null?void 0:f.update(s,C,Q))},[]),K=n.useCallback(async s=>{o(s,!1,!0)},[o]),{onClick:U,...m}=n.useMemo(()=>c||{},[c]),u=n.useMemo(()=>e.jsx(Z.NewButton,{onClick:(s,C)=>{l?l():c!=null&&c.onClick?c.onClick(C):J()},className:"flex-1",...m}),[l,c,m]),L=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:L()}),e.jsxs(q.Space,{children:[!!k&&e.jsx($.PrintButton,{className:"float-right",loading:I,onClick:k}),!!j&&e.jsx(X,{fields:r,importProps:j})]})]}),e.jsx(Y,{...H,minusHeight:w,scroll:z,data:b,size:G,fields:r,extraAction:_,idField:x,isDeleting:B,loadingData:V,onClickUpdate:d||(t?o:void 0),onHide:v,isHiding:R,onDelete:N,onUpdate:t,onClickClone:A?K:void 0,paginateProps:S,viewable:O,extraView:F})]}),e.jsx(T,{ref:a,fields:r,wizard:E,grid:g,fullWidthModal:D,isCreating:y,isUpdating:M,onCreate:h,onUpdate:t,idField:x,formBuilder:W})]})}module.exports=p;
@@ -1,6 +1,6 @@
1
1
  import { ButtonProps, ColorPickerProps } from 'antd';
2
2
  import { Rule } from 'antd/es/form';
3
- import { FormInstance, FormItemProps, TablePaginationConfig } from 'antd/lib';
3
+ import { FormInstance, FormItemProps, TablePaginationConfig, TableProps } from 'antd/lib';
4
4
  import { Dayjs } from 'dayjs';
5
5
  import { default as React, ReactElement, ReactNode } from 'react';
6
6
  import { CrudSearchComponentProps } from './CrudSearchComponent';
@@ -258,6 +258,7 @@ export type CrudComponentProps<T, FormType = T> = {
258
258
  paginateProps?: CrudPaginateProps;
259
259
  formBuilder?: FormBuilderFunc<T>;
260
260
  minusHeight?: string;
261
+ scroll?: TableProps<T>["scroll"];
261
262
  cloneable?: boolean;
262
263
  fullWidthModal?: boolean;
263
264
  wizard?: CrudWizardProp<T>[];
@@ -274,5 +275,5 @@ export type CrudComponentProps<T, FormType = T> = {
274
275
  newButton: JSX.Element;
275
276
  }) => React.ReactElement;
276
277
  } & CrudSearchComponentProps<T, FormType>;
277
- 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;
278
+ 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, scroll, cloneable, fullWidthModal, wizard, extraView, importable, onClickNew, newButtonProps, size, headerRender, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
278
279
  export default CrudComponent;
@@ -1,12 +1,12 @@
1
- import { jsx as e, jsxs as l, Fragment as X } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as l, Fragment as Y } from "react/jsx-runtime";
2
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({
3
+ import { useRef as Z, useCallback as c, useMemo as N } from "react";
4
+ import $ from "./modal/index.es.js";
5
+ import w from "./import/CrudImportButton.es.js";
6
+ import U from "./view/CrudViewer.es.js";
7
+ import { NewButton as P } from "../common/button/NewButton.es.js";
8
+ import { PrintButton as oo } from "../common/button/PrintButton.es.js";
9
+ function so({
10
10
  idField: C = "id",
11
11
  onCreate: g,
12
12
  onDelete: j,
@@ -28,67 +28,69 @@ function mo({
28
28
  formBuilder: z,
29
29
  extraAction: A,
30
30
  minusHeight: B,
31
- cloneable: D,
32
- fullWidthModal: E = !0,
33
- wizard: F,
34
- extraView: G,
31
+ scroll: D,
32
+ cloneable: E,
33
+ fullWidthModal: F = !0,
34
+ wizard: G,
35
+ extraView: H,
35
36
  importable: h,
36
37
  onClickNew: n,
37
38
  newButtonProps: o,
38
- size: H,
39
+ size: J,
39
40
  headerRender: a,
40
- ...J
41
+ ...K
41
42
  }) {
42
- const m = Y(null), K = c(() => {
43
+ const m = Z(null), L = c(() => {
43
44
  var r;
44
45
  (r = m.current) == null || r.create();
45
46
  }, []), s = c(
46
- async (r, u = !0, T = !1) => {
47
+ async (r, u = !0, X = !1) => {
47
48
  var v;
48
- await ((v = m.current) == null ? void 0 : v.update(r, u, T));
49
+ await ((v = m.current) == null ? void 0 : v.update(r, u, X));
49
50
  },
50
51
  []
51
- ), L = c(
52
+ ), Q = c(
52
53
  async (r) => {
53
54
  s(r, !1, !0);
54
55
  },
55
56
  [s]
56
- ), { onClick: oo, ...p } = N(() => o || {}, [o]), f = N(
57
+ ), { onClick: ro, ...p } = N(() => o || {}, [o]), f = N(
57
58
  () => /* @__PURE__ */ e(
58
- U,
59
+ P,
59
60
  {
60
61
  onClick: (r, u) => {
61
- n ? n() : o != null && o.onClick ? o.onClick(u) : K();
62
+ n ? n() : o != null && o.onClick ? o.onClick(u) : L();
62
63
  },
63
64
  className: "flex-1",
64
65
  ...p
65
66
  }
66
67
  ),
67
68
  [n, o, p]
68
- ), Q = c(() => a ? a({ newButton: f }) : f, [f, a]);
69
- return /* @__PURE__ */ l(X, { children: [
69
+ ), T = c(() => a ? a({ newButton: f }) : f, [f, a]);
70
+ return /* @__PURE__ */ l(Y, { children: [
70
71
  /* @__PURE__ */ l(x, { direction: "vertical", className: "w-100", children: [
71
72
  /* @__PURE__ */ l("div", { className: "w-100 d-flex", children: [
72
- /* @__PURE__ */ e("div", { children: Q() }),
73
+ /* @__PURE__ */ e("div", { children: T() }),
73
74
  /* @__PURE__ */ l(x, { children: [
74
75
  !!k && /* @__PURE__ */ e(
75
- P,
76
+ oo,
76
77
  {
77
78
  className: "float-right",
78
79
  loading: _,
79
80
  onClick: k
80
81
  }
81
82
  ),
82
- !!h && /* @__PURE__ */ e($, { fields: t, importProps: h })
83
+ !!h && /* @__PURE__ */ e(w, { fields: t, importProps: h })
83
84
  ] })
84
85
  ] }),
85
86
  /* @__PURE__ */ e(
86
- w,
87
+ U,
87
88
  {
88
- ...J,
89
+ ...K,
89
90
  minusHeight: B,
91
+ scroll: D,
90
92
  data: M,
91
- size: H,
93
+ size: J,
92
94
  fields: t,
93
95
  extraAction: A,
94
96
  idField: C,
@@ -99,21 +101,21 @@ function mo({
99
101
  isHiding: O,
100
102
  onDelete: j,
101
103
  onUpdate: i,
102
- onClickClone: D ? L : void 0,
104
+ onClickClone: E ? Q : void 0,
103
105
  paginateProps: W,
104
106
  viewable: b,
105
- extraView: G
107
+ extraView: H
106
108
  }
107
109
  )
108
110
  ] }),
109
111
  /* @__PURE__ */ e(
110
- Z,
112
+ $,
111
113
  {
112
114
  ref: m,
113
115
  fields: t,
114
- wizard: F,
116
+ wizard: G,
115
117
  grid: I,
116
- fullWidthModal: E,
118
+ fullWidthModal: F,
117
119
  isCreating: R,
118
120
  isUpdating: V,
119
121
  onCreate: g,
@@ -125,5 +127,5 @@ function mo({
125
127
  ] });
126
128
  }
127
129
  export {
128
- mo as default
130
+ so as default
129
131
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.19.0",
4
+ "version": "1.20.0",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",