@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"),
|
|
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
|
|
2
|
-
import { Space as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { NewButton as
|
|
8
|
-
import { PrintButton as
|
|
9
|
-
function
|
|
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:
|
|
12
|
-
onDelete:
|
|
13
|
-
onHide:
|
|
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:
|
|
18
|
-
isHiding:
|
|
19
|
-
isCreating:
|
|
20
|
-
isDeleting:
|
|
21
|
-
isUpdating:
|
|
22
|
-
paginateProps:
|
|
23
|
-
onPrint:
|
|
24
|
-
printing:
|
|
25
|
-
viewable:
|
|
26
|
-
loadingData:
|
|
27
|
-
formBuilder:
|
|
28
|
-
extraAction:
|
|
29
|
-
minusHeight:
|
|
30
|
-
cloneable:
|
|
31
|
-
fullWidthModal:
|
|
32
|
-
wizard:
|
|
33
|
-
extraView:
|
|
34
|
-
importable:
|
|
35
|
-
onClickNew:
|
|
36
|
-
size:
|
|
37
|
-
...
|
|
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 =
|
|
40
|
-
var
|
|
41
|
-
(
|
|
40
|
+
const n = K(null), E = c(() => {
|
|
41
|
+
var r;
|
|
42
|
+
(r = n.current) == null || r.create();
|
|
42
43
|
}, []), a = c(
|
|
43
|
-
async (
|
|
44
|
+
async (r, G = !0, H = !1) => {
|
|
44
45
|
var d;
|
|
45
|
-
await ((d = n.current) == null ? void 0 : d.update(
|
|
46
|
+
await ((d = n.current) == null ? void 0 : d.update(r, G, H));
|
|
46
47
|
},
|
|
47
48
|
[]
|
|
48
|
-
),
|
|
49
|
-
async (
|
|
50
|
-
a(
|
|
49
|
+
), F = c(
|
|
50
|
+
async (r) => {
|
|
51
|
+
a(r, !1, !0);
|
|
51
52
|
},
|
|
52
53
|
[a]
|
|
53
54
|
);
|
|
54
|
-
return /* @__PURE__ */ e(
|
|
55
|
-
/* @__PURE__ */ e(
|
|
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__ */
|
|
58
|
-
|
|
58
|
+
/* @__PURE__ */ o("div", { style: { flex: 1 }, children: /* @__PURE__ */ o(
|
|
59
|
+
T,
|
|
59
60
|
{
|
|
60
61
|
onClick: () => {
|
|
61
|
-
|
|
62
|
+
f ? f() : E();
|
|
62
63
|
},
|
|
63
64
|
className: "flex-1"
|
|
64
65
|
}
|
|
65
66
|
) }),
|
|
66
|
-
/* @__PURE__ */ e(
|
|
67
|
-
!!
|
|
68
|
-
|
|
67
|
+
/* @__PURE__ */ e(p, { children: [
|
|
68
|
+
!!s && /* @__PURE__ */ o(
|
|
69
|
+
W,
|
|
69
70
|
{
|
|
70
71
|
className: "float-right",
|
|
71
|
-
loading:
|
|
72
|
-
onClick:
|
|
72
|
+
loading: j,
|
|
73
|
+
onClick: s
|
|
73
74
|
}
|
|
74
75
|
),
|
|
75
|
-
!!
|
|
76
|
+
!!u && /* @__PURE__ */ o(O, { fields: l, importProps: u })
|
|
76
77
|
] })
|
|
77
78
|
] }),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
79
|
+
/* @__PURE__ */ o(
|
|
80
|
+
Q,
|
|
80
81
|
{
|
|
81
|
-
...
|
|
82
|
-
minusHeight:
|
|
82
|
+
...D,
|
|
83
|
+
minusHeight: S,
|
|
83
84
|
data: k,
|
|
84
|
-
size:
|
|
85
|
+
size: A,
|
|
85
86
|
fields: l,
|
|
86
|
-
extraAction:
|
|
87
|
+
extraAction: P,
|
|
87
88
|
idField: i,
|
|
88
|
-
isDeleting:
|
|
89
|
-
loadingData:
|
|
90
|
-
onClickUpdate: t ? a : void 0,
|
|
91
|
-
onHide:
|
|
92
|
-
isHiding:
|
|
93
|
-
onDelete:
|
|
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:
|
|
96
|
-
paginateProps:
|
|
97
|
-
viewable:
|
|
98
|
-
extraView:
|
|
96
|
+
onClickClone: V ? F : void 0,
|
|
97
|
+
paginateProps: y,
|
|
98
|
+
viewable: R,
|
|
99
|
+
extraView: z
|
|
99
100
|
}
|
|
100
101
|
)
|
|
101
102
|
] }),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
103
|
+
/* @__PURE__ */ o(
|
|
104
|
+
L,
|
|
104
105
|
{
|
|
105
106
|
ref: n,
|
|
106
107
|
fields: l,
|
|
107
|
-
wizard:
|
|
108
|
-
grid:
|
|
109
|
-
fullWidthModal:
|
|
110
|
-
isCreating:
|
|
111
|
-
isUpdating:
|
|
112
|
-
onCreate:
|
|
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:
|
|
116
|
+
formBuilder: M
|
|
116
117
|
}
|
|
117
118
|
)
|
|
118
119
|
] });
|
|
119
120
|
}
|
|
120
121
|
export {
|
|
121
|
-
|
|
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;
|
package/dist/crud/index.d.ts
CHANGED
|
@@ -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';
|