@kingteza/crud-component 1.0.40 → 1.0.43
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/DateUtil.cjs.js +1 -1
- package/util/DateUtil.es.js +16 -4
- package/util/ValidationUtil.cjs.js +1 -1
- package/util/ValidationUtil.es.js +26 -23
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { jsxs as w, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { WarningTwoTone as B, DownloadOutlined as z } from "@ant-design/icons";
|
|
3
|
-
import
|
|
4
|
-
import { Tooltip as
|
|
3
|
+
import $ from "papaparse";
|
|
4
|
+
import { Tooltip as V, App as R, Modal as U, Space as O, Spin as Y, Progress as _ } from "antd";
|
|
5
5
|
import { saveAs as G } from "file-saver";
|
|
6
|
-
import { useState as T, useEffect as H, useMemo as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import Q from "
|
|
10
|
-
import X from "../../
|
|
11
|
-
import Z from "../../common/button/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
fields: N,
|
|
6
|
+
import { useState as T, useEffect as H, useMemo as A, useCallback as f } from "react";
|
|
7
|
+
import { useTranslationLib as J } from "../../locale/index.es.js";
|
|
8
|
+
import K from "../view/CrudViewer.es.js";
|
|
9
|
+
import Q from "../../util/DateUtil.es.js";
|
|
10
|
+
import X from "../../common/button/Button.es.js";
|
|
11
|
+
import { ImportButton as Z } from "../../common/button/ImportButton.es.js";
|
|
12
|
+
function de({
|
|
13
|
+
onCloseMethod: b,
|
|
14
|
+
open: x,
|
|
15
|
+
fields: D,
|
|
17
16
|
importProps: o
|
|
18
17
|
}) {
|
|
19
|
-
const [c,
|
|
18
|
+
const [c, F] = T([]), [g, C] = T(!1), [N, I] = T(0);
|
|
20
19
|
H(() => {
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
const u =
|
|
20
|
+
x || (F([]), C(!1));
|
|
21
|
+
}, [x]);
|
|
22
|
+
const u = A(
|
|
24
23
|
() => new Map(
|
|
25
|
-
|
|
24
|
+
D.filter((e) => {
|
|
26
25
|
var t;
|
|
27
26
|
return !e.hidden && !((t = e.importProps) != null && t.hidden) && !e.readonly;
|
|
28
27
|
}).map((e) => [e.name, e])
|
|
29
28
|
),
|
|
30
|
-
[
|
|
31
|
-
),
|
|
29
|
+
[D]
|
|
30
|
+
), E = A(
|
|
32
31
|
() => Array.from(u.values()).flatMap((e) => {
|
|
33
32
|
var t;
|
|
34
33
|
return [
|
|
@@ -37,24 +36,24 @@ function fe({
|
|
|
37
36
|
];
|
|
38
37
|
}),
|
|
39
38
|
[u]
|
|
40
|
-
),
|
|
39
|
+
), W = f(
|
|
41
40
|
async function() {
|
|
42
|
-
const e = `${
|
|
41
|
+
const e = `${E.join(",")}
|
|
43
42
|
`, t = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
44
43
|
G(
|
|
45
44
|
t,
|
|
46
|
-
(o == null ? void 0 : o.name) + " - " +
|
|
45
|
+
(o == null ? void 0 : o.name) + " - " + Q.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
47
46
|
);
|
|
48
47
|
},
|
|
49
|
-
[
|
|
50
|
-
), { t: s } = J(
|
|
48
|
+
[E, o == null ? void 0 : o.name]
|
|
49
|
+
), { t: s } = J(), L = f(async (e) => {
|
|
51
50
|
const t = new FileReader();
|
|
52
51
|
t.onerror = console.error, t.onload = async (r) => {
|
|
53
52
|
var n;
|
|
54
|
-
const l = (n = r == null ? void 0 : r.target) == null ? void 0 : n.result, a =
|
|
55
|
-
|
|
53
|
+
const l = (n = r == null ? void 0 : r.target) == null ? void 0 : n.result, a = $.parse(l, { header: !0 });
|
|
54
|
+
F(a.data);
|
|
56
55
|
}, t.readAsText(e);
|
|
57
|
-
}, []), k =
|
|
56
|
+
}, []), k = A(() => {
|
|
58
57
|
var t, r, l;
|
|
59
58
|
let e = !1;
|
|
60
59
|
for (const a of c)
|
|
@@ -62,8 +61,8 @@ function fe({
|
|
|
62
61
|
const h = a[n], m = h || !isNaN(h);
|
|
63
62
|
if (d.required && !m)
|
|
64
63
|
if ((r = (t = d.importProps) == null ? void 0 : t.extraFields) != null && r.length)
|
|
65
|
-
for (const
|
|
66
|
-
if (a[
|
|
64
|
+
for (const v of ((l = d.importProps) == null ? void 0 : l.extraFields) ?? [])
|
|
65
|
+
if (a[v] || !isNaN(a[v])) {
|
|
67
66
|
e = !1;
|
|
68
67
|
break;
|
|
69
68
|
} else return !0;
|
|
@@ -80,7 +79,7 @@ function fe({
|
|
|
80
79
|
const m = (d = e.importProps) == null ? void 0 : d.extraFields;
|
|
81
80
|
(m == null ? void 0 : m.find((j) => !r[j])) && (h = "Either one of these fields is required: " + [e.name, ...m].join(", "));
|
|
82
81
|
}
|
|
83
|
-
return /* @__PURE__ */ w(
|
|
82
|
+
return /* @__PURE__ */ w(V, { className: "d-flex", title: h, children: [
|
|
84
83
|
/* @__PURE__ */ i(B, { twoToneColor: "#ee9702" }),
|
|
85
84
|
t
|
|
86
85
|
] });
|
|
@@ -88,16 +87,16 @@ function fe({
|
|
|
88
87
|
return t;
|
|
89
88
|
},
|
|
90
89
|
[s]
|
|
91
|
-
),
|
|
92
|
-
|
|
90
|
+
), q = f(async (e) => {
|
|
91
|
+
I(e);
|
|
93
92
|
}, []), y = f(async () => {
|
|
94
93
|
try {
|
|
95
|
-
|
|
94
|
+
C(!0), await o.onClickImport(c, q), b(!1);
|
|
96
95
|
} finally {
|
|
97
|
-
|
|
96
|
+
C(!1), I(0);
|
|
98
97
|
}
|
|
99
|
-
}, [c, o,
|
|
100
|
-
k ?
|
|
98
|
+
}, [c, o, b, q]), { modal: S } = R.useApp(), M = f(async () => {
|
|
99
|
+
k ? S.warning ? S.warning({
|
|
101
100
|
title: s("str.warning"),
|
|
102
101
|
content: s("qus.importWithIssues"),
|
|
103
102
|
okText: s("str.import"),
|
|
@@ -109,24 +108,24 @@ function fe({
|
|
|
109
108
|
), window.confirm(s("qus.importWithIssues")) && y()) : y();
|
|
110
109
|
}, [k, y, s]);
|
|
111
110
|
return /* @__PURE__ */ w(
|
|
112
|
-
|
|
111
|
+
U,
|
|
113
112
|
{
|
|
114
113
|
title: [s("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
|
|
115
114
|
width: "100%",
|
|
116
|
-
open:
|
|
117
|
-
onOk:
|
|
115
|
+
open: x,
|
|
116
|
+
onOk: M,
|
|
118
117
|
destroyOnClose: !0,
|
|
119
|
-
onCancel: () =>
|
|
118
|
+
onCancel: () => b(!1),
|
|
120
119
|
okText: s("str.import"),
|
|
121
|
-
confirmLoading:
|
|
120
|
+
confirmLoading: g,
|
|
122
121
|
okButtonProps: {
|
|
123
122
|
disabled: !(c != null && c.length)
|
|
124
123
|
},
|
|
125
|
-
footer: (e, { OkBtn: t, CancelBtn: r }) => /* @__PURE__ */ w(
|
|
124
|
+
footer: (e, { OkBtn: t, CancelBtn: r }) => /* @__PURE__ */ w(O, { children: [
|
|
126
125
|
/* @__PURE__ */ i(r, {}),
|
|
127
126
|
/* @__PURE__ */ i(t, {}),
|
|
128
127
|
k && /* @__PURE__ */ i(
|
|
129
|
-
|
|
128
|
+
V,
|
|
130
129
|
{
|
|
131
130
|
className: "d-flex",
|
|
132
131
|
title: "Some fields have issue. Please review before submit.",
|
|
@@ -135,41 +134,41 @@ function fe({
|
|
|
135
134
|
)
|
|
136
135
|
] }),
|
|
137
136
|
children: [
|
|
138
|
-
/* @__PURE__ */ w(
|
|
137
|
+
/* @__PURE__ */ w(O, { children: [
|
|
139
138
|
/* @__PURE__ */ i(
|
|
140
|
-
|
|
139
|
+
X,
|
|
141
140
|
{
|
|
142
|
-
onClick:
|
|
141
|
+
onClick: W,
|
|
143
142
|
icon: /* @__PURE__ */ i(z, {}),
|
|
144
143
|
children: s("str.downloadCsvTemplate")
|
|
145
144
|
}
|
|
146
145
|
),
|
|
147
146
|
/* @__PURE__ */ i(
|
|
148
|
-
|
|
147
|
+
Z,
|
|
149
148
|
{
|
|
150
|
-
disabled:
|
|
149
|
+
disabled: g,
|
|
151
150
|
type: "default",
|
|
152
|
-
onClick:
|
|
151
|
+
onClick: L,
|
|
153
152
|
accept: ".csv",
|
|
154
153
|
children: s("str.importCsvFile")
|
|
155
154
|
}
|
|
156
155
|
)
|
|
157
156
|
] }),
|
|
158
157
|
/* @__PURE__ */ i(
|
|
159
|
-
|
|
158
|
+
Y,
|
|
160
159
|
{
|
|
161
|
-
spinning:
|
|
162
|
-
indicator:
|
|
163
|
-
|
|
160
|
+
spinning: g,
|
|
161
|
+
indicator: N ? /* @__PURE__ */ i(
|
|
162
|
+
_,
|
|
164
163
|
{
|
|
165
164
|
type: "circle",
|
|
166
|
-
percent:
|
|
165
|
+
percent: N * 100,
|
|
167
166
|
size: 50,
|
|
168
167
|
format: (e) => `${parseInt(e)}%`
|
|
169
168
|
}
|
|
170
169
|
) : void 0,
|
|
171
170
|
children: /* @__PURE__ */ i(
|
|
172
|
-
|
|
171
|
+
K,
|
|
173
172
|
{
|
|
174
173
|
data: c,
|
|
175
174
|
bordered: !0,
|
|
@@ -219,5 +218,5 @@ function fe({
|
|
|
219
218
|
);
|
|
220
219
|
}
|
|
221
220
|
export {
|
|
222
|
-
|
|
221
|
+
de as default
|
|
223
222
|
};
|
|
@@ -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"),f=require("../../common/description/DescList.cjs.js"),q=require("react"),x=require("../../locale/index.cjs.js"),V=require("./CrudViewerUtil.cjs.js");function d({className:o,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:b}){const{t:n}=x.useTranslationLib(),g=q.useMemo(()=>{const l=u.filter(({hidden:r,hideInDescList:i})=>!r&&!i).map((r,i)=>({label:r.label,noFormatting:!0,value:V.getRendererValueCrudViewer(r)(e==null?void 0:e[r.name],e,i)}));return t&&l.push({label:n("str.action"),value:t}),l},[t,e,u,n]);return e?s.jsx(f,{keepEmptyValues:b,bordered:!0,column:c,className:o,layout:m,list:g}):s.jsx(s.Fragment,{})}exports.CrudDecListView=d;
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { jsx as l, Fragment as b } from "react/jsx-runtime";
|
|
2
2
|
import g from "../../common/description/DescList.es.js";
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function E({
|
|
3
|
+
import { useMemo as x } from "react";
|
|
4
|
+
import { useTranslationLib as L } from "../../locale/index.es.js";
|
|
5
|
+
import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.es.js";
|
|
6
|
+
function h({
|
|
8
7
|
className: n,
|
|
9
|
-
fields:
|
|
8
|
+
fields: m,
|
|
10
9
|
data: r,
|
|
11
10
|
descListColumn: u = { xs: 1, md: 3, sm: 2, lg: 4 },
|
|
12
11
|
layout: f,
|
|
13
12
|
action: o,
|
|
14
13
|
keepEmptyValues: p
|
|
15
14
|
}) {
|
|
16
|
-
const { t: i } =
|
|
17
|
-
const s =
|
|
15
|
+
const { t: i } = L(), c = x(() => {
|
|
16
|
+
const s = m.filter(({ hidden: e, hideInDescList: t }) => !e && !t).map((e, t) => ({
|
|
18
17
|
label: e.label,
|
|
19
18
|
noFormatting: !0,
|
|
20
|
-
value:
|
|
19
|
+
value: V(e)(
|
|
21
20
|
r == null ? void 0 : r[e.name],
|
|
22
21
|
r,
|
|
23
|
-
|
|
22
|
+
t
|
|
24
23
|
)
|
|
25
24
|
}));
|
|
26
25
|
return o && s.push({ label: i("str.action"), value: o }), s;
|
|
27
|
-
}, [o, r,
|
|
26
|
+
}, [o, r, m, i]);
|
|
28
27
|
return r ? /* @__PURE__ */ l(
|
|
29
28
|
g,
|
|
30
29
|
{
|
|
@@ -38,5 +37,5 @@ function E({
|
|
|
38
37
|
) : /* @__PURE__ */ l(b, {});
|
|
39
38
|
}
|
|
40
39
|
export {
|
|
41
|
-
|
|
40
|
+
h as CrudDecListView
|
|
42
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),A=require("antd"),H=require("../../common/button/CloneButtonTable.cjs.js"),p=require("../../common/button/DeleteButtonTable.cjs.js"),U=require("../../common/button/ExportButton.cjs.js"),F=require("../../common/button/HideButtonTable.cjs.js"),rr=require("../../common/button/RefreshButton.cjs.js"),er=require("../../common/button/UpdateButtonTable.cjs.js"),tr=require("../../common/button/ViewButtonTable.cjs.js"),ur=require("../../common/table/table.cjs.js"),j=require("react"),sr=require("../../locale/index.cjs.js"),nr=require("../CrudSearchComponent.cjs.js"),or=require("./CrudDecListView.cjs.js"),E=require("./CrudViewerUtil.cjs.js"),cr=require("../../common/layout/VerticalSpace.cjs.js");function lr({idField:u="id",loadingData:_,fields:l,isDeleting:m,isHiding:y,viewable:o=!1,paginateProps:h,onDelete:q,onHide:T,onUpdate:v,data:x=[],extraAction:i,onClickUpdate:c,minusHeight:C,scroll:$,onClickClone:B,className:w,expandable:G,size:J,bordered:K,descListColumn:N,extraView:b,decListLayout:Q,scrollToTop:ar,onClickRefresh:V,closeViewOnClickUpdate:d,onExport:g,confirmHiding:I,confirmDeleting:L,rowClassName:W,actionWidth:X=190,...Y}){const{t:Z}=sr.useTranslationLib(),M=j.useMemo(()=>l.map(({hideInTable:e,hidden:t,width:a,name:n,label:P,halign:k,...O})=>({title:P,width:a,key:n,dataIndex:n,hidden:e||t,align:k??(O.type==="number"?"right":void 0),render:E.getRendererValueCrudViewer(O)})),[l]),[s,f]=j.useState(),[S,R]=j.useState();j.useEffect(()=>{x&&f(e=>{if(e)return x.find(t=>t[u]===e[u])})},[x,u,s]);const z=j.useCallback(e=>{var a;const t=i==null?void 0:i(e);return(Array.isArray(t)?(a=t==null?void 0:t.filter(Boolean))!=null&&a.length:t)||v||c||B||q?r.jsxs(r.Fragment,{children:[t,(v||c)&&r.jsx(er,{value:e,onClick:n=>{R(n[u]),c==null||c(e),d&&f(void 0)}}),B&&r.jsx(H,{value:e,onClick:n=>B(n)}),g&&r.jsx(U.ExportButton,{value:e,onClick:async n=>await g(n)}),T&&r.jsx(F,{value:e,disabled:y,shouldConfirm:I,loading:y&&e[u]===S,onClick:async n=>{R(n[u]),await T({[u]:n[u]})}}),q&&r.jsx(p,{value:e,disabled:m,shouldConfirm:L,loading:m&&e[u]===S,onClick:async n=>{R(n[u]),await q({[u]:n[u]})}})]}):void 0},[d,L,I,i,u,m,y,B,c,q,g,T,v,S]),D=j.useMemo(()=>{let e=typeof o=="string"?s==null?void 0:s[o]:void 0;if(typeof e=="object"){const t=l.find(a=>a.name===o);e=E.getRendererValueCrudViewer(t)(e,s,0)}return e},[o,s,l]);return r.jsxs("div",{children:[o&&r.jsx(A.Modal,{width:"100%",open:!!s,title:D??r.jsx("div",{children:" "}),footer:r.jsx(r.Fragment,{}),closable:!0,onCancel:()=>f(void 0),children:!!s&&r.jsxs("div",{children:[r.jsx(or.CrudDecListView,{layout:Q,descListColumn:N,data:s,fields:l,action:z(s)}),b==null?void 0:b(s)]},s==null?void 0:s[u])}),r.jsx(nr,{fields:l,...Y}),r.jsxs(cr,{children:[!!V&&r.jsx(rr.RefreshButton,{onClick:V}),r.jsx(ur,{rowClassName:W,className:w,scroll:$??(C?{y:`calc(100vh - ${C})`}:void 0),id:"crud-table",dataSource:x,loading:_,bordered:K,size:J,expandable:G,pagination:h?{total:h.count,onChange:h.setPage,current:h.page,pageSize:h.pageSize}:void 0,columns:v||c||q||i||o?[...M,{title:Z("str.action"),dataIndex:"",fixed:"right",width:X,render:(e,t)=>r.jsxs(r.Fragment,{children:[o&&r.jsx(tr,{value:t,onClick:f}),z(t)]})}]:M})]})]})}module.exports=lr;
|
|
@@ -1,106 +1,105 @@
|
|
|
1
|
-
import { jsxs as v, Fragment as
|
|
1
|
+
import { jsxs as v, Fragment as z, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { Modal as U } from "antd";
|
|
3
3
|
import F from "../../common/button/CloneButtonTable.es.js";
|
|
4
4
|
import rr from "../../common/button/DeleteButtonTable.es.js";
|
|
5
5
|
import { ExportButton as or } from "../../common/button/ExportButton.es.js";
|
|
6
6
|
import tr from "../../common/button/HideButtonTable.es.js";
|
|
7
|
-
import { RefreshButton as
|
|
8
|
-
import
|
|
7
|
+
import { RefreshButton as ur } from "../../common/button/RefreshButton.es.js";
|
|
8
|
+
import mr from "../../common/button/UpdateButtonTable.es.js";
|
|
9
9
|
import nr from "../../common/button/ViewButtonTable.es.js";
|
|
10
|
-
import
|
|
11
|
-
import { useMemo as
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import hr from "
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
function _r({
|
|
10
|
+
import cr from "../../common/table/table.es.js";
|
|
11
|
+
import { useMemo as E, useState as G, useEffect as er, useCallback as fr } from "react";
|
|
12
|
+
import { useTranslationLib as lr } from "../../locale/index.es.js";
|
|
13
|
+
import sr from "../CrudSearchComponent.es.js";
|
|
14
|
+
import { CrudDecListView as hr } from "./CrudDecListView.es.js";
|
|
15
|
+
import { getRendererValueCrudViewer as J } from "./CrudViewerUtil.es.js";
|
|
16
|
+
import ar from "../../common/layout/VerticalSpace.es.js";
|
|
17
|
+
function Vr({
|
|
19
18
|
idField: t = "id",
|
|
20
|
-
loadingData:
|
|
21
|
-
fields:
|
|
22
|
-
isDeleting:
|
|
23
|
-
isHiding:
|
|
24
|
-
viewable:
|
|
19
|
+
loadingData: K,
|
|
20
|
+
fields: f,
|
|
21
|
+
isDeleting: p,
|
|
22
|
+
isHiding: i,
|
|
23
|
+
viewable: c = !1,
|
|
25
24
|
paginateProps: s,
|
|
26
25
|
onDelete: h,
|
|
27
|
-
onHide:
|
|
28
|
-
onUpdate:
|
|
29
|
-
data:
|
|
26
|
+
onHide: S,
|
|
27
|
+
onUpdate: y,
|
|
28
|
+
data: B = [],
|
|
30
29
|
extraAction: a,
|
|
31
|
-
onClickUpdate:
|
|
32
|
-
minusHeight:
|
|
33
|
-
scroll:
|
|
34
|
-
onClickClone:
|
|
35
|
-
className:
|
|
36
|
-
expandable:
|
|
37
|
-
size:
|
|
38
|
-
bordered:
|
|
39
|
-
descListColumn:
|
|
30
|
+
onClickUpdate: e,
|
|
31
|
+
minusHeight: L,
|
|
32
|
+
scroll: N,
|
|
33
|
+
onClickClone: T,
|
|
34
|
+
className: Q,
|
|
35
|
+
expandable: W,
|
|
36
|
+
size: X,
|
|
37
|
+
bordered: Y,
|
|
38
|
+
descListColumn: Z,
|
|
40
39
|
extraView: g,
|
|
41
|
-
decListLayout:
|
|
42
|
-
scrollToTop:
|
|
43
|
-
onClickRefresh:
|
|
44
|
-
closeViewOnClickUpdate:
|
|
40
|
+
decListLayout: d,
|
|
41
|
+
scrollToTop: vr,
|
|
42
|
+
onClickRefresh: M,
|
|
43
|
+
closeViewOnClickUpdate: O,
|
|
45
44
|
onExport: I,
|
|
46
|
-
confirmHiding:
|
|
47
|
-
confirmDeleting:
|
|
48
|
-
rowClassName:
|
|
49
|
-
actionWidth:
|
|
50
|
-
...
|
|
45
|
+
confirmHiding: R,
|
|
46
|
+
confirmDeleting: V,
|
|
47
|
+
rowClassName: w,
|
|
48
|
+
actionWidth: D = 190,
|
|
49
|
+
...P
|
|
51
50
|
}) {
|
|
52
|
-
const { t:
|
|
53
|
-
() =>
|
|
54
|
-
({ hideInTable: r, hidden: o, width: l, name:
|
|
51
|
+
const { t: k } = lr(), _ = E(
|
|
52
|
+
() => f.map(
|
|
53
|
+
({ hideInTable: r, hidden: o, width: l, name: m, label: H, halign: x, ...q }) => ({
|
|
55
54
|
title: H,
|
|
56
55
|
width: l,
|
|
57
|
-
key:
|
|
58
|
-
dataIndex:
|
|
56
|
+
key: m,
|
|
57
|
+
dataIndex: m,
|
|
59
58
|
hidden: r || o,
|
|
60
|
-
align: x ?? (
|
|
61
|
-
render:
|
|
59
|
+
align: x ?? (q.type === "number" ? "right" : void 0),
|
|
60
|
+
render: J(q)
|
|
62
61
|
})
|
|
63
62
|
),
|
|
64
|
-
[
|
|
65
|
-
), [
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
[f]
|
|
64
|
+
), [u, b] = G(), [j, C] = G();
|
|
65
|
+
er(() => {
|
|
66
|
+
B && b((r) => {
|
|
68
67
|
if (r)
|
|
69
|
-
return
|
|
68
|
+
return B.find((o) => o[t] === r[t]);
|
|
70
69
|
});
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
70
|
+
}, [B, t, u]);
|
|
71
|
+
const $ = fr(
|
|
73
72
|
(r) => {
|
|
74
73
|
var l;
|
|
75
74
|
const o = a == null ? void 0 : a(r);
|
|
76
|
-
return (Array.isArray(o) ? (l = o == null ? void 0 : o.filter(Boolean)) != null && l.length : o) ||
|
|
75
|
+
return (Array.isArray(o) ? (l = o == null ? void 0 : o.filter(Boolean)) != null && l.length : o) || y || e || T || h ? /* @__PURE__ */ v(z, { children: [
|
|
77
76
|
o,
|
|
78
|
-
(
|
|
79
|
-
|
|
77
|
+
(y || e) && /* @__PURE__ */ n(
|
|
78
|
+
mr,
|
|
80
79
|
{
|
|
81
80
|
value: r,
|
|
82
|
-
onClick: (
|
|
83
|
-
|
|
81
|
+
onClick: (m) => {
|
|
82
|
+
C(m[t]), e == null || e(r), O && b(void 0);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
),
|
|
87
|
-
|
|
86
|
+
T && /* @__PURE__ */ n(F, { value: r, onClick: (m) => T(m) }),
|
|
88
87
|
I && /* @__PURE__ */ n(
|
|
89
88
|
or,
|
|
90
89
|
{
|
|
91
90
|
value: r,
|
|
92
|
-
onClick: async (
|
|
91
|
+
onClick: async (m) => await I(m)
|
|
93
92
|
}
|
|
94
93
|
),
|
|
95
|
-
|
|
94
|
+
S && /* @__PURE__ */ n(
|
|
96
95
|
tr,
|
|
97
96
|
{
|
|
98
97
|
value: r,
|
|
99
|
-
disabled:
|
|
100
|
-
shouldConfirm:
|
|
101
|
-
loading:
|
|
102
|
-
onClick: async (
|
|
103
|
-
|
|
98
|
+
disabled: i,
|
|
99
|
+
shouldConfirm: R,
|
|
100
|
+
loading: i && r[t] === j,
|
|
101
|
+
onClick: async (m) => {
|
|
102
|
+
C(m[t]), await S({ [t]: m[t] });
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
),
|
|
@@ -108,110 +107,110 @@ function _r({
|
|
|
108
107
|
rr,
|
|
109
108
|
{
|
|
110
109
|
value: r,
|
|
111
|
-
disabled:
|
|
112
|
-
shouldConfirm:
|
|
113
|
-
loading:
|
|
114
|
-
onClick: async (
|
|
115
|
-
|
|
110
|
+
disabled: p,
|
|
111
|
+
shouldConfirm: V,
|
|
112
|
+
loading: p && r[t] === j,
|
|
113
|
+
onClick: async (m) => {
|
|
114
|
+
C(m[t]), await h({ [t]: m[t] });
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
)
|
|
119
118
|
] }) : void 0;
|
|
120
119
|
},
|
|
121
120
|
[
|
|
121
|
+
O,
|
|
122
|
+
V,
|
|
122
123
|
R,
|
|
123
|
-
E,
|
|
124
|
-
z,
|
|
125
124
|
a,
|
|
126
125
|
t,
|
|
127
|
-
|
|
128
|
-
b,
|
|
129
|
-
B,
|
|
130
|
-
c,
|
|
131
|
-
h,
|
|
132
|
-
I,
|
|
126
|
+
p,
|
|
133
127
|
i,
|
|
134
128
|
T,
|
|
135
|
-
|
|
129
|
+
e,
|
|
130
|
+
h,
|
|
131
|
+
I,
|
|
132
|
+
S,
|
|
133
|
+
y,
|
|
134
|
+
j
|
|
136
135
|
]
|
|
137
|
-
),
|
|
138
|
-
let r = typeof
|
|
136
|
+
), A = E(() => {
|
|
137
|
+
let r = typeof c == "string" ? u == null ? void 0 : u[c] : void 0;
|
|
139
138
|
if (typeof r == "object") {
|
|
140
|
-
const o =
|
|
141
|
-
r =
|
|
139
|
+
const o = f.find((l) => l.name === c);
|
|
140
|
+
r = J(o)(
|
|
142
141
|
r,
|
|
143
|
-
|
|
142
|
+
u,
|
|
144
143
|
0
|
|
145
144
|
);
|
|
146
145
|
}
|
|
147
146
|
return r;
|
|
148
|
-
}, [
|
|
147
|
+
}, [c, u, f]);
|
|
149
148
|
return /* @__PURE__ */ v("div", { children: [
|
|
150
|
-
|
|
149
|
+
c && /* @__PURE__ */ n(
|
|
151
150
|
U,
|
|
152
151
|
{
|
|
153
152
|
width: "100%",
|
|
154
|
-
open: !!
|
|
155
|
-
title:
|
|
156
|
-
footer: /* @__PURE__ */ n(
|
|
153
|
+
open: !!u,
|
|
154
|
+
title: A ?? /* @__PURE__ */ n("div", { children: " " }),
|
|
155
|
+
footer: /* @__PURE__ */ n(z, {}),
|
|
157
156
|
closable: !0,
|
|
158
|
-
onCancel: () =>
|
|
159
|
-
children: !!
|
|
157
|
+
onCancel: () => b(void 0),
|
|
158
|
+
children: !!u && /* @__PURE__ */ v("div", { children: [
|
|
160
159
|
/* @__PURE__ */ n(
|
|
161
|
-
|
|
160
|
+
hr,
|
|
162
161
|
{
|
|
163
|
-
layout:
|
|
164
|
-
descListColumn:
|
|
165
|
-
data:
|
|
166
|
-
fields:
|
|
167
|
-
action:
|
|
162
|
+
layout: d,
|
|
163
|
+
descListColumn: Z,
|
|
164
|
+
data: u,
|
|
165
|
+
fields: f,
|
|
166
|
+
action: $(u)
|
|
168
167
|
}
|
|
169
168
|
),
|
|
170
|
-
g == null ? void 0 : g(
|
|
171
|
-
] },
|
|
169
|
+
g == null ? void 0 : g(u)
|
|
170
|
+
] }, u == null ? void 0 : u[t])
|
|
172
171
|
}
|
|
173
172
|
),
|
|
174
|
-
/* @__PURE__ */ n(
|
|
175
|
-
/* @__PURE__ */ v(
|
|
176
|
-
!!
|
|
173
|
+
/* @__PURE__ */ n(sr, { fields: f, ...P }),
|
|
174
|
+
/* @__PURE__ */ v(ar, { children: [
|
|
175
|
+
!!M && /* @__PURE__ */ n(ur, { onClick: M }),
|
|
177
176
|
/* @__PURE__ */ n(
|
|
178
|
-
|
|
177
|
+
cr,
|
|
179
178
|
{
|
|
180
|
-
rowClassName:
|
|
181
|
-
className:
|
|
182
|
-
scroll:
|
|
183
|
-
y: `calc(100vh - ${
|
|
179
|
+
rowClassName: w,
|
|
180
|
+
className: Q,
|
|
181
|
+
scroll: N ?? (L ? {
|
|
182
|
+
y: `calc(100vh - ${L})`
|
|
184
183
|
} : void 0),
|
|
185
184
|
id: "crud-table",
|
|
186
|
-
dataSource:
|
|
187
|
-
loading:
|
|
188
|
-
bordered:
|
|
189
|
-
size:
|
|
190
|
-
expandable:
|
|
185
|
+
dataSource: B,
|
|
186
|
+
loading: K,
|
|
187
|
+
bordered: Y,
|
|
188
|
+
size: X,
|
|
189
|
+
expandable: W,
|
|
191
190
|
pagination: s ? {
|
|
192
191
|
total: s.count,
|
|
193
192
|
onChange: s.setPage,
|
|
194
193
|
current: s.page,
|
|
195
194
|
pageSize: s.pageSize
|
|
196
195
|
} : void 0,
|
|
197
|
-
columns:
|
|
198
|
-
...
|
|
196
|
+
columns: y || e || h || a || c ? [
|
|
197
|
+
..._,
|
|
199
198
|
{
|
|
200
|
-
title:
|
|
199
|
+
title: k("str.action"),
|
|
201
200
|
dataIndex: "",
|
|
202
201
|
fixed: "right",
|
|
203
|
-
width:
|
|
204
|
-
render: (r, o) => /* @__PURE__ */ v(
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
width: D,
|
|
203
|
+
render: (r, o) => /* @__PURE__ */ v(z, { children: [
|
|
204
|
+
c && /* @__PURE__ */ n(nr, { value: o, onClick: b }),
|
|
205
|
+
$(o)
|
|
207
206
|
] })
|
|
208
207
|
}
|
|
209
|
-
] :
|
|
208
|
+
] : _
|
|
210
209
|
}
|
|
211
210
|
)
|
|
212
211
|
] })
|
|
213
212
|
] });
|
|
214
213
|
}
|
|
215
214
|
export {
|
|
216
|
-
|
|
215
|
+
Vr as default
|
|
217
216
|
};
|