@kingteza/crud-component 1.0.5 → 1.0.6
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/_virtual/_commonjsHelpers.cjs +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -5
- package/dist/_virtual/advancedFormat.cjs +1 -1
- package/dist/_virtual/customParseFormat.cjs +1 -1
- package/dist/_virtual/dayjs.min.cjs +1 -1
- package/dist/_virtual/index.cjs +1 -1
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +2 -2
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.cjs +1 -1
- package/dist/_virtual/index5.js +2 -5
- package/dist/_virtual/localeData.cjs +1 -1
- package/dist/_virtual/weekOfYear.cjs +1 -1
- package/dist/_virtual/weekYear.cjs +1 -1
- package/dist/_virtual/weekday.cjs +1 -1
- package/dist/common/index.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +3 -3
- package/dist/src/components/common/appearance/Hider.cjs +1 -1
- package/dist/src/components/common/button/Button.cjs +1 -1
- package/dist/src/components/common/button/Button.js +10 -10
- package/dist/src/components/common/button/CloneButtonTable.cjs +1 -1
- package/dist/src/components/common/button/CloneButtonTable.js +7 -7
- package/dist/src/components/common/button/DeleteButtonTable.cjs +1 -1
- package/dist/src/components/common/button/DeleteButtonTable.js +17 -17
- package/dist/src/components/common/button/ExportButton.cjs +1 -1
- package/dist/src/components/common/button/ExportButton.js +16 -16
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/src/components/common/button/HideButtonTable.js +18 -18
- package/dist/src/components/common/button/ImportButton.cjs +1 -1
- package/dist/src/components/common/button/ImportButton.js +25 -25
- package/dist/src/components/common/button/NewButton.cjs +1 -1
- package/dist/src/components/common/button/NewButton.js +16 -16
- package/dist/src/components/common/button/PrintButton.cjs +1 -1
- package/dist/src/components/common/button/PrintButton.js +14 -14
- package/dist/src/components/common/button/RefreshButton.cjs +1 -1
- package/dist/src/components/common/button/RefreshButton.js +12 -12
- package/dist/src/components/common/button/UnHideButton.cjs +1 -1
- package/dist/src/components/common/button/UnHideButton.js +28 -28
- package/dist/src/components/common/button/UpdateButtonTable.cjs +1 -1
- package/dist/src/components/common/button/UpdateButtonTable.js +9 -9
- package/dist/src/components/common/button/ViewButtonTable.cjs +1 -1
- package/dist/src/components/common/button/ViewButtonTable.js +13 -13
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/src/components/common/description/DescList.cjs +1 -1
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +5 -5
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/src/components/common/picker/ImagePicker.js +73 -76
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.js +5 -5
- package/dist/src/components/common/show-more/index.cjs +1 -1
- package/dist/src/components/common/show-more/index.js +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.cjs +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.js +11 -10
- package/dist/src/components/common/table/table.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.js +1 -1
- package/dist/src/components/common/text-field/NumberField.cjs +1 -1
- package/dist/src/components/common/text-field/NumberField.js +7 -7
- package/dist/src/components/common/text-field/PhoneNumberField.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.js +3 -3
- package/dist/src/components/common/text-field/TextField.cjs +1 -1
- package/dist/src/components/common/text-field/TextField.js +34 -34
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.js +36 -37
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.js +15 -15
- package/dist/src/components/crud/CrudField.cjs +1 -1
- package/dist/src/components/crud/CrudField.js +22 -22
- package/dist/src/components/crud/CrudForm.js +10 -10
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/src/components/crud/CrudFormWizard.js +63 -65
- package/dist/src/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/src/components/crud/CrudReportComponent.js +54 -54
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/src/components/crud/CrudSearchComponent.js +23 -23
- package/dist/src/components/crud/FileCrudField.cjs +1 -1
- package/dist/src/components/crud/FileCrudField.js +94 -101
- package/dist/src/components/crud/ImageCrudField.cjs +1 -1
- package/dist/src/components/crud/ImageCrudField.js +35 -35
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/src/components/crud/import/CrudImportButton.js +12 -12
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +94 -95
- package/dist/src/components/crud/view/CrudDecListView.cjs +1 -1
- package/dist/src/components/crud/view/CrudDecListView.js +5 -5
- package/dist/src/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewer.js +7 -7
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +31 -32
- package/dist/src/context/WindowDimension.cjs +1 -1
- package/dist/src/locale/index.cjs +1 -1
- package/dist/src/locale/index.js +2 -2
- package/dist/src/locale/translations/en.cjs +1 -1
- package/dist/src/util/DateUtil.cjs +1 -1
- package/dist/src/util/DateUtil.js +4 -4
- package/dist/src/util/ImageUtil.cjs +1 -1
- package/dist/src/util/ImageUtil.js +1 -1
- package/dist/src/util/ValidationUtil.cjs +1 -1
- package/dist/src/util/ValidationUtil.js +1 -1
- package/dist/util/index.cjs +1 -1
- package/package.json +1 -1
- package/dist/_virtual/FileSaver.min.cjs +0 -1
- package/dist/_virtual/FileSaver.min.js +0 -5
- package/dist/_virtual/FileSaver.min2.cjs +0 -1
- package/dist/_virtual/FileSaver.min2.js +0 -4
- package/dist/_virtual/ShowMoreText.cjs +0 -1
- package/dist/_virtual/ShowMoreText.js +0 -7
- package/dist/_virtual/ShowMoreText2.cjs +0 -1
- package/dist/_virtual/ShowMoreText2.js +0 -4
- package/dist/_virtual/Truncate.cjs +0 -1
- package/dist/_virtual/Truncate.js +0 -4
- package/dist/_virtual/index10.cjs +0 -1
- package/dist/_virtual/index10.js +0 -4
- package/dist/_virtual/index6.cjs +0 -1
- package/dist/_virtual/index6.js +0 -2
- package/dist/_virtual/index7.cjs +0 -1
- package/dist/_virtual/index7.js +0 -7
- package/dist/_virtual/index8.cjs +0 -1
- package/dist/_virtual/index8.js +0 -7
- package/dist/_virtual/index9.cjs +0 -1
- package/dist/_virtual/index9.js +0 -4
- package/dist/_virtual/main.cjs +0 -1
- package/dist/_virtual/main.js +0 -7
- package/dist/_virtual/main2.cjs +0 -1
- package/dist/_virtual/main2.js +0 -4
- package/dist/_virtual/papaparse.min.cjs +0 -1
- package/dist/_virtual/papaparse.min.js +0 -7
- package/dist/_virtual/papaparse.min2.cjs +0 -1
- package/dist/_virtual/papaparse.min2.js +0 -4
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { j as e } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { LoadingOutlined as M } from "@ant-design/icons";
|
|
3
|
+
import { Input as p, Form as O } from "antd";
|
|
4
|
+
import { useMemo as R } from "react";
|
|
5
|
+
import { useTranslation as S } from "react-i18next";
|
|
4
6
|
import { TRANSLATION_NAMESPACE as $ } from "../../../locale/hooks/translation-constants.js";
|
|
5
7
|
import D from "../tooltip/TooltipComponent.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var r;
|
|
10
|
-
n && t && (o.preventDefault(), (r = t == null ? void 0 : t.getFieldInstance(n)) == null || r.focus()), s && s(o);
|
|
8
|
+
const _ = (o, n, t, r) => {
|
|
9
|
+
var i;
|
|
10
|
+
n && t && (o.preventDefault(), (i = t == null ? void 0 : t.getFieldInstance(n)) == null || i.focus()), r && r(o);
|
|
11
11
|
}, Q = ({
|
|
12
12
|
type: o,
|
|
13
13
|
required: n,
|
|
14
14
|
label: t,
|
|
15
|
-
disabled:
|
|
16
|
-
rules:
|
|
15
|
+
disabled: r,
|
|
16
|
+
rules: i = [],
|
|
17
17
|
placeholder: m,
|
|
18
|
-
onEnter:
|
|
19
|
-
size:
|
|
20
|
-
form:
|
|
21
|
-
addonAfter:
|
|
22
|
-
addonBefore:
|
|
18
|
+
onEnter: d,
|
|
19
|
+
size: f,
|
|
20
|
+
form: l,
|
|
21
|
+
addonAfter: u,
|
|
22
|
+
addonBefore: c,
|
|
23
23
|
nextFocus: x,
|
|
24
24
|
autoComplete: j = "off",
|
|
25
|
-
defaultValue:
|
|
26
|
-
readOnly:
|
|
25
|
+
defaultValue: T,
|
|
26
|
+
readOnly: g,
|
|
27
27
|
value: A,
|
|
28
28
|
loading: E,
|
|
29
|
-
onBlur:
|
|
29
|
+
onBlur: I,
|
|
30
30
|
inputRef: v,
|
|
31
31
|
status: C,
|
|
32
32
|
autoFocus: P,
|
|
@@ -34,9 +34,9 @@ const _ = (o, n, t, s) => {
|
|
|
34
34
|
tooltip: h,
|
|
35
35
|
...F
|
|
36
36
|
}) => {
|
|
37
|
-
const { t: a } =
|
|
38
|
-
const
|
|
39
|
-
...
|
|
37
|
+
const { t: a } = S($), N = R(() => {
|
|
38
|
+
const s = [
|
|
39
|
+
...i,
|
|
40
40
|
{
|
|
41
41
|
required: n,
|
|
42
42
|
message: `${t ?? m ?? ""} ${a(
|
|
@@ -44,28 +44,28 @@ const _ = (o, n, t, s) => {
|
|
|
44
44
|
)}`
|
|
45
45
|
}
|
|
46
46
|
];
|
|
47
|
-
return o === "email" &&
|
|
47
|
+
return o === "email" && s.push({
|
|
48
48
|
type: "email",
|
|
49
49
|
message: a("err.validation.invalidEmail")
|
|
50
|
-
}),
|
|
51
|
-
}, [
|
|
52
|
-
disabled:
|
|
50
|
+
}), s;
|
|
51
|
+
}, [i, n, t, m, a, o]), w = {
|
|
52
|
+
disabled: r,
|
|
53
53
|
value: A,
|
|
54
|
-
readOnly:
|
|
55
|
-
defaultValue:
|
|
54
|
+
readOnly: g,
|
|
55
|
+
defaultValue: T,
|
|
56
56
|
autoFocus: P,
|
|
57
|
-
addonBefore:
|
|
57
|
+
addonBefore: c,
|
|
58
58
|
ref: v,
|
|
59
|
-
onBlur:
|
|
60
|
-
addonAfter: E ? /* @__PURE__ */
|
|
59
|
+
onBlur: I,
|
|
60
|
+
addonAfter: E ? /* @__PURE__ */ e.jsx(M, {}) : u,
|
|
61
61
|
status: C,
|
|
62
|
-
size:
|
|
62
|
+
size: f,
|
|
63
63
|
autoComplete: j,
|
|
64
|
-
onPressEnter: (
|
|
64
|
+
onPressEnter: (s) => _(s, x, l, d),
|
|
65
65
|
type: o,
|
|
66
66
|
placeholder: m ?? t
|
|
67
|
-
},
|
|
68
|
-
return /* @__PURE__ */
|
|
67
|
+
}, L = o == "password" ? p.Password : p;
|
|
68
|
+
return /* @__PURE__ */ e.jsx(D, { title: h, children: /* @__PURE__ */ e.jsx(O.Item, { ...F, label: t, rules: N, children: /* @__PURE__ */ e.jsx(L, { ...w }) }) });
|
|
69
69
|
};
|
|
70
70
|
export {
|
|
71
71
|
Q as default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../../../../_virtual/jsx-runtime.cjs"),r=require("antd"),u=({children:e,title:t})=>t?o.jsxRuntimeExports.jsx(r.Tooltip,{title:t,children:e}):e;exports.default=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("../../../../_virtual/jsx-runtime.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../../_virtual/jsx-runtime.cjs"),a=require("@ant-design/icons"),E=require("antd"),u=require("i18next"),y=require("react-i18next"),d=require("../button/Button.cjs"),f=require("../../../locale/hooks/translation-constants.cjs"),q=({errorChildren:l,children:j,onRetry:r,onClickBack:x,success:s,loading:i,error:e,successTitle:c=u.t("str.success"),successMessage:m,errorMessage:o=u.t("err.save"),errorTitle:p=u.t("str.error"),loadingTitle:v=u.t("message.loading.saving"),loadingMessage:R})=>{const{t:n}=y.useTranslation(f.TRANSLATION_NAMESPACE);return t.jsxRuntimeExports.jsx(E.Result,{status:i?void 0:s?"success":e?["403","404","500"].includes(e==null?void 0:e.code)?e.code:e?"error":void 0:void 0,title:i?v:s?c:e?p:void 0,icon:i?t.jsxRuntimeExports.jsx(a.LoadingOutlined,{}):void 0,subTitle:i?R:s?m:e?typeof o=="function"?o()??n("err.save"):o??n("err.save"):void 0,extra:[s?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:j}):e?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[!!x&&t.jsxRuntimeExports.jsx(d.default,{onClick:x,htmlType:"button",type:"primary",icon:t.jsxRuntimeExports.jsx(a.ArrowLeftOutlined,{}),children:n("str.previous")}),!!r&&t.jsxRuntimeExports.jsx(d.default,{type:"primary",onClick:()=>r(void 0,void 0,!0),children:n("str.retry")},"retry"),l]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{})]})};exports.default=q;
|
|
@@ -1,61 +1,60 @@
|
|
|
1
1
|
import { j as t } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
success: i,
|
|
2
|
+
import { LoadingOutlined as c, ArrowLeftOutlined as y } from "@ant-design/icons";
|
|
3
|
+
import { Result as A } from "antd";
|
|
4
|
+
import { t as n } from "i18next";
|
|
5
|
+
import { useTranslation as T } from "react-i18next";
|
|
6
|
+
import p from "../button/Button.js";
|
|
7
|
+
import { TRANSLATION_NAMESPACE as h } from "../../../locale/hooks/translation-constants.js";
|
|
8
|
+
const b = ({
|
|
9
|
+
errorChildren: a,
|
|
10
|
+
children: u,
|
|
11
|
+
onRetry: r,
|
|
12
|
+
onClickBack: d,
|
|
13
|
+
success: o,
|
|
15
14
|
loading: s,
|
|
16
|
-
error:
|
|
17
|
-
successTitle:
|
|
15
|
+
error: i,
|
|
16
|
+
successTitle: l = n("str.success"),
|
|
18
17
|
successMessage: v,
|
|
19
|
-
errorMessage:
|
|
20
|
-
errorTitle:
|
|
21
|
-
loadingTitle:
|
|
22
|
-
loadingMessage:
|
|
18
|
+
errorMessage: m = n("err.save"),
|
|
19
|
+
errorTitle: x = n("str.error"),
|
|
20
|
+
loadingTitle: f = n("message.loading.saving"),
|
|
21
|
+
loadingMessage: j
|
|
23
22
|
}) => {
|
|
24
|
-
const { t:
|
|
23
|
+
const { t: e } = T(h);
|
|
25
24
|
return /* @__PURE__ */ t.jsx(
|
|
26
|
-
|
|
25
|
+
A,
|
|
27
26
|
{
|
|
28
|
-
status: s ? void 0 :
|
|
29
|
-
title: s ?
|
|
30
|
-
icon: s ? /* @__PURE__ */ t.jsx(
|
|
31
|
-
subTitle: s ?
|
|
27
|
+
status: s ? void 0 : o ? "success" : i ? ["403", "404", "500"].includes(i == null ? void 0 : i.code) ? i.code : i ? "error" : void 0 : void 0,
|
|
28
|
+
title: s ? f : o ? l : i ? x : void 0,
|
|
29
|
+
icon: s ? /* @__PURE__ */ t.jsx(c, {}) : void 0,
|
|
30
|
+
subTitle: s ? j : o ? v : i ? typeof m == "function" ? m() ?? e("err.save") : m ?? e("err.save") : void 0,
|
|
32
31
|
extra: [
|
|
33
|
-
|
|
34
|
-
!!
|
|
35
|
-
|
|
32
|
+
o ? /* @__PURE__ */ t.jsx(t.Fragment, { children: u }) : i ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
33
|
+
!!d && /* @__PURE__ */ t.jsx(
|
|
34
|
+
p,
|
|
36
35
|
{
|
|
37
|
-
onClick:
|
|
36
|
+
onClick: d,
|
|
38
37
|
htmlType: "button",
|
|
39
38
|
type: "primary",
|
|
40
|
-
icon: /* @__PURE__ */ t.jsx(
|
|
41
|
-
children:
|
|
39
|
+
icon: /* @__PURE__ */ t.jsx(y, {}),
|
|
40
|
+
children: e("str.previous")
|
|
42
41
|
}
|
|
43
42
|
),
|
|
44
|
-
!!
|
|
45
|
-
|
|
43
|
+
!!r && /* @__PURE__ */ t.jsx(
|
|
44
|
+
p,
|
|
46
45
|
{
|
|
47
46
|
type: "primary",
|
|
48
|
-
onClick: () =>
|
|
49
|
-
children:
|
|
47
|
+
onClick: () => r(void 0, void 0, !0),
|
|
48
|
+
children: e("str.retry")
|
|
50
49
|
},
|
|
51
50
|
"retry"
|
|
52
51
|
),
|
|
53
|
-
|
|
52
|
+
a
|
|
54
53
|
] }) : /* @__PURE__ */ t.jsx(t.Fragment, {})
|
|
55
54
|
]
|
|
56
55
|
}
|
|
57
56
|
);
|
|
58
57
|
};
|
|
59
58
|
export {
|
|
60
|
-
|
|
59
|
+
b as default
|
|
61
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("../../../../_virtual/jsx-runtime.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../../../../_virtual/jsx-runtime.cjs"),S=require("antd"),o=require("react"),q=require("../appearance/Hider.cjs"),{Step:_}=S.Steps,y=o.forwardRef(({pages:d,onSubmit:a,initPosition:p=0,progressDot:v,type:E,labelPlacement:b,className:g,pageStyle:w},k)=>{const[s,c]=o.useState(0),[r,f]=o.useState([]);o.useEffect(()=>{c(p)},[p]),o.useImperativeHandle(k,()=>({gotTo:t=>c(t)}),[]);const x=o.useCallback((t,u=!1,l=!1)=>{const e=[...r];if(t!==void 0&&(e[s]=t,f(e)),l||c(s+1),u&&a){const n={};for(const h of e)for(const R in h)n[R]=h[R];a(e,n)}},[s,r,a]),m=o.useCallback(()=>{const t=[...r];t[s]=void 0,f(t),c(s-1)},[s,r]),j=o.useMemo(()=>{const t=[],u=[],l=d.filter(e=>!e.hidden);for(let e=0;e<l.length;e++){const n=l[e];u.push(i.jsxRuntimeExports.jsx(q.default,{hide:s!==e,children:n.component({forward:x,backward:m},r,s===e)},`${n.title}${e}`)),t.push(i.jsxRuntimeExports.jsx(_,{icon:n.icon,title:n.title},n.title))}return{_pages:u,steps:t}},[m,s,r,x,d]);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(S.Steps,{labelPlacement:b,progressDot:v,className:[g,"pb-3"].join(" "),current:s,type:E,children:j.steps}),i.jsxRuntimeExports.jsx("div",{style:w,children:j._pages})]})});exports.default=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("../../../_virtual/jsx-runtime.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../../../_virtual/jsx-runtime.cjs"),x=require("antd"),ae=require("../../../_virtual/dayjs.min.cjs"),o=require("react"),ie=require("react-i18next"),le=require("../../locale/hooks/translation-constants.cjs"),re=require("./CrudForm.cjs"),ce=require("./CrudFormWizard.cjs"),ue=require("./import/CrudImportButton.cjs"),de=require("./view/CrudViewer.cjs"),pe=require("../common/button/NewButton.cjs"),me=require("../common/button/PrintButton.cjs"),{useForm:fe}=x.Form;function xe({idField:j="id",onCreate:g,onDelete:O,onHide:T,onUpdate:p,fields:i,data:I,grid:w,isHiding:D,isCreating:R,isDeleting:U,isUpdating:b,paginateProps:W,onPrint:h,printing:L,viewable:H,loadingData:G,formBuilder:J,extraAction:K,minusHeight:Q,cloneable:X,fullWidthModal:Y=!0,wizard:l,extraView:Z,importable:q,onClickNew:N,...$}){const{t:F}=ie.useTranslation(le.TRANSLATION_NAMESPACE),[v,y]=o.useState(!1),[m,E]=o.useState(),[z,S]=o.useState(),[r]=fe(),P=o.useCallback(async n=>{const u=l?n:await r.validateFields(),c=i.filter(e=>e.type==="color"),a={};c.forEach(e=>{var d;const t=r.getFieldValue(e.name);a[e.name]=typeof t=="string"?t:(d=t==null?void 0:t.toHexString())==null?void 0:d.toUpperCase()}),Object.assign(u,a),m&&p?(await p({...u,[j]:m[j]}),E(void 0)):!m&&g&&await g(u),S(void 0),r.resetFields(),y(!1)},[i,r,j,g,p,m,l]),[ee,V]=o.useState(!1),[te,k]=o.useState(!1);o.useEffect(()=>{v?(V(!1),k(!1)):C(void 0)},[v]);const _=o.useCallback(async n=>{V(n),k(!0)},[]),A=o.useCallback(async()=>{k(!0)},[]),[se,M]=o.useState(!1),B=o.useCallback(async(n,u=!0,c=!1)=>{try{M(!0),y(!0),u&&C("update");const a={};for(const e of i){const t=n[e.name];if(c&&e.type==="image"){const d=t;try{const oe=await e.provider.clone(d);a[e.name]=oe;continue}catch{continue}}e.type==="date"?t&&(a[e.name]=ae.default(t)):e.type==="select"?e.multiple&&Array.isArray(t)?a[e.name]=t.map(d=>d[e.innerFieldId??"id"]):t&&typeof t=="object"?a[e.name]=t[e.innerFieldId??"id"]:(t&&typeof t=="string"||typeof t=="number")&&(a[e.name]=t):a[e.name]=t}r.setFieldsValue(a),S(a),u&&E(n)}finally{M(!1)}},[i,r]),[f,C]=o.useState(),ne=o.useCallback(async n=>{C("clone"),B(n,!1,!0)},[B]);return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs(x.Space,{direction:"vertical",className:"w-100",children:[s.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex",children:[s.jsxRuntimeExports.jsx("div",{style:{flex:1},children:s.jsxRuntimeExports.jsx(pe.NewButton,{onClick:()=>{N?N():(y(n=>!n),C("new"))},className:"flex-1"})}),s.jsxRuntimeExports.jsxs(x.Space,{children:[!!h&&s.jsxRuntimeExports.jsx(me.PrintButton,{className:"float-right",loading:L,onClick:h}),!!q&&s.jsxRuntimeExports.jsx(ue.default,{fields:i,importProps:q})]})]}),s.jsxRuntimeExports.jsx(de.default,{...$,minusHeight:Q,data:I,fields:i,extraAction:K,idField:j,isDeleting:U,loadingData:G,onClickUpdate:p?B:void 0,onHide:T,isHiding:D,onDelete:O,onUpdate:p,onClickClone:X?ne:void 0,paginateProps:W,viewable:H,extraView:Z})]}),s.jsxRuntimeExports.jsx(x.Modal,{width:Y?"100%":void 0,title:F(f??"new"),open:v,confirmLoading:R||b,okText:F("str."+(f==="update"?"update":"save")),cancelText:F("str.cancel"),cancelButtonProps:{disabled:te,hidden:!!l},okButtonProps:{disabled:ee,hidden:!!l},onCancel:async()=>{try{if(f==="clone"){const n=l?m:r.getFieldsValue(),u=i.filter(c=>c.type==="image");for(const c of u)n[c.name]&&c.provider.delete(n[c.name])}}finally{}l||r.resetFields(),S(void 0),E(void 0),y(!1)},onOk:()=>P(),destroyOnClose:!0,children:s.jsxRuntimeExports.jsxs(x.Spin,{spinning:se,children:[!l&&s.jsxRuntimeExports.jsx(re.CrudForm,{purpose:f,fields:i,form:r,formBuilder:J,grid:w,onDeleteFile:A,onUploadFile:_}),l&&s.jsxRuntimeExports.jsx(ce.default,{submitting:R||b,className:"mt-2",onSave:P,updatingValue:z,fields:i,onDeleteFile:A,onUploadFile:_,purpose:f,wizard:l})]})})]})}exports.default=xe;
|
|
@@ -2,14 +2,14 @@ import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
|
2
2
|
import { Space as _, Modal as ae, Spin as ie, Form as re } from "antd";
|
|
3
3
|
import ce from "../../../_virtual/dayjs.min.js";
|
|
4
4
|
import { useState as m, useCallback as y, useEffect as me } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import ue from "./
|
|
8
|
-
import pe from "./
|
|
9
|
-
import ye from "./
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { useTranslation as fe } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as de } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { CrudForm as ue } from "./CrudForm.js";
|
|
8
|
+
import pe from "./CrudFormWizard.js";
|
|
9
|
+
import ye from "./import/CrudImportButton.js";
|
|
10
|
+
import xe from "./view/CrudViewer.js";
|
|
11
|
+
import { NewButton as Fe } from "../common/button/NewButton.js";
|
|
12
|
+
import { PrintButton as ge } from "../common/button/PrintButton.js";
|
|
13
13
|
const { useForm: je } = re;
|
|
14
14
|
function Oe({
|
|
15
15
|
idField: x = "id",
|
|
@@ -40,7 +40,7 @@ function Oe({
|
|
|
40
40
|
onClickNew: A,
|
|
41
41
|
...z
|
|
42
42
|
}) {
|
|
43
|
-
const { t: v } =
|
|
43
|
+
const { t: v } = fe(de), [C, F] = m(!1), [u, B] = m(), [ee, h] = m(), [i] = je(), E = y(
|
|
44
44
|
async (n) => {
|
|
45
45
|
const c = a ? n : await i.validateFields(), r = l.filter((e) => e.type === "color"), s = {};
|
|
46
46
|
r.forEach((e) => {
|
|
@@ -98,7 +98,7 @@ function Oe({
|
|
|
98
98
|
/* @__PURE__ */ o.jsxs(_, { direction: "vertical", className: "w-100", children: [
|
|
99
99
|
/* @__PURE__ */ o.jsxs("div", { className: "w-100 d-flex", children: [
|
|
100
100
|
/* @__PURE__ */ o.jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ o.jsx(
|
|
101
|
-
|
|
101
|
+
Fe,
|
|
102
102
|
{
|
|
103
103
|
onClick: () => {
|
|
104
104
|
A ? A() : (F((n) => !n), g("new"));
|
|
@@ -108,18 +108,18 @@ function Oe({
|
|
|
108
108
|
) }),
|
|
109
109
|
/* @__PURE__ */ o.jsxs(_, { children: [
|
|
110
110
|
!!V && /* @__PURE__ */ o.jsx(
|
|
111
|
-
|
|
111
|
+
ge,
|
|
112
112
|
{
|
|
113
113
|
className: "float-right",
|
|
114
114
|
loading: q,
|
|
115
115
|
onClick: V
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
|
-
!!P && /* @__PURE__ */ o.jsx(
|
|
118
|
+
!!P && /* @__PURE__ */ o.jsx(ye, { fields: l, importProps: P })
|
|
119
119
|
] })
|
|
120
120
|
] }),
|
|
121
121
|
/* @__PURE__ */ o.jsx(
|
|
122
|
-
|
|
122
|
+
xe,
|
|
123
123
|
{
|
|
124
124
|
...z,
|
|
125
125
|
minusHeight: X,
|
|
@@ -175,7 +175,7 @@ function Oe({
|
|
|
175
175
|
destroyOnClose: !0,
|
|
176
176
|
children: /* @__PURE__ */ o.jsxs(ie, { spinning: ne, children: [
|
|
177
177
|
!a && /* @__PURE__ */ o.jsx(
|
|
178
|
-
|
|
178
|
+
ue,
|
|
179
179
|
{
|
|
180
180
|
purpose: p,
|
|
181
181
|
fields: l,
|
|
@@ -187,7 +187,7 @@ function Oe({
|
|
|
187
187
|
}
|
|
188
188
|
),
|
|
189
189
|
a && /* @__PURE__ */ o.jsx(
|
|
190
|
-
|
|
190
|
+
pe,
|
|
191
191
|
{
|
|
192
192
|
submitting: S || N,
|
|
193
193
|
className: "mt-2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),E=require("antd"),y=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),E=require("antd"),y=require("react"),D=require("react-highlight-words"),W=require("react-i18next"),G=require("../../locale/hooks/translation-constants.cjs"),$=require("./FileCrudField.cjs"),z=require("./ImageCrudField.cjs"),J=require("../common/DatePicker/DatePicker.cjs"),K=require("../common/DatePicker/TimePicker.cjs"),Q=require("../common/check-box/CheckBox.cjs"),L=require("../common/select/SelectComponent.cjs"),X=require("../common/text-field/NumberField.cjs"),Y=require("../common/text-field/TextField.cjs"),Z=require("../common/text-field/TextArea.cjs"),V=require("../common/tooltip/TooltipComponent.cjs");function ee(b){const{label:i,name:d,type:f,required:l,hidden:T,rules:x=[],updatable:m=!0,readonly:q=!1,fieldClassName:h,customFormFieldRender:N,fieldTooltip:C,...e}=b,p=E.Form.useFormInstance();y.useEffect(()=>{if(f==="select"){const{items:r=[],onSearch:a,searchOnType:n}=e;!(r!=null&&r.length)&&!n&&(a==null||a(void 0,p,e==null?void 0:e.updatingValue))}},[p,e,f,e==null?void 0:e.updatingValue]);const{t:F}=W.useTranslation(G.TRANSLATION_NAMESPACE);if(q||T)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});if(N)return N(p,b);switch(f){case"text":case"email":case"password":{const{onChange:r,placeholder:a}=e;return t.jsxRuntimeExports.jsx(Y.default,{placeholder:a,disabled:!m,rules:x,required:l,onChange:r?n=>r(n,p):void 0,type:f,name:d,tooltip:C,label:i,className:h,autoComplete:"new-password"})}case"number":{const{onChange:r,placeholder:a,allowMinus:n}=e;return t.jsxRuntimeExports.jsx(X.default,{placeholder:a,disabled:!m,moneyField:!!e.formatted,type:f,onChange:r?j=>r(j,p):void 0,rules:x,autoComplete:"false",required:l,tooltip:C,className:h,min:n?null:void 0,name:d,label:i})}case"date":{const{range:r,disableToday:a,disabledFutureDays:n,disabledPastDays:j,onChange:g,placeholder:c,format:v}=e;return t.jsxRuntimeExports.jsx(J.default,{placeholder:c,required:l,disabled:!m,type:f,format:v,tooltip:C,range:r,name:d,label:i,onChange:g?o=>g(o,p):void 0,className:h,disableToday:a,disabledFutureDays:n,disabledPastDays:j})}case"time":{const{range:r=!1,disableCurrent:a,disabledFuture:n,disabledPast:j,onChange:g,use12Hours:c,format:v,placeholder:o}=e;return t.jsxRuntimeExports.jsx(K.default,{placeholder:o,required:l,format:v,disabled:!m,type:f,tooltip:C,range:r,use12Hours:c,name:d,label:i,onChange:g?R=>g(R,p):void 0,className:h,disableCurrent:a,disabledFuture:n,disabledPast:j})}case"textarea":{const{onChange:r,placeholder:a,rows:n,cols:j}=e;return t.jsxRuntimeExports.jsx(Z.default,{rules:x,placeholder:a,onChange:r?g=>{var c;return r((c=g==null?void 0:g.target)==null?void 0:c.value,p)}:void 0,tooltip:C,required:l,disabled:!m,name:d,label:i,className:h,rows:n,cols:j})}case"image":return t.jsxRuntimeExports.jsx(z.default,{...e,required:l,name:d,label:i,rules:x,fieldClassName:h,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return t.jsxRuntimeExports.jsx($.default,{...e,required:l,name:d,label:i,rules:x,fieldClassName:h,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return t.jsxRuntimeExports.jsx(B,{...e,required:l,name:d,label:i,rules:x,fieldClassName:h,form:p,updatable:m,readonly:q,fieldTooltip:C});case"enum":{const{enum:r,radio:a=!1,translation:n,onChange:j,onSearch:g,multiple:c}=e,v=Array.isArray(r)?r:Object.keys(r);return a?t.jsxRuntimeExports.jsx(E.Form.Item,{...e,name:d,required:l,tooltip:C,rules:x,label:i,className:["w-100",h].join(" "),children:t.jsxRuntimeExports.jsx(E.Radio.Group,{...e,onChange:j?o=>{var R;return j((R=o==null?void 0:o.target)==null?void 0:R.value,p)}:void 0,children:v.map(o=>t.jsxRuntimeExports.jsx(E.Radio,{disabled:!m,value:o,children:n?F(n[o]):o},o))})}):t.jsxRuntimeExports.jsx(L.default,{...e,onChange:j?o=>j(o,p):void 0,className:["w-100",h].join(" "),name:d,items:v,required:l,tooltip:C,rules:x,label:i,disabled:!m,onSearch:g?o=>g(o,p):void 0,allowClear:!0,mode:c?"multiple":void 0,itemBuilder:o=>t.jsxRuntimeExports.jsx(E.Select.Option,{value:o,children:n?F(n[o]):o},o)})}case"checkbox":{const{onChange:r}=e;return t.jsxRuntimeExports.jsx(Q.default,{className:h,rules:x,onChange:r?a=>r(a,p):void 0,label:i,tooltip:C,disabled:!m,name:d})}case"color":return t.jsxRuntimeExports.jsx(H,{...e,type:"color",required:l,name:d,label:i,rules:x,fieldClassName:h,updatable:m,readonly:q,fieldTooltip:C});default:return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:`${f} Not Implemented`})}}function B(b){const{items:i=[],loading:d,searchOnType:f,onSearch:l,multiple:T,onChange:x,highlightSearch:m,required:q,fieldClassName:h,rules:N,fieldTooltip:C,updatable:e,label:p,name:F,tagRender:r,updatingValue:a,onSet:n,placeholder:j,allowClear:g=!0}=b,c=b.form,[v,o]=y.useState(""),R=E.Form.useWatch(F,c),[S,w]=y.useState(!0);y.useEffect(()=>{n&&S&&R&&(n==null||n(R,i,c),w(!1))},[S,c,i,F,n,R]),y.useEffect(()=>{R&&w(!0)},[R]);const M=y.useCallback(async s=>{o(s),f&&(l==null||l(s,c,a))},[c,l,f,a]);return t.jsxRuntimeExports.jsx(L.default,{...b,maxTagCount:"responsive",maxTagPlaceholder:s=>t.jsxRuntimeExports.jsxs(V.default,{title:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:s.map(u=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u.label," ",t.jsxRuntimeExports.jsx("br",{})]}))}),children:["+",s==null?void 0:s.length]}),placeholder:j,onSelect:s=>{n==null||n(s==null?void 0:s.key,i,c)},onChange:x?s=>{o(""),x(s,c)}:void 0,mode:T?"multiple":void 0,className:["w-100",h].join(" "),name:F,items:i,required:q,tooltip:C,tagRender:r,rules:N,disabled:!e,label:p,allowClear:g,onSearch:M,loading:d,filterOption:m?(s,u)=>{var k,O,P;try{const A=s.toLowerCase().split(/\s+/),U=((typeof(u==null?void 0:u.children)=="string"?u==null?void 0:u.children:(O=(k=u==null?void 0:u.children)==null?void 0:k.props)==null?void 0:O.textToHighlight)??"").toLowerCase(),_=(((P=u==null?void 0:u.value)==null?void 0:P.toString())??"").toLowerCase();return A.every(I=>U.indexOf(I)>=0||_.indexOf(I)>=0)}catch{return!0}}:void 0,itemBuilder:m?s=>{const u=s.value?String(s.value):void 0;return t.jsxRuntimeExports.jsx(E.Select.Option,{value:s.key,title:u,disabled:s.disabled,children:t.jsxRuntimeExports.jsx(D,{highlightClassName:"highlight-text",searchWords:(v??"").split(" "),autoEscape:!0,textToHighlight:u??""})},s.key)}:s=>t.jsxRuntimeExports.jsx(E.Select.Option,{value:s.key,title:s.value,disabled:s.disabled,children:s.value},s.key)})}function H(b){const{required:i,fieldClassName:d,rules:f,fieldTooltip:l,updatable:T,label:x,name:m}=b;return t.jsxRuntimeExports.jsx(E.Form.Item,{label:x,name:m,required:i,rules:f,tooltip:l,children:t.jsxRuntimeExports.jsx(E.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:d,disabled:!T,...b.innerProps})})}exports.ColorCrudFieldComponent=H;exports.SelectCrudFieldComponent=B;exports.default=ee;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { Form as k, Radio as H, Select as O, ColorPicker as _ } from "antd";
|
|
3
3
|
import { useEffect as R, useState as U, useCallback as G } from "react";
|
|
4
|
-
import $ from "
|
|
5
|
-
import {
|
|
6
|
-
import J from "
|
|
7
|
-
import K from "./
|
|
8
|
-
import Q from "
|
|
9
|
-
import X from "../common/DatePicker/
|
|
10
|
-
import Y from "../common/
|
|
4
|
+
import $ from "react-highlight-words";
|
|
5
|
+
import { useTranslation as z } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as J } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import K from "./FileCrudField.js";
|
|
8
|
+
import Q from "./ImageCrudField.js";
|
|
9
|
+
import X from "../common/DatePicker/DatePicker.js";
|
|
10
|
+
import Y from "../common/DatePicker/TimePicker.js";
|
|
11
|
+
import Z from "../common/check-box/CheckBox.js";
|
|
11
12
|
import q from "../common/select/SelectComponent.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { useTranslation as re } from "../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
13
|
+
import V from "../common/text-field/NumberField.js";
|
|
14
|
+
import ee from "../common/text-field/TextField.js";
|
|
15
|
+
import te from "../common/text-field/TextArea.js";
|
|
16
|
+
import re from "../common/tooltip/TooltipComponent.js";
|
|
17
17
|
function ve(v) {
|
|
18
18
|
const {
|
|
19
19
|
label: i,
|
|
@@ -39,7 +39,7 @@ function ve(v) {
|
|
|
39
39
|
!(o != null && o.length) && !a && (n == null || n(void 0, p, e == null ? void 0 : e.updatingValue));
|
|
40
40
|
}
|
|
41
41
|
}, [p, e, x, e == null ? void 0 : e.updatingValue]);
|
|
42
|
-
const { t: F } =
|
|
42
|
+
const { t: F } = z(J);
|
|
43
43
|
if (N || T) return /* @__PURE__ */ t.jsx(t.Fragment, {});
|
|
44
44
|
if (w)
|
|
45
45
|
return w(p, v);
|
|
@@ -49,7 +49,7 @@ function ve(v) {
|
|
|
49
49
|
case "password": {
|
|
50
50
|
const { onChange: o, placeholder: n } = e;
|
|
51
51
|
return /* @__PURE__ */ t.jsx(
|
|
52
|
-
|
|
52
|
+
ee,
|
|
53
53
|
{
|
|
54
54
|
placeholder: n,
|
|
55
55
|
disabled: !h,
|
|
@@ -68,7 +68,7 @@ function ve(v) {
|
|
|
68
68
|
case "number": {
|
|
69
69
|
const { onChange: o, placeholder: n, allowMinus: a } = e;
|
|
70
70
|
return /* @__PURE__ */ t.jsx(
|
|
71
|
-
|
|
71
|
+
V,
|
|
72
72
|
{
|
|
73
73
|
placeholder: n,
|
|
74
74
|
disabled: !h,
|
|
@@ -97,7 +97,7 @@ function ve(v) {
|
|
|
97
97
|
format: y
|
|
98
98
|
} = e;
|
|
99
99
|
return /* @__PURE__ */ t.jsx(
|
|
100
|
-
|
|
100
|
+
X,
|
|
101
101
|
{
|
|
102
102
|
placeholder: c,
|
|
103
103
|
required: s,
|
|
@@ -128,7 +128,7 @@ function ve(v) {
|
|
|
128
128
|
placeholder: l
|
|
129
129
|
} = e;
|
|
130
130
|
return /* @__PURE__ */ t.jsx(
|
|
131
|
-
|
|
131
|
+
Y,
|
|
132
132
|
{
|
|
133
133
|
placeholder: l,
|
|
134
134
|
required: s,
|
|
@@ -151,7 +151,7 @@ function ve(v) {
|
|
|
151
151
|
case "textarea": {
|
|
152
152
|
const { onChange: o, placeholder: n, rows: a, cols: f } = e;
|
|
153
153
|
return /* @__PURE__ */ t.jsx(
|
|
154
|
-
|
|
154
|
+
te,
|
|
155
155
|
{
|
|
156
156
|
rules: u,
|
|
157
157
|
placeholder: n,
|
|
@@ -172,7 +172,7 @@ function ve(v) {
|
|
|
172
172
|
}
|
|
173
173
|
case "image":
|
|
174
174
|
return /* @__PURE__ */ t.jsx(
|
|
175
|
-
|
|
175
|
+
Q,
|
|
176
176
|
{
|
|
177
177
|
...e,
|
|
178
178
|
required: s,
|
|
@@ -187,7 +187,7 @@ function ve(v) {
|
|
|
187
187
|
);
|
|
188
188
|
case "file":
|
|
189
189
|
return /* @__PURE__ */ t.jsx(
|
|
190
|
-
|
|
190
|
+
K,
|
|
191
191
|
{
|
|
192
192
|
...e,
|
|
193
193
|
required: s,
|
|
@@ -270,7 +270,7 @@ function ve(v) {
|
|
|
270
270
|
case "checkbox": {
|
|
271
271
|
const { onChange: o } = e;
|
|
272
272
|
return /* @__PURE__ */ t.jsx(
|
|
273
|
-
|
|
273
|
+
Z,
|
|
274
274
|
{
|
|
275
275
|
className: g,
|
|
276
276
|
rules: u,
|
|
@@ -341,7 +341,7 @@ function oe(v) {
|
|
|
341
341
|
...v,
|
|
342
342
|
maxTagCount: "responsive",
|
|
343
343
|
maxTagPlaceholder: (r) => /* @__PURE__ */ t.jsxs(
|
|
344
|
-
|
|
344
|
+
re,
|
|
345
345
|
{
|
|
346
346
|
title: /* @__PURE__ */ t.jsx(t.Fragment, { children: r.map((d) => /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
347
347
|
d.label,
|
|
@@ -2,18 +2,18 @@ import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
|
2
2
|
import x, { useMemo as h, createElement as o, useCallback as p } from "react";
|
|
3
3
|
import { Form as j, Col as b, Input as g, Row as A } from "antd";
|
|
4
4
|
import l from "./CrudField.js";
|
|
5
|
-
function
|
|
5
|
+
function v({
|
|
6
6
|
form: d,
|
|
7
|
-
purpose:
|
|
7
|
+
purpose: s = "new",
|
|
8
8
|
...i
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(j, { form: d, layout: "vertical", children: /* @__PURE__ */ t.jsx(C, { ...i, purpose:
|
|
10
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(j, { form: d, layout: "vertical", children: /* @__PURE__ */ t.jsx(C, { ...i, purpose: s }) }) });
|
|
11
11
|
}
|
|
12
12
|
function C({
|
|
13
13
|
fields: d,
|
|
14
|
-
formBuilder:
|
|
14
|
+
formBuilder: s,
|
|
15
15
|
grid: i,
|
|
16
|
-
onDeleteFile:
|
|
16
|
+
onDeleteFile: u,
|
|
17
17
|
onUploadFile: c,
|
|
18
18
|
purpose: m
|
|
19
19
|
}) {
|
|
@@ -26,7 +26,7 @@ function C({
|
|
|
26
26
|
},
|
|
27
27
|
onDelete: (a) => {
|
|
28
28
|
var n;
|
|
29
|
-
r.onUploading && ((n = r.onDelete) == null || n.call(r, a)),
|
|
29
|
+
r.onUploading && ((n = r.onDelete) == null || n.call(r, a)), u == null || u(a);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
return /* @__PURE__ */ t.jsx(x.Fragment, { children: r.grid && i ? /* @__PURE__ */ t.jsx(b, { ...r.grid, children: /* @__PURE__ */ o(
|
|
@@ -47,7 +47,7 @@ function C({
|
|
|
47
47
|
}
|
|
48
48
|
) }, r.name);
|
|
49
49
|
}),
|
|
50
|
-
[d, i,
|
|
50
|
+
[d, i, u, c, m]
|
|
51
51
|
), y = p(
|
|
52
52
|
(r, e = {}) => {
|
|
53
53
|
const a = d.find((n) => n.name === r);
|
|
@@ -68,8 +68,8 @@ function C({
|
|
|
68
68
|
},
|
|
69
69
|
[d, m]
|
|
70
70
|
);
|
|
71
|
-
return /* @__PURE__ */ t.jsx(t.Fragment, { children:
|
|
72
|
-
|
|
71
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: s ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
72
|
+
s(y, {
|
|
73
73
|
isAnyFieldHidden(...r) {
|
|
74
74
|
const e = Array.isArray(r) ? r : [r];
|
|
75
75
|
return d.filter((n) => e.includes(n.name)).some((n) => n.hidden);
|
|
@@ -86,6 +86,6 @@ function C({
|
|
|
86
86
|
] }) : i ? /* @__PURE__ */ t.jsx(A, { gutter: [8, 8], children: f }) : f });
|
|
87
87
|
}
|
|
88
88
|
export {
|
|
89
|
-
|
|
89
|
+
v as CrudForm,
|
|
90
90
|
C as CrudFormFields
|
|
91
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("../../../_virtual/jsx-runtime.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs"),R=require("@ant-design/icons"),x=require("antd"),E=require("react"),F=require("react-i18next"),S=require("../../locale/hooks/translation-constants.cjs"),q=require("./CrudForm.cjs"),b=require("../common/button/Button.cjs"),C=require("../common/wizard/WizardViewForm.cjs");function k({fields:l,className:a,onDeleteFile:m,onUploadFile:i,purpose:u,wizard:r=[],updatingValue:j,onSave:f,submitting:h}){const d=E.useMemo(()=>r.map(n=>{let t=!0;const s=l.filter(o=>n.fields.includes(o.name));return s.forEach(o=>t&&(t=o.hidden??!1)),{...n,hidden:t,fieldThatShouldShowing:s}}),[l,r]),c=E.useMemo(()=>d.filter(n=>!n.hidden),[d]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(C.default,{onSubmit:(n,t)=>{console.log(t),f(t)},className:a,pages:c.map(({title:n,icon:t,fieldThatShouldShowing:s,hidden:o},g)=>({title:n,icon:t,hidden:o,component:p=>e.jsxRuntimeExports.jsx(y,{fields:s,onDeleteFile:m,onUploadFile:i,purpose:u,i:g,updatingValue:j,backward:p.backward,forward:p.forward,wizard:c,submitting:h},g)}))})})}function y({fields:l,onDeleteFile:a,onUploadFile:m,purpose:i,wizard:u=[],i:r,forward:j,backward:f,submitting:h,updatingValue:d}){const c=u[r],{t:n}=F.useTranslation(S.TRANSLATION_NAMESPACE),[t]=x.Form.useForm();return E.useEffect(()=>{if(d&&(i==="update"||i==="clone")){const s={};for(const o of l)s[o.name]=d[o.name];t.setFieldsValue(s)}},[l,t,i,d]),e.jsxRuntimeExports.jsxs(x.Form,{name:String(r),form:t,layout:"vertical",children:[e.jsxRuntimeExports.jsx(q.CrudFormFields,{fields:l,formBuilder:c.formBuilder,grid:c.grid,onDeleteFile:a,onUploadFile:m,purpose:i}),e.jsxRuntimeExports.jsx(x.Divider,{}),e.jsxRuntimeExports.jsxs(x.Row,{gutter:[8,8],children:[r>0&&e.jsxRuntimeExports.jsx(x.Col,{md:12,children:e.jsxRuntimeExports.jsx(b.default,{block:!0,icon:e.jsxRuntimeExports.jsx(R.LeftOutlined,{}),htmlType:"button",type:"default",size:"large",onClick:()=>f(),children:n("str.back")})}),e.jsxRuntimeExports.jsx(x.Col,{md:r>0?12:24,children:e.jsxRuntimeExports.jsx(b.default,{block:!0,icon:u.length-1===r?e.jsxRuntimeExports.jsx(R.SaveOutlined,{}):e.jsxRuntimeExports.jsx(R.RightOutlined,{}),htmlType:"submit",type:"primary",loading:h,size:"large",onClick:()=>{t.validateFields().then(s=>{j(s,u.length-1===r,u.length-1===r)})},children:u.length-1===r?n("str."+(i==="update"?"update":"save")):n("str.next")})})]})]})}exports.default=k;
|