@sia.soul/sia-react-ui 0.1.119 → 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/{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-UW2W7RYZ.js} +81 -11
- package/dist/{chunk-BQIARYZB.js → chunk-XDG736H7.js} +2 -2
- package/dist/{chunk-6MGFX7B2.js → chunk-ZD45Z2NI.js} +15 -5
- package/dist/{core-bcMvT7pl.d.cts → core-C2V9aLTP.d.cts} +16 -3
- package/dist/{core-CA0gNAug.d.ts → core-DUjadxCD.d.ts} +16 -3
- package/dist/core.cjs +38 -6
- package/dist/core.css +9 -2
- 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 +1 -1
- package/dist/game.js +1 -1
- package/dist/index.cjs +106 -9
- package/dist/index.css +9 -2
- package/dist/index.d.cts +20 -7
- package/dist/index.d.ts +20 -7
- package/dist/index.js +25 -7
- 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
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-UW2W7RYZ.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
package/dist/game.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,
|
|
@@ -1750,7 +1751,14 @@ function focusableElements(container) {
|
|
|
1750
1751
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
1751
1752
|
)].filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
1752
1753
|
}
|
|
1753
|
-
function
|
|
1754
|
+
function firstModalInput(panel) {
|
|
1755
|
+
const body = panel.querySelector(":scope > .sia-modal__body");
|
|
1756
|
+
const candidates = body?.querySelectorAll(
|
|
1757
|
+
'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'
|
|
1758
|
+
);
|
|
1759
|
+
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");
|
|
1760
|
+
}
|
|
1761
|
+
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false) {
|
|
1754
1762
|
const overlayIdRef = (0, import_react6.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
1755
1763
|
const closeRef = (0, import_react6.useRef)(onRequestClose);
|
|
1756
1764
|
closeRef.current = onRequestClose;
|
|
@@ -1764,9 +1772,11 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1764
1772
|
const unlockBody = lockBodyScroll();
|
|
1765
1773
|
const focusTimer = window.setTimeout(() => {
|
|
1766
1774
|
const panel = panelRef.current;
|
|
1767
|
-
if (!panel) return;
|
|
1775
|
+
if (!panel || overlayStack.at(-1) !== overlayId) return;
|
|
1776
|
+
if (panel.contains(document.activeElement) && document.activeElement !== panel) return;
|
|
1768
1777
|
const [firstFocusable] = focusableElements(panel);
|
|
1769
|
-
|
|
1778
|
+
const input = autoFocusInput ? firstModalInput(panel) : void 0;
|
|
1779
|
+
(input ?? firstFocusable ?? panel).focus({ preventScroll: true });
|
|
1770
1780
|
}, 0);
|
|
1771
1781
|
function handleKeyDown(event) {
|
|
1772
1782
|
if (overlayStack.at(-1) !== overlayId) return;
|
|
@@ -1803,7 +1813,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true) {
|
|
|
1803
1813
|
unlockBody();
|
|
1804
1814
|
previouslyFocused?.focus({ preventScroll: true });
|
|
1805
1815
|
};
|
|
1806
|
-
}, [keyboard, open, panelRef]);
|
|
1816
|
+
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
1807
1817
|
}
|
|
1808
1818
|
function OverlayPortal({ children, container }) {
|
|
1809
1819
|
if (typeof document === "undefined") return null;
|
|
@@ -2024,7 +2034,7 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
|
|
|
2024
2034
|
] }, item.key);
|
|
2025
2035
|
}) });
|
|
2026
2036
|
}
|
|
2027
|
-
function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
2037
|
+
function ImagePreview({ open, src, alt = "", onOpenChange, current = 0, count = 1, onCurrentChange }) {
|
|
2028
2038
|
const previewRef = (0, import_react7.useRef)(null);
|
|
2029
2039
|
const stageRef = (0, import_react7.useRef)(null);
|
|
2030
2040
|
const [natural, setNatural] = (0, import_react7.useState)({ src: "", width: 0, height: 0 });
|
|
@@ -2047,6 +2057,18 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
2047
2057
|
reset();
|
|
2048
2058
|
setFailed(false);
|
|
2049
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]);
|
|
2050
2072
|
(0, import_react7.useEffect)(() => {
|
|
2051
2073
|
const stage = stageRef.current;
|
|
2052
2074
|
if (!open || !stage) return;
|
|
@@ -2103,6 +2125,15 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
2103
2125
|
src
|
|
2104
2126
|
) }),
|
|
2105
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,
|
|
2106
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 }) }),
|
|
2107
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 }) }),
|
|
2108
2139
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "text", title: "\u5411\u5DE6\u65CB\u8F6C", "aria-label": "\u5411\u5DE6\u65CB\u8F6C", disabled: !ready, onClick: () => {
|
|
@@ -2120,6 +2151,46 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
|
2120
2151
|
] })
|
|
2121
2152
|
] }), document.body);
|
|
2122
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
|
+
}
|
|
2123
2194
|
function Image2({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onLoad, onError, style, ...props }) {
|
|
2124
2195
|
const config = typeof preview === "object" ? preview : {};
|
|
2125
2196
|
const controlled = typeof preview === "object" && preview.open !== void 0;
|
|
@@ -2128,16 +2199,24 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
|
|
|
2128
2199
|
const [loaded, setLoaded] = (0, import_react7.useState)(false);
|
|
2129
2200
|
const [failed, setFailed] = (0, import_react7.useState)(false);
|
|
2130
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]);
|
|
2131
2209
|
const radius = typeof style?.borderRadius === "number" ? `${style.borderRadius}px` : style?.borderRadius;
|
|
2132
2210
|
const rootStyle = {
|
|
2133
2211
|
...style,
|
|
2134
2212
|
"--sia-image-radius": radius ?? "var(--sia-radius)"
|
|
2135
2213
|
};
|
|
2136
2214
|
function setOpen(next) {
|
|
2137
|
-
if (
|
|
2215
|
+
if (grouped && next) group?.open(groupId);
|
|
2216
|
+
else if (!controlled) setInternalOpen(next);
|
|
2138
2217
|
config.onOpenChange?.(next);
|
|
2139
2218
|
}
|
|
2140
|
-
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: [
|
|
2141
2220
|
!loaded && placeholder ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sia-image__placeholder", children: placeholder }) : null,
|
|
2142
2221
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { ...withTitleTooltip(props), src: displaySrc, alt, className, onLoad: (event) => {
|
|
2143
2222
|
setLoaded(true);
|
|
@@ -3089,6 +3168,7 @@ var typeIcons = {
|
|
|
3089
3168
|
};
|
|
3090
3169
|
var ModalRoot = (0, import_react15.forwardRef)(function Modal({
|
|
3091
3170
|
open,
|
|
3171
|
+
autoFocus = true,
|
|
3092
3172
|
title,
|
|
3093
3173
|
children,
|
|
3094
3174
|
footer,
|
|
@@ -3178,7 +3258,7 @@ var ModalRoot = (0, import_react15.forwardRef)(function Modal({
|
|
|
3178
3258
|
setSubmitting(false);
|
|
3179
3259
|
}
|
|
3180
3260
|
}
|
|
3181
|
-
useOverlayLifecycle(rendered, localRef, requestClose, keyboard);
|
|
3261
|
+
useOverlayLifecycle(rendered, localRef, requestClose, keyboard, autoFocus);
|
|
3182
3262
|
if (!rendered) return null;
|
|
3183
3263
|
const mergedStyle = {
|
|
3184
3264
|
...height !== void 0 ? { display: "flex", flexDirection: "column", height, maxHeight: "calc(100dvh - 48px)" } : {},
|
|
@@ -7296,6 +7376,21 @@ var FormStore = class {
|
|
|
7296
7376
|
});
|
|
7297
7377
|
this.notify();
|
|
7298
7378
|
};
|
|
7379
|
+
setFields = (fields) => {
|
|
7380
|
+
if (!fields.length) return;
|
|
7381
|
+
fields.forEach((field) => {
|
|
7382
|
+
const path = pathArray(field.name);
|
|
7383
|
+
if (Object.prototype.hasOwnProperty.call(field, "value")) {
|
|
7384
|
+
if (!this.initialized) this.pendingWrites.push({ path: [...path], value: cloneFormValue(field.value) });
|
|
7385
|
+
this.values = setValue(this.values, path, field.value);
|
|
7386
|
+
}
|
|
7387
|
+
if (field.errors !== void 0) {
|
|
7388
|
+
if (field.errors.length) this.errors.set(pathKey2(path), [...field.errors]);
|
|
7389
|
+
else this.errors.delete(pathKey2(path));
|
|
7390
|
+
}
|
|
7391
|
+
});
|
|
7392
|
+
this.notify();
|
|
7393
|
+
};
|
|
7299
7394
|
resetFields = (names) => {
|
|
7300
7395
|
if (!names) {
|
|
7301
7396
|
this.pendingWrites = [];
|
|
@@ -7382,6 +7477,7 @@ function useForm(form) {
|
|
|
7382
7477
|
return [ref.current];
|
|
7383
7478
|
}
|
|
7384
7479
|
function FormRoot({
|
|
7480
|
+
fill = false,
|
|
7385
7481
|
form,
|
|
7386
7482
|
initialValues,
|
|
7387
7483
|
layout = "horizontal",
|
|
@@ -7448,7 +7544,7 @@ function FormRoot({
|
|
|
7448
7544
|
{
|
|
7449
7545
|
ref: formRef,
|
|
7450
7546
|
...withTitleTooltip(props),
|
|
7451
|
-
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(),
|
|
7452
7548
|
"data-required-mark": requiredMark,
|
|
7453
7549
|
onSubmit: (event) => {
|
|
7454
7550
|
event.preventDefault();
|
|
@@ -25722,6 +25818,7 @@ function Result({ status = "info", title, subTitle, icon, extra, children, class
|
|
|
25722
25818
|
Icon,
|
|
25723
25819
|
Image,
|
|
25724
25820
|
ImagePreview,
|
|
25821
|
+
ImagePreviewGroup,
|
|
25725
25822
|
Input,
|
|
25726
25823
|
InputNumber,
|
|
25727
25824
|
InputSelect,
|
package/dist/index.css
CHANGED
|
@@ -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 {
|
|
@@ -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);
|
|
@@ -10461,7 +10468,7 @@ body > .sia-popup-portal[data-sia-popup-layer] {
|
|
|
10461
10468
|
.sia-alert__content {
|
|
10462
10469
|
flex: 1;
|
|
10463
10470
|
}
|
|
10464
|
-
.sia-alert__content strong,
|
|
10471
|
+
.sia-alert__content > strong,
|
|
10465
10472
|
.sia-alert__content > span {
|
|
10466
10473
|
display: block;
|
|
10467
10474
|
}
|
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
|
|
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';
|
|
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
|
/** 执行字段校验;成功返回字段值,失败抛出校验错误信息。 */
|
|
@@ -817,6 +828,8 @@ interface FormInstance {
|
|
|
817
828
|
declare function useForm(form?: FormInstance): readonly [FormInstance];
|
|
818
829
|
/** 表单的属性配置。 */
|
|
819
830
|
interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"> {
|
|
831
|
+
/** 是否作为纵向弹性容器填满父容器剩余高度;父容器需提供确定高度,子列表可用 flex 分配剩余空间。默认 false。 */
|
|
832
|
+
fill?: boolean;
|
|
820
833
|
/** 组件尺寸;用于调整控件高度、字号和间距。 */
|
|
821
834
|
size?: ControlSize;
|
|
822
835
|
/** 表单实例;可由 Form.useForm() 或 useForm() 创建。 */
|
|
@@ -852,7 +865,7 @@ interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"
|
|
|
852
865
|
/** 字段通过表单控件交互更新时调用,接收本次变化字段和完整值;用于联动查询条件等业务逻辑。 */
|
|
853
866
|
onValuesChange?: (changedValues: FormValues, values: FormValues) => void;
|
|
854
867
|
}
|
|
855
|
-
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;
|
|
856
869
|
/** 表单项的字段绑定、标签、校验及内容配置;默认保留 8px 下外边距,noStyle 不生成布局容器或间距。 */
|
|
857
870
|
interface FormItemProps {
|
|
858
871
|
/** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
|
|
@@ -3407,4 +3420,4 @@ interface NumberRangeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "onChan
|
|
|
3407
3420
|
/** 日期区间风格的双数字输入框,使用波浪线分隔;可直接绑定 Form.Item。 */
|
|
3408
3421
|
declare const NumberRange: react.ForwardRefExoticComponent<NumberRangeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
3409
3422
|
|
|
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 };
|
|
3423
|
+
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
|
|
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';
|
|
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
|
/** 执行字段校验;成功返回字段值,失败抛出校验错误信息。 */
|
|
@@ -817,6 +828,8 @@ interface FormInstance {
|
|
|
817
828
|
declare function useForm(form?: FormInstance): readonly [FormInstance];
|
|
818
829
|
/** 表单的属性配置。 */
|
|
819
830
|
interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"> {
|
|
831
|
+
/** 是否作为纵向弹性容器填满父容器剩余高度;父容器需提供确定高度,子列表可用 flex 分配剩余空间。默认 false。 */
|
|
832
|
+
fill?: boolean;
|
|
820
833
|
/** 组件尺寸;用于调整控件高度、字号和间距。 */
|
|
821
834
|
size?: ControlSize;
|
|
822
835
|
/** 表单实例;可由 Form.useForm() 或 useForm() 创建。 */
|
|
@@ -852,7 +865,7 @@ interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"
|
|
|
852
865
|
/** 字段通过表单控件交互更新时调用,接收本次变化字段和完整值;用于联动查询条件等业务逻辑。 */
|
|
853
866
|
onValuesChange?: (changedValues: FormValues, values: FormValues) => void;
|
|
854
867
|
}
|
|
855
|
-
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;
|
|
856
869
|
/** 表单项的字段绑定、标签、校验及内容配置;默认保留 8px 下外边距,noStyle 不生成布局容器或间距。 */
|
|
857
870
|
interface FormItemProps {
|
|
858
871
|
/** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
|
|
@@ -3407,4 +3420,4 @@ interface NumberRangeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "onChan
|
|
|
3407
3420
|
/** 日期区间风格的双数字输入框,使用波浪线分隔;可直接绑定 Form.Item。 */
|
|
3408
3421
|
declare const NumberRange: react.ForwardRefExoticComponent<NumberRangeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
3409
3422
|
|
|
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 };
|
|
3423
|
+
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 };
|