@kingteza/crud-component 1.0.50 → 1.0.52
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/App.d.ts +1 -0
- package/Play.d.ts +2 -0
- package/_virtual/_commonjsHelpers.cjs.js +1 -1
- package/_virtual/_commonjsHelpers.es.js +3 -5
- package/_virtual/index.cjs.js +1 -1
- package/_virtual/index.es.js +5 -9
- package/_virtual/index.es2.js +4 -0
- package/common/button/Button.cjs.js +1 -1
- package/common/button/Button.es.js +38 -52
- package/common/button/CloneButtonTable.cjs.js +1 -1
- package/common/button/HideButtonTable.cjs.js +1 -1
- package/common/button/NewButton.cjs.js +1 -1
- package/common/button/PrintButton.cjs.js +1 -1
- package/common/button/RefreshButton.cjs.js +1 -1
- package/common/button/UnHideButton.cjs.js +1 -1
- package/common/button/UpdateButtonTable.cjs.js +1 -1
- package/common/button/ViewButtonTable.cjs.js +1 -1
- package/common/icon/KIcon.cjs.js +1 -0
- package/common/icon/KIcon.d.ts +9 -0
- package/common/icon/KIcon.es.js +11 -0
- package/common/index.cjs.js +1 -1
- package/common/index.es.js +68 -68
- package/common/picker/ImagePicker.cjs.js +1 -1
- package/common/picker/ImagePicker.es.js +228 -189
- package/common/rich/index.cjs.js +1 -1
- package/common/rich/index.es.js +10 -10
- package/common/select/SelectComponent.es.js +4 -4
- package/common/tab/TabViewWithRoute.cjs.js +1 -1
- package/common/tab/TabViewWithRoute.es.js +21 -21
- package/common/table/table.d.ts +1 -1
- package/common/text-field/TextField.cjs.js +1 -1
- package/common/wizard/WizardResult.es.js +4 -4
- package/crud/CrudComponent.cjs.js +1 -1
- package/crud/CrudComponent.d.ts +5 -1
- package/crud/CrudComponent.es.js +66 -64
- package/crud/CrudField.es.js +1 -1
- package/crud/CrudReportComponent.cjs.js +1 -1
- package/crud/FileCrudField.cjs.js +1 -1
- package/crud/FileCrudField.es.js +23 -23
- package/crud/import/CrudImportComponent.cjs.js +2 -2
- package/crud/import/CrudImportComponent.es.js +10 -10
- package/crud/view/CrudViewer.cjs.js +1 -1
- package/crud/view/CrudViewer.d.ts +11 -1
- package/crud/view/CrudViewer.es.js +285 -174
- package/index.cjs.js +1 -1
- package/index.es.js +19 -19
- package/locale/index.d.ts +5 -0
- package/locale/translations/en.cjs.js +1 -1
- package/locale/translations/en.d.ts +5 -0
- package/locale/translations/en.es.js +7 -2
- package/package.json +7 -2
- package/_virtual/_nodeUtil.es.js +0 -4
- package/_virtual/isBuffer.cjs.js +0 -1
- package/_virtual/isBuffer.es.js +0 -4
- package/_virtual/quill.cjs.js +0 -1
- package/_virtual/quill.es.js +0 -4
- /package/_virtual/{_nodeUtil.cjs.js → index.cjs2.js} +0 -0
|
@@ -1,281 +1,320 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
1
|
+
import { jsx as r, jsxs as z, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
+
import { Cropper as xe } from "../../node_modules/.pnpm/react-advanced-cropper@0.20.1_react@18.3.1/node_modules/react-advanced-cropper/dist/index.esm-bundler.es.js";
|
|
3
|
+
/* empty css */
|
|
3
4
|
/* empty css */
|
|
4
|
-
import { RotateLeftOutlined as
|
|
5
|
-
import { Form as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
import { RotateLeftOutlined as Fe, RotateRightOutlined as Oe, UploadOutlined as se, LoadingOutlined as Se } from "@ant-design/icons";
|
|
6
|
+
import { Form as Ue, Modal as te, Space as ke, Upload as Re } from "antd";
|
|
7
|
+
import H, { useRef as L, useState as w, useCallback as V, useEffect as j, useMemo as re } from "react";
|
|
8
|
+
import { useTranslationLib as Ne } from "../../locale/index.es.js";
|
|
9
|
+
import O from "../button/Button.es.js";
|
|
10
|
+
import je from "../../util/ImageUtil.es.js";
|
|
11
|
+
import ze from "../../icons/FlipHIcon.es.js";
|
|
12
|
+
import Te from "../../icons/FlipVIcon.es.js";
|
|
13
|
+
const Pe = Ue.Item, oe = "crud-component.image-picker.button-state";
|
|
14
|
+
function ie(o) {
|
|
15
|
+
return new Promise((c, m) => {
|
|
16
|
+
const i = new FileReader();
|
|
17
|
+
i.readAsDataURL(o), i.onload = () => c(i.result), i.onerror = (p) => m(p);
|
|
16
18
|
});
|
|
17
19
|
}
|
|
18
|
-
const
|
|
19
|
-
values:
|
|
20
|
-
required:
|
|
21
|
-
buttonType:
|
|
22
|
-
label:
|
|
23
|
-
name:
|
|
24
|
-
onChange:
|
|
25
|
-
aspectRatio:
|
|
26
|
-
buttonTitle:
|
|
20
|
+
const Ke = ({
|
|
21
|
+
values: o = [],
|
|
22
|
+
required: c,
|
|
23
|
+
buttonType: m,
|
|
24
|
+
label: i,
|
|
25
|
+
name: p,
|
|
26
|
+
onChange: u,
|
|
27
|
+
aspectRatio: C,
|
|
28
|
+
buttonTitle: b,
|
|
27
29
|
hidePreview: v,
|
|
28
|
-
buttonSize:
|
|
30
|
+
buttonSize: f = "large",
|
|
29
31
|
showButtonText: g = !0,
|
|
30
32
|
showOnlyIcon: _ = !1,
|
|
31
|
-
icon:
|
|
32
|
-
loading:
|
|
33
|
-
maxCount:
|
|
34
|
-
onAdd:
|
|
35
|
-
onRemove:
|
|
36
|
-
listType:
|
|
33
|
+
icon: S = /* @__PURE__ */ r(se, {}),
|
|
34
|
+
loading: U,
|
|
35
|
+
maxCount: y = 1,
|
|
36
|
+
onAdd: s,
|
|
37
|
+
onRemove: k,
|
|
38
|
+
listType: R,
|
|
37
39
|
...E
|
|
38
40
|
}) => {
|
|
39
|
-
const [
|
|
40
|
-
!e.url && !e.preview && (e.preview = await
|
|
41
|
-
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const [ae, le] = H.useState(""), [ce, de] = H.useState(""), [me, M] = H.useState(!1), T = L(), l = L(null), [n, P] = w([]), [h, B] = w(), pe = L(), ue = () => M(!1), fe = async (e) => {
|
|
42
|
+
!e.url && !e.preview && (e.preview = await ie(e.originFileObj)), de(e.url || e.preview), M(!0), le(e.name);
|
|
43
|
+
}, [J, N] = w(!1), W = (e) => {
|
|
44
|
+
var t;
|
|
45
|
+
(t = l.current) == null || t.rotateImage(e ? -90 : 90);
|
|
46
|
+
}, $ = V((e) => {
|
|
47
|
+
var t;
|
|
48
|
+
l.current && ((t = l.current) == null || t.flipImage(e === "h", e === "v"));
|
|
49
|
+
}, []);
|
|
46
50
|
j(() => {
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
const
|
|
50
|
-
var
|
|
51
|
-
const e = (
|
|
52
|
-
|
|
53
|
-
const
|
|
51
|
+
u == null || u(n[0], n);
|
|
52
|
+
}, [n, u]);
|
|
53
|
+
const ge = async () => {
|
|
54
|
+
var F;
|
|
55
|
+
const e = (F = l.current) == null ? void 0 : F.getCanvas(), { type: t, size: a, name: I, uid: x } = T.current;
|
|
56
|
+
N(!0), e == null || e.toBlob(async (ye) => {
|
|
57
|
+
const Ie = Object.assign(new File([ye], I, { type: t }), {
|
|
54
58
|
uid: x
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
}), q = await je.resizeImage(Ie), D = await ie(q);
|
|
60
|
+
console.log({ url: D });
|
|
61
|
+
const ee = {
|
|
62
|
+
url: D,
|
|
63
|
+
name: I,
|
|
58
64
|
uid: x,
|
|
59
|
-
type:
|
|
60
|
-
size:
|
|
61
|
-
thumbUrl:
|
|
62
|
-
originFileObj:
|
|
65
|
+
type: t,
|
|
66
|
+
size: a,
|
|
67
|
+
thumbUrl: D,
|
|
68
|
+
originFileObj: q
|
|
63
69
|
};
|
|
64
|
-
if (
|
|
70
|
+
if (s)
|
|
65
71
|
try {
|
|
66
|
-
|
|
72
|
+
N(!0), await s(ee);
|
|
67
73
|
} finally {
|
|
68
|
-
|
|
74
|
+
N(!1);
|
|
69
75
|
}
|
|
70
|
-
|
|
71
|
-
}),
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
var
|
|
81
|
-
if (typeof
|
|
82
|
-
|
|
83
|
-
const x = localStorage.getItem(
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
P([ee, ...n]), N(!1);
|
|
77
|
+
}), B(void 0);
|
|
78
|
+
}, he = () => {
|
|
79
|
+
B(void 0), T.current = void 0;
|
|
80
|
+
}, G = V((e) => {
|
|
81
|
+
const t = e;
|
|
82
|
+
if (t) {
|
|
83
|
+
T.current = t;
|
|
84
|
+
const a = new FileReader();
|
|
85
|
+
a.addEventListener("load", () => {
|
|
86
|
+
var I;
|
|
87
|
+
if (typeof a.result == "string") {
|
|
88
|
+
B(a.result);
|
|
89
|
+
const x = localStorage.getItem(oe), F = x ? JSON.parse(x) : void 0;
|
|
90
|
+
F && ((I = l.current) == null || I.setState(F)), setTimeout(() => {
|
|
91
|
+
Z(l.current);
|
|
86
92
|
}, 100);
|
|
87
93
|
}
|
|
88
|
-
}),
|
|
94
|
+
}), a.readAsDataURL(t);
|
|
89
95
|
}
|
|
90
96
|
}, []);
|
|
91
97
|
j(() => {
|
|
92
|
-
if (
|
|
93
|
-
const e = Array.isArray(
|
|
94
|
-
|
|
98
|
+
if (o != null && o.length || typeof o == "string") {
|
|
99
|
+
const e = Array.isArray(o) ? o.map((t) => [{ uid: o, url: t }]) : [{ uid: o, url: o }];
|
|
100
|
+
P(e);
|
|
95
101
|
}
|
|
96
|
-
}, [
|
|
97
|
-
const { t:
|
|
98
|
-
() =>
|
|
99
|
-
required:
|
|
100
|
-
validator: (e,
|
|
101
|
-
h ||
|
|
102
|
+
}, [o]);
|
|
103
|
+
const { t: d } = Ne(), we = re(
|
|
104
|
+
() => c ? {
|
|
105
|
+
required: c,
|
|
106
|
+
validator: (e, t, a) => {
|
|
107
|
+
h || n != null && n.length ? a() : a(`${i ?? ""} ${d("err.validation.required")}`);
|
|
102
108
|
}
|
|
103
109
|
} : void 0,
|
|
104
|
-
[
|
|
105
|
-
),
|
|
106
|
-
() => /* @__PURE__ */
|
|
107
|
-
|
|
110
|
+
[c, h, n == null ? void 0 : n.length, i, d]
|
|
111
|
+
), K = b ?? d("message.uploadButtonText"), Q = re(
|
|
112
|
+
() => /* @__PURE__ */ r(
|
|
113
|
+
Be,
|
|
108
114
|
{
|
|
109
|
-
showLoadingIndicator:
|
|
110
|
-
_buttonTitle:
|
|
111
|
-
buttonSize:
|
|
112
|
-
buttonType:
|
|
113
|
-
fileList:
|
|
115
|
+
showLoadingIndicator: J,
|
|
116
|
+
_buttonTitle: K,
|
|
117
|
+
buttonSize: f,
|
|
118
|
+
buttonType: m,
|
|
119
|
+
fileList: n,
|
|
114
120
|
hidePreview: v,
|
|
115
|
-
icon:
|
|
116
|
-
loading:
|
|
117
|
-
listType:
|
|
118
|
-
maxCount:
|
|
119
|
-
onChangeFile:
|
|
120
|
-
onRemove:
|
|
121
|
+
icon: S,
|
|
122
|
+
loading: U,
|
|
123
|
+
listType: R,
|
|
124
|
+
maxCount: y,
|
|
125
|
+
onChangeFile: G,
|
|
126
|
+
onRemove: k,
|
|
121
127
|
showButtonText: g,
|
|
122
|
-
handlePreview:
|
|
123
|
-
setFileList:
|
|
128
|
+
handlePreview: fe,
|
|
129
|
+
setFileList: P
|
|
124
130
|
}
|
|
125
131
|
),
|
|
126
132
|
[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
J,
|
|
134
|
+
K,
|
|
135
|
+
f,
|
|
136
|
+
m,
|
|
137
|
+
n,
|
|
132
138
|
v,
|
|
139
|
+
S,
|
|
133
140
|
U,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
O,
|
|
141
|
+
R,
|
|
142
|
+
y,
|
|
143
|
+
G,
|
|
144
|
+
k,
|
|
139
145
|
g
|
|
140
146
|
]
|
|
141
147
|
);
|
|
142
|
-
|
|
143
|
-
const [
|
|
148
|
+
pe.current = Q.props.beforeUpload;
|
|
149
|
+
const [Ce, X] = w(0), [be, Y] = w(0), [A, ve] = w();
|
|
144
150
|
j(() => {
|
|
145
151
|
const e = setTimeout(() => {
|
|
146
|
-
|
|
152
|
+
A && localStorage.setItem(oe, JSON.stringify(A));
|
|
147
153
|
}, 400);
|
|
148
154
|
return () => clearTimeout(e);
|
|
149
|
-
}, [
|
|
150
|
-
|
|
155
|
+
}, [A]), j(() => {
|
|
156
|
+
if (!h) {
|
|
157
|
+
X(0), Y(0);
|
|
158
|
+
const e = setTimeout(() => {
|
|
159
|
+
var t;
|
|
160
|
+
(t = l.current) == null || t.reset();
|
|
161
|
+
}, 1500);
|
|
162
|
+
return () => clearTimeout(e);
|
|
163
|
+
}
|
|
151
164
|
}, [h]);
|
|
152
|
-
const
|
|
153
|
-
var n;
|
|
154
|
-
const e = (n = i == null ? void 0 : i.current) == null ? void 0 : n.cropper;
|
|
165
|
+
const Z = V(async (e) => {
|
|
155
166
|
if (e) {
|
|
156
|
-
const
|
|
157
|
-
ve(e.
|
|
167
|
+
const t = e.getCoordinates();
|
|
168
|
+
ve(e.getState()), X((t == null ? void 0 : t.width) ?? 10), Y((t == null ? void 0 : t.height) ?? 10);
|
|
158
169
|
}
|
|
159
170
|
}, []);
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
|
|
171
|
+
return /* @__PURE__ */ z(ne, { children: [
|
|
172
|
+
/* @__PURE__ */ r(
|
|
173
|
+
Pe,
|
|
163
174
|
{
|
|
164
|
-
label:
|
|
175
|
+
label: i,
|
|
165
176
|
...E,
|
|
166
|
-
name:
|
|
177
|
+
name: p,
|
|
167
178
|
className: "mb-0",
|
|
168
|
-
rules: [
|
|
169
|
-
children:
|
|
179
|
+
rules: [we, ...E.rules ?? []],
|
|
180
|
+
children: Q
|
|
170
181
|
}
|
|
171
182
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
|
|
183
|
+
/* @__PURE__ */ z(
|
|
184
|
+
te,
|
|
174
185
|
{
|
|
175
186
|
open: !!h,
|
|
176
187
|
maskClosable: !1,
|
|
177
|
-
onOk:
|
|
188
|
+
onOk: ge,
|
|
178
189
|
closable: !1,
|
|
179
|
-
onCancel:
|
|
190
|
+
onCancel: he,
|
|
191
|
+
destroyOnHidden: !0,
|
|
180
192
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
|
|
193
|
+
/* @__PURE__ */ r(
|
|
194
|
+
xe,
|
|
183
195
|
{
|
|
184
|
-
ref:
|
|
196
|
+
ref: l,
|
|
197
|
+
stencilProps: {
|
|
198
|
+
grid: !0
|
|
199
|
+
},
|
|
200
|
+
style: { border: "1px solid black" },
|
|
185
201
|
src: h,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
202
|
+
onChange: (e) => {
|
|
203
|
+
Z(e);
|
|
204
|
+
},
|
|
205
|
+
aspectRatio: C ? {
|
|
206
|
+
minimum: C,
|
|
207
|
+
maximum: C
|
|
208
|
+
} : void 0
|
|
190
209
|
}
|
|
191
210
|
),
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
|
|
211
|
+
/* @__PURE__ */ r("p", { className: "text-center", children: [Ce, be].join(" ⨉ ") }),
|
|
212
|
+
/* @__PURE__ */ r("div", { className: "mt-2 d-flex justify-content-center", children: /* @__PURE__ */ z(ke.Compact, { children: [
|
|
213
|
+
/* @__PURE__ */ r(
|
|
214
|
+
O,
|
|
196
215
|
{
|
|
197
216
|
size: "large",
|
|
198
|
-
|
|
217
|
+
tooltip: d("str.rotateLeft"),
|
|
218
|
+
icon: /* @__PURE__ */ r(Fe, {}),
|
|
199
219
|
onClick: () => W(!0)
|
|
200
220
|
}
|
|
201
221
|
),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
222
|
+
/* @__PURE__ */ r(
|
|
223
|
+
O,
|
|
204
224
|
{
|
|
205
225
|
size: "large",
|
|
206
|
-
icon: /* @__PURE__ */
|
|
226
|
+
icon: /* @__PURE__ */ r(Oe, {}),
|
|
227
|
+
tooltip: d("str.rotateRight"),
|
|
207
228
|
onClick: () => W(!1)
|
|
208
229
|
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ r(
|
|
232
|
+
O,
|
|
233
|
+
{
|
|
234
|
+
size: "large",
|
|
235
|
+
icon: /* @__PURE__ */ r(ze, {}),
|
|
236
|
+
tooltip: d("str.flipHorizontal"),
|
|
237
|
+
onClick: () => $("h")
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ r(
|
|
241
|
+
O,
|
|
242
|
+
{
|
|
243
|
+
size: "large",
|
|
244
|
+
icon: /* @__PURE__ */ r(Te, {}),
|
|
245
|
+
tooltip: d("str.flipVertical"),
|
|
246
|
+
onClick: () => $("v")
|
|
247
|
+
}
|
|
209
248
|
)
|
|
210
|
-
] })
|
|
249
|
+
] }) })
|
|
211
250
|
]
|
|
212
251
|
}
|
|
213
252
|
),
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
|
|
253
|
+
/* @__PURE__ */ r(
|
|
254
|
+
te,
|
|
216
255
|
{
|
|
217
|
-
open:
|
|
218
|
-
title:
|
|
256
|
+
open: me,
|
|
257
|
+
title: ae,
|
|
219
258
|
footer: null,
|
|
220
|
-
onCancel:
|
|
221
|
-
children: /* @__PURE__ */
|
|
259
|
+
onCancel: ue,
|
|
260
|
+
children: /* @__PURE__ */ r("div", { className: "text-center", children: /* @__PURE__ */ r("img", { alt: "example", style: { maxWidth: "400px" }, src: ce }) })
|
|
222
261
|
}
|
|
223
262
|
)
|
|
224
263
|
] });
|
|
225
|
-
},
|
|
226
|
-
_buttonTitle:
|
|
227
|
-
buttonSize:
|
|
228
|
-
buttonType:
|
|
229
|
-
fileList:
|
|
230
|
-
hidePreview:
|
|
231
|
-
icon:
|
|
232
|
-
loading:
|
|
233
|
-
maxCount:
|
|
264
|
+
}, Be = ({
|
|
265
|
+
_buttonTitle: o,
|
|
266
|
+
buttonSize: c,
|
|
267
|
+
buttonType: m,
|
|
268
|
+
fileList: i,
|
|
269
|
+
hidePreview: p,
|
|
270
|
+
icon: u,
|
|
271
|
+
loading: C,
|
|
272
|
+
maxCount: b,
|
|
234
273
|
onChangeFile: v,
|
|
235
|
-
onRemove:
|
|
274
|
+
onRemove: f,
|
|
236
275
|
showButtonText: g,
|
|
237
276
|
handlePreview: _,
|
|
238
|
-
setFileList:
|
|
239
|
-
showLoadingIndicator:
|
|
240
|
-
listType:
|
|
241
|
-
}) => /* @__PURE__ */
|
|
242
|
-
|
|
277
|
+
setFileList: S,
|
|
278
|
+
showLoadingIndicator: U,
|
|
279
|
+
listType: y = "picture"
|
|
280
|
+
}) => /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ z(
|
|
281
|
+
Re,
|
|
243
282
|
{
|
|
244
283
|
accept: "image/x-png,image/gif,image/jpeg",
|
|
245
|
-
fileList:
|
|
246
|
-
defaultFileList:
|
|
284
|
+
fileList: i,
|
|
285
|
+
defaultFileList: i,
|
|
247
286
|
onChange: () => {
|
|
248
287
|
},
|
|
249
|
-
className: (
|
|
288
|
+
className: (i.length >= b ? " hide-upload " : "") + " mb-0",
|
|
250
289
|
multiple: !1,
|
|
251
|
-
onPreview:
|
|
252
|
-
onDrop: (
|
|
253
|
-
listType:
|
|
254
|
-
showUploadList: !
|
|
255
|
-
onRemove: (
|
|
256
|
-
const
|
|
257
|
-
|
|
290
|
+
onPreview: p ? void 0 : _,
|
|
291
|
+
onDrop: (s) => (v(s.dataTransfer.files.item(0)), !1),
|
|
292
|
+
listType: y,
|
|
293
|
+
showUploadList: !p,
|
|
294
|
+
onRemove: (s) => {
|
|
295
|
+
const k = i.filter((R) => s.uid !== R.uid);
|
|
296
|
+
f == null || f(s), S(k);
|
|
258
297
|
},
|
|
259
|
-
beforeUpload: async (
|
|
260
|
-
maxCount:
|
|
298
|
+
beforeUpload: async (s) => (v(s), !1),
|
|
299
|
+
maxCount: b,
|
|
261
300
|
children: [
|
|
262
|
-
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
|
|
301
|
+
U && /* @__PURE__ */ r(Se, {}),
|
|
302
|
+
/* @__PURE__ */ r("div", { className: "d-flex flex-column", children: i.length < b && (y === "picture-circle" ? /* @__PURE__ */ r(se, {}) : /* @__PURE__ */ r(
|
|
303
|
+
O,
|
|
265
304
|
{
|
|
266
|
-
loading:
|
|
267
|
-
tooltip: g ? void 0 :
|
|
268
|
-
size:
|
|
269
|
-
icon:
|
|
270
|
-
type: g ?
|
|
271
|
-
children: g ?
|
|
305
|
+
loading: C,
|
|
306
|
+
tooltip: g ? void 0 : o,
|
|
307
|
+
size: c,
|
|
308
|
+
icon: u,
|
|
309
|
+
type: g ? m : "text",
|
|
310
|
+
children: g ? o : void 0
|
|
272
311
|
}
|
|
273
312
|
)) })
|
|
274
313
|
]
|
|
275
314
|
},
|
|
276
|
-
|
|
315
|
+
i.length
|
|
277
316
|
) });
|
|
278
317
|
export {
|
|
279
|
-
|
|
280
|
-
|
|
318
|
+
Be as UploadComponent,
|
|
319
|
+
Ke as default
|
|
281
320
|
};
|
package/common/rich/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var g=Object.create;var p=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var w=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of V(t))!F.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(s=q(t,o))||s.enumerable});return e};var R=(e,t,r)=>(r=e!=null?g(j(e)):{},w(t||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime");;/* empty css */;/* empty css */const h=require("antd"),c=require("react"),y=require("../../util/ValidationUtil.cjs.js"),E=c.lazy(async()=>{const{default:e}=await import("react-quill");return{default:t=>a.jsx(e,{...t})}}),S=({name:e,label:t,required:r,rules:s=[],disabled:o})=>{const n=h.Form.useFormInstance(),[u,d]=c.useState(""),f={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},b=["bold","italic","underline","strike","blockquote","list","bullet","link"];c.useEffect(()=>{const i=n.getFieldValue(e);i&&i!=="<p></p>"&&i!=="<p><br></p>"&&d(i)},[n,e]);const l=h.Form.useWatch(e,n);c.useEffect(()=>{l!==u&&d(!l||l==="<p></p>"||l==="<p><br></p>"?"":l)},[l,u]);const k=i=>{d(i);const x=!i||i==="<p></p>"||i.trim()==="<p><br></p>"?void 0:i;n.setFieldValue(e,x),n.validateFields([e]).catch(()=>{})},m=c.useMemo(()=>r?[...s,...y.required(t??"")]:s,[r,s,t]);return a.jsx(h.Form.Item,{name:e,label:t,rules:m,children:a.jsx(c.Suspense,{fallback:a.jsx("div",{children:"Loading editor..."}),children:a.jsx(E,{readOnly:o,value:u,onChange:k,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:f,formats:b})})})};exports.RichTextEditor=S;
|
package/common/rich/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
/* empty css
|
|
2
|
+
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { Form as a } from "antd";
|
|
5
5
|
import V, { useState as g, useEffect as u, useMemo as w, Suspense as F } from "react";
|
|
6
6
|
import x from "../../util/ValidationUtil.es.js";
|
|
7
7
|
const R = V.lazy(async () => {
|
|
8
|
-
const { default: e } = await import("
|
|
9
|
-
return { default: (
|
|
8
|
+
const { default: e } = await import("react-quill");
|
|
9
|
+
return { default: (o) => /* @__PURE__ */ l(e, { ...o }) };
|
|
10
10
|
}), S = ({
|
|
11
11
|
name: e,
|
|
12
|
-
label:
|
|
12
|
+
label: o,
|
|
13
13
|
required: d,
|
|
14
14
|
rules: c = [],
|
|
15
15
|
disabled: p
|
|
@@ -35,20 +35,20 @@ const R = V.lazy(async () => {
|
|
|
35
35
|
const t = r.getFieldValue(e);
|
|
36
36
|
t && t !== "<p></p>" && t !== "<p><br></p>" && s(t);
|
|
37
37
|
}, [r, e]);
|
|
38
|
-
const
|
|
38
|
+
const i = a.useWatch(e, r);
|
|
39
39
|
u(() => {
|
|
40
|
-
|
|
41
|
-
}, [
|
|
40
|
+
i !== n && s(!i || i === "<p></p>" || i === "<p><br></p>" ? "" : i);
|
|
41
|
+
}, [i, n]);
|
|
42
42
|
const h = (t) => {
|
|
43
43
|
s(t);
|
|
44
44
|
const k = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
|
|
45
45
|
r.setFieldValue(e, k), r.validateFields([e]).catch(() => {
|
|
46
46
|
});
|
|
47
47
|
}, b = w(
|
|
48
|
-
() => d ? [...c, ...x.required(
|
|
49
|
-
[d, c,
|
|
48
|
+
() => d ? [...c, ...x.required(o ?? "")] : c,
|
|
49
|
+
[d, c, o]
|
|
50
50
|
);
|
|
51
|
-
return /* @__PURE__ */ l(a.Item, { name: e, label:
|
|
51
|
+
return /* @__PURE__ */ l(a.Item, { name: e, label: o, rules: b, children: /* @__PURE__ */ l(F, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
|
|
52
52
|
R,
|
|
53
53
|
{
|
|
54
54
|
readOnly: p,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { ConfigProvider as q,
|
|
2
|
+
import { ConfigProvider as q, Form as B, Select as D, Spin as E } from "antd";
|
|
3
3
|
import { useCallback as F } from "react";
|
|
4
4
|
import { useTranslationLib as P } from "../../locale/index.es.js";
|
|
5
5
|
import V from "../tooltip/TooltipComponent.es.js";
|
|
@@ -33,9 +33,9 @@ function Q({
|
|
|
33
33
|
return /* @__PURE__ */ t(
|
|
34
34
|
q,
|
|
35
35
|
{
|
|
36
|
-
renderEmpty: _ && d ? () => /* @__PURE__ */ t(
|
|
36
|
+
renderEmpty: _ && d ? () => /* @__PURE__ */ t(E, {}) : void 0,
|
|
37
37
|
children: /* @__PURE__ */ t(V, { title: $, children: /* @__PURE__ */ t(
|
|
38
|
-
|
|
38
|
+
B.Item,
|
|
39
39
|
{
|
|
40
40
|
label: m,
|
|
41
41
|
name: n.name,
|
|
@@ -51,7 +51,7 @@ function Q({
|
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
children: /* @__PURE__ */ t(
|
|
54
|
-
|
|
54
|
+
D,
|
|
55
55
|
{
|
|
56
56
|
ref: N,
|
|
57
57
|
loading: d,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),n=require("antd"),i=require("react"),u=require("react-router-dom"),T=require("../../hooks/NavigatorHooks.cjs.js"),y=require("../../context/WindowDimension.cjs.js"),{Content:S}=n.Layout,v=({positionOfRoute:a,initialKey:o="*",tabs:l,className:d="",mode:h="default"})=>{const[b,m]=i.useState(o),e=T.useNavigateOptional(),p=t=>{e==null||e(t)},r=u.useLocation();i.useEffect(()=>{const t=r.pathname.split("/")[a];m(t??""),t||e==null||e(o,{replace:!0})},[o,r.pathname,e,a]);const{isDesktop:x}=y(),c=h==="side"&&x,f=c?"left":"top",j=c?"d-flex h-100":"";return s.jsxs("div",{className:`${d} ${j}`,children:[s.jsx(n.Tabs,{type:"card",tabPosition:f,activeKey:b,onChange:p,children:l.map(({key:t,label:q})=>s.jsx(n.Tabs.TabPane,{tab:q},t))}),s.jsx(S,{className:`max-height ${c?"overflow-auto":""}`,children:s.jsx(u.Outlet,{})})]})};exports.TabViewWithRoute=v;
|