@kingteza/crud-component 1.0.40 → 1.0.42
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/common/button/Button.cjs.js +1 -1
- package/common/button/Button.es.js +19 -20
- package/common/button/CloneButtonTable.cjs.js +1 -1
- package/common/button/CloneButtonTable.es.js +9 -10
- package/common/button/DeleteButtonTable.cjs.js +1 -1
- package/common/button/DeleteButtonTable.es.js +29 -33
- package/common/button/ExportButton.cjs.js +1 -1
- package/common/button/ExportButton.es.js +10 -11
- package/common/button/HideButtonTable.cjs.js +1 -1
- package/common/button/HideButtonTable.es.js +22 -23
- package/common/button/ImportButton.cjs.js +1 -1
- package/common/button/ImportButton.es.js +19 -20
- package/common/button/NewButton.cjs.js +1 -1
- package/common/button/NewButton.es.js +13 -14
- package/common/button/PrintButton.cjs.js +1 -1
- package/common/button/PrintButton.es.js +11 -12
- package/common/button/RefreshButton.cjs.js +1 -1
- package/common/button/RefreshButton.es.js +10 -11
- package/common/button/UnHideButton.cjs.js +1 -1
- package/common/button/UnHideButton.es.js +37 -38
- package/common/button/UpdateButtonTable.cjs.js +1 -1
- package/common/button/UpdateButtonTable.es.js +8 -9
- package/common/button/ViewButtonTable.cjs.js +1 -1
- package/common/button/ViewButtonTable.es.js +10 -11
- package/common/date-picker/DatePicker.cjs.js +1 -1
- package/common/date-picker/DatePicker.es.js +40 -41
- package/common/date-picker/TimePicker.cjs.js +1 -1
- package/common/date-picker/TimePicker.es.js +47 -48
- package/common/loading/LoadingIndicator.cjs.js +1 -1
- package/common/loading/LoadingIndicator.es.js +6 -7
- package/common/picker/ImagePicker.cjs.js +1 -1
- package/common/picker/ImagePicker.es.js +80 -81
- package/common/select/SelectComponent.cjs.js +1 -1
- package/common/select/SelectComponent.es.js +33 -34
- package/common/tag/StatusTag.cjs.js +1 -1
- package/common/tag/StatusTag.es.js +12 -13
- package/common/text-field/NumberField.cjs.js +1 -1
- package/common/text-field/NumberField.es.js +41 -42
- package/common/text-field/TextArea.cjs.js +1 -1
- package/common/text-field/TextArea.es.js +15 -16
- package/common/text-field/TextField.cjs.js +1 -1
- package/common/text-field/TextField.es.js +50 -51
- package/common/wizard/WizardResult.cjs.js +1 -1
- package/common/wizard/WizardResult.es.js +36 -38
- package/crud/CrudComponent.cjs.js +1 -1
- package/crud/CrudComponent.es.js +77 -78
- package/crud/CrudField.cjs.js +1 -1
- package/crud/CrudField.es.js +126 -127
- package/crud/CrudFormWizard.cjs.js +1 -1
- package/crud/CrudFormWizard.es.js +47 -48
- package/crud/FileCrudField.cjs.js +1 -1
- package/crud/FileCrudField.es.js +72 -73
- package/crud/import/CrudImportButton.cjs.js +1 -1
- package/crud/import/CrudImportButton.es.js +10 -11
- package/crud/import/CrudImportComponent.cjs.js +2 -2
- package/crud/import/CrudImportComponent.es.js +56 -57
- package/crud/view/CrudDecListView.cjs.js +1 -1
- package/crud/view/CrudDecListView.es.js +11 -12
- package/crud/view/CrudViewer.cjs.js +1 -1
- package/crud/view/CrudViewer.es.js +120 -121
- package/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/crud/view/CrudViewerUtil.es.js +15 -17
- package/locale/index.cjs.js +1 -1
- package/locale/index.d.ts +4 -0
- package/locale/index.es.js +36 -24
- package/package.json +1 -1
- package/util/ValidationUtil.cjs.js +1 -1
- package/util/ValidationUtil.es.js +26 -23
|
@@ -1,70 +1,69 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { UpCircleOutlined as
|
|
3
|
-
import { Popconfirm as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import {
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { UpCircleOutlined as p } from "@ant-design/icons";
|
|
3
|
+
import { Popconfirm as x } from "antd";
|
|
4
|
+
import { useMemo as T, useState as U, useEffect as k, useCallback as _ } from "react";
|
|
5
|
+
import { useTranslationLib as h } from "../../locale/index.es.js";
|
|
6
6
|
import d from "./Button.es.js";
|
|
7
|
-
|
|
8
|
-
function O({
|
|
7
|
+
function E({
|
|
9
8
|
shouldConfirm: C = !0,
|
|
10
|
-
block:
|
|
9
|
+
block: r,
|
|
11
10
|
value: i,
|
|
12
11
|
loading: a,
|
|
13
12
|
onClick: s,
|
|
14
|
-
text:
|
|
15
|
-
disabled:
|
|
16
|
-
type:
|
|
17
|
-
hidden:
|
|
13
|
+
text: l,
|
|
14
|
+
disabled: u,
|
|
15
|
+
type: f = "link",
|
|
16
|
+
hidden: g
|
|
18
17
|
}) {
|
|
19
|
-
const { t } =
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const { t: o } = h(), n = T(() => l ?? o("str.unhide"), [l, o]), [m, e] = U(!1);
|
|
19
|
+
k(() => {
|
|
20
|
+
e(a ?? !1);
|
|
22
21
|
}, [a]);
|
|
23
|
-
const
|
|
22
|
+
const c = _(
|
|
24
23
|
async () => {
|
|
25
24
|
try {
|
|
26
|
-
|
|
25
|
+
e(!0), await s(i);
|
|
27
26
|
} finally {
|
|
28
|
-
|
|
27
|
+
e(!1);
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
30
|
[s, i]
|
|
32
31
|
);
|
|
33
|
-
return C ? /* @__PURE__ */
|
|
34
|
-
|
|
32
|
+
return C ? /* @__PURE__ */ t(
|
|
33
|
+
x,
|
|
35
34
|
{
|
|
36
|
-
title:
|
|
35
|
+
title: o("qus.doYouWantToHide"),
|
|
37
36
|
okText: n.toUpperCase(),
|
|
38
|
-
cancelText:
|
|
39
|
-
onConfirm:
|
|
40
|
-
children: /* @__PURE__ */
|
|
37
|
+
cancelText: o("str.no").toUpperCase(),
|
|
38
|
+
onConfirm: c,
|
|
39
|
+
children: /* @__PURE__ */ t(
|
|
41
40
|
d,
|
|
42
41
|
{
|
|
43
42
|
tooltip: n,
|
|
44
|
-
icon: /* @__PURE__ */
|
|
45
|
-
disabled:
|
|
46
|
-
loading:
|
|
47
|
-
type:
|
|
43
|
+
icon: /* @__PURE__ */ t(p, {}),
|
|
44
|
+
disabled: u,
|
|
45
|
+
loading: m,
|
|
46
|
+
type: f,
|
|
48
47
|
danger: !0,
|
|
49
|
-
hidden:
|
|
50
|
-
block:
|
|
48
|
+
hidden: g,
|
|
49
|
+
block: r
|
|
51
50
|
}
|
|
52
51
|
)
|
|
53
52
|
}
|
|
54
|
-
) : /* @__PURE__ */
|
|
53
|
+
) : /* @__PURE__ */ t(
|
|
55
54
|
d,
|
|
56
55
|
{
|
|
57
56
|
tooltip: n,
|
|
58
|
-
icon: /* @__PURE__ */
|
|
59
|
-
disabled:
|
|
60
|
-
loading:
|
|
61
|
-
type:
|
|
57
|
+
icon: /* @__PURE__ */ t(p, {}),
|
|
58
|
+
disabled: u,
|
|
59
|
+
loading: m,
|
|
60
|
+
type: f,
|
|
62
61
|
danger: !0,
|
|
63
|
-
block:
|
|
64
|
-
onClick:
|
|
62
|
+
block: r,
|
|
63
|
+
onClick: c
|
|
65
64
|
}
|
|
66
65
|
);
|
|
67
66
|
}
|
|
68
67
|
export {
|
|
69
|
-
|
|
68
|
+
E as default
|
|
70
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),o=require("@ant-design/icons"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),o=require("@ant-design/icons"),s=require("../../locale/index.cjs.js"),r=require("./Button.cjs.js");function u({value:e,onClick:n}){const{t:i}=s.useTranslationLib();return t.jsx(r,{tooltip:i("str.update"),type:"link",onClick:()=>n(e),icon:t.jsx(o.EditOutlined,{})})}module.exports=u;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { EditOutlined as
|
|
3
|
-
import {
|
|
2
|
+
import { EditOutlined as r } from "@ant-design/icons";
|
|
3
|
+
import { useTranslationLib as e } from "../../locale/index.es.js";
|
|
4
4
|
import p from "./Button.es.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { t: n } = m(e);
|
|
5
|
+
function f({ value: o, onClick: n }) {
|
|
6
|
+
const { t: i } = e();
|
|
8
7
|
return /* @__PURE__ */ t(
|
|
9
8
|
p,
|
|
10
9
|
{
|
|
11
|
-
tooltip:
|
|
10
|
+
tooltip: i("str.update"),
|
|
12
11
|
type: "link",
|
|
13
|
-
onClick: () =>
|
|
14
|
-
icon: /* @__PURE__ */ t(
|
|
12
|
+
onClick: () => n(o),
|
|
13
|
+
icon: /* @__PURE__ */ t(r, {})
|
|
15
14
|
}
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
f as default
|
|
20
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),o=require("@ant-design/icons"),s=require("../../locale/index.cjs.js"),r=require("./Button.cjs.js");function u({value:e,onClick:n}){const{t:i}=s.useTranslationLib();return t.jsx(r,{type:"link",onClick:()=>n(e),icon:t.jsx(o.EyeOutlined,{}),tooltip:i("str.view")})}module.exports=u;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { EyeOutlined as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { EyeOutlined as r } from "@ant-design/icons";
|
|
3
|
+
import { useTranslationLib as e } from "../../locale/index.es.js";
|
|
4
4
|
import m from "./Button.es.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return /* @__PURE__ */ o(
|
|
5
|
+
function s({ value: o, onClick: i }) {
|
|
6
|
+
const { t: n } = e();
|
|
7
|
+
return /* @__PURE__ */ t(
|
|
9
8
|
m,
|
|
10
9
|
{
|
|
11
10
|
type: "link",
|
|
12
|
-
onClick: () =>
|
|
13
|
-
icon: /* @__PURE__ */
|
|
14
|
-
tooltip:
|
|
11
|
+
onClick: () => i(o),
|
|
12
|
+
icon: /* @__PURE__ */ t(r, {}),
|
|
13
|
+
tooltip: n("str.view")
|
|
15
14
|
}
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
|
-
|
|
18
|
+
s as default
|
|
20
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),s=require("antd"),t=require("dayjs"),$=require("dayjs/plugin/advancedFormat"),C=require("dayjs/plugin/customParseFormat"),E=require("dayjs/plugin/localeData"),I=require("dayjs/plugin/weekday"),L=require("dayjs/plugin/weekOfYear"),N=require("dayjs/plugin/weekYear"),b=require("../../locale/index.cjs.js"),z=require("react");t.extend(C);t.extend($);t.extend(I);t.extend(E);t.extend(L);t.extend(N);const A=({type:B,required:q,label:o,rules:x=[],placeholder:a,disabledPastDays:c=!1,disableToday:i=!1,onEnter:G,disabled:f,nextFocus:H,onChange:r,range:m,showTime:k,disabledFutureDays:d,picker:l,defaultValue:y,value:O,format:j,autoComplete:J="off",enabledDates:K=[],renderExtraFooter:p,...w})=>{const{t:D}=b.useTranslationLib(),P=m?s.DatePicker.RangePicker:s.DatePicker,F=z.useCallback(e=>{if(!e)return!1;const n=t(),R=c&&e<n.startOf("day"),v=d&&e>n.endOf("day"),Y=i&&e<n.endOf("day")&&n.startOf("day")<e;return R||v||Y},[c,d,i]);return u.jsx(s.Form.Item,{...w,label:o,rules:[{required:q,message:`${o??a??""} ${D("err.validation.required")}`},...x],children:u.jsx(P,{renderExtraFooter:p,value:O,picker:l,defaultValue:y,format:j,onChange:e=>r==null?void 0:r(e),disabledDate:F,disabled:f,className:"w-100",placeholder:a,showTime:k})})};module.exports=A;
|
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { DatePicker as d, Form as C } from "antd";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { useCallback as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: _,
|
|
3
|
+
import t from "dayjs";
|
|
4
|
+
import E from "dayjs/plugin/advancedFormat";
|
|
5
|
+
import I from "dayjs/plugin/customParseFormat";
|
|
6
|
+
import L from "dayjs/plugin/localeData";
|
|
7
|
+
import N from "dayjs/plugin/weekday";
|
|
8
|
+
import R from "dayjs/plugin/weekOfYear";
|
|
9
|
+
import b from "dayjs/plugin/weekYear";
|
|
10
|
+
import { useTranslationLib as z } from "../../locale/index.es.js";
|
|
11
|
+
import { useCallback as A } from "react";
|
|
12
|
+
t.extend(I);
|
|
13
|
+
t.extend(E);
|
|
14
|
+
t.extend(N);
|
|
15
|
+
t.extend(L);
|
|
16
|
+
t.extend(R);
|
|
17
|
+
t.extend(b);
|
|
18
|
+
const h = ({
|
|
19
|
+
type: B,
|
|
21
20
|
required: c,
|
|
22
21
|
label: m,
|
|
23
22
|
rules: p = [],
|
|
24
23
|
placeholder: a,
|
|
25
24
|
disabledPastDays: n = !1,
|
|
26
25
|
disableToday: f = !1,
|
|
27
|
-
onEnter:
|
|
26
|
+
onEnter: G,
|
|
28
27
|
disabled: l,
|
|
29
|
-
nextFocus:
|
|
28
|
+
nextFocus: H,
|
|
30
29
|
onChange: r,
|
|
31
30
|
range: x,
|
|
32
31
|
showTime: k,
|
|
33
32
|
disabledFutureDays: s,
|
|
34
|
-
picker:
|
|
35
|
-
defaultValue:
|
|
36
|
-
value:
|
|
33
|
+
picker: u,
|
|
34
|
+
defaultValue: y,
|
|
35
|
+
value: O,
|
|
37
36
|
format: w,
|
|
38
|
-
autoComplete:
|
|
39
|
-
enabledDates:
|
|
40
|
-
renderExtraFooter:
|
|
41
|
-
...
|
|
37
|
+
autoComplete: J = "off",
|
|
38
|
+
enabledDates: K = [],
|
|
39
|
+
renderExtraFooter: D,
|
|
40
|
+
...F
|
|
42
41
|
}) => {
|
|
43
|
-
const { t: P } =
|
|
44
|
-
(
|
|
45
|
-
if (!
|
|
42
|
+
const { t: P } = z(), j = x ? d.RangePicker : d, v = A(
|
|
43
|
+
(e) => {
|
|
44
|
+
if (!e)
|
|
46
45
|
return !1;
|
|
47
|
-
const o =
|
|
48
|
-
return
|
|
46
|
+
const o = t(), Y = n && e < o.startOf("day"), $ = s && e > o.endOf("day"), q = f && e < o.endOf("day") && o.startOf("day") < e;
|
|
47
|
+
return Y || $ || q;
|
|
49
48
|
},
|
|
50
49
|
[n, s, f]
|
|
51
50
|
// Dependencies for useCallback
|
|
@@ -53,7 +52,7 @@ const et = ({
|
|
|
53
52
|
return /* @__PURE__ */ i(
|
|
54
53
|
C.Item,
|
|
55
54
|
{
|
|
56
|
-
...
|
|
55
|
+
...F,
|
|
57
56
|
label: m,
|
|
58
57
|
rules: [
|
|
59
58
|
{
|
|
@@ -65,15 +64,15 @@ const et = ({
|
|
|
65
64
|
...p
|
|
66
65
|
],
|
|
67
66
|
children: /* @__PURE__ */ i(
|
|
68
|
-
|
|
67
|
+
j,
|
|
69
68
|
{
|
|
70
|
-
renderExtraFooter:
|
|
71
|
-
value:
|
|
72
|
-
picker:
|
|
73
|
-
defaultValue:
|
|
69
|
+
renderExtraFooter: D,
|
|
70
|
+
value: O,
|
|
71
|
+
picker: u,
|
|
72
|
+
defaultValue: y,
|
|
74
73
|
format: w,
|
|
75
|
-
onChange: (
|
|
76
|
-
disabledDate:
|
|
74
|
+
onChange: (e) => r == null ? void 0 : r(e),
|
|
75
|
+
disabledDate: v,
|
|
77
76
|
disabled: l,
|
|
78
77
|
className: "w-100",
|
|
79
78
|
placeholder: a,
|
|
@@ -84,5 +83,5 @@ const et = ({
|
|
|
84
83
|
);
|
|
85
84
|
};
|
|
86
85
|
export {
|
|
87
|
-
|
|
86
|
+
h as default
|
|
88
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),n=require("antd"),E=require("dayjs"),f=require("react"),H=require("../../locale/index.cjs.js"),I=({type:L,required:q,label:i,rules:x=[],placeholder:o,disabledPast:r=!1,disableCurrent:m=!1,onEnter:M,disabled:k,use12Hours:T,nextFocus:N,onChange:t,range:c,disabledFuture:u,defaultValue:j,value:p,format:d,autoComplete:S="off",renderExtraFooter:y,...P})=>{const{t:R}=H.useTranslationLib(),a=f.useMemo(()=>o||(c?["From","To"]:"Select time"),[o,c]);console.log(a);const F=c?n.TimePicker.RangePicker:n.TimePicker,$=f.useCallback(e=>{if(!e)return!1;const s=E(),v=r&&e<s,w=u&&e>s,D=m&&e<s&&s<e;return v||w||D},[m,u,r]);return l.jsx(n.Form.Item,{...P,label:i,rules:[{required:q,message:`${i??o??""} ${R("err.validation.required")}`},...x],children:l.jsx(F,{use12Hours:T,renderExtraFooter:y,value:p,defaultValue:j,format:d,onChange:e=>t==null?void 0:t(e),disabledDate:$,disabled:k,className:"w-100",placeholder:a})})};module.exports=I;
|
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { TimePicker as
|
|
3
|
-
import
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import {
|
|
6
|
-
import { TRANSLATION_NAMESPACE as w } from "../../locale/hooks/translation-constants.es.js";
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { TimePicker as l, Form as E } from "antd";
|
|
3
|
+
import H from "dayjs";
|
|
4
|
+
import { useMemo as I, useCallback as L } from "react";
|
|
5
|
+
import { useTranslationLib as M } from "../../locale/index.es.js";
|
|
7
6
|
const K = ({
|
|
8
|
-
type:
|
|
9
|
-
required:
|
|
10
|
-
label:
|
|
11
|
-
rules:
|
|
7
|
+
type: N,
|
|
8
|
+
required: p,
|
|
9
|
+
label: c,
|
|
10
|
+
rules: k = [],
|
|
12
11
|
placeholder: t,
|
|
13
|
-
disabledPast:
|
|
14
|
-
disableCurrent:
|
|
15
|
-
onEnter:
|
|
16
|
-
disabled:
|
|
17
|
-
use12Hours:
|
|
18
|
-
nextFocus:
|
|
19
|
-
onChange:
|
|
20
|
-
range:
|
|
12
|
+
disabledPast: i = !1,
|
|
13
|
+
disableCurrent: r = !1,
|
|
14
|
+
onEnter: R,
|
|
15
|
+
disabled: u,
|
|
16
|
+
use12Hours: T,
|
|
17
|
+
nextFocus: S,
|
|
18
|
+
onChange: s,
|
|
19
|
+
range: m,
|
|
21
20
|
disabledFuture: n,
|
|
22
|
-
defaultValue:
|
|
23
|
-
value:
|
|
24
|
-
format:
|
|
25
|
-
autoComplete:
|
|
26
|
-
renderExtraFooter:
|
|
27
|
-
...
|
|
21
|
+
defaultValue: x,
|
|
22
|
+
value: y,
|
|
23
|
+
format: d,
|
|
24
|
+
autoComplete: z = "off",
|
|
25
|
+
renderExtraFooter: j,
|
|
26
|
+
...F
|
|
28
27
|
}) => {
|
|
29
|
-
const { t: P } =
|
|
30
|
-
() => t || (
|
|
31
|
-
[t,
|
|
28
|
+
const { t: P } = M(), f = I(
|
|
29
|
+
() => t || (m ? ["From", "To"] : "Select time"),
|
|
30
|
+
[t, m]
|
|
32
31
|
);
|
|
33
32
|
console.log(f);
|
|
34
|
-
const
|
|
33
|
+
const $ = m ? l.RangePicker : l, q = L(
|
|
35
34
|
(o) => {
|
|
36
35
|
if (!o)
|
|
37
36
|
return !1;
|
|
38
|
-
const
|
|
39
|
-
return
|
|
37
|
+
const e = H(), v = i && o < e, w = n && o > e, D = r && o < e && e < o;
|
|
38
|
+
return v || w || D;
|
|
40
39
|
},
|
|
41
|
-
[
|
|
40
|
+
[r, n, i]
|
|
42
41
|
// Dependencies for useCallback
|
|
43
42
|
);
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
43
|
+
return /* @__PURE__ */ a(
|
|
44
|
+
E.Item,
|
|
46
45
|
{
|
|
47
|
-
...
|
|
48
|
-
label:
|
|
46
|
+
...F,
|
|
47
|
+
label: c,
|
|
49
48
|
rules: [
|
|
50
49
|
{
|
|
51
|
-
required:
|
|
52
|
-
message: `${
|
|
50
|
+
required: p,
|
|
51
|
+
message: `${c ?? t ?? ""} ${P(
|
|
53
52
|
"err.validation.required"
|
|
54
53
|
)}`
|
|
55
54
|
},
|
|
56
|
-
...
|
|
55
|
+
...k
|
|
57
56
|
],
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
|
|
57
|
+
children: /* @__PURE__ */ a(
|
|
58
|
+
$,
|
|
60
59
|
{
|
|
61
|
-
use12Hours:
|
|
62
|
-
renderExtraFooter:
|
|
63
|
-
value:
|
|
64
|
-
defaultValue:
|
|
65
|
-
format:
|
|
66
|
-
onChange: (o) =>
|
|
67
|
-
disabledDate:
|
|
68
|
-
disabled:
|
|
60
|
+
use12Hours: T,
|
|
61
|
+
renderExtraFooter: j,
|
|
62
|
+
value: y,
|
|
63
|
+
defaultValue: x,
|
|
64
|
+
format: d,
|
|
65
|
+
onChange: (o) => s == null ? void 0 : s(o),
|
|
66
|
+
disabledDate: q,
|
|
67
|
+
disabled: u,
|
|
69
68
|
className: "w-100",
|
|
70
69
|
placeholder: f
|
|
71
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),r=require("antd"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),r=require("antd"),i=require("../../locale/index.cjs.js"),o=require("../button/Button.cjs.js"),u=({loading:s,children:n,error:a})=>{const{t:e}=i.useTranslationLib();return t.jsx(r.Skeleton,{loading:s,paragraph:!0,className:"h-100",children:a?t.jsx(r.Result,{status:"404",title:404,subTitle:e("err.notFound"),className:"",extra:t.jsx(o,{to:-1,type:"primary",children:e("str.goBack")})}):n})};module.exports=u;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { Skeleton as n, Result as s } from "antd";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const { t: r } = m(p);
|
|
3
|
+
import { useTranslationLib as i } from "../../locale/index.es.js";
|
|
4
|
+
import m from "../button/Button.es.js";
|
|
5
|
+
const d = ({ loading: o, children: e, error: a }) => {
|
|
6
|
+
const { t: r } = i();
|
|
8
7
|
return (
|
|
9
8
|
// <Spin spinning={loading} className="h-100">
|
|
10
9
|
/* @__PURE__ */ t(n, { loading: o, paragraph: !0, className: "h-100", children: a ? /* @__PURE__ */ t(
|
|
@@ -14,11 +13,11 @@ const N = ({ loading: o, children: e, error: a }) => {
|
|
|
14
13
|
title: 404,
|
|
15
14
|
subTitle: r("err.notFound"),
|
|
16
15
|
className: "",
|
|
17
|
-
extra: /* @__PURE__ */ t(
|
|
16
|
+
extra: /* @__PURE__ */ t(m, { to: -1, type: "primary", children: r("str.goBack") })
|
|
18
17
|
}
|
|
19
18
|
) : e })
|
|
20
19
|
);
|
|
21
20
|
};
|
|
22
21
|
export {
|
|
23
|
-
|
|
22
|
+
d as default
|
|
24
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime");;/* empty css */;/* empty css */const S=require("@ant-design/icons"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime");;/* empty css */;/* empty css */const S=require("@ant-design/icons"),I=require("antd"),s=require("react"),xe=require("react-cropper"),he=require("../../locale/index.cjs.js"),z=require("../button/Button.cjs.js"),je=require("../../util/ImageUtil.cjs.js"),we=I.Form.Item;function X(r){return new Promise((d,p)=>{const o=new FileReader;o.readAsDataURL(r),o.onload=()=>d(o.result),o.onerror=f=>p(f)})}const Ce=({values:r=[],required:d,buttonType:p,label:o,name:f,onChange:m,aspectRatio:q,buttonTitle:j,hidePreview:w,buttonSize:g="large",showButtonText:x=!0,showOnlyIcon:B=!1,icon:y=t.jsx(S.UploadOutlined,{}),loading:U,maxCount:C=1,onAdd:l,onRemove:O,listType:R,...E})=>{const[Z,ee]=s.useState(""),[te,se]=s.useState(""),[re,_]=s.useState(!1),M=s.useRef(),a=s.useRef(),[i,k]=s.useState([]),[h,N]=s.useState(),oe=s.useRef(),ne=()=>_(!1),ae=async e=>{!e.url&&!e.preview&&(e.preview=await X(e.originFileObj)),se(e.url||e.preview),_(!0),ee(e.name)},[A,F]=s.useState(!1),ie=()=>{},L=e=>{var n;(n=a==null?void 0:a.current)==null||n.cropper.rotate(e?-90:90)};s.useEffect(()=>{m==null||m(i[0],i)},[i,m]);const ce=()=>{var v;const e=(v=a==null?void 0:a.current)==null?void 0:v.cropper.getCroppedCanvas(),{type:n,size:c,name:u,uid:b}=M.current;F(!0),e==null||e.toBlob(async me=>{const ge=Object.assign(new File([me],u,{type:n}),{uid:b}),G=await je.resizeImage(ge),K=await X(G),Q={url:K,name:u,uid:b,type:n,size:c,thumbUrl:K,originFileObj:G};if(l)try{F(!0),await l(Q)}finally{F(!1)}k([Q,...i]),F(!1)}),N(void 0)},le=()=>{N(void 0),M.current=void 0},J=s.useCallback(e=>{const n=e;if(n){M.current=n;const c=new FileReader;c.addEventListener("load",()=>{var u;if(typeof c.result=="string"){N(c.result);const b=localStorage.getItem("cropper.box"),v=b?JSON.parse(b):void 0;v&&((u=a==null?void 0:a.current)==null||u.cropper.setCropBoxData(v)),setTimeout(()=>{H()},100)}}),c.readAsDataURL(n)}},[]);s.useEffect(()=>{if(r!=null&&r.length||typeof r=="string"){const e=Array.isArray(r)?r.map(n=>[{uid:r,url:n}]):[{uid:r,url:r}];k(e)}},[r]);const{t:P}=he.useTranslationLib(),de=s.useMemo(()=>d?{required:d,validator:(e,n,c)=>{h||i!=null&&i.length?c():c(`${o??""} ${P("err.validation.required")}`)}}:void 0,[d,h,i==null?void 0:i.length,o,P]),T=j??P("message.fileUploadMessage2"),V=s.useMemo(()=>t.jsx(Y,{showLoadingIndicator:A,_buttonTitle:T,buttonSize:g,buttonType:p,fileList:i,hidePreview:w,icon:y,loading:U,listType:R,maxCount:C,onChangeFile:J,onRemove:O,showButtonText:x,handlePreview:ae,setFileList:k}),[A,T,g,p,i,w,y,U,R,C,J,O,x]);oe.current=V.props.beforeUpload;const[ue,W]=s.useState(0),[pe,$]=s.useState(0),[D,fe]=s.useState();s.useEffect(()=>{const e=setTimeout(()=>{D&&localStorage.setItem("cropper.box",JSON.stringify(D))},400);return()=>clearTimeout(e)},[D]),s.useEffect(()=>{h||(W(0),$(0))},[h]);const H=s.useCallback(async()=>{var n;const e=(n=a==null?void 0:a.current)==null?void 0:n.cropper;if(e){const{width:c,height:u}=e.getCroppedCanvas();fe(e.getCropBoxData()),W(c),$(u)}},[]);return t.jsxs(t.Fragment,{children:[t.jsx(we,{label:o,...E,name:f,className:"mb-0",rules:[de,...E.rules??[]],children:V}),t.jsxs(I.Modal,{open:!!h,maskClosable:!1,onOk:ce,closable:!1,onCancel:le,children:[t.jsx(xe.Cropper,{ref:a,src:h,cropmove:H,viewMode:1,aspectRatio:q,cropend:()=>ie()}),t.jsx("p",{className:"text-center",children:[ue,pe].join(" ⨉ ")}),t.jsxs("div",{className:"mt-2 d-flex justify-content-center",children:[t.jsx(z,{size:"large",icon:t.jsx(S.RotateLeftOutlined,{}),onClick:()=>L(!0)}),t.jsx(z,{size:"large",icon:t.jsx(S.RotateRightOutlined,{}),onClick:()=>L(!1)})]})]}),t.jsx(I.Modal,{open:re,title:Z,footer:null,onCancel:ne,children:t.jsx("div",{className:"text-center",children:t.jsx("img",{alt:"example",style:{maxWidth:"400px"},src:te})})})]})},Y=({_buttonTitle:r,buttonSize:d,buttonType:p,fileList:o,hidePreview:f,icon:m,loading:q,maxCount:j,onChangeFile:w,onRemove:g,showButtonText:x,handlePreview:B,setFileList:y,showLoadingIndicator:U,listType:C="picture"})=>t.jsx(t.Fragment,{children:t.jsxs(I.Upload,{accept:"image/x-png,image/gif,image/jpeg",fileList:o,defaultFileList:o,onChange:()=>{},className:(o.length>=j?" hide-upload ":"")+" mb-0",multiple:!1,onPreview:f?void 0:B,onDrop:l=>(w(l.dataTransfer.files.item(0)),!1),listType:C,showUploadList:!f,onRemove:l=>{const O=o.filter(R=>l.uid!==R.uid);g==null||g(l),y(O)},beforeUpload:async l=>(w(l),!1),maxCount:j,children:[U&&t.jsx(S.LoadingOutlined,{}),t.jsx("div",{className:"d-flex flex-column",children:o.length<j&&(C==="picture-circle"?t.jsx(S.UploadOutlined,{}):t.jsx(z,{loading:q,tooltip:x?void 0:r,size:d,icon:m,type:x?p:"text",children:x?r:void 0}))})]},o.length)});exports.UploadComponent=Y;exports.default=Ce;
|