@kingteza/crud-component 1.0.6 → 1.0.9
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/FileSaver.min.cjs +1 -0
- package/dist/_virtual/FileSaver.min.js +5 -0
- package/dist/_virtual/FileSaver.min2.cjs +1 -0
- package/dist/_virtual/FileSaver.min2.js +4 -0
- package/dist/_virtual/ShowMoreText.cjs +1 -0
- package/dist/_virtual/ShowMoreText.js +7 -0
- package/dist/_virtual/ShowMoreText2.cjs +1 -0
- package/dist/_virtual/ShowMoreText2.js +4 -0
- package/dist/_virtual/Truncate.cjs +1 -0
- package/dist/_virtual/Truncate.js +4 -0
- package/dist/_virtual/_commonjsHelpers.cjs +1 -1
- package/dist/_virtual/_commonjsHelpers.js +5 -3
- package/dist/_virtual/index.cjs +1 -1
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index10.cjs +1 -0
- package/dist/_virtual/index10.js +7 -0
- package/dist/_virtual/index11.cjs +1 -0
- package/dist/_virtual/index11.js +7 -0
- package/dist/_virtual/index12.cjs +1 -0
- package/dist/_virtual/index12.js +4 -0
- package/dist/_virtual/index13.cjs +1 -0
- package/dist/_virtual/index13.js +4 -0
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +3 -5
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index3.js +5 -2
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.js +2 -2
- package/dist/_virtual/index6.cjs +1 -0
- package/dist/_virtual/index6.js +4 -0
- package/dist/_virtual/index7.cjs +1 -0
- package/dist/_virtual/index7.js +4 -0
- package/dist/_virtual/index8.cjs +1 -0
- package/dist/_virtual/index8.js +2 -0
- package/dist/_virtual/index9.cjs +1 -0
- package/dist/_virtual/index9.js +7 -0
- package/dist/_virtual/main.cjs +1 -0
- package/dist/_virtual/main.js +7 -0
- package/dist/_virtual/main2.cjs +1 -0
- package/dist/_virtual/main2.js +4 -0
- package/dist/_virtual/papaparse.min.cjs +1 -0
- package/dist/_virtual/papaparse.min.js +7 -0
- package/dist/_virtual/papaparse.min2.cjs +1 -0
- package/dist/_virtual/papaparse.min2.js +4 -0
- package/dist/_virtual/react-is.development2.cjs +1 -0
- package/dist/_virtual/react-is.development2.js +4 -0
- package/dist/_virtual/react-is.production.min2.cjs +1 -0
- package/dist/_virtual/react-is.production.min2.js +4 -0
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +23 -22
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +14 -13
- package/dist/src/components/common/button/Button.cjs +1 -1
- package/dist/src/components/common/button/Button.js +32 -31
- 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 +22 -22
- package/dist/src/components/common/button/ExportButton.cjs +1 -1
- package/dist/src/components/common/button/ExportButton.js +13 -13
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/src/components/common/button/HideButtonTable.js +20 -20
- 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 +15 -15
- 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 +31 -31
- 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 +11 -11
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/src/components/common/check-box/CheckBox.js +17 -15
- package/dist/src/components/common/description/DescList.cjs +1 -1
- package/dist/src/components/common/description/DescList.js +1 -1
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/src/components/common/layout/VerticalSpace.js +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +11 -10
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/src/components/common/picker/ImagePicker.js +95 -90
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/src/components/common/radio/RadioGroupComponent.js +17 -16
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/src/components/common/report/SelectFieldInReport.js +17 -16
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/src/components/common/select/CustomSelectOption.js +1 -1
- package/dist/src/components/common/select/SelectComponent.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.js +36 -33
- 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 +10 -10
- package/dist/src/components/common/table/table.cjs +1 -1
- package/dist/src/components/common/table/table.js +16 -16
- package/dist/src/components/common/tag/StatusTag.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.js +4 -4
- package/dist/src/components/common/text/index.cjs +1 -1
- package/dist/src/components/common/text/index.js +1 -1
- package/dist/src/components/common/text/title/index.cjs +1 -1
- package/dist/src/components/common/text/title/index.js +1 -1
- package/dist/src/components/common/text-field/NumberField.cjs +1 -1
- package/dist/src/components/common/text-field/NumberField.js +20 -19
- package/dist/src/components/common/text-field/TextArea.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.js +19 -18
- package/dist/src/components/common/text-field/TextField.cjs +1 -1
- package/dist/src/components/common/text-field/TextField.js +37 -36
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/src/components/common/tooltip/TooltipComponent.js +1 -1
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.js +37 -36
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/src/components/common/wizard/WizardViewForm.js +1 -1
- package/dist/src/components/crud/CrudComponent.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.js +74 -71
- package/dist/src/components/crud/CrudField.cjs +1 -1
- package/dist/src/components/crud/CrudField.js +111 -108
- package/dist/src/components/crud/CrudForm.cjs +1 -1
- package/dist/src/components/crud/CrudForm.js +36 -33
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/src/components/crud/CrudFormWizard.js +78 -73
- package/dist/src/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/src/components/crud/CrudReportComponent.js +75 -71
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/src/components/crud/CrudSearchComponent.js +17 -15
- package/dist/src/components/crud/FileCrudField.cjs +1 -1
- package/dist/src/components/crud/FileCrudField.js +103 -94
- package/dist/src/components/crud/ImageCrudField.cjs +1 -1
- package/dist/src/components/crud/ImageCrudField.js +58 -55
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/src/components/crud/import/CrudImportButton.js +10 -10
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +111 -106
- package/dist/src/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewer.js +30 -30
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +35 -33
- package/dist/src/util/ImageUtil.cjs +1 -1
- package/dist/src/util/ImageUtil.js +1 -1
- package/package.json +7 -9
|
@@ -1,61 +1,66 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useMemo as g, useEffect as y } from "react";
|
|
3
|
+
import { useTranslation as C } from "react-i18next";
|
|
4
|
+
import { TRANSLATION_NAMESPACE as S } from "../../locale/hooks/translation-constants.js";
|
|
5
|
+
import { CrudFormFields as R } from "./CrudForm.js";
|
|
6
|
+
import b from "../common/button/Button.js";
|
|
7
|
+
import T from "../common/wizard/WizardViewForm.js";
|
|
8
|
+
import F from "../../../node_modules/antd/es/form/index.js";
|
|
9
|
+
import E from "../../../node_modules/antd/es/divider/index.js";
|
|
10
|
+
import k from "../../../node_modules/antd/es/grid/col.js";
|
|
11
|
+
import v from "../../../node_modules/antd/es/grid/row.js";
|
|
12
|
+
import w from "../../../node_modules/@ant-design/icons/es/icons/LeftOutlined.js";
|
|
13
|
+
import A from "../../../node_modules/@ant-design/icons/es/icons/SaveOutlined.js";
|
|
14
|
+
import I from "../../../node_modules/@ant-design/icons/es/icons/RightOutlined.js";
|
|
15
|
+
function K({
|
|
16
|
+
fields: l,
|
|
12
17
|
className: c,
|
|
13
|
-
onDeleteFile:
|
|
14
|
-
onUploadFile:
|
|
15
|
-
purpose:
|
|
16
|
-
wizard:
|
|
18
|
+
onDeleteFile: a,
|
|
19
|
+
onUploadFile: i,
|
|
20
|
+
purpose: s,
|
|
21
|
+
wizard: t = [],
|
|
17
22
|
updatingValue: u,
|
|
18
23
|
onSave: h,
|
|
19
24
|
submitting: x
|
|
20
25
|
}) {
|
|
21
|
-
const d =
|
|
22
|
-
let
|
|
23
|
-
const n =
|
|
24
|
-
(
|
|
26
|
+
const d = g(() => t.map((e) => {
|
|
27
|
+
let o = !0;
|
|
28
|
+
const n = l.filter(
|
|
29
|
+
(m) => e.fields.includes(m.name)
|
|
25
30
|
);
|
|
26
|
-
return n.forEach((
|
|
27
|
-
...
|
|
28
|
-
hidden:
|
|
31
|
+
return n.forEach((m) => o && (o = m.hidden ?? !1)), {
|
|
32
|
+
...e,
|
|
33
|
+
hidden: o,
|
|
29
34
|
fieldThatShouldShowing: n
|
|
30
35
|
};
|
|
31
|
-
}), [
|
|
32
|
-
() => d.filter((
|
|
36
|
+
}), [l, t]), f = g(
|
|
37
|
+
() => d.filter((e) => !e.hidden),
|
|
33
38
|
[d]
|
|
34
39
|
);
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
40
|
+
return /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsx(
|
|
41
|
+
T,
|
|
37
42
|
{
|
|
38
|
-
onSubmit: (
|
|
39
|
-
console.log(
|
|
43
|
+
onSubmit: (e, o) => {
|
|
44
|
+
console.log(o), h(o);
|
|
40
45
|
},
|
|
41
46
|
className: c,
|
|
42
|
-
pages:
|
|
43
|
-
({ title:
|
|
44
|
-
title:
|
|
45
|
-
icon:
|
|
46
|
-
hidden:
|
|
47
|
-
component: (
|
|
47
|
+
pages: f.map(
|
|
48
|
+
({ title: e, icon: o, fieldThatShouldShowing: n, hidden: m }, j) => ({
|
|
49
|
+
title: e,
|
|
50
|
+
icon: o,
|
|
51
|
+
hidden: m,
|
|
52
|
+
component: (p) => /* @__PURE__ */ r.jsx(
|
|
48
53
|
W,
|
|
49
54
|
{
|
|
50
55
|
fields: n,
|
|
51
|
-
onDeleteFile:
|
|
52
|
-
onUploadFile:
|
|
53
|
-
purpose:
|
|
56
|
+
onDeleteFile: a,
|
|
57
|
+
onUploadFile: i,
|
|
58
|
+
purpose: s,
|
|
54
59
|
i: j,
|
|
55
60
|
updatingValue: u,
|
|
56
|
-
backward:
|
|
57
|
-
forward:
|
|
58
|
-
wizard:
|
|
61
|
+
backward: p.backward,
|
|
62
|
+
forward: p.forward,
|
|
63
|
+
wizard: f,
|
|
59
64
|
submitting: x
|
|
60
65
|
},
|
|
61
66
|
j
|
|
@@ -66,75 +71,75 @@ function q({
|
|
|
66
71
|
) });
|
|
67
72
|
}
|
|
68
73
|
function W({
|
|
69
|
-
fields:
|
|
74
|
+
fields: l,
|
|
70
75
|
onDeleteFile: c,
|
|
71
|
-
onUploadFile:
|
|
72
|
-
purpose:
|
|
73
|
-
wizard:
|
|
74
|
-
i:
|
|
76
|
+
onUploadFile: a,
|
|
77
|
+
purpose: i,
|
|
78
|
+
wizard: s = [],
|
|
79
|
+
i: t,
|
|
75
80
|
forward: u,
|
|
76
81
|
backward: h,
|
|
77
82
|
submitting: x,
|
|
78
83
|
updatingValue: d
|
|
79
84
|
}) {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
if (d && (
|
|
85
|
+
const f = s[t], { t: e } = C(S), [o] = F.useForm();
|
|
86
|
+
return y(() => {
|
|
87
|
+
if (d && (i === "update" || i === "clone")) {
|
|
83
88
|
const n = {};
|
|
84
|
-
for (const
|
|
85
|
-
n[
|
|
86
|
-
|
|
89
|
+
for (const m of l)
|
|
90
|
+
n[m.name] = d[m.name];
|
|
91
|
+
o.setFieldsValue(n);
|
|
87
92
|
}
|
|
88
|
-
}, [
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
93
|
+
}, [l, o, i, d]), /* @__PURE__ */ r.jsxs(F, { name: String(t), form: o, layout: "vertical", children: [
|
|
94
|
+
/* @__PURE__ */ r.jsx(
|
|
95
|
+
R,
|
|
91
96
|
{
|
|
92
|
-
fields:
|
|
93
|
-
formBuilder:
|
|
94
|
-
grid:
|
|
97
|
+
fields: l,
|
|
98
|
+
formBuilder: f.formBuilder,
|
|
99
|
+
grid: f.grid,
|
|
95
100
|
onDeleteFile: c,
|
|
96
|
-
onUploadFile:
|
|
97
|
-
purpose:
|
|
101
|
+
onUploadFile: a,
|
|
102
|
+
purpose: i
|
|
98
103
|
}
|
|
99
104
|
),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
/* @__PURE__ */ r.jsx(E, {}),
|
|
106
|
+
/* @__PURE__ */ r.jsxs(v, { gutter: [8, 8], children: [
|
|
107
|
+
t > 0 && /* @__PURE__ */ r.jsx(k, { md: 12, children: /* @__PURE__ */ r.jsx(
|
|
108
|
+
b,
|
|
104
109
|
{
|
|
105
110
|
block: !0,
|
|
106
|
-
icon: /* @__PURE__ */
|
|
111
|
+
icon: /* @__PURE__ */ r.jsx(w, {}),
|
|
107
112
|
htmlType: "button",
|
|
108
113
|
type: "default",
|
|
109
114
|
size: "large",
|
|
110
115
|
onClick: () => h(),
|
|
111
|
-
children:
|
|
116
|
+
children: e("str.back")
|
|
112
117
|
}
|
|
113
118
|
) }),
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
|
|
119
|
+
/* @__PURE__ */ r.jsx(k, { md: t > 0 ? 12 : 24, children: /* @__PURE__ */ r.jsx(
|
|
120
|
+
b,
|
|
116
121
|
{
|
|
117
122
|
block: !0,
|
|
118
|
-
icon:
|
|
123
|
+
icon: s.length - 1 === t ? /* @__PURE__ */ r.jsx(A, {}) : /* @__PURE__ */ r.jsx(I, {}),
|
|
119
124
|
htmlType: "submit",
|
|
120
125
|
type: "primary",
|
|
121
126
|
loading: x,
|
|
122
127
|
size: "large",
|
|
123
128
|
onClick: () => {
|
|
124
|
-
|
|
129
|
+
o.validateFields().then((n) => {
|
|
125
130
|
u(
|
|
126
131
|
n,
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
s.length - 1 === t,
|
|
133
|
+
s.length - 1 === t
|
|
129
134
|
);
|
|
130
135
|
});
|
|
131
136
|
},
|
|
132
|
-
children:
|
|
137
|
+
children: s.length - 1 === t ? e("str." + (i === "update" ? "update" : "save")) : e("str.next")
|
|
133
138
|
}
|
|
134
139
|
) })
|
|
135
140
|
] })
|
|
136
141
|
] });
|
|
137
142
|
}
|
|
138
143
|
export {
|
|
139
|
-
|
|
144
|
+
K as default
|
|
140
145
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),
|
|
2
|
-
${x||!
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),u=require("react"),y=require("./CrudField.cjs"),Q=require("./view/CrudViewer.cjs"),V=require("../common/button/Button.cjs"),W=require("../common/button/PrintButton.cjs"),X=require("../common/report/SelectFieldInReport.cjs"),Y=require("../common/select/SelectComponent.cjs"),A=require("./view/CrudViewerUtil.cjs"),g=require("../../../node_modules/antd/es/form/index.cjs"),_=require("../../../node_modules/antd/es/space/index.cjs"),f=require("../../../node_modules/antd/es/grid/col.cjs"),$=require("../../../node_modules/antd/es/grid/row.cjs"),S=require("../../../node_modules/antd/es/radio/index.cjs"),Z=require("../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.cjs"),L={lg:6,md:8,sm:12,xs:24},P={lg:12,md:16,sm:24,xs:24};function k({fields:a,data:i,idField:M,loadingData:x,onSubmit:E,paginateProps:O,size:G,onClickPrint:j,onClickExcelExport:b,minusHeight:U,extraSearchFields:q,searchOnMount:B,summary:z}){const{searchable:D,selectable:d,sortable:w,defaultSort:m}=u.useMemo(()=>{var p,c,v,I,C;const e=[],s=[],l=[];let o;for(const r of a.filter(K=>!K.hidden))r.type==="image"||!r.report||((p=r.report)!=null&&p.searchable&&e.push(r),(c=r.report)!=null&&c.sortable&&(s.push(r),!o&&((v=r.report)!=null&&v.defaultSort)&&(o=r)),r.hideInTable||l.push({id:r.name,label:r.label,lock:(I=r.report)==null?void 0:I.lock,alreadySelected:(C=r.report)==null?void 0:C.alreadySelected}));return{defaultSort:o,searchable:e,sortable:s,selectable:l}},[a]),[h,F]=u.useState([]),R=u.useCallback(async({sortBy:e,sortByType:s,showFields:l=[],...o})=>{const p=[];e&&p.push({field:e,sort:s??"DESC"}),F(a.filter(c=>l.includes(c.name)).map(c=>({...c,hideInTable:!1}))),E({showFields:l,sortBy:p,...o})},[a,E]),[n]=g.default.useForm(),[N,H]=u.useState(!1),[T,J]=u.useState(!0);return u.useEffect(()=>{if(B&&T){const e=setTimeout(()=>{n.validateFields().then(s=>{R(s)}),J(!1)},200);return()=>clearTimeout(e)}},[R,n,T,B]),u.useEffect(()=>{var s,l,o;!n.getFieldValue("sortBy")&&m&&(console.log((s=m.report)==null?void 0:s.defaultSort),n.setFieldsValue({sortBy:m.name,sortByType:typeof((l=m.report)==null?void 0:l.defaultSort)=="string"?(o=m.report)==null?void 0:o.defaultSort:"ASC"}))},[m,n]),u.useEffect(()=>{if(N){const e=d.filter(s=>s.alreadySelected).map(s=>s.id);F(a.filter(s=>e.includes(s.name)).map(s=>({...s,hideInTable:!1}))),H(!1)}},[a,N,d]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(_.default,{className:"w-100",direction:"vertical",children:[t.jsxRuntimeExports.jsxs(g.default,{form:n,layout:"vertical",onFinish:R,children:[t.jsxRuntimeExports.jsxs($.default,{gutter:[8,8],children:[D.map(e=>{var s,l,o;return t.jsxRuntimeExports.jsx(f.default,{...e.grid??L,style:{alignSelf:"end"},children:(s=e.report)!=null&&s.customRender?e.report.customRender(n):e.type==="date"?t.jsxRuntimeExports.jsx(y.default,{...e,type:"date",range:(l=e.report)==null?void 0:l.range,required:!!((o=e.report)!=null&&o.required),readonly:!1,fieldClassName:"mb-0"}):e.type==="select"?t.jsxRuntimeExports.jsx(y.default,{...e,type:"select",multiple:!0,required:!1,readonly:!1,fieldClassName:"mb-0"}):t.jsxRuntimeExports.jsx(y.default,{...e,readonly:!1,required:!1,fieldClassName:"mb-0"})},e.name)}),!!(d!=null&&d.length)&&t.jsxRuntimeExports.jsx(f.default,{...P,children:t.jsxRuntimeExports.jsx(X.SelectFieldInReport,{items:d,name:"showFields",mode:"multiple",label:"Show Fields",className:"mb-0"})}),!!w.length&&t.jsxRuntimeExports.jsx(f.default,{...L,children:t.jsxRuntimeExports.jsx(Y.default,{label:"Sort By",name:"sortBy",items:w.map(e=>({id:e.name,label:e.label})),nameFieldInArray:"label",fieldId:"id",className:"mb-0",dropdownRender:e=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[e,t.jsxRuntimeExports.jsx(g.default.Item,{name:"sortByType",noStyle:!0,className:"mt-3",children:t.jsxRuntimeExports.jsx(S.default.Group,{className:"w-100",defaultValue:"DESC",optionType:"button",children:t.jsxRuntimeExports.jsxs($.default,{children:[t.jsxRuntimeExports.jsx(f.default,{xs:12,children:t.jsxRuntimeExports.jsx(S.default,{className:"w-100",style:{borderTopRightRadius:0,borderBottomRightRadius:0},value:"ASC",children:"Ascending"})}),t.jsxRuntimeExports.jsx(f.default,{xs:12,children:t.jsxRuntimeExports.jsx(S.default,{className:"w-100",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0},value:"DESC",children:"Descending"})})]})})})]})})}),q?q(n):null]}),t.jsxRuntimeExports.jsx(V.default,{className:"mt-3",type:"primary",block:!0,htmlType:"submit",disabled:x,children:"Submit"})]}),t.jsxRuntimeExports.jsxs(_.default,{children:[!!j&&t.jsxRuntimeExports.jsx(W.PrintButton,{disabled:x||!i.length,onClick:()=>j==null?void 0:j({tableId:"#crud-table table",data:i,fields:h.map(e=>({...e,render:A.getRendererValueCrudViewer(e)}))})}),!!b&&t.jsxRuntimeExports.jsx(V.default,{disabled:x||!i.length,onClick:()=>b==null?void 0:b({tableId:"#crud-table table",data:i,fields:h.map(e=>({...e,render:A.getRendererValueCrudViewer(e)}))}),icon:t.jsxRuntimeExports.jsx(Z.default,{}),className:`group
|
|
2
|
+
${x||!i.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"})]}),z,t.jsxRuntimeExports.jsx(Q.default,{minusHeight:U,data:i,size:G,fields:h,idField:M,loadingData:x,paginateProps:O,viewable:!1})]})})}exports.default=k;
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import E from "./view/CrudViewer.js";
|
|
7
|
-
import O from "../common/button/Button.js";
|
|
2
|
+
import { useMemo as X, useState as j, useCallback as Y, useEffect as S } from "react";
|
|
3
|
+
import x from "./CrudField.js";
|
|
4
|
+
import Z from "./view/CrudViewer.js";
|
|
5
|
+
import L from "../common/button/Button.js";
|
|
8
6
|
import { PrintButton as k } from "../common/button/PrintButton.js";
|
|
9
|
-
import { SelectFieldInReport as
|
|
10
|
-
import
|
|
11
|
-
import { getRendererValueCrudViewer as
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { SelectFieldInReport as E } from "../common/report/SelectFieldInReport.js";
|
|
8
|
+
import P from "../common/select/SelectComponent.js";
|
|
9
|
+
import { getRendererValueCrudViewer as G } from "./view/CrudViewerUtil.js";
|
|
10
|
+
import B from "../../../node_modules/antd/es/form/index.js";
|
|
11
|
+
import _ from "../../../node_modules/antd/es/space/index.js";
|
|
12
|
+
import f from "../../../node_modules/antd/es/grid/col.js";
|
|
13
|
+
import $ from "../../../node_modules/antd/es/grid/row.js";
|
|
14
|
+
import R from "../../../node_modules/antd/es/radio/index.js";
|
|
15
|
+
import ee from "../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.js";
|
|
16
|
+
const z = { lg: 6, md: 8, sm: 12, xs: 24 }, re = { lg: 12, md: 16, sm: 24, xs: 24 };
|
|
17
|
+
function ye({
|
|
14
18
|
fields: n,
|
|
15
19
|
data: i,
|
|
16
|
-
idField:
|
|
17
|
-
loadingData:
|
|
18
|
-
onSubmit:
|
|
19
|
-
paginateProps:
|
|
20
|
-
size:
|
|
20
|
+
idField: D,
|
|
21
|
+
loadingData: p,
|
|
22
|
+
onSubmit: w,
|
|
23
|
+
paginateProps: H,
|
|
24
|
+
size: J,
|
|
21
25
|
onClickPrint: b,
|
|
22
26
|
onClickExcelExport: h,
|
|
23
|
-
minusHeight:
|
|
24
|
-
extraSearchFields:
|
|
27
|
+
minusHeight: K,
|
|
28
|
+
extraSearchFields: F,
|
|
25
29
|
searchOnMount: N,
|
|
26
|
-
summary:
|
|
30
|
+
summary: M
|
|
27
31
|
}) {
|
|
28
|
-
const { searchable:
|
|
29
|
-
var
|
|
32
|
+
const { searchable: O, selectable: d, sortable: T, defaultSort: m } = X(() => {
|
|
33
|
+
var c, u, V, q, A;
|
|
30
34
|
const e = [], t = [], l = [];
|
|
31
35
|
let o;
|
|
32
36
|
for (const s of n.filter((W) => !W.hidden))
|
|
33
|
-
s.type === "image" || !s.report || ((
|
|
37
|
+
s.type === "image" || !s.report || ((c = s.report) != null && c.searchable && e.push(s), (u = s.report) != null && u.sortable && (t.push(s), !o && ((V = s.report) != null && V.defaultSort) && (o = s)), s.hideInTable || l.push({
|
|
34
38
|
id: s.name,
|
|
35
39
|
label: s.label,
|
|
36
40
|
lock: (q = s.report) == null ? void 0 : q.lock,
|
|
@@ -42,27 +46,27 @@ function pe({
|
|
|
42
46
|
sortable: t,
|
|
43
47
|
selectable: l
|
|
44
48
|
};
|
|
45
|
-
}, [n]), [y,
|
|
49
|
+
}, [n]), [y, I] = j(
|
|
46
50
|
[]
|
|
47
|
-
), g =
|
|
51
|
+
), g = Y(
|
|
48
52
|
async ({
|
|
49
53
|
sortBy: e,
|
|
50
54
|
sortByType: t,
|
|
51
55
|
showFields: l = [],
|
|
52
56
|
...o
|
|
53
57
|
}) => {
|
|
54
|
-
const
|
|
55
|
-
e &&
|
|
58
|
+
const c = [];
|
|
59
|
+
e && c.push({
|
|
56
60
|
field: e,
|
|
57
61
|
sort: t ?? "DESC"
|
|
58
|
-
}),
|
|
62
|
+
}), I(
|
|
59
63
|
n.filter((u) => l.includes(u.name)).map((u) => ({ ...u, hideInTable: !1 }))
|
|
60
|
-
),
|
|
64
|
+
), w({ showFields: l, sortBy: c, ...o });
|
|
61
65
|
},
|
|
62
|
-
[n,
|
|
63
|
-
), [a] =
|
|
64
|
-
return
|
|
65
|
-
if (N &&
|
|
66
|
+
[n, w]
|
|
67
|
+
), [a] = B.useForm(), [v, Q] = j(!1), [C, U] = j(!0);
|
|
68
|
+
return S(() => {
|
|
69
|
+
if (N && C) {
|
|
66
70
|
const e = setTimeout(() => {
|
|
67
71
|
a.validateFields().then((t) => {
|
|
68
72
|
g(t);
|
|
@@ -70,31 +74,31 @@ function pe({
|
|
|
70
74
|
}, 200);
|
|
71
75
|
return () => clearTimeout(e);
|
|
72
76
|
}
|
|
73
|
-
}, [g, a,
|
|
77
|
+
}, [g, a, C, N]), S(() => {
|
|
74
78
|
var t, l, o;
|
|
75
79
|
!a.getFieldValue("sortBy") && m && (console.log((t = m.report) == null ? void 0 : t.defaultSort), a.setFieldsValue({
|
|
76
80
|
sortBy: m.name,
|
|
77
81
|
sortByType: typeof ((l = m.report) == null ? void 0 : l.defaultSort) == "string" ? (o = m.report) == null ? void 0 : o.defaultSort : "ASC"
|
|
78
82
|
}));
|
|
79
|
-
}, [m, a]),
|
|
80
|
-
if (
|
|
83
|
+
}, [m, a]), S(() => {
|
|
84
|
+
if (v) {
|
|
81
85
|
const e = d.filter((t) => t.alreadySelected).map((t) => t.id);
|
|
82
|
-
|
|
86
|
+
I(
|
|
83
87
|
n.filter((t) => e.includes(t.name)).map((t) => ({ ...t, hideInTable: !1 }))
|
|
84
88
|
), Q(!1);
|
|
85
89
|
}
|
|
86
|
-
}, [n,
|
|
87
|
-
/* @__PURE__ */ r.jsxs(
|
|
88
|
-
/* @__PURE__ */ r.jsxs(
|
|
89
|
-
|
|
90
|
+
}, [n, v, d]), /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsxs(_, { className: "w-100", direction: "vertical", children: [
|
|
91
|
+
/* @__PURE__ */ r.jsxs(B, { form: a, layout: "vertical", onFinish: g, children: [
|
|
92
|
+
/* @__PURE__ */ r.jsxs($, { gutter: [8, 8], children: [
|
|
93
|
+
O.map((e) => {
|
|
90
94
|
var t, l, o;
|
|
91
95
|
return /* @__PURE__ */ r.jsx(
|
|
92
96
|
f,
|
|
93
97
|
{
|
|
94
|
-
...e.grid ??
|
|
98
|
+
...e.grid ?? z,
|
|
95
99
|
style: { alignSelf: "end" },
|
|
96
100
|
children: (t = e.report) != null && t.customRender ? e.report.customRender(a) : e.type === "date" ? /* @__PURE__ */ r.jsx(
|
|
97
|
-
|
|
101
|
+
x,
|
|
98
102
|
{
|
|
99
103
|
...e,
|
|
100
104
|
type: "date",
|
|
@@ -104,7 +108,7 @@ function pe({
|
|
|
104
108
|
fieldClassName: "mb-0"
|
|
105
109
|
}
|
|
106
110
|
) : e.type === "select" ? /* @__PURE__ */ r.jsx(
|
|
107
|
-
|
|
111
|
+
x,
|
|
108
112
|
{
|
|
109
113
|
...e,
|
|
110
114
|
type: "select",
|
|
@@ -114,7 +118,7 @@ function pe({
|
|
|
114
118
|
fieldClassName: "mb-0"
|
|
115
119
|
}
|
|
116
120
|
) : /* @__PURE__ */ r.jsx(
|
|
117
|
-
|
|
121
|
+
x,
|
|
118
122
|
{
|
|
119
123
|
...e,
|
|
120
124
|
readonly: !1,
|
|
@@ -127,7 +131,7 @@ function pe({
|
|
|
127
131
|
);
|
|
128
132
|
}),
|
|
129
133
|
!!(d != null && d.length) && /* @__PURE__ */ r.jsx(f, { ...re, children: /* @__PURE__ */ r.jsx(
|
|
130
|
-
|
|
134
|
+
E,
|
|
131
135
|
{
|
|
132
136
|
items: d,
|
|
133
137
|
name: "showFields",
|
|
@@ -136,8 +140,8 @@ function pe({
|
|
|
136
140
|
className: "mb-0"
|
|
137
141
|
}
|
|
138
142
|
) }),
|
|
139
|
-
!!T.length && /* @__PURE__ */ r.jsx(f, {
|
|
140
|
-
|
|
143
|
+
!!T.length && /* @__PURE__ */ r.jsx(f, { ...z, children: /* @__PURE__ */ r.jsx(
|
|
144
|
+
P,
|
|
141
145
|
{
|
|
142
146
|
label: "Sort By",
|
|
143
147
|
name: "sortBy",
|
|
@@ -147,15 +151,15 @@ function pe({
|
|
|
147
151
|
className: "mb-0",
|
|
148
152
|
dropdownRender: (e) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
149
153
|
e,
|
|
150
|
-
/* @__PURE__ */ r.jsx(
|
|
151
|
-
|
|
154
|
+
/* @__PURE__ */ r.jsx(B.Item, { name: "sortByType", noStyle: !0, className: "mt-3", children: /* @__PURE__ */ r.jsx(
|
|
155
|
+
R.Group,
|
|
152
156
|
{
|
|
153
157
|
className: "w-100",
|
|
154
158
|
defaultValue: "DESC",
|
|
155
159
|
optionType: "button",
|
|
156
|
-
children: /* @__PURE__ */ r.jsxs(
|
|
160
|
+
children: /* @__PURE__ */ r.jsxs($, { children: [
|
|
157
161
|
/* @__PURE__ */ r.jsx(f, { xs: 12, children: /* @__PURE__ */ r.jsx(
|
|
158
|
-
|
|
162
|
+
R,
|
|
159
163
|
{
|
|
160
164
|
className: "w-100",
|
|
161
165
|
style: {
|
|
@@ -167,7 +171,7 @@ function pe({
|
|
|
167
171
|
}
|
|
168
172
|
) }),
|
|
169
173
|
/* @__PURE__ */ r.jsx(f, { xs: 12, children: /* @__PURE__ */ r.jsx(
|
|
170
|
-
|
|
174
|
+
R,
|
|
171
175
|
{
|
|
172
176
|
className: "w-100",
|
|
173
177
|
style: {
|
|
@@ -184,72 +188,72 @@ function pe({
|
|
|
184
188
|
] })
|
|
185
189
|
}
|
|
186
190
|
) }),
|
|
187
|
-
|
|
191
|
+
F ? F(a) : null
|
|
188
192
|
] }),
|
|
189
193
|
/* @__PURE__ */ r.jsx(
|
|
190
|
-
|
|
194
|
+
L,
|
|
191
195
|
{
|
|
192
196
|
className: "mt-3",
|
|
193
197
|
type: "primary",
|
|
194
198
|
block: !0,
|
|
195
199
|
htmlType: "submit",
|
|
196
|
-
disabled:
|
|
200
|
+
disabled: p,
|
|
197
201
|
children: "Submit"
|
|
198
202
|
}
|
|
199
203
|
)
|
|
200
204
|
] }),
|
|
201
|
-
/* @__PURE__ */ r.jsxs(
|
|
205
|
+
/* @__PURE__ */ r.jsxs(_, { children: [
|
|
202
206
|
!!b && /* @__PURE__ */ r.jsx(
|
|
203
207
|
k,
|
|
204
208
|
{
|
|
205
|
-
disabled:
|
|
209
|
+
disabled: p || !i.length,
|
|
206
210
|
onClick: () => b == null ? void 0 : b({
|
|
207
211
|
tableId: "#crud-table table",
|
|
208
212
|
data: i,
|
|
209
213
|
fields: y.map((e) => ({
|
|
210
214
|
...e,
|
|
211
|
-
render:
|
|
215
|
+
render: G(e)
|
|
212
216
|
}))
|
|
213
217
|
})
|
|
214
218
|
}
|
|
215
219
|
),
|
|
216
220
|
!!h && /* @__PURE__ */ r.jsx(
|
|
217
|
-
|
|
221
|
+
L,
|
|
218
222
|
{
|
|
219
|
-
disabled:
|
|
223
|
+
disabled: p || !i.length,
|
|
220
224
|
onClick: () => h == null ? void 0 : h({
|
|
221
225
|
tableId: "#crud-table table",
|
|
222
226
|
data: i,
|
|
223
227
|
fields: y.map((e) => ({
|
|
224
228
|
...e,
|
|
225
|
-
render:
|
|
229
|
+
render: G(e)
|
|
226
230
|
}))
|
|
227
231
|
}),
|
|
228
|
-
icon: /* @__PURE__ */ r.jsx(
|
|
232
|
+
icon: /* @__PURE__ */ r.jsx(ee, {}),
|
|
229
233
|
className: `group
|
|
230
|
-
${
|
|
234
|
+
${p || !i.length ? "" : "!bg-green-700 hover:!bg-green-600 !text-white !border-green-700 hover:!border-green-600"}
|
|
231
235
|
|
|
232
236
|
`,
|
|
233
237
|
children: "Excel"
|
|
234
238
|
}
|
|
235
239
|
)
|
|
236
240
|
] }),
|
|
237
|
-
|
|
241
|
+
M,
|
|
238
242
|
/* @__PURE__ */ r.jsx(
|
|
239
|
-
|
|
243
|
+
Z,
|
|
240
244
|
{
|
|
241
|
-
minusHeight:
|
|
245
|
+
minusHeight: K,
|
|
242
246
|
data: i,
|
|
243
|
-
size:
|
|
247
|
+
size: J,
|
|
244
248
|
fields: y,
|
|
245
|
-
idField:
|
|
246
|
-
loadingData:
|
|
247
|
-
paginateProps:
|
|
249
|
+
idField: D,
|
|
250
|
+
loadingData: p,
|
|
251
|
+
paginateProps: H,
|
|
248
252
|
viewable: !1
|
|
249
253
|
}
|
|
250
254
|
)
|
|
251
255
|
] }) });
|
|
252
256
|
}
|
|
253
257
|
export {
|
|
254
|
-
|
|
258
|
+
ye as default
|
|
255
259
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});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"),u=require("react"),R=require("./CrudField.cjs"),q=require("../common/button/Button.cjs"),p=require("../../../node_modules/antd/es/form/index.cjs"),a=require("../../../node_modules/antd/es/grid/col.cjs"),c=require("../../../node_modules/antd/es/grid/row.cjs"),M=require("../../../node_modules/@ant-design/icons/es/icons/SearchOutlined.cjs");function v({searchFields:t=[],fields:i,searchOnChange:x,onSearch:m,searchDefaultValues:r,searchFieldsCustomColumnProps:b}){const y=u.useMemo(()=>t.map(n=>typeof n=="string"?{...i.find(E=>n===E.name),required:!1}:{...i.find(f=>(n==null?void 0:n.name)===f.name),...n}).filter(n=>n&&!(n!=null&&n.hidden)),[t,i]),d=u.useMemo(()=>t.length===1?{field:22,button:2}:t.length===2?{field:11,button:2}:t.length===3?{field:6,button:6}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),j=u.useMemo(()=>t.length===1?{field:22,button:2}:t.length===2?{field:11,button:2}:t.length===3?{field:6,button:6}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),s=u.useMemo(()=>t.length===1?{field:21,button:3}:t.length===2?{field:11,button:2}:t.length===3?{field:24,button:24}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),[o]=p.default.useForm(),g=u.useCallback(async n=>{if((n||x)&&m){const l=await o.validateFields();m(l)}},[o,m,x]);return u.useEffect(()=>{r&&(o.setFieldsValue(r),g(!0))},[o,r]),t!=null&&t.length?e.jsxRuntimeExports.jsx(p.default,{form:o,onFinish:()=>g(!0),layout:"vertical",className:"mb-2",onChange:()=>g(!1),children:e.jsxRuntimeExports.jsxs(c.default,{gutter:[4,8],className:"w-100",children:[y.map((n,l)=>{const f=(b==null?void 0:b[l])??{md:d.field,sm:j.field,xs:s.field};return u.createElement(a.default,{...f,key:`search_field_${String(n.name)}`,className:"align-self-end"},e.jsxRuntimeExports.jsx(R.default,{...n,readonly:!1,fieldClassName:"mb-0"}))}),e.jsxRuntimeExports.jsx(a.default,{md:d.button,sm:j.button,xs:s.button,style:{alignSelf:"end"},children:e.jsxRuntimeExports.jsx(q.default,{type:"primary",htmlType:"submit",block:!0,icon:e.jsxRuntimeExports.jsx(M.default,{})})})]})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})}exports.default=v;
|