@sia.soul/sia-react-ui 0.1.120 → 0.1.121
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-WS4WYFJZ.js → chunk-UW2W7RYZ.js} +78 -8
- package/dist/{core-DQ2ZROfx.d.cts → core-C2V9aLTP.d.cts} +15 -2
- package/dist/{core-DCfngMfy.d.ts → core-DUjadxCD.d.ts} +15 -2
- package/dist/core.cjs +23 -1
- package/dist/core.css +7 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +76 -4
- package/dist/index.css +7 -0
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -2
- package/package.json +1 -1
|
@@ -816,7 +816,7 @@ function Tour({ open = false, steps, current, defaultCurrent = 0, mask = true, c
|
|
|
816
816
|
}
|
|
817
817
|
|
|
818
818
|
// src/components/DataDisplay.tsx
|
|
819
|
-
import { Children, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
819
|
+
import { Children, createContext, useContext, useEffect as useEffect3, useId as useId2, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
820
820
|
import { createPortal as createPortal2 } from "react-dom";
|
|
821
821
|
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
822
822
|
function Rate({ value, size: sizeProp, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
|
|
@@ -1030,7 +1030,7 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
|
|
|
1030
1030
|
] }, item.key);
|
|
1031
1031
|
}) });
|
|
1032
1032
|
}
|
|
1033
|
-
function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
1033
|
+
function ImagePreview({ open, src, alt = "", onOpenChange, current = 0, count = 1, onCurrentChange }) {
|
|
1034
1034
|
const previewRef = useRef4(null);
|
|
1035
1035
|
const stageRef = useRef4(null);
|
|
1036
1036
|
const [natural, setNatural] = useState5({ src: "", width: 0, height: 0 });
|
|
@@ -1053,6 +1053,18 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
1053
1053
|
reset();
|
|
1054
1054
|
setFailed(false);
|
|
1055
1055
|
}, [open, src]);
|
|
1056
|
+
useEffect3(() => {
|
|
1057
|
+
if (!open || !onCurrentChange || count < 2) return;
|
|
1058
|
+
const handleKey = (event) => {
|
|
1059
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
1060
|
+
event.preventDefault();
|
|
1061
|
+
event.stopPropagation();
|
|
1062
|
+
const next = current + (event.key === "ArrowRight" ? 1 : -1);
|
|
1063
|
+
if (next >= 0 && next < count) onCurrentChange(next);
|
|
1064
|
+
};
|
|
1065
|
+
document.addEventListener("keydown", handleKey, true);
|
|
1066
|
+
return () => document.removeEventListener("keydown", handleKey, true);
|
|
1067
|
+
}, [open, current, count, onCurrentChange]);
|
|
1056
1068
|
useEffect3(() => {
|
|
1057
1069
|
const stage = stageRef.current;
|
|
1058
1070
|
if (!open || !stage) return;
|
|
@@ -1109,6 +1121,15 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
1109
1121
|
src
|
|
1110
1122
|
) }),
|
|
1111
1123
|
/* @__PURE__ */ jsxs6("div", { className: "sia-image-preview__toolbar", role: "toolbar", "aria-label": "\u56FE\u7247\u64CD\u4F5C", onClick: (event) => event.stopPropagation(), children: [
|
|
1124
|
+
count > 1 && onCurrentChange ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1125
|
+
/* @__PURE__ */ jsx6(Button, { variant: "text", "aria-label": "\u4E0A\u4E00\u5F20", disabled: current === 0, onClick: () => onCurrentChange(current - 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-left" }) }),
|
|
1126
|
+
/* @__PURE__ */ jsxs6("output", { "aria-label": "\u56FE\u7247\u5E8F\u53F7", children: [
|
|
1127
|
+
current + 1,
|
|
1128
|
+
" / ",
|
|
1129
|
+
count
|
|
1130
|
+
] }),
|
|
1131
|
+
/* @__PURE__ */ jsx6(Button, { variant: "text", "aria-label": "\u4E0B\u4E00\u5F20", disabled: current >= count - 1, onClick: () => onCurrentChange(current + 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-right" }) })
|
|
1132
|
+
] }) : null,
|
|
1112
1133
|
/* @__PURE__ */ jsx6(Button, { variant: "text", title: "\u6C34\u5E73\u7FFB\u8F6C", "aria-label": "\u6C34\u5E73\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, x: -value.x })), children: /* @__PURE__ */ jsx6(Icon, { name: "flip-horizontal", size: 20 }) }),
|
|
1113
1134
|
/* @__PURE__ */ jsx6(Button, { variant: "text", title: "\u5782\u76F4\u7FFB\u8F6C", "aria-label": "\u5782\u76F4\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, y: -value.y })), children: /* @__PURE__ */ jsx6(Icon, { name: "flip-vertical", size: 20 }) }),
|
|
1114
1135
|
/* @__PURE__ */ jsx6(Button, { variant: "text", title: "\u5411\u5DE6\u65CB\u8F6C", "aria-label": "\u5411\u5DE6\u65CB\u8F6C", disabled: !ready, onClick: () => {
|
|
@@ -1126,6 +1147,46 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
1126
1147
|
] })
|
|
1127
1148
|
] }), document.body);
|
|
1128
1149
|
}
|
|
1150
|
+
var ImageGroupContext = createContext(null);
|
|
1151
|
+
function ImagePreviewGroup({ children }) {
|
|
1152
|
+
const images = useRef4(/* @__PURE__ */ new Map());
|
|
1153
|
+
const [active, setActive] = useState5();
|
|
1154
|
+
const [, setRevision] = useState5(0);
|
|
1155
|
+
const context = useMemo3(() => ({
|
|
1156
|
+
register: (id, image2) => {
|
|
1157
|
+
images.current.set(id, image2);
|
|
1158
|
+
setRevision((value) => value + 1);
|
|
1159
|
+
return () => {
|
|
1160
|
+
images.current.delete(id);
|
|
1161
|
+
setRevision((value) => value + 1);
|
|
1162
|
+
};
|
|
1163
|
+
},
|
|
1164
|
+
open: (id) => setActive(id)
|
|
1165
|
+
}), []);
|
|
1166
|
+
const entries = [...images.current].sort((a, b) => a[1].element.compareDocumentPosition(b[1].element) & 4 ? -1 : 1);
|
|
1167
|
+
const index = entries.findIndex(([id]) => id === active);
|
|
1168
|
+
const image = entries[index]?.[1];
|
|
1169
|
+
useEffect3(() => {
|
|
1170
|
+
if (active && index < 0) setActive(void 0);
|
|
1171
|
+
}, [active, index]);
|
|
1172
|
+
return /* @__PURE__ */ jsxs6(ImageGroupContext.Provider, { value: context, children: [
|
|
1173
|
+
children,
|
|
1174
|
+
/* @__PURE__ */ jsx6(
|
|
1175
|
+
ImagePreview,
|
|
1176
|
+
{
|
|
1177
|
+
open: Boolean(image),
|
|
1178
|
+
src: image?.src,
|
|
1179
|
+
alt: image?.alt,
|
|
1180
|
+
current: index,
|
|
1181
|
+
count: entries.length,
|
|
1182
|
+
onOpenChange: (open) => {
|
|
1183
|
+
if (!open) setActive(void 0);
|
|
1184
|
+
},
|
|
1185
|
+
onCurrentChange: (next) => setActive(entries[next]?.[0])
|
|
1186
|
+
}
|
|
1187
|
+
)
|
|
1188
|
+
] });
|
|
1189
|
+
}
|
|
1129
1190
|
function Image({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onLoad, onError, style, ...props }) {
|
|
1130
1191
|
const config = typeof preview === "object" ? preview : {};
|
|
1131
1192
|
const controlled = typeof preview === "object" && preview.open !== void 0;
|
|
@@ -1134,16 +1195,24 @@ function Image({ fallback, placeholder, preview = true, rootClassName = "", clas
|
|
|
1134
1195
|
const [loaded, setLoaded] = useState5(false);
|
|
1135
1196
|
const [failed, setFailed] = useState5(false);
|
|
1136
1197
|
const displaySrc = failed && fallback ? fallback : src;
|
|
1198
|
+
const group = useContext(ImageGroupContext);
|
|
1199
|
+
const groupId = useId2();
|
|
1200
|
+
const rootRef = useRef4(null);
|
|
1201
|
+
const grouped = Boolean(group && preview && !controlled && displaySrc);
|
|
1202
|
+
useEffect3(() => {
|
|
1203
|
+
if (grouped && group && displaySrc && rootRef.current) return group.register(groupId, { src: displaySrc, alt, element: rootRef.current });
|
|
1204
|
+
}, [group, grouped, groupId, displaySrc, alt]);
|
|
1137
1205
|
const radius = typeof style?.borderRadius === "number" ? `${style.borderRadius}px` : style?.borderRadius;
|
|
1138
1206
|
const rootStyle = {
|
|
1139
1207
|
...style,
|
|
1140
1208
|
"--sia-image-radius": radius ?? "var(--sia-radius)"
|
|
1141
1209
|
};
|
|
1142
1210
|
function setOpen(next) {
|
|
1143
|
-
if (
|
|
1211
|
+
if (grouped && next) group?.open(groupId);
|
|
1212
|
+
else if (!controlled) setInternalOpen(next);
|
|
1144
1213
|
config.onOpenChange?.(next);
|
|
1145
1214
|
}
|
|
1146
|
-
return /* @__PURE__ */ jsxs6("span", { className: `sia-image ${rootClassName}`.trim(), style: rootStyle, children: [
|
|
1215
|
+
return /* @__PURE__ */ jsxs6("span", { ref: rootRef, className: `sia-image ${rootClassName}`.trim(), style: rootStyle, children: [
|
|
1147
1216
|
!loaded && placeholder ? /* @__PURE__ */ jsx6("span", { className: "sia-image__placeholder", children: placeholder }) : null,
|
|
1148
1217
|
/* @__PURE__ */ jsx6("img", { ...withTitleTooltip(props), src: displaySrc, alt, className, onLoad: (event) => {
|
|
1149
1218
|
setLoaded(true);
|
|
@@ -1955,9 +2024,9 @@ var Typography = Object.assign(TypographyRoot, {
|
|
|
1955
2024
|
});
|
|
1956
2025
|
|
|
1957
2026
|
// src/components/FloatButton.tsx
|
|
1958
|
-
import { createContext, forwardRef as forwardRef2, useContext, useEffect as useEffect6, useId as
|
|
2027
|
+
import { createContext as createContext2, forwardRef as forwardRef2, useContext as useContext2, useEffect as useEffect6, useId as useId3, useRef as useRef7, useState as useState8 } from "react";
|
|
1959
2028
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1960
|
-
var GroupShape =
|
|
2029
|
+
var GroupShape = createContext2(void 0);
|
|
1961
2030
|
var FloatButtonRoot = forwardRef2(function FloatButton({
|
|
1962
2031
|
icon,
|
|
1963
2032
|
description,
|
|
@@ -1971,7 +2040,7 @@ var FloatButtonRoot = forwardRef2(function FloatButton({
|
|
|
1971
2040
|
children,
|
|
1972
2041
|
...props
|
|
1973
2042
|
}, ref) {
|
|
1974
|
-
const groupShape =
|
|
2043
|
+
const groupShape = useContext2(GroupShape);
|
|
1975
2044
|
const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
|
|
1976
2045
|
const button = /* @__PURE__ */ jsx11(
|
|
1977
2046
|
"button",
|
|
@@ -2011,7 +2080,7 @@ function FloatButtonGroup({
|
|
|
2011
2080
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
2012
2081
|
const rootRef = useRef7(null);
|
|
2013
2082
|
const triggerRef = useRef7(null);
|
|
2014
|
-
const id =
|
|
2083
|
+
const id = useId3();
|
|
2015
2084
|
useEffect6(() => {
|
|
2016
2085
|
if (!trigger || !visible) return;
|
|
2017
2086
|
const close = (event) => {
|
|
@@ -2127,6 +2196,7 @@ export {
|
|
|
2127
2196
|
Carousel,
|
|
2128
2197
|
Collapse,
|
|
2129
2198
|
ImagePreview,
|
|
2199
|
+
ImagePreviewGroup,
|
|
2130
2200
|
Image,
|
|
2131
2201
|
message,
|
|
2132
2202
|
Upload,
|
|
@@ -1882,6 +1882,12 @@ interface CollapseProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange">
|
|
|
1882
1882
|
declare function Collapse({ items, activeKey, defaultActiveKey, accordion, bordered, ghost, destroyInactivePanel, expandIconPosition, onChange, className, ...props }: CollapseProps): react.JSX.Element;
|
|
1883
1883
|
/** 图片预览的属性配置。 */
|
|
1884
1884
|
interface ImagePreviewProps {
|
|
1885
|
+
/** 分组中当前图片的序号,从 0 开始;与 count、onCurrentChange 一起提供时显示切换按钮。 */
|
|
1886
|
+
current?: number;
|
|
1887
|
+
/** 分组图片数量;大于 1 时允许按钮及左右方向键切换,首尾不循环。 */
|
|
1888
|
+
count?: number;
|
|
1889
|
+
/** 切换图片时回调新的序号,由外部同步 current、src 与 alt。 */
|
|
1890
|
+
onCurrentChange?: (current: number) => void;
|
|
1885
1891
|
/** 是否打开;传入后由外部控制显示状态。 */
|
|
1886
1892
|
open: boolean;
|
|
1887
1893
|
/** 图片或资源地址。 */
|
|
@@ -1895,7 +1901,7 @@ interface ImagePreviewProps {
|
|
|
1895
1901
|
onOpenChange: (open: boolean) => void;
|
|
1896
1902
|
}
|
|
1897
1903
|
/** 图片预览弹层,初始按窗口适配大图,支持水平/垂直翻转、左右旋转、缩放及拖动;重新打开或更换图片时重置视图。 */
|
|
1898
|
-
declare function ImagePreview({ open, src, alt, onOpenChange }: ImagePreviewProps): react.ReactPortal | null;
|
|
1904
|
+
declare function ImagePreview({ open, src, alt, onOpenChange, current, count, onCurrentChange }: ImagePreviewProps): react.ReactPortal | null;
|
|
1899
1905
|
/** 图片预览的配置。 */
|
|
1900
1906
|
interface ImagePreviewConfig {
|
|
1901
1907
|
/** 图片或资源地址。 */
|
|
@@ -1926,6 +1932,13 @@ interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
|
1926
1932
|
*/
|
|
1927
1933
|
rootClassName?: string;
|
|
1928
1934
|
}
|
|
1935
|
+
/** 图片预览组的配置。 */
|
|
1936
|
+
interface ImagePreviewGroupProps {
|
|
1937
|
+
/** 包含 Image 的内容,可嵌套布局容器;preview=false 或受控预览的 Image 不加入分组。 */
|
|
1938
|
+
children?: ReactNode;
|
|
1939
|
+
}
|
|
1940
|
+
/** 按图片在页面中的顺序组织预览,支持按钮和方向键切换;删除当前图片时关闭预览。 */
|
|
1941
|
+
declare function ImagePreviewGroup({ children }: ImagePreviewGroupProps): react.JSX.Element;
|
|
1929
1942
|
/** 图片组件。 */
|
|
1930
1943
|
declare function Image({ fallback, placeholder, preview, rootClassName, className, src, alt, onLoad, onError, style, ...props }: ImageProps): react.JSX.Element;
|
|
1931
1944
|
|
|
@@ -2424,4 +2437,4 @@ interface ResultProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
|
2424
2437
|
/** 用于导入、提交等操作完成后的结果展示,支持自定义图标、详情和操作。 */
|
|
2425
2438
|
declare function Result({ status, title, subTitle, icon, extra, children, className, ...props }: ResultProps): react.JSX.Element;
|
|
2426
2439
|
|
|
2427
|
-
export { type
|
|
2440
|
+
export { type MenuMode as $, type FloatButtonGroupProps as A, type BadgeProps as B, Calendar as C, Dropdown as D, type FloatButtonProps as E, FILLED_ICON_NAMES as F, type FloatButtonShape as G, type FloatingPlacement as H, type FloatingTrigger as I, ICON_NAMES as J, Icon as K, type IconName as L, type IconProps as M, type IconVariant as N, Image as O, ImagePreview as P, type ImagePreviewConfig as Q, ImagePreviewGroup as R, type ImagePreviewGroupProps as S, type TagStatus as T, type ImagePreviewProps as U, type ImageProps as V, Input as W, type InputProps as X, Menu as Y, type MenuClickInfo as Z, type MenuItem as _, Badge as a, Upload as a$, type MenuProps as a0, type MenuTheme as a1, type MessageConfig as a2, type MessageHandle as a3, type MessageKey as a4, type MessageType as a5, type NotificationConfig as a6, type NotificationPlacement as a7, type NotificationType as a8, Popconfirm as a9, type TabsProps as aA, type TabsType as aB, Tag as aC, type TagProps as aD, type TagSize as aE, type TagVariant as aF, Timeline as aG, type TimelineItem as aH, type TimelineProps as aI, Toolbar as aJ, type ToolbarItem as aK, type ToolbarProps as aL, Tooltip as aM, type TooltipProps as aN, Tour as aO, type TourProps as aP, type TourStep as aQ, Tree as aR, type TreeDropPosition as aS, type TreeKey as aT, type TreeNode as aU, type TreeProps as aV, Typography as aW, type TypographyLinkProps as aX, type TypographyProps as aY, type TypographyTitleProps as aZ, type TypographyType as a_, type PopconfirmProps as aa, Popover as ab, type PopoverProps as ac, Progress as ad, type ProgressProps as ae, type ProgressStatus as af, Rate as ag, type RateProps as ah, Result as ai, type ResultProps as aj, type ResultStatus as ak, Segmented as al, type SegmentedOption as am, type SegmentedProps as an, type SegmentedValue as ao, Spin as ap, type SpinProps as aq, type StepItem as ar, type StepStatus as as, Steps as at, type StepsProps as au, type TabItem as av, Tabs as aw, type TabsContextMenuClickInfo as ax, type TabsOrientation as ay, type TabsPosition as az, type BadgeRibbonProps as b, type UploadChangeInfo as b0, type UploadDraggerProps as b1, type UploadFile as b2, type UploadFileStatus as b3, type UploadHttpRequest as b4, type UploadItemActions as b5, type UploadProps as b6, type UploadRef as b7, type UploadRejectInfo as b8, type UploadRequestHandle as b9, type UploadRequestOptions as ba, Watermark as bb, type WatermarkFont as bc, type WatermarkProps as bd, message as be, notification as bf, type BadgeStatus as c, Breadcrumb as d, type BreadcrumbItem as e, type BreadcrumbProps as f, type CalendarProps as g, Card as h, type CardAccent as i, type CardProps as j, Carousel as k, type CarouselProps as l, type CarouselRef as m, Collapse as n, type CollapseItem as o, type CollapseKey as p, type CollapseProps as q, type DropdownButtonProps as r, type DropdownMenuProps as s, type DropdownOpenSource as t, type DropdownPlacement as u, type DropdownProps as v, type DropdownTrigger as w, type FilledIconName as x, FloatButton as y, type FloatButtonBackTopProps as z };
|
|
@@ -1882,6 +1882,12 @@ interface CollapseProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange">
|
|
|
1882
1882
|
declare function Collapse({ items, activeKey, defaultActiveKey, accordion, bordered, ghost, destroyInactivePanel, expandIconPosition, onChange, className, ...props }: CollapseProps): react.JSX.Element;
|
|
1883
1883
|
/** 图片预览的属性配置。 */
|
|
1884
1884
|
interface ImagePreviewProps {
|
|
1885
|
+
/** 分组中当前图片的序号,从 0 开始;与 count、onCurrentChange 一起提供时显示切换按钮。 */
|
|
1886
|
+
current?: number;
|
|
1887
|
+
/** 分组图片数量;大于 1 时允许按钮及左右方向键切换,首尾不循环。 */
|
|
1888
|
+
count?: number;
|
|
1889
|
+
/** 切换图片时回调新的序号,由外部同步 current、src 与 alt。 */
|
|
1890
|
+
onCurrentChange?: (current: number) => void;
|
|
1885
1891
|
/** 是否打开;传入后由外部控制显示状态。 */
|
|
1886
1892
|
open: boolean;
|
|
1887
1893
|
/** 图片或资源地址。 */
|
|
@@ -1895,7 +1901,7 @@ interface ImagePreviewProps {
|
|
|
1895
1901
|
onOpenChange: (open: boolean) => void;
|
|
1896
1902
|
}
|
|
1897
1903
|
/** 图片预览弹层,初始按窗口适配大图,支持水平/垂直翻转、左右旋转、缩放及拖动;重新打开或更换图片时重置视图。 */
|
|
1898
|
-
declare function ImagePreview({ open, src, alt, onOpenChange }: ImagePreviewProps): react.ReactPortal | null;
|
|
1904
|
+
declare function ImagePreview({ open, src, alt, onOpenChange, current, count, onCurrentChange }: ImagePreviewProps): react.ReactPortal | null;
|
|
1899
1905
|
/** 图片预览的配置。 */
|
|
1900
1906
|
interface ImagePreviewConfig {
|
|
1901
1907
|
/** 图片或资源地址。 */
|
|
@@ -1926,6 +1932,13 @@ interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
|
1926
1932
|
*/
|
|
1927
1933
|
rootClassName?: string;
|
|
1928
1934
|
}
|
|
1935
|
+
/** 图片预览组的配置。 */
|
|
1936
|
+
interface ImagePreviewGroupProps {
|
|
1937
|
+
/** 包含 Image 的内容,可嵌套布局容器;preview=false 或受控预览的 Image 不加入分组。 */
|
|
1938
|
+
children?: ReactNode;
|
|
1939
|
+
}
|
|
1940
|
+
/** 按图片在页面中的顺序组织预览,支持按钮和方向键切换;删除当前图片时关闭预览。 */
|
|
1941
|
+
declare function ImagePreviewGroup({ children }: ImagePreviewGroupProps): react.JSX.Element;
|
|
1929
1942
|
/** 图片组件。 */
|
|
1930
1943
|
declare function Image({ fallback, placeholder, preview, rootClassName, className, src, alt, onLoad, onError, style, ...props }: ImageProps): react.JSX.Element;
|
|
1931
1944
|
|
|
@@ -2424,4 +2437,4 @@ interface ResultProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
|
2424
2437
|
/** 用于导入、提交等操作完成后的结果展示,支持自定义图标、详情和操作。 */
|
|
2425
2438
|
declare function Result({ status, title, subTitle, icon, extra, children, className, ...props }: ResultProps): react.JSX.Element;
|
|
2426
2439
|
|
|
2427
|
-
export { type
|
|
2440
|
+
export { type MenuMode as $, type FloatButtonGroupProps as A, type BadgeProps as B, Calendar as C, Dropdown as D, type FloatButtonProps as E, FILLED_ICON_NAMES as F, type FloatButtonShape as G, type FloatingPlacement as H, type FloatingTrigger as I, ICON_NAMES as J, Icon as K, type IconName as L, type IconProps as M, type IconVariant as N, Image as O, ImagePreview as P, type ImagePreviewConfig as Q, ImagePreviewGroup as R, type ImagePreviewGroupProps as S, type TagStatus as T, type ImagePreviewProps as U, type ImageProps as V, Input as W, type InputProps as X, Menu as Y, type MenuClickInfo as Z, type MenuItem as _, Badge as a, Upload as a$, type MenuProps as a0, type MenuTheme as a1, type MessageConfig as a2, type MessageHandle as a3, type MessageKey as a4, type MessageType as a5, type NotificationConfig as a6, type NotificationPlacement as a7, type NotificationType as a8, Popconfirm as a9, type TabsProps as aA, type TabsType as aB, Tag as aC, type TagProps as aD, type TagSize as aE, type TagVariant as aF, Timeline as aG, type TimelineItem as aH, type TimelineProps as aI, Toolbar as aJ, type ToolbarItem as aK, type ToolbarProps as aL, Tooltip as aM, type TooltipProps as aN, Tour as aO, type TourProps as aP, type TourStep as aQ, Tree as aR, type TreeDropPosition as aS, type TreeKey as aT, type TreeNode as aU, type TreeProps as aV, Typography as aW, type TypographyLinkProps as aX, type TypographyProps as aY, type TypographyTitleProps as aZ, type TypographyType as a_, type PopconfirmProps as aa, Popover as ab, type PopoverProps as ac, Progress as ad, type ProgressProps as ae, type ProgressStatus as af, Rate as ag, type RateProps as ah, Result as ai, type ResultProps as aj, type ResultStatus as ak, Segmented as al, type SegmentedOption as am, type SegmentedProps as an, type SegmentedValue as ao, Spin as ap, type SpinProps as aq, type StepItem as ar, type StepStatus as as, Steps as at, type StepsProps as au, type TabItem as av, Tabs as aw, type TabsContextMenuClickInfo as ax, type TabsOrientation as ay, type TabsPosition as az, type BadgeRibbonProps as b, type UploadChangeInfo as b0, type UploadDraggerProps as b1, type UploadFile as b2, type UploadFileStatus as b3, type UploadHttpRequest as b4, type UploadItemActions as b5, type UploadProps as b6, type UploadRef as b7, type UploadRejectInfo as b8, type UploadRequestHandle as b9, type UploadRequestOptions as ba, Watermark as bb, type WatermarkFont as bc, type WatermarkProps as bd, message as be, notification as bf, type BadgeStatus as c, Breadcrumb as d, type BreadcrumbItem as e, type BreadcrumbProps as f, type CalendarProps as g, Card as h, type CardAccent as i, type CardProps as j, Carousel as k, type CarouselProps as l, type CarouselRef as m, Collapse as n, type CollapseItem as o, type CollapseKey as p, type CollapseProps as q, type DropdownButtonProps as r, type DropdownMenuProps as s, type DropdownOpenSource as t, type DropdownPlacement as u, type DropdownProps as v, type DropdownTrigger as w, type FilledIconName as x, FloatButton as y, type FloatButtonBackTopProps as z };
|
package/dist/core.cjs
CHANGED
|
@@ -3557,7 +3557,7 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
|
|
|
3557
3557
|
] }, item.key);
|
|
3558
3558
|
}) });
|
|
3559
3559
|
}
|
|
3560
|
-
function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
3560
|
+
function ImagePreview({ open, src, alt = "", onOpenChange, current = 0, count = 1, onCurrentChange }) {
|
|
3561
3561
|
const previewRef = (0, import_react19.useRef)(null);
|
|
3562
3562
|
const stageRef = (0, import_react19.useRef)(null);
|
|
3563
3563
|
const [natural, setNatural] = (0, import_react19.useState)({ src: "", width: 0, height: 0 });
|
|
@@ -3580,6 +3580,18 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
3580
3580
|
reset();
|
|
3581
3581
|
setFailed(false);
|
|
3582
3582
|
}, [open, src]);
|
|
3583
|
+
(0, import_react19.useEffect)(() => {
|
|
3584
|
+
if (!open || !onCurrentChange || count < 2) return;
|
|
3585
|
+
const handleKey = (event) => {
|
|
3586
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
3587
|
+
event.preventDefault();
|
|
3588
|
+
event.stopPropagation();
|
|
3589
|
+
const next = current + (event.key === "ArrowRight" ? 1 : -1);
|
|
3590
|
+
if (next >= 0 && next < count) onCurrentChange(next);
|
|
3591
|
+
};
|
|
3592
|
+
document.addEventListener("keydown", handleKey, true);
|
|
3593
|
+
return () => document.removeEventListener("keydown", handleKey, true);
|
|
3594
|
+
}, [open, current, count, onCurrentChange]);
|
|
3583
3595
|
(0, import_react19.useEffect)(() => {
|
|
3584
3596
|
const stage = stageRef.current;
|
|
3585
3597
|
if (!open || !stage) return;
|
|
@@ -3636,6 +3648,15 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
3636
3648
|
src
|
|
3637
3649
|
) }),
|
|
3638
3650
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "sia-image-preview__toolbar", role: "toolbar", "aria-label": "\u56FE\u7247\u64CD\u4F5C", onClick: (event) => event.stopPropagation(), children: [
|
|
3651
|
+
count > 1 && onCurrentChange ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "text", "aria-label": "\u4E0A\u4E00\u5F20", disabled: current === 0, onClick: () => onCurrentChange(current - 1), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "chevron-left" }) }),
|
|
3653
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("output", { "aria-label": "\u56FE\u7247\u5E8F\u53F7", children: [
|
|
3654
|
+
current + 1,
|
|
3655
|
+
" / ",
|
|
3656
|
+
count
|
|
3657
|
+
] }),
|
|
3658
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "text", "aria-label": "\u4E0B\u4E00\u5F20", disabled: current >= count - 1, onClick: () => onCurrentChange(current + 1), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "chevron-right" }) })
|
|
3659
|
+
] }) : null,
|
|
3639
3660
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "text", title: "\u6C34\u5E73\u7FFB\u8F6C", "aria-label": "\u6C34\u5E73\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, x: -value.x })), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "flip-horizontal", size: 20 }) }),
|
|
3640
3661
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "text", title: "\u5782\u76F4\u7FFB\u8F6C", "aria-label": "\u5782\u76F4\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, y: -value.y })), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "flip-vertical", size: 20 }) }),
|
|
3641
3662
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "text", title: "\u5411\u5DE6\u65CB\u8F6C", "aria-label": "\u5411\u5DE6\u65CB\u8F6C", disabled: !ready, onClick: () => {
|
|
@@ -3653,6 +3674,7 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
3653
3674
|
] })
|
|
3654
3675
|
] }), document.body);
|
|
3655
3676
|
}
|
|
3677
|
+
var ImageGroupContext = (0, import_react19.createContext)(null);
|
|
3656
3678
|
|
|
3657
3679
|
// src/components/FloatingPlaceholder.tsx
|
|
3658
3680
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
package/dist/core.css
CHANGED
|
@@ -8026,6 +8026,13 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8026
8026
|
padding: 0;
|
|
8027
8027
|
border: 0;
|
|
8028
8028
|
}
|
|
8029
|
+
.sia-form--fill {
|
|
8030
|
+
display: flex;
|
|
8031
|
+
flex: 1;
|
|
8032
|
+
flex-direction: column;
|
|
8033
|
+
min-width: 0;
|
|
8034
|
+
min-height: 0;
|
|
8035
|
+
}
|
|
8029
8036
|
.sia-form-item {
|
|
8030
8037
|
display: grid;
|
|
8031
8038
|
grid-template-columns: var(--sia-form-label-width, var(--sia-form-auto-label-width, 0px)) minmax(0, 1fr);
|
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,
|
|
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, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-C2V9aLTP.cjs';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-B9hlqeO5.cjs';
|
|
4
4
|
import 'react';
|
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,
|
|
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, W as Input, X as InputProps, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, ad as Progress, ae as ProgressProps, af as ProgressStatus, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, av as TabItem, aw as Tabs, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, T as TagStatus, aF as TagVariant, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b6 as UploadProps, ba as UploadRequestOptions, be as message } from './core-DUjadxCD.js';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-DgZW5a7j.js';
|
|
4
4
|
import 'react';
|
package/dist/core.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
Icon: () => Icon,
|
|
88
88
|
Image: () => Image2,
|
|
89
89
|
ImagePreview: () => ImagePreview,
|
|
90
|
+
ImagePreviewGroup: () => ImagePreviewGroup,
|
|
90
91
|
Input: () => Input,
|
|
91
92
|
InputNumber: () => InputNumber,
|
|
92
93
|
InputSelect: () => InputSelect,
|
|
@@ -2033,7 +2034,7 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
|
|
|
2033
2034
|
] }, item.key);
|
|
2034
2035
|
}) });
|
|
2035
2036
|
}
|
|
2036
|
-
function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
2037
|
+
function ImagePreview({ open, src, alt = "", onOpenChange, current = 0, count = 1, onCurrentChange }) {
|
|
2037
2038
|
const previewRef = (0, import_react7.useRef)(null);
|
|
2038
2039
|
const stageRef = (0, import_react7.useRef)(null);
|
|
2039
2040
|
const [natural, setNatural] = (0, import_react7.useState)({ src: "", width: 0, height: 0 });
|
|
@@ -2056,6 +2057,18 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
2056
2057
|
reset();
|
|
2057
2058
|
setFailed(false);
|
|
2058
2059
|
}, [open, src]);
|
|
2060
|
+
(0, import_react7.useEffect)(() => {
|
|
2061
|
+
if (!open || !onCurrentChange || count < 2) return;
|
|
2062
|
+
const handleKey = (event) => {
|
|
2063
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
2064
|
+
event.preventDefault();
|
|
2065
|
+
event.stopPropagation();
|
|
2066
|
+
const next = current + (event.key === "ArrowRight" ? 1 : -1);
|
|
2067
|
+
if (next >= 0 && next < count) onCurrentChange(next);
|
|
2068
|
+
};
|
|
2069
|
+
document.addEventListener("keydown", handleKey, true);
|
|
2070
|
+
return () => document.removeEventListener("keydown", handleKey, true);
|
|
2071
|
+
}, [open, current, count, onCurrentChange]);
|
|
2059
2072
|
(0, import_react7.useEffect)(() => {
|
|
2060
2073
|
const stage = stageRef.current;
|
|
2061
2074
|
if (!open || !stage) return;
|
|
@@ -2112,6 +2125,15 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
2112
2125
|
src
|
|
2113
2126
|
) }),
|
|
2114
2127
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "sia-image-preview__toolbar", role: "toolbar", "aria-label": "\u56FE\u7247\u64CD\u4F5C", onClick: (event) => event.stopPropagation(), children: [
|
|
2128
|
+
count > 1 && onCurrentChange ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "text", "aria-label": "\u4E0A\u4E00\u5F20", disabled: current === 0, onClick: () => onCurrentChange(current - 1), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron-left" }) }),
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("output", { "aria-label": "\u56FE\u7247\u5E8F\u53F7", children: [
|
|
2131
|
+
current + 1,
|
|
2132
|
+
" / ",
|
|
2133
|
+
count
|
|
2134
|
+
] }),
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "text", "aria-label": "\u4E0B\u4E00\u5F20", disabled: current >= count - 1, onClick: () => onCurrentChange(current + 1), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron-right" }) })
|
|
2136
|
+
] }) : null,
|
|
2115
2137
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "text", title: "\u6C34\u5E73\u7FFB\u8F6C", "aria-label": "\u6C34\u5E73\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, x: -value.x })), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "flip-horizontal", size: 20 }) }),
|
|
2116
2138
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "text", title: "\u5782\u76F4\u7FFB\u8F6C", "aria-label": "\u5782\u76F4\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, y: -value.y })), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "flip-vertical", size: 20 }) }),
|
|
2117
2139
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "text", title: "\u5411\u5DE6\u65CB\u8F6C", "aria-label": "\u5411\u5DE6\u65CB\u8F6C", disabled: !ready, onClick: () => {
|
|
@@ -2129,6 +2151,46 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
2129
2151
|
] })
|
|
2130
2152
|
] }), document.body);
|
|
2131
2153
|
}
|
|
2154
|
+
var ImageGroupContext = (0, import_react7.createContext)(null);
|
|
2155
|
+
function ImagePreviewGroup({ children }) {
|
|
2156
|
+
const images = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
|
|
2157
|
+
const [active, setActive] = (0, import_react7.useState)();
|
|
2158
|
+
const [, setRevision] = (0, import_react7.useState)(0);
|
|
2159
|
+
const context = (0, import_react7.useMemo)(() => ({
|
|
2160
|
+
register: (id, image2) => {
|
|
2161
|
+
images.current.set(id, image2);
|
|
2162
|
+
setRevision((value) => value + 1);
|
|
2163
|
+
return () => {
|
|
2164
|
+
images.current.delete(id);
|
|
2165
|
+
setRevision((value) => value + 1);
|
|
2166
|
+
};
|
|
2167
|
+
},
|
|
2168
|
+
open: (id) => setActive(id)
|
|
2169
|
+
}), []);
|
|
2170
|
+
const entries = [...images.current].sort((a, b) => a[1].element.compareDocumentPosition(b[1].element) & 4 ? -1 : 1);
|
|
2171
|
+
const index = entries.findIndex(([id]) => id === active);
|
|
2172
|
+
const image = entries[index]?.[1];
|
|
2173
|
+
(0, import_react7.useEffect)(() => {
|
|
2174
|
+
if (active && index < 0) setActive(void 0);
|
|
2175
|
+
}, [active, index]);
|
|
2176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ImageGroupContext.Provider, { value: context, children: [
|
|
2177
|
+
children,
|
|
2178
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2179
|
+
ImagePreview,
|
|
2180
|
+
{
|
|
2181
|
+
open: Boolean(image),
|
|
2182
|
+
src: image?.src,
|
|
2183
|
+
alt: image?.alt,
|
|
2184
|
+
current: index,
|
|
2185
|
+
count: entries.length,
|
|
2186
|
+
onOpenChange: (open) => {
|
|
2187
|
+
if (!open) setActive(void 0);
|
|
2188
|
+
},
|
|
2189
|
+
onCurrentChange: (next) => setActive(entries[next]?.[0])
|
|
2190
|
+
}
|
|
2191
|
+
)
|
|
2192
|
+
] });
|
|
2193
|
+
}
|
|
2132
2194
|
function Image2({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onLoad, onError, style, ...props }) {
|
|
2133
2195
|
const config = typeof preview === "object" ? preview : {};
|
|
2134
2196
|
const controlled = typeof preview === "object" && preview.open !== void 0;
|
|
@@ -2137,16 +2199,24 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
|
|
|
2137
2199
|
const [loaded, setLoaded] = (0, import_react7.useState)(false);
|
|
2138
2200
|
const [failed, setFailed] = (0, import_react7.useState)(false);
|
|
2139
2201
|
const displaySrc = failed && fallback ? fallback : src;
|
|
2202
|
+
const group = (0, import_react7.useContext)(ImageGroupContext);
|
|
2203
|
+
const groupId = (0, import_react7.useId)();
|
|
2204
|
+
const rootRef = (0, import_react7.useRef)(null);
|
|
2205
|
+
const grouped = Boolean(group && preview && !controlled && displaySrc);
|
|
2206
|
+
(0, import_react7.useEffect)(() => {
|
|
2207
|
+
if (grouped && group && displaySrc && rootRef.current) return group.register(groupId, { src: displaySrc, alt, element: rootRef.current });
|
|
2208
|
+
}, [group, grouped, groupId, displaySrc, alt]);
|
|
2140
2209
|
const radius = typeof style?.borderRadius === "number" ? `${style.borderRadius}px` : style?.borderRadius;
|
|
2141
2210
|
const rootStyle = {
|
|
2142
2211
|
...style,
|
|
2143
2212
|
"--sia-image-radius": radius ?? "var(--sia-radius)"
|
|
2144
2213
|
};
|
|
2145
2214
|
function setOpen(next) {
|
|
2146
|
-
if (
|
|
2215
|
+
if (grouped && next) group?.open(groupId);
|
|
2216
|
+
else if (!controlled) setInternalOpen(next);
|
|
2147
2217
|
config.onOpenChange?.(next);
|
|
2148
2218
|
}
|
|
2149
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: `sia-image ${rootClassName}`.trim(), style: rootStyle, children: [
|
|
2219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { ref: rootRef, className: `sia-image ${rootClassName}`.trim(), style: rootStyle, children: [
|
|
2150
2220
|
!loaded && placeholder ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sia-image__placeholder", children: placeholder }) : null,
|
|
2151
2221
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { ...withTitleTooltip(props), src: displaySrc, alt, className, onLoad: (event) => {
|
|
2152
2222
|
setLoaded(true);
|
|
@@ -7407,6 +7477,7 @@ function useForm(form) {
|
|
|
7407
7477
|
return [ref.current];
|
|
7408
7478
|
}
|
|
7409
7479
|
function FormRoot({
|
|
7480
|
+
fill = false,
|
|
7410
7481
|
form,
|
|
7411
7482
|
initialValues,
|
|
7412
7483
|
layout = "horizontal",
|
|
@@ -7473,7 +7544,7 @@ function FormRoot({
|
|
|
7473
7544
|
{
|
|
7474
7545
|
ref: formRef,
|
|
7475
7546
|
...withTitleTooltip(props),
|
|
7476
|
-
className: `sia-form sia-form--${layout} sia-form--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
7547
|
+
className: `sia-form sia-form--${layout} sia-form--${size}${fill ? " sia-form--fill" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
7477
7548
|
"data-required-mark": requiredMark,
|
|
7478
7549
|
onSubmit: (event) => {
|
|
7479
7550
|
event.preventDefault();
|
|
@@ -25747,6 +25818,7 @@ function Result({ status = "info", title, subTitle, icon, extra, children, class
|
|
|
25747
25818
|
Icon,
|
|
25748
25819
|
Image,
|
|
25749
25820
|
ImagePreview,
|
|
25821
|
+
ImagePreviewGroup,
|
|
25750
25822
|
Input,
|
|
25751
25823
|
InputNumber,
|
|
25752
25824
|
InputSelect,
|
package/dist/index.css
CHANGED
|
@@ -8026,6 +8026,13 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8026
8026
|
padding: 0;
|
|
8027
8027
|
border: 0;
|
|
8028
8028
|
}
|
|
8029
|
+
.sia-form--fill {
|
|
8030
|
+
display: flex;
|
|
8031
|
+
flex: 1;
|
|
8032
|
+
flex-direction: column;
|
|
8033
|
+
min-width: 0;
|
|
8034
|
+
min-height: 0;
|
|
8035
|
+
}
|
|
8029
8036
|
.sia-form-item {
|
|
8030
8037
|
display: grid;
|
|
8031
8038
|
grid-template-columns: var(--sia-form-label-width, var(--sia-form-auto-label-width, 0px)) minmax(0, 1fr);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
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
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-C2V9aLTP.cjs';
|
|
4
|
+
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 ImagePreviewGroup, S as ImagePreviewGroupProps, U as ImagePreviewProps, V as ImageProps, W as Input, X as InputProps, Y as Menu, Z as MenuClickInfo, _ as MenuItem, $ as MenuMode, a0 as MenuProps, a1 as MenuTheme, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, a6 as NotificationConfig, a7 as NotificationPlacement, a8 as NotificationType, a9 as Popconfirm, aa as PopconfirmProps, ab as Popover, ac as PopoverProps, ad as Progress, ae as ProgressProps, af as ProgressStatus, ag as Rate, ah as RateProps, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, ap as Spin, aq as SpinProps, ar as StepItem, as as StepStatus, at as Steps, au as StepsProps, av as TabItem, aw as Tabs, ax as TabsContextMenuClickInfo, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, aF as TagVariant, aG as Timeline, aH as TimelineItem, aI as TimelineProps, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aM as Tooltip, aN as TooltipProps, aO as Tour, aP as TourProps, aQ as TourStep, aR as Tree, aS as TreeDropPosition, aT as TreeKey, aU as TreeNode, aV as TreeProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b4 as UploadHttpRequest, b5 as UploadItemActions, b6 as UploadProps, b7 as UploadRef, b8 as UploadRejectInfo, b9 as UploadRequestHandle, ba as UploadRequestOptions, bb as Watermark, bc as WatermarkFont, bd as WatermarkProps, be as message, bf as notification } from './core-C2V9aLTP.cjs';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
6
6
|
import { B as ButtonProps, a as ButtonSize } from './Button-O_pNB3SQ.cjs';
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
@@ -828,6 +828,8 @@ interface FormInstance {
|
|
|
828
828
|
declare function useForm(form?: FormInstance): readonly [FormInstance];
|
|
829
829
|
/** 表单的属性配置。 */
|
|
830
830
|
interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"> {
|
|
831
|
+
/** 是否作为纵向弹性容器填满父容器剩余高度;父容器需提供确定高度,子列表可用 flex 分配剩余空间。默认 false。 */
|
|
832
|
+
fill?: boolean;
|
|
831
833
|
/** 组件尺寸;用于调整控件高度、字号和间距。 */
|
|
832
834
|
size?: ControlSize;
|
|
833
835
|
/** 表单实例;可由 Form.useForm() 或 useForm() 创建。 */
|
|
@@ -863,7 +865,7 @@ interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"
|
|
|
863
865
|
/** 字段通过表单控件交互更新时调用,接收本次变化字段和完整值;用于联动查询条件等业务逻辑。 */
|
|
864
866
|
onValuesChange?: (changedValues: FormValues, values: FormValues) => void;
|
|
865
867
|
}
|
|
866
|
-
declare function FormRoot({ form, initialValues, layout, size: sizeProp, placeholderMode, disabled, requiredMark, className, onFinish, onFinishFailed, onValuesChange, children, ...props }: FormProps): react.JSX.Element;
|
|
868
|
+
declare function FormRoot({ fill, form, initialValues, layout, size: sizeProp, placeholderMode, disabled, requiredMark, className, onFinish, onFinishFailed, onValuesChange, children, ...props }: FormProps): react.JSX.Element;
|
|
867
869
|
/** 表单项的字段绑定、标签、校验及内容配置;默认保留 8px 下外边距,noStyle 不生成布局容器或间距。 */
|
|
868
870
|
interface FormItemProps {
|
|
869
871
|
/** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
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
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-DUjadxCD.js';
|
|
4
|
+
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 ImagePreviewGroup, S as ImagePreviewGroupProps, U as ImagePreviewProps, V as ImageProps, W as Input, X as InputProps, Y as Menu, Z as MenuClickInfo, _ as MenuItem, $ as MenuMode, a0 as MenuProps, a1 as MenuTheme, a2 as MessageConfig, a3 as MessageHandle, a4 as MessageKey, a5 as MessageType, a6 as NotificationConfig, a7 as NotificationPlacement, a8 as NotificationType, a9 as Popconfirm, aa as PopconfirmProps, ab as Popover, ac as PopoverProps, ad as Progress, ae as ProgressProps, af as ProgressStatus, ag as Rate, ah as RateProps, ai as Result, aj as ResultProps, ak as ResultStatus, al as Segmented, am as SegmentedOption, an as SegmentedProps, ao as SegmentedValue, ap as Spin, aq as SpinProps, ar as StepItem, as as StepStatus, at as Steps, au as StepsProps, av as TabItem, aw as Tabs, ax as TabsContextMenuClickInfo, ay as TabsOrientation, az as TabsPosition, aA as TabsProps, aB as TabsType, aC as Tag, aD as TagProps, aE as TagSize, aF as TagVariant, aG as Timeline, aH as TimelineItem, aI as TimelineProps, aJ as Toolbar, aK as ToolbarItem, aL as ToolbarProps, aM as Tooltip, aN as TooltipProps, aO as Tour, aP as TourProps, aQ as TourStep, aR as Tree, aS as TreeDropPosition, aT as TreeKey, aU as TreeNode, aV as TreeProps, aW as Typography, aX as TypographyLinkProps, aY as TypographyProps, aZ as TypographyTitleProps, a_ as TypographyType, a$ as Upload, b0 as UploadChangeInfo, b1 as UploadDraggerProps, b2 as UploadFile, b3 as UploadFileStatus, b4 as UploadHttpRequest, b5 as UploadItemActions, b6 as UploadProps, b7 as UploadRef, b8 as UploadRejectInfo, b9 as UploadRequestHandle, ba as UploadRequestOptions, bb as Watermark, bc as WatermarkFont, bd as WatermarkProps, be as message, bf as notification } from './core-DUjadxCD.js';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
6
6
|
import { B as ButtonProps, a as ButtonSize } from './Button-BiL3Wjsd.js';
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
@@ -828,6 +828,8 @@ interface FormInstance {
|
|
|
828
828
|
declare function useForm(form?: FormInstance): readonly [FormInstance];
|
|
829
829
|
/** 表单的属性配置。 */
|
|
830
830
|
interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"> {
|
|
831
|
+
/** 是否作为纵向弹性容器填满父容器剩余高度;父容器需提供确定高度,子列表可用 flex 分配剩余空间。默认 false。 */
|
|
832
|
+
fill?: boolean;
|
|
831
833
|
/** 组件尺寸;用于调整控件高度、字号和间距。 */
|
|
832
834
|
size?: ControlSize;
|
|
833
835
|
/** 表单实例;可由 Form.useForm() 或 useForm() 创建。 */
|
|
@@ -863,7 +865,7 @@ interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"
|
|
|
863
865
|
/** 字段通过表单控件交互更新时调用,接收本次变化字段和完整值;用于联动查询条件等业务逻辑。 */
|
|
864
866
|
onValuesChange?: (changedValues: FormValues, values: FormValues) => void;
|
|
865
867
|
}
|
|
866
|
-
declare function FormRoot({ form, initialValues, layout, size: sizeProp, placeholderMode, disabled, requiredMark, className, onFinish, onFinishFailed, onValuesChange, children, ...props }: FormProps): react.JSX.Element;
|
|
868
|
+
declare function FormRoot({ fill, form, initialValues, layout, size: sizeProp, placeholderMode, disabled, requiredMark, className, onFinish, onFinishFailed, onValuesChange, children, ...props }: FormProps): react.JSX.Element;
|
|
867
869
|
/** 表单项的字段绑定、标签、校验及内容配置;默认保留 8px 下外边距,noStyle 不生成布局容器或间距。 */
|
|
868
870
|
interface FormItemProps {
|
|
869
871
|
/** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
|
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ import {
|
|
|
67
67
|
FloatButton,
|
|
68
68
|
Image,
|
|
69
69
|
ImagePreview,
|
|
70
|
+
ImagePreviewGroup,
|
|
70
71
|
Popconfirm,
|
|
71
72
|
Progress,
|
|
72
73
|
Rate,
|
|
@@ -81,7 +82,7 @@ import {
|
|
|
81
82
|
Watermark,
|
|
82
83
|
message,
|
|
83
84
|
notification
|
|
84
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-UW2W7RYZ.js";
|
|
85
86
|
import "./chunk-RX242MUO.js";
|
|
86
87
|
import {
|
|
87
88
|
MarkdownEditor
|
|
@@ -1940,6 +1941,7 @@ function useForm(form) {
|
|
|
1940
1941
|
return [ref.current];
|
|
1941
1942
|
}
|
|
1942
1943
|
function FormRoot({
|
|
1944
|
+
fill = false,
|
|
1943
1945
|
form,
|
|
1944
1946
|
initialValues,
|
|
1945
1947
|
layout = "horizontal",
|
|
@@ -2006,7 +2008,7 @@ function FormRoot({
|
|
|
2006
2008
|
{
|
|
2007
2009
|
ref: formRef,
|
|
2008
2010
|
...withTitleTooltip(props),
|
|
2009
|
-
className: `sia-form sia-form--${layout} sia-form--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
2011
|
+
className: `sia-form sia-form--${layout} sia-form--${size}${fill ? " sia-form--fill" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
2010
2012
|
"data-required-mark": requiredMark,
|
|
2011
2013
|
onSubmit: (event) => {
|
|
2012
2014
|
event.preventDefault();
|
|
@@ -10151,6 +10153,7 @@ export {
|
|
|
10151
10153
|
Icon,
|
|
10152
10154
|
Image,
|
|
10153
10155
|
ImagePreview,
|
|
10156
|
+
ImagePreviewGroup,
|
|
10154
10157
|
Input,
|
|
10155
10158
|
InputNumber,
|
|
10156
10159
|
InputSelect,
|