@sia.soul/sia-react-ui 0.1.118 → 0.1.120
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/{Select-BAFXKVZB.d.cts → Select-B9hlqeO5.d.cts} +6 -0
- package/dist/{Select-vjX7B63I.d.ts → Select-DgZW5a7j.d.ts} +6 -0
- package/dist/{chunk-GKFFFHHU.js → chunk-IRMKZYGV.js} +1 -1
- package/dist/{chunk-QBBIBJXW.js → chunk-ODJNSVNB.js} +2 -2
- package/dist/{chunk-AOWWHL5Z.js → chunk-RZR3EZRL.js} +2 -2
- package/dist/{chunk-BEVCKS5J.js → chunk-WS4WYFJZ.js} +3 -3
- package/dist/{chunk-BQIARYZB.js → chunk-XDG736H7.js} +2 -2
- package/dist/{chunk-6MGFX7B2.js → chunk-ZD45Z2NI.js} +15 -5
- package/dist/{core-PlVXb05e.d.ts → core-DCfngMfy.d.ts} +2 -2
- package/dist/{core-mmHC4SGJ.d.cts → core-DQ2ZROfx.d.cts} +2 -2
- package/dist/core.cjs +15 -5
- package/dist/core.css +3 -3
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +4 -4
- package/dist/game.cjs +15 -5
- package/dist/game.css +2 -2
- package/dist/game.js +1 -1
- package/dist/index.cjs +30 -5
- package/dist/index.css +3 -3
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +21 -6
- package/dist/rich-text-editor.cjs +15 -5
- package/dist/rich-text-editor.js +3 -3
- package/dist/{select-date-range-C9jlUrCX.d.ts → select-date-range-BskjBzTI.d.ts} +1 -1
- package/dist/{select-date-range-CIiI0F5o.d.cts → select-date-range-CZpQhFBu.d.cts} +1 -1
- package/dist/select-date-range.cjs +15 -5
- package/dist/select-date-range.d.cts +2 -2
- package/dist/select-date-range.d.ts +2 -2
- package/dist/select-date-range.js +4 -4
- package/package.json +1 -1
|
@@ -14,6 +14,12 @@ type ModalActionResult = void | boolean | Promise<void | boolean>;
|
|
|
14
14
|
interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "onSubmit"> {
|
|
15
15
|
/** 是否显示对话框 */
|
|
16
16
|
open: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 打开时自动聚焦正文中首个可用输入组件,跳过隐藏、禁用和只读字段;尊重内容自身已设置的焦点。
|
|
19
|
+
* 无可用输入组件或设置为 false 时,使用默认首个可聚焦元素。仅在打开时执行,不等待异步加载的字段;异步内容可在加载完成后自行聚焦。
|
|
20
|
+
* @defaultValue true
|
|
21
|
+
*/
|
|
22
|
+
autoFocus?: boolean;
|
|
17
23
|
/** 标题 */
|
|
18
24
|
title?: ReactNode;
|
|
19
25
|
/** 弹框正文内容,默认字号为 13px;子元素可通过自身字号样式覆盖。 */
|
|
@@ -14,6 +14,12 @@ type ModalActionResult = void | boolean | Promise<void | boolean>;
|
|
|
14
14
|
interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "onSubmit"> {
|
|
15
15
|
/** 是否显示对话框 */
|
|
16
16
|
open: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 打开时自动聚焦正文中首个可用输入组件,跳过隐藏、禁用和只读字段;尊重内容自身已设置的焦点。
|
|
19
|
+
* 无可用输入组件或设置为 false 时,使用默认首个可聚焦元素。仅在打开时执行,不等待异步加载的字段;异步内容可在加载完成后自行聚焦。
|
|
20
|
+
* @defaultValue true
|
|
21
|
+
*/
|
|
22
|
+
autoFocus?: boolean;
|
|
17
23
|
/** 标题 */
|
|
18
24
|
title?: ReactNode;
|
|
19
25
|
/** 弹框正文内容,默认字号为 13px;子元素可通过自身字号样式覆盖。 */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FloatingScrollbarProvider,
|
|
3
3
|
Select
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XDG736H7.js";
|
|
5
5
|
import {
|
|
6
6
|
Icon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZD45Z2NI.js";
|
|
8
8
|
import {
|
|
9
9
|
useFloatingPlaceholder
|
|
10
10
|
} from "./chunk-KY6A5IJH.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Popover,
|
|
3
3
|
Tooltip
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XDG736H7.js";
|
|
5
5
|
import {
|
|
6
6
|
Dropdown
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IRMKZYGV.js";
|
|
8
8
|
import {
|
|
9
9
|
TextArea
|
|
10
10
|
} from "./chunk-SCEHVGKV.js";
|
|
11
11
|
import {
|
|
12
12
|
Icon,
|
|
13
13
|
useOverlayLifecycle
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZD45Z2NI.js";
|
|
15
15
|
import {
|
|
16
16
|
Button
|
|
17
17
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Dropdown,
|
|
3
3
|
Input
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IRMKZYGV.js";
|
|
5
5
|
import {
|
|
6
6
|
Icon,
|
|
7
7
|
Modal,
|
|
8
8
|
isAnchorBehindOverlay,
|
|
9
9
|
subscribeOverlayLayers
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZD45Z2NI.js";
|
|
11
11
|
import {
|
|
12
12
|
Button
|
|
13
13
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -1216,7 +1216,14 @@ function focusableElements(container) {
|
|
|
1216
1216
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
1217
1217
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
1218
1218
|
}
|
|
1219
|
-
function
|
|
1219
|
+
function firstModalInput(panel) {
|
|
1220
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
1221
|
+
const candidates = body?.querySelectorAll(
|
|
1222
|
+
'input:not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"], [role="combobox"], .sia-picker__trigger, .sia-cascader__trigger, .sia-tree-select__trigger'
|
|
1223
|
+
);
|
|
1224
|
+
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
1225
|
+
}
|
|
1226
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
1220
1227
|
const overlayIdRef = useRef(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
1221
1228
|
const closeRef = useRef(onRequestClose);
|
|
1222
1229
|
closeRef.current = onRequestClose;
|
|
@@ -1230,9 +1237,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1230
1237
|
const unlockBody = lockBodyScroll();
|
|
1231
1238
|
const focusTimer = window.setTimeout(() => {
|
|
1232
1239
|
const panel = panelRef.current;
|
|
1233
|
-
if (!panel) return;
|
|
1240
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
1241
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
1234
1242
|
const [firstFocusable] = focusableElements(panel);
|
|
1235
|
-
|
|
1243
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
1244
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
1236
1245
|
}, 0);
|
|
1237
1246
|
function handleKeyDown(event) {
|
|
1238
1247
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -1269,7 +1278,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1269
1278
|
unlockBody();
|
|
1270
1279
|
previouslyFocused?.focus({ preventScroll: true });
|
|
1271
1280
|
};
|
|
1272
|
-
}, [keyboard, open, panelRef]);
|
|
1281
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
1273
1282
|
}
|
|
1274
1283
|
function OverlayPortal({ children, container }) {
|
|
1275
1284
|
if (typeof document === "undefined") return null;
|
|
@@ -1290,6 +1299,7 @@ var typeIcons = {
|
|
|
1290
1299
|
};
|
|
1291
1300
|
var ModalRoot = forwardRef2(function Modal({
|
|
1292
1301
|
open,
|
|
1302
|
+
autoFocus = true,
|
|
1293
1303
|
title,
|
|
1294
1304
|
children,
|
|
1295
1305
|
footer,
|
|
@@ -1379,7 +1389,7 @@ var ModalRoot = forwardRef2(function Modal({
|
|
|
1379
1389
|
setSubmitting(false);
|
|
1380
1390
|
}
|
|
1381
1391
|
}
|
|
1382
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
1392
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
1383
1393
|
if (!rendered) return null;
|
|
1384
1394
|
const mergedStyle = {
|
|
1385
1395
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode, HTMLAttributes, CSSProperties, MouseEvent, ReactElement, ImgHTMLAttributes, InputHTMLAttributes, MouseEventHandler, AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
3
3
|
import { B as ButtonProps, b as Button } from './Button-BiL3Wjsd.js';
|
|
4
4
|
import { C as ControlSize, a as ControlStatus, I as InputPlaceholderMode } from './shared-Bx4B28Wh.js';
|
|
5
|
-
import './Select-
|
|
5
|
+
import './Select-DgZW5a7j.js';
|
|
6
6
|
|
|
7
7
|
/** 单个工具栏操作及其下拉菜单。 */
|
|
8
8
|
interface ToolbarItem {
|
|
@@ -49,7 +49,7 @@ type CardAccent = "primary" | "success" | "warning" | "error";
|
|
|
49
49
|
interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
50
50
|
/**
|
|
51
51
|
* 是否显示外边框并保留默认内部留白。false 移除外边框、选中描边、标题区左右留白及说明、悬浮操作区的内边距,正文内边距改为上下 8px、左右 0;保留背景、圆角、内部分割线和键盘焦点提示。
|
|
52
|
-
*
|
|
52
|
+
* 默认外边框混合 75% 主题边框色和 25% 表面色,以降低对比度;无边框时仍可通过 bodyStyle.padding 自定义正文内边距。
|
|
53
53
|
* @defaultValue true
|
|
54
54
|
*/
|
|
55
55
|
bordered?: boolean;
|
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode, HTMLAttributes, CSSProperties, MouseEvent, ReactElement, ImgHTMLAttributes, InputHTMLAttributes, MouseEventHandler, AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
3
3
|
import { B as ButtonProps, b as Button } from './Button-O_pNB3SQ.cjs';
|
|
4
4
|
import { C as ControlSize, a as ControlStatus, I as InputPlaceholderMode } from './shared-Bx4B28Wh.cjs';
|
|
5
|
-
import './Select-
|
|
5
|
+
import './Select-B9hlqeO5.cjs';
|
|
6
6
|
|
|
7
7
|
/** 单个工具栏操作及其下拉菜单。 */
|
|
8
8
|
interface ToolbarItem {
|
|
@@ -49,7 +49,7 @@ type CardAccent = "primary" | "success" | "warning" | "error";
|
|
|
49
49
|
interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
50
50
|
/**
|
|
51
51
|
* 是否显示外边框并保留默认内部留白。false 移除外边框、选中描边、标题区左右留白及说明、悬浮操作区的内边距,正文内边距改为上下 8px、左右 0;保留背景、圆角、内部分割线和键盘焦点提示。
|
|
52
|
-
*
|
|
52
|
+
* 默认外边框混合 75% 主题边框色和 25% 表面色,以降低对比度;无边框时仍可通过 bodyStyle.padding 自定义正文内边距。
|
|
53
53
|
* @defaultValue true
|
|
54
54
|
*/
|
|
55
55
|
bordered?: boolean;
|
package/dist/core.cjs
CHANGED
|
@@ -3121,7 +3121,14 @@ function focusableElements(container) {
|
|
|
3121
3121
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
3122
3122
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
3123
3123
|
}
|
|
3124
|
-
function
|
|
3124
|
+
function firstModalInput(panel) {
|
|
3125
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
3126
|
+
const candidates = body?.querySelectorAll(
|
|
3127
|
+
'input:not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"], [role="combobox"], .sia-picker__trigger, .sia-cascader__trigger, .sia-tree-select__trigger'
|
|
3128
|
+
);
|
|
3129
|
+
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
3130
|
+
}
|
|
3131
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
3125
3132
|
const overlayIdRef = (0, import_react16.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
3126
3133
|
const closeRef = (0, import_react16.useRef)(onRequestClose);
|
|
3127
3134
|
closeRef.current = onRequestClose;
|
|
@@ -3135,9 +3142,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
3135
3142
|
const unlockBody = lockBodyScroll();
|
|
3136
3143
|
const focusTimer = window.setTimeout(() => {
|
|
3137
3144
|
const panel = panelRef.current;
|
|
3138
|
-
if (!panel) return;
|
|
3145
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
3146
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
3139
3147
|
const [firstFocusable] = focusableElements(panel);
|
|
3140
|
-
|
|
3148
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
3149
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
3141
3150
|
}, 0);
|
|
3142
3151
|
function handleKeyDown(event) {
|
|
3143
3152
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -3174,7 +3183,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
3174
3183
|
unlockBody();
|
|
3175
3184
|
previouslyFocused?.focus({ preventScroll: true });
|
|
3176
3185
|
};
|
|
3177
|
-
}, [keyboard, open, panelRef]);
|
|
3186
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
3178
3187
|
}
|
|
3179
3188
|
function OverlayPortal({ children, container }) {
|
|
3180
3189
|
if (typeof document === "undefined") return null;
|
|
@@ -3674,6 +3683,7 @@ var typeIcons = {
|
|
|
3674
3683
|
};
|
|
3675
3684
|
var ModalRoot = (0, import_react20.forwardRef)(function Modal({
|
|
3676
3685
|
open,
|
|
3686
|
+
autoFocus = true,
|
|
3677
3687
|
title,
|
|
3678
3688
|
children,
|
|
3679
3689
|
footer,
|
|
@@ -3763,7 +3773,7 @@ var ModalRoot = (0, import_react20.forwardRef)(function Modal({
|
|
|
3763
3773
|
setSubmitting(false);
|
|
3764
3774
|
}
|
|
3765
3775
|
}
|
|
3766
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
3776
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
3767
3777
|
if (!rendered) return null;
|
|
3768
3778
|
const mergedStyle = {
|
|
3769
3779
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
package/dist/core.css
CHANGED
|
@@ -2531,7 +2531,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2531
2531
|
--sia-card-accent: var(--sia-color-primary);
|
|
2532
2532
|
color: var(--sia-color-text);
|
|
2533
2533
|
background: var(--sia-color-surface);
|
|
2534
|
-
border: 1px solid var(--sia-color-border);
|
|
2534
|
+
border: 1px solid color-mix(in srgb, var(--sia-color-border) 75%, var(--sia-color-surface));
|
|
2535
2535
|
border-radius: var(--sia-radius);
|
|
2536
2536
|
}
|
|
2537
2537
|
.sia-card__header {
|
|
@@ -2744,7 +2744,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2744
2744
|
gap: 2px;
|
|
2745
2745
|
flex: 1;
|
|
2746
2746
|
}
|
|
2747
|
-
.sia-alert__content span {
|
|
2747
|
+
.sia-alert__content > span {
|
|
2748
2748
|
color: var(--sia-color-text-secondary);
|
|
2749
2749
|
}
|
|
2750
2750
|
.sia-alert__action {
|
|
@@ -10461,7 +10461,7 @@ body > .sia-popup-portal[data-sia-popup-layer] {
|
|
|
10461
10461
|
.sia-alert__content {
|
|
10462
10462
|
flex: 1;
|
|
10463
10463
|
}
|
|
10464
|
-
.sia-alert__content strong,
|
|
10464
|
+
.sia-alert__content > strong,
|
|
10465
10465
|
.sia-alert__content > span {
|
|
10466
10466
|
display: block;
|
|
10467
10467
|
}
|
package/dist/core.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc 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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-DQ2ZROfx.cjs';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
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-
|
|
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';
|
|
5
5
|
import './shared-Bx4B28Wh.cjs';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc 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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-DCfngMfy.js';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
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-
|
|
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';
|
|
5
5
|
import './shared-Bx4B28Wh.js';
|
package/dist/core.js
CHANGED
|
@@ -11,20 +11,20 @@ import {
|
|
|
11
11
|
Typography,
|
|
12
12
|
Upload,
|
|
13
13
|
message
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WS4WYFJZ.js";
|
|
15
15
|
import "./chunk-RX242MUO.js";
|
|
16
16
|
import {
|
|
17
17
|
Select
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XDG736H7.js";
|
|
19
19
|
import {
|
|
20
20
|
Input,
|
|
21
21
|
Segmented
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IRMKZYGV.js";
|
|
23
23
|
import "./chunk-SCEHVGKV.js";
|
|
24
24
|
import {
|
|
25
25
|
Icon,
|
|
26
26
|
Modal
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-ZD45Z2NI.js";
|
|
28
28
|
import {
|
|
29
29
|
Button
|
|
30
30
|
} from "./chunk-CZ2ITBRW.js";
|
package/dist/game.cjs
CHANGED
|
@@ -2285,7 +2285,14 @@ function focusableElements(container) {
|
|
|
2285
2285
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
2286
2286
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
2287
2287
|
}
|
|
2288
|
-
function
|
|
2288
|
+
function firstModalInput(panel) {
|
|
2289
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
2290
|
+
const candidates = body?.querySelectorAll(
|
|
2291
|
+
'input:not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"], [role="combobox"], .sia-picker__trigger, .sia-cascader__trigger, .sia-tree-select__trigger'
|
|
2292
|
+
);
|
|
2293
|
+
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
2294
|
+
}
|
|
2295
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
2289
2296
|
const overlayIdRef = (0, import_react7.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
2290
2297
|
const closeRef = (0, import_react7.useRef)(onRequestClose);
|
|
2291
2298
|
closeRef.current = onRequestClose;
|
|
@@ -2299,9 +2306,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2299
2306
|
const unlockBody = lockBodyScroll();
|
|
2300
2307
|
const focusTimer = window.setTimeout(() => {
|
|
2301
2308
|
const panel = panelRef.current;
|
|
2302
|
-
if (!panel) return;
|
|
2309
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
2310
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
2303
2311
|
const [firstFocusable] = focusableElements(panel);
|
|
2304
|
-
|
|
2312
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
2313
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
2305
2314
|
}, 0);
|
|
2306
2315
|
function handleKeyDown(event) {
|
|
2307
2316
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -2338,7 +2347,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2338
2347
|
unlockBody();
|
|
2339
2348
|
previouslyFocused?.focus({ preventScroll: true });
|
|
2340
2349
|
};
|
|
2341
|
-
}, [keyboard, open, panelRef]);
|
|
2350
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
2342
2351
|
}
|
|
2343
2352
|
function OverlayPortal({ children, container }) {
|
|
2344
2353
|
if (typeof document === "undefined") return null;
|
|
@@ -2359,6 +2368,7 @@ var typeIcons = {
|
|
|
2359
2368
|
};
|
|
2360
2369
|
var ModalRoot = (0, import_react8.forwardRef)(function Modal({
|
|
2361
2370
|
open,
|
|
2371
|
+
autoFocus = true,
|
|
2362
2372
|
title,
|
|
2363
2373
|
children,
|
|
2364
2374
|
footer,
|
|
@@ -2448,7 +2458,7 @@ var ModalRoot = (0, import_react8.forwardRef)(function Modal({
|
|
|
2448
2458
|
setSubmitting(false);
|
|
2449
2459
|
}
|
|
2450
2460
|
}
|
|
2451
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
2461
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
2452
2462
|
if (!rendered) return null;
|
|
2453
2463
|
const mergedStyle = {
|
|
2454
2464
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
package/dist/game.css
CHANGED
|
@@ -2540,7 +2540,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2540
2540
|
--sia-card-accent: var(--sia-color-primary);
|
|
2541
2541
|
color: var(--sia-color-text);
|
|
2542
2542
|
background: var(--sia-color-surface);
|
|
2543
|
-
border: 1px solid var(--sia-color-border);
|
|
2543
|
+
border: 1px solid color-mix(in srgb, var(--sia-color-border) 75%, var(--sia-color-surface));
|
|
2544
2544
|
border-radius: var(--sia-radius);
|
|
2545
2545
|
}
|
|
2546
2546
|
.sia-card__header {
|
|
@@ -2753,7 +2753,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2753
2753
|
gap: 2px;
|
|
2754
2754
|
flex: 1;
|
|
2755
2755
|
}
|
|
2756
|
-
.sia-alert__content span {
|
|
2756
|
+
.sia-alert__content > span {
|
|
2757
2757
|
color: var(--sia-color-text-secondary);
|
|
2758
2758
|
}
|
|
2759
2759
|
.sia-alert__action {
|
package/dist/game.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1750,7 +1750,14 @@ function focusableElements(container) {
|
|
|
1750
1750
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
1751
1751
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
1752
1752
|
}
|
|
1753
|
-
function
|
|
1753
|
+
function firstModalInput(panel) {
|
|
1754
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
1755
|
+
const candidates = body?.querySelectorAll(
|
|
1756
|
+
'input:not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"], [role="combobox"], .sia-picker__trigger, .sia-cascader__trigger, .sia-tree-select__trigger'
|
|
1757
|
+
);
|
|
1758
|
+
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
1759
|
+
}
|
|
1760
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
1754
1761
|
const overlayIdRef = (0, import_react6.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
1755
1762
|
const closeRef = (0, import_react6.useRef)(onRequestClose);
|
|
1756
1763
|
closeRef.current = onRequestClose;
|
|
@@ -1764,9 +1771,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1764
1771
|
const unlockBody = lockBodyScroll();
|
|
1765
1772
|
const focusTimer = window.setTimeout(() => {
|
|
1766
1773
|
const panel = panelRef.current;
|
|
1767
|
-
if (!panel) return;
|
|
1774
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
1775
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
1768
1776
|
const [firstFocusable] = focusableElements(panel);
|
|
1769
|
-
|
|
1777
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
1778
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
1770
1779
|
}, 0);
|
|
1771
1780
|
function handleKeyDown(event) {
|
|
1772
1781
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -1803,7 +1812,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1803
1812
|
unlockBody();
|
|
1804
1813
|
previouslyFocused?.focus({ preventScroll: true });
|
|
1805
1814
|
};
|
|
1806
|
-
}, [keyboard, open, panelRef]);
|
|
1815
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
1807
1816
|
}
|
|
1808
1817
|
function OverlayPortal({ children, container }) {
|
|
1809
1818
|
if (typeof document === "undefined") return null;
|
|
@@ -3089,6 +3098,7 @@ var typeIcons = {
|
|
|
3089
3098
|
};
|
|
3090
3099
|
var ModalRoot = (0, import_react15.forwardRef)(function Modal({
|
|
3091
3100
|
open,
|
|
3101
|
+
autoFocus = true,
|
|
3092
3102
|
title,
|
|
3093
3103
|
children,
|
|
3094
3104
|
footer,
|
|
@@ -3178,7 +3188,7 @@ var ModalRoot = (0, import_react15.forwardRef)(function Modal({
|
|
|
3178
3188
|
setSubmitting(false);
|
|
3179
3189
|
}
|
|
3180
3190
|
}
|
|
3181
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
3191
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
3182
3192
|
if (!rendered) return null;
|
|
3183
3193
|
const mergedStyle = {
|
|
3184
3194
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
|
@@ -7296,6 +7306,21 @@ var FormStore = class {
|
|
|
7296
7306
|
});
|
|
7297
7307
|
this.notify();
|
|
7298
7308
|
};
|
|
7309
|
+
setFields = (fields) => {
|
|
7310
|
+
if (!fields.length) return;
|
|
7311
|
+
fields.forEach((field) => {
|
|
7312
|
+
const path = pathArray(field.name);
|
|
7313
|
+
if (Object.prototype.hasOwnProperty.call(field, "value")) {
|
|
7314
|
+
if (!this.initialized) this.pendingWrites.push({ path: [...path], value: cloneFormValue(field.value) });
|
|
7315
|
+
this.values = setValue(this.values, path, field.value);
|
|
7316
|
+
}
|
|
7317
|
+
if (field.errors !== void 0) {
|
|
7318
|
+
if (field.errors.length) this.errors.set(pathKey2(path), [...field.errors]);
|
|
7319
|
+
else this.errors.delete(pathKey2(path));
|
|
7320
|
+
}
|
|
7321
|
+
});
|
|
7322
|
+
this.notify();
|
|
7323
|
+
};
|
|
7299
7324
|
resetFields = (names) => {
|
|
7300
7325
|
if (!names) {
|
|
7301
7326
|
this.pendingWrites = [];
|
package/dist/index.css
CHANGED
|
@@ -2531,7 +2531,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2531
2531
|
--sia-card-accent: var(--sia-color-primary);
|
|
2532
2532
|
color: var(--sia-color-text);
|
|
2533
2533
|
background: var(--sia-color-surface);
|
|
2534
|
-
border: 1px solid var(--sia-color-border);
|
|
2534
|
+
border: 1px solid color-mix(in srgb, var(--sia-color-border) 75%, var(--sia-color-surface));
|
|
2535
2535
|
border-radius: var(--sia-radius);
|
|
2536
2536
|
}
|
|
2537
2537
|
.sia-card__header {
|
|
@@ -2744,7 +2744,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2744
2744
|
gap: 2px;
|
|
2745
2745
|
flex: 1;
|
|
2746
2746
|
}
|
|
2747
|
-
.sia-alert__content span {
|
|
2747
|
+
.sia-alert__content > span {
|
|
2748
2748
|
color: var(--sia-color-text-secondary);
|
|
2749
2749
|
}
|
|
2750
2750
|
.sia-alert__action {
|
|
@@ -10461,7 +10461,7 @@ body > .sia-popup-portal[data-sia-popup-layer] {
|
|
|
10461
10461
|
.sia-alert__content {
|
|
10462
10462
|
flex: 1;
|
|
10463
10463
|
}
|
|
10464
|
-
.sia-alert__content strong,
|
|
10464
|
+
.sia-alert__content > strong,
|
|
10465
10465
|
.sia-alert__content > span {
|
|
10466
10466
|
display: block;
|
|
10467
10467
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-DQ2ZROfx.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 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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-DQ2ZROfx.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';
|
|
8
|
-
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult } from './Select-
|
|
9
|
-
export { e as Modal, f as ModalProps, g as ModalType, h as Select, i as SelectMode, j as SelectValue } from './Select-
|
|
10
|
-
export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
8
|
+
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult } from './Select-B9hlqeO5.cjs';
|
|
9
|
+
export { e as Modal, f as ModalProps, g as ModalType, h as Select, i as SelectMode, j as SelectValue } from './Select-B9hlqeO5.cjs';
|
|
10
|
+
export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CZpQhFBu.cjs';
|
|
11
11
|
export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.cjs';
|
|
12
12
|
export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.cjs';
|
|
13
13
|
import * as Monaco from 'monaco-editor';
|
|
@@ -792,6 +792,15 @@ interface FormErrorField {
|
|
|
792
792
|
/** 字段的校验错误信息列表。 */
|
|
793
793
|
errors: readonly ReactNode[];
|
|
794
794
|
}
|
|
795
|
+
/** 外部校验或接口回填的字段更新;未提供的值、错误保持不变。 */
|
|
796
|
+
interface FormFieldData {
|
|
797
|
+
/** 字段路径,支持尚未挂载的动态字段。 */
|
|
798
|
+
name: NamePath;
|
|
799
|
+
/** 新字段值;显式传入 undefined 清空值,省略则保留当前值。 */
|
|
800
|
+
value?: unknown;
|
|
801
|
+
/** 替换该字段的全部错误;空数组清除错误,省略则保留。 */
|
|
802
|
+
errors?: readonly ReactNode[];
|
|
803
|
+
}
|
|
795
804
|
/** 表单操作实例,提供读写字段值、校验、重置和提交方法。 */
|
|
796
805
|
interface FormInstance {
|
|
797
806
|
/** 读取指定字段的当前值,支持嵌套字段路径。 */
|
|
@@ -804,6 +813,8 @@ interface FormInstance {
|
|
|
804
813
|
setFieldValue: (name: NamePath, value: unknown) => void;
|
|
805
814
|
/** 批量设置表单字段值,不触发 onValuesChange;首次挂载前回填的字段会保留并优先于 initialValues。 */
|
|
806
815
|
setFieldsValue: (values: FormValues) => void;
|
|
816
|
+
/** 批量回填字段值及外部校验错误,一次通知视图,不触发 onValuesChange;仅更新提供的成员。未挂载字段的状态在挂载后生效。 */
|
|
817
|
+
setFields: (fields: readonly FormFieldData[]) => void;
|
|
807
818
|
/** 将字段恢复到初始值,并清理相关校验状态。 */
|
|
808
819
|
resetFields: (names?: readonly NamePath[]) => void;
|
|
809
820
|
/** 执行字段校验;成功返回字段值,失败抛出校验错误信息。 */
|
|
@@ -3407,4 +3418,4 @@ interface NumberRangeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "onChan
|
|
|
3407
3418
|
/** 日期区间风格的双数字输入框,使用波浪线分隔;可直接绑定 Form.Item。 */
|
|
3408
3419
|
declare const NumberRange: react.ForwardRefExoticComponent<NumberRangeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
3409
3420
|
|
|
3410
|
-
export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, AutoSizer, type AutoSizerProps, type AutoSizerSize, BadgeProps, ButtonProps, ButtonSize, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, CursorPreview, type CursorPreviewFrame, type CursorPreviewProps, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingPanel, type FloatingPanelProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, ModalActionResult, ModalOpenConfig, type NamePath, NumberRange, type NumberRangeProps, type NumberRangeValue, OverlayApiHandle, Pagination, type PaginationProps, QueryForm, type QueryFormField, type QueryFormFieldSetting, type QueryFormProps, type QueryFormSearchInfo, type QueryFormSettingsConfig, type QueryFormSettingsSnapshot, type QueryFormShortcut, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, SelectChangeValue, type SelectModalConfig, SelectOption, SelectProps, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, type SortableKey, SortableList, type SortableListProps, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCanvasCell, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TagStatus, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, openSelectModal, useForm };
|
|
3421
|
+
export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, AutoSizer, type AutoSizerProps, type AutoSizerSize, BadgeProps, ButtonProps, ButtonSize, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, CursorPreview, type CursorPreviewFrame, type CursorPreviewProps, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingPanel, type FloatingPanelProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormFieldData, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, ModalActionResult, ModalOpenConfig, type NamePath, NumberRange, type NumberRangeProps, type NumberRangeValue, OverlayApiHandle, Pagination, type PaginationProps, QueryForm, type QueryFormField, type QueryFormFieldSetting, type QueryFormProps, type QueryFormSearchInfo, type QueryFormSettingsConfig, type QueryFormSettingsSnapshot, type QueryFormShortcut, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, SelectChangeValue, type SelectModalConfig, SelectOption, SelectProps, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, type SortableKey, SortableList, type SortableListProps, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCanvasCell, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TagStatus, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, openSelectModal, useForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-DCfngMfy.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 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 Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-DCfngMfy.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';
|
|
8
|
-
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult } from './Select-
|
|
9
|
-
export { e as Modal, f as ModalProps, g as ModalType, h as Select, i as SelectMode, j as SelectValue } from './Select-
|
|
10
|
-
export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
8
|
+
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult } from './Select-DgZW5a7j.js';
|
|
9
|
+
export { e as Modal, f as ModalProps, g as ModalType, h as Select, i as SelectMode, j as SelectValue } from './Select-DgZW5a7j.js';
|
|
10
|
+
export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-BskjBzTI.js';
|
|
11
11
|
export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.js';
|
|
12
12
|
export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.js';
|
|
13
13
|
import * as Monaco from 'monaco-editor';
|
|
@@ -792,6 +792,15 @@ interface FormErrorField {
|
|
|
792
792
|
/** 字段的校验错误信息列表。 */
|
|
793
793
|
errors: readonly ReactNode[];
|
|
794
794
|
}
|
|
795
|
+
/** 外部校验或接口回填的字段更新;未提供的值、错误保持不变。 */
|
|
796
|
+
interface FormFieldData {
|
|
797
|
+
/** 字段路径,支持尚未挂载的动态字段。 */
|
|
798
|
+
name: NamePath;
|
|
799
|
+
/** 新字段值;显式传入 undefined 清空值,省略则保留当前值。 */
|
|
800
|
+
value?: unknown;
|
|
801
|
+
/** 替换该字段的全部错误;空数组清除错误,省略则保留。 */
|
|
802
|
+
errors?: readonly ReactNode[];
|
|
803
|
+
}
|
|
795
804
|
/** 表单操作实例,提供读写字段值、校验、重置和提交方法。 */
|
|
796
805
|
interface FormInstance {
|
|
797
806
|
/** 读取指定字段的当前值,支持嵌套字段路径。 */
|
|
@@ -804,6 +813,8 @@ interface FormInstance {
|
|
|
804
813
|
setFieldValue: (name: NamePath, value: unknown) => void;
|
|
805
814
|
/** 批量设置表单字段值,不触发 onValuesChange;首次挂载前回填的字段会保留并优先于 initialValues。 */
|
|
806
815
|
setFieldsValue: (values: FormValues) => void;
|
|
816
|
+
/** 批量回填字段值及外部校验错误,一次通知视图,不触发 onValuesChange;仅更新提供的成员。未挂载字段的状态在挂载后生效。 */
|
|
817
|
+
setFields: (fields: readonly FormFieldData[]) => void;
|
|
807
818
|
/** 将字段恢复到初始值,并清理相关校验状态。 */
|
|
808
819
|
resetFields: (names?: readonly NamePath[]) => void;
|
|
809
820
|
/** 执行字段校验;成功返回字段值,失败抛出校验错误信息。 */
|
|
@@ -3407,4 +3418,4 @@ interface NumberRangeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "onChan
|
|
|
3407
3418
|
/** 日期区间风格的双数字输入框,使用波浪线分隔;可直接绑定 Form.Item。 */
|
|
3408
3419
|
declare const NumberRange: react.ForwardRefExoticComponent<NumberRangeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
3409
3420
|
|
|
3410
|
-
export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, AutoSizer, type AutoSizerProps, type AutoSizerSize, BadgeProps, ButtonProps, ButtonSize, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, CursorPreview, type CursorPreviewFrame, type CursorPreviewProps, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingPanel, type FloatingPanelProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, ModalActionResult, ModalOpenConfig, type NamePath, NumberRange, type NumberRangeProps, type NumberRangeValue, OverlayApiHandle, Pagination, type PaginationProps, QueryForm, type QueryFormField, type QueryFormFieldSetting, type QueryFormProps, type QueryFormSearchInfo, type QueryFormSettingsConfig, type QueryFormSettingsSnapshot, type QueryFormShortcut, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, SelectChangeValue, type SelectModalConfig, SelectOption, SelectProps, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, type SortableKey, SortableList, type SortableListProps, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCanvasCell, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TagStatus, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, openSelectModal, useForm };
|
|
3421
|
+
export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, AutoSizer, type AutoSizerProps, type AutoSizerSize, BadgeProps, ButtonProps, ButtonSize, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, CursorPreview, type CursorPreviewFrame, type CursorPreviewProps, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingPanel, type FloatingPanelProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormFieldData, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, ModalActionResult, ModalOpenConfig, type NamePath, NumberRange, type NumberRangeProps, type NumberRangeValue, OverlayApiHandle, Pagination, type PaginationProps, QueryForm, type QueryFormField, type QueryFormFieldSetting, type QueryFormProps, type QueryFormSearchInfo, type QueryFormSettingsConfig, type QueryFormSettingsSnapshot, type QueryFormShortcut, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, SelectChangeValue, type SelectModalConfig, SelectOption, SelectProps, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, type SortableKey, SortableList, type SortableListProps, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCanvasCell, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TagStatus, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, openSelectModal, useForm };
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
Watermark,
|
|
82
82
|
message,
|
|
83
83
|
notification
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-WS4WYFJZ.js";
|
|
85
85
|
import "./chunk-RX242MUO.js";
|
|
86
86
|
import {
|
|
87
87
|
MarkdownEditor
|
|
@@ -89,12 +89,12 @@ import {
|
|
|
89
89
|
import {
|
|
90
90
|
RichTextContent,
|
|
91
91
|
RichTextEditor
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-ODJNSVNB.js";
|
|
93
93
|
import {
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-RZR3EZRL.js";
|
|
98
98
|
import {
|
|
99
99
|
Checkbox,
|
|
100
100
|
FloatingScrollbarProvider,
|
|
@@ -106,14 +106,14 @@ import {
|
|
|
106
106
|
Tooltip,
|
|
107
107
|
Tree,
|
|
108
108
|
useScrollbarProximity
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-XDG736H7.js";
|
|
110
110
|
import {
|
|
111
111
|
Dropdown,
|
|
112
112
|
Input,
|
|
113
113
|
Menu,
|
|
114
114
|
Segmented,
|
|
115
115
|
Steps
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-IRMKZYGV.js";
|
|
117
117
|
import {
|
|
118
118
|
TextArea
|
|
119
119
|
} from "./chunk-SCEHVGKV.js";
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
Modal,
|
|
125
125
|
OverlayPortal,
|
|
126
126
|
useOverlayLifecycle
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-ZD45Z2NI.js";
|
|
128
128
|
import {
|
|
129
129
|
Button
|
|
130
130
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -1839,6 +1839,21 @@ var FormStore = class {
|
|
|
1839
1839
|
});
|
|
1840
1840
|
this.notify();
|
|
1841
1841
|
};
|
|
1842
|
+
setFields = (fields) => {
|
|
1843
|
+
if (!fields.length) return;
|
|
1844
|
+
fields.forEach((field) => {
|
|
1845
|
+
const path = pathArray(field.name);
|
|
1846
|
+
if (Object.prototype.hasOwnProperty.call(field, "value")) {
|
|
1847
|
+
if (!this.initialized) this.pendingWrites.push({ path: [...path], value: cloneFormValue(field.value) });
|
|
1848
|
+
this.values = setValue(this.values, path, field.value);
|
|
1849
|
+
}
|
|
1850
|
+
if (field.errors !== void 0) {
|
|
1851
|
+
if (field.errors.length) this.errors.set(pathKey2(path), [...field.errors]);
|
|
1852
|
+
else this.errors.delete(pathKey2(path));
|
|
1853
|
+
}
|
|
1854
|
+
});
|
|
1855
|
+
this.notify();
|
|
1856
|
+
};
|
|
1842
1857
|
resetFields = (names) => {
|
|
1843
1858
|
if (!names) {
|
|
1844
1859
|
this.pendingWrites = [];
|
|
@@ -2117,7 +2117,14 @@ function focusableElements(container) {
|
|
|
2117
2117
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
2118
2118
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2120
|
+
function firstModalInput(panel) {
|
|
2121
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
2122
|
+
const candidates = body?.querySelectorAll(
|
|
2123
|
+
'input:not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"], [role="combobox"], .sia-picker__trigger, .sia-cascader__trigger, .sia-tree-select__trigger'
|
|
2124
|
+
);
|
|
2125
|
+
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
2126
|
+
}
|
|
2127
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
2121
2128
|
const overlayIdRef = (0, import_react9.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
2122
2129
|
const closeRef = (0, import_react9.useRef)(onRequestClose);
|
|
2123
2130
|
closeRef.current = onRequestClose;
|
|
@@ -2131,9 +2138,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2131
2138
|
const unlockBody = lockBodyScroll();
|
|
2132
2139
|
const focusTimer = window.setTimeout(() => {
|
|
2133
2140
|
const panel = panelRef.current;
|
|
2134
|
-
if (!panel) return;
|
|
2141
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
2142
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
2135
2143
|
const [firstFocusable] = focusableElements(panel);
|
|
2136
|
-
|
|
2144
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
2145
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
2137
2146
|
}, 0);
|
|
2138
2147
|
function handleKeyDown(event) {
|
|
2139
2148
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -2170,7 +2179,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2170
2179
|
unlockBody();
|
|
2171
2180
|
previouslyFocused?.focus({ preventScroll: true });
|
|
2172
2181
|
};
|
|
2173
|
-
}, [keyboard, open, panelRef]);
|
|
2182
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
2174
2183
|
}
|
|
2175
2184
|
function OverlayPortal({ children, container }) {
|
|
2176
2185
|
if (typeof document === "undefined") return null;
|
|
@@ -2191,6 +2200,7 @@ var typeIcons = {
|
|
|
2191
2200
|
};
|
|
2192
2201
|
var ModalRoot = (0, import_react10.forwardRef)(function Modal({
|
|
2193
2202
|
open,
|
|
2203
|
+
autoFocus = true,
|
|
2194
2204
|
title,
|
|
2195
2205
|
children,
|
|
2196
2206
|
footer,
|
|
@@ -2280,7 +2290,7 @@ var ModalRoot = (0, import_react10.forwardRef)(function Modal({
|
|
|
2280
2290
|
setSubmitting(false);
|
|
2281
2291
|
}
|
|
2282
2292
|
}
|
|
2283
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
2293
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
2284
2294
|
if (!rendered) return null;
|
|
2285
2295
|
const mergedStyle = {
|
|
2286
2296
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
package/dist/rich-text-editor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RichTextContent,
|
|
3
3
|
RichTextEditor
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ODJNSVNB.js";
|
|
5
|
+
import "./chunk-IRMKZYGV.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ZD45Z2NI.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
9
9
|
import "./chunk-KY6A5IJH.js";
|
|
10
10
|
import "./chunk-NZMUW5XI.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
4
|
-
import { S as SelectOption, j as SelectValue } from './Select-
|
|
4
|
+
import { S as SelectOption, j as SelectValue } from './Select-DgZW5a7j.js';
|
|
5
5
|
|
|
6
6
|
/** 日期选择附带的时间选择配置。 */
|
|
7
7
|
type DatePickerShowTime = boolean | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
4
|
-
import { S as SelectOption, j as SelectValue } from './Select-
|
|
4
|
+
import { S as SelectOption, j as SelectValue } from './Select-B9hlqeO5.cjs';
|
|
5
5
|
|
|
6
6
|
/** 日期选择附带的时间选择配置。 */
|
|
7
7
|
type DatePickerShowTime = boolean | {
|
|
@@ -2858,7 +2858,14 @@ function focusableElements(container) {
|
|
|
2858
2858
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
2859
2859
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
2860
2860
|
}
|
|
2861
|
-
function
|
|
2861
|
+
function firstModalInput(panel) {
|
|
2862
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
2863
|
+
const candidates = body?.querySelectorAll(
|
|
2864
|
+
'input:not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"], [role="combobox"], .sia-picker__trigger, .sia-cascader__trigger, .sia-tree-select__trigger'
|
|
2865
|
+
);
|
|
2866
|
+
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
2867
|
+
}
|
|
2868
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
2862
2869
|
const overlayIdRef = (0, import_react10.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
2863
2870
|
const closeRef = (0, import_react10.useRef)(onRequestClose);
|
|
2864
2871
|
closeRef.current = onRequestClose;
|
|
@@ -2872,9 +2879,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2872
2879
|
const unlockBody = lockBodyScroll();
|
|
2873
2880
|
const focusTimer = window.setTimeout(() => {
|
|
2874
2881
|
const panel = panelRef.current;
|
|
2875
|
-
if (!panel) return;
|
|
2882
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
2883
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
2876
2884
|
const [firstFocusable] = focusableElements(panel);
|
|
2877
|
-
|
|
2885
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
2886
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
2878
2887
|
}, 0);
|
|
2879
2888
|
function handleKeyDown(event) {
|
|
2880
2889
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -2911,7 +2920,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
2911
2920
|
unlockBody();
|
|
2912
2921
|
previouslyFocused?.focus({ preventScroll: true });
|
|
2913
2922
|
};
|
|
2914
|
-
}, [keyboard, open, panelRef]);
|
|
2923
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
2915
2924
|
}
|
|
2916
2925
|
function OverlayPortal({ children, container }) {
|
|
2917
2926
|
if (typeof document === "undefined") return null;
|
|
@@ -2932,6 +2941,7 @@ var typeIcons = {
|
|
|
2932
2941
|
};
|
|
2933
2942
|
var ModalRoot = (0, import_react11.forwardRef)(function Modal({
|
|
2934
2943
|
open,
|
|
2944
|
+
autoFocus = true,
|
|
2935
2945
|
title,
|
|
2936
2946
|
children,
|
|
2937
2947
|
footer,
|
|
@@ -3021,7 +3031,7 @@ var ModalRoot = (0, import_react11.forwardRef)(function Modal({
|
|
|
3021
3031
|
setSubmitting(false);
|
|
3022
3032
|
}
|
|
3023
3033
|
}
|
|
3024
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
3034
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
3025
3035
|
if (!rendered) return null;
|
|
3026
3036
|
const mergedStyle = {
|
|
3027
3037
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
1
|
+
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CZpQhFBu.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './shared-Bx4B28Wh.cjs';
|
|
4
|
-
import './Select-
|
|
4
|
+
import './Select-B9hlqeO5.cjs';
|
|
5
5
|
import './Button-O_pNB3SQ.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
1
|
+
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-BskjBzTI.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './shared-Bx4B28Wh.js';
|
|
4
|
-
import './Select-
|
|
4
|
+
import './Select-DgZW5a7j.js';
|
|
5
5
|
import './Button-BiL3Wjsd.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectDateRange
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-RZR3EZRL.js";
|
|
4
|
+
import "./chunk-XDG736H7.js";
|
|
5
|
+
import "./chunk-IRMKZYGV.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ZD45Z2NI.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
9
9
|
import "./chunk-KY6A5IJH.js";
|
|
10
10
|
import "./chunk-NZMUW5XI.js";
|