@sia.soul/sia-react-ui 0.1.6 → 0.1.8
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-GiTHMScg.d.cts → Select-CVvF4mcy.d.cts} +14 -0
- package/dist/{Select-rtDktLYY.d.ts → Select-Ce2Irbpt.d.ts} +14 -0
- package/dist/{chunk-PX6BOFTW.js → chunk-F3VH6LJH.js} +2 -4
- package/dist/chunk-FVQON65A.js +1331 -0
- package/dist/{chunk-EJ23MVR6.js → chunk-JJVD2ITI.js} +592 -1
- package/dist/chunk-JMVCKK34.js +1494 -0
- package/dist/{chunk-MJUTLEEE.js → chunk-PXQUIG6V.js} +2 -2
- package/dist/{core-D8BSMfHD.d.ts → core-ByQQ3hq2.d.ts} +1 -1
- package/dist/{core-CBtbeAms.d.cts → core-Dwc_30PN.d.cts} +1 -1
- package/dist/core.cjs +1094 -715
- package/dist/core.css +142 -11
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +7 -9
- package/dist/index.cjs +4123 -3971
- package/dist/index.css +142 -11
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +76 -230
- package/dist/rich-text-editor.cjs +11 -2
- package/dist/rich-text-editor.js +2 -3
- package/dist/{select-date-range-CQ1vmze_.d.ts → select-date-range-D-JMfpwD.d.ts} +1 -1
- package/dist/{select-date-range-DRmGaEzP.d.cts → select-date-range-l-xgB959.d.cts} +1 -1
- package/dist/select-date-range.cjs +1092 -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-FVQON65A.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-PXQUIG6V.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-JMVCKK34.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,
|
|
@@ -5997,7 +5996,25 @@ function buildHeaderRows(columns) {
|
|
|
5997
5996
|
const colSpan = countLeaves(column);
|
|
5998
5997
|
if (colSpan === 0) continue;
|
|
5999
5998
|
const leaf = !column.children?.length;
|
|
6000
|
-
|
|
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
|
+
}
|
|
6001
6018
|
if (!leaf) walk(column.children, depth + 1);
|
|
6002
6019
|
}
|
|
6003
6020
|
};
|
|
@@ -6519,7 +6536,7 @@ function TableInner(props, ref) {
|
|
|
6519
6536
|
const fixed = normalizeFixed(column.fixed);
|
|
6520
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" : "";
|
|
6521
6538
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
6522
|
-
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);
|
|
6523
6540
|
}) }, summary.key);
|
|
6524
6541
|
}
|
|
6525
6542
|
return /* @__PURE__ */ jsxs20(
|
|
@@ -6580,7 +6597,7 @@ function TableInner(props, ref) {
|
|
|
6580
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: [
|
|
6581
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)) }),
|
|
6582
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) => {
|
|
6583
|
-
const fixed = cell.
|
|
6600
|
+
const fixed = cell.fixed;
|
|
6584
6601
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
6585
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" : "";
|
|
6586
6603
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
@@ -6592,7 +6609,7 @@ function TableInner(props, ref) {
|
|
|
6592
6609
|
colSpan: cell.colSpan,
|
|
6593
6610
|
rowSpan: cell.rowSpan,
|
|
6594
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(),
|
|
6595
|
-
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 },
|
|
6596
6613
|
scope: "col",
|
|
6597
6614
|
onPointerDown: (event) => {
|
|
6598
6615
|
for (const plugin of sortedPlugins) plugin.onHeaderPointerDown?.(cell.column, event, getContext(plugin));
|
|
@@ -6602,7 +6619,7 @@ function TableInner(props, ref) {
|
|
|
6602
6619
|
},
|
|
6603
6620
|
children: renderHeaderContent(cell.column, cell.column.renderHeader ? cell.column.renderHeader(cell.column, coreContext) : cell.column.title ?? cell.column.name ?? cell.column.key)
|
|
6604
6621
|
},
|
|
6605
|
-
`${cell.column.key}-${depth}`
|
|
6622
|
+
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
6606
6623
|
);
|
|
6607
6624
|
}) }, depth)) }),
|
|
6608
6625
|
/* @__PURE__ */ jsxs20("tbody", { children: [
|
|
@@ -7076,180 +7093,9 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
7076
7093
|
target.style.colorScheme = mode;
|
|
7077
7094
|
}
|
|
7078
7095
|
|
|
7079
|
-
// src/components/SelectionPanel.tsx
|
|
7080
|
-
import { useEffect as useEffect15, useId as useId7, useMemo as useMemo10, useRef as useRef15, useState as useState18 } from "react";
|
|
7081
|
-
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7082
|
-
function SelectionPanel({
|
|
7083
|
-
options,
|
|
7084
|
-
value,
|
|
7085
|
-
onChange,
|
|
7086
|
-
multiple = false,
|
|
7087
|
-
disabled = false,
|
|
7088
|
-
loading = false,
|
|
7089
|
-
showSearch = true,
|
|
7090
|
-
searchValue,
|
|
7091
|
-
onSearch,
|
|
7092
|
-
selectedOnly = false,
|
|
7093
|
-
showValue = false,
|
|
7094
|
-
displayField = "label",
|
|
7095
|
-
columns = 1,
|
|
7096
|
-
maxHeight = 250,
|
|
7097
|
-
autoFocusSearch = false
|
|
7098
|
-
}) {
|
|
7099
|
-
const [localSearch, setLocalSearch] = useState18("");
|
|
7100
|
-
const search = searchValue ?? localSearch;
|
|
7101
|
-
const [scrollTop, setScrollTop] = useState18(0);
|
|
7102
|
-
const [active, setActive] = useState18();
|
|
7103
|
-
const listRef = useRef15(null);
|
|
7104
|
-
const id = useId7();
|
|
7105
|
-
const selected = useMemo10(() => new Set(value), [value]);
|
|
7106
|
-
const count = Math.max(1, Math.floor(columns));
|
|
7107
|
-
const allOptions = useMemo10(() => {
|
|
7108
|
-
const known = new Set(options.filter((option) => option.optionType !== "divider").map((option) => option.value));
|
|
7109
|
-
return [...value.filter((item) => !known.has(item)).map((item) => ({ value: item, label: String(item), group: "\u81EA\u5B9A\u4E49\u503C" })), ...options];
|
|
7110
|
-
}, [options, value]);
|
|
7111
|
-
const filtered = useMemo10(
|
|
7112
|
-
() => allOptions.filter((option) => (!selectedOnly || selected.has(option.value)) && (!search || option.optionType !== "divider" && [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase())))),
|
|
7113
|
-
[allOptions, selectedOnly, selected, search]
|
|
7114
|
-
);
|
|
7115
|
-
const rows = useMemo10(() => {
|
|
7116
|
-
const groups = /* @__PURE__ */ new Map();
|
|
7117
|
-
filtered.forEach((option) => {
|
|
7118
|
-
const items = groups.get(option.group) ?? [];
|
|
7119
|
-
items.push(option);
|
|
7120
|
-
groups.set(option.group, items);
|
|
7121
|
-
});
|
|
7122
|
-
const rows2 = [];
|
|
7123
|
-
let top = 0;
|
|
7124
|
-
for (const [group, items] of groups) {
|
|
7125
|
-
if (group) {
|
|
7126
|
-
rows2.push({ key: `group-${rows2.length}`, title: group, top, height: 30 });
|
|
7127
|
-
top += 30;
|
|
7128
|
-
}
|
|
7129
|
-
for (let index = 0; index < items.length; index += count) {
|
|
7130
|
-
const height = showValue ? 48 : 34;
|
|
7131
|
-
rows2.push({ key: `row-${rows2.length}`, items: items.slice(index, index + count), top, height });
|
|
7132
|
-
top += height;
|
|
7133
|
-
}
|
|
7134
|
-
}
|
|
7135
|
-
return rows2;
|
|
7136
|
-
}, [filtered, count, showValue]);
|
|
7137
|
-
const totalHeight = rows.length ? rows[rows.length - 1].top + rows[rows.length - 1].height : 0;
|
|
7138
|
-
const virtual = filtered.length > 100;
|
|
7139
|
-
const renderedRows = virtual ? rows.filter((row) => row.top + row.height >= scrollTop - 100 && row.top <= scrollTop + maxHeight + 100) : rows;
|
|
7140
|
-
const enabled = filtered.filter((option) => !option.disabled && option.optionType !== "divider");
|
|
7141
|
-
useEffect15(() => {
|
|
7142
|
-
setScrollTop(0);
|
|
7143
|
-
if (listRef.current) listRef.current.scrollTop = 0;
|
|
7144
|
-
setActive(void 0);
|
|
7145
|
-
}, [search, selectedOnly, count]);
|
|
7146
|
-
function toggle(option) {
|
|
7147
|
-
if (disabled || loading || option.disabled || option.optionType === "divider") return;
|
|
7148
|
-
setActive(option.value);
|
|
7149
|
-
onChange(multiple ? selected.has(option.value) ? value.filter((item) => item !== option.value) : [...value, option.value] : [option.value]);
|
|
7150
|
-
}
|
|
7151
|
-
function batch(operation) {
|
|
7152
|
-
if (disabled || loading) return;
|
|
7153
|
-
if (operation === "clear") {
|
|
7154
|
-
onChange([]);
|
|
7155
|
-
return;
|
|
7156
|
-
}
|
|
7157
|
-
const editable = new Set(enabled.map((option) => option.value));
|
|
7158
|
-
const retained = value.filter((item) => !editable.has(item));
|
|
7159
|
-
const add = enabled.filter((option) => operation === "all" || !selected.has(option.value)).map((option) => option.value);
|
|
7160
|
-
onChange([...retained, ...add]);
|
|
7161
|
-
}
|
|
7162
|
-
return /* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel", children: [
|
|
7163
|
-
showSearch && /* @__PURE__ */ jsx23(
|
|
7164
|
-
Input,
|
|
7165
|
-
{
|
|
7166
|
-
"aria-label": "\u641C\u7D22\u9009\u9879",
|
|
7167
|
-
placeholder: "\u641C\u7D22",
|
|
7168
|
-
autoFocus: autoFocusSearch,
|
|
7169
|
-
value: search,
|
|
7170
|
-
allowClear: true,
|
|
7171
|
-
onChange: (event) => {
|
|
7172
|
-
setLocalSearch(event.target.value);
|
|
7173
|
-
onSearch?.(event.target.value);
|
|
7174
|
-
}
|
|
7175
|
-
}
|
|
7176
|
-
),
|
|
7177
|
-
multiple && /* @__PURE__ */ jsxs22("div", { className: "sia-selection-panel__actions", children: [
|
|
7178
|
-
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("all"), children: "\u5168\u9009" }),
|
|
7179
|
-
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
7180
|
-
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || loading || !value.length, onClick: () => batch("clear"), children: "\u6E05\u7A7A" }),
|
|
7181
|
-
/* @__PURE__ */ jsxs22("span", { children: [
|
|
7182
|
-
"\u5DF2\u9009 ",
|
|
7183
|
-
value.length,
|
|
7184
|
-
" \u9879"
|
|
7185
|
-
] })
|
|
7186
|
-
] }),
|
|
7187
|
-
/* @__PURE__ */ jsx23(
|
|
7188
|
-
"div",
|
|
7189
|
-
{
|
|
7190
|
-
ref: listRef,
|
|
7191
|
-
role: "listbox",
|
|
7192
|
-
"aria-label": "\u9009\u9879\u5217\u8868",
|
|
7193
|
-
"aria-multiselectable": multiple || void 0,
|
|
7194
|
-
tabIndex: disabled ? -1 : 0,
|
|
7195
|
-
className: "sia-selection-panel__list",
|
|
7196
|
-
style: { maxHeight },
|
|
7197
|
-
onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
|
|
7198
|
-
"aria-activedescendant": active !== void 0 ? `${id}-${typeof active}-${active}` : void 0,
|
|
7199
|
-
onKeyDown: (event) => {
|
|
7200
|
-
if (disabled || loading || !enabled.length) return;
|
|
7201
|
-
const index = enabled.findIndex((option) => option.value === active);
|
|
7202
|
-
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
7203
|
-
event.preventDefault();
|
|
7204
|
-
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)));
|
|
7205
|
-
const option = enabled[next];
|
|
7206
|
-
setActive(option.value);
|
|
7207
|
-
const row = rows.find((row2) => row2.items?.includes(option));
|
|
7208
|
-
if (row && listRef.current) {
|
|
7209
|
-
listRef.current.scrollTop = Math.max(0, row.top - maxHeight / 2);
|
|
7210
|
-
setScrollTop(listRef.current.scrollTop);
|
|
7211
|
-
}
|
|
7212
|
-
} else if ((event.key === "Enter" || event.key === " ") && index >= 0) {
|
|
7213
|
-
event.preventDefault();
|
|
7214
|
-
toggle(enabled[index]);
|
|
7215
|
-
}
|
|
7216
|
-
},
|
|
7217
|
-
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(
|
|
7218
|
-
"div",
|
|
7219
|
-
{
|
|
7220
|
-
className: row.title !== void 0 ? "sia-selection-panel__group" : "sia-selection-panel__row",
|
|
7221
|
-
style: { position: "absolute", top: row.top, height: row.height, width: "100%", gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))` },
|
|
7222
|
-
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(
|
|
7223
|
-
"button",
|
|
7224
|
-
{
|
|
7225
|
-
type: "button",
|
|
7226
|
-
role: "option",
|
|
7227
|
-
id: `${id}-${typeof option.value}-${option.value}`,
|
|
7228
|
-
tabIndex: -1,
|
|
7229
|
-
"aria-selected": selected.has(option.value),
|
|
7230
|
-
"aria-disabled": disabled || option.disabled || void 0,
|
|
7231
|
-
className: `sia-selection-panel__option${active === option.value ? " is-active" : ""}`,
|
|
7232
|
-
onClick: () => toggle(option),
|
|
7233
|
-
children: [
|
|
7234
|
-
multiple && /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: "sia-selection-panel__check", children: selected.has(option.value) ? "\u2713" : "" }),
|
|
7235
|
-
/* @__PURE__ */ jsxs22("span", { className: "sia-selection-panel__text", children: [
|
|
7236
|
-
showValue || displayField === "label" ? option.label : String(option.value),
|
|
7237
|
-
showValue && /* @__PURE__ */ jsx23("small", { children: String(option.value) })
|
|
7238
|
-
] })
|
|
7239
|
-
]
|
|
7240
|
-
}
|
|
7241
|
-
) }, `${typeof option.value}-${option.value}`))
|
|
7242
|
-
},
|
|
7243
|
-
row.key
|
|
7244
|
-
)) })
|
|
7245
|
-
}
|
|
7246
|
-
)
|
|
7247
|
-
] });
|
|
7248
|
-
}
|
|
7249
|
-
|
|
7250
7096
|
// src/components/InputSelect.tsx
|
|
7251
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
7252
|
-
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";
|
|
7253
7099
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
7254
7100
|
options,
|
|
7255
7101
|
value,
|
|
@@ -7275,22 +7121,22 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7275
7121
|
onOpenChange,
|
|
7276
7122
|
...inputProps
|
|
7277
7123
|
}, forwardedRef) {
|
|
7278
|
-
const [internal, setInternal] =
|
|
7124
|
+
const [internal, setInternal] = useState18(defaultValue);
|
|
7279
7125
|
const current = value !== void 0 ? value : internal;
|
|
7280
7126
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
7281
7127
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
7282
|
-
const [draft, setDraft] =
|
|
7283
|
-
|
|
7128
|
+
const [draft, setDraft] = useState18(text);
|
|
7129
|
+
useEffect15(() => {
|
|
7284
7130
|
setDraft(text);
|
|
7285
7131
|
}, [text, current]);
|
|
7286
|
-
const [open, setOpen] =
|
|
7287
|
-
const [search, setSearch] =
|
|
7288
|
-
const [modalOpen, setModalOpen] =
|
|
7289
|
-
const [modalValues, setModalValues] =
|
|
7290
|
-
const [selectedOnly, setSelectedOnly] =
|
|
7291
|
-
const rootRef =
|
|
7292
|
-
const popupRef =
|
|
7293
|
-
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);
|
|
7294
7140
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
7295
7141
|
function changeOpen(next) {
|
|
7296
7142
|
if (next && (disabled || loading)) return;
|
|
@@ -7310,7 +7156,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7310
7156
|
inputRef.current?.focus();
|
|
7311
7157
|
}
|
|
7312
7158
|
}
|
|
7313
|
-
|
|
7159
|
+
useEffect15(() => {
|
|
7314
7160
|
if (!open) return;
|
|
7315
7161
|
const outside = (event) => {
|
|
7316
7162
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -7318,7 +7164,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7318
7164
|
document.addEventListener("pointerdown", outside);
|
|
7319
7165
|
return () => document.removeEventListener("pointerdown", outside);
|
|
7320
7166
|
}, [open, onOpenChange]);
|
|
7321
|
-
|
|
7167
|
+
useEffect15(() => {
|
|
7322
7168
|
if (disabled || loading) {
|
|
7323
7169
|
changeOpen(false);
|
|
7324
7170
|
setModalOpen(false);
|
|
@@ -7331,14 +7177,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7331
7177
|
setSelectedOnly(false);
|
|
7332
7178
|
setModalOpen(true);
|
|
7333
7179
|
}
|
|
7334
|
-
return /* @__PURE__ */
|
|
7180
|
+
return /* @__PURE__ */ jsxs22("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
7335
7181
|
if (event.key === "Escape" && open) {
|
|
7336
7182
|
event.stopPropagation();
|
|
7337
7183
|
changeOpen(false);
|
|
7338
7184
|
inputRef.current?.focus();
|
|
7339
7185
|
}
|
|
7340
7186
|
}, children: [
|
|
7341
|
-
/* @__PURE__ */
|
|
7187
|
+
/* @__PURE__ */ jsx23(
|
|
7342
7188
|
Input,
|
|
7343
7189
|
{
|
|
7344
7190
|
...inputProps,
|
|
@@ -7375,26 +7221,26 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7375
7221
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
7376
7222
|
changeOpen(true);
|
|
7377
7223
|
},
|
|
7378
|
-
suffix: /* @__PURE__ */
|
|
7379
|
-
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) => {
|
|
7380
7226
|
event.stopPropagation();
|
|
7381
7227
|
setDraft("");
|
|
7382
7228
|
emit(multiple ? [] : void 0);
|
|
7383
7229
|
inputRef.current?.focus();
|
|
7384
7230
|
}, children: "\xD7" }),
|
|
7385
7231
|
suffix,
|
|
7386
|
-
enableModal && /* @__PURE__ */
|
|
7232
|
+
enableModal && /* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
7387
7233
|
event.stopPropagation();
|
|
7388
7234
|
openModal();
|
|
7389
7235
|
}, children: "\u2026" }),
|
|
7390
|
-
/* @__PURE__ */
|
|
7236
|
+
/* @__PURE__ */ jsx23(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
7391
7237
|
event.stopPropagation();
|
|
7392
7238
|
changeOpen(!open);
|
|
7393
|
-
}, children: /* @__PURE__ */
|
|
7239
|
+
}, children: /* @__PURE__ */ jsx23(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
7394
7240
|
] })
|
|
7395
7241
|
}
|
|
7396
7242
|
),
|
|
7397
|
-
/* @__PURE__ */
|
|
7243
|
+
/* @__PURE__ */ jsx23(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx23(
|
|
7398
7244
|
SelectionPanel,
|
|
7399
7245
|
{
|
|
7400
7246
|
options,
|
|
@@ -7409,7 +7255,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7409
7255
|
onSearch: setSearch
|
|
7410
7256
|
}
|
|
7411
7257
|
) }),
|
|
7412
|
-
enableModal && /* @__PURE__ */
|
|
7258
|
+
enableModal && /* @__PURE__ */ jsxs22(
|
|
7413
7259
|
Modal,
|
|
7414
7260
|
{
|
|
7415
7261
|
open: modalOpen,
|
|
@@ -7422,15 +7268,15 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7422
7268
|
setModalOpen(false);
|
|
7423
7269
|
},
|
|
7424
7270
|
children: [
|
|
7425
|
-
/* @__PURE__ */
|
|
7426
|
-
/* @__PURE__ */
|
|
7427
|
-
/* @__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: [
|
|
7428
7274
|
"\u5DF2\u9009\u9879(",
|
|
7429
7275
|
modalValues.length,
|
|
7430
7276
|
")"
|
|
7431
7277
|
] })
|
|
7432
7278
|
] }),
|
|
7433
|
-
modalOpen && /* @__PURE__ */
|
|
7279
|
+
modalOpen && /* @__PURE__ */ jsx23(
|
|
7434
7280
|
SelectionPanel,
|
|
7435
7281
|
{
|
|
7436
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.js';
|
|
4
|
-
import { c as SelectOption, e as SelectValue } from './Select-
|
|
4
|
+
import { c as SelectOption, e as SelectValue } from './Select-Ce2Irbpt.js';
|
|
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.cjs';
|
|
4
|
-
import { c as SelectOption, e as SelectValue } from './Select-
|
|
4
|
+
import { c as SelectOption, e as SelectValue } from './Select-CVvF4mcy.cjs';
|
|
5
5
|
|
|
6
6
|
type DatePickerShowTime = boolean | {
|
|
7
7
|
showSecond?: boolean;
|