@sia.soul/sia-react-ui 0.1.110 → 0.1.112
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/{core-lGT-8jSj.d.cts → core-CmVKw5q8.d.cts} +2 -2
- package/dist/{core-gI4QB_Nz.d.ts → core-ypvUN1on.d.ts} +2 -2
- package/dist/core.css +13 -2
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/game.css +12 -1
- package/dist/index.cjs +57 -54
- package/dist/index.css +13 -2
- package/dist/index.d.cts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +57 -54
- package/package.json +1 -1
|
@@ -53,14 +53,14 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
53
53
|
* @defaultValue true
|
|
54
54
|
*/
|
|
55
55
|
bordered?: boolean;
|
|
56
|
-
/** 标题内容,可传入文本或 React
|
|
56
|
+
/** 标题内容,可传入文本或 React 节点;标题分割线在浅色主题下减淡,深色主题下保留边框对比度,卡片收起时隐藏。可通过 --sia-card-header-border-color 覆盖颜色。 */
|
|
57
57
|
title?: ReactNode;
|
|
58
58
|
/** 补充说明内容。 */
|
|
59
59
|
description?: ReactNode;
|
|
60
60
|
/** 主体之外的补充内容或操作区。 */
|
|
61
61
|
extra?: ReactNode;
|
|
62
62
|
/**
|
|
63
|
-
* 点击卡片非交互区域切换选中,支持 Enter
|
|
63
|
+
* 点击卡片非交互区域切换选中,支持 Enter 和空格键;选中时显示主题色浅背景及右上角三角勾选标记。
|
|
64
64
|
* @defaultValue false
|
|
65
65
|
*/
|
|
66
66
|
selectable?: boolean;
|
|
@@ -53,14 +53,14 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
53
53
|
* @defaultValue true
|
|
54
54
|
*/
|
|
55
55
|
bordered?: boolean;
|
|
56
|
-
/** 标题内容,可传入文本或 React
|
|
56
|
+
/** 标题内容,可传入文本或 React 节点;标题分割线在浅色主题下减淡,深色主题下保留边框对比度,卡片收起时隐藏。可通过 --sia-card-header-border-color 覆盖颜色。 */
|
|
57
57
|
title?: ReactNode;
|
|
58
58
|
/** 补充说明内容。 */
|
|
59
59
|
description?: ReactNode;
|
|
60
60
|
/** 主体之外的补充内容或操作区。 */
|
|
61
61
|
extra?: ReactNode;
|
|
62
62
|
/**
|
|
63
|
-
* 点击卡片非交互区域切换选中,支持 Enter
|
|
63
|
+
* 点击卡片非交互区域切换选中,支持 Enter 和空格键;选中时显示主题色浅背景及右上角三角勾选标记。
|
|
64
64
|
* @defaultValue false
|
|
65
65
|
*/
|
|
66
66
|
selectable?: boolean;
|
package/dist/core.css
CHANGED
|
@@ -414,6 +414,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
414
414
|
--sia-color-background: #f5f7fa;
|
|
415
415
|
--sia-color-surface: #ffffff;
|
|
416
416
|
--sia-color-border: #d9d9d9;
|
|
417
|
+
--sia-card-header-border-color: color-mix(in srgb, var(--sia-color-border) 40%, var(--sia-color-surface));
|
|
417
418
|
--sia-color-control-hover: #fafafa;
|
|
418
419
|
--sia-color-control-active: #f0f0f0;
|
|
419
420
|
--sia-color-focus-ring: rgb(22 119 255 / 22%);
|
|
@@ -449,6 +450,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
449
450
|
--sia-color-background: #141414;
|
|
450
451
|
--sia-color-surface: #1f1f1f;
|
|
451
452
|
--sia-color-border: #424242;
|
|
453
|
+
--sia-card-header-border-color: var(--sia-color-border);
|
|
452
454
|
--sia-color-control-hover: #2d2d2d;
|
|
453
455
|
--sia-color-control-active: #383838;
|
|
454
456
|
--sia-color-focus-ring: rgb(60 135 230 / 28%);
|
|
@@ -2527,7 +2529,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2527
2529
|
gap: 16px;
|
|
2528
2530
|
min-height: 40px;
|
|
2529
2531
|
margin-inline: 16px;
|
|
2530
|
-
border-bottom: 1px solid var(--sia-
|
|
2532
|
+
border-bottom: 1px solid var(--sia-card-header-border-color);
|
|
2531
2533
|
}
|
|
2532
2534
|
.sia-card__heading {
|
|
2533
2535
|
display: flex;
|
|
@@ -2648,6 +2650,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2648
2650
|
cursor: default;
|
|
2649
2651
|
}
|
|
2650
2652
|
.sia-card.sia-card--selected {
|
|
2653
|
+
background: color-mix(in srgb, var(--sia-color-primary) 10%, var(--sia-color-surface));
|
|
2651
2654
|
border-color: var(--sia-color-primary);
|
|
2652
2655
|
box-shadow: inset 0 0 0 1px var(--sia-color-primary);
|
|
2653
2656
|
}
|
|
@@ -5553,6 +5556,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
5553
5556
|
cursor: not-allowed;
|
|
5554
5557
|
opacity: .5;
|
|
5555
5558
|
}
|
|
5559
|
+
.sia-sortable-list__handle--custom {
|
|
5560
|
+
justify-content: flex-start;
|
|
5561
|
+
padding: 0;
|
|
5562
|
+
font: inherit;
|
|
5563
|
+
color: inherit;
|
|
5564
|
+
background: transparent;
|
|
5565
|
+
text-align: start;
|
|
5566
|
+
}
|
|
5556
5567
|
.sia-sortable-list__item.is-drop-before::before,
|
|
5557
5568
|
.sia-sortable-list__item.is-drop-after::after {
|
|
5558
5569
|
content: "";
|
|
@@ -8002,7 +8013,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8002
8013
|
display: grid;
|
|
8003
8014
|
grid-template-columns: var(--sia-form-label-width, var(--sia-form-auto-label-width, 0px)) minmax(0, 1fr);
|
|
8004
8015
|
gap: 8px 14px;
|
|
8005
|
-
margin-bottom:
|
|
8016
|
+
margin-bottom: 8px;
|
|
8006
8017
|
color: var(--sia-color-text);
|
|
8007
8018
|
}
|
|
8008
8019
|
.sia-form-item__label-content {
|
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as 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-CmVKw5q8.cjs';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-Cf0xz1Tg.cjs';
|
|
4
4
|
import 'react';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, 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-ypvUN1on.js';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-BddM4uXC.js';
|
|
4
4
|
import 'react';
|
package/dist/game.css
CHANGED
|
@@ -423,6 +423,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
423
423
|
--sia-color-background: #f5f7fa;
|
|
424
424
|
--sia-color-surface: #ffffff;
|
|
425
425
|
--sia-color-border: #d9d9d9;
|
|
426
|
+
--sia-card-header-border-color: color-mix(in srgb, var(--sia-color-border) 40%, var(--sia-color-surface));
|
|
426
427
|
--sia-color-control-hover: #fafafa;
|
|
427
428
|
--sia-color-control-active: #f0f0f0;
|
|
428
429
|
--sia-color-focus-ring: rgb(22 119 255 / 22%);
|
|
@@ -458,6 +459,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
458
459
|
--sia-color-background: #141414;
|
|
459
460
|
--sia-color-surface: #1f1f1f;
|
|
460
461
|
--sia-color-border: #424242;
|
|
462
|
+
--sia-card-header-border-color: var(--sia-color-border);
|
|
461
463
|
--sia-color-control-hover: #2d2d2d;
|
|
462
464
|
--sia-color-control-active: #383838;
|
|
463
465
|
--sia-color-focus-ring: rgb(60 135 230 / 28%);
|
|
@@ -2536,7 +2538,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2536
2538
|
gap: 16px;
|
|
2537
2539
|
min-height: 40px;
|
|
2538
2540
|
margin-inline: 16px;
|
|
2539
|
-
border-bottom: 1px solid var(--sia-
|
|
2541
|
+
border-bottom: 1px solid var(--sia-card-header-border-color);
|
|
2540
2542
|
}
|
|
2541
2543
|
.sia-card__heading {
|
|
2542
2544
|
display: flex;
|
|
@@ -2657,6 +2659,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2657
2659
|
cursor: default;
|
|
2658
2660
|
}
|
|
2659
2661
|
.sia-card.sia-card--selected {
|
|
2662
|
+
background: color-mix(in srgb, var(--sia-color-primary) 10%, var(--sia-color-surface));
|
|
2660
2663
|
border-color: var(--sia-color-primary);
|
|
2661
2664
|
box-shadow: inset 0 0 0 1px var(--sia-color-primary);
|
|
2662
2665
|
}
|
|
@@ -5562,6 +5565,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
5562
5565
|
cursor: not-allowed;
|
|
5563
5566
|
opacity: .5;
|
|
5564
5567
|
}
|
|
5568
|
+
.sia-sortable-list__handle--custom {
|
|
5569
|
+
justify-content: flex-start;
|
|
5570
|
+
padding: 0;
|
|
5571
|
+
font: inherit;
|
|
5572
|
+
color: inherit;
|
|
5573
|
+
background: transparent;
|
|
5574
|
+
text-align: start;
|
|
5575
|
+
}
|
|
5565
5576
|
.sia-sortable-list__item.is-drop-before::before,
|
|
5566
5577
|
.sia-sortable-list__item.is-drop-after::after {
|
|
5567
5578
|
content: "";
|
package/dist/index.cjs
CHANGED
|
@@ -2127,7 +2127,7 @@ function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
|
2127
2127
|
children
|
|
2128
2128
|
] }), document.body);
|
|
2129
2129
|
}
|
|
2130
|
-
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false }) {
|
|
2130
|
+
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false, handlePlacement = "before", handleContent }) {
|
|
2131
2131
|
const [dragging, setDragging] = (0, import_react9.useState)(null);
|
|
2132
2132
|
const [target, setTarget] = (0, import_react9.useState)(null);
|
|
2133
2133
|
const clear = () => {
|
|
@@ -2149,60 +2149,63 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
2149
2149
|
}, [disabled, dragging, items]);
|
|
2150
2150
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", onDragLeave: (event) => {
|
|
2151
2151
|
if (!event.currentTarget.contains(event.relatedTarget)) setTarget(null);
|
|
2152
|
-
}, children: items.map((key, index) =>
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
event.preventDefault();
|
|
2167
|
-
if (target !== null) move(dragging, target);
|
|
2168
|
-
clear();
|
|
2169
|
-
},
|
|
2170
|
-
children: [
|
|
2171
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2172
|
-
"button",
|
|
2173
|
-
{
|
|
2174
|
-
type: "button",
|
|
2175
|
-
className: "sia-sortable-list__handle",
|
|
2176
|
-
draggable: !disabled,
|
|
2177
|
-
disabled,
|
|
2178
|
-
"aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
|
|
2179
|
-
title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
|
|
2180
|
-
onDragStart: (event) => {
|
|
2181
|
-
if (disabled) {
|
|
2182
|
-
event.preventDefault();
|
|
2183
|
-
return;
|
|
2184
|
-
}
|
|
2185
|
-
setDragging(key);
|
|
2186
|
-
event.dataTransfer.effectAllowed = "move";
|
|
2187
|
-
event.dataTransfer.setData("text/plain", String(key));
|
|
2188
|
-
},
|
|
2189
|
-
onDragEnd: clear,
|
|
2190
|
-
onKeyDown: (event) => {
|
|
2191
|
-
const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
2192
|
-
const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
2193
|
-
if (event.key === previous || event.key === next) {
|
|
2194
|
-
event.preventDefault();
|
|
2195
|
-
move(key, event.key === previous ? index - 1 : index + 2);
|
|
2196
|
-
}
|
|
2197
|
-
},
|
|
2198
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "menu", size: 16 })
|
|
2152
|
+
}, children: items.map((key, index) => {
|
|
2153
|
+
const handle = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2154
|
+
"button",
|
|
2155
|
+
{
|
|
2156
|
+
type: "button",
|
|
2157
|
+
className: `sia-sortable-list__handle${handlePlacement === "custom" ? " sia-sortable-list__handle--custom" : ""}`,
|
|
2158
|
+
draggable: !disabled,
|
|
2159
|
+
disabled,
|
|
2160
|
+
"aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
|
|
2161
|
+
title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
|
|
2162
|
+
onDragStart: (event) => {
|
|
2163
|
+
if (disabled) {
|
|
2164
|
+
event.preventDefault();
|
|
2165
|
+
return;
|
|
2199
2166
|
}
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2167
|
+
setDragging(key);
|
|
2168
|
+
event.dataTransfer.effectAllowed = "move";
|
|
2169
|
+
event.dataTransfer.setData("text/plain", String(key));
|
|
2170
|
+
},
|
|
2171
|
+
onDragEnd: clear,
|
|
2172
|
+
onKeyDown: (event) => {
|
|
2173
|
+
const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
2174
|
+
const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
2175
|
+
if (event.key === previous || event.key === next) {
|
|
2176
|
+
event.preventDefault();
|
|
2177
|
+
move(key, event.key === previous ? index - 1 : index + 2);
|
|
2178
|
+
}
|
|
2179
|
+
},
|
|
2180
|
+
children: handleContent ? handleContent(key, index) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "menu", size: 16 })
|
|
2181
|
+
}
|
|
2182
|
+
);
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2184
|
+
"div",
|
|
2185
|
+
{
|
|
2186
|
+
role: "listitem",
|
|
2187
|
+
className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
|
|
2188
|
+
onDragOver: (event) => {
|
|
2189
|
+
if (disabled || dragging === null) return;
|
|
2190
|
+
event.preventDefault();
|
|
2191
|
+
event.dataTransfer.dropEffect = "move";
|
|
2192
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
2193
|
+
setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
|
|
2194
|
+
},
|
|
2195
|
+
onDrop: (event) => {
|
|
2196
|
+
if (dragging === null || disabled) return;
|
|
2197
|
+
event.preventDefault();
|
|
2198
|
+
if (target !== null) move(dragging, target);
|
|
2199
|
+
clear();
|
|
2200
|
+
},
|
|
2201
|
+
children: [
|
|
2202
|
+
handlePlacement === "before" ? handle : null,
|
|
2203
|
+
renderItem(key, index, handle)
|
|
2204
|
+
]
|
|
2205
|
+
},
|
|
2206
|
+
key
|
|
2207
|
+
);
|
|
2208
|
+
}) });
|
|
2206
2209
|
}
|
|
2207
2210
|
|
|
2208
2211
|
// src/components/Toolbar.tsx
|
package/dist/index.css
CHANGED
|
@@ -414,6 +414,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
414
414
|
--sia-color-background: #f5f7fa;
|
|
415
415
|
--sia-color-surface: #ffffff;
|
|
416
416
|
--sia-color-border: #d9d9d9;
|
|
417
|
+
--sia-card-header-border-color: color-mix(in srgb, var(--sia-color-border) 40%, var(--sia-color-surface));
|
|
417
418
|
--sia-color-control-hover: #fafafa;
|
|
418
419
|
--sia-color-control-active: #f0f0f0;
|
|
419
420
|
--sia-color-focus-ring: rgb(22 119 255 / 22%);
|
|
@@ -449,6 +450,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
449
450
|
--sia-color-background: #141414;
|
|
450
451
|
--sia-color-surface: #1f1f1f;
|
|
451
452
|
--sia-color-border: #424242;
|
|
453
|
+
--sia-card-header-border-color: var(--sia-color-border);
|
|
452
454
|
--sia-color-control-hover: #2d2d2d;
|
|
453
455
|
--sia-color-control-active: #383838;
|
|
454
456
|
--sia-color-focus-ring: rgb(60 135 230 / 28%);
|
|
@@ -2527,7 +2529,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2527
2529
|
gap: 16px;
|
|
2528
2530
|
min-height: 40px;
|
|
2529
2531
|
margin-inline: 16px;
|
|
2530
|
-
border-bottom: 1px solid var(--sia-
|
|
2532
|
+
border-bottom: 1px solid var(--sia-card-header-border-color);
|
|
2531
2533
|
}
|
|
2532
2534
|
.sia-card__heading {
|
|
2533
2535
|
display: flex;
|
|
@@ -2648,6 +2650,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2648
2650
|
cursor: default;
|
|
2649
2651
|
}
|
|
2650
2652
|
.sia-card.sia-card--selected {
|
|
2653
|
+
background: color-mix(in srgb, var(--sia-color-primary) 10%, var(--sia-color-surface));
|
|
2651
2654
|
border-color: var(--sia-color-primary);
|
|
2652
2655
|
box-shadow: inset 0 0 0 1px var(--sia-color-primary);
|
|
2653
2656
|
}
|
|
@@ -5553,6 +5556,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
5553
5556
|
cursor: not-allowed;
|
|
5554
5557
|
opacity: .5;
|
|
5555
5558
|
}
|
|
5559
|
+
.sia-sortable-list__handle--custom {
|
|
5560
|
+
justify-content: flex-start;
|
|
5561
|
+
padding: 0;
|
|
5562
|
+
font: inherit;
|
|
5563
|
+
color: inherit;
|
|
5564
|
+
background: transparent;
|
|
5565
|
+
text-align: start;
|
|
5566
|
+
}
|
|
5556
5567
|
.sia-sortable-list__item.is-drop-before::before,
|
|
5557
5568
|
.sia-sortable-list__item.is-drop-after::after {
|
|
5558
5569
|
content: "";
|
|
@@ -8002,7 +8013,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
8002
8013
|
display: grid;
|
|
8003
8014
|
grid-template-columns: var(--sia-form-label-width, var(--sia-form-auto-label-width, 0px)) minmax(0, 1fr);
|
|
8004
8015
|
gap: 8px 14px;
|
|
8005
|
-
margin-bottom:
|
|
8016
|
+
margin-bottom: 8px;
|
|
8006
8017
|
color: var(--sia-color-text);
|
|
8007
8018
|
}
|
|
8008
8019
|
.sia-form-item__label-content {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as 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-CmVKw5q8.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-CmVKw5q8.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';
|
|
@@ -78,8 +78,12 @@ type SortableKey = string | number;
|
|
|
78
78
|
interface SortableListProps {
|
|
79
79
|
/** 按当前顺序排列的唯一稳定标识,不允许重复。 */
|
|
80
80
|
items: readonly SortableKey[];
|
|
81
|
-
/**
|
|
82
|
-
renderItem: (key: SortableKey, index: number) => ReactNode;
|
|
81
|
+
/** 根据标识渲染条目内容;第三个参数为框架手柄,handlePlacement="custom" 时须将其放入标题等位置;拖动和键盘排序仅由该手柄发起。 */
|
|
82
|
+
renderItem: (key: SortableKey, index: number, handle: ReactNode) => ReactNode;
|
|
83
|
+
/** 手柄位置;before 在条目前独占一行,custom 由 renderItem 放置框架提供的手柄。@defaultValue "before" */
|
|
84
|
+
handlePlacement?: "before" | "custom";
|
|
85
|
+
/** 手柄的内容,接收稳定标识和当前位置;未指定时显示拖动图标,可返回卡片标题文字。 */
|
|
86
|
+
handleContent?: (key: SortableKey, index: number) => ReactNode;
|
|
83
87
|
/** 拖放或手柄方向键完成移动时返回新顺序;无变化、取消、禁用时不触发。 */
|
|
84
88
|
onOrderChange: (items: SortableKey[]) => void;
|
|
85
89
|
/** 排列方向;横向内容超出时在列表内滚动。@defaultValue "horizontal" */
|
|
@@ -88,7 +92,7 @@ interface SortableListProps {
|
|
|
88
92
|
disabled?: boolean;
|
|
89
93
|
}
|
|
90
94
|
/** 拖放与键盘共用受控顺序,输入控件无需参与拖动事件。 */
|
|
91
|
-
declare function SortableList({ items, renderItem, onOrderChange, direction, disabled }: SortableListProps): react.JSX.Element;
|
|
95
|
+
declare function SortableList({ items, renderItem, onOrderChange, direction, disabled, handlePlacement, handleContent }: SortableListProps): react.JSX.Element;
|
|
92
96
|
|
|
93
97
|
/** 警告提示的状态类型。 */
|
|
94
98
|
type AlertStatus = "info" | "success" | "warning" | "error";
|
|
@@ -845,7 +849,7 @@ interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"
|
|
|
845
849
|
onValuesChange?: (changedValues: FormValues, values: FormValues) => void;
|
|
846
850
|
}
|
|
847
851
|
declare function FormRoot({ form, initialValues, layout, size: sizeProp, placeholderMode, disabled, requiredMark, className, onFinish, onFinishFailed, onValuesChange, children, ...props }: FormProps): react.JSX.Element;
|
|
848
|
-
/**
|
|
852
|
+
/** 表单项的字段绑定、标签、校验及内容配置;默认保留 8px 下外边距,noStyle 不生成布局容器或间距。 */
|
|
849
853
|
interface FormItemProps {
|
|
850
854
|
/** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
|
|
851
855
|
name?: NamePath;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as 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-ypvUN1on.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-ypvUN1on.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';
|
|
@@ -78,8 +78,12 @@ type SortableKey = string | number;
|
|
|
78
78
|
interface SortableListProps {
|
|
79
79
|
/** 按当前顺序排列的唯一稳定标识,不允许重复。 */
|
|
80
80
|
items: readonly SortableKey[];
|
|
81
|
-
/**
|
|
82
|
-
renderItem: (key: SortableKey, index: number) => ReactNode;
|
|
81
|
+
/** 根据标识渲染条目内容;第三个参数为框架手柄,handlePlacement="custom" 时须将其放入标题等位置;拖动和键盘排序仅由该手柄发起。 */
|
|
82
|
+
renderItem: (key: SortableKey, index: number, handle: ReactNode) => ReactNode;
|
|
83
|
+
/** 手柄位置;before 在条目前独占一行,custom 由 renderItem 放置框架提供的手柄。@defaultValue "before" */
|
|
84
|
+
handlePlacement?: "before" | "custom";
|
|
85
|
+
/** 手柄的内容,接收稳定标识和当前位置;未指定时显示拖动图标,可返回卡片标题文字。 */
|
|
86
|
+
handleContent?: (key: SortableKey, index: number) => ReactNode;
|
|
83
87
|
/** 拖放或手柄方向键完成移动时返回新顺序;无变化、取消、禁用时不触发。 */
|
|
84
88
|
onOrderChange: (items: SortableKey[]) => void;
|
|
85
89
|
/** 排列方向;横向内容超出时在列表内滚动。@defaultValue "horizontal" */
|
|
@@ -88,7 +92,7 @@ interface SortableListProps {
|
|
|
88
92
|
disabled?: boolean;
|
|
89
93
|
}
|
|
90
94
|
/** 拖放与键盘共用受控顺序,输入控件无需参与拖动事件。 */
|
|
91
|
-
declare function SortableList({ items, renderItem, onOrderChange, direction, disabled }: SortableListProps): react.JSX.Element;
|
|
95
|
+
declare function SortableList({ items, renderItem, onOrderChange, direction, disabled, handlePlacement, handleContent }: SortableListProps): react.JSX.Element;
|
|
92
96
|
|
|
93
97
|
/** 警告提示的状态类型。 */
|
|
94
98
|
type AlertStatus = "info" | "success" | "warning" | "error";
|
|
@@ -845,7 +849,7 @@ interface FormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit"
|
|
|
845
849
|
onValuesChange?: (changedValues: FormValues, values: FormValues) => void;
|
|
846
850
|
}
|
|
847
851
|
declare function FormRoot({ form, initialValues, layout, size: sizeProp, placeholderMode, disabled, requiredMark, className, onFinish, onFinishFailed, onValuesChange, children, ...props }: FormProps): react.JSX.Element;
|
|
848
|
-
/**
|
|
852
|
+
/** 表单项的字段绑定、标签、校验及内容配置;默认保留 8px 下外边距,noStyle 不生成布局容器或间距。 */
|
|
849
853
|
interface FormItemProps {
|
|
850
854
|
/** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
|
|
851
855
|
name?: NamePath;
|
package/dist/index.js
CHANGED
|
@@ -209,7 +209,7 @@ function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
|
209
209
|
children
|
|
210
210
|
] }), document.body);
|
|
211
211
|
}
|
|
212
|
-
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false }) {
|
|
212
|
+
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false, handlePlacement = "before", handleContent }) {
|
|
213
213
|
const [dragging, setDragging] = useState2(null);
|
|
214
214
|
const [target, setTarget] = useState2(null);
|
|
215
215
|
const clear = () => {
|
|
@@ -231,60 +231,63 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
231
231
|
}, [disabled, dragging, items]);
|
|
232
232
|
return /* @__PURE__ */ jsx2("div", { className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", onDragLeave: (event) => {
|
|
233
233
|
if (!event.currentTarget.contains(event.relatedTarget)) setTarget(null);
|
|
234
|
-
}, children: items.map((key, index) =>
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
event.preventDefault();
|
|
249
|
-
if (target !== null) move(dragging, target);
|
|
250
|
-
clear();
|
|
251
|
-
},
|
|
252
|
-
children: [
|
|
253
|
-
/* @__PURE__ */ jsx2(
|
|
254
|
-
"button",
|
|
255
|
-
{
|
|
256
|
-
type: "button",
|
|
257
|
-
className: "sia-sortable-list__handle",
|
|
258
|
-
draggable: !disabled,
|
|
259
|
-
disabled,
|
|
260
|
-
"aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
|
|
261
|
-
title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
|
|
262
|
-
onDragStart: (event) => {
|
|
263
|
-
if (disabled) {
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
setDragging(key);
|
|
268
|
-
event.dataTransfer.effectAllowed = "move";
|
|
269
|
-
event.dataTransfer.setData("text/plain", String(key));
|
|
270
|
-
},
|
|
271
|
-
onDragEnd: clear,
|
|
272
|
-
onKeyDown: (event) => {
|
|
273
|
-
const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
274
|
-
const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
275
|
-
if (event.key === previous || event.key === next) {
|
|
276
|
-
event.preventDefault();
|
|
277
|
-
move(key, event.key === previous ? index - 1 : index + 2);
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
children: /* @__PURE__ */ jsx2(Icon, { name: "menu", size: 16 })
|
|
234
|
+
}, children: items.map((key, index) => {
|
|
235
|
+
const handle = /* @__PURE__ */ jsx2(
|
|
236
|
+
"button",
|
|
237
|
+
{
|
|
238
|
+
type: "button",
|
|
239
|
+
className: `sia-sortable-list__handle${handlePlacement === "custom" ? " sia-sortable-list__handle--custom" : ""}`,
|
|
240
|
+
draggable: !disabled,
|
|
241
|
+
disabled,
|
|
242
|
+
"aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
|
|
243
|
+
title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
|
|
244
|
+
onDragStart: (event) => {
|
|
245
|
+
if (disabled) {
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
return;
|
|
281
248
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
249
|
+
setDragging(key);
|
|
250
|
+
event.dataTransfer.effectAllowed = "move";
|
|
251
|
+
event.dataTransfer.setData("text/plain", String(key));
|
|
252
|
+
},
|
|
253
|
+
onDragEnd: clear,
|
|
254
|
+
onKeyDown: (event) => {
|
|
255
|
+
const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
256
|
+
const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
257
|
+
if (event.key === previous || event.key === next) {
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
move(key, event.key === previous ? index - 1 : index + 2);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
children: handleContent ? handleContent(key, index) : /* @__PURE__ */ jsx2(Icon, { name: "menu", size: 16 })
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
return /* @__PURE__ */ jsxs2(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
role: "listitem",
|
|
269
|
+
className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
|
|
270
|
+
onDragOver: (event) => {
|
|
271
|
+
if (disabled || dragging === null) return;
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
event.dataTransfer.dropEffect = "move";
|
|
274
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
275
|
+
setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
|
|
276
|
+
},
|
|
277
|
+
onDrop: (event) => {
|
|
278
|
+
if (dragging === null || disabled) return;
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
if (target !== null) move(dragging, target);
|
|
281
|
+
clear();
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
handlePlacement === "before" ? handle : null,
|
|
285
|
+
renderItem(key, index, handle)
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
key
|
|
289
|
+
);
|
|
290
|
+
}) });
|
|
288
291
|
}
|
|
289
292
|
|
|
290
293
|
// src/components/Alert.tsx
|