@pnkx-lib/ui 1.9.465 → 1.9.466
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/es/ui/GenericUploadModal.js +32 -48
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Modal, Spin } from 'antd';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { isValidElement, version as version$1, useRef, useLayoutEffect, useEffect, Component, useContext, forwardRef, useMemo as useMemo$1, useState, Children, useImperativeHandle } from 'react';
|
|
@@ -13,7 +13,6 @@ import { R as RefIcon$7 } from '../chunks/LoadingOutlined-C5-PNVpb.js';
|
|
|
13
13
|
import { R as RefIcon$8, a as RefIcon$a } from '../chunks/CloseCircleFilled-4jnV3XJV.js';
|
|
14
14
|
import { R as RefIcon$9 } from '../chunks/CloseOutlined-DdLJZQvZ.js';
|
|
15
15
|
import { C as Controller } from '../chunks/index.esm-Dr5ZHcf7.js';
|
|
16
|
-
import { ViewPdf } from './ViewPdf.js';
|
|
17
16
|
import { R as RefIcon$b } from '../chunks/InboxOutlined-W7xl_mLq.js';
|
|
18
17
|
|
|
19
18
|
// This icon file is generated automatically.
|
|
@@ -11486,7 +11485,6 @@ function GenericUploadModal({
|
|
|
11486
11485
|
texts
|
|
11487
11486
|
}) {
|
|
11488
11487
|
const [displayFileList, setDisplayFileList] = useState([]);
|
|
11489
|
-
const [previewPdf, setPreviewPdf] = useState(null);
|
|
11490
11488
|
useEffect(() => {
|
|
11491
11489
|
if (open) {
|
|
11492
11490
|
const recordFiles = record?.map((item) => ({
|
|
@@ -11531,18 +11529,13 @@ function GenericUploadModal({
|
|
|
11531
11529
|
},
|
|
11532
11530
|
onPreview: (file) => {
|
|
11533
11531
|
const fileUrl = file.url || (file.originFileObj ? URL.createObjectURL(file.originFileObj) : "");
|
|
11534
|
-
const
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
link.target = "_blank";
|
|
11542
|
-
document.body.appendChild(link);
|
|
11543
|
-
link.click();
|
|
11544
|
-
document.body.removeChild(link);
|
|
11545
|
-
}
|
|
11532
|
+
const link = document.createElement("a");
|
|
11533
|
+
link.href = fileUrl;
|
|
11534
|
+
link.download = file.name || "download";
|
|
11535
|
+
link.target = "_blank";
|
|
11536
|
+
document.body.appendChild(link);
|
|
11537
|
+
link.click();
|
|
11538
|
+
document.body.removeChild(link);
|
|
11546
11539
|
},
|
|
11547
11540
|
onRemove: (file) => {
|
|
11548
11541
|
const newList = displayFileList.filter((item) => item.uid !== file.uid);
|
|
@@ -11552,7 +11545,7 @@ function GenericUploadModal({
|
|
|
11552
11545
|
return true;
|
|
11553
11546
|
}
|
|
11554
11547
|
});
|
|
11555
|
-
return /* @__PURE__ */
|
|
11548
|
+
return /* @__PURE__ */ jsx(
|
|
11556
11549
|
Modal,
|
|
11557
11550
|
{
|
|
11558
11551
|
open,
|
|
@@ -11563,39 +11556,30 @@ function GenericUploadModal({
|
|
|
11563
11556
|
onOk: onCancel,
|
|
11564
11557
|
width: 800,
|
|
11565
11558
|
centered: true,
|
|
11566
|
-
children:
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
children: [
|
|
11588
|
-
/* @__PURE__ */ jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsx(RefIcon$b, {}) }),
|
|
11589
|
-
/* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: texts?.dragText ?? "Click or drag files to this area to upload" }),
|
|
11590
|
-
/* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint1 ?? "Max size 5MB" }),
|
|
11591
|
-
/* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint2 ?? "Supported formats: " + allowedExtensions.join(", ") })
|
|
11592
|
-
]
|
|
11593
|
-
}
|
|
11594
|
-
) });
|
|
11595
|
-
}
|
|
11559
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(
|
|
11560
|
+
Controller,
|
|
11561
|
+
{
|
|
11562
|
+
name: "file",
|
|
11563
|
+
control,
|
|
11564
|
+
render: ({ field }) => {
|
|
11565
|
+
const { onChange } = field;
|
|
11566
|
+
const props = createUploadProps(onChange);
|
|
11567
|
+
return /* @__PURE__ */ jsx(Spin, { spinning: false, tip: texts?.uploading ?? "Uploading...", children: /* @__PURE__ */ jsxs(
|
|
11568
|
+
Dragger,
|
|
11569
|
+
{
|
|
11570
|
+
...props,
|
|
11571
|
+
accept: allowedExtensions.map((ext) => `.${ext}`).join(","),
|
|
11572
|
+
children: [
|
|
11573
|
+
/* @__PURE__ */ jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsx(RefIcon$b, {}) }),
|
|
11574
|
+
/* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: texts?.dragText ?? "Click or drag files to this area to upload" }),
|
|
11575
|
+
/* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint1 ?? "Max size 5MB" }),
|
|
11576
|
+
/* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint2 ?? "Supported formats: " + allowedExtensions.join(", ") })
|
|
11577
|
+
]
|
|
11578
|
+
}
|
|
11579
|
+
) });
|
|
11596
11580
|
}
|
|
11597
|
-
|
|
11598
|
-
|
|
11581
|
+
}
|
|
11582
|
+
) })
|
|
11599
11583
|
}
|
|
11600
11584
|
);
|
|
11601
11585
|
}
|