@sheetxl/react 0.8.0-beta.1 → 0.8.0-beta.10
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/browser/esm/BHjeSMaycUkS5dVL.mjs +66 -0
- package/browser/esm/BZcQ-KYwS62Ut45c.mjs +20 -0
- package/browser/esm/Bow9CzRJrYxak2i5.mjs +318 -0
- package/browser/esm/BuvXl14hs-1CvjeA.mjs +2706 -0
- package/browser/esm/BwRduT8FTrk5n72r.mjs +32 -0
- package/browser/esm/C6urN77szrYwODXF.mjs +134 -0
- package/browser/esm/CYMRbtPIr6SklGpp.mjs +775 -0
- package/browser/esm/CYoUd5KIl7W3AsxH.mjs +196 -0
- package/browser/esm/Cfe0kofqVKGxLqO6.mjs +31 -0
- package/browser/esm/CiRN-woJZWYOgTn4.mjs +36 -0
- package/browser/esm/Dd-ZybXAgoq9pgGv.mjs +45 -0
- package/browser/esm/DjiBz4H74I6nPUY6.mjs +79 -0
- package/browser/esm/DyU9UInRnfkPYYlR.mjs +63 -0
- package/browser/esm/J8cPagZBeXz86Lnd.mjs +777 -0
- package/browser/esm/Sp6PJavGKpF8SJzA.mjs +75 -0
- package/browser/esm/cYjYjqEsyd63x8t4.mjs +67 -0
- package/browser/esm/chart.mjs +60 -0
- package/browser/esm/control.mjs +216 -0
- package/browser/esm/group.mjs +123 -0
- package/browser/esm/index.mjs +14070 -9138
- package/browser/esm/note.mjs +86 -0
- package/browser/esm/picture.mjs +86 -0
- package/{node/esm/DAE_NG8D9uT50zUH.mjs → browser/esm/shape.mjs} +2 -4
- package/browser/esm/slicer.mjs +276 -0
- package/licenses/dependencies.txt +6 -599
- package/node/esm/BJ7ZZm63j5O6cvrB.mjs +134 -0
- package/node/esm/BfRn5S5V4X8xIAEa.mjs +20 -0
- package/node/esm/BpwE3HqTnrLLzE3C.mjs +775 -0
- package/node/esm/Buw-VKYJy3y5dbaJ.mjs +197 -0
- package/node/esm/CFFlJxNwgyInjEnh.mjs +45 -0
- package/node/esm/CM5BT7h-hMtST2bE.mjs +2706 -0
- package/node/esm/CV3bT3Hql74GcHoU.mjs +37 -0
- package/node/esm/C_ANM4feA1xV-pri.mjs +32 -0
- package/node/esm/D3YXHeOyFp00Xk3m.mjs +323 -0
- package/node/esm/DPN0n6MGYQ9vZ2KO.mjs +80 -0
- package/node/esm/DYosMUJKp-3MSO4q.mjs +76 -0
- package/node/esm/DhSq680c5tgMFFbj.mjs +68 -0
- package/node/esm/Dxbm6ryIDCEi26RO.mjs +66 -0
- package/node/esm/GkmuxU7OwRZtm2Rf.mjs +63 -0
- package/node/esm/chart.mjs +60 -0
- package/node/esm/control.mjs +216 -0
- package/node/esm/group.mjs +123 -0
- package/node/esm/index.mjs +16618 -11534
- package/node/esm/note.mjs +87 -0
- package/node/esm/picture.mjs +86 -0
- package/node/esm/shape.mjs +783 -0
- package/node/esm/slicer.mjs +278 -0
- package/package.json +53 -14
- package/resources/contents.json +18 -0
- package/resources/locales/contents.json +42 -0
- package/resources/locales/de/movable.cmd.json +154 -0
- package/resources/locales/de/picture.cmd.json +31 -0
- package/resources/locales/de/selection.cmd.json +8 -0
- package/resources/locales/de/shape.cmd.json +17 -0
- package/resources/locales/de/sheet.cmd.json +328 -21
- package/resources/locales/de/slicer.cmd.json +17 -0
- package/resources/locales/de/table.cmd.json +9 -1
- package/resources/locales/de/ui.msg.json +309 -3
- package/resources/locales/de/workbook.cmd.json +10 -6
- package/resources/locales/en/movable.cmd.json +154 -0
- package/resources/locales/en/picture.cmd.json +31 -0
- package/resources/locales/en/selection.cmd.json +8 -0
- package/resources/locales/en/shape.cmd.json +17 -0
- package/resources/locales/en/sheet.cmd.json +342 -22
- package/resources/locales/en/slicer.cmd.json +17 -0
- package/resources/locales/en/table.cmd.json +9 -1
- package/resources/locales/en/ui.msg.json +309 -3
- package/resources/locales/en/workbook.cmd.json +11 -7
- package/types/chart.d.ts +2 -0
- package/types/control.d.ts +2 -0
- package/types/group.d.ts +2 -0
- package/types/note.d.ts +2 -0
- package/types/picture.d.ts +2 -0
- package/types/shape.d.ts +2 -0
- package/types/slicer.d.ts +2 -0
- package/types/src/annotation/RangeAnnotations.d.ts +119 -0
- package/types/src/annotation/index.d.ts +2 -0
- package/types/src/autoFill/AutoFillPresets.d.ts +14 -0
- package/types/src/autoFill/FillMenu.d.ts +36 -0
- package/types/src/autoFill/FillSeries.d.ts +38 -0
- package/types/src/autoFill/index.d.ts +4 -0
- package/types/src/border/StaticBorderRenderer.d.ts +2 -2
- package/types/src/border/useBorders.d.ts +7 -7
- package/types/src/cell/CornerTriangle.d.ts +6 -0
- package/types/src/cell/FormulaCellRenderer.d.ts +1 -1
- package/types/src/cell/OutlineButton.d.ts +123 -0
- package/types/src/cell/SheetCellRenderer.d.ts +2 -2
- package/types/src/cell/SheetHeaderRenderer.d.ts +5 -0
- package/types/src/cell/StaticCellRenderer.d.ts +57 -0
- package/types/src/cell/index.d.ts +2 -0
- package/types/src/cell/useFormulaViewAnchor.d.ts +1 -1
- package/types/src/chart/index.d.ts +0 -1
- package/types/src/checklist/ValueChecklist.d.ts +112 -0
- package/types/src/checklist/index.d.ts +2 -0
- package/types/src/commands/ContextualToolbar.d.ts +19 -0
- package/types/src/commands/createTransactionalMiddleware.d.ts +4 -1
- package/types/src/commands/index.d.ts +1 -0
- package/types/src/comment/CommentCardRequest.d.ts +94 -0
- package/types/src/comment/CommentUtils.d.ts +43 -0
- package/types/src/comment/NoteEditor.d.ts +20 -0
- package/types/src/comment/index.d.ts +5 -0
- package/types/src/comment/useCommentThread.d.ts +37 -0
- package/types/src/comment/useSheetComments.d.ts +28 -0
- package/types/src/{sheet → conditionalFormat}/ConditionalFormatPresets.d.ts +6 -6
- package/types/src/conditionalFormat/index.d.ts +1 -0
- package/types/src/control/FormControlRenderers.d.ts +22 -0
- package/types/src/editor/FunctionPreviewPanel.d.ts +15 -1
- package/types/src/editor/NamedItemLabel.d.ts +29 -0
- package/types/src/editor/NamedItemsPanel.d.ts +13 -2
- package/types/src/editor/SheetCellEditorLayer.d.ts +3 -7
- package/types/src/editor/SheetCellEditorStartLayer.d.ts +44 -0
- package/types/src/editor/SheetCellInput.d.ts +26 -2
- package/types/src/editor/SheetEditable.d.ts +8 -2
- package/types/src/editor/formulaCaret.d.ts +39 -10
- package/types/src/editor/formulaEval.d.ts +9 -5
- package/types/src/editor/formulaLint.d.ts +36 -0
- package/types/src/editor/formulaPresentation.d.ts +7 -0
- package/types/src/editor/formulaText.d.ts +17 -5
- package/types/src/editor/functionArgs.d.ts +20 -0
- package/types/src/editor/index.d.ts +4 -1
- package/types/src/editor/pickedReference.d.ts +76 -0
- package/types/src/editor/useEditRejectedNotice.d.ts +32 -0
- package/types/src/editor/useFormulaHints.d.ts +93 -3
- package/types/src/editor/useFormulaInput.d.ts +30 -4
- package/types/src/editor/useReferenceMode.d.ts +12 -0
- package/types/src/editor/validationAlert.d.ts +24 -0
- package/types/src/externalLink/ExternalLinksPaneArgs.d.ts +23 -0
- package/types/src/externalLink/index.d.ts +2 -0
- package/types/src/form/FormulaInput.d.ts +18 -2
- package/types/src/form/FormulaInputParts.d.ts +10 -1
- package/types/src/form/useEditCommit.d.ts +23 -3
- package/types/src/form/useInputField.d.ts +2 -3
- package/types/src/frame/CommandContext.d.ts +188 -6
- package/types/src/group/GroupEditor.d.ts +25 -0
- package/types/src/index.d.ts +12 -2
- package/types/src/io/WorkbookIO.d.ts +2 -0
- package/types/src/layer/CellErrorLayer.d.ts +24 -7
- package/types/src/layer/CommentCardLayer.d.ts +43 -0
- package/types/src/layer/CommentsLayer.d.ts +35 -0
- package/types/src/layer/ConditionalIcons.d.ts +4 -4
- package/types/src/layer/FreezeDragLines.d.ts +17 -0
- package/types/src/layer/GridFreezeLayer.d.ts +11 -0
- package/types/src/layer/HeaderFreezeLayer.d.ts +12 -0
- package/types/src/layer/HeaderResizerLayer.d.ts +2 -1
- package/types/src/layer/HyperlinkLayer.d.ts +109 -0
- package/types/src/layer/MovableKindScope.d.ts +17 -0
- package/types/src/layer/ProtectionLayer.d.ts +52 -0
- package/types/src/layer/RangeAnnotationLayer.d.ts +71 -0
- package/types/src/layer/ResizeIndicator.d.ts +9 -8
- package/types/src/layer/ResizeTooltip.d.ts +13 -0
- package/types/src/layer/SheetHeaderCellLayer.d.ts +10 -1
- package/types/src/layer/SheetOutlineLayer.d.ts +40 -0
- package/types/src/layer/TableLayer.d.ts +5 -4
- package/types/src/layer/TableToolbar.d.ts +42 -0
- package/types/src/layer/ValidationDropdownLayer.d.ts +15 -5
- package/types/src/layer/ValidationIndicatorLayer.d.ts +9 -3
- package/types/src/layer/ValidationPromptLayer.d.ts +64 -0
- package/types/src/layer/_tableColor.d.ts +4 -0
- package/types/src/layer/cellTip.d.ts +13 -0
- package/types/src/layer/freezeDragState.d.ts +21 -0
- package/types/src/layer/index.d.ts +12 -1
- package/types/src/layer/resizeIndicatorState.d.ts +3 -1
- package/types/src/layer/useFreezeDrag.d.ts +22 -0
- package/types/src/layer/useValidationPicker.d.ts +35 -35
- package/types/src/layer/validationMark.d.ts +63 -0
- package/types/src/listener/useModelListener.d.ts +4 -4
- package/types/src/movable/ConnectionSites.d.ts +18 -0
- package/types/src/movable/IMovableArea.d.ts +56 -0
- package/types/src/movable/MovableAdornment.d.ts +26 -0
- package/types/src/movable/MovableCommandGroups.d.ts +40 -0
- package/types/src/movable/MovableCommands.d.ts +6 -1
- package/types/src/movable/MovableControl.d.ts +78 -0
- package/types/src/movable/MovableEdit.d.ts +22 -0
- package/types/src/movable/MovableFrame.d.ts +16 -13
- package/types/src/movable/MovableLayer.d.ts +25 -7
- package/types/src/movable/MovableRenderers.d.ts +210 -0
- package/types/src/movable/PlaceholderFrames.d.ts +11 -0
- package/types/src/movable/RotateHandle.d.ts +37 -0
- package/types/src/movable/TextBox.d.ts +34 -0
- package/types/src/movable/connect.d.ts +16 -0
- package/types/src/movable/framePlacement.d.ts +72 -0
- package/types/src/movable/geometry.d.ts +61 -0
- package/types/src/movable/index.d.ts +10 -0
- package/types/src/movable/pressTarget.d.ts +20 -0
- package/types/src/picker/PickerPanel.d.ts +52 -0
- package/types/src/picker/cellPickerOpen.d.ts +6 -0
- package/types/src/picker/index.d.ts +4 -0
- package/types/src/picker/useCellPicker.d.ts +95 -0
- package/types/src/picture/PictureCommands.d.ts +12 -0
- package/types/src/picture/PictureKind.d.ts +7 -0
- package/types/src/picture/index.d.ts +0 -1
- package/types/src/protection/ProtectionPaneArgs.d.ts +31 -0
- package/types/src/protection/index.d.ts +3 -0
- package/types/src/protection/unlockProtectedRanges.d.ts +23 -0
- package/types/src/richText/RichTextEditor.d.ts +41 -0
- package/types/src/richText/index.d.ts +2 -0
- package/types/src/selection/SheetSelectionLayer.d.ts +14 -10
- package/types/src/shape/ConnectorControl.d.ts +46 -0
- package/types/src/shape/ShapeCommands.d.ts +11 -0
- package/types/src/shape/ShapeControl.d.ts +8 -0
- package/types/src/shape/ShapeEditor.d.ts +15 -2
- package/types/src/shape/ShapeGallery.d.ts +31 -0
- package/types/src/shape/ShapeHandles.d.ts +28 -0
- package/types/src/shape/ShapeKind.d.ts +7 -0
- package/types/src/shape/ShapeSVG.d.ts +22 -0
- package/types/src/shape/ShapeText.d.ts +17 -0
- package/types/src/shape/icons/ShapeIcons.d.ts +16 -0
- package/types/src/shape/icons/_ShapeIconPack.d.ts +4 -0
- package/types/src/shape/index.d.ts +3 -1
- package/types/src/shape/shapeFrame.d.ts +50 -0
- package/types/src/shape/shapeStyle.d.ts +82 -0
- package/types/src/sheet/ISheetElement.d.ts +62 -65
- package/types/src/sheet/SheetCommandProvider.d.ts +9 -4
- package/types/src/sheet/SheetCommands.d.ts +21 -6
- package/types/src/sheet/SheetOutlineElement.d.ts +70 -0
- package/types/src/sheet/SheetScrollbar.d.ts +1 -10
- package/types/src/sheet/_freezeAt.d.ts +10 -0
- package/types/src/sheet/_useHeaderMetrics.d.ts +11 -0
- package/types/src/sheet/circularReferences.d.ts +9 -1
- package/types/src/sheet/index.d.ts +1 -1
- package/types/src/sheet/useCycleHighlight.d.ts +21 -0
- package/types/src/slicer/SlicerCommands.d.ts +10 -0
- package/types/src/slicer/SlicerEditor.d.ts +8 -2
- package/types/src/slicer/SlicerKind.d.ts +7 -0
- package/types/src/slicer/SlicerStylePreview.d.ts +18 -0
- package/types/src/slicer/index.d.ts +2 -1
- package/types/src/slicer/slicerStyles.d.ts +32 -0
- package/types/src/tabStrip/TabStrip.d.ts +7 -0
- package/types/src/taskPane/ITaskPane.d.ts +12 -1
- package/types/src/taskPane/MovablePane.d.ts +17 -0
- package/types/src/taskPane/index.d.ts +1 -0
- package/types/src/theme/ThemeState.d.ts +14 -1
- package/types/src/theme/useGridColorScheme.d.ts +1 -1
- package/types/src/workbook/DefaultMovableRenderers.d.ts +20 -0
- package/types/src/workbook/IWorkbookElement.d.ts +24 -0
- package/types/src/workbook/WorkbookCommands.d.ts +2 -4
- package/types/src/workbook/WorkbookStrip.d.ts +9 -0
- package/types/src/workbook/_followOrigin.d.ts +9 -0
- package/types/src/workbook/useWorkbookFormat.d.ts +3 -3
- package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +0 -1
- package/browser/cjs/Pl04-kDEQSO8_qFU.cjs +0 -156
- package/browser/cjs/index.cjs +0 -35
- package/browser/esm/SJMJzBwlXTJ9QIO5.mjs +0 -6286
- package/types/src/editor/useProtectedEditNotice.d.ts +0 -14
- package/types/src/layer/validationList.d.ts +0 -84
- package/types/src/list/SheetValueList.d.ts +0 -93
- package/types/src/list/index.d.ts +0 -2
- package/types/src/movable/MoveableBundle.d.ts +0 -4
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.10
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { t } from "./CFFlJxNwgyInjEnh.mjs";
|
|
8
|
+
import { d as n } from "./D3YXHeOyFp00Xk3m.mjs";
|
|
9
|
+
import { n as e, r as o } from "./CV3bT3Hql74GcHoU.mjs";
|
|
10
|
+
import { ShapeEditor as r } from "./shape.mjs";
|
|
11
|
+
import { memo as a, useCallback as s, useReducer as i, useRef as c } from "react";
|
|
12
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
13
|
+
import { messageKey as d } from "@sheetxl/utils";
|
|
14
|
+
import { useGridPaneOptional as u, useSurfaceStateSetter as g } from "@sheetxl/grid-react";
|
|
15
|
+
var p = (t, n) => {
|
|
16
|
+
const e = [n.horizontal ? 1 : -1, n.vertical ? 1 : -1];
|
|
17
|
+
return "start" === t ? e : [-e[0], -e[1]];
|
|
18
|
+
}, m = (t) => {
|
|
19
|
+
const n = t.getBounds();
|
|
20
|
+
return n ? {
|
|
21
|
+
bounds: n,
|
|
22
|
+
rotation: t.getRotation() || 0,
|
|
23
|
+
flip: t.getFlip()
|
|
24
|
+
} : null;
|
|
25
|
+
}, h = (t, n, e) => {
|
|
26
|
+
const { x: o, y: r, width: a, height: s } = t.bounds, i = -(t.rotation || 0) * Math.PI / 180, c = n.x - (o + a / 2), l = n.y - (r + s / 2), d = c * Math.cos(i) - l * Math.sin(i), u = c * Math.sin(i) + l * Math.cos(i);
|
|
27
|
+
return Math.abs(d) <= a / 2 + e && Math.abs(u) <= s / 2 + e;
|
|
28
|
+
}, f = a((n) => {
|
|
29
|
+
const { movable: e, flip: r, isDragging: a = !1, gesture: f } = n, x = u(), C = g(o, null), [, y] = i((t) => t + 1, 0), b = e.getContent();
|
|
30
|
+
t(b, { onAnyChange: y });
|
|
31
|
+
const v = b.getConnectorFormat(), M = c(null), P = s((t) => {
|
|
32
|
+
const n = x?.getPanePointFromPointer(t.clientX, t.clientY);
|
|
33
|
+
if (!x || !n) return null;
|
|
34
|
+
const e = x.toAbsoluteBounds({
|
|
35
|
+
x: n.x,
|
|
36
|
+
y: n.y,
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
x: e.x,
|
|
42
|
+
y: e.y
|
|
43
|
+
};
|
|
44
|
+
}, [x]), I = s((t) => {
|
|
45
|
+
if (0 !== t.button) return;
|
|
46
|
+
t.stopPropagation(), t.preventDefault();
|
|
47
|
+
const n = t.currentTarget.dataset.end, o = m(e);
|
|
48
|
+
if (!o || !x) return;
|
|
49
|
+
const r = {
|
|
50
|
+
pointerId: t.pointerId,
|
|
51
|
+
end: n,
|
|
52
|
+
placement: o,
|
|
53
|
+
candidates: [],
|
|
54
|
+
hit: null
|
|
55
|
+
};
|
|
56
|
+
f.start(d("op.connectShape"), (t) => {
|
|
57
|
+
const e = t.getContent().getConnectorFormat();
|
|
58
|
+
if (!e) return;
|
|
59
|
+
const o = r.hit, a = "start" === n ? e.getStartConnectedMovable() : e.getEndConnectedMovable(), s = "start" === n ? e.getStartConnectionSite() : e.getEndConnectionSite();
|
|
60
|
+
(o ? a !== o.target || s !== o.index : null !== a) && (o ? "start" === n ? e.startConnect(o.target, o.index) : e.endConnect(o.target, o.index) : "start" === n ? e.startDisconnect() : e.endDisconnect());
|
|
61
|
+
}) && (r.candidates = ((t) => {
|
|
62
|
+
const n = t.getRange().getSheet(), e = /* @__PURE__ */ new Set([t]);
|
|
63
|
+
for (let n = t.getParent(); n; n = n.getParent()) e.add(n);
|
|
64
|
+
const o = [];
|
|
65
|
+
for (const t of n.getMovables().getItems({ deep: !0 })) {
|
|
66
|
+
if (e.has(t) || t.isHidden()) continue;
|
|
67
|
+
const n = m(t);
|
|
68
|
+
n && o.push({
|
|
69
|
+
movable: t,
|
|
70
|
+
placement: n
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return o;
|
|
74
|
+
})(e), M.current = r, t.currentTarget.setPointerCapture(t.pointerId), C({
|
|
75
|
+
connector: e.getId(),
|
|
76
|
+
target: null,
|
|
77
|
+
index: null
|
|
78
|
+
}));
|
|
79
|
+
}, [
|
|
80
|
+
e,
|
|
81
|
+
x,
|
|
82
|
+
f,
|
|
83
|
+
C
|
|
84
|
+
]), S = s((t) => {
|
|
85
|
+
const n = M.current;
|
|
86
|
+
if (!n || n.pointerId !== t.pointerId) return;
|
|
87
|
+
t.stopPropagation();
|
|
88
|
+
const o = P(t);
|
|
89
|
+
if (!o) return;
|
|
90
|
+
const r = ((t, n, e) => {
|
|
91
|
+
const o = 8 / e, r = 10 / e;
|
|
92
|
+
let a = null, s = 1 / 0;
|
|
93
|
+
for (const { movable: e, placement: i } of n) {
|
|
94
|
+
const n = e.getConnectionSites(i);
|
|
95
|
+
if (!n || 0 === n.length) continue;
|
|
96
|
+
const c = h(i, t, o);
|
|
97
|
+
for (const o of n) {
|
|
98
|
+
const n = Math.hypot(o.x - t.x, o.y - t.y);
|
|
99
|
+
(c || n <= r) && n < s && (a = {
|
|
100
|
+
target: e,
|
|
101
|
+
index: o.index,
|
|
102
|
+
x: o.x,
|
|
103
|
+
y: o.y
|
|
104
|
+
}, s = n);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return a;
|
|
108
|
+
})(o, n.candidates, x?.getZoom() || 1);
|
|
109
|
+
n.hit = r;
|
|
110
|
+
const a = e.getContent().getConnectorFormat(), s = a?.getEndPoints(n.placement);
|
|
111
|
+
if (!a || !s) return;
|
|
112
|
+
const i = s["start" === n.end ? "end" : "start"];
|
|
113
|
+
s[n.end] = r ? {
|
|
114
|
+
x: r.x,
|
|
115
|
+
y: r.y
|
|
116
|
+
} : t.shiftKey ? ((t, n, e = 15) => {
|
|
117
|
+
const o = n.x - t.x, r = n.y - t.y;
|
|
118
|
+
if (0 === o && 0 === r) return n;
|
|
119
|
+
const a = e * Math.PI / 180, s = Math.round(Math.atan2(r, o) / a) * a, i = Math.abs(Math.cos(s)) < 1e-12 ? 0 : Math.cos(s), c = Math.abs(Math.sin(s)) < 1e-12 ? 0 : Math.sin(s), l = o * i + r * c;
|
|
120
|
+
return {
|
|
121
|
+
x: t.x + l * i,
|
|
122
|
+
y: t.y + l * c
|
|
123
|
+
};
|
|
124
|
+
})(i, o) : o;
|
|
125
|
+
const c = a.placeEnds(s.start, s.end);
|
|
126
|
+
C({
|
|
127
|
+
connector: e.getId(),
|
|
128
|
+
target: r ? r.target.getId() : null,
|
|
129
|
+
index: r ? r.index : null
|
|
130
|
+
}), f.preview({
|
|
131
|
+
bounds: c.bounds,
|
|
132
|
+
flip: c.flip,
|
|
133
|
+
grip: {
|
|
134
|
+
kind: "resize",
|
|
135
|
+
direction: p(n.end, c.flip)
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}, [
|
|
139
|
+
P,
|
|
140
|
+
x,
|
|
141
|
+
e,
|
|
142
|
+
f,
|
|
143
|
+
C
|
|
144
|
+
]), j = s((t) => {
|
|
145
|
+
const n = M.current;
|
|
146
|
+
n && n.pointerId === t.pointerId && (t.stopPropagation(), M.current = null, C(null), f.finish());
|
|
147
|
+
}, [f, C]), F = s((t) => {
|
|
148
|
+
const n = M.current;
|
|
149
|
+
n && n.pointerId === t.pointerId && (M.current = null, C(null), f.cancel());
|
|
150
|
+
}, [f, C]);
|
|
151
|
+
return l("div", {
|
|
152
|
+
className: [
|
|
153
|
+
"movable-control",
|
|
154
|
+
"connector",
|
|
155
|
+
a ? "dragging" : null
|
|
156
|
+
].filter(Boolean).join(" "),
|
|
157
|
+
children: ["start", "end"].map((t) => {
|
|
158
|
+
const n = p(t, r), e = "start" === t ? !!v?.isStartConnected() : !!v?.isEndConnected();
|
|
159
|
+
return l("div", {
|
|
160
|
+
className: e ? "movable-control-handle connector-end glued" : "movable-control-handle connector-end",
|
|
161
|
+
"data-end": t,
|
|
162
|
+
style: {
|
|
163
|
+
left: 50 * (n[0] + 1) + "%",
|
|
164
|
+
top: 50 * (n[1] + 1) + "%"
|
|
165
|
+
},
|
|
166
|
+
onPointerDown: I,
|
|
167
|
+
onPointerMove: S,
|
|
168
|
+
onPointerUp: j,
|
|
169
|
+
onPointerCancel: F
|
|
170
|
+
}, t);
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
f.displayName = "ConnectorControl";
|
|
175
|
+
var x = a((t) => t.movable.getContent().isConnector() ? l(f, { ...t }) : l(n, { ...t }));
|
|
176
|
+
x.displayName = "ShapeControl";
|
|
177
|
+
var C = {
|
|
178
|
+
renderer: (t) => l(r, {
|
|
179
|
+
...t,
|
|
180
|
+
shape: t.movable.getContent()
|
|
181
|
+
}),
|
|
182
|
+
control: x,
|
|
183
|
+
commands: (t, n) => {
|
|
184
|
+
const { sheet: o, movable: r, notifier: a } = n, s = r.getContent();
|
|
185
|
+
t.use(e({
|
|
186
|
+
transaction: o,
|
|
187
|
+
notifier: a
|
|
188
|
+
})), t.updateCommand("changeShape", {
|
|
189
|
+
disabledReasons: s.getConnectorFormat() ? [d("reason.connectorShape")] : [],
|
|
190
|
+
callback: (t) => {
|
|
191
|
+
const n = "object" == typeof t && null !== t ? t.geometry : t;
|
|
192
|
+
s.setShapeType("string" == typeof n ? n : "rect");
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
export { C as ShapeKind };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.10
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { useEffect as r, useMemo as n, useReducer as o, useRef as t } from "react";
|
|
8
|
+
var e = (n, o, e) => {
|
|
9
|
+
const c = t(o);
|
|
10
|
+
c.current = o;
|
|
11
|
+
const a = (e = e ? {
|
|
12
|
+
...s,
|
|
13
|
+
...e
|
|
14
|
+
} : s).ignoreModelChange;
|
|
15
|
+
r(() => {
|
|
16
|
+
if (!n || !c.current) return;
|
|
17
|
+
const r = Object.keys(c.current), o = {}, t = r.length;
|
|
18
|
+
for (let n = 0; n < t; n++) {
|
|
19
|
+
const t = r[n];
|
|
20
|
+
o[t] = (r, n) => c.current[t]?.(r, n);
|
|
21
|
+
}
|
|
22
|
+
const s = e?.debugText;
|
|
23
|
+
s && console.log("Add: " + s);
|
|
24
|
+
const i = n.addListeners(o, e);
|
|
25
|
+
if (!a) for (let e = 0; e < t; e++) o[r[e]]?.(n);
|
|
26
|
+
return () => {
|
|
27
|
+
s && console.log("Remove: " + s), i?.();
|
|
28
|
+
};
|
|
29
|
+
}, [n]);
|
|
30
|
+
};
|
|
31
|
+
function c(r, t) {
|
|
32
|
+
const [c, s] = o((r) => r + 1, 0);
|
|
33
|
+
e(r, n(() => {
|
|
34
|
+
const r = (r, n) => {
|
|
35
|
+
s();
|
|
36
|
+
}, n = Array.isArray(t) ? t : [t], o = {};
|
|
37
|
+
for (const t of n) o[t] = r;
|
|
38
|
+
return o;
|
|
39
|
+
}, [r, ...Array.isArray(t) ? t : [t]]));
|
|
40
|
+
}
|
|
41
|
+
var s = {
|
|
42
|
+
transactional: !1,
|
|
43
|
+
ignoreModelChange: !1
|
|
44
|
+
};
|
|
45
|
+
export { c as n, e as t };
|