@kingteza/crud-component 1.0.6 → 1.0.11
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/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/index10.cjs +1 -0
- package/dist/_virtual/index10.js +4 -0
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +2 -5
- package/dist/_virtual/index3.js +2 -2
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -4
- package/dist/_virtual/index5.js +2 -2
- package/dist/_virtual/index6.cjs +1 -0
- package/dist/_virtual/index6.js +7 -0
- package/dist/_virtual/index7.cjs +1 -0
- package/dist/_virtual/index7.js +7 -0
- package/dist/_virtual/index8.cjs +1 -0
- package/dist/_virtual/index8.js +7 -0
- package/dist/_virtual/index9.cjs +1 -0
- package/dist/_virtual/index9.js +4 -0
- package/dist/_virtual/localeData.cjs +1 -1
- 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/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 +76 -73
- 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 +10 -11
- 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 +37 -36
- 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 +65 -63
- 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 +101 -94
- 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 +95 -94
- 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 +32 -31
- 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/common/index.d.ts +0 -2
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { TRANSLATION_NAMESPACE as A } from "../../locale/hooks/translation-constants.js";
|
|
7
|
-
import { CrudFormFields as O } from "./CrudForm.js";
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { Form as g, Divider as y, Row as C, Col as b } from "antd";
|
|
3
|
+
import { useMemo as F, useEffect as S } from "react";
|
|
4
|
+
import { TRANSLATION_NAMESPACE as R } from "../../locale/hooks/translation-constants.js";
|
|
5
|
+
import { CrudFormFields as T } from "./CrudForm.js";
|
|
8
6
|
import k from "../common/button/Button.js";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import E from "../common/wizard/WizardViewForm.js";
|
|
8
|
+
import { useTranslation as v } from "../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
9
|
+
import w from "../../../node_modules/@ant-design/icons/es/icons/LeftOutlined.js";
|
|
10
|
+
import A from "../../../node_modules/@ant-design/icons/es/icons/SaveOutlined.js";
|
|
11
|
+
import I from "../../../node_modules/@ant-design/icons/es/icons/RightOutlined.js";
|
|
12
|
+
function G({
|
|
13
|
+
fields: l,
|
|
14
|
+
className: a,
|
|
13
15
|
onDeleteFile: f,
|
|
14
|
-
onUploadFile:
|
|
15
|
-
purpose:
|
|
16
|
+
onUploadFile: i,
|
|
17
|
+
purpose: s,
|
|
16
18
|
wizard: e = [],
|
|
17
19
|
updatingValue: u,
|
|
18
20
|
onSave: h,
|
|
19
21
|
submitting: x
|
|
20
22
|
}) {
|
|
21
23
|
const d = F(() => e.map((o) => {
|
|
22
|
-
let
|
|
23
|
-
const n =
|
|
24
|
-
(
|
|
24
|
+
let t = !0;
|
|
25
|
+
const n = l.filter(
|
|
26
|
+
(m) => o.fields.includes(m.name)
|
|
25
27
|
);
|
|
26
|
-
return n.forEach((
|
|
28
|
+
return n.forEach((m) => t && (t = m.hidden ?? !1)), {
|
|
27
29
|
...o,
|
|
28
|
-
hidden:
|
|
30
|
+
hidden: t,
|
|
29
31
|
fieldThatShouldShowing: n
|
|
30
32
|
};
|
|
31
|
-
}), [
|
|
33
|
+
}), [l, e]), c = F(
|
|
32
34
|
() => d.filter((o) => !o.hidden),
|
|
33
35
|
[d]
|
|
34
36
|
);
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
37
|
+
return /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsx(
|
|
38
|
+
E,
|
|
37
39
|
{
|
|
38
|
-
onSubmit: (o,
|
|
39
|
-
console.log(
|
|
40
|
+
onSubmit: (o, t) => {
|
|
41
|
+
console.log(t), h(t);
|
|
40
42
|
},
|
|
41
|
-
className:
|
|
42
|
-
pages:
|
|
43
|
-
({ title: o, icon:
|
|
43
|
+
className: a,
|
|
44
|
+
pages: c.map(
|
|
45
|
+
({ title: o, icon: t, fieldThatShouldShowing: n, hidden: m }, j) => ({
|
|
44
46
|
title: o,
|
|
45
|
-
icon:
|
|
46
|
-
hidden:
|
|
47
|
-
component: (
|
|
47
|
+
icon: t,
|
|
48
|
+
hidden: m,
|
|
49
|
+
component: (p) => /* @__PURE__ */ r.jsx(
|
|
48
50
|
W,
|
|
49
51
|
{
|
|
50
52
|
fields: n,
|
|
51
53
|
onDeleteFile: f,
|
|
52
|
-
onUploadFile:
|
|
53
|
-
purpose:
|
|
54
|
+
onUploadFile: i,
|
|
55
|
+
purpose: s,
|
|
54
56
|
i: j,
|
|
55
57
|
updatingValue: u,
|
|
56
|
-
backward:
|
|
57
|
-
forward:
|
|
58
|
-
wizard:
|
|
58
|
+
backward: p.backward,
|
|
59
|
+
forward: p.forward,
|
|
60
|
+
wizard: c,
|
|
59
61
|
submitting: x
|
|
60
62
|
},
|
|
61
63
|
j
|
|
@@ -66,44 +68,44 @@ function q({
|
|
|
66
68
|
) });
|
|
67
69
|
}
|
|
68
70
|
function W({
|
|
69
|
-
fields:
|
|
70
|
-
onDeleteFile:
|
|
71
|
+
fields: l,
|
|
72
|
+
onDeleteFile: a,
|
|
71
73
|
onUploadFile: f,
|
|
72
|
-
purpose:
|
|
73
|
-
wizard:
|
|
74
|
+
purpose: i,
|
|
75
|
+
wizard: s = [],
|
|
74
76
|
i: e,
|
|
75
77
|
forward: u,
|
|
76
78
|
backward: h,
|
|
77
79
|
submitting: x,
|
|
78
80
|
updatingValue: d
|
|
79
81
|
}) {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
if (d && (
|
|
82
|
+
const c = s[e], { t: o } = v(R), [t] = g.useForm();
|
|
83
|
+
return S(() => {
|
|
84
|
+
if (d && (i === "update" || i === "clone")) {
|
|
83
85
|
const n = {};
|
|
84
|
-
for (const
|
|
85
|
-
n[
|
|
86
|
-
|
|
86
|
+
for (const m of l)
|
|
87
|
+
n[m.name] = d[m.name];
|
|
88
|
+
t.setFieldsValue(n);
|
|
87
89
|
}
|
|
88
|
-
}, [
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
90
|
+
}, [l, t, i, d]), /* @__PURE__ */ r.jsxs(g, { name: String(e), form: t, layout: "vertical", children: [
|
|
91
|
+
/* @__PURE__ */ r.jsx(
|
|
92
|
+
T,
|
|
91
93
|
{
|
|
92
|
-
fields:
|
|
93
|
-
formBuilder:
|
|
94
|
-
grid:
|
|
95
|
-
onDeleteFile:
|
|
94
|
+
fields: l,
|
|
95
|
+
formBuilder: c.formBuilder,
|
|
96
|
+
grid: c.grid,
|
|
97
|
+
onDeleteFile: a,
|
|
96
98
|
onUploadFile: f,
|
|
97
|
-
purpose:
|
|
99
|
+
purpose: i
|
|
98
100
|
}
|
|
99
101
|
),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
e > 0 && /* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ r.jsx(y, {}),
|
|
103
|
+
/* @__PURE__ */ r.jsxs(C, { gutter: [8, 8], children: [
|
|
104
|
+
e > 0 && /* @__PURE__ */ r.jsx(b, { md: 12, children: /* @__PURE__ */ r.jsx(
|
|
103
105
|
k,
|
|
104
106
|
{
|
|
105
107
|
block: !0,
|
|
106
|
-
icon: /* @__PURE__ */
|
|
108
|
+
icon: /* @__PURE__ */ r.jsx(w, {}),
|
|
107
109
|
htmlType: "button",
|
|
108
110
|
type: "default",
|
|
109
111
|
size: "large",
|
|
@@ -111,30 +113,30 @@ function W({
|
|
|
111
113
|
children: o("str.back")
|
|
112
114
|
}
|
|
113
115
|
) }),
|
|
114
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ r.jsx(b, { md: e > 0 ? 12 : 24, children: /* @__PURE__ */ r.jsx(
|
|
115
117
|
k,
|
|
116
118
|
{
|
|
117
119
|
block: !0,
|
|
118
|
-
icon:
|
|
120
|
+
icon: s.length - 1 === e ? /* @__PURE__ */ r.jsx(A, {}) : /* @__PURE__ */ r.jsx(I, {}),
|
|
119
121
|
htmlType: "submit",
|
|
120
122
|
type: "primary",
|
|
121
123
|
loading: x,
|
|
122
124
|
size: "large",
|
|
123
125
|
onClick: () => {
|
|
124
|
-
|
|
126
|
+
t.validateFields().then((n) => {
|
|
125
127
|
u(
|
|
126
128
|
n,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
s.length - 1 === e,
|
|
130
|
+
s.length - 1 === e
|
|
129
131
|
);
|
|
130
132
|
});
|
|
131
133
|
},
|
|
132
|
-
children:
|
|
134
|
+
children: s.length - 1 === e ? o("str." + (i === "update" ? "update" : "save")) : o("str.next")
|
|
133
135
|
}
|
|
134
136
|
) })
|
|
135
137
|
] })
|
|
136
138
|
] });
|
|
137
139
|
}
|
|
138
140
|
export {
|
|
139
|
-
|
|
141
|
+
G as default
|
|
140
142
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
${
|
|
1
|
+
"use strict";const t=require("../../../_virtual/jsx-runtime.cjs"),r=require("antd"),a=require("react"),y=require("./CrudField.cjs"),H=require("./view/CrudViewer.cjs"),I=require("../common/button/Button.cjs"),J=require("../common/button/PrintButton.cjs"),K=require("../common/report/SelectFieldInReport.cjs"),M=require("../common/select/SelectComponent.cjs"),v=require("./view/CrudViewerUtil.cjs"),Q=require("../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.cjs"),V={lg:6,md:8,sm:12,xs:24},W={lg:12,md:16,sm:24,xs:24};function X({fields:u,data:d,idField:A,loadingData:p,onSubmit:S,paginateProps:L,size:G,onClickPrint:f,onClickExcelExport:R,minusHeight:O,extraSearchFields:g,searchOnMount:E,summary:U}){const{searchable:_,selectable:m,sortable:B,defaultSort:c}=a.useMemo(()=>{var j,x,C,N,T;const e=[],s=[],l=[];let n;for(const o of u.filter(D=>!D.hidden))o.type==="image"||!o.report||((j=o.report)!=null&&j.searchable&&e.push(o),(x=o.report)!=null&&x.sortable&&(s.push(o),!n&&((C=o.report)!=null&&C.defaultSort)&&(n=o)),o.hideInTable||l.push({id:o.name,label:o.label,lock:(N=o.report)==null?void 0:N.lock,alreadySelected:(T=o.report)==null?void 0:T.alreadySelected}));return{defaultSort:n,searchable:e,sortable:s,selectable:l}},[u]),[b,F]=a.useState([]),h=a.useCallback(async({sortBy:e,sortByType:s,showFields:l=[],...n})=>{const j=[];e&&j.push({field:e,sort:s??"DESC"}),F(u.filter(x=>l.includes(x.name)).map(x=>({...x,hideInTable:!1}))),S({showFields:l,sortBy:j,...n})},[u,S]),[i]=r.Form.useForm(),[w,$]=a.useState(!1),[q,z]=a.useState(!0);return a.useEffect(()=>{if(E&&q){const e=setTimeout(()=>{i.validateFields().then(s=>{h(s)}),z(!1)},200);return()=>clearTimeout(e)}},[h,i,q,E]),a.useEffect(()=>{var s,l,n;!i.getFieldValue("sortBy")&&c&&(console.log((s=c.report)==null?void 0:s.defaultSort),i.setFieldsValue({sortBy:c.name,sortByType:typeof((l=c.report)==null?void 0:l.defaultSort)=="string"?(n=c.report)==null?void 0:n.defaultSort:"ASC"}))},[c,i]),a.useEffect(()=>{if(w){const e=m.filter(s=>s.alreadySelected).map(s=>s.id);F(u.filter(s=>e.includes(s.name)).map(s=>({...s,hideInTable:!1}))),$(!1)}},[u,w,m]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(r.Space,{className:"w-100",direction:"vertical",children:[t.jsxRuntimeExports.jsxs(r.Form,{form:i,layout:"vertical",onFinish:h,children:[t.jsxRuntimeExports.jsxs(r.Row,{gutter:[8,8],children:[_.map(e=>{var s,l,n;return t.jsxRuntimeExports.jsx(r.Col,{...e.grid??V,style:{alignSelf:"end"},children:(s=e.report)!=null&&s.customRender?e.report.customRender(i):e.type==="date"?t.jsxRuntimeExports.jsx(y.default,{...e,type:"date",range:(l=e.report)==null?void 0:l.range,required:!!((n=e.report)!=null&&n.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)}),!!(m!=null&&m.length)&&t.jsxRuntimeExports.jsx(r.Col,{...W,children:t.jsxRuntimeExports.jsx(K.SelectFieldInReport,{items:m,name:"showFields",mode:"multiple",label:"Show Fields",className:"mb-0"})}),!!B.length&&t.jsxRuntimeExports.jsx(r.Col,{...V,children:t.jsxRuntimeExports.jsx(M,{label:"Sort By",name:"sortBy",items:B.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(r.Form.Item,{name:"sortByType",noStyle:!0,className:"mt-3",children:t.jsxRuntimeExports.jsx(r.Radio.Group,{className:"w-100",defaultValue:"DESC",optionType:"button",children:t.jsxRuntimeExports.jsxs(r.Row,{children:[t.jsxRuntimeExports.jsx(r.Col,{xs:12,children:t.jsxRuntimeExports.jsx(r.Radio,{className:"w-100",style:{borderTopRightRadius:0,borderBottomRightRadius:0},value:"ASC",children:"Ascending"})}),t.jsxRuntimeExports.jsx(r.Col,{xs:12,children:t.jsxRuntimeExports.jsx(r.Radio,{className:"w-100",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0},value:"DESC",children:"Descending"})})]})})})]})})}),g?g(i):null]}),t.jsxRuntimeExports.jsx(I,{className:"mt-3",type:"primary",block:!0,htmlType:"submit",disabled:p,children:"Submit"})]}),t.jsxRuntimeExports.jsxs(r.Space,{children:[!!f&&t.jsxRuntimeExports.jsx(J.PrintButton,{disabled:p||!d.length,onClick:()=>f==null?void 0:f({tableId:"#crud-table table",data:d,fields:b.map(e=>({...e,render:v.getRendererValueCrudViewer(e)}))})}),!!R&&t.jsxRuntimeExports.jsx(I,{disabled:p||!d.length,onClick:()=>R==null?void 0:R({tableId:"#crud-table table",data:d,fields:b.map(e=>({...e,render:v.getRendererValueCrudViewer(e)}))}),icon:t.jsxRuntimeExports.jsx(Q,{}),className:`group
|
|
2
|
+
${p||!d.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"})]}),U,t.jsxRuntimeExports.jsx(H,{minusHeight:O,data:d,size:G,fields:b,idField:A,loadingData:p,paginateProps:L,viewable:!1})]})})}module.exports=X;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { FileExcelOutlined as X } from "@ant-design/icons";
|
|
3
2
|
import { Form as j, Space as L, Row as G, Col as f, Radio as S } from "antd";
|
|
4
|
-
import { useMemo as
|
|
3
|
+
import { useMemo as X, useState as x, useCallback as Y, useEffect as B } from "react";
|
|
5
4
|
import R from "./CrudField.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import Z from "./view/CrudViewer.js";
|
|
6
|
+
import _ from "../common/button/Button.js";
|
|
8
7
|
import { PrintButton as k } from "../common/button/PrintButton.js";
|
|
9
|
-
import { SelectFieldInReport as
|
|
10
|
-
import
|
|
11
|
-
import { getRendererValueCrudViewer as
|
|
12
|
-
|
|
8
|
+
import { SelectFieldInReport as E } from "../common/report/SelectFieldInReport.js";
|
|
9
|
+
import P from "../common/select/SelectComponent.js";
|
|
10
|
+
import { getRendererValueCrudViewer as $ } from "./view/CrudViewerUtil.js";
|
|
11
|
+
import ee from "../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.js";
|
|
12
|
+
const z = { lg: 6, md: 8, sm: 12, xs: 24 }, re = { lg: 12, md: 16, sm: 24, xs: 24 };
|
|
13
13
|
function pe({
|
|
14
14
|
fields: n,
|
|
15
|
-
data:
|
|
16
|
-
idField:
|
|
15
|
+
data: d,
|
|
16
|
+
idField: D,
|
|
17
17
|
loadingData: c,
|
|
18
|
-
onSubmit:
|
|
19
|
-
paginateProps:
|
|
20
|
-
size:
|
|
18
|
+
onSubmit: w,
|
|
19
|
+
paginateProps: H,
|
|
20
|
+
size: J,
|
|
21
21
|
onClickPrint: b,
|
|
22
22
|
onClickExcelExport: h,
|
|
23
|
-
minusHeight:
|
|
24
|
-
extraSearchFields:
|
|
23
|
+
minusHeight: K,
|
|
24
|
+
extraSearchFields: F,
|
|
25
25
|
searchOnMount: N,
|
|
26
|
-
summary:
|
|
26
|
+
summary: M
|
|
27
27
|
}) {
|
|
28
|
-
const { searchable:
|
|
28
|
+
const { searchable: O, selectable: i, sortable: T, defaultSort: m } = X(() => {
|
|
29
29
|
var p, u, V, q, A;
|
|
30
30
|
const e = [], t = [], l = [];
|
|
31
31
|
let o;
|
|
@@ -42,9 +42,9 @@ function pe({
|
|
|
42
42
|
sortable: t,
|
|
43
43
|
selectable: l
|
|
44
44
|
};
|
|
45
|
-
}, [n]), [y,
|
|
45
|
+
}, [n]), [y, I] = x(
|
|
46
46
|
[]
|
|
47
|
-
), g =
|
|
47
|
+
), g = Y(
|
|
48
48
|
async ({
|
|
49
49
|
sortBy: e,
|
|
50
50
|
sortByType: t,
|
|
@@ -55,14 +55,14 @@ function pe({
|
|
|
55
55
|
e && p.push({
|
|
56
56
|
field: e,
|
|
57
57
|
sort: t ?? "DESC"
|
|
58
|
-
}),
|
|
58
|
+
}), I(
|
|
59
59
|
n.filter((u) => l.includes(u.name)).map((u) => ({ ...u, hideInTable: !1 }))
|
|
60
|
-
),
|
|
60
|
+
), w({ showFields: l, sortBy: p, ...o });
|
|
61
61
|
},
|
|
62
|
-
[n,
|
|
63
|
-
), [a] = j.useForm(), [
|
|
62
|
+
[n, w]
|
|
63
|
+
), [a] = j.useForm(), [v, Q] = x(!1), [C, U] = x(!0);
|
|
64
64
|
return B(() => {
|
|
65
|
-
if (N &&
|
|
65
|
+
if (N && C) {
|
|
66
66
|
const e = setTimeout(() => {
|
|
67
67
|
a.validateFields().then((t) => {
|
|
68
68
|
g(t);
|
|
@@ -70,28 +70,28 @@ function pe({
|
|
|
70
70
|
}, 200);
|
|
71
71
|
return () => clearTimeout(e);
|
|
72
72
|
}
|
|
73
|
-
}, [g, a,
|
|
73
|
+
}, [g, a, C, N]), B(() => {
|
|
74
74
|
var t, l, o;
|
|
75
75
|
!a.getFieldValue("sortBy") && m && (console.log((t = m.report) == null ? void 0 : t.defaultSort), a.setFieldsValue({
|
|
76
76
|
sortBy: m.name,
|
|
77
77
|
sortByType: typeof ((l = m.report) == null ? void 0 : l.defaultSort) == "string" ? (o = m.report) == null ? void 0 : o.defaultSort : "ASC"
|
|
78
78
|
}));
|
|
79
79
|
}, [m, a]), B(() => {
|
|
80
|
-
if (
|
|
81
|
-
const e =
|
|
82
|
-
|
|
80
|
+
if (v) {
|
|
81
|
+
const e = i.filter((t) => t.alreadySelected).map((t) => t.id);
|
|
82
|
+
I(
|
|
83
83
|
n.filter((t) => e.includes(t.name)).map((t) => ({ ...t, hideInTable: !1 }))
|
|
84
84
|
), Q(!1);
|
|
85
85
|
}
|
|
86
|
-
}, [n,
|
|
86
|
+
}, [n, v, i]), /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsxs(L, { className: "w-100", direction: "vertical", children: [
|
|
87
87
|
/* @__PURE__ */ r.jsxs(j, { form: a, layout: "vertical", onFinish: g, children: [
|
|
88
88
|
/* @__PURE__ */ r.jsxs(G, { gutter: [8, 8], children: [
|
|
89
|
-
|
|
89
|
+
O.map((e) => {
|
|
90
90
|
var t, l, o;
|
|
91
91
|
return /* @__PURE__ */ r.jsx(
|
|
92
92
|
f,
|
|
93
93
|
{
|
|
94
|
-
...e.grid ??
|
|
94
|
+
...e.grid ?? z,
|
|
95
95
|
style: { alignSelf: "end" },
|
|
96
96
|
children: (t = e.report) != null && t.customRender ? e.report.customRender(a) : e.type === "date" ? /* @__PURE__ */ r.jsx(
|
|
97
97
|
R,
|
|
@@ -126,18 +126,18 @@ function pe({
|
|
|
126
126
|
e.name
|
|
127
127
|
);
|
|
128
128
|
}),
|
|
129
|
-
!!(
|
|
130
|
-
|
|
129
|
+
!!(i != null && i.length) && /* @__PURE__ */ r.jsx(f, { ...re, children: /* @__PURE__ */ r.jsx(
|
|
130
|
+
E,
|
|
131
131
|
{
|
|
132
|
-
items:
|
|
132
|
+
items: i,
|
|
133
133
|
name: "showFields",
|
|
134
134
|
mode: "multiple",
|
|
135
135
|
label: "Show Fields",
|
|
136
136
|
className: "mb-0"
|
|
137
137
|
}
|
|
138
138
|
) }),
|
|
139
|
-
!!T.length && /* @__PURE__ */ r.jsx(f, {
|
|
140
|
-
|
|
139
|
+
!!T.length && /* @__PURE__ */ r.jsx(f, { ...z, children: /* @__PURE__ */ r.jsx(
|
|
140
|
+
P,
|
|
141
141
|
{
|
|
142
142
|
label: "Sort By",
|
|
143
143
|
name: "sortBy",
|
|
@@ -184,10 +184,10 @@ function pe({
|
|
|
184
184
|
] })
|
|
185
185
|
}
|
|
186
186
|
) }),
|
|
187
|
-
|
|
187
|
+
F ? F(a) : null
|
|
188
188
|
] }),
|
|
189
189
|
/* @__PURE__ */ r.jsx(
|
|
190
|
-
|
|
190
|
+
_,
|
|
191
191
|
{
|
|
192
192
|
className: "mt-3",
|
|
193
193
|
type: "primary",
|
|
@@ -202,49 +202,49 @@ function pe({
|
|
|
202
202
|
!!b && /* @__PURE__ */ r.jsx(
|
|
203
203
|
k,
|
|
204
204
|
{
|
|
205
|
-
disabled: c || !
|
|
205
|
+
disabled: c || !d.length,
|
|
206
206
|
onClick: () => b == null ? void 0 : b({
|
|
207
207
|
tableId: "#crud-table table",
|
|
208
|
-
data:
|
|
208
|
+
data: d,
|
|
209
209
|
fields: y.map((e) => ({
|
|
210
210
|
...e,
|
|
211
|
-
render:
|
|
211
|
+
render: $(e)
|
|
212
212
|
}))
|
|
213
213
|
})
|
|
214
214
|
}
|
|
215
215
|
),
|
|
216
216
|
!!h && /* @__PURE__ */ r.jsx(
|
|
217
|
-
|
|
217
|
+
_,
|
|
218
218
|
{
|
|
219
|
-
disabled: c || !
|
|
219
|
+
disabled: c || !d.length,
|
|
220
220
|
onClick: () => h == null ? void 0 : h({
|
|
221
221
|
tableId: "#crud-table table",
|
|
222
|
-
data:
|
|
222
|
+
data: d,
|
|
223
223
|
fields: y.map((e) => ({
|
|
224
224
|
...e,
|
|
225
|
-
render:
|
|
225
|
+
render: $(e)
|
|
226
226
|
}))
|
|
227
227
|
}),
|
|
228
|
-
icon: /* @__PURE__ */ r.jsx(
|
|
228
|
+
icon: /* @__PURE__ */ r.jsx(ee, {}),
|
|
229
229
|
className: `group
|
|
230
|
-
${c || !
|
|
230
|
+
${c || !d.length ? "" : "!bg-green-700 hover:!bg-green-600 !text-white !border-green-700 hover:!border-green-600"}
|
|
231
231
|
|
|
232
232
|
`,
|
|
233
233
|
children: "Excel"
|
|
234
234
|
}
|
|
235
235
|
)
|
|
236
236
|
] }),
|
|
237
|
-
|
|
237
|
+
M,
|
|
238
238
|
/* @__PURE__ */ r.jsx(
|
|
239
|
-
|
|
239
|
+
Z,
|
|
240
240
|
{
|
|
241
|
-
minusHeight:
|
|
242
|
-
data:
|
|
243
|
-
size:
|
|
241
|
+
minusHeight: K,
|
|
242
|
+
data: d,
|
|
243
|
+
size: J,
|
|
244
244
|
fields: y,
|
|
245
|
-
idField:
|
|
245
|
+
idField: D,
|
|
246
246
|
loadingData: c,
|
|
247
|
-
paginateProps:
|
|
247
|
+
paginateProps: H,
|
|
248
248
|
viewable: !1
|
|
249
249
|
}
|
|
250
250
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const e=require("../../../_virtual/jsx-runtime.cjs"),o=require("react"),i=require("antd"),y=require("./CrudField.cjs"),q=require("../common/button/Button.cjs"),w=require("../../../node_modules/@ant-design/icons/es/icons/SearchOutlined.cjs");function M({searchFields:t=[],fields:m,searchOnChange:j,onSearch:x,searchDefaultValues:b,searchFieldsCustomColumnProps:g}){const R=o.useMemo(()=>t.map(n=>typeof n=="string"?{...m.find(E=>n===E.name),required:!1}:{...m.find(l=>(n==null?void 0:n.name)===l.name),...n}).filter(n=>n&&!(n!=null&&n.hidden)),[t,m]),p=o.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]),d=o.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=o.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]),[u]=i.Form.useForm(),r=o.useCallback(async n=>{if((n||j)&&x){const f=await u.validateFields();x(f)}},[u,x,j]);return o.useEffect(()=>{b&&(u.setFieldsValue(b),r(!0))},[u,b]),t!=null&&t.length?e.jsxRuntimeExports.jsx(i.Form,{form:u,onFinish:()=>r(!0),layout:"vertical",className:"mb-2",onChange:()=>r(!1),children:e.jsxRuntimeExports.jsxs(i.Row,{gutter:[4,8],className:"w-100",children:[R.map((n,f)=>{const l=(g==null?void 0:g[f])??{md:p.field,sm:d.field,xs:s.field};return o.createElement(i.Col,{...l,key:`search_field_${String(n.name)}`,className:"align-self-end"},e.jsxRuntimeExports.jsx(y.default,{...n,readonly:!1,fieldClassName:"mb-0"}))}),e.jsxRuntimeExports.jsx(i.Col,{md:p.button,sm:d.button,xs:s.button,style:{alignSelf:"end"},children:e.jsxRuntimeExports.jsx(q,{type:"primary",htmlType:"submit",block:!0,icon:e.jsxRuntimeExports.jsx(w,{})})})]})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})}module.exports=M;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useMemo as l, useCallback as
|
|
3
|
-
import {
|
|
4
|
-
import { Form as y, Row as S, Col as w } from "antd";
|
|
2
|
+
import { useMemo as l, useCallback as E, useEffect as R, createElement as a } from "react";
|
|
3
|
+
import { Form as y, Row as v, Col as w } from "antd";
|
|
5
4
|
import _ from "./CrudField.js";
|
|
6
5
|
import q from "../common/button/Button.js";
|
|
7
|
-
|
|
6
|
+
import B from "../../../node_modules/@ant-design/icons/es/icons/SearchOutlined.js";
|
|
7
|
+
function A({
|
|
8
8
|
searchFields: t = [],
|
|
9
9
|
fields: e,
|
|
10
|
-
searchOnChange:
|
|
11
|
-
onSearch:
|
|
12
|
-
searchDefaultValues:
|
|
13
|
-
searchFieldsCustomColumnProps:
|
|
10
|
+
searchOnChange: r,
|
|
11
|
+
onSearch: b,
|
|
12
|
+
searchDefaultValues: g,
|
|
13
|
+
searchFieldsCustomColumnProps: i
|
|
14
14
|
}) {
|
|
15
15
|
const N = l(
|
|
16
16
|
() => t.map((n) => typeof n == "string" ? {
|
|
17
|
-
...e.find((
|
|
17
|
+
...e.find((k) => n === k.name),
|
|
18
18
|
required: !1
|
|
19
19
|
} : {
|
|
20
20
|
...e.find(
|
|
@@ -32,33 +32,33 @@ function G({
|
|
|
32
32
|
), j = l(
|
|
33
33
|
() => 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 },
|
|
34
34
|
[t.length]
|
|
35
|
-
), [f] = y.useForm(),
|
|
35
|
+
), [f] = y.useForm(), p = E(
|
|
36
36
|
async (n) => {
|
|
37
|
-
if ((n ||
|
|
37
|
+
if ((n || r) && b) {
|
|
38
38
|
const m = await f.validateFields();
|
|
39
|
-
|
|
39
|
+
b(m);
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
[f,
|
|
42
|
+
[f, b, r]
|
|
43
43
|
);
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
}, [f,
|
|
44
|
+
return R(() => {
|
|
45
|
+
g && (f.setFieldsValue(g), p(!0));
|
|
46
|
+
}, [f, g]), t != null && t.length ? /* @__PURE__ */ o.jsx(
|
|
47
47
|
y,
|
|
48
48
|
{
|
|
49
49
|
form: f,
|
|
50
|
-
onFinish: () =>
|
|
50
|
+
onFinish: () => p(!0),
|
|
51
51
|
layout: "vertical",
|
|
52
52
|
className: "mb-2",
|
|
53
|
-
onChange: () =>
|
|
54
|
-
children: /* @__PURE__ */ o.jsxs(
|
|
53
|
+
onChange: () => p(!1),
|
|
54
|
+
children: /* @__PURE__ */ o.jsxs(v, { gutter: [4, 8], className: "w-100", children: [
|
|
55
55
|
N.map((n, m) => {
|
|
56
|
-
const u = (
|
|
56
|
+
const u = (i == null ? void 0 : i[m]) ?? {
|
|
57
57
|
md: x.field,
|
|
58
58
|
sm: d.field,
|
|
59
59
|
xs: j.field
|
|
60
60
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ a(
|
|
62
62
|
w,
|
|
63
63
|
{
|
|
64
64
|
...u,
|
|
@@ -81,7 +81,7 @@ function G({
|
|
|
81
81
|
type: "primary",
|
|
82
82
|
htmlType: "submit",
|
|
83
83
|
block: !0,
|
|
84
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
84
|
+
icon: /* @__PURE__ */ o.jsx(B, {})
|
|
85
85
|
}
|
|
86
86
|
)
|
|
87
87
|
}
|
|
@@ -91,5 +91,5 @@ function G({
|
|
|
91
91
|
) : /* @__PURE__ */ o.jsx(o.Fragment, {});
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
94
|
-
|
|
94
|
+
A as default
|
|
95
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const f=require("antd"),I=require("../../../node_modules/mime/dist/src/index.cjs"),u=require("react"),W=require("../../locale/hooks/translation-constants.cjs"),B=require("../../util/ValidationUtil.cjs"),F=require("../common/button/Button.cjs"),H=require("../common/layout/VerticalSpace.cjs"),z=require("../../../node_modules/@ant-design/icons/es/icons/FileOutlined.cjs"),G=require("../../../node_modules/@ant-design/icons/es/icons/FilePptOutlined.cjs"),J=require("../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.cjs"),K=require("../../../node_modules/@ant-design/icons/es/icons/FileTextOutlined.cjs"),Q=require("../../../node_modules/@ant-design/icons/es/icons/FileWordOutlined.cjs"),X=require("../../../node_modules/@ant-design/icons/es/icons/FilePdfOutlined.cjs"),Y=require("../../../node_modules/@ant-design/icons/es/icons/FileImageOutlined.cjs"),Z=require("../../../node_modules/react-i18next/dist/es/useTranslation.cjs"),m=require("../../../node_modules/@ant-design/icons/es/icons/ExportOutlined.cjs");function v({name:l,label:t,required:r,provider:s,onUploading:i,onRemoved:x,fieldClassName:h,accept:w,rules:A,maxCount:g=1,block:D,...N}){const d=f.Form.useFormInstance(),j=f.Form.useWatch(l,d),[q,C]=u.useState(!1),[P,k]=u.useState(!1),U=u.useCallback(async n=>{var o,a;try{const{file:c}=n,E=c.name;C(!0),k(!0),i==null||i(!0);const R=E??"",S=R.split("."),$=S[S.length-1],L=s.generateFileName(R),b=`${await s.getInitialPath()}/${L}.${$}`;console.log({filePath:b});const V=await s.upload({...c,originFileObj:c},b);i==null||i(!1),d.setFieldValue(l,V),(o=n.onSuccess)==null||o.call(n,V)}catch(c){(a=n.onError)==null||a.call(n,c)}finally{C(!1)}},[d,l,i,s]),[p,O]=u.useState([]);u.useEffect(()=>{!P&&j&&Promise.all((Array.isArray(j)?j:[j]).map(async n=>{const o=I.default.getType(n),a=n.split("/").pop(),c=await s.getRealUrl(n);return{uid:n,url:c,type:o,name:a}})).then(n=>O(()=>{const o=n.map(({url:a,type:c,uid:E,name:R})=>({uid:E,url:a,type:c,response:E,thumbUrl:a,name:R}));return console.log(o),o}))},[j,P,q,s]);const _=u.useCallback(async n=>{const o=n.response,a=o||d.getFieldValue(l);await s.delete(a),x==null||x(),n&&d.setFieldsValue({[l]:null})},[d,l,x,s]);return e.jsxRuntimeExports.jsxs(f.Form.Item,{label:t,required:r,name:l,className:h,rules:[...r?B.required(t):[],...A??[]],children:[e.jsxRuntimeExports.jsx("input",{hidden:!0}),e.jsxRuntimeExports.jsx(f.Upload,{...N,fileList:p,className:((p==null?void 0:p.length)??0)>=g?"hide-upload":"",maxCount:g,customRequest:U,onRemove:_,listType:"picture",onChange:({fileList:n})=>{O(n)},style:D?{width:"100%"}:void 0,children:e.jsxRuntimeExports.jsx(F,{loading:q,children:"Upload File"})})]})}const y=({provider:l,value:t})=>{const[r,s]=u.useState();return u.useEffect(()=>{t&&l.getRealUrl(t).then(i=>{s({mimeType:I.default.getType(t),url:i,fileName:t.split("/").pop()??t})})},[l,t]),r?e.jsxRuntimeExports.jsx(M,{fileName:r.fileName,url:r==null?void 0:r.url,mimeType:r==null?void 0:r.mimeType}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})},M=({url:l,mimeType:t="",fileName:r})=>{const s=u.useMemo(()=>t!=null&&t.includes("image")?"image":t!=null&&t.includes("pdf")?"pdf":t!=null&&t.includes("word")?"word":t!=null&&t.includes("text")?"text":t!=null&&t.includes("presentation")?"presentation":t!=null&&t.includes("excel")||t!=null&&t.includes("spreadsheet")?"excel":"file",[t]),i=u.useMemo(()=>{switch(s){case"image":return e.jsxRuntimeExports.jsx(Y,{});case"pdf":return e.jsxRuntimeExports.jsx(X,{});case"word":return e.jsxRuntimeExports.jsx(Q,{});case"text":return e.jsxRuntimeExports.jsx(K,{});case"excel":return e.jsxRuntimeExports.jsx(J,{});case"presentation":return e.jsxRuntimeExports.jsx(G,{});default:return e.jsxRuntimeExports.jsx(z,{})}},[s]),[x,h]=u.useState(!1),{t:w}=Z.useTranslation(W.TRANSLATION_NAMESPACE);return s!=="file"&&s!=="text"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.Modal,{open:x,title:r,onCancel:()=>h(!1),footer:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),width:"100%",style:{top:"8px",minHeight:"700px"},destroyOnClose:!0,children:e.jsxRuntimeExports.jsxs(H,{children:[e.jsxRuntimeExports.jsx(F,{tooltip:r,icon:e.jsxRuntimeExports.jsx(m,{}),target:"_blank",href:l,style:{textDecoration:"none"},children:w("str.openInNewTab")}),s==="image"?e.jsxRuntimeExports.jsx("img",{src:l,alt:r,style:{width:"100%"}}):s==="pdf"?e.jsxRuntimeExports.jsxs("iframe",{title:r,src:l,width:"100%",height:"700px",children:["This browser does not support PDFs. Please download the PDF to view it:",e.jsxRuntimeExports.jsx("a",{href:l,children:"Download PDF"}),"."]}):e.jsxRuntimeExports.jsxs("iframe",{title:r,src:`https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(l)}`,width:"100%",height:"700px",children:["This browser does not support open ",s.toUpperCase(),". Please download the",s.toUpperCase()," to view it:",e.jsxRuntimeExports.jsxs("a",{href:l,children:["Download ",s.toUpperCase()]}),"."]})]})}),e.jsxRuntimeExports.jsx(F,{tooltip:r,icon:i,shape:"circle",onClick:()=>h(!0)})]}):e.jsxRuntimeExports.jsx(F,{tooltip:r,icon:i,target:"_blank",href:l,shape:"circle"})};exports.FileCellValue=M;exports.FileCrudCellValue=y;exports.default=v;
|