@kingteza/crud-component 1.0.6 → 1.0.9
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/FileSaver.min.cjs +1 -0
- package/dist/_virtual/FileSaver.min.js +5 -0
- package/dist/_virtual/FileSaver.min2.cjs +1 -0
- package/dist/_virtual/FileSaver.min2.js +4 -0
- package/dist/_virtual/ShowMoreText.cjs +1 -0
- package/dist/_virtual/ShowMoreText.js +7 -0
- package/dist/_virtual/ShowMoreText2.cjs +1 -0
- package/dist/_virtual/ShowMoreText2.js +4 -0
- package/dist/_virtual/Truncate.cjs +1 -0
- package/dist/_virtual/Truncate.js +4 -0
- package/dist/_virtual/_commonjsHelpers.cjs +1 -1
- package/dist/_virtual/_commonjsHelpers.js +5 -3
- package/dist/_virtual/index.cjs +1 -1
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index10.cjs +1 -0
- package/dist/_virtual/index10.js +7 -0
- package/dist/_virtual/index11.cjs +1 -0
- package/dist/_virtual/index11.js +7 -0
- package/dist/_virtual/index12.cjs +1 -0
- package/dist/_virtual/index12.js +4 -0
- package/dist/_virtual/index13.cjs +1 -0
- package/dist/_virtual/index13.js +4 -0
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +3 -5
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index3.js +5 -2
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.js +2 -2
- package/dist/_virtual/index6.cjs +1 -0
- package/dist/_virtual/index6.js +4 -0
- package/dist/_virtual/index7.cjs +1 -0
- package/dist/_virtual/index7.js +4 -0
- package/dist/_virtual/index8.cjs +1 -0
- package/dist/_virtual/index8.js +2 -0
- package/dist/_virtual/index9.cjs +1 -0
- package/dist/_virtual/index9.js +7 -0
- package/dist/_virtual/main.cjs +1 -0
- package/dist/_virtual/main.js +7 -0
- package/dist/_virtual/main2.cjs +1 -0
- package/dist/_virtual/main2.js +4 -0
- package/dist/_virtual/papaparse.min.cjs +1 -0
- package/dist/_virtual/papaparse.min.js +7 -0
- package/dist/_virtual/papaparse.min2.cjs +1 -0
- package/dist/_virtual/papaparse.min2.js +4 -0
- package/dist/_virtual/react-is.development2.cjs +1 -0
- package/dist/_virtual/react-is.development2.js +4 -0
- package/dist/_virtual/react-is.production.min2.cjs +1 -0
- package/dist/_virtual/react-is.production.min2.js +4 -0
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +23 -22
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +14 -13
- package/dist/src/components/common/button/Button.cjs +1 -1
- package/dist/src/components/common/button/Button.js +32 -31
- 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 +22 -22
- package/dist/src/components/common/button/ExportButton.cjs +1 -1
- package/dist/src/components/common/button/ExportButton.js +13 -13
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/src/components/common/button/HideButtonTable.js +20 -20
- 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 +15 -15
- 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 +31 -31
- 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 +11 -11
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/src/components/common/check-box/CheckBox.js +17 -15
- package/dist/src/components/common/description/DescList.cjs +1 -1
- package/dist/src/components/common/description/DescList.js +1 -1
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/src/components/common/layout/VerticalSpace.js +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +11 -10
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/src/components/common/picker/ImagePicker.js +95 -90
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/src/components/common/radio/RadioGroupComponent.js +17 -16
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/src/components/common/report/SelectFieldInReport.js +17 -16
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/src/components/common/select/CustomSelectOption.js +1 -1
- package/dist/src/components/common/select/SelectComponent.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.js +36 -33
- 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 +10 -10
- package/dist/src/components/common/table/table.cjs +1 -1
- package/dist/src/components/common/table/table.js +16 -16
- package/dist/src/components/common/tag/StatusTag.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.js +4 -4
- package/dist/src/components/common/text/index.cjs +1 -1
- package/dist/src/components/common/text/index.js +1 -1
- package/dist/src/components/common/text/title/index.cjs +1 -1
- package/dist/src/components/common/text/title/index.js +1 -1
- package/dist/src/components/common/text-field/NumberField.cjs +1 -1
- package/dist/src/components/common/text-field/NumberField.js +20 -19
- package/dist/src/components/common/text-field/TextArea.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.js +19 -18
- package/dist/src/components/common/text-field/TextField.cjs +1 -1
- package/dist/src/components/common/text-field/TextField.js +37 -36
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/src/components/common/tooltip/TooltipComponent.js +1 -1
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.js +37 -36
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/src/components/common/wizard/WizardViewForm.js +1 -1
- package/dist/src/components/crud/CrudComponent.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.js +74 -71
- package/dist/src/components/crud/CrudField.cjs +1 -1
- package/dist/src/components/crud/CrudField.js +111 -108
- package/dist/src/components/crud/CrudForm.cjs +1 -1
- package/dist/src/components/crud/CrudForm.js +36 -33
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/src/components/crud/CrudFormWizard.js +78 -73
- package/dist/src/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/src/components/crud/CrudReportComponent.js +75 -71
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/src/components/crud/CrudSearchComponent.js +17 -15
- package/dist/src/components/crud/FileCrudField.cjs +1 -1
- package/dist/src/components/crud/FileCrudField.js +103 -94
- package/dist/src/components/crud/ImageCrudField.cjs +1 -1
- package/dist/src/components/crud/ImageCrudField.js +58 -55
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/src/components/crud/import/CrudImportButton.js +10 -10
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +111 -106
- package/dist/src/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewer.js +30 -30
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +35 -33
- package/dist/src/util/ImageUtil.cjs +1 -1
- package/dist/src/util/ImageUtil.js +1 -1
- package/package.json +7 -9
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useMemo as l, useCallback as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
2
|
+
import { useMemo as l, useCallback as E, useEffect as R, createElement as a } from "react";
|
|
3
|
+
import v from "./CrudField.js";
|
|
4
|
+
import _ from "../common/button/Button.js";
|
|
5
|
+
import y from "../../../node_modules/antd/es/form/index.js";
|
|
6
|
+
import w from "../../../node_modules/antd/es/grid/col.js";
|
|
7
|
+
import q from "../../../node_modules/antd/es/grid/row.js";
|
|
8
|
+
import B from "../../../node_modules/@ant-design/icons/es/icons/SearchOutlined.js";
|
|
9
|
+
function H({
|
|
8
10
|
searchFields: t = [],
|
|
9
11
|
fields: e,
|
|
10
12
|
searchOnChange: p,
|
|
@@ -14,7 +16,7 @@ function G({
|
|
|
14
16
|
}) {
|
|
15
17
|
const N = l(
|
|
16
18
|
() => t.map((n) => typeof n == "string" ? {
|
|
17
|
-
...e.find((
|
|
19
|
+
...e.find((k) => n === k.name),
|
|
18
20
|
required: !1
|
|
19
21
|
} : {
|
|
20
22
|
...e.find(
|
|
@@ -32,7 +34,7 @@ function G({
|
|
|
32
34
|
), j = l(
|
|
33
35
|
() => t.length === 1 ? { field: 21, button: 3 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 24, button: 24 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
34
36
|
[t.length]
|
|
35
|
-
), [f] = y.useForm(), r =
|
|
37
|
+
), [f] = y.useForm(), r = E(
|
|
36
38
|
async (n) => {
|
|
37
39
|
if ((n || p) && i) {
|
|
38
40
|
const m = await f.validateFields();
|
|
@@ -41,7 +43,7 @@ function G({
|
|
|
41
43
|
},
|
|
42
44
|
[f, i, p]
|
|
43
45
|
);
|
|
44
|
-
return
|
|
46
|
+
return R(() => {
|
|
45
47
|
b && (f.setFieldsValue(b), r(!0));
|
|
46
48
|
}, [f, b]), t != null && t.length ? /* @__PURE__ */ o.jsx(
|
|
47
49
|
y,
|
|
@@ -51,21 +53,21 @@ function G({
|
|
|
51
53
|
layout: "vertical",
|
|
52
54
|
className: "mb-2",
|
|
53
55
|
onChange: () => r(!1),
|
|
54
|
-
children: /* @__PURE__ */ o.jsxs(
|
|
56
|
+
children: /* @__PURE__ */ o.jsxs(q, { gutter: [4, 8], className: "w-100", children: [
|
|
55
57
|
N.map((n, m) => {
|
|
56
58
|
const u = (g == null ? void 0 : g[m]) ?? {
|
|
57
59
|
md: x.field,
|
|
58
60
|
sm: d.field,
|
|
59
61
|
xs: j.field
|
|
60
62
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ a(
|
|
62
64
|
w,
|
|
63
65
|
{
|
|
64
66
|
...u,
|
|
65
67
|
key: `search_field_${String(n.name)}`,
|
|
66
68
|
className: "align-self-end"
|
|
67
69
|
},
|
|
68
|
-
/* @__PURE__ */ o.jsx(
|
|
70
|
+
/* @__PURE__ */ o.jsx(v, { ...n, readonly: !1, fieldClassName: "mb-0" })
|
|
69
71
|
);
|
|
70
72
|
}),
|
|
71
73
|
/* @__PURE__ */ o.jsx(
|
|
@@ -76,12 +78,12 @@ function G({
|
|
|
76
78
|
xs: j.button,
|
|
77
79
|
style: { alignSelf: "end" },
|
|
78
80
|
children: /* @__PURE__ */ o.jsx(
|
|
79
|
-
|
|
81
|
+
_,
|
|
80
82
|
{
|
|
81
83
|
type: "primary",
|
|
82
84
|
htmlType: "submit",
|
|
83
85
|
block: !0,
|
|
84
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
86
|
+
icon: /* @__PURE__ */ o.jsx(B, {})
|
|
85
87
|
}
|
|
86
88
|
)
|
|
87
89
|
}
|
|
@@ -91,5 +93,5 @@ function G({
|
|
|
91
93
|
) : /* @__PURE__ */ o.jsx(o.Fragment, {});
|
|
92
94
|
}
|
|
93
95
|
export {
|
|
94
|
-
|
|
96
|
+
H as default
|
|
95
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const V=require("../../../node_modules/mime/dist/src/index.cjs"),i=require("react"),W=require("react-i18next"),B=require("../../locale/hooks/translation-constants.cjs"),H=require("../../util/ValidationUtil.cjs"),R=require("../common/button/Button.cjs"),z=require("../common/layout/VerticalSpace.cjs"),F=require("../../../node_modules/antd/es/form/index.cjs"),G=require("../../../node_modules/antd/es/upload/index.cjs"),J=require("../../../node_modules/@ant-design/icons/es/icons/FileOutlined.cjs"),K=require("../../../node_modules/@ant-design/icons/es/icons/FilePptOutlined.cjs"),Q=require("../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.cjs"),X=require("../../../node_modules/@ant-design/icons/es/icons/FileTextOutlined.cjs"),Y=require("../../../node_modules/@ant-design/icons/es/icons/FileWordOutlined.cjs"),Z=require("../../../node_modules/@ant-design/icons/es/icons/FilePdfOutlined.cjs"),m=require("../../../node_modules/@ant-design/icons/es/icons/FileImageOutlined.cjs"),v=require("../../../node_modules/antd/es/modal/index.cjs"),y=require("../../../node_modules/@ant-design/icons/es/icons/ExportOutlined.cjs");function T({name:l,label:t,required:r,provider:s,onUploading:u,onRemoved:x,fieldClassName:j,accept:w,rules:$,maxCount:g=1,block:A,...D}){const d=F.default.useFormInstance(),f=F.default.useWatch(l,d),[q,C]=i.useState(!1),[P,N]=i.useState(!1),k=i.useCallback(async n=>{var a,o;try{const{file:c}=n,p=c.name;C(!0),N(!0),u==null||u(!0);const E=p??"",S=E.split("."),U=S[S.length-1],L=s.generateFileName(E),b=`${await s.getInitialPath()}/${L}.${U}`;console.log({filePath:b});const I=await s.upload({...c,originFileObj:c},b);u==null||u(!1),d.setFieldValue(l,I),(a=n.onSuccess)==null||a.call(n,I)}catch(c){(o=n.onError)==null||o.call(n,c)}finally{C(!1)}},[d,l,u,s]),[h,O]=i.useState([]);i.useEffect(()=>{!P&&f&&Promise.all((Array.isArray(f)?f:[f]).map(async n=>{const a=V.default.getType(n),o=n.split("/").pop(),c=await s.getRealUrl(n);return{uid:n,url:c,type:a,name:o}})).then(n=>O(()=>{const a=n.map(({url:o,type:c,uid:p,name:E})=>({uid:p,url:o,type:c,response:p,thumbUrl:o,name:E}));return console.log(a),a}))},[f,P,q,s]);const _=i.useCallback(async n=>{const a=n.response,o=a||d.getFieldValue(l);await s.delete(o),x==null||x(),n&&d.setFieldsValue({[l]:null})},[d,l,x,s]);return e.jsxRuntimeExports.jsxs(F.default.Item,{label:t,required:r,name:l,className:j,rules:[...r?H.default.required(t):[],...$??[]],children:[e.jsxRuntimeExports.jsx("input",{hidden:!0}),e.jsxRuntimeExports.jsx(G.default,{...D,fileList:h,className:((h==null?void 0:h.length)??0)>=g?"hide-upload":"",maxCount:g,customRequest:k,onRemove:_,listType:"picture",onChange:({fileList:n})=>{O(n)},style:A?{width:"100%"}:void 0,children:e.jsxRuntimeExports.jsx(R.default,{loading:q,children:"Upload File"})})]})}const tt=({provider:l,value:t})=>{const[r,s]=i.useState();return i.useEffect(()=>{t&&l.getRealUrl(t).then(u=>{s({mimeType:V.default.getType(t),url:u,fileName:t.split("/").pop()??t})})},[l,t]),r?e.jsxRuntimeExports.jsx(M,{fileName:r.fileName,url:r==null?void 0:r.url,mimeType:r==null?void 0:r.mimeType}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})},M=({url:l,mimeType:t="",fileName:r})=>{const s=i.useMemo(()=>t!=null&&t.includes("image")?"image":t!=null&&t.includes("pdf")?"pdf":t!=null&&t.includes("word")?"word":t!=null&&t.includes("text")?"text":t!=null&&t.includes("presentation")?"presentation":t!=null&&t.includes("excel")||t!=null&&t.includes("spreadsheet")?"excel":"file",[t]),u=i.useMemo(()=>{switch(s){case"image":return e.jsxRuntimeExports.jsx(m.default,{});case"pdf":return e.jsxRuntimeExports.jsx(Z.default,{});case"word":return e.jsxRuntimeExports.jsx(Y.default,{});case"text":return e.jsxRuntimeExports.jsx(X.default,{});case"excel":return e.jsxRuntimeExports.jsx(Q.default,{});case"presentation":return e.jsxRuntimeExports.jsx(K.default,{});default:return e.jsxRuntimeExports.jsx(J.default,{})}},[s]),[x,j]=i.useState(!1),{t:w}=W.useTranslation(B.TRANSLATION_NAMESPACE);return s!=="file"&&s!=="text"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.default,{open:x,title:r,onCancel:()=>j(!1),footer:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),width:"100%",style:{top:"8px",minHeight:"700px"},destroyOnClose:!0,children:e.jsxRuntimeExports.jsxs(z.default,{children:[e.jsxRuntimeExports.jsx(R.default,{tooltip:r,icon:e.jsxRuntimeExports.jsx(y.default,{}),target:"_blank",href:l,style:{textDecoration:"none"},children:w("str.openInNewTab")}),s==="image"?e.jsxRuntimeExports.jsx("img",{src:l,alt:r,style:{width:"100%"}}):s==="pdf"?e.jsxRuntimeExports.jsxs("iframe",{title:r,src:l,width:"100%",height:"700px",children:["This browser does not support PDFs. Please download the PDF to view it:",e.jsxRuntimeExports.jsx("a",{href:l,children:"Download PDF"}),"."]}):e.jsxRuntimeExports.jsxs("iframe",{title:r,src:`https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(l)}`,width:"100%",height:"700px",children:["This browser does not support open ",s.toUpperCase(),". Please download the",s.toUpperCase()," to view it:",e.jsxRuntimeExports.jsxs("a",{href:l,children:["Download ",s.toUpperCase()]}),"."]})]})}),e.jsxRuntimeExports.jsx(R.default,{tooltip:r,icon:u,shape:"circle",onClick:()=>j(!0)})]}):e.jsxRuntimeExports.jsx(R.default,{tooltip:r,icon:u,target:"_blank",href:l,shape:"circle"})};exports.FileCellValue=M;exports.FileCrudCellValue=tt;exports.default=T;
|
|
@@ -1,119 +1,128 @@
|
|
|
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
|
-
|
|
3
|
+
import M from "../../../node_modules/mime/dist/src/index.js";
|
|
4
|
+
import { useState as d, useCallback as N, useEffect as S, useMemo as E } from "react";
|
|
5
|
+
import { useTranslation as H } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as W } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import z from "../../util/ValidationUtil.js";
|
|
8
|
+
import g from "../common/button/Button.js";
|
|
9
|
+
import G from "../common/layout/VerticalSpace.js";
|
|
10
|
+
import F from "../../../node_modules/antd/es/form/index.js";
|
|
11
|
+
import J from "../../../node_modules/antd/es/upload/index.js";
|
|
12
|
+
import K from "../../../node_modules/@ant-design/icons/es/icons/FileOutlined.js";
|
|
13
|
+
import Q from "../../../node_modules/@ant-design/icons/es/icons/FilePptOutlined.js";
|
|
14
|
+
import X from "../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.js";
|
|
15
|
+
import Y from "../../../node_modules/@ant-design/icons/es/icons/FileTextOutlined.js";
|
|
16
|
+
import Z from "../../../node_modules/@ant-design/icons/es/icons/FileWordOutlined.js";
|
|
17
|
+
import v from "../../../node_modules/@ant-design/icons/es/icons/FilePdfOutlined.js";
|
|
18
|
+
import y from "../../../node_modules/@ant-design/icons/es/icons/FileImageOutlined.js";
|
|
19
|
+
import T from "../../../node_modules/antd/es/modal/index.js";
|
|
20
|
+
import tt from "../../../node_modules/@ant-design/icons/es/icons/ExportOutlined.js";
|
|
21
|
+
function Pt({
|
|
22
|
+
name: o,
|
|
14
23
|
label: t,
|
|
15
24
|
required: r,
|
|
16
25
|
provider: s,
|
|
17
|
-
onUploading:
|
|
18
|
-
onRemoved:
|
|
26
|
+
onUploading: l,
|
|
27
|
+
onRemoved: f,
|
|
19
28
|
fieldClassName: x,
|
|
20
|
-
accept:
|
|
21
|
-
rules:
|
|
22
|
-
maxCount:
|
|
23
|
-
block:
|
|
24
|
-
...
|
|
29
|
+
accept: I,
|
|
30
|
+
rules: U,
|
|
31
|
+
maxCount: C = 1,
|
|
32
|
+
block: k,
|
|
33
|
+
...O
|
|
25
34
|
}) {
|
|
26
|
-
const
|
|
27
|
-
async (
|
|
28
|
-
var c,
|
|
35
|
+
const u = F.useFormInstance(), h = F.useWatch(o, u), [P, $] = d(!1), [R, _] = d(!1), m = N(
|
|
36
|
+
async (n) => {
|
|
37
|
+
var c, a;
|
|
29
38
|
try {
|
|
30
|
-
const { file: i } =
|
|
31
|
-
|
|
32
|
-
const
|
|
39
|
+
const { file: i } = n, j = i.name;
|
|
40
|
+
$(!0), _(!0), l == null || l(!0);
|
|
41
|
+
const w = j ?? "", b = w.split("."), q = b[b.length - 1], B = s.generateFileName(w), A = `${await s.getInitialPath()}/${B}.${q}`;
|
|
33
42
|
console.log({ filePath: A });
|
|
34
43
|
const D = await s.upload(
|
|
35
44
|
{ ...i, originFileObj: i },
|
|
36
45
|
A
|
|
37
46
|
);
|
|
38
|
-
|
|
47
|
+
l == null || l(!1), u.setFieldValue(o, D), (c = n.onSuccess) == null || c.call(n, D);
|
|
39
48
|
} catch (i) {
|
|
40
|
-
(
|
|
49
|
+
(a = n.onError) == null || a.call(n, i);
|
|
41
50
|
} finally {
|
|
42
|
-
|
|
51
|
+
$(!1);
|
|
43
52
|
}
|
|
44
53
|
},
|
|
45
|
-
[
|
|
46
|
-
), [
|
|
47
|
-
|
|
48
|
-
!
|
|
49
|
-
(Array.isArray(
|
|
50
|
-
async (
|
|
51
|
-
const c =
|
|
54
|
+
[u, o, l, s]
|
|
55
|
+
), [p, V] = d([]);
|
|
56
|
+
S(() => {
|
|
57
|
+
!R && h && Promise.all(
|
|
58
|
+
(Array.isArray(h) ? h : [h]).map(
|
|
59
|
+
async (n) => {
|
|
60
|
+
const c = M.getType(n), a = n.split("/").pop(), i = await s.getRealUrl(n);
|
|
52
61
|
return {
|
|
53
|
-
uid:
|
|
62
|
+
uid: n,
|
|
54
63
|
url: i,
|
|
55
64
|
type: c,
|
|
56
|
-
name:
|
|
65
|
+
name: a
|
|
57
66
|
};
|
|
58
67
|
}
|
|
59
68
|
)
|
|
60
|
-
).then((
|
|
61
|
-
const c =
|
|
69
|
+
).then((n) => V(() => {
|
|
70
|
+
const c = n.map(({ url: a, type: i, uid: j, name: w }) => ({ uid: j, url: a, type: i, response: j, thumbUrl: a, name: w }));
|
|
62
71
|
return console.log(c), c;
|
|
63
72
|
}));
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
async (
|
|
67
|
-
const c =
|
|
68
|
-
await s.delete(
|
|
73
|
+
}, [h, R, P, s]);
|
|
74
|
+
const L = N(
|
|
75
|
+
async (n) => {
|
|
76
|
+
const c = n.response, a = c || u.getFieldValue(o);
|
|
77
|
+
await s.delete(a), f == null || f(), n && u.setFieldsValue({ [o]: null });
|
|
69
78
|
},
|
|
70
|
-
[
|
|
79
|
+
[u, o, f, s]
|
|
71
80
|
);
|
|
72
81
|
return /* @__PURE__ */ e.jsxs(
|
|
73
|
-
|
|
82
|
+
F.Item,
|
|
74
83
|
{
|
|
75
84
|
label: t,
|
|
76
85
|
required: r,
|
|
77
|
-
name:
|
|
86
|
+
name: o,
|
|
78
87
|
className: x,
|
|
79
88
|
rules: [
|
|
80
|
-
...r ?
|
|
81
|
-
...
|
|
89
|
+
...r ? z.required(t) : [],
|
|
90
|
+
...U ?? []
|
|
82
91
|
],
|
|
83
92
|
children: [
|
|
84
93
|
/* @__PURE__ */ e.jsx("input", { hidden: !0 }),
|
|
85
94
|
/* @__PURE__ */ e.jsx(
|
|
86
|
-
|
|
95
|
+
J,
|
|
87
96
|
{
|
|
88
|
-
...
|
|
89
|
-
fileList:
|
|
90
|
-
className: ((
|
|
91
|
-
maxCount:
|
|
92
|
-
customRequest:
|
|
93
|
-
onRemove:
|
|
97
|
+
...O,
|
|
98
|
+
fileList: p,
|
|
99
|
+
className: ((p == null ? void 0 : p.length) ?? 0) >= C ? "hide-upload" : "",
|
|
100
|
+
maxCount: C,
|
|
101
|
+
customRequest: m,
|
|
102
|
+
onRemove: L,
|
|
94
103
|
listType: "picture",
|
|
95
|
-
onChange: ({ fileList:
|
|
96
|
-
|
|
104
|
+
onChange: ({ fileList: n }) => {
|
|
105
|
+
V(n);
|
|
97
106
|
},
|
|
98
|
-
style:
|
|
99
|
-
children: /* @__PURE__ */ e.jsx(
|
|
107
|
+
style: k ? { width: "100%" } : void 0,
|
|
108
|
+
children: /* @__PURE__ */ e.jsx(g, { loading: P, children: "Upload File" })
|
|
100
109
|
}
|
|
101
110
|
)
|
|
102
111
|
]
|
|
103
112
|
}
|
|
104
113
|
);
|
|
105
114
|
}
|
|
106
|
-
const
|
|
107
|
-
const [r, s] =
|
|
108
|
-
return
|
|
109
|
-
t &&
|
|
115
|
+
const $t = ({ provider: o, value: t }) => {
|
|
116
|
+
const [r, s] = d();
|
|
117
|
+
return S(() => {
|
|
118
|
+
t && o.getRealUrl(t).then((l) => {
|
|
110
119
|
s({
|
|
111
|
-
mimeType:
|
|
112
|
-
url:
|
|
120
|
+
mimeType: M.getType(t),
|
|
121
|
+
url: l,
|
|
113
122
|
fileName: t.split("/").pop() ?? t
|
|
114
123
|
});
|
|
115
124
|
});
|
|
116
|
-
}, [
|
|
125
|
+
}, [o, t]), r ? /* @__PURE__ */ e.jsx(
|
|
117
126
|
et,
|
|
118
127
|
{
|
|
119
128
|
fileName: r.fileName,
|
|
@@ -121,58 +130,58 @@ const xt = ({ provider: n, value: t }) => {
|
|
|
121
130
|
mimeType: r == null ? void 0 : r.mimeType
|
|
122
131
|
}
|
|
123
132
|
) : /* @__PURE__ */ e.jsx(e.Fragment, {});
|
|
124
|
-
}, et = ({ url:
|
|
125
|
-
const s =
|
|
133
|
+
}, et = ({ url: o, mimeType: t = "", fileName: r }) => {
|
|
134
|
+
const s = E(() => 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]), l = E(() => {
|
|
126
135
|
switch (s) {
|
|
127
136
|
case "image":
|
|
128
|
-
return /* @__PURE__ */ e.jsx(
|
|
137
|
+
return /* @__PURE__ */ e.jsx(y, {});
|
|
129
138
|
case "pdf":
|
|
130
|
-
return /* @__PURE__ */ e.jsx(
|
|
139
|
+
return /* @__PURE__ */ e.jsx(v, {});
|
|
131
140
|
case "word":
|
|
132
|
-
return /* @__PURE__ */ e.jsx(
|
|
141
|
+
return /* @__PURE__ */ e.jsx(Z, {});
|
|
133
142
|
case "text":
|
|
134
|
-
return /* @__PURE__ */ e.jsx(
|
|
143
|
+
return /* @__PURE__ */ e.jsx(Y, {});
|
|
135
144
|
case "excel":
|
|
136
|
-
return /* @__PURE__ */ e.jsx(
|
|
145
|
+
return /* @__PURE__ */ e.jsx(X, {});
|
|
137
146
|
case "presentation":
|
|
138
|
-
return /* @__PURE__ */ e.jsx(
|
|
147
|
+
return /* @__PURE__ */ e.jsx(Q, {});
|
|
139
148
|
default:
|
|
140
|
-
return /* @__PURE__ */ e.jsx(
|
|
149
|
+
return /* @__PURE__ */ e.jsx(K, {});
|
|
141
150
|
}
|
|
142
|
-
}, [s]), [
|
|
151
|
+
}, [s]), [f, x] = d(!1), { t: I } = H(W);
|
|
143
152
|
return s !== "file" && s !== "text" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
144
153
|
/* @__PURE__ */ e.jsx(
|
|
145
|
-
|
|
154
|
+
T,
|
|
146
155
|
{
|
|
147
|
-
open:
|
|
156
|
+
open: f,
|
|
148
157
|
title: r,
|
|
149
158
|
onCancel: () => x(!1),
|
|
150
159
|
footer: /* @__PURE__ */ e.jsx(e.Fragment, {}),
|
|
151
160
|
width: "100%",
|
|
152
161
|
style: { top: "8px", minHeight: "700px" },
|
|
153
162
|
destroyOnClose: !0,
|
|
154
|
-
children: /* @__PURE__ */ e.jsxs(
|
|
163
|
+
children: /* @__PURE__ */ e.jsxs(G, { children: [
|
|
155
164
|
/* @__PURE__ */ e.jsx(
|
|
156
|
-
|
|
165
|
+
g,
|
|
157
166
|
{
|
|
158
167
|
tooltip: r,
|
|
159
|
-
icon: /* @__PURE__ */ e.jsx(
|
|
168
|
+
icon: /* @__PURE__ */ e.jsx(tt, {}),
|
|
160
169
|
target: "_blank",
|
|
161
|
-
href:
|
|
170
|
+
href: o,
|
|
162
171
|
style: { textDecoration: "none" },
|
|
163
|
-
children:
|
|
172
|
+
children: I("str.openInNewTab")
|
|
164
173
|
}
|
|
165
174
|
),
|
|
166
|
-
s === "image" ? /* @__PURE__ */ e.jsx("img", { src:
|
|
175
|
+
s === "image" ? /* @__PURE__ */ e.jsx("img", { src: o, alt: r, style: { width: "100%" } }) : s === "pdf" ? /* @__PURE__ */ e.jsxs("iframe", { title: r, src: o, width: "100%", height: "700px", children: [
|
|
167
176
|
"This browser does not support PDFs. Please download the PDF to view it:",
|
|
168
|
-
/* @__PURE__ */ e.jsx("a", { href:
|
|
177
|
+
/* @__PURE__ */ e.jsx("a", { href: o, children: "Download PDF" }),
|
|
169
178
|
"."
|
|
170
179
|
] }) : /* @__PURE__ */ e.jsxs(
|
|
171
180
|
"iframe",
|
|
172
181
|
{
|
|
173
182
|
title: r,
|
|
174
183
|
src: `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
|
|
175
|
-
|
|
184
|
+
o
|
|
176
185
|
)}`,
|
|
177
186
|
width: "100%",
|
|
178
187
|
height: "700px",
|
|
@@ -182,7 +191,7 @@ const xt = ({ provider: n, value: t }) => {
|
|
|
182
191
|
". Please download the",
|
|
183
192
|
s.toUpperCase(),
|
|
184
193
|
" to view it:",
|
|
185
|
-
/* @__PURE__ */ e.jsxs("a", { href:
|
|
194
|
+
/* @__PURE__ */ e.jsxs("a", { href: o, children: [
|
|
186
195
|
"Download ",
|
|
187
196
|
s.toUpperCase()
|
|
188
197
|
] }),
|
|
@@ -194,27 +203,27 @@ const xt = ({ provider: n, value: t }) => {
|
|
|
194
203
|
}
|
|
195
204
|
),
|
|
196
205
|
/* @__PURE__ */ e.jsx(
|
|
197
|
-
|
|
206
|
+
g,
|
|
198
207
|
{
|
|
199
208
|
tooltip: r,
|
|
200
|
-
icon:
|
|
209
|
+
icon: l,
|
|
201
210
|
shape: "circle",
|
|
202
211
|
onClick: () => x(!0)
|
|
203
212
|
}
|
|
204
213
|
)
|
|
205
214
|
] }) : /* @__PURE__ */ e.jsx(
|
|
206
|
-
|
|
215
|
+
g,
|
|
207
216
|
{
|
|
208
217
|
tooltip: r,
|
|
209
|
-
icon:
|
|
218
|
+
icon: l,
|
|
210
219
|
target: "_blank",
|
|
211
|
-
href:
|
|
220
|
+
href: o,
|
|
212
221
|
shape: "circle"
|
|
213
222
|
}
|
|
214
223
|
);
|
|
215
224
|
};
|
|
216
225
|
export {
|
|
217
226
|
et as FileCellValue,
|
|
218
|
-
|
|
219
|
-
|
|
227
|
+
$t as FileCrudCellValue,
|
|
228
|
+
Pt as default
|
|
220
229
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var S=Object.defineProperty;var _=(e,
|
|
1
|
+
"use strict";var S=Object.defineProperty;var _=(e,l,t)=>l in e?S(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;var d=(e,l,t)=>_(e,typeof l!="symbol"?l+"":l,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const q=require("../../../_virtual/index.cjs"),n=require("react"),O=require("../../util/NumberUtil.cjs"),k=require("../../util/ValidationUtil.cjs"),D=require("../common/picker/ImagePicker.cjs"),j=require("../../../node_modules/antd/es/form/index.cjs"),M=require("../../../node_modules/antd/es/input/index.cjs"),A=require("../../../node_modules/uuid/dist/esm-browser/v4.cjs"),T=require("../../../node_modules/antd/es/avatar/index.cjs"),W=require("../../../node_modules/antd/es/image/index.cjs"),z=require("../../../node_modules/@ant-design/icons/es/icons/EyeOutlined.cjs");class I{}class B extends I{constructor(t="",s=""){super();d(this,"rootPath");d(this,"subPath");this.rootPath=t,this.subPath=s}cloneFilePath(t){const s=q.default.parse(t),r=`${s.name}_cloned_${O.default.randInt(1e5)}`;return q.default.format({dir:s.dir,ext:s.ext,name:r})}generateFileName(t){return`${t.split(".")[0]}_${A.default().replace("-","")}`}}function G({name:e,label:l,required:t,provider:s,onUploading:r,aspectRatio:h,onRemoved:c,fieldClassName:R,hideLabel:$=!1,listType:w}){const i=j.default.useFormInstance(),x=j.default.useWatch(e,i),[F,C]=n.useState(!1),P=n.useCallback(async(u,N)=>{if(N){r==null||r(!0);const o=u.name,f=o.split("."),V=f[f.length-1],g=s.generateFileName(o),y=`${await s.getInitialPath()}/${g}.${V}`,b=await s.upload(u,y);C(!0),r==null||r(!1),i.setFieldValue(e,b)}else{console.log(u);const o=i.getFieldsValue(),f=await s.delete(o[e]);c==null||c(),f&&i.setFieldsValue({[e]:null})}},[i,e,c,r,s]),[m,E]=n.useState();return n.useEffect(()=>{!F&&x?s.getRealUrl(x).then(E):E(m)},[x,F,s,m]),a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{children:a.jsxRuntimeExports.jsxs(j.default.Item,{rules:t?k.default.required(l):[],label:$?null:l,required:t,name:e,children:[a.jsxRuntimeExports.jsx(D.default,{noStyle:!0,listType:w,aspectRatio:h,values:m,onRemove:u=>{u&&P(u,!1)},onAdd:async u=>{u&&await P(u,!0)},className:R}),a.jsxRuntimeExports.jsx(M.default,{hidden:!0})]})})}const H=({provider:e,value:l})=>{const[t,s]=n.useState();return n.useEffect(()=>{l&&e.getRealUrl(l).then(s)},[e,l]),t?a.jsxRuntimeExports.jsx(p,{url:t}):a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{})},p=({url:e})=>a.jsxRuntimeExports.jsx(T.default,{className:"p-0",children:a.jsxRuntimeExports.jsx(W.default,{className:"m-0 p-0 position-relative",src:e,preview:{mask:a.jsxRuntimeExports.jsx(z.default,{})}})});exports.FileDownloadProvider=I;exports.FileUploadProvider=B;exports.ImageCellValue=p;exports.ImageCrudCellValue=H;exports.default=G;
|