@kingteza/crud-component 1.27.0 → 1.27.1
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/dist/crud/CrudComponent.cjs.js +1 -1
- package/dist/crud/CrudComponent.d.ts +4 -3
- package/dist/crud/CrudComponent.es.js +29 -27
- package/dist/crud/CrudForm.cjs.js +1 -1
- package/dist/crud/CrudForm.d.ts +3 -2
- package/dist/crud/CrudForm.es.js +14 -13
- package/dist/crud/CrudFormWizard.cjs.js +1 -1
- package/dist/crud/CrudFormWizard.d.ts +3 -1
- package/dist/crud/CrudFormWizard.es.js +105 -93
- package/dist/crud/modal/index.cjs.js +1 -1
- package/dist/crud/modal/index.d.ts +3 -1
- package/dist/crud/modal/index.es.js +66 -63
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),q=require("antd"),n=require("react"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),q=require("antd"),n=require("react"),Y=require("./modal/index.cjs.js"),Z=require("./import/CrudImportButton.cjs.js"),$=require("./view/CrudViewer.cjs.js"),p=require("../common/button/NewButton.cjs.js"),U=require("../common/button/PrintButton.cjs.js");function P({idField:x="id",onCreate:h,onDelete:N,onHide:v,onUpdate:t,onClickUpdate:d,fields:l,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:m,onClickNew:r,newButtonProps:c,size:G,headerRender:i,actionWidth:H,onValuesChange:J,...K}){const a=n.useRef(null),L=n.useCallback(()=>{var s;(s=a.current)==null||s.create()},[]),o=n.useCallback(async(s,C=!0,X=!1)=>{var j;await((j=a.current)==null?void 0:j.update(s,C,X))},[]),Q=n.useCallback(async s=>{o(s,!1,!0)},[o]),{onClick:ee,...f}=n.useMemo(()=>c||{},[c]),u=n.useMemo(()=>e.jsx(p.NewButton,{onClick:(s,C)=>{r?r():c!=null&&c.onClick?c.onClick(C):L()},className:"flex-1",...f}),[r,c,f]),T=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",{className:"flex-1",children:T()}),e.jsxs(q.Space,{children:[!!k&&e.jsx(U.PrintButton,{className:"float-right",loading:I,onClick:k}),!!m&&e.jsx(Z,{fields:l,importProps:m})]})]}),e.jsx($,{...K,minusHeight:w,scroll:z,data:b,size:G,fields:l,extraAction:_,actionWidth:H,idField:x,isDeleting:B,loadingData:V,onClickUpdate:d||(t?o:void 0),onHide:v,isHiding:R,onDelete:N,onUpdate:t,onClickClone:A?Q:void 0,paginateProps:S,viewable:O,extraView:F})]}),e.jsx(Y,{ref:a,fields:l,wizard:E,grid:g,fullWidthModal:D,isCreating:y,isUpdating:M,onCreate:h,onUpdate:t,idField:x,formBuilder:W,onValuesChange:J})]})}module.exports=P;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps, ColorPickerProps } from 'antd';
|
|
1
|
+
import { ButtonProps, ColorPickerProps, FormProps } from 'antd';
|
|
2
2
|
import { Rule } from 'antd/es/form';
|
|
3
3
|
import { FormInstance, FormItemProps, TablePaginationConfig, TableProps } from 'antd/lib';
|
|
4
4
|
import { Dayjs } from 'dayjs';
|
|
@@ -21,7 +21,7 @@ export type SelectFieldItem = {
|
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
};
|
|
23
23
|
export interface InitialCrudField<T> {
|
|
24
|
-
formLayoutProps?: Pick<FormItemProps, "layout" |
|
|
24
|
+
formLayoutProps?: Pick<FormItemProps, "layout" | "labelCol" | "wrapperCol">;
|
|
25
25
|
label: string;
|
|
26
26
|
fieldHelper?: ReactNode;
|
|
27
27
|
updatingValue?: T;
|
|
@@ -281,6 +281,7 @@ export type CrudComponentProps<T, FormType = T> = {
|
|
|
281
281
|
headerRender?: (props: {
|
|
282
282
|
newButton: JSX.Element;
|
|
283
283
|
}) => React.ReactElement;
|
|
284
|
+
onValuesChange?: FormProps<T>["onValuesChange"];
|
|
284
285
|
} & CrudSearchComponentProps<T, FormType>;
|
|
285
|
-
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, actionWidth, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
|
|
286
|
+
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, actionWidth, onValuesChange, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
|
|
286
287
|
export default CrudComponent;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as r, jsxs as l, Fragment as
|
|
1
|
+
import { jsx as r, jsxs as l, Fragment as $ } from "react/jsx-runtime";
|
|
2
2
|
import { Space as N } from "antd";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { NewButton as
|
|
8
|
-
import { PrintButton as
|
|
9
|
-
function
|
|
3
|
+
import { useRef as w, useCallback as c, useMemo as v } from "react";
|
|
4
|
+
import U from "./modal/index.es.js";
|
|
5
|
+
import P from "./import/CrudImportButton.es.js";
|
|
6
|
+
import ee from "./view/CrudViewer.es.js";
|
|
7
|
+
import { NewButton as oe } from "../common/button/NewButton.es.js";
|
|
8
|
+
import { PrintButton as re } from "../common/button/PrintButton.es.js";
|
|
9
|
+
function ue({
|
|
10
10
|
idField: C = "id",
|
|
11
11
|
onCreate: g,
|
|
12
12
|
onDelete: j,
|
|
@@ -39,55 +39,56 @@ function fe({
|
|
|
39
39
|
size: J,
|
|
40
40
|
headerRender: n,
|
|
41
41
|
actionWidth: K,
|
|
42
|
-
|
|
42
|
+
onValuesChange: L,
|
|
43
|
+
...Q
|
|
43
44
|
}) {
|
|
44
|
-
const m =
|
|
45
|
+
const m = w(null), T = c(() => {
|
|
45
46
|
var o;
|
|
46
47
|
(o = m.current) == null || o.create();
|
|
47
48
|
}, []), s = c(
|
|
48
|
-
async (o, u = !0,
|
|
49
|
+
async (o, u = !0, Z = !1) => {
|
|
49
50
|
var x;
|
|
50
|
-
await ((x = m.current) == null ? void 0 : x.update(o, u,
|
|
51
|
+
await ((x = m.current) == null ? void 0 : x.update(o, u, Z));
|
|
51
52
|
},
|
|
52
53
|
[]
|
|
53
|
-
),
|
|
54
|
+
), X = c(
|
|
54
55
|
async (o) => {
|
|
55
56
|
s(o, !1, !0);
|
|
56
57
|
},
|
|
57
58
|
[s]
|
|
58
|
-
), { onClick:
|
|
59
|
+
), { onClick: le, ...p } = v(() => e || {}, [e]), f = v(
|
|
59
60
|
() => /* @__PURE__ */ r(
|
|
60
|
-
|
|
61
|
+
oe,
|
|
61
62
|
{
|
|
62
63
|
onClick: (o, u) => {
|
|
63
|
-
a ? a() : e != null && e.onClick ? e.onClick(u) :
|
|
64
|
+
a ? a() : e != null && e.onClick ? e.onClick(u) : T();
|
|
64
65
|
},
|
|
65
66
|
className: "flex-1",
|
|
66
67
|
...p
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
70
|
[a, e, p]
|
|
70
|
-
),
|
|
71
|
-
return /* @__PURE__ */ l(
|
|
71
|
+
), Y = c(() => n ? n({ newButton: f }) : f, [f, n]);
|
|
72
|
+
return /* @__PURE__ */ l($, { children: [
|
|
72
73
|
/* @__PURE__ */ l(N, { direction: "vertical", className: "w-100", children: [
|
|
73
74
|
/* @__PURE__ */ l("div", { className: "w-100 d-flex", children: [
|
|
74
|
-
/* @__PURE__ */ r("div", { className: "flex-1", children:
|
|
75
|
+
/* @__PURE__ */ r("div", { className: "flex-1", children: Y() }),
|
|
75
76
|
/* @__PURE__ */ l(N, { children: [
|
|
76
77
|
!!k && /* @__PURE__ */ r(
|
|
77
|
-
|
|
78
|
+
re,
|
|
78
79
|
{
|
|
79
80
|
className: "float-right",
|
|
80
81
|
loading: _,
|
|
81
82
|
onClick: k
|
|
82
83
|
}
|
|
83
84
|
),
|
|
84
|
-
!!h && /* @__PURE__ */ r(
|
|
85
|
+
!!h && /* @__PURE__ */ r(P, { fields: t, importProps: h })
|
|
85
86
|
] })
|
|
86
87
|
] }),
|
|
87
88
|
/* @__PURE__ */ r(
|
|
88
|
-
|
|
89
|
+
ee,
|
|
89
90
|
{
|
|
90
|
-
...
|
|
91
|
+
...Q,
|
|
91
92
|
minusHeight: B,
|
|
92
93
|
scroll: D,
|
|
93
94
|
data: M,
|
|
@@ -103,7 +104,7 @@ function fe({
|
|
|
103
104
|
isHiding: O,
|
|
104
105
|
onDelete: j,
|
|
105
106
|
onUpdate: i,
|
|
106
|
-
onClickClone: E ?
|
|
107
|
+
onClickClone: E ? X : void 0,
|
|
107
108
|
paginateProps: W,
|
|
108
109
|
viewable: b,
|
|
109
110
|
extraView: H
|
|
@@ -111,7 +112,7 @@ function fe({
|
|
|
111
112
|
)
|
|
112
113
|
] }),
|
|
113
114
|
/* @__PURE__ */ r(
|
|
114
|
-
|
|
115
|
+
U,
|
|
115
116
|
{
|
|
116
117
|
ref: m,
|
|
117
118
|
fields: t,
|
|
@@ -123,11 +124,12 @@ function fe({
|
|
|
123
124
|
onCreate: g,
|
|
124
125
|
onUpdate: i,
|
|
125
126
|
idField: C,
|
|
126
|
-
formBuilder: z
|
|
127
|
+
formBuilder: z,
|
|
128
|
+
onValuesChange: L
|
|
127
129
|
}
|
|
128
130
|
)
|
|
129
131
|
] });
|
|
130
132
|
}
|
|
131
133
|
export {
|
|
132
|
-
|
|
134
|
+
ue as default
|
|
133
135
|
};
|
|
@@ -1 +1 @@
|
|
|
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:
|
|
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:d,purpose:y="new",onValuesChange:o,...i}){return e.jsx(m.Form,{form:d,layout:"vertical",onValuesChange:o,children:e.jsx(x,{...i,purpose:y})})}function x({fields:d,formBuilder:y,grid:o,onDeleteFile:i,onUploadFile:u,purpose:c}){const p=s.useMemo(()=>d.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)),i==null||i(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)}),[d,o,i,u,c]),C=s.useCallback((t,a={})=>{const r=d.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)),i==null||i(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,{})},[d,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 d.filter(n=>a.includes(n.name)).some(n=>n.hidden)},isAllFieldsHidden(...t){const a=Array.isArray(t)?t:[t];return d.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;
|
package/dist/crud/CrudForm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormInstance } from 'antd';
|
|
1
|
+
import { FormInstance, FormProps } from 'antd';
|
|
2
2
|
import { CrudFieldProps, CrudPurpose, FormBuilderFunc } from './CrudComponent';
|
|
3
3
|
export interface CurdFormFieldsProps<T> {
|
|
4
4
|
onDeleteFile?: (e: any) => void;
|
|
@@ -7,8 +7,9 @@ export interface CurdFormFieldsProps<T> {
|
|
|
7
7
|
formBuilder?: FormBuilderFunc<T>;
|
|
8
8
|
fields: CrudFieldProps<T>[];
|
|
9
9
|
purpose?: CrudPurpose;
|
|
10
|
+
onValuesChange?: FormProps<T>["onValuesChange"];
|
|
10
11
|
}
|
|
11
|
-
export declare function CrudForm<T>({ form, purpose, ...props }: Readonly<CurdFormFieldsProps<T> & {
|
|
12
|
+
export declare function CrudForm<T>({ form, purpose, onValuesChange, ...props }: Readonly<CurdFormFieldsProps<T> & {
|
|
12
13
|
form: FormInstance;
|
|
13
14
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare function CrudFormFields<T>({ fields, formBuilder, grid, onDeleteFile, onUploadFile, purpose, }: Readonly<CurdFormFieldsProps<T>>): import("react/jsx-runtime").JSX.Element;
|
package/dist/crud/CrudForm.es.js
CHANGED
|
@@ -4,22 +4,23 @@ 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
|
-
form:
|
|
7
|
+
form: m,
|
|
8
8
|
purpose: y = "new",
|
|
9
|
-
|
|
9
|
+
onValuesChange: o,
|
|
10
|
+
...d
|
|
10
11
|
}) {
|
|
11
|
-
return /* @__PURE__ */ a(R, { form:
|
|
12
|
+
return /* @__PURE__ */ a(R, { form: m, layout: "vertical", onValuesChange: o, children: /* @__PURE__ */ a(I, { ...d, purpose: y }) });
|
|
12
13
|
}
|
|
13
14
|
function I({
|
|
14
|
-
fields:
|
|
15
|
+
fields: m,
|
|
15
16
|
formBuilder: y,
|
|
16
17
|
grid: o,
|
|
17
|
-
onDeleteFile:
|
|
18
|
+
onDeleteFile: d,
|
|
18
19
|
onUploadFile: e,
|
|
19
20
|
purpose: u
|
|
20
21
|
}) {
|
|
21
22
|
const h = j(
|
|
22
|
-
() =>
|
|
23
|
+
() => m.filter(
|
|
23
24
|
(t) => !t.readonly && (t.type !== "object" || typeof t.customFormFieldRender == "function")
|
|
24
25
|
).map((t) => {
|
|
25
26
|
const i = {
|
|
@@ -29,7 +30,7 @@ function I({
|
|
|
29
30
|
} : void 0,
|
|
30
31
|
onDelete: t.type === "image" || t.type === "file" ? (r) => {
|
|
31
32
|
var n;
|
|
32
|
-
t.onUploading && ((n = t.onDelete) == null || n.call(t, r)),
|
|
33
|
+
t.onUploading && ((n = t.onDelete) == null || n.call(t, r)), d == null || d(r);
|
|
33
34
|
} : void 0
|
|
34
35
|
};
|
|
35
36
|
return /* @__PURE__ */ a(S.Fragment, { children: t.grid && o ? /* @__PURE__ */ a(w, { ...t.grid, children: /* @__PURE__ */ p(
|
|
@@ -50,10 +51,10 @@ function I({
|
|
|
50
51
|
}
|
|
51
52
|
) }, t.name);
|
|
52
53
|
}),
|
|
53
|
-
[
|
|
54
|
+
[m, o, d, e, u]
|
|
54
55
|
), k = N(
|
|
55
56
|
(t, i = {}) => {
|
|
56
|
-
const r =
|
|
57
|
+
const r = m.find(
|
|
57
58
|
(n) => C.getRealName(n.name) === t
|
|
58
59
|
);
|
|
59
60
|
if (r != null && r.hidden) return /* @__PURE__ */ a(g, {});
|
|
@@ -65,7 +66,7 @@ function I({
|
|
|
65
66
|
} : void 0,
|
|
66
67
|
onDelete: r.type === "image" || r.type === "file" ? (c) => {
|
|
67
68
|
var f;
|
|
68
|
-
r.onUploading && ((f = r.onDelete) == null || f.call(r, c)),
|
|
69
|
+
r.onUploading && ((f = r.onDelete) == null || f.call(r, c)), d == null || d(c);
|
|
69
70
|
} : void 0
|
|
70
71
|
}, s = C.getRealName(r.name), b = /* @__PURE__ */ p(
|
|
71
72
|
l,
|
|
@@ -81,17 +82,17 @@ function I({
|
|
|
81
82
|
}
|
|
82
83
|
return /* @__PURE__ */ a(g, {});
|
|
83
84
|
},
|
|
84
|
-
[
|
|
85
|
+
[m, u]
|
|
85
86
|
);
|
|
86
87
|
return /* @__PURE__ */ a(g, { children: y ? /* @__PURE__ */ v(g, { children: [
|
|
87
88
|
y(k, {
|
|
88
89
|
isAnyFieldHidden(...t) {
|
|
89
90
|
const i = Array.isArray(t) ? t : [t];
|
|
90
|
-
return
|
|
91
|
+
return m.filter((n) => i.includes(n.name)).some((n) => n.hidden);
|
|
91
92
|
},
|
|
92
93
|
isAllFieldsHidden(...t) {
|
|
93
94
|
const i = Array.isArray(t) ? t : [t];
|
|
94
|
-
return
|
|
95
|
+
return m.filter((n) => i.includes(n.name)).every((n) => n.hidden);
|
|
95
96
|
},
|
|
96
97
|
purpose: u
|
|
97
98
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),F=require("@ant-design/icons"),c=require("antd"),b=require("react"),R=require("../locale/index.cjs.js"),S=require("./CrudForm.cjs.js"),v=require("../common/wizard/WizardViewForm.cjs.js"),q=require("../util/CrudUtil.cjs.js"),y=require("../common/button/Button.cjs.js");function N({fields:d,className:h,onDeleteFile:f,onUploadFile:s,purpose:l,wizard:t=[],updatingValue:x,onSave:g,submitting:j,onValuesChange:u}){const m=b.useMemo(()=>t.map(r=>{let n=!0;const o=d.filter(i=>r.fields.includes(q.getRealName(i.name)));return o.forEach(i=>n&&(n=i.hidden??!1)),{...r,hidden:n,fieldThatShouldShowing:o}}),[d,t]),a=b.useMemo(()=>m.filter(r=>!r.hidden),[m]);return e.jsx(v,{onSubmit:(r,n)=>{g(n)},className:h,pages:a.map(({title:r,icon:n,fieldThatShouldShowing:o,hidden:i},k)=>({title:r,icon:n,hidden:i,component:C=>e.jsx(w,{fields:o,onDeleteFile:f,onUploadFile:s,purpose:l,i:k,updatingValue:x,backward:C.backward,forward:C.forward,wizard:a,submitting:j,onValuesChange:u},k)}))})}function w({fields:d,onDeleteFile:h,onUploadFile:f,purpose:s,wizard:l=[],i:t,forward:x,backward:g,submitting:j,updatingValue:u,onValuesChange:m}){const a=l[t],{t:r}=R.useTranslationLib(),[n]=c.Form.useForm();return b.useEffect(()=>{if(u&&(s==="update"||s==="clone")){const o={};for(const i of d)o[q.getRealName(i.name,"upsertFieldName")]=u[q.getRealName(i.name,"upsertFieldName")];n.setFieldsValue(o)}},[d,n,s,u]),e.jsxs(c.Form,{name:String(t),form:n,layout:"vertical",onValuesChange:m,children:[e.jsx(S.CrudFormFields,{fields:d,formBuilder:a.formBuilder,grid:a.grid,onDeleteFile:h,onUploadFile:f,purpose:s}),e.jsx(c.Divider,{}),e.jsxs(c.Row,{gutter:[8,8],children:[t>0&&e.jsx(c.Col,{md:12,children:e.jsx(y,{block:!0,icon:e.jsx(F.LeftOutlined,{}),htmlType:"button",type:"default",size:"large",onClick:()=>g(),children:r("str.back")})}),e.jsx(c.Col,{md:t>0?12:24,children:e.jsx(y,{block:!0,icon:l.length-1===t?e.jsx(F.SaveOutlined,{}):e.jsx(F.RightOutlined,{}),htmlType:"submit",type:"primary",loading:j,size:"large",onClick:()=>{n.validateFields().then(o=>{x(o,l.length-1===t,l.length-1===t)})},children:l.length-1===t?r("str."+(s==="update"?"update":"save")):r("str.next")})})]})]})}module.exports=N;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormProps } from 'antd';
|
|
1
2
|
import { CrudFieldProps, CrudPurpose, CrudWizardProp } from './CrudComponent';
|
|
2
3
|
export interface CrudFormWizardProps<T> {
|
|
3
4
|
onDeleteFile?: (e: any) => void;
|
|
@@ -9,6 +10,7 @@ export interface CrudFormWizardProps<T> {
|
|
|
9
10
|
onSave: (e: T) => void;
|
|
10
11
|
updatingValue?: T;
|
|
11
12
|
submitting?: boolean;
|
|
13
|
+
onValuesChange?: FormProps<T>["onValuesChange"];
|
|
12
14
|
}
|
|
13
|
-
declare function CrudFormWizard<T>({ fields, className, onDeleteFile, onUploadFile, purpose, wizard, updatingValue, onSave, submitting, }: Readonly<CrudFormWizardProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function CrudFormWizard<T>({ fields, className, onDeleteFile, onUploadFile, purpose, wizard, updatingValue, onSave, submitting, onValuesChange, }: Readonly<CrudFormWizardProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
export default CrudFormWizard;
|
|
@@ -1,140 +1,152 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { LeftOutlined as
|
|
3
|
-
import { Form as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { useTranslationLib as
|
|
6
|
-
import { CrudFormFields as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
1
|
+
import { jsx as o, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { LeftOutlined as R, SaveOutlined as w, RightOutlined as x } from "@ant-design/icons";
|
|
3
|
+
import { Form as C, Divider as T, Row as W, Col as S } from "antd";
|
|
4
|
+
import { useMemo as v, useEffect as j } from "react";
|
|
5
|
+
import { useTranslationLib as z } from "../locale/index.es.js";
|
|
6
|
+
import { CrudFormFields as B } from "./CrudForm.es.js";
|
|
7
|
+
import O from "../common/wizard/WizardViewForm.es.js";
|
|
8
|
+
import b from "../util/CrudUtil.es.js";
|
|
9
|
+
import N from "../common/button/Button.es.js";
|
|
10
|
+
function I({
|
|
11
11
|
fields: d,
|
|
12
|
-
className:
|
|
13
|
-
onDeleteFile:
|
|
12
|
+
className: f,
|
|
13
|
+
onDeleteFile: s,
|
|
14
14
|
onUploadFile: m,
|
|
15
15
|
purpose: l,
|
|
16
16
|
wizard: e = [],
|
|
17
|
-
updatingValue:
|
|
18
|
-
onSave:
|
|
19
|
-
submitting:
|
|
17
|
+
updatingValue: h,
|
|
18
|
+
onSave: g,
|
|
19
|
+
submitting: p,
|
|
20
|
+
onValuesChange: a
|
|
20
21
|
}) {
|
|
21
|
-
const
|
|
22
|
+
const u = v(() => e.map((t) => {
|
|
22
23
|
let r = !0;
|
|
23
24
|
const n = d.filter(
|
|
24
|
-
(i) => t.fields.includes(
|
|
25
|
+
(i) => t.fields.includes(b.getRealName(i.name))
|
|
25
26
|
);
|
|
26
27
|
return n.forEach((i) => r && (r = i.hidden ?? !1)), {
|
|
27
28
|
...t,
|
|
28
29
|
hidden: r,
|
|
29
30
|
fieldThatShouldShowing: n
|
|
30
31
|
};
|
|
31
|
-
}), [d, e]), c =
|
|
32
|
-
() =>
|
|
33
|
-
[
|
|
32
|
+
}), [d, e]), c = v(
|
|
33
|
+
() => u.filter((t) => !t.hidden),
|
|
34
|
+
[u]
|
|
34
35
|
);
|
|
35
36
|
return /* @__PURE__ */ o(
|
|
36
|
-
|
|
37
|
+
O,
|
|
37
38
|
{
|
|
38
39
|
onSubmit: (t, r) => {
|
|
39
|
-
|
|
40
|
+
g(r);
|
|
40
41
|
},
|
|
41
|
-
className:
|
|
42
|
+
className: f,
|
|
42
43
|
pages: c.map(
|
|
43
|
-
({ title: t, icon: r, fieldThatShouldShowing: n, hidden: i },
|
|
44
|
+
({ title: t, icon: r, fieldThatShouldShowing: n, hidden: i }, F) => ({
|
|
44
45
|
title: t,
|
|
45
46
|
icon: r,
|
|
46
47
|
hidden: i,
|
|
47
|
-
component: (
|
|
48
|
-
|
|
48
|
+
component: (k) => /* @__PURE__ */ o(
|
|
49
|
+
E,
|
|
49
50
|
{
|
|
50
51
|
fields: n,
|
|
51
|
-
onDeleteFile:
|
|
52
|
+
onDeleteFile: s,
|
|
52
53
|
onUploadFile: m,
|
|
53
54
|
purpose: l,
|
|
54
|
-
i:
|
|
55
|
-
updatingValue:
|
|
56
|
-
backward:
|
|
57
|
-
forward:
|
|
55
|
+
i: F,
|
|
56
|
+
updatingValue: h,
|
|
57
|
+
backward: k.backward,
|
|
58
|
+
forward: k.forward,
|
|
58
59
|
wizard: c,
|
|
59
|
-
submitting:
|
|
60
|
+
submitting: p,
|
|
61
|
+
onValuesChange: a
|
|
60
62
|
},
|
|
61
|
-
|
|
63
|
+
F
|
|
62
64
|
)
|
|
63
65
|
})
|
|
64
66
|
)
|
|
65
67
|
}
|
|
66
68
|
);
|
|
67
69
|
}
|
|
68
|
-
function
|
|
70
|
+
function E({
|
|
69
71
|
fields: d,
|
|
70
|
-
onDeleteFile:
|
|
71
|
-
onUploadFile:
|
|
72
|
+
onDeleteFile: f,
|
|
73
|
+
onUploadFile: s,
|
|
72
74
|
purpose: m,
|
|
73
75
|
wizard: l = [],
|
|
74
76
|
i: e,
|
|
75
|
-
forward:
|
|
76
|
-
backward:
|
|
77
|
-
submitting:
|
|
78
|
-
updatingValue: a
|
|
77
|
+
forward: h,
|
|
78
|
+
backward: g,
|
|
79
|
+
submitting: p,
|
|
80
|
+
updatingValue: a,
|
|
81
|
+
onValuesChange: u
|
|
79
82
|
}) {
|
|
80
|
-
const c = l[e], { t } =
|
|
81
|
-
return
|
|
83
|
+
const c = l[e], { t } = z(), [r] = C.useForm();
|
|
84
|
+
return j(() => {
|
|
82
85
|
if (a && (m === "update" || m === "clone")) {
|
|
83
86
|
const n = {};
|
|
84
87
|
for (const i of d)
|
|
85
|
-
n[
|
|
88
|
+
n[b.getRealName(i.name, "upsertFieldName")] = a[b.getRealName(i.name, "upsertFieldName")];
|
|
86
89
|
r.setFieldsValue(n);
|
|
87
90
|
}
|
|
88
|
-
}, [d, r, m, a]), /* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
91
|
+
}, [d, r, m, a]), /* @__PURE__ */ y(
|
|
92
|
+
C,
|
|
93
|
+
{
|
|
94
|
+
name: String(e),
|
|
95
|
+
form: r,
|
|
96
|
+
layout: "vertical",
|
|
97
|
+
onValuesChange: u,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ o(
|
|
100
|
+
B,
|
|
101
|
+
{
|
|
102
|
+
fields: d,
|
|
103
|
+
formBuilder: c.formBuilder,
|
|
104
|
+
grid: c.grid,
|
|
105
|
+
onDeleteFile: f,
|
|
106
|
+
onUploadFile: s,
|
|
107
|
+
purpose: m
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ o(T, {}),
|
|
111
|
+
/* @__PURE__ */ y(W, { gutter: [8, 8], children: [
|
|
112
|
+
e > 0 && /* @__PURE__ */ o(S, { md: 12, children: /* @__PURE__ */ o(
|
|
113
|
+
N,
|
|
114
|
+
{
|
|
115
|
+
block: !0,
|
|
116
|
+
icon: /* @__PURE__ */ o(R, {}),
|
|
117
|
+
htmlType: "button",
|
|
118
|
+
type: "default",
|
|
119
|
+
size: "large",
|
|
120
|
+
onClick: () => g(),
|
|
121
|
+
children: t("str.back")
|
|
122
|
+
}
|
|
123
|
+
) }),
|
|
124
|
+
/* @__PURE__ */ o(S, { md: e > 0 ? 12 : 24, children: /* @__PURE__ */ o(
|
|
125
|
+
N,
|
|
126
|
+
{
|
|
127
|
+
block: !0,
|
|
128
|
+
icon: l.length - 1 === e ? /* @__PURE__ */ o(w, {}) : /* @__PURE__ */ o(x, {}),
|
|
129
|
+
htmlType: "submit",
|
|
130
|
+
type: "primary",
|
|
131
|
+
loading: p,
|
|
132
|
+
size: "large",
|
|
133
|
+
onClick: () => {
|
|
134
|
+
r.validateFields().then((n) => {
|
|
135
|
+
h(
|
|
136
|
+
n,
|
|
137
|
+
l.length - 1 === e,
|
|
138
|
+
l.length - 1 === e
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
children: l.length - 1 === e ? t("str." + (m === "update" ? "update" : "save")) : t("str.next")
|
|
143
|
+
}
|
|
144
|
+
) })
|
|
145
|
+
] })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
);
|
|
137
149
|
}
|
|
138
150
|
export {
|
|
139
|
-
|
|
151
|
+
I as default
|
|
140
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const g=require("react/jsx-runtime"),B=require("antd"),t=require("react"),
|
|
1
|
+
"use strict";const g=require("react/jsx-runtime"),B=require("antd"),t=require("react"),J=require("../CrudForm.cjs.js"),K=require("../CrudFormWizard.cjs.js"),Q=require("../../locale/index.cjs.js"),I=require("../../util/CrudUtil.cjs.js"),X=require("dayjs"),Y=({fields:u,wizard:l,grid:M,fullWidthModal:T,isCreating:h,isUpdating:j,onCreate:b,onUpdate:v,idField:k="id",formBuilder:W,onValuesChange:q},_)=>{const[s]=B.Form.useForm(),{t:S}=Q.useTranslationLib(),[C,m]=t.useState(!1),[p,N]=t.useState("new"),[f,F]=t.useState(),[A,y]=t.useState(),[L,V]=t.useState(!1),[E,x]=t.useState(!1),[$,P]=t.useState(!1),R=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=I.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]),U=t.useCallback(async c=>{V(c),x(!0)},[]),O=t.useCallback(async()=>{x(!0)},[]),D=t.useCallback(()=>{m(!0),N("new"),s.resetFields(),F(void 0),y(void 0)},[s]),H=t.useCallback(async(c,d=!0,i=!1)=>{try{P(!0),m(!0),N(i?"clone":"update");const o={};for(const n of u){const a=I.getRealName(n.name,"upsertFieldName"),e=c[a];if(i&&n.type==="image"){const r=e;try{const G=await n.provider.clone(r);o[a]=G;continue}catch{continue}}n.type==="date"||n.type==="time"?e&&(o[a]=X(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{P(!1)}},[u,s]);t.useImperativeHandle(_,()=>({create:D,update:H}),[D,H]),t.useEffect(()=>{C&&(V(!1),x(!1))},[C]);const w=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:T?"100%":void 0,title:S(p??"new"),open:C,confirmLoading:h||j,okText:S("str."+(p==="update"?"update":"save")),cancelText:S("str.cancel"),cancelButtonProps:{disabled:E,hidden:!!l},okButtonProps:{disabled:L,hidden:!!l},onCancel:w,onOk:()=>R(),destroyOnHidden:!0,children:g.jsxs(B.Spin,{spinning:$,children:[l?null:g.jsx(J.CrudForm,{purpose:p,fields:u,form:s,formBuilder:W,grid:M,onDeleteFile:O,onUploadFile:U,onValuesChange:q}),l&&g.jsx(K,{submitting:h||j,className:"mt-2",onSave:R,updatingValue:A,fields:u,onDeleteFile:O,onUploadFile:U,purpose:p,wizard:l,onValuesChange:q})]})})},Z=t.forwardRef(Y);module.exports=Z;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormProps } from 'antd';
|
|
1
2
|
import { Ref } from 'react';
|
|
2
3
|
import { CrudFieldProps, CrudWizardProp, FormBuilderFunc } from '../CrudComponent';
|
|
3
4
|
import { default as IdProps } from '../../types/Id';
|
|
@@ -12,12 +13,13 @@ export interface CrudModalProps<T, FormType> {
|
|
|
12
13
|
onUpdate?: (data: FormType & IdProps) => Promise<any>;
|
|
13
14
|
idField?: string;
|
|
14
15
|
formBuilder?: FormBuilderFunc<T>;
|
|
16
|
+
onValuesChange?: FormProps<T>["onValuesChange"];
|
|
15
17
|
}
|
|
16
18
|
export interface CrudModalRef<T> {
|
|
17
19
|
create: () => void;
|
|
18
20
|
update: (data: T, shouldSetUpdatingField?: boolean, isClone?: boolean) => Promise<void>;
|
|
19
21
|
}
|
|
20
|
-
declare const CrudModal: <T, FormType = T>({ fields, wizard, grid, fullWidthModal, isCreating, isUpdating, onCreate, onUpdate, idField, formBuilder, }: CrudModalProps<T, FormType>, ref: Ref<CrudModalRef<T>>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare const CrudModal: <T, FormType = T>({ fields, wizard, grid, fullWidthModal, isCreating, isUpdating, onCreate, onUpdate, idField, formBuilder, onValuesChange, }: CrudModalProps<T, FormType>, ref: Ref<CrudModalRef<T>>) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
declare const _default: <T, FormType = T>(props: CrudModalProps<T, FormType> & {
|
|
22
24
|
ref?: Ref<CrudModalRef<T>>;
|
|
23
25
|
}) => ReturnType<typeof CrudModal>;
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { CrudForm as
|
|
5
|
-
import
|
|
6
|
-
import { useTranslationLib as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
1
|
+
import { jsx as S, jsxs as J } from "react/jsx-runtime";
|
|
2
|
+
import { Form as K, Modal as Q, Spin as X } from "antd";
|
|
3
|
+
import { forwardRef as Y, useState as u, useCallback as m, useImperativeHandle as Z, useEffect as z } from "react";
|
|
4
|
+
import { CrudForm as ee } from "../CrudForm.es.js";
|
|
5
|
+
import te from "../CrudFormWizard.es.js";
|
|
6
|
+
import { useTranslationLib as oe } from "../../locale/index.es.js";
|
|
7
|
+
import R from "../../util/CrudUtil.es.js";
|
|
8
|
+
import ne from "dayjs";
|
|
9
|
+
const se = ({
|
|
10
10
|
fields: c,
|
|
11
11
|
wizard: l,
|
|
12
|
-
grid:
|
|
13
|
-
fullWidthModal:
|
|
14
|
-
isCreating:
|
|
15
|
-
isUpdating:
|
|
12
|
+
grid: T,
|
|
13
|
+
fullWidthModal: W,
|
|
14
|
+
isCreating: x,
|
|
15
|
+
isUpdating: C,
|
|
16
16
|
onCreate: v,
|
|
17
17
|
onUpdate: b,
|
|
18
18
|
idField: B = "id",
|
|
19
|
-
formBuilder:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
formBuilder: _,
|
|
20
|
+
onValuesChange: V
|
|
21
|
+
}, A) => {
|
|
22
|
+
const [t] = K.useForm(), { t: h } = oe(), [k, F] = u(!1), [p, j] = u("new"), [f, y] = u(), [L, g] = u(), [E, P] = u(!1), [$, N] = u(!1), [q, U] = u(!1), O = m(
|
|
22
23
|
async (i) => {
|
|
23
24
|
var o;
|
|
24
25
|
const d = l ? i : await t.validateFields(), a = c.filter((s) => s.type === "color"), n = {};
|
|
25
26
|
for (const s of a) {
|
|
26
|
-
const e =
|
|
27
|
+
const e = R.getRealName(s.name, "upsertFieldName"), r = t.getFieldValue(e);
|
|
27
28
|
n[e] = typeof r == "string" ? r : (o = r == null ? void 0 : r.toHexString()) == null ? void 0 : o.toUpperCase();
|
|
28
29
|
}
|
|
29
30
|
Object.assign(d, n), f && b ? (await b({
|
|
@@ -32,54 +33,54 @@ const ne = ({
|
|
|
32
33
|
}), y(void 0)) : !f && v && await v(d), g(void 0), t.resetFields(), F(!1);
|
|
33
34
|
},
|
|
34
35
|
[c, t, B, v, b, f, l]
|
|
35
|
-
),
|
|
36
|
-
|
|
37
|
-
}, []),
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
40
|
-
F(!0),
|
|
41
|
-
}, [t]),
|
|
36
|
+
), D = m(async (i) => {
|
|
37
|
+
P(i), N(!0);
|
|
38
|
+
}, []), H = m(async () => {
|
|
39
|
+
N(!0);
|
|
40
|
+
}, []), I = m(() => {
|
|
41
|
+
F(!0), j("new"), t.resetFields(), y(void 0), g(void 0);
|
|
42
|
+
}, [t]), M = m(
|
|
42
43
|
async (i, d = !0, a = !1) => {
|
|
43
44
|
try {
|
|
44
|
-
|
|
45
|
+
U(!0), F(!0), j(a ? "clone" : "update");
|
|
45
46
|
const n = {};
|
|
46
47
|
for (const o of c) {
|
|
47
|
-
const s =
|
|
48
|
+
const s = R.getRealName(
|
|
48
49
|
o.name,
|
|
49
50
|
"upsertFieldName"
|
|
50
51
|
), e = i[s];
|
|
51
52
|
if (a && o.type === "image") {
|
|
52
53
|
const r = e;
|
|
53
54
|
try {
|
|
54
|
-
const
|
|
55
|
-
n[s] =
|
|
55
|
+
const G = await o.provider.clone(r);
|
|
56
|
+
n[s] = G;
|
|
56
57
|
continue;
|
|
57
58
|
} catch {
|
|
58
59
|
continue;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
o.type === "date" || o.type === "time" ? e && (n[s] =
|
|
62
|
+
o.type === "date" || o.type === "time" ? e && (n[s] = ne(e)) : o.type === "select" ? o.multiple && Array.isArray(e) ? n[s] = e.map(
|
|
62
63
|
(r) => r[o.innerFieldId ?? "id"]
|
|
63
64
|
) : e && typeof e == "object" ? n[s] = e[o.innerFieldId ?? "id"] : (e && typeof e == "string" || typeof e == "number") && (n[s] = e) : n[s] = e;
|
|
64
65
|
}
|
|
65
66
|
t.setFieldsValue(n), g(n), d && y(i);
|
|
66
67
|
} finally {
|
|
67
|
-
|
|
68
|
+
U(!1);
|
|
68
69
|
}
|
|
69
70
|
},
|
|
70
71
|
[c, t]
|
|
71
72
|
);
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
Z(
|
|
74
|
+
A,
|
|
74
75
|
() => ({
|
|
75
|
-
create:
|
|
76
|
-
update:
|
|
76
|
+
create: I,
|
|
77
|
+
update: M
|
|
77
78
|
}),
|
|
78
|
-
[
|
|
79
|
-
),
|
|
80
|
-
k && (
|
|
79
|
+
[I, M]
|
|
80
|
+
), z(() => {
|
|
81
|
+
k && (P(!1), N(!1));
|
|
81
82
|
}, [k]);
|
|
82
|
-
const
|
|
83
|
+
const w = m(async () => {
|
|
83
84
|
try {
|
|
84
85
|
if (p === "clone") {
|
|
85
86
|
const i = l ? f : t.getFieldsValue(), d = c.filter((a) => a.type === "image");
|
|
@@ -90,57 +91,59 @@ const ne = ({
|
|
|
90
91
|
}
|
|
91
92
|
l || t.resetFields(), g(void 0), y(void 0), F(!1);
|
|
92
93
|
}, [p, l, t, f, c]);
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
|
|
94
|
+
return /* @__PURE__ */ S(
|
|
95
|
+
Q,
|
|
95
96
|
{
|
|
96
|
-
width:
|
|
97
|
+
width: W ? "100%" : void 0,
|
|
97
98
|
title: h(p ?? "new"),
|
|
98
99
|
open: k,
|
|
99
|
-
confirmLoading:
|
|
100
|
+
confirmLoading: x || C,
|
|
100
101
|
okText: h("str." + (p === "update" ? "update" : "save")),
|
|
101
102
|
cancelText: h("str.cancel"),
|
|
102
103
|
cancelButtonProps: {
|
|
103
|
-
disabled:
|
|
104
|
+
disabled: $,
|
|
104
105
|
hidden: !!l
|
|
105
106
|
},
|
|
106
107
|
okButtonProps: {
|
|
107
|
-
disabled:
|
|
108
|
+
disabled: E,
|
|
108
109
|
hidden: !!l
|
|
109
110
|
},
|
|
110
|
-
onCancel:
|
|
111
|
-
onOk: () =>
|
|
111
|
+
onCancel: w,
|
|
112
|
+
onOk: () => O(),
|
|
112
113
|
destroyOnHidden: !0,
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
l ? null : /* @__PURE__ */
|
|
115
|
-
|
|
114
|
+
children: /* @__PURE__ */ J(X, { spinning: q, children: [
|
|
115
|
+
l ? null : /* @__PURE__ */ S(
|
|
116
|
+
ee,
|
|
116
117
|
{
|
|
117
118
|
purpose: p,
|
|
118
119
|
fields: c,
|
|
119
120
|
form: t,
|
|
120
|
-
formBuilder:
|
|
121
|
-
grid:
|
|
122
|
-
onDeleteFile:
|
|
123
|
-
onUploadFile:
|
|
121
|
+
formBuilder: _,
|
|
122
|
+
grid: T,
|
|
123
|
+
onDeleteFile: H,
|
|
124
|
+
onUploadFile: D,
|
|
125
|
+
onValuesChange: V
|
|
124
126
|
}
|
|
125
127
|
),
|
|
126
|
-
l && /* @__PURE__ */
|
|
127
|
-
|
|
128
|
+
l && /* @__PURE__ */ S(
|
|
129
|
+
te,
|
|
128
130
|
{
|
|
129
|
-
submitting:
|
|
131
|
+
submitting: x || C,
|
|
130
132
|
className: "mt-2",
|
|
131
|
-
onSave:
|
|
132
|
-
updatingValue:
|
|
133
|
+
onSave: O,
|
|
134
|
+
updatingValue: L,
|
|
133
135
|
fields: c,
|
|
134
|
-
onDeleteFile:
|
|
135
|
-
onUploadFile:
|
|
136
|
+
onDeleteFile: H,
|
|
137
|
+
onUploadFile: D,
|
|
136
138
|
purpose: p,
|
|
137
|
-
wizard: l
|
|
139
|
+
wizard: l,
|
|
140
|
+
onValuesChange: V
|
|
138
141
|
}
|
|
139
142
|
)
|
|
140
143
|
] })
|
|
141
144
|
}
|
|
142
145
|
);
|
|
143
|
-
},
|
|
146
|
+
}, fe = Y(se);
|
|
144
147
|
export {
|
|
145
|
-
|
|
148
|
+
fe as default
|
|
146
149
|
};
|