@sia.soul/sia-react-ui 0.1.5 → 0.1.7
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-rtDktLYY.d.ts → Select-Cl6UXsN5.d.ts} +12 -0
- package/dist/{Select-GiTHMScg.d.cts → Select-IjA4yqLh.d.cts} +12 -0
- package/dist/chunk-6QQRMGW4.js +1331 -0
- package/dist/{chunk-PX6BOFTW.js → chunk-F3VH6LJH.js} +2 -4
- package/dist/{chunk-EJ23MVR6.js → chunk-JJVD2ITI.js} +592 -1
- package/dist/chunk-SMNSQDXN.js +1493 -0
- package/dist/{chunk-MJUTLEEE.js → chunk-X6ZPBBDF.js} +2 -2
- package/dist/{core-D8BSMfHD.d.ts → core-CcB8n8uv.d.ts} +1 -1
- package/dist/{core-CBtbeAms.d.cts → core-DrpbQni9.d.cts} +1 -1
- package/dist/core.cjs +1093 -715
- package/dist/core.css +147 -14
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +7 -9
- package/dist/index.cjs +4135 -3966
- package/dist/index.css +147 -14
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +97 -233
- package/dist/rich-text-editor.cjs +11 -2
- package/dist/rich-text-editor.js +2 -3
- package/dist/{select-date-range-DRmGaEzP.d.cts → select-date-range-BzEXIsqZ.d.cts} +1 -1
- package/dist/{select-date-range-CQ1vmze_.d.ts → select-date-range-CU2ou9sD.d.ts} +1 -1
- package/dist/select-date-range.cjs +1091 -77
- 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 -3
- package/package.json +1 -1
- package/dist/chunk-IHTODT53.js +0 -586
- package/dist/chunk-R7BVDN3Q.js +0 -366
- package/dist/chunk-S2JAJCLN.js +0 -2154
package/dist/index.js
CHANGED
|
@@ -63,31 +63,23 @@ import {
|
|
|
63
63
|
Calendar,
|
|
64
64
|
Card,
|
|
65
65
|
Carousel,
|
|
66
|
-
Checkbox,
|
|
67
66
|
Collapse,
|
|
68
67
|
FloatButton,
|
|
69
68
|
Image,
|
|
70
69
|
ImagePreview,
|
|
71
|
-
Modal,
|
|
72
|
-
OverlayPortal,
|
|
73
70
|
Popconfirm,
|
|
74
|
-
Popover,
|
|
75
71
|
Progress,
|
|
76
72
|
Rate,
|
|
77
73
|
Spin,
|
|
78
74
|
Tabs,
|
|
79
75
|
Tag,
|
|
80
|
-
Timeline,
|
|
81
|
-
Tooltip,
|
|
82
76
|
Tour,
|
|
83
|
-
Tree,
|
|
84
77
|
Typography,
|
|
85
78
|
Upload,
|
|
86
79
|
Watermark,
|
|
87
80
|
message,
|
|
88
|
-
notification
|
|
89
|
-
|
|
90
|
-
} from "./chunk-S2JAJCLN.js";
|
|
81
|
+
notification
|
|
82
|
+
} from "./chunk-6QQRMGW4.js";
|
|
91
83
|
import {
|
|
92
84
|
TextArea
|
|
93
85
|
} from "./chunk-WHARTF2I.js";
|
|
@@ -97,32 +89,39 @@ import {
|
|
|
97
89
|
import {
|
|
98
90
|
RichTextContent,
|
|
99
91
|
RichTextEditor
|
|
100
|
-
} from "./chunk-
|
|
101
|
-
import {
|
|
102
|
-
Dropdown,
|
|
103
|
-
Input,
|
|
104
|
-
Menu,
|
|
105
|
-
Segmented,
|
|
106
|
-
Steps
|
|
107
|
-
} from "./chunk-IHTODT53.js";
|
|
108
|
-
import {
|
|
109
|
-
Button
|
|
110
|
-
} from "./chunk-MBS2HXLZ.js";
|
|
92
|
+
} from "./chunk-F3VH6LJH.js";
|
|
111
93
|
import {
|
|
112
94
|
DatePicker,
|
|
113
95
|
SelectDateRange,
|
|
114
96
|
TimePanel
|
|
115
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-X6ZPBBDF.js";
|
|
116
98
|
import {
|
|
99
|
+
Checkbox,
|
|
100
|
+
Modal,
|
|
117
101
|
OverflowTags,
|
|
118
|
-
|
|
119
|
-
|
|
102
|
+
OverlayPortal,
|
|
103
|
+
Popover,
|
|
104
|
+
Select,
|
|
105
|
+
SelectionPanel,
|
|
106
|
+
Timeline,
|
|
107
|
+
Tooltip,
|
|
108
|
+
Tree,
|
|
109
|
+
useOverlayLifecycle
|
|
110
|
+
} from "./chunk-SMNSQDXN.js";
|
|
120
111
|
import {
|
|
112
|
+
Dropdown,
|
|
121
113
|
FILLED_ICON_NAMES,
|
|
122
114
|
ICON_NAMES,
|
|
123
115
|
Icon,
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
Input,
|
|
117
|
+
Menu,
|
|
118
|
+
PopupPortal,
|
|
119
|
+
Segmented,
|
|
120
|
+
Steps
|
|
121
|
+
} from "./chunk-JJVD2ITI.js";
|
|
122
|
+
import {
|
|
123
|
+
Button
|
|
124
|
+
} from "./chunk-MBS2HXLZ.js";
|
|
126
125
|
import {
|
|
127
126
|
PlaceholderModeContext,
|
|
128
127
|
useControllableState,
|
|
@@ -4470,14 +4469,32 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
4470
4469
|
useLayoutEffect(() => {
|
|
4471
4470
|
const element = ref.current;
|
|
4472
4471
|
if (!element || !ellipsis || !customContent) return;
|
|
4473
|
-
const
|
|
4472
|
+
const layouts = [];
|
|
4473
|
+
const normalizeLayouts = (parent) => {
|
|
4474
|
+
for (const child of parent.children) {
|
|
4475
|
+
if (!(child instanceof HTMLElement)) continue;
|
|
4476
|
+
const component = [...child.classList].some((name) => name.startsWith("sia-") && !name.startsWith("sia-space") && name !== "sia-flex");
|
|
4477
|
+
if (component || child.matches("button, input, textarea, select, [contenteditable]")) continue;
|
|
4478
|
+
const display = getComputedStyle(child).display;
|
|
4479
|
+
if (["flex", "inline-flex", "grid", "inline-grid"].includes(display)) {
|
|
4480
|
+
child.setAttribute("data-table-inline-layout", "");
|
|
4481
|
+
layouts.push(child);
|
|
4482
|
+
}
|
|
4483
|
+
normalizeLayouts(child);
|
|
4484
|
+
}
|
|
4485
|
+
};
|
|
4486
|
+
normalizeLayouts(element);
|
|
4487
|
+
const update = () => setOverflowing(element.scrollWidth > element.clientWidth + 1 || element.scrollHeight > element.clientHeight + 1);
|
|
4474
4488
|
update();
|
|
4475
4489
|
const observer = new ResizeObserver(update);
|
|
4476
4490
|
observer.observe(element);
|
|
4477
4491
|
for (const child of element.children) observer.observe(child);
|
|
4478
|
-
return () =>
|
|
4492
|
+
return () => {
|
|
4493
|
+
observer.disconnect();
|
|
4494
|
+
layouts.forEach((layout) => layout.removeAttribute("data-table-inline-layout"));
|
|
4495
|
+
};
|
|
4479
4496
|
}, [children, ellipsis, customContent]);
|
|
4480
|
-
return /* @__PURE__ */ jsx19("div", { ref, className: "sia-table__cell-content", title, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
|
|
4497
|
+
return /* @__PURE__ */ jsx19("div", { ref, className: "sia-table__cell-content", title, "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children });
|
|
4481
4498
|
}
|
|
4482
4499
|
|
|
4483
4500
|
// src/components/Table/Table.tsx
|
|
@@ -5979,7 +5996,25 @@ function buildHeaderRows(columns) {
|
|
|
5979
5996
|
const colSpan = countLeaves(column);
|
|
5980
5997
|
if (colSpan === 0) continue;
|
|
5981
5998
|
const leaf = !column.children?.length;
|
|
5982
|
-
|
|
5999
|
+
const descendants = flattenTableColumns([column]);
|
|
6000
|
+
const segments = [];
|
|
6001
|
+
for (const descendant of descendants) {
|
|
6002
|
+
const previous = segments[segments.length - 1];
|
|
6003
|
+
if (previous && normalizeFixed(previous[0].fixed) === normalizeFixed(descendant.fixed)) previous.push(descendant);
|
|
6004
|
+
else segments.push([descendant]);
|
|
6005
|
+
}
|
|
6006
|
+
for (const segment of segments) {
|
|
6007
|
+
rows[depth].push({
|
|
6008
|
+
column,
|
|
6009
|
+
colSpan: segment.length,
|
|
6010
|
+
rowSpan: leaf ? maxDepth - depth : 1,
|
|
6011
|
+
depth,
|
|
6012
|
+
leaf,
|
|
6013
|
+
fixed: normalizeFixed(segment[0].fixed),
|
|
6014
|
+
firstLeafKey: segment[0].key,
|
|
6015
|
+
lastLeafKey: segment[segment.length - 1].key
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
5983
6018
|
if (!leaf) walk(column.children, depth + 1);
|
|
5984
6019
|
}
|
|
5985
6020
|
};
|
|
@@ -6501,7 +6536,7 @@ function TableInner(props, ref) {
|
|
|
6501
6536
|
const fixed = normalizeFixed(column.fixed);
|
|
6502
6537
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
6503
6538
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
6504
|
-
return /* @__PURE__ */ jsx21("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__summary-cell${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: content }, column.key);
|
|
6539
|
+
return /* @__PURE__ */ jsx21("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: content }, column.key);
|
|
6505
6540
|
}) }, summary.key);
|
|
6506
6541
|
}
|
|
6507
6542
|
return /* @__PURE__ */ jsxs20(
|
|
@@ -6562,7 +6597,7 @@ function TableInner(props, ref) {
|
|
|
6562
6597
|
/* @__PURE__ */ jsx21("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs20("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
6563
6598
|
/* @__PURE__ */ jsx21("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx21("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
6564
6599
|
/* @__PURE__ */ jsx21("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx21("tr", { children: headerRow.map((cell) => {
|
|
6565
|
-
const fixed = cell.
|
|
6600
|
+
const fixed = cell.fixed;
|
|
6566
6601
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
6567
6602
|
const fixedEdgeClass = fixed === "left" && cell.column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && cell.column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
6568
6603
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
@@ -6574,7 +6609,7 @@ function TableInner(props, ref) {
|
|
|
6574
6609
|
colSpan: cell.colSpan,
|
|
6575
6610
|
rowSpan: cell.rowSpan,
|
|
6576
6611
|
className: `sia-table__header-cell sia-table__cell--${cell.column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass} ${cell.column.headerClassName ?? ""} ${pluginHeaderProps.className ?? ""}`.trim(),
|
|
6577
|
-
style: { ...
|
|
6612
|
+
style: { ...fixed === "left" ? { left: leftOffsets.get(cell.firstLeafKey) } : fixed === "right" ? { right: rightOffsets.get(cell.lastLeafKey) } : {}, top: stickyHeader ? depth * rowHeight : void 0, ...pluginHeaderProps.style },
|
|
6578
6613
|
scope: "col",
|
|
6579
6614
|
onPointerDown: (event) => {
|
|
6580
6615
|
for (const plugin of sortedPlugins) plugin.onHeaderPointerDown?.(cell.column, event, getContext(plugin));
|
|
@@ -6584,7 +6619,7 @@ function TableInner(props, ref) {
|
|
|
6584
6619
|
},
|
|
6585
6620
|
children: renderHeaderContent(cell.column, cell.column.renderHeader ? cell.column.renderHeader(cell.column, coreContext) : cell.column.title ?? cell.column.name ?? cell.column.key)
|
|
6586
6621
|
},
|
|
6587
|
-
`${cell.column.key}-${depth}`
|
|
6622
|
+
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
6588
6623
|
);
|
|
6589
6624
|
}) }, depth)) }),
|
|
6590
6625
|
/* @__PURE__ */ jsxs20("tbody", { children: [
|
|
@@ -7058,180 +7093,9 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
7058
7093
|
target.style.colorScheme = mode;
|
|
7059
7094
|
}
|
|
7060
7095
|
|
|
7061
|
-
// src/components/SelectionPanel.tsx
|
|
7062
|
-
import { useEffect as useEffect15, useId as useId7, useMemo as useMemo10, useRef as useRef15, useState as useState18 } from "react";
|
|
7063
|
-
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7064
|
-
function SelectionPanel({
|
|
7065
|
-
options,
|
|
7066
|
-
value,
|
|
7067
|
-
onChange,
|
|
7068
|
-
multiple = false,
|
|
7069
|
-
disabled = false,
|
|
7070
|
-
loading = false,
|
|
7071
|
-
showSearch = true,
|
|
7072
|
-
searchValue,
|
|
7073
|
-
onSearch,
|
|
7074
|
-
selectedOnly = false,
|
|
7075
|
-
showValue = false,
|
|
7076
|
-
displayField = "label",
|
|
7077
|
-
columns = 1,
|
|
7078
|
-
maxHeight = 250,
|
|
7079
|
-
autoFocusSearch = false
|
|
7080
|
-
}) {
|
|
7081
|
-
const [localSearch, setLocalSearch] = useState18("");
|
|
7082
|
-
const search = searchValue ?? localSearch;
|
|
7083
|
-
const [scrollTop, setScrollTop] = useState18(0);
|
|
7084
|
-
const [active, setActive] = useState18();
|
|
7085
|
-
const listRef = useRef15(null);
|
|
7086
|
-
const id = useId7();
|
|
7087
|
-
const selected = useMemo10(() => new Set(value), [value]);
|
|
7088
|
-
const count = Math.max(1, Math.floor(columns));
|
|
7089
|
-
const allOptions = useMemo10(() => {
|
|
7090
|
-
const known = new Set(options.filter((option) => option.optionType !== "divider").map((option) => option.value));
|
|
7091
|
-
return [...value.filter((item) => !known.has(item)).map((item) => ({ value: item, label: String(item), group: "\u81EA\u5B9A\u4E49\u503C" })), ...options];
|
|
7092
|
-
}, [options, value]);
|
|
7093
|
-
const filtered = useMemo10(
|
|
7094
|
-
() => allOptions.filter((option) => (!selectedOnly || selected.has(option.value)) && (!search || option.optionType !== "divider" && [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase())))),
|
|
7095
|
-
[allOptions, selectedOnly, selected, search]
|
|
7096
|
-
);
|
|
7097
|
-
const rows = useMemo10(() => {
|
|
7098
|
-
const groups = /* @__PURE__ */ new Map();
|
|
7099
|
-
filtered.forEach((option) => {
|
|
7100
|
-
const items = groups.get(option.group) ?? [];
|
|
7101
|
-
items.push(option);
|
|
7102
|
-
groups.set(option.group, items);
|
|
7103
|
-
});
|
|
7104
|
-
const rows2 = [];
|
|
7105
|
-
let top = 0;
|
|
7106
|
-
for (const [group, items] of groups) {
|
|
7107
|
-
if (group) {
|
|
7108
|
-
rows2.push({ key: `group-${rows2.length}`, title: group, top, height: 30 });
|
|
7109
|
-
top += 30;
|
|
7110
|
-
}
|
|
7111
|
-
for (let index = 0; index < items.length; index += count) {
|
|
7112
|
-
const height = showValue ? 48 : 34;
|
|
7113
|
-
rows2.push({ key: `row-${rows2.length}`, items: items.slice(index, index + count), top, height });
|
|
7114
|
-
top += height;
|
|
7115
|
-
}
|
|
7116
|
-
}
|
|
7117
|
-
return rows2;
|
|
7118
|
-
}, [filtered, count, showValue]);
|
|
7119
|
-
const totalHeight = rows.length ? rows[rows.length - 1].top + rows[rows.length - 1].height : 0;
|
|
7120
|
-
const virtual = filtered.length > 100;
|
|
7121
|
-
const renderedRows = virtual ? rows.filter((row) => row.top + row.height >= scrollTop - 100 && row.top <= scrollTop + maxHeight + 100) : rows;
|
|
7122
|
-
const enabled = filtered.filter((option) => !option.disabled && option.optionType !== "divider");
|
|
7123
|
-
useEffect15(() => {
|
|
7124
|
-
setScrollTop(0);
|
|
7125
|
-
if (listRef.current) listRef.current.scrollTop = 0;
|
|
7126
|
-
setActive(void 0);
|
|
7127
|
-
}, [search, selectedOnly, count]);
|
|
7128
|
-
function toggle(option) {
|
|
7129
|
-
if (disabled || loading || option.disabled || option.optionType === "divider") return;
|
|
7130
|
-
setActive(option.value);
|
|
7131
|
-
onChange(multiple ? selected.has(option.value) ? value.filter((item) => item !== option.value) : [...value, option.value] : [option.value]);
|
|
7132
|
-
}
|
|
7133
|
-
function batch(operation) {
|
|
7134
|
-
if (disabled || loading) return;
|
|
7135
|
-
if (operation === "clear") {
|
|
7136
|
-
onChange([]);
|
|
7137
|
-
return;
|
|
7138
|
-
}
|
|
7139
|
-
const editable = new Set(enabled.map((option) => option.value));
|
|
7140
|
-
const retained = value.filter((item) => !editable.has(item));
|
|
7141
|
-
const add = enabled.filter((option) => operation === "all" || !selected.has(option.value)).map((option) => option.value);
|
|
7142
|
-
onChange([...retained, ...add]);
|
|
7143
|
-
}
|
|
7144
|
-
return /* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel", children: [
|
|
7145
|
-
showSearch && /* @__PURE__ */ jsx23(
|
|
7146
|
-
Input,
|
|
7147
|
-
{
|
|
7148
|
-
"aria-label": "\u641C\u7D22\u9009\u9879",
|
|
7149
|
-
placeholder: "\u641C\u7D22",
|
|
7150
|
-
autoFocus: autoFocusSearch,
|
|
7151
|
-
value: search,
|
|
7152
|
-
allowClear: true,
|
|
7153
|
-
onChange: (event) => {
|
|
7154
|
-
setLocalSearch(event.target.value);
|
|
7155
|
-
onSearch?.(event.target.value);
|
|
7156
|
-
}
|
|
7157
|
-
}
|
|
7158
|
-
),
|
|
7159
|
-
multiple && /* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel__actions", children: [
|
|
7160
|
-
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("all"), children: "\u5168\u9009" }),
|
|
7161
|
-
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
7162
|
-
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !value.length, onClick: () => batch("clear"), children: "\u6E05\u7A7A" }),
|
|
7163
|
-
/* @__PURE__ */ jsxs22("span", { children: [
|
|
7164
|
-
"\u5DF2\u9009 ",
|
|
7165
|
-
value.length,
|
|
7166
|
-
" \u9879"
|
|
7167
|
-
] })
|
|
7168
|
-
] }),
|
|
7169
|
-
/* @__PURE__ */ jsx23(
|
|
7170
|
-
"div",
|
|
7171
|
-
{
|
|
7172
|
-
ref: listRef,
|
|
7173
|
-
role: "listbox",
|
|
7174
|
-
"aria-label": "\u9009\u9879\u5217\u8868",
|
|
7175
|
-
"aria-multiselectable": multiple || void 0,
|
|
7176
|
-
tabIndex: disabled ? -1 : 0,
|
|
7177
|
-
className: "sia-selection-panel__list",
|
|
7178
|
-
style: { maxHeight },
|
|
7179
|
-
onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
|
|
7180
|
-
"aria-activedescendant": active !== void 0 ? `${id}-${typeof active}-${active}` : void 0,
|
|
7181
|
-
onKeyDown: (event) => {
|
|
7182
|
-
if (disabled || loading || !enabled.length) return;
|
|
7183
|
-
const index = enabled.findIndex((option) => option.value === active);
|
|
7184
|
-
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
7185
|
-
event.preventDefault();
|
|
7186
|
-
const next = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : Math.max(0, Math.min(enabled.length - 1, index + (event.key === "ArrowDown" ? 1 : -1)));
|
|
7187
|
-
const option = enabled[next];
|
|
7188
|
-
setActive(option.value);
|
|
7189
|
-
const row = rows.find((row2) => row2.items?.includes(option));
|
|
7190
|
-
if (row && listRef.current) {
|
|
7191
|
-
listRef.current.scrollTop = Math.max(0, row.top - maxHeight / 2);
|
|
7192
|
-
setScrollTop(listRef.current.scrollTop);
|
|
7193
|
-
}
|
|
7194
|
-
} else if ((event.key === "Enter" || event.key === " ") && index >= 0) {
|
|
7195
|
-
event.preventDefault();
|
|
7196
|
-
toggle(enabled[index]);
|
|
7197
|
-
}
|
|
7198
|
-
},
|
|
7199
|
-
children: loading ? /* @__PURE__ */ jsx23("div", { role: "status", children: "\u52A0\u8F7D\u4E2D\u2026" }) : !rows.length ? /* @__PURE__ */ jsx23("div", { className: "sia-selection-panel__empty", children: "\u6682\u65E0\u5339\u914D\u9009\u9879" }) : /* @__PURE__ */ jsx23("div", { style: { height: totalHeight, position: "relative" }, children: renderedRows.map((row) => /* @__PURE__ */ jsx23(
|
|
7200
|
-
"div",
|
|
7201
|
-
{
|
|
7202
|
-
className: row.title !== void 0 ? "sia-selection-panel__group" : "sia-selection-panel__row",
|
|
7203
|
-
style: { position: "absolute", top: row.top, height: row.height, width: "100%", gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))` },
|
|
7204
|
-
children: row.title ?? row.items?.map((option, index) => option.optionType === "divider" ? /* @__PURE__ */ jsx23("div", { role: "separator", className: "sia-selection-panel__divider" }, `divider-${index}`) : /* @__PURE__ */ jsx23(Tooltip, { title: option.disabled ? option.disabledTip : void 0, placement: "right", children: /* @__PURE__ */ jsxs22(
|
|
7205
|
-
"button",
|
|
7206
|
-
{
|
|
7207
|
-
type: "button",
|
|
7208
|
-
role: "option",
|
|
7209
|
-
id: `${id}-${typeof option.value}-${option.value}`,
|
|
7210
|
-
tabIndex: -1,
|
|
7211
|
-
"aria-selected": selected.has(option.value),
|
|
7212
|
-
"aria-disabled": disabled || option.disabled || void 0,
|
|
7213
|
-
className: `sia-selection-panel__option${active === option.value ? " is-active" : ""}`,
|
|
7214
|
-
onClick: () => toggle(option),
|
|
7215
|
-
children: [
|
|
7216
|
-
multiple && /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: "sia-selection-panel__check", children: selected.has(option.value) ? "\u2713" : "" }),
|
|
7217
|
-
/* @__PURE__ */ jsxs22("span", { className: "sia-selection-panel__text", children: [
|
|
7218
|
-
showValue || displayField === "label" ? option.label : String(option.value),
|
|
7219
|
-
showValue && /* @__PURE__ */ jsx23("small", { children: String(option.value) })
|
|
7220
|
-
] })
|
|
7221
|
-
]
|
|
7222
|
-
}
|
|
7223
|
-
) }, `${typeof option.value}-${option.value}`))
|
|
7224
|
-
},
|
|
7225
|
-
row.key
|
|
7226
|
-
)) })
|
|
7227
|
-
}
|
|
7228
|
-
)
|
|
7229
|
-
] });
|
|
7230
|
-
}
|
|
7231
|
-
|
|
7232
7096
|
// src/components/InputSelect.tsx
|
|
7233
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
7234
|
-
import { jsx as
|
|
7097
|
+
import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as useRef15, useState as useState18 } from "react";
|
|
7098
|
+
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7235
7099
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
7236
7100
|
options,
|
|
7237
7101
|
value,
|
|
@@ -7257,22 +7121,22 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7257
7121
|
onOpenChange,
|
|
7258
7122
|
...inputProps
|
|
7259
7123
|
}, forwardedRef) {
|
|
7260
|
-
const [internal, setInternal] =
|
|
7124
|
+
const [internal, setInternal] = useState18(defaultValue);
|
|
7261
7125
|
const current = value !== void 0 ? value : internal;
|
|
7262
7126
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
7263
7127
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
7264
|
-
const [draft, setDraft] =
|
|
7265
|
-
|
|
7128
|
+
const [draft, setDraft] = useState18(text);
|
|
7129
|
+
useEffect15(() => {
|
|
7266
7130
|
setDraft(text);
|
|
7267
7131
|
}, [text, current]);
|
|
7268
|
-
const [open, setOpen] =
|
|
7269
|
-
const [search, setSearch] =
|
|
7270
|
-
const [modalOpen, setModalOpen] =
|
|
7271
|
-
const [modalValues, setModalValues] =
|
|
7272
|
-
const [selectedOnly, setSelectedOnly] =
|
|
7273
|
-
const rootRef =
|
|
7274
|
-
const popupRef =
|
|
7275
|
-
const inputRef =
|
|
7132
|
+
const [open, setOpen] = useState18(false);
|
|
7133
|
+
const [search, setSearch] = useState18("");
|
|
7134
|
+
const [modalOpen, setModalOpen] = useState18(false);
|
|
7135
|
+
const [modalValues, setModalValues] = useState18([]);
|
|
7136
|
+
const [selectedOnly, setSelectedOnly] = useState18(false);
|
|
7137
|
+
const rootRef = useRef15(null);
|
|
7138
|
+
const popupRef = useRef15(null);
|
|
7139
|
+
const inputRef = useRef15(null);
|
|
7276
7140
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
7277
7141
|
function changeOpen(next) {
|
|
7278
7142
|
if (next && (disabled || loading)) return;
|
|
@@ -7292,7 +7156,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7292
7156
|
inputRef.current?.focus();
|
|
7293
7157
|
}
|
|
7294
7158
|
}
|
|
7295
|
-
|
|
7159
|
+
useEffect15(() => {
|
|
7296
7160
|
if (!open) return;
|
|
7297
7161
|
const outside = (event) => {
|
|
7298
7162
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -7300,7 +7164,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7300
7164
|
document.addEventListener("pointerdown", outside);
|
|
7301
7165
|
return () => document.removeEventListener("pointerdown", outside);
|
|
7302
7166
|
}, [open, onOpenChange]);
|
|
7303
|
-
|
|
7167
|
+
useEffect15(() => {
|
|
7304
7168
|
if (disabled || loading) {
|
|
7305
7169
|
changeOpen(false);
|
|
7306
7170
|
setModalOpen(false);
|
|
@@ -7313,14 +7177,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7313
7177
|
setSelectedOnly(false);
|
|
7314
7178
|
setModalOpen(true);
|
|
7315
7179
|
}
|
|
7316
|
-
return /* @__PURE__ */
|
|
7180
|
+
return /* @__PURE__ */ jsxs22("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
7317
7181
|
if (event.key === "Escape" && open) {
|
|
7318
7182
|
event.stopPropagation();
|
|
7319
7183
|
changeOpen(false);
|
|
7320
7184
|
inputRef.current?.focus();
|
|
7321
7185
|
}
|
|
7322
7186
|
}, children: [
|
|
7323
|
-
/* @__PURE__ */
|
|
7187
|
+
/* @__PURE__ */ jsx23(
|
|
7324
7188
|
Input,
|
|
7325
7189
|
{
|
|
7326
7190
|
...inputProps,
|
|
@@ -7357,26 +7221,26 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7357
7221
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
7358
7222
|
changeOpen(true);
|
|
7359
7223
|
},
|
|
7360
|
-
suffix: /* @__PURE__ */
|
|
7361
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
7224
|
+
suffix: /* @__PURE__ */ jsxs22("span", { className: "sia-input-select__suffix", children: [
|
|
7225
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
7362
7226
|
event.stopPropagation();
|
|
7363
7227
|
setDraft("");
|
|
7364
7228
|
emit(multiple ? [] : void 0);
|
|
7365
7229
|
inputRef.current?.focus();
|
|
7366
7230
|
}, children: "\xD7" }),
|
|
7367
7231
|
suffix,
|
|
7368
|
-
enableModal && /* @__PURE__ */
|
|
7232
|
+
enableModal && /* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
7369
7233
|
event.stopPropagation();
|
|
7370
7234
|
openModal();
|
|
7371
7235
|
}, children: "\u2026" }),
|
|
7372
|
-
/* @__PURE__ */
|
|
7236
|
+
/* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
7373
7237
|
event.stopPropagation();
|
|
7374
7238
|
changeOpen(!open);
|
|
7375
|
-
}, children: /* @__PURE__ */
|
|
7239
|
+
}, children: /* @__PURE__ */ jsx23(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
7376
7240
|
] })
|
|
7377
7241
|
}
|
|
7378
7242
|
),
|
|
7379
|
-
/* @__PURE__ */
|
|
7243
|
+
/* @__PURE__ */ jsx23(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx23(
|
|
7380
7244
|
SelectionPanel,
|
|
7381
7245
|
{
|
|
7382
7246
|
options,
|
|
@@ -7391,7 +7255,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7391
7255
|
onSearch: setSearch
|
|
7392
7256
|
}
|
|
7393
7257
|
) }),
|
|
7394
|
-
enableModal && /* @__PURE__ */
|
|
7258
|
+
enableModal && /* @__PURE__ */ jsxs22(
|
|
7395
7259
|
Modal,
|
|
7396
7260
|
{
|
|
7397
7261
|
open: modalOpen,
|
|
@@ -7404,15 +7268,15 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7404
7268
|
setModalOpen(false);
|
|
7405
7269
|
},
|
|
7406
7270
|
children: [
|
|
7407
|
-
/* @__PURE__ */
|
|
7408
|
-
/* @__PURE__ */
|
|
7409
|
-
/* @__PURE__ */
|
|
7271
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
7272
|
+
/* @__PURE__ */ jsx23(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
7273
|
+
/* @__PURE__ */ jsxs22(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
7410
7274
|
"\u5DF2\u9009\u9879(",
|
|
7411
7275
|
modalValues.length,
|
|
7412
7276
|
")"
|
|
7413
7277
|
] })
|
|
7414
7278
|
] }),
|
|
7415
|
-
modalOpen && /* @__PURE__ */
|
|
7279
|
+
modalOpen && /* @__PURE__ */ jsx23(
|
|
7416
7280
|
SelectionPanel,
|
|
7417
7281
|
{
|
|
7418
7282
|
options,
|
|
@@ -1148,7 +1148,7 @@ function MenuEntry({
|
|
|
1148
1148
|
ref: anchorRef,
|
|
1149
1149
|
type: "button",
|
|
1150
1150
|
className: "sia-menu__item",
|
|
1151
|
-
style: { paddingInlineStart:
|
|
1151
|
+
style: { paddingInlineStart: props.mode === "inline" && !props.inlineCollapsed ? 12 + level * props.inlineIndent : void 0 },
|
|
1152
1152
|
title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title,
|
|
1153
1153
|
disabled: item.disabled,
|
|
1154
1154
|
"aria-current": isSelected ? "page" : void 0,
|
|
@@ -1555,6 +1555,15 @@ var Input = (0, import_react7.forwardRef)(function Input2({
|
|
|
1555
1555
|
input2.focus();
|
|
1556
1556
|
onClear?.();
|
|
1557
1557
|
}
|
|
1558
|
+
function handleControlMouseDown(event) {
|
|
1559
|
+
if (disabled || event.defaultPrevented || event.button !== 0) return;
|
|
1560
|
+
const target = event.target;
|
|
1561
|
+
if (!(target instanceof Element)) return;
|
|
1562
|
+
const interactive = target.closest("input, textarea, select, button, a[href], [tabindex], [contenteditable]:not([contenteditable='false']), [role='button'], [role='link']");
|
|
1563
|
+
if (interactive && event.currentTarget.contains(interactive) && !interactive.classList.contains("sia-input-control__clear")) return;
|
|
1564
|
+
event.preventDefault();
|
|
1565
|
+
localRef.current?.focus({ preventScroll: true });
|
|
1566
|
+
}
|
|
1558
1567
|
const input = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1559
1568
|
"input",
|
|
1560
1569
|
{
|
|
@@ -1572,7 +1581,7 @@ var Input = (0, import_react7.forwardRef)(function Input2({
|
|
|
1572
1581
|
onChange: handleChange
|
|
1573
1582
|
}
|
|
1574
1583
|
);
|
|
1575
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: `sia-input-control sia-input-control--${size} sia-input-control--${status}${floatingPlaceholder ? " sia-input-control--floating" : ""}${floatingPlaceholder && hasValue ? " is-filled" : ""}${disabled ? " is-disabled" : ""}`, children: [
|
|
1584
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { onMouseDown: handleControlMouseDown, className: `sia-input-control sia-input-control--${size} sia-input-control--${status}${floatingPlaceholder ? " sia-input-control--floating" : ""}${floatingPlaceholder && hasValue ? " is-filled" : ""}${disabled ? " is-disabled" : ""}`, children: [
|
|
1576
1585
|
prefix ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-input-control__affix", children: prefix }) : null,
|
|
1577
1586
|
floatingPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "sia-input-control__input-wrap", children: [
|
|
1578
1587
|
input,
|
package/dist/rich-text-editor.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RichTextContent,
|
|
3
3
|
RichTextEditor
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-F3VH6LJH.js";
|
|
5
|
+
import "./chunk-JJVD2ITI.js";
|
|
6
6
|
import "./chunk-MBS2HXLZ.js";
|
|
7
|
-
import "./chunk-EJ23MVR6.js";
|
|
8
7
|
import "./chunk-EJDPRAU2.js";
|
|
9
8
|
export {
|
|
10
9
|
RichTextContent,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-DAYZvZVu.cjs';
|
|
4
|
-
import { c as SelectOption, e as SelectValue } from './Select-
|
|
4
|
+
import { c as SelectOption, e as SelectValue } from './Select-IjA4yqLh.cjs';
|
|
5
5
|
|
|
6
6
|
type DatePickerShowTime = boolean | {
|
|
7
7
|
showSecond?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-DAYZvZVu.js';
|
|
4
|
-
import { c as SelectOption, e as SelectValue } from './Select-
|
|
4
|
+
import { c as SelectOption, e as SelectValue } from './Select-Cl6UXsN5.js';
|
|
5
5
|
|
|
6
6
|
type DatePickerShowTime = boolean | {
|
|
7
7
|
showSecond?: boolean;
|