@sia.soul/sia-react-ui 0.1.131 → 0.1.134
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/{chunk-NYU3DJVZ.js → chunk-436QH6XH.js} +10 -2
- package/dist/{chunk-OHIBJFX5.js → chunk-4KNFPQEV.js} +2 -2
- package/dist/{chunk-J3RX7GCZ.js → chunk-L2S7IPSM.js} +1 -1
- package/dist/{chunk-EWEDQ3VJ.js → chunk-UVHC6OEX.js} +70 -5
- package/dist/{chunk-RC5MXFLI.js → chunk-WIRIEIRO.js} +1 -1
- package/dist/{core-DoyeSoBN.d.ts → core-Bkk7-59o.d.ts} +3 -3
- package/dist/{core-DUmn3A2b.d.cts → core-lZIzt-an.d.cts} +3 -3
- package/dist/core.cjs +74 -5
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +3 -3
- package/dist/index.cjs +221 -49
- package/dist/index.css +52 -0
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +147 -44
- package/dist/rich-text-editor.cjs +58 -5
- package/dist/rich-text-editor.js +2 -2
- package/dist/select-date-range.cjs +19 -0
- package/dist/select-date-range.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-4KNFPQEV.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
@@ -90,12 +90,12 @@ import {
|
|
|
90
90
|
import {
|
|
91
91
|
RichTextContent,
|
|
92
92
|
RichTextEditor
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-WIRIEIRO.js";
|
|
94
94
|
import {
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-L2S7IPSM.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
FloatingScrollbarProvider,
|
|
@@ -107,14 +107,14 @@ import {
|
|
|
107
107
|
Tooltip,
|
|
108
108
|
Tree,
|
|
109
109
|
useScrollbarProximity
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-436QH6XH.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
114
114
|
Menu,
|
|
115
115
|
Segmented,
|
|
116
116
|
Steps
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-UVHC6OEX.js";
|
|
118
118
|
import {
|
|
119
119
|
TextArea
|
|
120
120
|
} from "./chunk-SCEHVGKV.js";
|
|
@@ -5698,6 +5698,46 @@ function createRowIdentity() {
|
|
|
5698
5698
|
};
|
|
5699
5699
|
}
|
|
5700
5700
|
|
|
5701
|
+
// src/components/Table/cellFocus.ts
|
|
5702
|
+
function playCellFocusGlow(cell, isVisible, onFinish) {
|
|
5703
|
+
const namespace = "http://www.w3.org/2000/svg";
|
|
5704
|
+
const glow = document.createElementNS(namespace, "svg");
|
|
5705
|
+
glow.classList.add("sia-table__cell-focus-glow");
|
|
5706
|
+
glow.setAttribute("aria-hidden", "true");
|
|
5707
|
+
const paths = [12, 6, 2].map((length) => {
|
|
5708
|
+
const path = document.createElementNS(namespace, "path");
|
|
5709
|
+
path.setAttribute("pathLength", "100");
|
|
5710
|
+
path.style.setProperty("--sia-cell-focus-tail", String(length));
|
|
5711
|
+
path.setAttribute("stroke-dasharray", `${length} ${100 - length}`);
|
|
5712
|
+
glow.appendChild(path);
|
|
5713
|
+
return path;
|
|
5714
|
+
});
|
|
5715
|
+
let frame = 0, disposed = false;
|
|
5716
|
+
const cleanup = () => {
|
|
5717
|
+
if (disposed) return;
|
|
5718
|
+
disposed = true;
|
|
5719
|
+
cancelAnimationFrame(frame);
|
|
5720
|
+
glow.remove();
|
|
5721
|
+
onFinish();
|
|
5722
|
+
};
|
|
5723
|
+
const position = () => {
|
|
5724
|
+
if (!cell.isConnected || !isVisible()) {
|
|
5725
|
+
cleanup();
|
|
5726
|
+
return;
|
|
5727
|
+
}
|
|
5728
|
+
const rect = cell.getBoundingClientRect();
|
|
5729
|
+
Object.assign(glow.style, { left: `${rect.left}px`, top: `${rect.top}px`, width: `${rect.width}px`, height: `${rect.height}px` });
|
|
5730
|
+
paths.forEach((path) => path.setAttribute("d", `M 1.5 1.5 H ${rect.width - 1.5} V ${rect.height - 1.5} H 1.5 Z`));
|
|
5731
|
+
frame = requestAnimationFrame(position);
|
|
5732
|
+
};
|
|
5733
|
+
position();
|
|
5734
|
+
if (!disposed) document.body.appendChild(glow);
|
|
5735
|
+
glow.addEventListener("animationend", (event) => {
|
|
5736
|
+
if (event.target === glow) cleanup();
|
|
5737
|
+
});
|
|
5738
|
+
return cleanup;
|
|
5739
|
+
}
|
|
5740
|
+
|
|
5701
5741
|
// src/components/Table/Table.tsx
|
|
5702
5742
|
import { Fragment as Fragment9, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect15, useImperativeHandle, useMemo as useMemo9, useRef as useRef19, useState as useState22 } from "react";
|
|
5703
5743
|
|
|
@@ -8448,6 +8488,12 @@ function TableInner(props, ref) {
|
|
|
8448
8488
|
const rootRef = useRef19(null);
|
|
8449
8489
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
8450
8490
|
const scrollRef = useRef19(null);
|
|
8491
|
+
const cellFocusRequest = useRef19(0);
|
|
8492
|
+
const cellGlow = useRef19(null);
|
|
8493
|
+
useEffect15(() => () => {
|
|
8494
|
+
cellFocusRequest.current++;
|
|
8495
|
+
cellGlow.current?.();
|
|
8496
|
+
}, []);
|
|
8451
8497
|
const tableRef = useRef19(null);
|
|
8452
8498
|
useScrollbarProximity();
|
|
8453
8499
|
const scrollbarDragRef = useRef19(null);
|
|
@@ -8798,44 +8844,100 @@ function TableInner(props, ref) {
|
|
|
8798
8844
|
scrollbarDragRef.current = null;
|
|
8799
8845
|
if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
|
|
8800
8846
|
}, []);
|
|
8801
|
-
useImperativeHandle(ref, () =>
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8847
|
+
useImperativeHandle(ref, () => {
|
|
8848
|
+
const api = {
|
|
8849
|
+
getRows: () => pipeline.rows.map((row) => row.record),
|
|
8850
|
+
getColumns: () => pipeline.columns,
|
|
8851
|
+
getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
|
|
8852
|
+
scrollTo: (options) => scrollRef.current?.scrollTo(options),
|
|
8853
|
+
scrollToRow: (key) => {
|
|
8854
|
+
const viewport = scrollRef.current;
|
|
8855
|
+
const table = tableRef.current;
|
|
8856
|
+
const index = pipeline.rows.findIndex((row2) => row2.key === key);
|
|
8857
|
+
if (!viewport || !table || !viewport.clientHeight || index < 0) return false;
|
|
8858
|
+
const row = Array.from(table.tBodies[0]?.rows ?? []).find((element) => element.dataset.rowKey === String(key));
|
|
8859
|
+
const headerHeight = table.tHead?.offsetHeight ?? headerRows.length * rowHeight;
|
|
8860
|
+
const top = row ? row.getBoundingClientRect().top - viewport.getBoundingClientRect().top - viewport.clientTop + viewport.scrollTop : headerHeight + index * rowHeight;
|
|
8861
|
+
const height2 = row?.offsetHeight ?? rowHeight;
|
|
8862
|
+
const headerInset = stickyHeader ? headerHeight : 0;
|
|
8863
|
+
const footerInset = table.tFoot?.offsetHeight ?? 0;
|
|
8864
|
+
const visibleTop = viewport.scrollTop + headerInset;
|
|
8865
|
+
const visibleBottom = viewport.scrollTop + viewport.clientHeight - footerInset;
|
|
8866
|
+
if (top < visibleTop || height2 > visibleBottom - visibleTop) viewport.scrollTop = Math.max(0, top - headerInset);
|
|
8867
|
+
else if (top + height2 > visibleBottom) viewport.scrollTop = top + height2 - viewport.clientHeight + footerInset;
|
|
8868
|
+
if (shouldVirtualize) setScrollTop(viewport.scrollTop);
|
|
8869
|
+
updateScrollMetrics();
|
|
8870
|
+
return true;
|
|
8871
|
+
},
|
|
8872
|
+
focusCell: async (key, columnKey, options) => {
|
|
8873
|
+
const request = ++cellFocusRequest.current;
|
|
8874
|
+
cellGlow.current?.();
|
|
8875
|
+
cellGlow.current = null;
|
|
8876
|
+
const viewport = scrollRef.current;
|
|
8877
|
+
const columnIndex = leafColumns.findIndex((column2) => column2.key === columnKey);
|
|
8878
|
+
if (!viewport || columnIndex < 0 || !api.scrollToRow(key)) return false;
|
|
8879
|
+
const column = leafColumns[columnIndex];
|
|
8880
|
+
if (!normalizeFixed(column.fixed)) {
|
|
8881
|
+
const start = leafColumns.slice(0, columnIndex).reduce((sum, item) => sum + (columnWidths.get(item.key) ?? DEFAULT_WIDTH), 0);
|
|
8882
|
+
const width = columnWidths.get(columnKey) ?? DEFAULT_WIDTH;
|
|
8883
|
+
const visibleWidth = viewport.clientWidth - left - right;
|
|
8884
|
+
if (start < viewport.scrollLeft + left || width > visibleWidth) viewport.scrollLeft = Math.max(0, start - left);
|
|
8885
|
+
else if (start + width > viewport.scrollLeft + viewport.clientWidth - right) viewport.scrollLeft = start + width - viewport.clientWidth + right;
|
|
8886
|
+
if (canvas) setScrollLeft(viewport.scrollLeft);
|
|
8887
|
+
}
|
|
8888
|
+
updateScrollMetrics();
|
|
8889
|
+
let previousRect;
|
|
8890
|
+
for (let frame = 0; frame < 20; frame++) {
|
|
8891
|
+
await new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
8892
|
+
if (request !== cellFocusRequest.current || !viewport.isConnected || !viewport.clientHeight) return false;
|
|
8893
|
+
const row = Array.from(tableRef.current?.tBodies[0]?.rows ?? []).find((item) => item.dataset.rowKey === String(key));
|
|
8894
|
+
const cell = Array.from(row?.cells ?? []).find((item) => item.dataset.columnKey === columnKey);
|
|
8895
|
+
if (!cell || !cell.offsetWidth) continue;
|
|
8896
|
+
api.scrollToRow(key);
|
|
8897
|
+
const visible = () => {
|
|
8898
|
+
if (!cell.isConnected || !viewport.clientHeight || !cell.offsetWidth) return false;
|
|
8899
|
+
const bounds = viewport.getBoundingClientRect(), rect2 = cell.getBoundingClientRect();
|
|
8900
|
+
const top = bounds.top + viewport.clientTop + (stickyHeader ? tableRef.current?.tHead?.offsetHeight ?? 0 : 0);
|
|
8901
|
+
const bottom = bounds.top + viewport.clientTop + viewport.clientHeight - (tableRef.current?.tFoot?.offsetHeight ?? 0);
|
|
8902
|
+
const fixed = normalizeFixed(column.fixed);
|
|
8903
|
+
return rect2.top >= Math.max(0, top) - 1 && rect2.bottom <= Math.min(window.innerHeight, bottom) + 1 && rect2.left >= Math.max(0, bounds.left + viewport.clientLeft + (fixed ? 0 : left)) - 1 && rect2.right <= Math.min(window.innerWidth, bounds.left + viewport.clientLeft + viewport.clientWidth - (fixed ? 0 : right)) + 1;
|
|
8904
|
+
};
|
|
8905
|
+
const rect = cell.getBoundingClientRect();
|
|
8906
|
+
const stable = previousRect && Math.abs(rect.top - previousRect.top) < 0.5 && Math.abs(rect.left - previousRect.left) < 0.5 && Math.abs(rect.width - previousRect.width) < 0.5 && Math.abs(rect.height - previousRect.height) < 0.5;
|
|
8907
|
+
previousRect = rect;
|
|
8908
|
+
if (!visible() || !stable) continue;
|
|
8909
|
+
const address = { rowKey: key, columnKey };
|
|
8910
|
+
pluginApisRef.current.cellSelection?.setRange({ anchor: address, focus: address });
|
|
8911
|
+
cell.tabIndex = -1;
|
|
8912
|
+
cell.focus({ preventScroll: true });
|
|
8913
|
+
await new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
8914
|
+
if (request !== cellFocusRequest.current || !visible()) return false;
|
|
8915
|
+
if (options?.highlight !== false) {
|
|
8916
|
+
const cleanup = playCellFocusGlow(cell, visible, () => {
|
|
8917
|
+
cellGlow.current = null;
|
|
8918
|
+
});
|
|
8919
|
+
cellGlow.current = cleanup;
|
|
8920
|
+
}
|
|
8921
|
+
return true;
|
|
8922
|
+
}
|
|
8923
|
+
return false;
|
|
8924
|
+
},
|
|
8925
|
+
setLoading: setInternalLoading,
|
|
8926
|
+
getPage: () => pluginApisRef.current.pagination?.getPage?.() ?? { current: 1, pageSize: dataSource.length || 25 },
|
|
8927
|
+
setPage: (page) => pluginApisRef.current.pagination?.setPage?.(page),
|
|
8928
|
+
clearSelection: () => pluginApisRef.current.selection?.clear?.(),
|
|
8929
|
+
setSelectedKeys: (keys) => pluginApisRef.current.selection?.setSelectedKeys?.(keys),
|
|
8930
|
+
getSelectedRows: () => pluginApisRef.current.selection?.getSelectedRows?.() ?? [],
|
|
8931
|
+
getSortInfo: () => pluginApisRef.current.sort?.getSortInfo?.() ?? null,
|
|
8932
|
+
getColumnSettings: () => pluginApisRef.current.columnSetting?.getSettings?.() ?? [],
|
|
8933
|
+
openColumnSetting: () => pluginApisRef.current.columnSetting?.open?.(),
|
|
8934
|
+
generatePageParams: (model) => pluginApisRef.current.pagination?.generatePageParams?.(model) ?? model,
|
|
8935
|
+
requestCount: async (model) => {
|
|
8936
|
+
await pluginApisRef.current.pagination?.requestCount?.(model);
|
|
8937
|
+
}
|
|
8938
|
+
};
|
|
8939
|
+
return api;
|
|
8940
|
+
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
8839
8941
|
const coreContext = {
|
|
8840
8942
|
pluginId: "core",
|
|
8841
8943
|
sourceData: dataSource,
|
|
@@ -9573,7 +9675,8 @@ function createWorksheetPlugin(options) {
|
|
|
9573
9675
|
...column,
|
|
9574
9676
|
render: (value, record, index, info) => {
|
|
9575
9677
|
const area = bounds(), cols = columns();
|
|
9576
|
-
const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key &&
|
|
9678
|
+
const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && // 填充入口与编辑权限一致,避免只读格或保存锁定后仍暗示可以拖拽修改。
|
|
9679
|
+
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
9577
9680
|
return /* @__PURE__ */ jsxs24(Fragment10, { children: [
|
|
9578
9681
|
render ? render(value, record, index, info) : value,
|
|
9579
9682
|
handle && /* @__PURE__ */ jsx26(
|
|
@@ -1582,10 +1582,25 @@ var Icon = (0, import_react5.forwardRef)(function Icon2({ name, tone = "inherit"
|
|
|
1582
1582
|
|
|
1583
1583
|
// src/components/Navigation.tsx
|
|
1584
1584
|
var import_react6 = require("react");
|
|
1585
|
+
|
|
1586
|
+
// src/components/floatingScrollbarOwnership.ts
|
|
1587
|
+
var targets = /* @__PURE__ */ new Map();
|
|
1588
|
+
function resolveFloatingScrollbarTarget(target) {
|
|
1589
|
+
const track = target instanceof Element ? target.closest(".sia-floating-scrollbar") : null;
|
|
1590
|
+
return track && targets.get(track)?.target || target;
|
|
1591
|
+
}
|
|
1592
|
+
function hasFloatingScrollbarInteraction(container) {
|
|
1593
|
+
if (!container) return false;
|
|
1594
|
+
return [...targets].some(([track, entry]) => container.contains(entry.target) && (entry.dragging || track.matches(":hover")));
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// src/components/Navigation.tsx
|
|
1585
1598
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1586
1599
|
var import_react7 = require("react");
|
|
1587
1600
|
function MenuPopup({
|
|
1588
1601
|
anchorRef,
|
|
1602
|
+
popupRef,
|
|
1603
|
+
keyPath,
|
|
1589
1604
|
open,
|
|
1590
1605
|
placement,
|
|
1591
1606
|
menuId,
|
|
@@ -1616,13 +1631,15 @@ function MenuPopup({
|
|
|
1616
1631
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1617
1632
|
PopupPortal,
|
|
1618
1633
|
{
|
|
1634
|
+
ref: popupRef,
|
|
1619
1635
|
anchorRef,
|
|
1620
1636
|
open: mounted,
|
|
1621
1637
|
placement,
|
|
1622
|
-
offset: 4,
|
|
1638
|
+
offset: placement.startsWith("right") || placement.startsWith("left") ? 16 : 4,
|
|
1623
1639
|
className: `sia-menu__popup sia-menu--${theme}${open ? " is-open" : " is-closing"}`,
|
|
1624
1640
|
style: { fontSize },
|
|
1625
1641
|
"data-sia-menu-owner": menuId,
|
|
1642
|
+
"data-sia-menu-path": JSON.stringify(keyPath),
|
|
1626
1643
|
onMouseEnter,
|
|
1627
1644
|
onMouseLeave,
|
|
1628
1645
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "sia-menu__popup-list", role: "menu", children })
|
|
@@ -1637,7 +1654,12 @@ function MenuEntry({
|
|
|
1637
1654
|
reserveIcon
|
|
1638
1655
|
}) {
|
|
1639
1656
|
const anchorRef = (0, import_react6.useRef)(null);
|
|
1657
|
+
const popupRef = (0, import_react6.useRef)(null);
|
|
1640
1658
|
const closeTimerRef = (0, import_react6.useRef)(void 0);
|
|
1659
|
+
const toggleRef = (0, import_react6.useRef)(props.toggle);
|
|
1660
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1661
|
+
toggleRef.current = props.toggle;
|
|
1662
|
+
});
|
|
1641
1663
|
const hasChildren = Boolean(item.children?.length);
|
|
1642
1664
|
const isOpen = props.open.includes(item.key);
|
|
1643
1665
|
const isSelected = props.selected.includes(item.key);
|
|
@@ -1655,7 +1677,14 @@ function MenuEntry({
|
|
|
1655
1677
|
}
|
|
1656
1678
|
function scheduleClose() {
|
|
1657
1679
|
cancelClose();
|
|
1658
|
-
closeTimerRef.current = window.setTimeout(() =>
|
|
1680
|
+
closeTimerRef.current = window.setTimeout(() => {
|
|
1681
|
+
const interacting = hasFloatingScrollbarInteraction(popupRef.current) || [...document.querySelectorAll(".sia-menu__popup[data-sia-menu-owner]")].some((popup) => popup.dataset.siaMenuOwner === props.menuId && JSON.parse(popup.dataset.siaMenuPath ?? "[]").includes(item.key) && hasFloatingScrollbarInteraction(popup));
|
|
1682
|
+
if (interacting) {
|
|
1683
|
+
scheduleClose();
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
toggleRef.current(item.key, false);
|
|
1687
|
+
}, 100);
|
|
1659
1688
|
}
|
|
1660
1689
|
const hover = props.triggerSubMenuAction === "hover" && hasChildren && !inlineSubmenu;
|
|
1661
1690
|
const submenu = hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
|
|
@@ -1698,6 +1727,8 @@ function MenuEntry({
|
|
|
1698
1727
|
MenuPopup,
|
|
1699
1728
|
{
|
|
1700
1729
|
anchorRef,
|
|
1730
|
+
popupRef,
|
|
1731
|
+
keyPath: path,
|
|
1701
1732
|
open: isOpen,
|
|
1702
1733
|
placement: popupPlacement,
|
|
1703
1734
|
menuId: props.menuId,
|
|
@@ -1758,6 +1789,22 @@ function Menu({
|
|
|
1758
1789
|
const rootRef = (0, import_react6.useRef)(null);
|
|
1759
1790
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
1760
1791
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
1792
|
+
const pendingOpenRef = (0, import_react6.useRef)(open);
|
|
1793
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
1794
|
+
pendingOpenRef.current = open;
|
|
1795
|
+
});
|
|
1796
|
+
const popupPaths = (0, import_react6.useMemo)(() => {
|
|
1797
|
+
const paths = /* @__PURE__ */ new Map();
|
|
1798
|
+
const visit = (entries, parents) => {
|
|
1799
|
+
for (const entry of entries) {
|
|
1800
|
+
const path = [...parents, entry.key];
|
|
1801
|
+
paths.set(entry.key, path);
|
|
1802
|
+
if (entry.children) visit(entry.children, path);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
visit(items, []);
|
|
1806
|
+
return paths;
|
|
1807
|
+
}, [items]);
|
|
1761
1808
|
const revealedKey = (0, import_react6.useRef)();
|
|
1762
1809
|
const firstSelected = selected[0];
|
|
1763
1810
|
(0, import_react6.useLayoutEffect)(() => {
|
|
@@ -1785,7 +1832,7 @@ function Menu({
|
|
|
1785
1832
|
(0, import_react6.useEffect)(() => {
|
|
1786
1833
|
if (mode === "inline" || !open.length) return void 0;
|
|
1787
1834
|
const closeOutside = (event) => {
|
|
1788
|
-
const target = event.target;
|
|
1835
|
+
const target = resolveFloatingScrollbarTarget(event.target);
|
|
1789
1836
|
if (rootRef.current?.contains(target)) return;
|
|
1790
1837
|
const owner = target instanceof Element ? target.closest("[data-sia-menu-owner]")?.getAttribute("data-sia-menu-owner") : null;
|
|
1791
1838
|
if (owner !== menuId) setOpen([]);
|
|
@@ -1794,8 +1841,14 @@ function Menu({
|
|
|
1794
1841
|
return () => document.removeEventListener("pointerdown", closeOutside);
|
|
1795
1842
|
}, [menuId, mode, open.length, setOpen]);
|
|
1796
1843
|
function toggle(key, force) {
|
|
1797
|
-
const
|
|
1798
|
-
|
|
1844
|
+
const current = pendingOpenRef.current;
|
|
1845
|
+
const shouldOpen = force ?? !current.includes(key);
|
|
1846
|
+
if (shouldOpen === current.includes(key)) return;
|
|
1847
|
+
const cascading = mode !== "inline" || inlineCollapsed;
|
|
1848
|
+
const branch = popupPaths.get(key) ?? [key];
|
|
1849
|
+
const next = shouldOpen ? [...current.filter((item) => !cascading || branch.includes(item)), key] : current.filter((item) => item !== key && (!cascading || !popupPaths.get(item)?.includes(key)));
|
|
1850
|
+
pendingOpenRef.current = next;
|
|
1851
|
+
setOpen(next);
|
|
1799
1852
|
}
|
|
1800
1853
|
function select(item, keyPath, domEvent) {
|
|
1801
1854
|
const info = { key: item.key, keyPath, domEvent, item };
|
package/dist/rich-text-editor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RichTextContent,
|
|
3
3
|
RichTextEditor
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-WIRIEIRO.js";
|
|
5
|
+
import "./chunk-UVHC6OEX.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
7
|
import "./chunk-PQBCD54U.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|
|
@@ -1565,6 +1565,19 @@ function useScrollbarProximity() {
|
|
|
1565
1565
|
}, []);
|
|
1566
1566
|
}
|
|
1567
1567
|
|
|
1568
|
+
// src/components/floatingScrollbarOwnership.ts
|
|
1569
|
+
var targets = /* @__PURE__ */ new Map();
|
|
1570
|
+
function registerFloatingScrollbar(track, target) {
|
|
1571
|
+
targets.set(track, { target, dragging: false });
|
|
1572
|
+
return () => {
|
|
1573
|
+
targets.delete(track);
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
function setFloatingScrollbarDragging(track, dragging) {
|
|
1577
|
+
const entry = targets.get(track);
|
|
1578
|
+
if (entry) entry.dragging = dragging;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1568
1581
|
// src/components/FloatingScrollbarProvider.tsx
|
|
1569
1582
|
var scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
1570
1583
|
var clippingOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
|
|
@@ -1724,6 +1737,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1724
1737
|
event.preventDefault();
|
|
1725
1738
|
event.stopPropagation();
|
|
1726
1739
|
entry.dragging = true;
|
|
1740
|
+
setFloatingScrollbarDragging(track, true);
|
|
1727
1741
|
showEntry(entry);
|
|
1728
1742
|
thumb.setPointerCapture(event.pointerId);
|
|
1729
1743
|
const startPointer = axis === "vertical" ? event.clientY : event.clientX;
|
|
@@ -1744,6 +1758,7 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1744
1758
|
const onPointerUp = (upEvent) => {
|
|
1745
1759
|
if (upEvent.pointerId !== event.pointerId) return;
|
|
1746
1760
|
entry.dragging = false;
|
|
1761
|
+
setFloatingScrollbarDragging(track, false);
|
|
1747
1762
|
thumb.releasePointerCapture(event.pointerId);
|
|
1748
1763
|
window.removeEventListener("pointermove", onPointerMove);
|
|
1749
1764
|
window.removeEventListener("pointerup", onPointerUp);
|
|
@@ -1775,6 +1790,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1775
1790
|
if (entries.has(target)) return;
|
|
1776
1791
|
const horizontal = createTrack("horizontal");
|
|
1777
1792
|
const vertical = createTrack("vertical");
|
|
1793
|
+
const releaseHorizontalOwner = registerFloatingScrollbar(horizontal.track, target);
|
|
1794
|
+
const releaseVerticalOwner = registerFloatingScrollbar(vertical.track, target);
|
|
1778
1795
|
layer.append(horizontal.track, vertical.track);
|
|
1779
1796
|
const onPointerEnter = () => {
|
|
1780
1797
|
const entry2 = entries.get(target);
|
|
@@ -1816,6 +1833,8 @@ function FloatingScrollbarProvider({ disabled = false, targetRef }) {
|
|
|
1816
1833
|
if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
|
|
1817
1834
|
cleanupHorizontal();
|
|
1818
1835
|
cleanupVertical();
|
|
1836
|
+
releaseHorizontalOwner();
|
|
1837
|
+
releaseVerticalOwner();
|
|
1819
1838
|
target.removeEventListener("pointerenter", onPointerEnter);
|
|
1820
1839
|
target.removeEventListener("pointerleave", onPointerLeave);
|
|
1821
1840
|
target.removeEventListener("scroll", onScroll);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectDateRange
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-L2S7IPSM.js";
|
|
4
|
+
import "./chunk-436QH6XH.js";
|
|
5
|
+
import "./chunk-UVHC6OEX.js";
|
|
6
6
|
import "./chunk-SCEHVGKV.js";
|
|
7
7
|
import "./chunk-PQBCD54U.js";
|
|
8
8
|
import "./chunk-CZ2ITBRW.js";
|