@kingteza/crud-component 1.0.14 → 1.0.16
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/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/common/DatePicker/DatePicker.js +42 -42
- package/dist/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/components/common/DatePicker/TimePicker.js +39 -39
- package/dist/components/common/appearance/Hider.cjs +1 -1
- package/dist/components/common/appearance/Hider.js +3 -3
- package/dist/components/common/button/Button.cjs +1 -1
- package/dist/components/common/button/Button.js +19 -19
- package/dist/components/common/button/CloneButtonTable.cjs +1 -1
- package/dist/components/common/button/CloneButtonTable.js +11 -11
- package/dist/components/common/button/DeleteButtonTable.cjs +1 -1
- package/dist/components/common/button/DeleteButtonTable.js +29 -29
- package/dist/components/common/button/ExportButton.cjs +1 -1
- package/dist/components/common/button/ExportButton.js +17 -17
- package/dist/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/components/common/button/HideButtonTable.js +35 -35
- package/dist/components/common/button/ImportButton.cjs +1 -1
- package/dist/components/common/button/ImportButton.js +28 -28
- package/dist/components/common/button/NewButton.cjs +1 -1
- package/dist/components/common/button/NewButton.js +14 -14
- package/dist/components/common/button/PrintButton.cjs +1 -1
- package/dist/components/common/button/PrintButton.js +14 -14
- package/dist/components/common/button/RefreshButton.cjs +1 -1
- package/dist/components/common/button/RefreshButton.js +16 -16
- package/dist/components/common/button/UnHideButton.cjs +1 -1
- package/dist/components/common/button/UnHideButton.js +37 -37
- package/dist/components/common/button/UpdateButtonTable.cjs +1 -1
- package/dist/components/common/button/UpdateButtonTable.js +11 -11
- package/dist/components/common/button/ViewButtonTable.cjs +1 -1
- package/dist/components/common/button/ViewButtonTable.js +10 -10
- package/dist/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/components/common/check-box/CheckBox.js +20 -20
- package/dist/components/common/description/DescList.cjs +1 -1
- package/dist/components/common/description/DescList.js +9 -9
- package/dist/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/components/common/layout/VerticalSpace.js +3 -3
- package/dist/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/components/common/loading/LoadingIndicator.js +12 -12
- package/dist/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/components/common/picker/ImagePicker.js +173 -176
- package/dist/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/components/common/radio/RadioGroupComponent.js +6 -6
- package/dist/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/components/common/report/SelectFieldInReport.js +11 -11
- package/dist/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/components/common/select/CustomSelectOption.js +7 -7
- package/dist/components/common/select/SelectComponent.cjs +1 -1
- package/dist/components/common/select/SelectComponent.js +36 -36
- package/dist/components/common/show-more/index.cjs +1 -1
- package/dist/components/common/show-more/index.js +5 -5
- package/dist/components/common/tab/TabViewWithRoute.cjs +1 -1
- package/dist/components/common/tab/TabViewWithRoute.js +23 -22
- package/dist/components/common/table/table.cjs +1 -1
- package/dist/components/common/table/table.js +12 -12
- package/dist/components/common/tag/StatusTag.cjs +1 -1
- package/dist/components/common/tag/StatusTag.js +13 -13
- package/dist/components/common/text-field/NumberField.cjs +1 -1
- package/dist/components/common/text-field/NumberField.js +43 -43
- package/dist/components/common/text-field/PhoneNumberField.cjs +1 -1
- package/dist/components/common/text-field/PhoneNumberField.js +4 -4
- package/dist/components/common/text-field/TextArea.cjs +1 -1
- package/dist/components/common/text-field/TextArea.js +20 -20
- package/dist/components/common/text-field/TextField.cjs +1 -1
- package/dist/components/common/text-field/TextField.js +47 -47
- package/dist/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/components/common/tooltip/TooltipComponent.js +3 -3
- package/dist/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/components/common/wizard/WizardResult.js +37 -38
- package/dist/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/components/common/wizard/WizardViewForm.js +43 -43
- package/dist/components/crud/CrudComponent.cjs +1 -1
- package/dist/components/crud/CrudComponent.js +130 -130
- package/dist/components/crud/CrudField.cjs +1 -1
- package/dist/components/crud/CrudField.js +217 -217
- package/dist/components/crud/CrudForm.cjs +1 -1
- package/dist/components/crud/CrudForm.js +55 -55
- package/dist/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/components/crud/CrudFormWizard.js +82 -84
- package/dist/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/components/crud/CrudReportComponent.js +123 -123
- package/dist/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/components/crud/CrudSearchComponent.js +43 -43
- package/dist/components/crud/FileCrudField.cjs +1 -1
- package/dist/components/crud/FileCrudField.js +118 -125
- package/dist/components/crud/ImageCrudField.cjs +1 -1
- package/dist/components/crud/ImageCrudField.js +56 -56
- package/dist/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/components/crud/import/CrudImportButton.js +18 -18
- package/dist/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/components/crud/import/CrudImportComponent.js +108 -109
- package/dist/components/crud/view/CrudDecListView.cjs +1 -1
- package/dist/components/crud/view/CrudDecListView.js +22 -22
- package/dist/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/components/crud/view/CrudViewer.js +152 -152
- package/dist/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/components/crud/view/CrudViewerUtil.js +33 -34
- package/dist/locale/index.cjs +1 -1
- package/dist/locale/index.js +2 -2
- package/dist/util/DateUtil.cjs +1 -1
- package/dist/util/DateUtil.js +4 -4
- package/dist/util/ImageUtil.cjs +1 -1
- package/dist/util/ImageUtil.js +1 -1
- package/dist/util/ValidationUtil.cjs +1 -1
- package/dist/util/ValidationUtil.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),u=require("antd"),g=require("./CrudField.cjs");function h({form:d,purpose:m="new",...s}){return t.jsx(t.Fragment,{children:t.jsx(u.Form,{form:d,layout:"vertical",children:t.jsx(y,{...s,purpose:m})})})}function y({fields:d,formBuilder:m,grid:s,onDeleteFile:l,onUploadFile:o,purpose:c}){const f=i.useMemo(()=>d.filter(r=>!r.readonly).map(r=>{const a={onUploading:e=>{var n;r.onUploading&&((n=r.onUploading)==null||n.call(r,e)),o==null||o(e)},onDelete:e=>{var n;r.onUploading&&((n=r.onDelete)==null||n.call(r,e)),l==null||l(e)}};return t.jsx(i.Fragment,{children:r.grid&&s?t.jsx(u.Col,{...r.grid,children:i.createElement(g.default,{...r,...a,key:typeof r.name=="string"?r.name:String(r.name),updatable:c!=="update"?!0:r.updatable})}):i.createElement(g.default,{...r,...a,key:typeof r.name=="string"?r.name:String(r.name),updatable:c!=="update"?!0:r.updatable})},r.name)}),[d,s,l,o,c]),j=i.useCallback((r,a={})=>{const e=d.find(n=>n.name===r);if(e!=null&&e.hidden)return t.jsx(t.Fragment,{});if(e){const n=i.createElement(g.default,{...e,...a,key:typeof e.name=="string"?e.name:String(e.name),updatable:c!=="update"?!0:e.updatable});return a.render?a.render(n):n}return t.jsx(t.Fragment,{})},[d,c]);return t.jsx(t.Fragment,{children:m?t.jsxs(t.Fragment,{children:[m(j,{isAnyFieldHidden(...r){const a=Array.isArray(r)?r:[r];return d.filter(n=>a.includes(n.name)).some(n=>n.hidden)},isAllFieldsHidden(...r){const a=Array.isArray(r)?r:[r];return d.filter(n=>a.includes(n.name)).every(n=>n.hidden)}}),t.jsxs(u.Form.Item,{hidden:!0,noStyle:!0,children:[t.jsx(u.Input,{name:"id"}),t.jsx(u.Input,{})]})]}):s?t.jsx(u.Row,{gutter:[8,8],children:f}):f})}exports.CrudForm=h;exports.CrudFormFields=y;
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { Form as
|
|
4
|
-
import
|
|
5
|
-
function
|
|
6
|
-
form:
|
|
7
|
-
purpose:
|
|
1
|
+
import { jsx as d, Fragment as m, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import A, { useMemo as C, createElement as f, useCallback as k } from "react";
|
|
3
|
+
import { Form as p, Col as S, Input as h, Row as j } from "antd";
|
|
4
|
+
import s from "./CrudField.js";
|
|
5
|
+
function x({
|
|
6
|
+
form: e,
|
|
7
|
+
purpose: c = "new",
|
|
8
8
|
...i
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ d(m, { children: /* @__PURE__ */ d(p, { form: e, layout: "vertical", children: /* @__PURE__ */ d(v, { ...i, purpose: c }) }) });
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
fields:
|
|
14
|
-
formBuilder:
|
|
12
|
+
function v({
|
|
13
|
+
fields: e,
|
|
14
|
+
formBuilder: c,
|
|
15
15
|
grid: i,
|
|
16
|
-
onDeleteFile:
|
|
17
|
-
onUploadFile:
|
|
18
|
-
purpose:
|
|
16
|
+
onDeleteFile: o,
|
|
17
|
+
onUploadFile: l,
|
|
18
|
+
purpose: u
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
() =>
|
|
22
|
-
const
|
|
23
|
-
onUploading: (
|
|
20
|
+
const y = C(
|
|
21
|
+
() => e.filter((r) => !r.readonly).map((r) => {
|
|
22
|
+
const a = {
|
|
23
|
+
onUploading: (t) => {
|
|
24
24
|
var n;
|
|
25
|
-
r.onUploading && ((n = r.onUploading) == null || n.call(r,
|
|
25
|
+
r.onUploading && ((n = r.onUploading) == null || n.call(r, t)), l == null || l(t);
|
|
26
26
|
},
|
|
27
|
-
onDelete: (
|
|
27
|
+
onDelete: (t) => {
|
|
28
28
|
var n;
|
|
29
|
-
r.onUploading && ((n = r.onDelete) == null || n.call(r,
|
|
29
|
+
r.onUploading && ((n = r.onDelete) == null || n.call(r, t)), o == null || o(t);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
32
|
+
return /* @__PURE__ */ d(A.Fragment, { children: r.grid && i ? /* @__PURE__ */ d(S, { ...r.grid, children: /* @__PURE__ */ f(
|
|
33
|
+
s,
|
|
34
34
|
{
|
|
35
35
|
...r,
|
|
36
|
-
...
|
|
36
|
+
...a,
|
|
37
37
|
key: typeof r.name == "string" ? r.name : String(r.name),
|
|
38
|
-
updatable:
|
|
38
|
+
updatable: u !== "update" ? !0 : r.updatable
|
|
39
39
|
}
|
|
40
|
-
) }) : /* @__PURE__ */
|
|
41
|
-
|
|
40
|
+
) }) : /* @__PURE__ */ f(
|
|
41
|
+
s,
|
|
42
42
|
{
|
|
43
43
|
...r,
|
|
44
|
-
...
|
|
44
|
+
...a,
|
|
45
45
|
key: typeof r.name == "string" ? r.name : String(r.name),
|
|
46
|
-
updatable:
|
|
46
|
+
updatable: u !== "update" ? !0 : r.updatable
|
|
47
47
|
}
|
|
48
48
|
) }, r.name);
|
|
49
49
|
}),
|
|
50
|
-
[
|
|
51
|
-
),
|
|
52
|
-
(r,
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
if (
|
|
56
|
-
const n = /* @__PURE__ */
|
|
57
|
-
|
|
50
|
+
[e, i, o, l, u]
|
|
51
|
+
), b = k(
|
|
52
|
+
(r, a = {}) => {
|
|
53
|
+
const t = e.find((n) => n.name === r);
|
|
54
|
+
if (t != null && t.hidden) return /* @__PURE__ */ d(m, {});
|
|
55
|
+
if (t) {
|
|
56
|
+
const n = /* @__PURE__ */ f(
|
|
57
|
+
s,
|
|
58
58
|
{
|
|
59
|
+
...t,
|
|
59
60
|
...a,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
updatable: m !== "update" ? !0 : a.updatable
|
|
61
|
+
key: typeof t.name == "string" ? t.name : String(t.name),
|
|
62
|
+
updatable: u !== "update" ? !0 : t.updatable
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
|
-
return
|
|
65
|
+
return a.render ? a.render(n) : n;
|
|
66
66
|
}
|
|
67
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ d(m, {});
|
|
68
68
|
},
|
|
69
|
-
[
|
|
69
|
+
[e, u]
|
|
70
70
|
);
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
|
|
71
|
+
return /* @__PURE__ */ d(m, { children: c ? /* @__PURE__ */ g(m, { children: [
|
|
72
|
+
c(b, {
|
|
73
73
|
isAnyFieldHidden(...r) {
|
|
74
|
-
const
|
|
75
|
-
return
|
|
74
|
+
const a = Array.isArray(r) ? r : [r];
|
|
75
|
+
return e.filter((n) => a.includes(n.name)).some((n) => n.hidden);
|
|
76
76
|
},
|
|
77
77
|
isAllFieldsHidden(...r) {
|
|
78
|
-
const
|
|
79
|
-
return
|
|
78
|
+
const a = Array.isArray(r) ? r : [r];
|
|
79
|
+
return e.filter((n) => a.includes(n.name)).every((n) => n.hidden);
|
|
80
80
|
}
|
|
81
81
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ g(p.Item, { hidden: !0, noStyle: !0, children: [
|
|
83
|
+
/* @__PURE__ */ d(h, { name: "id" }),
|
|
84
|
+
/* @__PURE__ */ d(h, {})
|
|
85
85
|
] })
|
|
86
|
-
] }) : i ? /* @__PURE__ */
|
|
86
|
+
] }) : i ? /* @__PURE__ */ d(j, { gutter: [8, 8], children: y }) : y });
|
|
87
87
|
}
|
|
88
88
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
x as CrudForm,
|
|
90
|
+
v as CrudFormFields
|
|
91
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),g=require("@ant-design/icons"),u=require("antd"),F=require("react"),k=require("react-i18next"),S=require("../../locale/hooks/translation-constants.cjs"),y=require("./CrudForm.cjs"),C=require("../common/button/Button.cjs"),T=require("../common/wizard/WizardViewForm.cjs");function v({fields:l,className:m,onDeleteFile:h,onUploadFile:i,purpose:c,wizard:r=[],updatingValue:f,onSave:x,submitting:j}){const d=F.useMemo(()=>r.map(n=>{let t=!0;const o=l.filter(s=>n.fields.includes(s.name));return o.forEach(s=>t&&(t=s.hidden??!1)),{...n,hidden:t,fieldThatShouldShowing:o}}),[l,r]),a=F.useMemo(()=>d.filter(n=>!n.hidden),[d]);return e.jsx(e.Fragment,{children:e.jsx(T,{onSubmit:(n,t)=>{console.log(t),x(t)},className:m,pages:a.map(({title:n,icon:t,fieldThatShouldShowing:o,hidden:s},b)=>({title:n,icon:t,hidden:s,component:q=>e.jsx(R,{fields:o,onDeleteFile:h,onUploadFile:i,purpose:c,i:b,updatingValue:f,backward:q.backward,forward:q.forward,wizard:a,submitting:j},b)}))})})}function R({fields:l,onDeleteFile:m,onUploadFile:h,purpose:i,wizard:c=[],i:r,forward:f,backward:x,submitting:j,updatingValue:d}){const a=c[r],{t:n}=k.useTranslation(S.TRANSLATION_NAMESPACE),[t]=u.Form.useForm();return F.useEffect(()=>{if(d&&(i==="update"||i==="clone")){const o={};for(const s of l)o[s.name]=d[s.name];t.setFieldsValue(o)}},[l,t,i,d]),e.jsxs(u.Form,{name:String(r),form:t,layout:"vertical",children:[e.jsx(y.CrudFormFields,{fields:l,formBuilder:a.formBuilder,grid:a.grid,onDeleteFile:m,onUploadFile:h,purpose:i}),e.jsx(u.Divider,{}),e.jsxs(u.Row,{gutter:[8,8],children:[r>0&&e.jsx(u.Col,{md:12,children:e.jsx(C,{block:!0,icon:e.jsx(g.LeftOutlined,{}),htmlType:"button",type:"default",size:"large",onClick:()=>x(),children:n("str.back")})}),e.jsx(u.Col,{md:r>0?12:24,children:e.jsx(C,{block:!0,icon:c.length-1===r?e.jsx(g.SaveOutlined,{}):e.jsx(g.RightOutlined,{}),htmlType:"submit",type:"primary",loading:j,size:"large",onClick:()=>{t.validateFields().then(o=>{f(o,c.length-1===r,c.length-1===r)})},children:c.length-1===r?n("str."+(i==="update"?"update":"save")):n("str.next")})})]})]})}module.exports=v;
|
|
@@ -1,111 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onUploadFile: i,
|
|
17
|
-
purpose: s,
|
|
1
|
+
import { jsx as t, Fragment as T, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { LeftOutlined as v, SaveOutlined as w, RightOutlined as x } from "@ant-design/icons";
|
|
3
|
+
import { Form as k, Divider as A, Row as E, Col as S } from "antd";
|
|
4
|
+
import { useMemo as y, useEffect as O } from "react";
|
|
5
|
+
import { useTranslation as W } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as j } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { CrudFormFields as z } from "./CrudForm.js";
|
|
8
|
+
import C from "../common/button/Button.js";
|
|
9
|
+
import B from "../common/wizard/WizardViewForm.js";
|
|
10
|
+
function H({
|
|
11
|
+
fields: d,
|
|
12
|
+
className: f,
|
|
13
|
+
onDeleteFile: u,
|
|
14
|
+
onUploadFile: l,
|
|
15
|
+
purpose: m,
|
|
18
16
|
wizard: e = [],
|
|
19
|
-
updatingValue:
|
|
17
|
+
updatingValue: s,
|
|
20
18
|
onSave: h,
|
|
21
|
-
submitting:
|
|
19
|
+
submitting: g
|
|
22
20
|
}) {
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
const n =
|
|
26
|
-
(
|
|
21
|
+
const a = y(() => e.map((o) => {
|
|
22
|
+
let r = !0;
|
|
23
|
+
const n = d.filter(
|
|
24
|
+
(i) => o.fields.includes(i.name)
|
|
27
25
|
);
|
|
28
|
-
return n.forEach((
|
|
26
|
+
return n.forEach((i) => r && (r = i.hidden ?? !1)), {
|
|
29
27
|
...o,
|
|
30
|
-
hidden:
|
|
28
|
+
hidden: r,
|
|
31
29
|
fieldThatShouldShowing: n
|
|
32
30
|
};
|
|
33
|
-
}), [
|
|
34
|
-
() =>
|
|
35
|
-
[
|
|
31
|
+
}), [d, e]), c = y(
|
|
32
|
+
() => a.filter((o) => !o.hidden),
|
|
33
|
+
[a]
|
|
36
34
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
35
|
+
return /* @__PURE__ */ t(T, { children: /* @__PURE__ */ t(
|
|
36
|
+
B,
|
|
39
37
|
{
|
|
40
|
-
onSubmit: (o,
|
|
41
|
-
console.log(
|
|
38
|
+
onSubmit: (o, r) => {
|
|
39
|
+
console.log(r), h(r);
|
|
42
40
|
},
|
|
43
|
-
className:
|
|
41
|
+
className: f,
|
|
44
42
|
pages: c.map(
|
|
45
|
-
({ title: o, icon:
|
|
43
|
+
({ title: o, icon: r, fieldThatShouldShowing: n, hidden: i }, p) => ({
|
|
46
44
|
title: o,
|
|
47
|
-
icon:
|
|
48
|
-
hidden:
|
|
49
|
-
component: (
|
|
50
|
-
|
|
45
|
+
icon: r,
|
|
46
|
+
hidden: i,
|
|
47
|
+
component: (b) => /* @__PURE__ */ t(
|
|
48
|
+
N,
|
|
51
49
|
{
|
|
52
50
|
fields: n,
|
|
53
|
-
onDeleteFile:
|
|
54
|
-
onUploadFile:
|
|
55
|
-
purpose:
|
|
56
|
-
i:
|
|
57
|
-
updatingValue:
|
|
58
|
-
backward:
|
|
59
|
-
forward:
|
|
51
|
+
onDeleteFile: u,
|
|
52
|
+
onUploadFile: l,
|
|
53
|
+
purpose: m,
|
|
54
|
+
i: p,
|
|
55
|
+
updatingValue: s,
|
|
56
|
+
backward: b.backward,
|
|
57
|
+
forward: b.forward,
|
|
60
58
|
wizard: c,
|
|
61
|
-
submitting:
|
|
59
|
+
submitting: g
|
|
62
60
|
},
|
|
63
|
-
|
|
61
|
+
p
|
|
64
62
|
)
|
|
65
63
|
})
|
|
66
64
|
)
|
|
67
65
|
}
|
|
68
66
|
) });
|
|
69
67
|
}
|
|
70
|
-
function
|
|
71
|
-
fields:
|
|
72
|
-
onDeleteFile:
|
|
73
|
-
onUploadFile:
|
|
74
|
-
purpose:
|
|
75
|
-
wizard:
|
|
68
|
+
function N({
|
|
69
|
+
fields: d,
|
|
70
|
+
onDeleteFile: f,
|
|
71
|
+
onUploadFile: u,
|
|
72
|
+
purpose: l,
|
|
73
|
+
wizard: m = [],
|
|
76
74
|
i: e,
|
|
77
|
-
forward:
|
|
75
|
+
forward: s,
|
|
78
76
|
backward: h,
|
|
79
|
-
submitting:
|
|
80
|
-
updatingValue:
|
|
77
|
+
submitting: g,
|
|
78
|
+
updatingValue: a
|
|
81
79
|
}) {
|
|
82
|
-
const c =
|
|
83
|
-
return
|
|
84
|
-
if (
|
|
80
|
+
const c = m[e], { t: o } = W(j), [r] = k.useForm();
|
|
81
|
+
return O(() => {
|
|
82
|
+
if (a && (l === "update" || l === "clone")) {
|
|
85
83
|
const n = {};
|
|
86
|
-
for (const
|
|
87
|
-
n[
|
|
88
|
-
|
|
84
|
+
for (const i of d)
|
|
85
|
+
n[i.name] = a[i.name];
|
|
86
|
+
r.setFieldsValue(n);
|
|
89
87
|
}
|
|
90
|
-
}, [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
88
|
+
}, [d, r, l, a]), /* @__PURE__ */ F(k, { name: String(e), form: r, layout: "vertical", children: [
|
|
89
|
+
/* @__PURE__ */ t(
|
|
90
|
+
z,
|
|
93
91
|
{
|
|
94
|
-
fields:
|
|
92
|
+
fields: d,
|
|
95
93
|
formBuilder: c.formBuilder,
|
|
96
94
|
grid: c.grid,
|
|
97
|
-
onDeleteFile:
|
|
98
|
-
onUploadFile:
|
|
99
|
-
purpose:
|
|
95
|
+
onDeleteFile: f,
|
|
96
|
+
onUploadFile: u,
|
|
97
|
+
purpose: l
|
|
100
98
|
}
|
|
101
99
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
e > 0 && /* @__PURE__ */
|
|
105
|
-
|
|
100
|
+
/* @__PURE__ */ t(A, {}),
|
|
101
|
+
/* @__PURE__ */ F(E, { gutter: [8, 8], children: [
|
|
102
|
+
e > 0 && /* @__PURE__ */ t(S, { md: 12, children: /* @__PURE__ */ t(
|
|
103
|
+
C,
|
|
106
104
|
{
|
|
107
105
|
block: !0,
|
|
108
|
-
icon: /* @__PURE__ */
|
|
106
|
+
icon: /* @__PURE__ */ t(v, {}),
|
|
109
107
|
htmlType: "button",
|
|
110
108
|
type: "default",
|
|
111
109
|
size: "large",
|
|
@@ -113,30 +111,30 @@ function W({
|
|
|
113
111
|
children: o("str.back")
|
|
114
112
|
}
|
|
115
113
|
) }),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
|
|
114
|
+
/* @__PURE__ */ t(S, { md: e > 0 ? 12 : 24, children: /* @__PURE__ */ t(
|
|
115
|
+
C,
|
|
118
116
|
{
|
|
119
117
|
block: !0,
|
|
120
|
-
icon:
|
|
118
|
+
icon: m.length - 1 === e ? /* @__PURE__ */ t(w, {}) : /* @__PURE__ */ t(x, {}),
|
|
121
119
|
htmlType: "submit",
|
|
122
120
|
type: "primary",
|
|
123
|
-
loading:
|
|
121
|
+
loading: g,
|
|
124
122
|
size: "large",
|
|
125
123
|
onClick: () => {
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
r.validateFields().then((n) => {
|
|
125
|
+
s(
|
|
128
126
|
n,
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
m.length - 1 === e,
|
|
128
|
+
m.length - 1 === e
|
|
131
129
|
);
|
|
132
130
|
});
|
|
133
131
|
},
|
|
134
|
-
children:
|
|
132
|
+
children: m.length - 1 === e ? o("str." + (l === "update" ? "update" : "save")) : o("str.next")
|
|
135
133
|
}
|
|
136
134
|
) })
|
|
137
135
|
] })
|
|
138
136
|
] });
|
|
139
137
|
}
|
|
140
138
|
export {
|
|
141
|
-
|
|
139
|
+
H as default
|
|
142
140
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
${p||!
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),J=require("@ant-design/icons"),s=require("antd"),i=require("react"),j=require("./CrudField.cjs"),K=require("./view/CrudViewer.cjs"),v=require("../common/button/Button.cjs"),M=require("../common/button/PrintButton.cjs"),Q=require("../common/report/SelectFieldInReport.cjs"),W=require("../common/select/SelectComponent.cjs"),V=require("./view/CrudViewerUtil.cjs"),A={lg:6,md:8,sm:12,xs:24},X={lg:12,md:16,sm:24,xs:24};function Y({fields:d,data:u,idField:L,loadingData:p,onSubmit:x,paginateProps:G,size:O,onClickPrint:h,onClickExcelExport:y,minusHeight:U,extraSearchFields:R,searchOnMount:B,summary:_}){const{searchable:$,selectable:c,sortable:F,defaultSort:m}=i.useMemo(()=>{var b,f,N,T,I;const e=[],t=[],o=[];let a;for(const l of d.filter(H=>!H.hidden))l.type==="image"||!l.report||((b=l.report)!=null&&b.searchable&&e.push(l),(f=l.report)!=null&&f.sortable&&(t.push(l),!a&&((N=l.report)!=null&&N.defaultSort)&&(a=l)),l.hideInTable||o.push({id:l.name,label:l.label,lock:(T=l.report)==null?void 0:T.lock,alreadySelected:(I=l.report)==null?void 0:I.alreadySelected}));return{defaultSort:a,searchable:e,sortable:t,selectable:o}},[d]),[S,w]=i.useState([]),g=i.useCallback(async({sortBy:e,sortByType:t,showFields:o=[],...a})=>{const b=[];e&&b.push({field:e,sort:t??"DESC"}),w(d.filter(f=>o.includes(f.name)).map(f=>({...f,hideInTable:!1}))),x({showFields:o,sortBy:b,...a})},[d,x]),[n]=s.Form.useForm(),[q,z]=i.useState(!1),[C,D]=i.useState(!0);return i.useEffect(()=>{if(B&&C){const e=setTimeout(()=>{n.validateFields().then(t=>{g(t)}),D(!1)},200);return()=>clearTimeout(e)}},[g,n,C,B]),i.useEffect(()=>{var t,o,a;!n.getFieldValue("sortBy")&&m&&(console.log((t=m.report)==null?void 0:t.defaultSort),n.setFieldsValue({sortBy:m.name,sortByType:typeof((o=m.report)==null?void 0:o.defaultSort)=="string"?(a=m.report)==null?void 0:a.defaultSort:"ASC"}))},[m,n]),i.useEffect(()=>{if(q){const e=c.filter(t=>t.alreadySelected).map(t=>t.id);w(d.filter(t=>e.includes(t.name)).map(t=>({...t,hideInTable:!1}))),z(!1)}},[d,q,c]),r.jsx(r.Fragment,{children:r.jsxs(s.Space,{className:"w-100",direction:"vertical",children:[r.jsxs(s.Form,{form:n,layout:"vertical",onFinish:g,children:[r.jsxs(s.Row,{gutter:[8,8],children:[$.map(e=>{var t,o,a;return r.jsx(s.Col,{...e.grid??A,style:{alignSelf:"end"},children:(t=e.report)!=null&&t.customRender?e.report.customRender(n):e.type==="date"?r.jsx(j.default,{...e,type:"date",range:(o=e.report)==null?void 0:o.range,required:!!((a=e.report)!=null&&a.required),readonly:!1,fieldClassName:"mb-0"}):e.type==="select"?r.jsx(j.default,{...e,type:"select",multiple:!0,required:!1,readonly:!1,fieldClassName:"mb-0"}):r.jsx(j.default,{...e,readonly:!1,required:!1,fieldClassName:"mb-0"})},e.name)}),!!(c!=null&&c.length)&&r.jsx(s.Col,{...X,children:r.jsx(Q.SelectFieldInReport,{items:c,name:"showFields",mode:"multiple",label:"Show Fields",className:"mb-0"})}),!!F.length&&r.jsx(s.Col,{...A,children:r.jsx(W,{label:"Sort By",name:"sortBy",items:F.map(e=>({id:e.name,label:e.label})),nameFieldInArray:"label",fieldId:"id",className:"mb-0",dropdownRender:e=>r.jsxs(r.Fragment,{children:[e,r.jsx(s.Form.Item,{name:"sortByType",noStyle:!0,className:"mt-3",children:r.jsx(s.Radio.Group,{className:"w-100",defaultValue:"DESC",optionType:"button",children:r.jsxs(s.Row,{children:[r.jsx(s.Col,{xs:12,children:r.jsx(s.Radio,{className:"w-100",style:{borderTopRightRadius:0,borderBottomRightRadius:0},value:"ASC",children:"Ascending"})}),r.jsx(s.Col,{xs:12,children:r.jsx(s.Radio,{className:"w-100",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0},value:"DESC",children:"Descending"})})]})})})]})})}),R?R(n):null]}),r.jsx(v,{className:"mt-3",type:"primary",block:!0,htmlType:"submit",disabled:p,children:"Submit"})]}),r.jsxs(s.Space,{children:[!!h&&r.jsx(M.PrintButton,{disabled:p||!u.length,onClick:()=>h==null?void 0:h({tableId:"#crud-table table",data:u,fields:S.map(e=>({...e,render:V.getRendererValueCrudViewer(e)}))})}),!!y&&r.jsx(v,{disabled:p||!u.length,onClick:()=>y==null?void 0:y({tableId:"#crud-table table",data:u,fields:S.map(e=>({...e,render:V.getRendererValueCrudViewer(e)}))}),icon:r.jsx(J.FileExcelOutlined,{}),className:`group
|
|
2
|
+
${p||!u.length?"":"!bg-green-700 hover:!bg-green-600 !text-white !border-green-700 hover:!border-green-600"}
|
|
3
3
|
|
|
4
|
-
`,children:"Excel"})]}),
|
|
4
|
+
`,children:"Excel"})]}),_,r.jsx(K,{minusHeight:U,data:u,size:O,fields:S,idField:L,loadingData:p,paginateProps:G,viewable:!1})]})})}module.exports=Y;
|