@sia.soul/sia-react-ui 0.1.36 → 0.1.38
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/{chunk-7CPIEYS2.js → chunk-DQ7WGTKA.js} +24 -6
- package/dist/{core-CLt6U7oH.d.cts → core-BzBVS9md.d.cts} +1 -1
- package/dist/{core-vIHbXa6s.d.ts → core-CBURAp9W.d.ts} +1 -1
- package/dist/core.cjs +24 -6
- package/dist/core.css +3 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +27 -7
- package/dist/index.css +3 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -2
- package/package.json +1 -1
|
@@ -1227,10 +1227,28 @@ async function downloadUploadFile(file, request) {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
+
// src/components/uploadImage.ts
|
|
1231
|
+
var imageExtension = /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico|apng)$/i;
|
|
1232
|
+
function isUploadImage(file, accept) {
|
|
1233
|
+
if (!file) return false;
|
|
1234
|
+
if (file.thumbUrl) return true;
|
|
1235
|
+
const type = (file.type || file.originFileObj?.type || "").toLowerCase();
|
|
1236
|
+
if (type && type !== "application/octet-stream") return type.startsWith("image/");
|
|
1237
|
+
if (/^data:image\//i.test(file.url || "")) return true;
|
|
1238
|
+
let pathname = "";
|
|
1239
|
+
try {
|
|
1240
|
+
pathname = new URL(file.url || "", "https://upload.invalid").pathname;
|
|
1241
|
+
} catch {
|
|
1242
|
+
}
|
|
1243
|
+
if (imageExtension.test(file.name) || imageExtension.test(pathname)) return true;
|
|
1244
|
+
const rules = (accept || "").split(",").map((rule) => rule.trim().toLowerCase()).filter(Boolean);
|
|
1245
|
+
return Boolean(file.url) && rules.length > 0 && rules.every((rule) => rule.startsWith("image/") || imageExtension.test(rule));
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1230
1248
|
// src/components/Upload.tsx
|
|
1231
1249
|
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1232
1250
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
1233
|
-
function useThumbnail(file) {
|
|
1251
|
+
function useThumbnail(file, accept) {
|
|
1234
1252
|
const [local, setLocal] = useState6();
|
|
1235
1253
|
useEffect4(() => {
|
|
1236
1254
|
if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
|
|
@@ -1240,10 +1258,10 @@ function useThumbnail(file) {
|
|
|
1240
1258
|
}
|
|
1241
1259
|
setLocal(void 0);
|
|
1242
1260
|
}, [file?.originFileObj, file?.thumbUrl]);
|
|
1243
|
-
return file?.thumbUrl || local || (
|
|
1261
|
+
return file?.thumbUrl || local || (isUploadImage(file, accept) ? file?.url : void 0);
|
|
1244
1262
|
}
|
|
1245
1263
|
function UploadItem({ file, files, props, actions }) {
|
|
1246
|
-
const source = useThumbnail(file);
|
|
1264
|
+
const source = useThumbnail(file, props.accept);
|
|
1247
1265
|
const [failed, setFailed] = useState6(false);
|
|
1248
1266
|
const [downloading, setDownloading] = useState6(false);
|
|
1249
1267
|
const downloadingRef = useRef5(false);
|
|
@@ -1330,7 +1348,7 @@ var UploadRoot = forwardRef(function UploadRoot2({
|
|
|
1330
1348
|
const mounted = useRef5(true);
|
|
1331
1349
|
const [dragging, setDragging] = useState6(false);
|
|
1332
1350
|
const [preview, setPreview] = useState6();
|
|
1333
|
-
const previewSource = useThumbnail(preview);
|
|
1351
|
+
const previewSource = useThumbnail(preview, accept);
|
|
1334
1352
|
const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
|
|
1335
1353
|
const full = files.length >= limit;
|
|
1336
1354
|
const current = useRef5({ disabled, directory, recursive });
|
|
@@ -1556,14 +1574,14 @@ var UploadRoot = forwardRef(function UploadRoot2({
|
|
|
1556
1574
|
),
|
|
1557
1575
|
listType !== "picture-card" && trigger,
|
|
1558
1576
|
/* @__PURE__ */ jsxs8("div", { className: "sia-upload__list", children: [
|
|
1559
|
-
showUploadList && files.map((file) => /* @__PURE__ */ jsx8(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest }, actions: {
|
|
1577
|
+
showUploadList && files.map((file) => /* @__PURE__ */ jsx8(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest, accept }, actions: {
|
|
1560
1578
|
upload: () => start(file),
|
|
1561
1579
|
abort: () => abort(file.uid),
|
|
1562
1580
|
remove: () => remove(file.uid),
|
|
1563
1581
|
download: () => downloadUploadFile(file, downloadRequest),
|
|
1564
1582
|
preview: () => {
|
|
1565
1583
|
if (onPreview) onPreview(file);
|
|
1566
|
-
else if ((file
|
|
1584
|
+
else if (isUploadImage(file, accept)) setPreview(file);
|
|
1567
1585
|
else if (file.url || file.originFileObj) {
|
|
1568
1586
|
const url = file.url || URL.createObjectURL(file.originFileObj);
|
|
1569
1587
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
@@ -1842,7 +1842,7 @@ interface UploadFile {
|
|
|
1842
1842
|
status?: UploadFileStatus;
|
|
1843
1843
|
/** 上传百分比,范围 0–100。 */
|
|
1844
1844
|
percent?: number;
|
|
1845
|
-
/**
|
|
1845
|
+
/** 远程访问地址,用于预览及下载;图片通过 MIME、文件名或 URL 后缀识别,无类型及后缀时可用仅包含图片的 accept 声明启用缩略图和内置预览。默认下载会 fetch 为 Blob,跨域地址需要服务端允许 CORS。 */
|
|
1846
1846
|
url?: string;
|
|
1847
1847
|
/** 缩略图地址,优先于本地缩略图;预览优先使用 url。 */
|
|
1848
1848
|
thumbUrl?: string;
|
|
@@ -1842,7 +1842,7 @@ interface UploadFile {
|
|
|
1842
1842
|
status?: UploadFileStatus;
|
|
1843
1843
|
/** 上传百分比,范围 0–100。 */
|
|
1844
1844
|
percent?: number;
|
|
1845
|
-
/**
|
|
1845
|
+
/** 远程访问地址,用于预览及下载;图片通过 MIME、文件名或 URL 后缀识别,无类型及后缀时可用仅包含图片的 accept 声明启用缩略图和内置预览。默认下载会 fetch 为 Blob,跨域地址需要服务端允许 CORS。 */
|
|
1846
1846
|
url?: string;
|
|
1847
1847
|
/** 缩略图地址,优先于本地缩略图;预览优先使用 url。 */
|
|
1848
1848
|
thumbUrl?: string;
|
package/dist/core.cjs
CHANGED
|
@@ -4181,6 +4181,24 @@ async function downloadUploadFile(file, request) {
|
|
|
4181
4181
|
}
|
|
4182
4182
|
}
|
|
4183
4183
|
|
|
4184
|
+
// src/components/uploadImage.ts
|
|
4185
|
+
var imageExtension = /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico|apng)$/i;
|
|
4186
|
+
function isUploadImage(file, accept) {
|
|
4187
|
+
if (!file) return false;
|
|
4188
|
+
if (file.thumbUrl) return true;
|
|
4189
|
+
const type = (file.type || file.originFileObj?.type || "").toLowerCase();
|
|
4190
|
+
if (type && type !== "application/octet-stream") return type.startsWith("image/");
|
|
4191
|
+
if (/^data:image\//i.test(file.url || "")) return true;
|
|
4192
|
+
let pathname = "";
|
|
4193
|
+
try {
|
|
4194
|
+
pathname = new URL(file.url || "", "https://upload.invalid").pathname;
|
|
4195
|
+
} catch {
|
|
4196
|
+
}
|
|
4197
|
+
if (imageExtension.test(file.name) || imageExtension.test(pathname)) return true;
|
|
4198
|
+
const rules = (accept || "").split(",").map((rule) => rule.trim().toLowerCase()).filter(Boolean);
|
|
4199
|
+
return Boolean(file.url) && rules.length > 0 && rules.every((rule) => rule.startsWith("image/") || imageExtension.test(rule));
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4184
4202
|
// src/components/Message.tsx
|
|
4185
4203
|
var import_client4 = require("react-dom/client");
|
|
4186
4204
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -4289,7 +4307,7 @@ var message = {
|
|
|
4289
4307
|
// src/components/Upload.tsx
|
|
4290
4308
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4291
4309
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
4292
|
-
function useThumbnail(file) {
|
|
4310
|
+
function useThumbnail(file, accept) {
|
|
4293
4311
|
const [local, setLocal] = (0, import_react23.useState)();
|
|
4294
4312
|
(0, import_react23.useEffect)(() => {
|
|
4295
4313
|
if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
|
|
@@ -4299,10 +4317,10 @@ function useThumbnail(file) {
|
|
|
4299
4317
|
}
|
|
4300
4318
|
setLocal(void 0);
|
|
4301
4319
|
}, [file?.originFileObj, file?.thumbUrl]);
|
|
4302
|
-
return file?.thumbUrl || local || (
|
|
4320
|
+
return file?.thumbUrl || local || (isUploadImage(file, accept) ? file?.url : void 0);
|
|
4303
4321
|
}
|
|
4304
4322
|
function UploadItem({ file, files, props, actions }) {
|
|
4305
|
-
const source = useThumbnail(file);
|
|
4323
|
+
const source = useThumbnail(file, props.accept);
|
|
4306
4324
|
const [failed, setFailed] = (0, import_react23.useState)(false);
|
|
4307
4325
|
const [downloading, setDownloading] = (0, import_react23.useState)(false);
|
|
4308
4326
|
const downloadingRef = (0, import_react23.useRef)(false);
|
|
@@ -4389,7 +4407,7 @@ var UploadRoot = (0, import_react23.forwardRef)(function UploadRoot2({
|
|
|
4389
4407
|
const mounted = (0, import_react23.useRef)(true);
|
|
4390
4408
|
const [dragging, setDragging] = (0, import_react23.useState)(false);
|
|
4391
4409
|
const [preview, setPreview] = (0, import_react23.useState)();
|
|
4392
|
-
const previewSource = useThumbnail(preview);
|
|
4410
|
+
const previewSource = useThumbnail(preview, accept);
|
|
4393
4411
|
const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
|
|
4394
4412
|
const full = files.length >= limit;
|
|
4395
4413
|
const current = (0, import_react23.useRef)({ disabled, directory, recursive });
|
|
@@ -4615,14 +4633,14 @@ var UploadRoot = (0, import_react23.forwardRef)(function UploadRoot2({
|
|
|
4615
4633
|
),
|
|
4616
4634
|
listType !== "picture-card" && trigger,
|
|
4617
4635
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "sia-upload__list", children: [
|
|
4618
|
-
showUploadList && files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest }, actions: {
|
|
4636
|
+
showUploadList && files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest, accept }, actions: {
|
|
4619
4637
|
upload: () => start(file),
|
|
4620
4638
|
abort: () => abort(file.uid),
|
|
4621
4639
|
remove: () => remove(file.uid),
|
|
4622
4640
|
download: () => downloadUploadFile(file, downloadRequest),
|
|
4623
4641
|
preview: () => {
|
|
4624
4642
|
if (onPreview) onPreview(file);
|
|
4625
|
-
else if ((file
|
|
4643
|
+
else if (isUploadImage(file, accept)) setPreview(file);
|
|
4626
4644
|
else if (file.url || file.originFileObj) {
|
|
4627
4645
|
const url = file.url || URL.createObjectURL(file.originFileObj);
|
|
4628
4646
|
window.open(url, "_blank", "noopener,noreferrer");
|
package/dist/core.css
CHANGED
|
@@ -9637,9 +9637,11 @@ body > .sia-popup-portal[data-sia-popup-layer] {
|
|
|
9637
9637
|
display: block;
|
|
9638
9638
|
}
|
|
9639
9639
|
.sia-alert__content > span {
|
|
9640
|
-
margin-top: 3px;
|
|
9641
9640
|
color: var(--sia-color-text-secondary);
|
|
9642
9641
|
}
|
|
9642
|
+
.sia-alert__content > strong + span {
|
|
9643
|
+
margin-top: 3px;
|
|
9644
|
+
}
|
|
9643
9645
|
.sia-alert__close {
|
|
9644
9646
|
align-self: flex-start;
|
|
9645
9647
|
padding: 3px;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-BzBVS9md.cjs';
|
|
2
2
|
export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-YJbT-MF1.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './shared-Bx4B28Wh.cjs';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-CBURAp9W.js';
|
|
2
2
|
export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-CCrPqULn.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './shared-Bx4B28Wh.js';
|
package/dist/core.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1927,11 +1927,13 @@ function Alert({
|
|
|
1927
1927
|
}) {
|
|
1928
1928
|
const [visible, setVisible] = (0, import_react9.useState)(true);
|
|
1929
1929
|
const resolvedStatus = status ?? type ?? (banner ? "warning" : "info");
|
|
1930
|
+
const heading = message2 ?? title;
|
|
1931
|
+
const hasHeading = heading != null && heading !== "" && typeof heading !== "boolean";
|
|
1930
1932
|
if (!visible) return null;
|
|
1931
1933
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), children: [
|
|
1932
1934
|
showIcon || banner ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sia-alert__icon", "aria-hidden": "true", children: alertIcons[resolvedStatus] }) : null,
|
|
1933
1935
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sia-alert__content", children: [
|
|
1934
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children:
|
|
1936
|
+
hasHeading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: heading }) : null,
|
|
1935
1937
|
description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: description }) : null
|
|
1936
1938
|
] }),
|
|
1937
1939
|
action ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sia-alert__action", children: action }) : null,
|
|
@@ -8338,6 +8340,24 @@ async function downloadUploadFile(file, request) {
|
|
|
8338
8340
|
}
|
|
8339
8341
|
}
|
|
8340
8342
|
|
|
8343
|
+
// src/components/uploadImage.ts
|
|
8344
|
+
var imageExtension = /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico|apng)$/i;
|
|
8345
|
+
function isUploadImage(file, accept) {
|
|
8346
|
+
if (!file) return false;
|
|
8347
|
+
if (file.thumbUrl) return true;
|
|
8348
|
+
const type = (file.type || file.originFileObj?.type || "").toLowerCase();
|
|
8349
|
+
if (type && type !== "application/octet-stream") return type.startsWith("image/");
|
|
8350
|
+
if (/^data:image\//i.test(file.url || "")) return true;
|
|
8351
|
+
let pathname = "";
|
|
8352
|
+
try {
|
|
8353
|
+
pathname = new URL(file.url || "", "https://upload.invalid").pathname;
|
|
8354
|
+
} catch {
|
|
8355
|
+
}
|
|
8356
|
+
if (imageExtension.test(file.name) || imageExtension.test(pathname)) return true;
|
|
8357
|
+
const rules = (accept || "").split(",").map((rule) => rule.trim().toLowerCase()).filter(Boolean);
|
|
8358
|
+
return Boolean(file.url) && rules.length > 0 && rules.every((rule) => rule.startsWith("image/") || imageExtension.test(rule));
|
|
8359
|
+
}
|
|
8360
|
+
|
|
8341
8361
|
// src/components/Message.tsx
|
|
8342
8362
|
var import_client5 = require("react-dom/client");
|
|
8343
8363
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
@@ -8446,7 +8466,7 @@ var message = {
|
|
|
8446
8466
|
// src/components/Upload.tsx
|
|
8447
8467
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8448
8468
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
8449
|
-
function useThumbnail(file) {
|
|
8469
|
+
function useThumbnail(file, accept) {
|
|
8450
8470
|
const [local, setLocal] = (0, import_react37.useState)();
|
|
8451
8471
|
(0, import_react37.useEffect)(() => {
|
|
8452
8472
|
if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
|
|
@@ -8456,10 +8476,10 @@ function useThumbnail(file) {
|
|
|
8456
8476
|
}
|
|
8457
8477
|
setLocal(void 0);
|
|
8458
8478
|
}, [file?.originFileObj, file?.thumbUrl]);
|
|
8459
|
-
return file?.thumbUrl || local || (
|
|
8479
|
+
return file?.thumbUrl || local || (isUploadImage(file, accept) ? file?.url : void 0);
|
|
8460
8480
|
}
|
|
8461
8481
|
function UploadItem({ file, files, props, actions }) {
|
|
8462
|
-
const source = useThumbnail(file);
|
|
8482
|
+
const source = useThumbnail(file, props.accept);
|
|
8463
8483
|
const [failed, setFailed] = (0, import_react37.useState)(false);
|
|
8464
8484
|
const [downloading, setDownloading] = (0, import_react37.useState)(false);
|
|
8465
8485
|
const downloadingRef = (0, import_react37.useRef)(false);
|
|
@@ -8546,7 +8566,7 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
|
|
|
8546
8566
|
const mounted = (0, import_react37.useRef)(true);
|
|
8547
8567
|
const [dragging, setDragging] = (0, import_react37.useState)(false);
|
|
8548
8568
|
const [preview, setPreview] = (0, import_react37.useState)();
|
|
8549
|
-
const previewSource = useThumbnail(preview);
|
|
8569
|
+
const previewSource = useThumbnail(preview, accept);
|
|
8550
8570
|
const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
|
|
8551
8571
|
const full = files.length >= limit;
|
|
8552
8572
|
const current = (0, import_react37.useRef)({ disabled, directory, recursive });
|
|
@@ -8772,14 +8792,14 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
|
|
|
8772
8792
|
),
|
|
8773
8793
|
listType !== "picture-card" && trigger,
|
|
8774
8794
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "sia-upload__list", children: [
|
|
8775
|
-
showUploadList && files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest }, actions: {
|
|
8795
|
+
showUploadList && files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest, accept }, actions: {
|
|
8776
8796
|
upload: () => start(file),
|
|
8777
8797
|
abort: () => abort(file.uid),
|
|
8778
8798
|
remove: () => remove(file.uid),
|
|
8779
8799
|
download: () => downloadUploadFile(file, downloadRequest),
|
|
8780
8800
|
preview: () => {
|
|
8781
8801
|
if (onPreview) onPreview(file);
|
|
8782
|
-
else if ((file
|
|
8802
|
+
else if (isUploadImage(file, accept)) setPreview(file);
|
|
8783
8803
|
else if (file.url || file.originFileObj) {
|
|
8784
8804
|
const url = file.url || URL.createObjectURL(file.originFileObj);
|
|
8785
8805
|
window.open(url, "_blank", "noopener,noreferrer");
|
package/dist/index.css
CHANGED
|
@@ -9637,9 +9637,11 @@ body > .sia-popup-portal[data-sia-popup-layer] {
|
|
|
9637
9637
|
display: block;
|
|
9638
9638
|
}
|
|
9639
9639
|
.sia-alert__content > span {
|
|
9640
|
-
margin-top: 3px;
|
|
9641
9640
|
color: var(--sia-color-text-secondary);
|
|
9642
9641
|
}
|
|
9642
|
+
.sia-alert__content > strong + span {
|
|
9643
|
+
margin-top: 3px;
|
|
9644
|
+
}
|
|
9643
9645
|
.sia-alert__close {
|
|
9644
9646
|
align-self: flex-start;
|
|
9645
9647
|
padding: 3px;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
2
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-
|
|
1
|
+
import { T as TagStatus, B as BadgeProps } from './core-BzBVS9md.cjs';
|
|
2
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-BzBVS9md.cjs';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
@@ -20,9 +20,9 @@ interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
|
20
20
|
status?: AlertStatus;
|
|
21
21
|
/** 类型标识,用于选择对应的表现形式。 */
|
|
22
22
|
type?: AlertStatus;
|
|
23
|
-
/**
|
|
23
|
+
/** 标题内容,支持文本或 React 节点;message 未提供时使用。 */
|
|
24
24
|
title?: ReactNode;
|
|
25
|
-
/**
|
|
25
|
+
/** 提示标题,支持文本或 React 节点,优先于 title;没有标题内容时不渲染标题区域。 */
|
|
26
26
|
message?: ReactNode;
|
|
27
27
|
/** 补充说明内容。 */
|
|
28
28
|
description?: ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
2
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-
|
|
1
|
+
import { T as TagStatus, B as BadgeProps } from './core-CBURAp9W.js';
|
|
2
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-CBURAp9W.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
@@ -20,9 +20,9 @@ interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
|
20
20
|
status?: AlertStatus;
|
|
21
21
|
/** 类型标识,用于选择对应的表现形式。 */
|
|
22
22
|
type?: AlertStatus;
|
|
23
|
-
/**
|
|
23
|
+
/** 标题内容,支持文本或 React 节点;message 未提供时使用。 */
|
|
24
24
|
title?: ReactNode;
|
|
25
|
-
/**
|
|
25
|
+
/** 提示标题,支持文本或 React 节点,优先于 title;没有标题内容时不渲染标题区域。 */
|
|
26
26
|
message?: ReactNode;
|
|
27
27
|
/** 补充说明内容。 */
|
|
28
28
|
description?: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
Watermark,
|
|
81
81
|
message,
|
|
82
82
|
notification
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-DQ7WGTKA.js";
|
|
84
84
|
import {
|
|
85
85
|
TextArea
|
|
86
86
|
} from "./chunk-SMCYEPBL.js";
|
|
@@ -162,11 +162,13 @@ function Alert({
|
|
|
162
162
|
}) {
|
|
163
163
|
const [visible, setVisible] = useState(true);
|
|
164
164
|
const resolvedStatus = status ?? type ?? (banner ? "warning" : "info");
|
|
165
|
+
const heading = message2 ?? title;
|
|
166
|
+
const hasHeading = heading != null && heading !== "" && typeof heading !== "boolean";
|
|
165
167
|
if (!visible) return null;
|
|
166
168
|
return /* @__PURE__ */ jsxs("div", { className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), children: [
|
|
167
169
|
showIcon || banner ? /* @__PURE__ */ jsx("span", { className: "sia-alert__icon", "aria-hidden": "true", children: alertIcons[resolvedStatus] }) : null,
|
|
168
170
|
/* @__PURE__ */ jsxs("div", { className: "sia-alert__content", children: [
|
|
169
|
-
/* @__PURE__ */ jsx("strong", { children:
|
|
171
|
+
hasHeading ? /* @__PURE__ */ jsx("strong", { children: heading }) : null,
|
|
170
172
|
description ? /* @__PURE__ */ jsx("span", { children: description }) : null
|
|
171
173
|
] }),
|
|
172
174
|
action ? /* @__PURE__ */ jsx("div", { className: "sia-alert__action", children: action }) : null,
|