@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,126 +1,119 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import m from "../../../node_modules/@ant-design/icons/es/icons/FileWordOutlined.js";
|
|
15
|
-
import v from "../../../node_modules/@ant-design/icons/es/icons/FilePdfOutlined.js";
|
|
16
|
-
import y from "../../../node_modules/@ant-design/icons/es/icons/FileImageOutlined.js";
|
|
17
|
-
import { useTranslation as T } from "../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
18
|
-
import tt from "../../../node_modules/@ant-design/icons/es/icons/ExportOutlined.js";
|
|
19
|
-
function It({
|
|
20
|
-
name: o,
|
|
3
|
+
import { FileOutlined as H, FilePptOutlined as z, FileExcelOutlined as G, FileTextOutlined as J, FileWordOutlined as K, FilePdfOutlined as Q, FileImageOutlined as X, ExportOutlined as Y } from "@ant-design/icons";
|
|
4
|
+
import { Form as g, Upload as Z, Modal as v } from "antd";
|
|
5
|
+
import S from "mime";
|
|
6
|
+
import { useState as h, useCallback as N, useEffect as U, useMemo as M } from "react";
|
|
7
|
+
import { useTranslation as y } from "react-i18next";
|
|
8
|
+
import { TRANSLATION_NAMESPACE as m } from "../../locale/hooks/translation-constants.js";
|
|
9
|
+
import T from "../../util/ValidationUtil.js";
|
|
10
|
+
import w from "../common/button/Button.js";
|
|
11
|
+
import tt from "../common/layout/VerticalSpace.js";
|
|
12
|
+
function ht({
|
|
13
|
+
name: n,
|
|
21
14
|
label: t,
|
|
22
15
|
required: r,
|
|
23
16
|
provider: s,
|
|
24
|
-
onUploading:
|
|
25
|
-
onRemoved:
|
|
17
|
+
onUploading: a,
|
|
18
|
+
onRemoved: u,
|
|
26
19
|
fieldClassName: x,
|
|
27
|
-
accept:
|
|
28
|
-
rules:
|
|
29
|
-
maxCount:
|
|
30
|
-
block:
|
|
31
|
-
...
|
|
20
|
+
accept: C,
|
|
21
|
+
rules: k,
|
|
22
|
+
maxCount: P = 1,
|
|
23
|
+
block: $,
|
|
24
|
+
..._
|
|
32
25
|
}) {
|
|
33
|
-
const
|
|
34
|
-
async (
|
|
35
|
-
var c,
|
|
26
|
+
const d = g.useFormInstance(), f = g.useWatch(n, d), [O, I] = h(!1), [V, L] = h(!1), R = N(
|
|
27
|
+
async (l) => {
|
|
28
|
+
var c, o;
|
|
36
29
|
try {
|
|
37
|
-
const { file: i } =
|
|
38
|
-
|
|
39
|
-
const
|
|
30
|
+
const { file: i } = l, p = i.name;
|
|
31
|
+
I(!0), L(!0), a == null || a(!0);
|
|
32
|
+
const F = p ?? "", E = F.split("."), q = E[E.length - 1], B = s.generateFileName(F), A = `${await s.getInitialPath()}/${B}.${q}`;
|
|
40
33
|
console.log({ filePath: A });
|
|
41
34
|
const D = await s.upload(
|
|
42
35
|
{ ...i, originFileObj: i },
|
|
43
36
|
A
|
|
44
37
|
);
|
|
45
|
-
|
|
38
|
+
a == null || a(!1), d.setFieldValue(n, D), (c = l.onSuccess) == null || c.call(l, D);
|
|
46
39
|
} catch (i) {
|
|
47
|
-
(
|
|
40
|
+
(o = l.onError) == null || o.call(l, i);
|
|
48
41
|
} finally {
|
|
49
|
-
|
|
42
|
+
I(!1);
|
|
50
43
|
}
|
|
51
44
|
},
|
|
52
|
-
[
|
|
53
|
-
), [
|
|
54
|
-
|
|
55
|
-
!
|
|
56
|
-
(Array.isArray(
|
|
57
|
-
async (
|
|
58
|
-
const c =
|
|
45
|
+
[d, n, a, s]
|
|
46
|
+
), [j, b] = h([]);
|
|
47
|
+
U(() => {
|
|
48
|
+
!V && f && Promise.all(
|
|
49
|
+
(Array.isArray(f) ? f : [f]).map(
|
|
50
|
+
async (l) => {
|
|
51
|
+
const c = S.getType(l), o = l.split("/").pop(), i = await s.getRealUrl(l);
|
|
59
52
|
return {
|
|
60
|
-
uid:
|
|
53
|
+
uid: l,
|
|
61
54
|
url: i,
|
|
62
55
|
type: c,
|
|
63
|
-
name:
|
|
56
|
+
name: o
|
|
64
57
|
};
|
|
65
58
|
}
|
|
66
59
|
)
|
|
67
|
-
).then((
|
|
68
|
-
const c =
|
|
60
|
+
).then((l) => b(() => {
|
|
61
|
+
const c = l.map(({ url: o, type: i, uid: p, name: F }) => ({ uid: p, url: o, type: i, response: p, thumbUrl: o, name: F }));
|
|
69
62
|
return console.log(c), c;
|
|
70
63
|
}));
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
73
|
-
async (
|
|
74
|
-
const c =
|
|
75
|
-
await s.delete(
|
|
64
|
+
}, [f, V, O, s]);
|
|
65
|
+
const W = N(
|
|
66
|
+
async (l) => {
|
|
67
|
+
const c = l.response, o = c || d.getFieldValue(n);
|
|
68
|
+
await s.delete(o), u == null || u(), l && d.setFieldsValue({ [n]: null });
|
|
76
69
|
},
|
|
77
|
-
[
|
|
70
|
+
[d, n, u, s]
|
|
78
71
|
);
|
|
79
72
|
return /* @__PURE__ */ e.jsxs(
|
|
80
|
-
|
|
73
|
+
g.Item,
|
|
81
74
|
{
|
|
82
75
|
label: t,
|
|
83
76
|
required: r,
|
|
84
|
-
name:
|
|
77
|
+
name: n,
|
|
85
78
|
className: x,
|
|
86
79
|
rules: [
|
|
87
|
-
...r ?
|
|
88
|
-
...
|
|
80
|
+
...r ? T.required(t) : [],
|
|
81
|
+
...k ?? []
|
|
89
82
|
],
|
|
90
83
|
children: [
|
|
91
84
|
/* @__PURE__ */ e.jsx("input", { hidden: !0 }),
|
|
92
85
|
/* @__PURE__ */ e.jsx(
|
|
93
|
-
|
|
86
|
+
Z,
|
|
94
87
|
{
|
|
95
|
-
...
|
|
96
|
-
fileList:
|
|
97
|
-
className: ((
|
|
98
|
-
maxCount:
|
|
99
|
-
customRequest:
|
|
100
|
-
onRemove:
|
|
88
|
+
..._,
|
|
89
|
+
fileList: j,
|
|
90
|
+
className: ((j == null ? void 0 : j.length) ?? 0) >= P ? "hide-upload" : "",
|
|
91
|
+
maxCount: P,
|
|
92
|
+
customRequest: R,
|
|
93
|
+
onRemove: W,
|
|
101
94
|
listType: "picture",
|
|
102
|
-
onChange: ({ fileList:
|
|
103
|
-
|
|
95
|
+
onChange: ({ fileList: l }) => {
|
|
96
|
+
b(l);
|
|
104
97
|
},
|
|
105
|
-
style:
|
|
106
|
-
children: /* @__PURE__ */ e.jsx(
|
|
98
|
+
style: $ ? { width: "100%" } : void 0,
|
|
99
|
+
children: /* @__PURE__ */ e.jsx(w, { loading: O, children: "Upload File" })
|
|
107
100
|
}
|
|
108
101
|
)
|
|
109
102
|
]
|
|
110
103
|
}
|
|
111
104
|
);
|
|
112
105
|
}
|
|
113
|
-
const
|
|
114
|
-
const [r, s] =
|
|
115
|
-
return
|
|
116
|
-
t &&
|
|
106
|
+
const xt = ({ provider: n, value: t }) => {
|
|
107
|
+
const [r, s] = h();
|
|
108
|
+
return U(() => {
|
|
109
|
+
t && n.getRealUrl(t).then((a) => {
|
|
117
110
|
s({
|
|
118
|
-
mimeType:
|
|
119
|
-
url:
|
|
111
|
+
mimeType: S.getType(t),
|
|
112
|
+
url: a,
|
|
120
113
|
fileName: t.split("/").pop() ?? t
|
|
121
114
|
});
|
|
122
115
|
});
|
|
123
|
-
}, [
|
|
116
|
+
}, [n, t]), r ? /* @__PURE__ */ e.jsx(
|
|
124
117
|
et,
|
|
125
118
|
{
|
|
126
119
|
fileName: r.fileName,
|
|
@@ -128,58 +121,58 @@ const Ct = ({ provider: o, value: t }) => {
|
|
|
128
121
|
mimeType: r == null ? void 0 : r.mimeType
|
|
129
122
|
}
|
|
130
123
|
) : /* @__PURE__ */ e.jsx(e.Fragment, {});
|
|
131
|
-
}, et = ({ url:
|
|
132
|
-
const s =
|
|
124
|
+
}, et = ({ url: n, mimeType: t = "", fileName: r }) => {
|
|
125
|
+
const s = M(() => 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]), a = M(() => {
|
|
133
126
|
switch (s) {
|
|
134
127
|
case "image":
|
|
135
|
-
return /* @__PURE__ */ e.jsx(
|
|
128
|
+
return /* @__PURE__ */ e.jsx(X, {});
|
|
136
129
|
case "pdf":
|
|
137
|
-
return /* @__PURE__ */ e.jsx(
|
|
130
|
+
return /* @__PURE__ */ e.jsx(Q, {});
|
|
138
131
|
case "word":
|
|
139
|
-
return /* @__PURE__ */ e.jsx(
|
|
132
|
+
return /* @__PURE__ */ e.jsx(K, {});
|
|
140
133
|
case "text":
|
|
141
|
-
return /* @__PURE__ */ e.jsx(
|
|
134
|
+
return /* @__PURE__ */ e.jsx(J, {});
|
|
142
135
|
case "excel":
|
|
143
|
-
return /* @__PURE__ */ e.jsx(
|
|
136
|
+
return /* @__PURE__ */ e.jsx(G, {});
|
|
144
137
|
case "presentation":
|
|
145
|
-
return /* @__PURE__ */ e.jsx(
|
|
138
|
+
return /* @__PURE__ */ e.jsx(z, {});
|
|
146
139
|
default:
|
|
147
|
-
return /* @__PURE__ */ e.jsx(
|
|
140
|
+
return /* @__PURE__ */ e.jsx(H, {});
|
|
148
141
|
}
|
|
149
|
-
}, [s]), [
|
|
142
|
+
}, [s]), [u, x] = h(!1), { t: C } = y(m);
|
|
150
143
|
return s !== "file" && s !== "text" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
151
144
|
/* @__PURE__ */ e.jsx(
|
|
152
|
-
|
|
145
|
+
v,
|
|
153
146
|
{
|
|
154
|
-
open:
|
|
147
|
+
open: u,
|
|
155
148
|
title: r,
|
|
156
149
|
onCancel: () => x(!1),
|
|
157
150
|
footer: /* @__PURE__ */ e.jsx(e.Fragment, {}),
|
|
158
151
|
width: "100%",
|
|
159
152
|
style: { top: "8px", minHeight: "700px" },
|
|
160
153
|
destroyOnClose: !0,
|
|
161
|
-
children: /* @__PURE__ */ e.jsxs(
|
|
154
|
+
children: /* @__PURE__ */ e.jsxs(tt, { children: [
|
|
162
155
|
/* @__PURE__ */ e.jsx(
|
|
163
|
-
|
|
156
|
+
w,
|
|
164
157
|
{
|
|
165
158
|
tooltip: r,
|
|
166
|
-
icon: /* @__PURE__ */ e.jsx(
|
|
159
|
+
icon: /* @__PURE__ */ e.jsx(Y, {}),
|
|
167
160
|
target: "_blank",
|
|
168
|
-
href:
|
|
161
|
+
href: n,
|
|
169
162
|
style: { textDecoration: "none" },
|
|
170
|
-
children:
|
|
163
|
+
children: C("str.openInNewTab")
|
|
171
164
|
}
|
|
172
165
|
),
|
|
173
|
-
s === "image" ? /* @__PURE__ */ e.jsx("img", { src:
|
|
166
|
+
s === "image" ? /* @__PURE__ */ e.jsx("img", { src: n, alt: r, style: { width: "100%" } }) : s === "pdf" ? /* @__PURE__ */ e.jsxs("iframe", { title: r, src: n, width: "100%", height: "700px", children: [
|
|
174
167
|
"This browser does not support PDFs. Please download the PDF to view it:",
|
|
175
|
-
/* @__PURE__ */ e.jsx("a", { href:
|
|
168
|
+
/* @__PURE__ */ e.jsx("a", { href: n, children: "Download PDF" }),
|
|
176
169
|
"."
|
|
177
170
|
] }) : /* @__PURE__ */ e.jsxs(
|
|
178
171
|
"iframe",
|
|
179
172
|
{
|
|
180
173
|
title: r,
|
|
181
174
|
src: `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
|
|
182
|
-
|
|
175
|
+
n
|
|
183
176
|
)}`,
|
|
184
177
|
width: "100%",
|
|
185
178
|
height: "700px",
|
|
@@ -189,7 +182,7 @@ const Ct = ({ provider: o, value: t }) => {
|
|
|
189
182
|
". Please download the",
|
|
190
183
|
s.toUpperCase(),
|
|
191
184
|
" to view it:",
|
|
192
|
-
/* @__PURE__ */ e.jsxs("a", { href:
|
|
185
|
+
/* @__PURE__ */ e.jsxs("a", { href: n, children: [
|
|
193
186
|
"Download ",
|
|
194
187
|
s.toUpperCase()
|
|
195
188
|
] }),
|
|
@@ -201,27 +194,27 @@ const Ct = ({ provider: o, value: t }) => {
|
|
|
201
194
|
}
|
|
202
195
|
),
|
|
203
196
|
/* @__PURE__ */ e.jsx(
|
|
204
|
-
|
|
197
|
+
w,
|
|
205
198
|
{
|
|
206
199
|
tooltip: r,
|
|
207
|
-
icon:
|
|
200
|
+
icon: a,
|
|
208
201
|
shape: "circle",
|
|
209
202
|
onClick: () => x(!0)
|
|
210
203
|
}
|
|
211
204
|
)
|
|
212
205
|
] }) : /* @__PURE__ */ e.jsx(
|
|
213
|
-
|
|
206
|
+
w,
|
|
214
207
|
{
|
|
215
208
|
tooltip: r,
|
|
216
|
-
icon:
|
|
209
|
+
icon: a,
|
|
217
210
|
target: "_blank",
|
|
218
|
-
href:
|
|
211
|
+
href: n,
|
|
219
212
|
shape: "circle"
|
|
220
213
|
}
|
|
221
214
|
);
|
|
222
215
|
};
|
|
223
216
|
export {
|
|
224
217
|
et as FileCellValue,
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
xt as FileCrudCellValue,
|
|
219
|
+
ht as default
|
|
227
220
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var S=Object.defineProperty;var _=(e,a,t)=>a in e?S(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t;var
|
|
1
|
+
"use strict";var S=Object.defineProperty;var _=(e,a,t)=>a in e?S(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t;var h=(e,a,t)=>_(e,typeof a!="symbol"?a+"":a,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const O=require("@ant-design/icons"),u=require("antd"),I=require("path-browserify"),i=require("react"),k=require("../../util/NumberUtil.cjs"),A=require("../../util/ValidationUtil.cjs"),D=require("uuid"),M=require("../common/picker/ImagePicker.cjs");class p{}class T extends p{constructor(t="",s=""){super();h(this,"rootPath");h(this,"subPath");this.rootPath=t,this.subPath=s}cloneFilePath(t){const s=I.parse(t),r=`${s.name}_cloned_${k.default.randInt(1e5)}`;return I.format({dir:s.dir,ext:s.ext,name:r})}generateFileName(t){return`${t.split(".")[0]}_${D.v4().replace("-","")}`}}function W({name:e,label:a,required:t,provider:s,onUploading:r,aspectRatio:j,onRemoved:o,fieldClassName:g,hideLabel:q=!1,listType:w}){const c=u.Form.useFormInstance(),f=u.Form.useWatch(e,c),[F,C]=i.useState(!1),P=i.useCallback(async(n,N)=>{if(N){r==null||r(!0);const m=n.name,x=m.split("."),V=x[x.length-1],y=s.generateFileName(m),$=`${await s.getInitialPath()}/${y}.${V}`,b=await s.upload(n,$);C(!0),r==null||r(!1),c.setFieldValue(e,b)}else{console.log(n);const m=c.getFieldsValue(),x=await s.delete(m[e]);o==null||o(),x&&c.setFieldsValue({[e]:null})}},[c,e,o,r,s]),[d,E]=i.useState();return i.useEffect(()=>{!F&&f?s.getRealUrl(f).then(E):E(d)},[f,F,s,d]),l.jsxRuntimeExports.jsx(l.jsxRuntimeExports.Fragment,{children:l.jsxRuntimeExports.jsxs(u.Form.Item,{rules:t?A.default.required(a):[],label:q?null:a,required:t,name:e,children:[l.jsxRuntimeExports.jsx(M.default,{noStyle:!0,listType:w,aspectRatio:j,values:d,onRemove:n=>{n&&P(n,!1)},onAdd:async n=>{n&&await P(n,!0)},className:g}),l.jsxRuntimeExports.jsx(u.Input,{hidden:!0})]})})}const z=({provider:e,value:a})=>{const[t,s]=i.useState();return i.useEffect(()=>{a&&e.getRealUrl(a).then(s)},[e,a]),t?l.jsxRuntimeExports.jsx(R,{url:t}):l.jsxRuntimeExports.jsx(l.jsxRuntimeExports.Fragment,{})},R=({url:e})=>l.jsxRuntimeExports.jsx(u.Avatar,{className:"p-0",children:l.jsxRuntimeExports.jsx(u.Image,{className:"m-0 p-0 position-relative",src:e,preview:{mask:l.jsxRuntimeExports.jsx(O.EyeOutlined,{})}})});exports.FileDownloadProvider=p;exports.FileUploadProvider=T;exports.ImageCellValue=R;exports.ImageCrudCellValue=z;exports.default=W;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (e, a, t) =>
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var _ = (e, a, t) => a in e ? O(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
|
|
3
|
+
var h = (e, a, t) => _(e, typeof a != "symbol" ? a + "" : a, t);
|
|
4
4
|
import { j as l } from "../../../_virtual/jsx-runtime.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import q from "
|
|
10
|
-
import z from "../../util/
|
|
11
|
-
import B from "
|
|
12
|
-
import G from "
|
|
13
|
-
import H from "
|
|
6
|
+
import { EyeOutlined as A } from "@ant-design/icons";
|
|
7
|
+
import { Form as x, Input as S, Avatar as D, Image as W } from "antd";
|
|
8
|
+
import N from "path-browserify";
|
|
9
|
+
import { useState as F, useCallback as q, useEffect as d } from "react";
|
|
10
|
+
import z from "../../util/NumberUtil.js";
|
|
11
|
+
import B from "../../util/ValidationUtil.js";
|
|
12
|
+
import { v4 as G } from "uuid";
|
|
13
|
+
import H from "../common/picker/ImagePicker.js";
|
|
14
14
|
class J {
|
|
15
15
|
}
|
|
16
16
|
class te extends J {
|
|
@@ -21,7 +21,7 @@ class te extends J {
|
|
|
21
21
|
this.rootPath = t, this.subPath = s;
|
|
22
22
|
}
|
|
23
23
|
cloneFilePath(t) {
|
|
24
|
-
const s = N.parse(t), r = `${s.name}_cloned_${
|
|
24
|
+
const s = N.parse(t), r = `${s.name}_cloned_${z.randInt(1e5)}`;
|
|
25
25
|
return N.format({
|
|
26
26
|
dir: s.dir,
|
|
27
27
|
ext: s.ext,
|
|
@@ -38,18 +38,18 @@ function se({
|
|
|
38
38
|
required: t,
|
|
39
39
|
provider: s,
|
|
40
40
|
onUploading: r,
|
|
41
|
-
aspectRatio:
|
|
41
|
+
aspectRatio: P,
|
|
42
42
|
onRemoved: c,
|
|
43
|
-
fieldClassName:
|
|
43
|
+
fieldClassName: w,
|
|
44
44
|
hideLabel: V = !1,
|
|
45
|
-
listType:
|
|
45
|
+
listType: y
|
|
46
46
|
}) {
|
|
47
|
-
const i = x.useFormInstance(), u = x.useWatch(e, i), [
|
|
48
|
-
async (n,
|
|
49
|
-
if (
|
|
47
|
+
const i = x.useFormInstance(), u = x.useWatch(e, i), [p, C] = F(!1), I = q(
|
|
48
|
+
async (n, $) => {
|
|
49
|
+
if ($) {
|
|
50
50
|
r == null || r(!0);
|
|
51
|
-
const m = n.name, o = m.split("."),
|
|
52
|
-
|
|
51
|
+
const m = n.name, o = m.split("."), g = o[o.length - 1], b = s.generateFileName(m), k = `${await s.getInitialPath()}/${b}.${g}`, E = await s.upload(n, k);
|
|
52
|
+
C(!0), r == null || r(!1), i.setFieldValue(e, E);
|
|
53
53
|
} else {
|
|
54
54
|
console.log(n);
|
|
55
55
|
const m = i.getFieldsValue(), o = await s.delete(m[e]);
|
|
@@ -58,49 +58,49 @@ function se({
|
|
|
58
58
|
},
|
|
59
59
|
[i, e, c, r, s]
|
|
60
60
|
), [f, j] = F();
|
|
61
|
-
return
|
|
62
|
-
!
|
|
63
|
-
}, [u,
|
|
61
|
+
return d(() => {
|
|
62
|
+
!p && u ? s.getRealUrl(u).then(j) : j(f);
|
|
63
|
+
}, [u, p, s, f]), /* @__PURE__ */ l.jsx(l.Fragment, { children: /* @__PURE__ */ l.jsxs(
|
|
64
64
|
x.Item,
|
|
65
65
|
{
|
|
66
|
-
rules: t ?
|
|
66
|
+
rules: t ? B.required(a) : [],
|
|
67
67
|
label: V ? null : a,
|
|
68
68
|
required: t,
|
|
69
69
|
name: e,
|
|
70
70
|
children: [
|
|
71
71
|
/* @__PURE__ */ l.jsx(
|
|
72
|
-
|
|
72
|
+
H,
|
|
73
73
|
{
|
|
74
74
|
noStyle: !0,
|
|
75
|
-
listType:
|
|
76
|
-
aspectRatio:
|
|
75
|
+
listType: y,
|
|
76
|
+
aspectRatio: P,
|
|
77
77
|
values: f,
|
|
78
78
|
onRemove: (n) => {
|
|
79
|
-
n &&
|
|
79
|
+
n && I(n, !1);
|
|
80
80
|
},
|
|
81
81
|
onAdd: async (n) => {
|
|
82
|
-
n && await
|
|
82
|
+
n && await I(n, !0);
|
|
83
83
|
},
|
|
84
|
-
className:
|
|
84
|
+
className: w
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
/* @__PURE__ */ l.jsx(
|
|
87
|
+
/* @__PURE__ */ l.jsx(S, { hidden: !0 })
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
) });
|
|
91
91
|
}
|
|
92
92
|
const ae = ({ provider: e, value: a }) => {
|
|
93
93
|
const [t, s] = F();
|
|
94
|
-
return
|
|
94
|
+
return d(() => {
|
|
95
95
|
a && e.getRealUrl(a).then(s);
|
|
96
96
|
}, [e, a]), t ? /* @__PURE__ */ l.jsx(K, { url: t }) : /* @__PURE__ */ l.jsx(l.Fragment, {});
|
|
97
|
-
}, K = ({ url: e }) => /* @__PURE__ */ l.jsx(
|
|
98
|
-
|
|
97
|
+
}, K = ({ url: e }) => /* @__PURE__ */ l.jsx(D, { className: "p-0", children: /* @__PURE__ */ l.jsx(
|
|
98
|
+
W,
|
|
99
99
|
{
|
|
100
100
|
className: "m-0 p-0 position-relative",
|
|
101
101
|
src: e,
|
|
102
102
|
preview: {
|
|
103
|
-
mask: /* @__PURE__ */ l.jsx(
|
|
103
|
+
mask: /* @__PURE__ */ l.jsx(A, {})
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("../../../../_virtual/jsx-runtime.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../../_virtual/jsx-runtime.cjs"),s=require("@ant-design/icons"),u=require("react"),i=require("react-i18next"),c=require("../../../locale/hooks/translation-constants.cjs"),a=require("./CrudImportComponent.cjs"),l=require("../../common/button/Button.cjs");function p(n){const{t:r}=i.useTranslation(c.TRANSLATION_NAMESPACE),[o,e]=u.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(a.default,{open:o,onCloseMethod:e,...n}),t.jsxRuntimeExports.jsx(l.default,{icon:t.jsxRuntimeExports.jsx(s.ImportOutlined,{}),onClick:()=>e(!0),children:r("str.import")})]})}exports.default=p;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { j as o } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import s from "
|
|
5
|
-
import i from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import { ImportOutlined as e } from "@ant-design/icons";
|
|
3
|
+
import { useState as p } from "react";
|
|
4
|
+
import { useTranslation as s } from "react-i18next";
|
|
5
|
+
import { TRANSLATION_NAMESPACE as i } from "../../../locale/hooks/translation-constants.js";
|
|
6
|
+
import u from "./CrudImportComponent.js";
|
|
7
|
+
import f from "../../common/button/Button.js";
|
|
8
8
|
function I(r) {
|
|
9
|
-
const { t:
|
|
9
|
+
const { t: m } = s(i), [n, t] = p(!1);
|
|
10
10
|
return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
11
11
|
/* @__PURE__ */ o.jsx(
|
|
12
|
-
|
|
12
|
+
u,
|
|
13
13
|
{
|
|
14
|
-
open:
|
|
14
|
+
open: n,
|
|
15
15
|
onCloseMethod: t,
|
|
16
16
|
...r
|
|
17
17
|
}
|
|
18
18
|
),
|
|
19
19
|
/* @__PURE__ */ o.jsx(
|
|
20
|
-
|
|
20
|
+
f,
|
|
21
21
|
{
|
|
22
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
22
|
+
icon: /* @__PURE__ */ o.jsx(e, {}),
|
|
23
23
|
onClick: () => t(!0),
|
|
24
|
-
children:
|
|
24
|
+
children: m("str.import")
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
27
|
] });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("../../../../_virtual/jsx-runtime.cjs"),M=require("
|
|
2
|
-
`,t=new Blob([e],{type:"text/csv;charset=utf-8;"});B.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../../../../_virtual/jsx-runtime.cjs"),g=require("@ant-design/icons"),M=require("papaparse"),d=require("antd"),B=require("file-saver"),o=require("react"),O=require("react-i18next"),V=require("../../../locale/hooks/translation-constants.cjs"),W=require("../view/CrudViewer.cjs"),_=require("../../../util/DateUtil.cjs"),L=require("../../common/button/Button.cjs"),z=require("../../common/button/ImportButton.cjs");function $({onCloseMethod:b,open:C,fields:T,importProps:a}){const[u,q]=o.useState([]),[E,h]=o.useState(!1),[w,v]=o.useState(0);o.useEffect(()=>{C||(q([]),h(!1))},[C]);const f=o.useMemo(()=>new Map(T.filter(e=>{var t;return!e.hidden&&!((t=e.importProps)!=null&&t.hidden)&&!e.readonly}).map(e=>[e.name,e])),[T]),S=o.useMemo(()=>Array.from(f.values()).flatMap(e=>{var t;return[e.name,...((t=e.importProps)==null?void 0:t.extraFields)??[]]}),[f]),D=o.useCallback(async function(){const e=`${S.join(",")}
|
|
2
|
+
`,t=new Blob([e],{type:"text/csv;charset=utf-8;"});B.saveAs(t,(a==null?void 0:a.name)+" - "+_.default.formatDateTimeWithSecond(new Date).replaceAll(":","-")+".csv")},[S,a==null?void 0:a.name]),{t:l}=O.useTranslation(V.TRANSLATION_NAMESPACE),I=o.useCallback(async e=>{const t=new FileReader;t.onerror=console.error,t.onload=async r=>{var n;const c=(n=r==null?void 0:r.target)==null?void 0:n.result,i=M.parse(c,{header:!0});q(i.data)},t.readAsText(e)},[]),y=o.useMemo(()=>{var t,r,c;let e=!1;for(const i of u)for(const[n,x]of f.entries()){const j=i[n],m=j||!isNaN(j);if(x.required&&!m)if((r=(t=x.importProps)==null?void 0:t.extraFields)!=null&&r.length)for(const R of((c=x.importProps)==null?void 0:c.extraFields)??[])if(i[R]||!isNaN(i[R])){e=!1;break}else return!0;else return!0}return e},[u,f]),p=o.useCallback(e=>(t,r)=>{var i,n,x;const c=t||!isNaN(t);if(e.required&&!c){let j=l("err.validation.required");if((n=(i=e.importProps)==null?void 0:i.extraFields)!=null&&n.length){const m=(x=e.importProps)==null?void 0:x.extraFields;(m==null?void 0:m.find(N=>!r[N]))&&(j="Either one of these fields is required: "+[e.name,...m].join(", "))}return s.jsxRuntimeExports.jsxs(d.Tooltip,{className:"d-flex",title:j,children:[s.jsxRuntimeExports.jsx(g.WarningTwoTone,{twoToneColor:"#ee9702"}),t]})}return t},[l]),A=o.useCallback(async e=>{v(e)},[]),k=o.useCallback(async()=>{try{h(!0),await a.onClickImport(u,A),b(!1)}finally{h(!1),v(0)}},[u,a,b,A]),F=o.useCallback(async()=>{y?d.Modal.warn({title:l("str.warning"),content:l("qus.importWithIssues"),okText:l("str.import"),onOk:k,okCancel:!0,closable:!0}):k()},[y,k,l]);return s.jsxRuntimeExports.jsxs(d.Modal,{title:[l("str.import"),a==null?void 0:a.name].filter(Boolean).join(" "),width:"100%",open:C,onOk:F,destroyOnClose:!0,onCancel:()=>b(!1),okText:l("str.import"),confirmLoading:E,okButtonProps:{disabled:!(u!=null&&u.length)},footer:(e,{OkBtn:t,CancelBtn:r})=>s.jsxRuntimeExports.jsxs(d.Space,{children:[s.jsxRuntimeExports.jsx(r,{}),s.jsxRuntimeExports.jsx(t,{}),y&&s.jsxRuntimeExports.jsx(d.Tooltip,{className:"d-flex",title:"Some fields have issue. Please review before submit.",children:s.jsxRuntimeExports.jsx(g.WarningTwoTone,{twoToneColor:"#ee9702"})})]}),children:[s.jsxRuntimeExports.jsxs(d.Space,{children:[s.jsxRuntimeExports.jsx(L.default,{onClick:D,icon:s.jsxRuntimeExports.jsx(g.DownloadOutlined,{}),children:l("str.downloadCsvTemplate")}),s.jsxRuntimeExports.jsx(z.ImportButton,{disabled:E,type:"default",onClick:I,accept:".csv",children:l("str.importCsvFile")})]}),s.jsxRuntimeExports.jsx(d.Spin,{spinning:E,indicator:w?s.jsxRuntimeExports.jsx(d.Progress,{type:"circle",percent:w*100,size:50,format:e=>`${parseInt(e)}%`}):void 0,children:s.jsxRuntimeExports.jsx(W.default,{data:u,bordered:!0,size:"small",fields:Array.from(f.values()).flatMap(e=>{var t,r,c,i;return e.type==="text"?[{...e,label:e.name,render:p(e)},...((r=(t=e.importProps)==null?void 0:t.extraFields)==null?void 0:r.map(n=>({...e,name:n,label:n,render:p(e)})))??[]]:e.type==="select"?[{...e,label:e.name,type:"text",render:p(e)},...((i=(c=e.importProps)==null?void 0:c.extraFields)==null?void 0:i.map(n=>({...e,name:n,label:n,type:"text",render:p(e)})))??[]]:[{...e,label:e.name,render:p(e)}]})})})]})}exports.default=$;
|