@kingteza/crud-component 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.cjs +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -5
- package/dist/_virtual/advancedFormat.cjs +1 -1
- package/dist/_virtual/customParseFormat.cjs +1 -1
- package/dist/_virtual/dayjs.min.cjs +1 -1
- package/dist/_virtual/index.cjs +1 -1
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +2 -2
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.cjs +1 -1
- package/dist/_virtual/index5.js +2 -5
- package/dist/_virtual/localeData.cjs +1 -1
- package/dist/_virtual/weekOfYear.cjs +1 -1
- package/dist/_virtual/weekYear.cjs +1 -1
- package/dist/_virtual/weekday.cjs +1 -1
- package/dist/common/index.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +3 -3
- package/dist/src/components/common/appearance/Hider.cjs +1 -1
- package/dist/src/components/common/button/Button.cjs +1 -1
- package/dist/src/components/common/button/Button.js +10 -10
- package/dist/src/components/common/button/CloneButtonTable.cjs +1 -1
- package/dist/src/components/common/button/CloneButtonTable.js +7 -7
- package/dist/src/components/common/button/DeleteButtonTable.cjs +1 -1
- package/dist/src/components/common/button/DeleteButtonTable.js +17 -17
- package/dist/src/components/common/button/ExportButton.cjs +1 -1
- package/dist/src/components/common/button/ExportButton.js +16 -16
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/src/components/common/button/HideButtonTable.js +18 -18
- package/dist/src/components/common/button/ImportButton.cjs +1 -1
- package/dist/src/components/common/button/ImportButton.js +25 -25
- package/dist/src/components/common/button/NewButton.cjs +1 -1
- package/dist/src/components/common/button/NewButton.js +16 -16
- package/dist/src/components/common/button/PrintButton.cjs +1 -1
- package/dist/src/components/common/button/PrintButton.js +14 -14
- package/dist/src/components/common/button/RefreshButton.cjs +1 -1
- package/dist/src/components/common/button/RefreshButton.js +12 -12
- package/dist/src/components/common/button/UnHideButton.cjs +1 -1
- package/dist/src/components/common/button/UnHideButton.js +28 -28
- package/dist/src/components/common/button/UpdateButtonTable.cjs +1 -1
- package/dist/src/components/common/button/UpdateButtonTable.js +9 -9
- package/dist/src/components/common/button/ViewButtonTable.cjs +1 -1
- package/dist/src/components/common/button/ViewButtonTable.js +13 -13
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/src/components/common/description/DescList.cjs +1 -1
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +5 -5
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/src/components/common/picker/ImagePicker.js +73 -76
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.js +5 -5
- package/dist/src/components/common/show-more/index.cjs +1 -1
- package/dist/src/components/common/show-more/index.js +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.cjs +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.js +11 -10
- package/dist/src/components/common/table/table.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.js +1 -1
- package/dist/src/components/common/text-field/NumberField.cjs +1 -1
- package/dist/src/components/common/text-field/NumberField.js +7 -7
- package/dist/src/components/common/text-field/PhoneNumberField.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.js +3 -3
- package/dist/src/components/common/text-field/TextField.cjs +1 -1
- package/dist/src/components/common/text-field/TextField.js +34 -34
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.js +36 -37
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.js +15 -15
- package/dist/src/components/crud/CrudField.cjs +1 -1
- package/dist/src/components/crud/CrudField.js +22 -22
- package/dist/src/components/crud/CrudForm.js +10 -10
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/src/components/crud/CrudFormWizard.js +63 -65
- package/dist/src/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/src/components/crud/CrudReportComponent.js +54 -54
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/src/components/crud/CrudSearchComponent.js +23 -23
- package/dist/src/components/crud/FileCrudField.cjs +1 -1
- package/dist/src/components/crud/FileCrudField.js +94 -101
- package/dist/src/components/crud/ImageCrudField.cjs +1 -1
- package/dist/src/components/crud/ImageCrudField.js +35 -35
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/src/components/crud/import/CrudImportButton.js +12 -12
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +94 -95
- package/dist/src/components/crud/view/CrudDecListView.cjs +1 -1
- package/dist/src/components/crud/view/CrudDecListView.js +5 -5
- package/dist/src/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewer.js +7 -7
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +31 -32
- package/dist/src/context/WindowDimension.cjs +1 -1
- package/dist/src/locale/index.cjs +1 -1
- package/dist/src/locale/index.js +2 -2
- package/dist/src/locale/translations/en.cjs +1 -1
- package/dist/src/util/DateUtil.cjs +1 -1
- package/dist/src/util/DateUtil.js +4 -4
- package/dist/src/util/ImageUtil.cjs +1 -1
- package/dist/src/util/ImageUtil.js +1 -1
- package/dist/src/util/ValidationUtil.cjs +1 -1
- package/dist/src/util/ValidationUtil.js +1 -1
- package/dist/util/index.cjs +1 -1
- package/package.json +1 -1
- package/dist/_virtual/FileSaver.min.cjs +0 -1
- package/dist/_virtual/FileSaver.min.js +0 -5
- package/dist/_virtual/FileSaver.min2.cjs +0 -1
- package/dist/_virtual/FileSaver.min2.js +0 -4
- package/dist/_virtual/ShowMoreText.cjs +0 -1
- package/dist/_virtual/ShowMoreText.js +0 -7
- package/dist/_virtual/ShowMoreText2.cjs +0 -1
- package/dist/_virtual/ShowMoreText2.js +0 -4
- package/dist/_virtual/Truncate.cjs +0 -1
- package/dist/_virtual/Truncate.js +0 -4
- package/dist/_virtual/index10.cjs +0 -1
- package/dist/_virtual/index10.js +0 -4
- package/dist/_virtual/index6.cjs +0 -1
- package/dist/_virtual/index6.js +0 -2
- package/dist/_virtual/index7.cjs +0 -1
- package/dist/_virtual/index7.js +0 -7
- package/dist/_virtual/index8.cjs +0 -1
- package/dist/_virtual/index8.js +0 -7
- package/dist/_virtual/index9.cjs +0 -1
- package/dist/_virtual/index9.js +0 -4
- package/dist/_virtual/main.cjs +0 -1
- package/dist/_virtual/main.js +0 -7
- package/dist/_virtual/main2.cjs +0 -1
- package/dist/_virtual/main2.js +0 -4
- package/dist/_virtual/papaparse.min.cjs +0 -1
- package/dist/_virtual/papaparse.min.js +0 -7
- package/dist/_virtual/papaparse.min2.cjs +0 -1
- package/dist/_virtual/papaparse.min2.js +0 -4
|
@@ -1,63 +1,61 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { LeftOutlined as S, SaveOutlined as y, RightOutlined as C } from "@ant-design/icons";
|
|
3
|
+
import { Form as p, Divider as T, Row as v, Col as b } from "antd";
|
|
4
|
+
import { useMemo as F, useEffect as E } from "react";
|
|
5
|
+
import { useTranslation as w } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as A } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { CrudFormFields as O } from "./CrudForm.js";
|
|
6
8
|
import k from "../common/button/Button.js";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import I from "../../../node_modules/@ant-design/icons/es/icons/RightOutlined.js";
|
|
12
|
-
function G({
|
|
13
|
-
fields: l,
|
|
14
|
-
className: a,
|
|
9
|
+
import R from "../common/wizard/WizardViewForm.js";
|
|
10
|
+
function q({
|
|
11
|
+
fields: s,
|
|
12
|
+
className: c,
|
|
15
13
|
onDeleteFile: f,
|
|
16
|
-
onUploadFile:
|
|
17
|
-
purpose:
|
|
14
|
+
onUploadFile: m,
|
|
15
|
+
purpose: l,
|
|
18
16
|
wizard: e = [],
|
|
19
17
|
updatingValue: u,
|
|
20
18
|
onSave: h,
|
|
21
19
|
submitting: x
|
|
22
20
|
}) {
|
|
23
21
|
const d = F(() => e.map((o) => {
|
|
24
|
-
let
|
|
25
|
-
const n =
|
|
26
|
-
(
|
|
22
|
+
let r = !0;
|
|
23
|
+
const n = s.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
|
-
}), [
|
|
31
|
+
}), [s, e]), a = F(
|
|
34
32
|
() => d.filter((o) => !o.hidden),
|
|
35
33
|
[d]
|
|
36
34
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
35
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
|
|
36
|
+
R,
|
|
39
37
|
{
|
|
40
|
-
onSubmit: (o,
|
|
41
|
-
console.log(
|
|
38
|
+
onSubmit: (o, r) => {
|
|
39
|
+
console.log(r), h(r);
|
|
42
40
|
},
|
|
43
|
-
className:
|
|
44
|
-
pages:
|
|
45
|
-
({ title: o, icon:
|
|
41
|
+
className: c,
|
|
42
|
+
pages: a.map(
|
|
43
|
+
({ title: o, icon: r, fieldThatShouldShowing: n, hidden: i }, j) => ({
|
|
46
44
|
title: o,
|
|
47
|
-
icon:
|
|
48
|
-
hidden:
|
|
49
|
-
component: (
|
|
45
|
+
icon: r,
|
|
46
|
+
hidden: i,
|
|
47
|
+
component: (g) => /* @__PURE__ */ t.jsx(
|
|
50
48
|
W,
|
|
51
49
|
{
|
|
52
50
|
fields: n,
|
|
53
51
|
onDeleteFile: f,
|
|
54
|
-
onUploadFile:
|
|
55
|
-
purpose:
|
|
52
|
+
onUploadFile: m,
|
|
53
|
+
purpose: l,
|
|
56
54
|
i: j,
|
|
57
55
|
updatingValue: u,
|
|
58
|
-
backward:
|
|
59
|
-
forward:
|
|
60
|
-
wizard:
|
|
56
|
+
backward: g.backward,
|
|
57
|
+
forward: g.forward,
|
|
58
|
+
wizard: a,
|
|
61
59
|
submitting: x
|
|
62
60
|
},
|
|
63
61
|
j
|
|
@@ -68,44 +66,44 @@ function G({
|
|
|
68
66
|
) });
|
|
69
67
|
}
|
|
70
68
|
function W({
|
|
71
|
-
fields:
|
|
72
|
-
onDeleteFile:
|
|
69
|
+
fields: s,
|
|
70
|
+
onDeleteFile: c,
|
|
73
71
|
onUploadFile: f,
|
|
74
|
-
purpose:
|
|
75
|
-
wizard:
|
|
72
|
+
purpose: m,
|
|
73
|
+
wizard: l = [],
|
|
76
74
|
i: e,
|
|
77
75
|
forward: u,
|
|
78
76
|
backward: h,
|
|
79
77
|
submitting: x,
|
|
80
78
|
updatingValue: d
|
|
81
79
|
}) {
|
|
82
|
-
const
|
|
83
|
-
return
|
|
84
|
-
if (d && (
|
|
80
|
+
const a = l[e], { t: o } = w(A), [r] = p.useForm();
|
|
81
|
+
return E(() => {
|
|
82
|
+
if (d && (m === "update" || m === "clone")) {
|
|
85
83
|
const n = {};
|
|
86
|
-
for (const
|
|
87
|
-
n[
|
|
88
|
-
|
|
84
|
+
for (const i of s)
|
|
85
|
+
n[i.name] = d[i.name];
|
|
86
|
+
r.setFieldsValue(n);
|
|
89
87
|
}
|
|
90
|
-
}, [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
88
|
+
}, [s, r, m, d]), /* @__PURE__ */ t.jsxs(p, { name: String(e), form: r, layout: "vertical", children: [
|
|
89
|
+
/* @__PURE__ */ t.jsx(
|
|
90
|
+
O,
|
|
93
91
|
{
|
|
94
|
-
fields:
|
|
95
|
-
formBuilder:
|
|
96
|
-
grid:
|
|
97
|
-
onDeleteFile:
|
|
92
|
+
fields: s,
|
|
93
|
+
formBuilder: a.formBuilder,
|
|
94
|
+
grid: a.grid,
|
|
95
|
+
onDeleteFile: c,
|
|
98
96
|
onUploadFile: f,
|
|
99
|
-
purpose:
|
|
97
|
+
purpose: m
|
|
100
98
|
}
|
|
101
99
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
e > 0 && /* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ t.jsx(T, {}),
|
|
101
|
+
/* @__PURE__ */ t.jsxs(v, { gutter: [8, 8], children: [
|
|
102
|
+
e > 0 && /* @__PURE__ */ t.jsx(b, { md: 12, children: /* @__PURE__ */ t.jsx(
|
|
105
103
|
k,
|
|
106
104
|
{
|
|
107
105
|
block: !0,
|
|
108
|
-
icon: /* @__PURE__ */
|
|
106
|
+
icon: /* @__PURE__ */ t.jsx(S, {}),
|
|
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__ */
|
|
114
|
+
/* @__PURE__ */ t.jsx(b, { md: e > 0 ? 12 : 24, children: /* @__PURE__ */ t.jsx(
|
|
117
115
|
k,
|
|
118
116
|
{
|
|
119
117
|
block: !0,
|
|
120
|
-
icon:
|
|
118
|
+
icon: l.length - 1 === e ? /* @__PURE__ */ t.jsx(y, {}) : /* @__PURE__ */ t.jsx(C, {}),
|
|
121
119
|
htmlType: "submit",
|
|
122
120
|
type: "primary",
|
|
123
121
|
loading: x,
|
|
124
122
|
size: "large",
|
|
125
123
|
onClick: () => {
|
|
126
|
-
|
|
124
|
+
r.validateFields().then((n) => {
|
|
127
125
|
u(
|
|
128
126
|
n,
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
l.length - 1 === e,
|
|
128
|
+
l.length - 1 === e
|
|
131
129
|
);
|
|
132
130
|
});
|
|
133
131
|
},
|
|
134
|
-
children:
|
|
132
|
+
children: l.length - 1 === e ? o("str." + (m === "update" ? "update" : "save")) : o("str.next")
|
|
135
133
|
}
|
|
136
134
|
) })
|
|
137
135
|
] })
|
|
138
136
|
] });
|
|
139
137
|
}
|
|
140
138
|
export {
|
|
141
|
-
|
|
139
|
+
q as default
|
|
142
140
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
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"),
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),D=require("@ant-design/icons"),r=require("antd"),a=require("react"),y=require("./CrudField.cjs"),H=require("./view/CrudViewer.cjs"),v=require("../common/button/Button.cjs"),J=require("../common/button/PrintButton.cjs"),K=require("../common/report/SelectFieldInReport.cjs"),Q=require("../common/select/SelectComponent.cjs"),I=require("./view/CrudViewerUtil.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:x,onSubmit:S,paginateProps:_,size:L,onClickPrint:j,onClickExcelExport:b,minusHeight:M,extraSearchFields:g,searchOnMount:E,summary:O}){const{searchable:G,selectable:m,sortable:B,defaultSort:c}=a.useMemo(()=>{var f,p,C,N,T;const e=[],s=[],o=[];let n;for(const l of u.filter(z=>!z.hidden))l.type==="image"||!l.report||((f=l.report)!=null&&f.searchable&&e.push(l),(p=l.report)!=null&&p.sortable&&(s.push(l),!n&&((C=l.report)!=null&&C.defaultSort)&&(n=l)),l.hideInTable||o.push({id:l.name,label:l.label,lock:(N=l.report)==null?void 0:N.lock,alreadySelected:(T=l.report)==null?void 0:T.alreadySelected}));return{defaultSort:n,searchable:e,sortable:s,selectable:o}},[u]),[R,F]=a.useState([]),h=a.useCallback(async({sortBy:e,sortByType:s,showFields:o=[],...n})=>{const f=[];e&&f.push({field:e,sort:s??"DESC"}),F(u.filter(p=>o.includes(p.name)).map(p=>({...p,hideInTable:!1}))),S({showFields:o,sortBy:f,...n})},[u,S]),[i]=r.Form.useForm(),[w,U]=a.useState(!1),[q,$]=a.useState(!0);return a.useEffect(()=>{if(E&&q){const e=setTimeout(()=>{i.validateFields().then(s=>{h(s)}),$(!1)},200);return()=>clearTimeout(e)}},[h,i,q,E]),a.useEffect(()=>{var s,o,n;!i.getFieldValue("sortBy")&&c&&(console.log((s=c.report)==null?void 0:s.defaultSort),i.setFieldsValue({sortBy:c.name,sortByType:typeof((o=c.report)==null?void 0:o.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}))),U(!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:[G.map(e=>{var s,o,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:(o=e.report)==null?void 0:o.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(Q.default,{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(v.default,{className:"mt-3",type:"primary",block:!0,htmlType:"submit",disabled:x,children:"Submit"})]}),t.jsxRuntimeExports.jsxs(r.Space,{children:[!!j&&t.jsxRuntimeExports.jsx(J.PrintButton,{disabled:x||!d.length,onClick:()=>j==null?void 0:j({tableId:"#crud-table table",data:d,fields:R.map(e=>({...e,render:I.getRendererValueCrudViewer(e)}))})}),!!b&&t.jsxRuntimeExports.jsx(v.default,{disabled:x||!d.length,onClick:()=>b==null?void 0:b({tableId:"#crud-table table",data:d,fields:R.map(e=>({...e,render:I.getRendererValueCrudViewer(e)}))}),icon:t.jsxRuntimeExports.jsx(D.FileExcelOutlined,{}),className:`group
|
|
2
|
+
${x||!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"})]}),O,t.jsxRuntimeExports.jsx(H.default,{minusHeight:M,data:d,size:L,fields:R,idField:A,loadingData:x,paginateProps:_,viewable:!1})]})})}exports.default=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";
|
|
2
3
|
import { Form as j, Space as L, Row as G, Col as f, Radio as S } from "antd";
|
|
3
|
-
import { useMemo as
|
|
4
|
+
import { useMemo as Y, useState as x, useCallback as Z, useEffect as B } from "react";
|
|
4
5
|
import R from "./CrudField.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
6
|
+
import E from "./view/CrudViewer.js";
|
|
7
|
+
import O from "../common/button/Button.js";
|
|
7
8
|
import { PrintButton as k } from "../common/button/PrintButton.js";
|
|
8
|
-
import { SelectFieldInReport as
|
|
9
|
-
import
|
|
10
|
-
import { getRendererValueCrudViewer as
|
|
11
|
-
|
|
12
|
-
const z = { lg: 6, md: 8, sm: 12, xs: 24 }, re = { lg: 12, md: 16, sm: 24, xs: 24 };
|
|
9
|
+
import { SelectFieldInReport as P } from "../common/report/SelectFieldInReport.js";
|
|
10
|
+
import ee from "../common/select/SelectComponent.js";
|
|
11
|
+
import { getRendererValueCrudViewer as _ } from "./view/CrudViewerUtil.js";
|
|
12
|
+
const $ = { 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: i,
|
|
16
|
+
idField: z,
|
|
17
17
|
loadingData: c,
|
|
18
|
-
onSubmit:
|
|
19
|
-
paginateProps:
|
|
20
|
-
size:
|
|
18
|
+
onSubmit: F,
|
|
19
|
+
paginateProps: D,
|
|
20
|
+
size: H,
|
|
21
21
|
onClickPrint: b,
|
|
22
22
|
onClickExcelExport: h,
|
|
23
|
-
minusHeight:
|
|
24
|
-
extraSearchFields:
|
|
23
|
+
minusHeight: J,
|
|
24
|
+
extraSearchFields: w,
|
|
25
25
|
searchOnMount: N,
|
|
26
|
-
summary:
|
|
26
|
+
summary: K
|
|
27
27
|
}) {
|
|
28
|
-
const { searchable:
|
|
28
|
+
const { searchable: M, selectable: d, sortable: T, defaultSort: m } = Y(() => {
|
|
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, v] = x(
|
|
46
46
|
[]
|
|
47
|
-
), g =
|
|
47
|
+
), g = Z(
|
|
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
|
+
}), v(
|
|
59
59
|
n.filter((u) => l.includes(u.name)).map((u) => ({ ...u, hideInTable: !1 }))
|
|
60
|
-
),
|
|
60
|
+
), F({ showFields: l, sortBy: p, ...o });
|
|
61
61
|
},
|
|
62
|
-
[n,
|
|
63
|
-
), [a] = j.useForm(), [
|
|
62
|
+
[n, F]
|
|
63
|
+
), [a] = j.useForm(), [C, Q] = x(!1), [I, U] = x(!0);
|
|
64
64
|
return B(() => {
|
|
65
|
-
if (N &&
|
|
65
|
+
if (N && I) {
|
|
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, I, 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 (C) {
|
|
81
|
+
const e = d.filter((t) => t.alreadySelected).map((t) => t.id);
|
|
82
|
+
v(
|
|
83
83
|
n.filter((t) => e.includes(t.name)).map((t) => ({ ...t, hideInTable: !1 }))
|
|
84
84
|
), Q(!1);
|
|
85
85
|
}
|
|
86
|
-
}, [n,
|
|
86
|
+
}, [n, C, d]), /* @__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
|
+
M.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 ?? $,
|
|
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
|
+
!!(d != null && d.length) && /* @__PURE__ */ r.jsx(f, { ...re, children: /* @__PURE__ */ r.jsx(
|
|
130
|
+
P,
|
|
131
131
|
{
|
|
132
|
-
items:
|
|
132
|
+
items: d,
|
|
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, { ...$, children: /* @__PURE__ */ r.jsx(
|
|
140
|
+
ee,
|
|
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
|
+
w ? w(a) : null
|
|
188
188
|
] }),
|
|
189
189
|
/* @__PURE__ */ r.jsx(
|
|
190
|
-
|
|
190
|
+
O,
|
|
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 || !i.length,
|
|
206
206
|
onClick: () => b == null ? void 0 : b({
|
|
207
207
|
tableId: "#crud-table table",
|
|
208
|
-
data:
|
|
208
|
+
data: i,
|
|
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
|
+
O,
|
|
218
218
|
{
|
|
219
|
-
disabled: c || !
|
|
219
|
+
disabled: c || !i.length,
|
|
220
220
|
onClick: () => h == null ? void 0 : h({
|
|
221
221
|
tableId: "#crud-table table",
|
|
222
|
-
data:
|
|
222
|
+
data: i,
|
|
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(X, {}),
|
|
229
229
|
className: `group
|
|
230
|
-
${c || !
|
|
230
|
+
${c || !i.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
|
+
K,
|
|
238
238
|
/* @__PURE__ */ r.jsx(
|
|
239
|
-
|
|
239
|
+
E,
|
|
240
240
|
{
|
|
241
|
-
minusHeight:
|
|
242
|
-
data:
|
|
243
|
-
size:
|
|
241
|
+
minusHeight: J,
|
|
242
|
+
data: i,
|
|
243
|
+
size: H,
|
|
244
244
|
fields: y,
|
|
245
|
-
idField:
|
|
245
|
+
idField: z,
|
|
246
246
|
loadingData: c,
|
|
247
|
-
paginateProps:
|
|
247
|
+
paginateProps: D,
|
|
248
248
|
viewable: !1
|
|
249
249
|
}
|
|
250
250
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("../../../_virtual/jsx-runtime.cjs"),o=require("react"),i=require("antd"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs"),o=require("react"),E=require("@ant-design/icons"),i=require("antd"),a=require("./CrudField.cjs"),q=require("../common/button/Button.cjs");function M({searchFields:t=[],fields:m,searchOnChange:d,onSearch:b,searchDefaultValues:g,searchFieldsCustomColumnProps:r}){const R=o.useMemo(()=>t.map(n=>typeof n=="string"?{...m.find(y=>n===y.name),required:!1}:{...m.find(f=>(n==null?void 0:n.name)===f.name),...n}).filter(n=>n&&!(n!=null&&n.hidden)),[t,m]),j=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]),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]),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(),x=o.useCallback(async n=>{if((n||d)&&b){const l=await u.validateFields();b(l)}},[u,b,d]);return o.useEffect(()=>{g&&(u.setFieldsValue(g),x(!0))},[u,g]),t!=null&&t.length?e.jsxRuntimeExports.jsx(i.Form,{form:u,onFinish:()=>x(!0),layout:"vertical",className:"mb-2",onChange:()=>x(!1),children:e.jsxRuntimeExports.jsxs(i.Row,{gutter:[4,8],className:"w-100",children:[R.map((n,l)=>{const f=(r==null?void 0:r[l])??{md:j.field,sm:p.field,xs:s.field};return o.createElement(i.Col,{...f,key:`search_field_${String(n.name)}`,className:"align-self-end"},e.jsxRuntimeExports.jsx(a.default,{...n,readonly:!1,fieldClassName:"mb-0"}))}),e.jsxRuntimeExports.jsx(i.Col,{md:j.button,sm:p.button,xs:s.button,style:{alignSelf:"end"},children:e.jsxRuntimeExports.jsx(q.default,{type:"primary",htmlType:"submit",block:!0,icon:e.jsxRuntimeExports.jsx(E.SearchOutlined,{})})})]})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})}exports.default=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 {
|
|
2
|
+
import { useMemo as l, useCallback as k, useEffect as E, createElement as v } from "react";
|
|
3
|
+
import { SearchOutlined as R } from "@ant-design/icons";
|
|
4
|
+
import { Form as y, Row as S, Col as w } from "antd";
|
|
4
5
|
import _ from "./CrudField.js";
|
|
5
6
|
import q from "../common/button/Button.js";
|
|
6
|
-
|
|
7
|
-
function A({
|
|
7
|
+
function G({
|
|
8
8
|
searchFields: t = [],
|
|
9
9
|
fields: e,
|
|
10
|
-
searchOnChange:
|
|
11
|
-
onSearch:
|
|
12
|
-
searchDefaultValues:
|
|
13
|
-
searchFieldsCustomColumnProps:
|
|
10
|
+
searchOnChange: p,
|
|
11
|
+
onSearch: i,
|
|
12
|
+
searchDefaultValues: b,
|
|
13
|
+
searchFieldsCustomColumnProps: g
|
|
14
14
|
}) {
|
|
15
15
|
const N = l(
|
|
16
16
|
() => t.map((n) => typeof n == "string" ? {
|
|
17
|
-
...e.find((
|
|
17
|
+
...e.find((a) => n === a.name),
|
|
18
18
|
required: !1
|
|
19
19
|
} : {
|
|
20
20
|
...e.find(
|
|
@@ -32,33 +32,33 @@ function A({
|
|
|
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(), r = k(
|
|
36
36
|
async (n) => {
|
|
37
|
-
if ((n ||
|
|
37
|
+
if ((n || p) && i) {
|
|
38
38
|
const m = await f.validateFields();
|
|
39
|
-
|
|
39
|
+
i(m);
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
[f,
|
|
42
|
+
[f, i, p]
|
|
43
43
|
);
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
}, [f,
|
|
44
|
+
return E(() => {
|
|
45
|
+
b && (f.setFieldsValue(b), r(!0));
|
|
46
|
+
}, [f, b]), t != null && t.length ? /* @__PURE__ */ o.jsx(
|
|
47
47
|
y,
|
|
48
48
|
{
|
|
49
49
|
form: f,
|
|
50
|
-
onFinish: () =>
|
|
50
|
+
onFinish: () => r(!0),
|
|
51
51
|
layout: "vertical",
|
|
52
52
|
className: "mb-2",
|
|
53
|
-
onChange: () =>
|
|
54
|
-
children: /* @__PURE__ */ o.jsxs(
|
|
53
|
+
onChange: () => r(!1),
|
|
54
|
+
children: /* @__PURE__ */ o.jsxs(S, { gutter: [4, 8], className: "w-100", children: [
|
|
55
55
|
N.map((n, m) => {
|
|
56
|
-
const u = (
|
|
56
|
+
const u = (g == null ? void 0 : g[m]) ?? {
|
|
57
57
|
md: x.field,
|
|
58
58
|
sm: d.field,
|
|
59
59
|
xs: j.field
|
|
60
60
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ v(
|
|
62
62
|
w,
|
|
63
63
|
{
|
|
64
64
|
...u,
|
|
@@ -81,7 +81,7 @@ function A({
|
|
|
81
81
|
type: "primary",
|
|
82
82
|
htmlType: "submit",
|
|
83
83
|
block: !0,
|
|
84
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
84
|
+
icon: /* @__PURE__ */ o.jsx(R, {})
|
|
85
85
|
}
|
|
86
86
|
)
|
|
87
87
|
}
|
|
@@ -91,5 +91,5 @@ function A({
|
|
|
91
91
|
) : /* @__PURE__ */ o.jsx(o.Fragment, {});
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
94
|
-
|
|
94
|
+
G 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 x=require("@ant-design/icons"),h=require("antd"),M=require("mime"),u=require("react"),B=require("react-i18next"),H=require("../../locale/hooks/translation-constants.cjs"),z=require("../../util/ValidationUtil.cjs"),w=require("../common/button/Button.cjs"),G=require("../common/layout/VerticalSpace.cjs");function J({name:l,label:t,required:r,provider:s,onUploading:i,onRemoved:d,fieldClassName:p,accept:g,rules:D,maxCount:C=1,block:N,...k}){const j=h.Form.useFormInstance(),f=h.Form.useWatch(l,j),[P,O]=u.useState(!1),[q,U]=u.useState(!1),_=u.useCallback(async n=>{var a,o;try{const{file:c}=n,R=c.name;O(!0),U(!0),i==null||i(!0);const F=R??"",b=F.split("."),L=b[b.length-1],W=s.generateFileName(F),I=`${await s.getInitialPath()}/${W}.${L}`;console.log({filePath:I});const V=await s.upload({...c,originFileObj:c},I);i==null||i(!1),j.setFieldValue(l,V),(a=n.onSuccess)==null||a.call(n,V)}catch(c){(o=n.onError)==null||o.call(n,c)}finally{O(!1)}},[j,l,i,s]),[E,S]=u.useState([]);u.useEffect(()=>{!q&&f&&Promise.all((Array.isArray(f)?f:[f]).map(async n=>{const a=M.getType(n),o=n.split("/").pop(),c=await s.getRealUrl(n);return{uid:n,url:c,type:a,name:o}})).then(n=>S(()=>{const a=n.map(({url:o,type:c,uid:R,name:F})=>({uid:R,url:o,type:c,response:R,thumbUrl:o,name:F}));return console.log(a),a}))},[f,q,P,s]);const $=u.useCallback(async n=>{const a=n.response,o=a||j.getFieldValue(l);await s.delete(o),d==null||d(),n&&j.setFieldsValue({[l]:null})},[j,l,d,s]);return e.jsxRuntimeExports.jsxs(h.Form.Item,{label:t,required:r,name:l,className:p,rules:[...r?z.default.required(t):[],...D??[]],children:[e.jsxRuntimeExports.jsx("input",{hidden:!0}),e.jsxRuntimeExports.jsx(h.Upload,{...k,fileList:E,className:((E==null?void 0:E.length)??0)>=C?"hide-upload":"",maxCount:C,customRequest:_,onRemove:$,listType:"picture",onChange:({fileList:n})=>{S(n)},style:N?{width:"100%"}:void 0,children:e.jsxRuntimeExports.jsx(w.default,{loading:P,children:"Upload File"})})]})}const K=({provider:l,value:t})=>{const[r,s]=u.useState();return u.useEffect(()=>{t&&l.getRealUrl(t).then(i=>{s({mimeType:M.getType(t),url:i,fileName:t.split("/").pop()??t})})},[l,t]),r?e.jsxRuntimeExports.jsx(A,{fileName:r.fileName,url:r==null?void 0:r.url,mimeType:r==null?void 0:r.mimeType}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})},A=({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(x.FileImageOutlined,{});case"pdf":return e.jsxRuntimeExports.jsx(x.FilePdfOutlined,{});case"word":return e.jsxRuntimeExports.jsx(x.FileWordOutlined,{});case"text":return e.jsxRuntimeExports.jsx(x.FileTextOutlined,{});case"excel":return e.jsxRuntimeExports.jsx(x.FileExcelOutlined,{});case"presentation":return e.jsxRuntimeExports.jsx(x.FilePptOutlined,{});default:return e.jsxRuntimeExports.jsx(x.FileOutlined,{})}},[s]),[d,p]=u.useState(!1),{t:g}=B.useTranslation(H.TRANSLATION_NAMESPACE);return s!=="file"&&s!=="text"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(h.Modal,{open:d,title:r,onCancel:()=>p(!1),footer:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),width:"100%",style:{top:"8px",minHeight:"700px"},destroyOnClose:!0,children:e.jsxRuntimeExports.jsxs(G.default,{children:[e.jsxRuntimeExports.jsx(w.default,{tooltip:r,icon:e.jsxRuntimeExports.jsx(x.ExportOutlined,{}),target:"_blank",href:l,style:{textDecoration:"none"},children:g("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(w.default,{tooltip:r,icon:i,shape:"circle",onClick:()=>p(!0)})]}):e.jsxRuntimeExports.jsx(w.default,{tooltip:r,icon:i,target:"_blank",href:l,shape:"circle"})};exports.FileCellValue=A;exports.FileCrudCellValue=K;exports.default=J;
|