@rowsncolumns/spreadsheet 10.9.2 → 10.10.1
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/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +28 -11
- package/dist/cjs/components/canvas-grid/overflow.d.ts +23 -0
- package/dist/cjs/components/canvas-grid/overflow.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/overflow.js +32 -1
- package/dist/cjs/components/canvas-grid/typings.d.ts +8 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +25 -13
- package/dist/cjs/components/cell/typings.d.ts +9 -0
- package/dist/cjs/components/cell/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +18 -3
- package/dist/cjs/components/cell-input/formula-bar-cell-input.d.ts +8 -1
- package/dist/cjs/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/formula-bar-cell-input.js +5 -5
- package/dist/cjs/components/cell-tooltip/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-tooltip/index.js +5 -1
- package/dist/cjs/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.js +17 -7
- package/dist/cjs/components/filter-box/index.d.ts.map +1 -1
- package/dist/cjs/components/filter-box/index.js +4 -1
- package/dist/cjs/components/pivot-placeholder/index.d.ts.map +1 -1
- package/dist/cjs/components/pivot-placeholder/index.js +4 -4
- package/dist/cjs/components/print-preview/page-block.d.ts +9 -0
- package/dist/cjs/components/print-preview/page-block.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/page-block.js +36 -38
- package/dist/cjs/components/print-preview/print-preview-dialog.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/print-preview-dialog.js +2 -1
- package/dist/cjs/components/selection/index.d.ts.map +1 -1
- package/dist/cjs/components/selection/index.js +5 -1
- package/dist/cjs/components/selection/title.d.ts.map +1 -1
- package/dist/cjs/components/selection/title.js +7 -2
- package/dist/cjs/hooks/use-cell-renderer.d.ts +7 -1
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +36 -17
- package/dist/cjs/hooks/use-conditional-formatting.d.ts +12 -1
- package/dist/cjs/hooks/use-conditional-formatting.d.ts.map +1 -1
- package/dist/cjs/hooks/use-conditional-formatting.js +16 -5
- package/dist/cjs/hooks/use-context-menu.d.ts +6 -1
- package/dist/cjs/hooks/use-context-menu.d.ts.map +1 -1
- package/dist/cjs/hooks/use-context-menu.js +6 -2
- package/dist/cjs/hooks/use-selection.d.ts +6 -1
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +7 -6
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/types.d.ts +2 -2
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +34 -16
- package/dist/esm/components/canvas-grid/overflow.d.ts +23 -0
- package/dist/esm/components/canvas-grid/overflow.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/overflow.js +23 -0
- package/dist/esm/components/canvas-grid/typings.d.ts +8 -0
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +22 -12
- package/dist/esm/components/cell/typings.d.ts +9 -0
- package/dist/esm/components/cell/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +19 -3
- package/dist/esm/components/cell-input/formula-bar-cell-input.d.ts +8 -1
- package/dist/esm/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/formula-bar-cell-input.js +2 -2
- package/dist/esm/components/cell-tooltip/index.d.ts.map +1 -1
- package/dist/esm/components/cell-tooltip/index.js +5 -1
- package/dist/esm/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.js +18 -8
- package/dist/esm/components/filter-box/index.d.ts.map +1 -1
- package/dist/esm/components/filter-box/index.js +5 -2
- package/dist/esm/components/pivot-placeholder/index.d.ts.map +1 -1
- package/dist/esm/components/pivot-placeholder/index.js +4 -0
- package/dist/esm/components/print-preview/page-block.d.ts +9 -0
- package/dist/esm/components/print-preview/page-block.d.ts.map +1 -1
- package/dist/esm/components/print-preview/page-block.js +38 -10
- package/dist/esm/components/print-preview/print-preview-dialog.d.ts.map +1 -1
- package/dist/esm/components/print-preview/print-preview-dialog.js +2 -1
- package/dist/esm/components/selection/index.d.ts.map +1 -1
- package/dist/esm/components/selection/index.js +5 -1
- package/dist/esm/components/selection/title.d.ts.map +1 -1
- package/dist/esm/components/selection/title.js +8 -3
- package/dist/esm/hooks/use-cell-renderer.d.ts +7 -1
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +26 -6
- package/dist/esm/hooks/use-conditional-formatting.d.ts +12 -1
- package/dist/esm/hooks/use-conditional-formatting.d.ts.map +1 -1
- package/dist/esm/hooks/use-conditional-formatting.js +12 -4
- package/dist/esm/hooks/use-context-menu.d.ts +6 -1
- package/dist/esm/hooks/use-context-menu.d.ts.map +1 -1
- package/dist/esm/hooks/use-context-menu.js +6 -2
- package/dist/esm/hooks/use-selection.d.ts +6 -1
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +4 -3
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/types.d.ts +2 -2
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Direction } from "@rowsncolumns/grid";
|
|
1
|
+
import { Direction, useIsInRtlMirrorLayer } from "@rowsncolumns/grid";
|
|
2
2
|
import { ArrowLeftIcon, ArrowRightIcon, ChevronDownIcon, ChevronRightIcon, Cross2Icon, SortDownIcon, SortUpIcon, TrashIcon, } from "@rowsncolumns/icons";
|
|
3
3
|
import { Button, cn, DropdownLeftSlot, DropdownMenuSeparator, Popover, PopoverContent, PopoverMenuItem, PopoverPortal, PopoverTrigger, Separator, } from "@rowsncolumns/ui";
|
|
4
4
|
import { isNil, number2Alpha } from "@rowsncolumns/utils";
|
|
@@ -419,8 +419,11 @@ export const FilterBox = (props) => {
|
|
|
419
419
|
const { isOpen, onOpenChange, x, y, dimensionIndex } = props;
|
|
420
420
|
const shouldFocusSheetRef = useRef(true);
|
|
421
421
|
const focusSheet = useFocusSheet();
|
|
422
|
+
// Right-to-left sheet: the anchor sits in the mirrored overlay layer, so
|
|
423
|
+
// the dropdown opens from the column's right edge; its box flips back.
|
|
424
|
+
const unmirror = useIsInRtlMirrorLayer();
|
|
422
425
|
return (React.createElement("div", { className: cn("absolute left-0 top-0", isOpen ? undefined : "invisible"), style: {
|
|
423
|
-
transform: `translate3d(${x}px, ${y}px, 0)`,
|
|
426
|
+
transform: `translate3d(${x}px, ${y}px, 0)${unmirror ? " scaleX(-1)" : ""}`,
|
|
424
427
|
minWidth: 220,
|
|
425
428
|
} },
|
|
426
429
|
React.createElement(Popover, { open: isOpen, onOpenChange: onOpenChange, modal: false },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/pivot-placeholder/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/pivot-placeholder/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,uBAAuB,EAAE,eAAe,CAAC,yBAAyB,CAAC,CAAC;CACrE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,kEAM9B,qBAAqB,sBAsCvB,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { UNMIRROR_STYLE, useIsInRtlMirrorLayer } from "@rowsncolumns/grid";
|
|
1
2
|
import React from "react";
|
|
2
3
|
export const PivotPlaceholder = ({ pivotTable, displayName, left, top, onRequestEditPivotTable, }) => {
|
|
4
|
+
// Right-to-left sheet: placed in the mirrored overlay layer; reads normally.
|
|
5
|
+
const unmirror = useIsInRtlMirrorLayer();
|
|
3
6
|
return (React.createElement("div", { key: pivotTable.pivotId, onClick: () => onRequestEditPivotTable?.(pivotTable), role: "button", tabIndex: 0, onKeyDown: (e) => {
|
|
4
7
|
if (e.key === "Enter" || e.key === " ") {
|
|
5
8
|
e.preventDefault();
|
|
@@ -8,6 +11,7 @@ export const PivotPlaceholder = ({ pivotTable, displayName, left, top, onRequest
|
|
|
8
11
|
}, className: "absolute pointer-events-auto cursor-pointer select-none group", style: {
|
|
9
12
|
top,
|
|
10
13
|
left,
|
|
14
|
+
...(unmirror ? UNMIRROR_STYLE : {}),
|
|
11
15
|
} },
|
|
12
16
|
React.createElement("div", { className: "transition-all duration-200 border border-dashed border-rnc-border bg-rnc-background rounded-lg shadow-sm hover:shadow-md hover:border-blue-500 p-2", style: {
|
|
13
17
|
minWidth: "280px",
|
|
@@ -90,6 +90,15 @@ export type PageBlockProps = CellAccess & {
|
|
|
90
90
|
charts?: Array<PrintedChart & {
|
|
91
91
|
imageUrl?: string;
|
|
92
92
|
}>;
|
|
93
|
+
/**
|
|
94
|
+
* The sheet displays right-to-left (`<sheetView rightToLeft="1">`): Excel
|
|
95
|
+
* prints it mirrored — the first column on the right edge of the page,
|
|
96
|
+
* General text aligned right and numbers left, text spilling the mirrored
|
|
97
|
+
* way, OOXML `left` / `right` borders on the leading / trailing edges (the
|
|
98
|
+
* right / left edges here), the note marker in the top-left corner and
|
|
99
|
+
* charts measured from the right.
|
|
100
|
+
*/
|
|
101
|
+
rightToLeft?: boolean;
|
|
93
102
|
};
|
|
94
103
|
export declare const PageBlock: React.FC<PageBlockProps>;
|
|
95
104
|
//# sourceMappingURL=page-block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-block.d.ts","sourceRoot":"","sources":["../../../../components/print-preview/page-block.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACV,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CACR,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC;IACb;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,aAAa,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"page-block.d.ts","sourceRoot":"","sources":["../../../../components/print-preview/page-block.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACV,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,YAAY,EAAE,CAAC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M,CAAA;aAAE,CAAC;YACzD,MAAM,CAAC,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;SAC1D,CAAC;KACH,CAAC;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAqIF,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAiZ9C,CAAC"}
|
|
@@ -10,6 +10,22 @@ import React, { useMemo } from "react";
|
|
|
10
10
|
import { cellInlineStyle } from "./cell-styles";
|
|
11
11
|
import { FOOTER_STRIP_HEIGHT, HEADER_STRIP_HEIGHT, } from "./settings";
|
|
12
12
|
/** Excel's horizontal alignments as the printed cell lays them out. */
|
|
13
|
+
const mirrorAlignment = (alignment) => alignment === "left" ? "right" : alignment === "right" ? "left" : alignment;
|
|
14
|
+
/**
|
|
15
|
+
* OOXML `left` / `right` borders are the leading / trailing edges (ISO/IEC
|
|
16
|
+
* 29500-4 §10.4.1: `left` is "semantically equivalent to start", Part 1
|
|
17
|
+
* §18.8.37) — on a right-to-left sheet they print on the right / left.
|
|
18
|
+
*/
|
|
19
|
+
const leadingEdgeBorders = (style, rightToLeft) => {
|
|
20
|
+
if (!rightToLeft)
|
|
21
|
+
return style;
|
|
22
|
+
const { borderLeft, borderRight, ...rest } = style;
|
|
23
|
+
return {
|
|
24
|
+
...rest,
|
|
25
|
+
...(borderRight !== undefined ? { borderLeft: borderRight } : null),
|
|
26
|
+
...(borderLeft !== undefined ? { borderRight: borderLeft } : null),
|
|
27
|
+
};
|
|
28
|
+
};
|
|
13
29
|
const printedAlignment = (alignment) => {
|
|
14
30
|
switch (alignment) {
|
|
15
31
|
case undefined:
|
|
@@ -134,7 +150,7 @@ const HeaderFooterStrip = ({ position, data }) => {
|
|
|
134
150
|
React.createElement("div", { style: { ...cellBase, justifyContent: "center" } }, center),
|
|
135
151
|
React.createElement("div", { style: { ...cellBase, justifyContent: "flex-end" } }, right)));
|
|
136
152
|
};
|
|
137
|
-
export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGridlines, showNotes, horizontalAlignment, verticalAlignment, sheetId, getFormattedValue, getEffectiveFormat, getColumnWidth, getRowHeight, merges, hasNote, getCellInfo, frozenRowStart, frozenRowEnd, frozenColumnStart, frozenColumnEnd, headerFooter, screen = true, charts, }) => {
|
|
153
|
+
export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGridlines, showNotes, horizontalAlignment, verticalAlignment, sheetId, getFormattedValue, getEffectiveFormat, getColumnWidth, getRowHeight, merges, hasNote, getCellInfo, frozenRowStart, frozenRowEnd, frozenColumnStart, frozenColumnEnd, headerFooter, screen = true, charts, rightToLeft = false, }) => {
|
|
138
154
|
const showFrozenRows = frozenRowStart !== undefined &&
|
|
139
155
|
frozenRowEnd !== undefined &&
|
|
140
156
|
frozenRowEnd >= frozenRowStart;
|
|
@@ -250,6 +266,8 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
250
266
|
const closingEdge = showGridlines
|
|
251
267
|
? "1px solid #d1d5db"
|
|
252
268
|
: undefined;
|
|
269
|
+
// The physical step toward the next printed column on the right.
|
|
270
|
+
const rightwardStep = rightToLeft ? -1 : 1;
|
|
253
271
|
const table = {
|
|
254
272
|
borderCollapse: "collapse",
|
|
255
273
|
tableLayout: "fixed",
|
|
@@ -259,7 +277,7 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
259
277
|
fontSize: 12,
|
|
260
278
|
color: "#111827",
|
|
261
279
|
borderBottom: closingEdge,
|
|
262
|
-
borderRight: closingEdge,
|
|
280
|
+
...(rightToLeft ? { borderLeft: closingEdge } : { borderRight: closingEdge }),
|
|
263
281
|
};
|
|
264
282
|
// Outer page becomes a flex column when header/footer strips are
|
|
265
283
|
// present so the middle content area is what actually paginates.
|
|
@@ -272,18 +290,19 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
272
290
|
const noteMarkerStyle = {
|
|
273
291
|
position: "absolute",
|
|
274
292
|
top: 1,
|
|
275
|
-
right: 1,
|
|
276
293
|
width: 0,
|
|
277
294
|
height: 0,
|
|
278
295
|
borderTop: "5px solid #ef4444",
|
|
279
|
-
borderLeft: "5px solid transparent",
|
|
280
296
|
pointerEvents: "none",
|
|
297
|
+
...(rightToLeft
|
|
298
|
+
? { left: 1, borderRight: "5px solid transparent" }
|
|
299
|
+
: { right: 1, borderLeft: "5px solid transparent" }),
|
|
281
300
|
};
|
|
282
301
|
return (React.createElement("div", { style: pageOuterWithStrips, "data-page-index": block.index },
|
|
283
302
|
headerFooter ? (React.createElement(HeaderFooterStrip, { position: "header", data: headerFooter })) : null,
|
|
284
303
|
React.createElement("div", { style: contentBoxWithStrips },
|
|
285
304
|
React.createElement("div", { style: tableWrap },
|
|
286
|
-
React.createElement("table", { style: table },
|
|
305
|
+
React.createElement("table", { style: table, dir: rightToLeft ? "rtl" : undefined },
|
|
287
306
|
React.createElement("colgroup", null, columnIndices.map((c, i) => (React.createElement("col", { key: `${c}-${i}`, style: { width: getColumnWidth(c) } })))),
|
|
288
307
|
React.createElement("tbody", null, rowIndices.map((r, ri) => {
|
|
289
308
|
const rowHeight = getRowHeight(r);
|
|
@@ -296,14 +315,17 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
296
315
|
const value = getFormattedValue(sheetId, r, c) ?? "";
|
|
297
316
|
const cellHeight = rowHeight * (span?.rowSpan ?? 1);
|
|
298
317
|
const info = getCellInfo?.(sheetId, r, c);
|
|
299
|
-
const alignment = printedAlignment(format?.horizontalAlignment ??
|
|
318
|
+
const alignment = printedAlignment(format?.horizontalAlignment ??
|
|
319
|
+
(rightToLeft && format?.readingOrder !== "ltr"
|
|
320
|
+
? mirrorAlignment(info?.defaultAlignment ?? "left")
|
|
321
|
+
: info?.defaultAlignment));
|
|
300
322
|
const wraps = format?.wrapStrategy === "wrap";
|
|
301
323
|
const spills = !!info?.spills && !wraps && !span;
|
|
302
324
|
const spillRight = spills && alignment !== "right"
|
|
303
|
-
? spillWidth(r, ci,
|
|
325
|
+
? spillWidth(r, ci, rightwardStep)
|
|
304
326
|
: 0;
|
|
305
327
|
const spillLeft = spills && alignment !== "left" && alignment !== undefined
|
|
306
|
-
? spillWidth(r, ci, -
|
|
328
|
+
? spillWidth(r, ci, -rightwardStep)
|
|
307
329
|
: 0;
|
|
308
330
|
// A centred cell spills evenly, so its text stays centred on the cell.
|
|
309
331
|
const centred = alignment === "center";
|
|
@@ -326,7 +348,7 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
326
348
|
// declared height + the visible content is
|
|
327
349
|
// clipped by the cell's `overflow: hidden`.
|
|
328
350
|
const style = {
|
|
329
|
-
...cellInlineStyle(format, showGridlines),
|
|
351
|
+
...leadingEdgeBorders(cellInlineStyle(format, showGridlines), rightToLeft),
|
|
330
352
|
...(alignment ? { textAlign: alignment } : null),
|
|
331
353
|
position: "relative",
|
|
332
354
|
overflow: spilling ? "visible" : "hidden",
|
|
@@ -335,6 +357,11 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
335
357
|
const noted = showNotes && hasNote?.(sheetId, r, c);
|
|
336
358
|
const innerStyle = {
|
|
337
359
|
position: "absolute",
|
|
360
|
+
// Right-to-left: the cell box still lays out
|
|
361
|
+
// left-to-right inside the rtl table — alignment and
|
|
362
|
+
// spill are physical. Left-to-right sheets are untouched.
|
|
363
|
+
direction: rightToLeft ? "ltr" : undefined,
|
|
364
|
+
unicodeBidi: rightToLeft ? "plaintext" : undefined,
|
|
338
365
|
top: 0,
|
|
339
366
|
right: -right,
|
|
340
367
|
bottom: 0,
|
|
@@ -383,7 +410,8 @@ export const PageBlock = ({ block, pageWidth, pageHeight, margins, scale, showGr
|
|
|
383
410
|
charts?.map((chart) => {
|
|
384
411
|
const frame = {
|
|
385
412
|
position: "absolute",
|
|
386
|
-
|
|
413
|
+
// A mirrored sheet measures its drawings from the right edge.
|
|
414
|
+
...(rightToLeft ? { right: chart.left } : { left: chart.left }),
|
|
387
415
|
top: chart.top,
|
|
388
416
|
width: chart.width,
|
|
389
417
|
height: chart.height,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-preview-dialog.d.ts","sourceRoot":"","sources":["../../../../components/print-preview/print-preview-dialog.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EAEX,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAaxD,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIxD,OAAO,EAUL,KAAK,aAAa,EAMnB,MAAM,YAAY,CAAC;AAepB,OAAO,EAIL,KAAK,YAAY,EAIlB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,iBAAiB,EAAE,CACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1D,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7D;;;;OAIG;IACH,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,SAAS,YAAY,EAAE,CAAC;IAC3D,4FAA4F;IAC5F,eAAe,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACzC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"print-preview-dialog.d.ts","sourceRoot":"","sources":["../../../../components/print-preview/print-preview-dialog.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EAEX,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAaxD,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIxD,OAAO,EAUL,KAAK,aAAa,EAMnB,MAAM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OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAuGF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA63BhE,CAAC"}
|
|
@@ -43,6 +43,7 @@ const resolveSheet = (sheet, options) => {
|
|
|
43
43
|
getColumnWidth: (c) => sheet.columnMetadata?.[c]?.size ?? defaultColumnWidth,
|
|
44
44
|
getRowHeight: (r) => sheet.rowMetadata?.[r]?.size ?? defaultRowHeight,
|
|
45
45
|
plan: sheetPrintPlan(sheet.printSettings),
|
|
46
|
+
rightToLeft: !!sheet.rightToLeft,
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
49
|
/** Each print area of the sheet as its own entry (Excel prints each on its own pages). */
|
|
@@ -402,7 +403,7 @@ export const PrintPreviewDialog = ({ isOpen, onClose, sheets, activeSheetId, sel
|
|
|
402
403
|
i + 1,
|
|
403
404
|
" of ",
|
|
404
405
|
pages.length),
|
|
405
|
-
React.createElement(PageBlock, { block: block, pageWidth: pageDims.width, pageHeight: pageDims.height, margins: margins, scale: computeScaleForSheet(sheet), showGridlines: settings.showGridlines, showNotes: settings.showNotes, horizontalAlignment: settings.horizontalAlignment, verticalAlignment: settings.verticalAlignment, sheetId: sheet.sheetId, getFormattedValue: getFormattedValue, getEffectiveFormat: getEffectiveFormat, getColumnWidth: sheet.getColumnWidth, getRowHeight: sheet.getRowHeight, merges: sheet.merges, hasNote: hasNote, getCellInfo: getCellInfo, charts: printedCharts
|
|
406
|
+
React.createElement(PageBlock, { block: block, pageWidth: pageDims.width, pageHeight: pageDims.height, margins: margins, scale: computeScaleForSheet(sheet), showGridlines: settings.showGridlines, showNotes: settings.showNotes, rightToLeft: sheet.rightToLeft, horizontalAlignment: settings.horizontalAlignment, verticalAlignment: settings.verticalAlignment, sheetId: sheet.sheetId, getFormattedValue: getFormattedValue, getEffectiveFormat: getEffectiveFormat, getColumnWidth: sheet.getColumnWidth, getRowHeight: sheet.getRowHeight, merges: sheet.merges, hasNote: hasNote, getCellInfo: getCellInfo, charts: printedCharts
|
|
406
407
|
.get(`${sheet.sheetId}:${block.index}`)
|
|
407
408
|
?.map((chart) => ({
|
|
408
409
|
...chart,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/selection/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/selection/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAe,MAAM,OAAO,CAAC;AAmBpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,SAAS,60CAqFjB,iBAAiB,uBAyZrB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useIsInRtlMirrorLayer } from "@rowsncolumns/grid";
|
|
1
2
|
import React, { memo } from "react";
|
|
2
3
|
import { CalculatedColumnSmartTag } from "../calculated-column-smart-tag";
|
|
3
4
|
import { ErrorCheckSmartTag } from "../error-check-smart-tag";
|
|
@@ -17,6 +18,7 @@ import { SelectionTitle } from "./title";
|
|
|
17
18
|
* @returns
|
|
18
19
|
*/
|
|
19
20
|
export const Selection = memo(({ x = 0, y = 0, width = 0, height = 0, fillHandleSize = 8, showFillHandle, offset = 0, stroke, strokeLeftColor = stroke, strokeTopColor = stroke, strokeRightColor = stroke, strokeBottomColor = stroke, strokeWidth = 0, strokeTopWidth = strokeWidth, strokeRightWidth = strokeWidth, strokeBottomWidth = strokeWidth, strokeLeftWidth = strokeWidth, strokeStyle = "solid", fillOpacity = 1, draggable, isDragging, borderCoverWidth = 5, type, range, title, keepTitleWithinBounds, keepTitleWithinVerticalBounds, flipTitleToBottom, table, pivotTable, onMouseDownTitle, onMouseDownResizeHandle, onMouseDownMoveHandle, TitleComponent = SelectionTitle, onMouseDown, onRequestEditTable, onRequestEditPivotTable, onFlashEnd, zIndex, index, id, showResizeHandles, resizeHandleBorderColor, resizeHandleSize = 6, fill, duration, selectionCount, enableMagicFill, sheetId, activeCell, selection, MagicFillComponent = MagicFill, metadata, readonly, showPasteMenu, onSplitTextToColumns, onChoosePasteOption, agentSuggestion, isHovered, MagicFillContent, QuickEdit = DefaultQuickEdit, PasteMenu = DefaultPasteMenu, FillOptionsMenu = DefaultFillOptionsMenu, fillOptions, onChooseFillType, onOpenFillSeriesDialog, onCloseFillOptions, InsertOptionsSmartTag = DefaultInsertOptionsSmartTag, insertOptions, onChooseInsertOption, tableAutoExpansion, onChooseTableAutoExpansionOption, flashFillOptions, onChooseFlashFillOption, calculatedColumnFill, onChooseCalculatedColumnOption, errorCheck, errorCheckMenuOpen = false, onErrorCheckMenuOpenChange, onChooseErrorCheckOption, SuggestionAction = DefaultSuggestionAction, onRemoveQuickEdit, onAddQuickEdit, }) => {
|
|
21
|
+
const unmirror = useIsInRtlMirrorLayer();
|
|
20
22
|
// Show paste menu
|
|
21
23
|
const finalShowPasteMenu = !showPasteMenu
|
|
22
24
|
? false
|
|
@@ -156,10 +158,12 @@ export const Selection = memo(({ x = 0, y = 0, width = 0, height = 0, fillHandle
|
|
|
156
158
|
// A centred, faint label over the whole range (Page Break Preview's
|
|
157
159
|
// "Page N"): never interactive, never in the way of the cells.
|
|
158
160
|
const watermark = typeof metadata?.watermark === "string" ? metadata.watermark : undefined;
|
|
161
|
+
// Right-to-left sheet: the selection layer is mirrored; the label flips
|
|
162
|
+
// back about its own (range-sized) box so it reads normally.
|
|
159
163
|
return (React.createElement(React.Fragment, null,
|
|
160
164
|
watermark ? (React.createElement("div", { "aria-hidden": true, "data-selection-watermark": "", style: {
|
|
161
165
|
position: "absolute",
|
|
162
|
-
transform: `translate3d(${x}px, ${y}px, 0)`,
|
|
166
|
+
transform: `translate3d(${x}px, ${y}px, 0)${unmirror ? " scaleX(-1)" : ""}`,
|
|
163
167
|
width,
|
|
164
168
|
height,
|
|
165
169
|
display: "flex",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../../components/selection/title.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../../components/selection/title.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI9E,OAAO,KAAsB,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAEV,UAAU,EACV,SAAS,EAEV,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACvE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IAC5D,uBAAuB,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAoCF,eAAO,MAAM,cAAc,GAAI,uPAqB5B,mBAAmB,6BAmHrB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UNMIRROR_STYLE, useIsInRtlMirrorLayer } from "@rowsncolumns/grid";
|
|
1
2
|
import { Pencil1Icon } from "@rowsncolumns/icons";
|
|
2
3
|
import { IconButton } from "@rowsncolumns/ui";
|
|
3
4
|
import React, { useCallback } from "react";
|
|
@@ -27,6 +28,10 @@ const getTitleStyle = (type, x, y, width, height, offset, isOutOfView) => {
|
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
export const SelectionTitle = ({ x, y, title, height, isDragging, onMouseDown, offset = 0, type, stroke, width, range, table, pivotTable, strokeWidth = 0, onRequestEditTable, onRequestEditPivotTable, readonly = false, keepTitleWithinBounds = false, keepTitleWithinVerticalBounds = false, flipTitleToBottom = false, }) => {
|
|
31
|
+
// Right-to-left sheet: the selection layer is mirrored. The chips flip back
|
|
32
|
+
// about their own boxes so names read normally; the collaborator chip's
|
|
33
|
+
// squared corner keeps pointing at the range.
|
|
34
|
+
const unmirror = useIsInRtlMirrorLayer();
|
|
30
35
|
const handleMouseMove = useCallback((e) => {
|
|
31
36
|
// Prevent propagation to parent element
|
|
32
37
|
// Selection title gets hidden when user mouses out of
|
|
@@ -66,14 +71,14 @@ export const SelectionTitle = ({ x, y, title, height, isDragging, onMouseDown, o
|
|
|
66
71
|
// the cell instead of letting it hang past it, where a frozen
|
|
67
72
|
// pane's overflow clip would cut it off.
|
|
68
73
|
marginLeft: keepTitleWithinBounds ? 0 : 10,
|
|
69
|
-
transform: `translate(${keepTitleWithinBounds ? "-100%" : "-10px"}, ${clampToBottomEdge ? "-100%" : "50%"})`,
|
|
70
|
-
}, alignment: clampToBottomEdge ? "top" : verticalAlignment, flipX: keepTitleWithinBounds })) : type === "table" ? (React.createElement(StyledTitleWrapper,
|
|
74
|
+
transform: `translate(${keepTitleWithinBounds ? "-100%" : "-10px"}, ${clampToBottomEdge ? "-100%" : "50%"})${unmirror ? " scaleX(-1)" : ""}`,
|
|
75
|
+
}, alignment: clampToBottomEdge ? "top" : verticalAlignment, flipX: keepTitleWithinBounds !== unmirror })) : type === "table" ? (React.createElement(StyledTitleWrapper, { style: unmirror ? UNMIRROR_STYLE : undefined },
|
|
71
76
|
title,
|
|
72
77
|
" ",
|
|
73
78
|
table && !readonly ? (React.createElement(IconButton, { onClick: () => onRequestEditTable?.(table), onMouseDown: (e) => {
|
|
74
79
|
e.stopPropagation();
|
|
75
80
|
}, className: "min-h-[20px] min-w-[20px]", tooltip: "Edit table" },
|
|
76
|
-
React.createElement(Pencil1Icon, null))) : null)) : (React.createElement(StyledTitleWrapper, { className: "bg-rnc-accent" },
|
|
81
|
+
React.createElement(Pencil1Icon, null))) : null)) : (React.createElement(StyledTitleWrapper, { className: "bg-rnc-accent", style: unmirror ? UNMIRROR_STYLE : undefined },
|
|
77
82
|
title,
|
|
78
83
|
" ",
|
|
79
84
|
pivotTable && !readonly ? (React.createElement(IconButton, { onClick: () => onRequestEditPivotTable?.(pivotTable), onMouseDown: (e) => {
|
|
@@ -33,6 +33,12 @@ export type CellRendererProps<T extends CellData = CellData> = {
|
|
|
33
33
|
filterIconColor: string;
|
|
34
34
|
showCalculatedColumnIcon: boolean;
|
|
35
35
|
enableTextOverflow: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The sheet is mirrored (right-to-left): text spills toward the physical
|
|
38
|
+
* side its alignment opens onto, and in-cell adornments take Excel's
|
|
39
|
+
* right-to-left sides.
|
|
40
|
+
*/
|
|
41
|
+
rightToLeft?: boolean;
|
|
36
42
|
showHeaders: boolean;
|
|
37
43
|
isTableHeader(rowIndex: number, columnIndex: number): boolean;
|
|
38
44
|
/**
|
|
@@ -293,5 +299,5 @@ export type CellRendererProps<T extends CellData = CellData> = {
|
|
|
293
299
|
*/
|
|
294
300
|
getDefaultHorizontalAlignment(sheetId: number, rowIndex: number, columnIndex: number): HorizontalAlign | undefined;
|
|
295
301
|
};
|
|
296
|
-
export declare const useCellRenderer: <T extends CellData = CellData>({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, locale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan, activeCell, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, getErrorCheck, circleInvalidData, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing, getCellDiff, }: CellRendererProps<T>) => readonly [(props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element, (props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element | null | undefined, (cells: RendererProps[]) => React.JSX.Element];
|
|
302
|
+
export declare const useCellRenderer: <T extends CellData = CellData>({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, rightToLeft, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, locale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan, activeCell, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, getErrorCheck, circleInvalidData, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing, getCellDiff, }: CellRendererProps<T>) => readonly [(props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element, (props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element | null | undefined, (cells: RendererProps[]) => React.JSX.Element];
|
|
297
303
|
//# sourceMappingURL=use-cell-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-cell-renderer.d.ts","sourceRoot":"","sources":["../../../hooks/use-cell-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,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,UAAU,CAAC,EAAE,CACX,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;IACV;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,QAAQ,GAAG,IAAI,CAAC;IAErB;;;;;OAKG;IACH,6BAA6B,CAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,eAAe,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,+3CA8E5D,iBAAiB,CAAC,CAAC,CAAC,uBAmpBX,aAAa,uCAtoBb,aAAa,gCAqhBb,aAAa,uCApFb,aAAa,mDAoRb,aAAa,EAAE,uBA0B1B,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { CellBackgrounds } from "../components/cell/cell-backgrounds";
|
|
|
10
10
|
import { getCellNumberFormatLayout } from "../components/cell/number-format-layout";
|
|
11
11
|
import { CellDiff as CellDiffRenderer } from "../components/cell-diff";
|
|
12
12
|
import { CellOverlayRenderer } from "../components/cell-overlay";
|
|
13
|
+
import { mirrorOverflowToCellFrame } from "../components/canvas-grid/overflow";
|
|
13
14
|
import { DEFAULT_ARRAY } from "../config";
|
|
14
15
|
import { convertBorderStyleToDashArray, getBorderStyleWidth, normalizeDisplayText, } from "../helpers";
|
|
15
16
|
import { getCellBordersForRendering } from "../helpers/merged-cell-borders";
|
|
@@ -17,7 +18,7 @@ import { getStringifiedColor } from "../themes";
|
|
|
17
18
|
import { applyShowZeros } from "./show-zeros";
|
|
18
19
|
import { useCellDiffHighlight } from "./use-cell-diff-highlight";
|
|
19
20
|
import { isIndexSelected } from "./use-selected-rows-columns";
|
|
20
|
-
export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, locale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan, activeCell, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, getErrorCheck, circleInvalidData = false, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing = false, getCellDiff, }) => {
|
|
21
|
+
export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, rightToLeft = false, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, locale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan, activeCell, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, getErrorCheck, circleInvalidData = false, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing = false, getCellDiff, }) => {
|
|
21
22
|
// Version comparison diff highlighting - only active when isComparing is true
|
|
22
23
|
const { mergeCellFormatWithDiff, getDiffHighlight } = useCellDiffHighlight(isComparing ? getCellDiff : undefined);
|
|
23
24
|
// Edit
|
|
@@ -38,7 +39,12 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
38
39
|
: applyShowZeros(rawFormattedValue, effectiveValue, showZeros);
|
|
39
40
|
const dataValidation = getDataValidation(sheetId, rowIndex, columnIndex);
|
|
40
41
|
const validationType = dataValidation?.condition?.type;
|
|
41
|
-
|
|
42
|
+
// On a mirrored (right-to-left) sheet General text is right-aligned, so
|
|
43
|
+
// the spill decision reads the resolved default alignment too.
|
|
44
|
+
const horizontalAlignment = effectiveCellFormat?.horizontalAlignment ??
|
|
45
|
+
(rightToLeft
|
|
46
|
+
? getDefaultHorizontalAlignment(sheetId, rowIndex, columnIndex)
|
|
47
|
+
: undefined);
|
|
42
48
|
// Expandable
|
|
43
49
|
const [expandable, expanded] = getCellGroupingInfo(sheetId, rowIndex, columnIndex);
|
|
44
50
|
// Display style
|
|
@@ -112,6 +118,10 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
112
118
|
const centerAcrossSpan = canSpill && isCenterAcross && !isNilOrBlank(displayFormattedValue)
|
|
113
119
|
? getCenterAcrossSelectionSpan?.(sheetId, rowIndex, columnIndex)
|
|
114
120
|
: undefined;
|
|
121
|
+
// Alignment is physical: left-aligned text spills to the right, which
|
|
122
|
+
// is the next column left-to-right and the previous one on a mirrored
|
|
123
|
+
// (right-to-left) sheet.
|
|
124
|
+
const spillsToNextColumn = rightToLeft ? isRightAligned : !isRightAligned;
|
|
115
125
|
const shouldOverflow = !!centerAcrossSpan ||
|
|
116
126
|
(canSpill &&
|
|
117
127
|
(isRightAligned ? isStringValue : true) &&
|
|
@@ -120,19 +130,28 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
120
130
|
canOverflowToNextCell({ rowIndex, columnIndex: columnIndex + 1 })
|
|
121
131
|
: canOverflowToNextCell({
|
|
122
132
|
rowIndex,
|
|
123
|
-
columnIndex: columnIndex + (
|
|
133
|
+
columnIndex: columnIndex + (spillsToNextColumn ? 1 : -1),
|
|
124
134
|
})));
|
|
125
|
-
const
|
|
135
|
+
const overflowResult = centerAcrossSpan
|
|
126
136
|
? centerAcrossSpan
|
|
127
137
|
: shouldOverflow
|
|
128
138
|
? getMaximumOverflowTextWidth(displayFormattedValue, sheetId, rowIndex, columnIndex,
|
|
129
139
|
// Investigate why isHiddenCell and the instance from Sheet-Grid differs
|
|
130
|
-
canOverflowToNextCell, effectiveCellFormat?.textFormat, shouldWrap,
|
|
140
|
+
canOverflowToNextCell, effectiveCellFormat?.textFormat, shouldWrap, spillsToNextColumn ? Direction.Right : Direction.Left, isCentered)
|
|
131
141
|
: [
|
|
132
142
|
props.width,
|
|
133
143
|
DEFAULT_ARRAY,
|
|
134
144
|
undefined,
|
|
135
145
|
];
|
|
146
|
+
// The cell paints in a frame flipped back to left-to-right: map the
|
|
147
|
+
// sheet-column spill into it.
|
|
148
|
+
const [cellWidth, columnSpans, overflowLeft] = rightToLeft
|
|
149
|
+
? mirrorOverflowToCellFrame(overflowResult, {
|
|
150
|
+
columnIndex,
|
|
151
|
+
x: props.x,
|
|
152
|
+
width: props.width,
|
|
153
|
+
})
|
|
154
|
+
: overflowResult;
|
|
136
155
|
if (shouldOverflow && cellWidth > props.width) {
|
|
137
156
|
// Report the full visual width as the required buffer
|
|
138
157
|
// This ensures that even if we scroll to the far right of the overflow,
|
|
@@ -207,7 +226,7 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
207
226
|
getSparklineGroup
|
|
208
227
|
? sparklineGroupAxisFor(effectiveValue.structuredValue, () => getSparklineGroup(sheetId, { rowIndex, columnIndex }), (cell) => getEffectiveValue(sheetId, cell.rowIndex, cell.columnIndex)
|
|
209
228
|
?.structuredValue)
|
|
210
|
-
: undefined, defaultFontSizePoint: defaultFontSizePoint, lineHeightMode: lineHeightMode, sortOrder: sortOrder, StructuredResult: StructuredResult, textFormatRuns: textFormatRuns, readonly: readonly, onExpandCollapse: (...args) => onExpandCollapse?.(sheetId, ...args), getDefaultHorizontalAlignment: getDefaultHorizontalAlignment, sheetId: sheetId, ...props }));
|
|
229
|
+
: undefined, defaultFontSizePoint: defaultFontSizePoint, lineHeightMode: lineHeightMode, sortOrder: sortOrder, StructuredResult: StructuredResult, textFormatRuns: textFormatRuns, readonly: readonly, onExpandCollapse: (...args) => onExpandCollapse?.(sheetId, ...args), getDefaultHorizontalAlignment: getDefaultHorizontalAlignment, sheetId: sheetId, rightToLeft: rightToLeft, ...props }));
|
|
211
230
|
}, [
|
|
212
231
|
isComparing,
|
|
213
232
|
sheetId,
|
|
@@ -226,6 +245,7 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
226
245
|
filterIconColor,
|
|
227
246
|
showCalculatedColumnIcon,
|
|
228
247
|
enableTextOverflow,
|
|
248
|
+
rightToLeft,
|
|
229
249
|
getTextFormatRuns,
|
|
230
250
|
getTableHeaderSortOrder,
|
|
231
251
|
isTableHeader,
|
|
@@ -50,6 +50,17 @@ export type UseConditionalFormattingProps<T extends CellData> = {
|
|
|
50
50
|
* caches them per rule until the data changes.
|
|
51
51
|
*/
|
|
52
52
|
getConditionalFormatRuleStats?: (sheetId: number, rule: ConditionalFormatRule) => CfRangeStats | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The sheet displays right-to-left: a data bar whose direction is
|
|
55
|
+
* `context` (or unset) grows from the right edge, as in Excel.
|
|
56
|
+
*/
|
|
57
|
+
rightToLeft?: boolean;
|
|
53
58
|
};
|
|
54
|
-
export declare const useConditionalFormatting: <T extends CellData>({ sheetId, theme, conditionalFormats, locale, getValidationValue, isNumberValue, getSheetRowCount, getSheetColumnCount, window: evaluationWindow, getConditionalFormatResult, getConditionalFormatRuleStats, }: UseConditionalFormattingProps<T>) => Map<string, CellFormat | undefined>;
|
|
59
|
+
export declare const useConditionalFormatting: <T extends CellData>({ sheetId, theme, conditionalFormats, locale, getValidationValue, isNumberValue, getSheetRowCount, getSheetColumnCount, window: evaluationWindow, getConditionalFormatResult, getConditionalFormatRuleStats, rightToLeft, }: UseConditionalFormattingProps<T>) => Map<string, CellFormat | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* A data bar's painted direction: `leftToRight` / `rightToLeft` are
|
|
62
|
+
* explicit; `context` (and unset) follows the sheet — right-to-left on a
|
|
63
|
+
* right-to-left sheet (Excel).
|
|
64
|
+
*/
|
|
65
|
+
export declare const resolveDataBarDirection: (direction: string | null | undefined, sheetRightToLeft: boolean) => "leftToRight" | "rightToLeft";
|
|
55
66
|
//# sourceMappingURL=use-conditional-formatting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-conditional-formatting.d.ts","sourceRoot":"","sources":["../../../hooks/use-conditional-formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAWpE,OAAO,EAIL,KAAK,YAAY,EAKlB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,UAAU,EAClB,OAAO,UAAU,KAChB,UAYF,CAAC;AAmCF,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,CAAC;IACxB,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,qBAAqB,KACzB,mBAAmB,CAAC;IACzB,aAAa,CACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IACX,gBAAgB,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACtD,mBAAmB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC5D;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC1B;;;;;;;;;OASG;IACH,0BAA0B,CAAC,EAAE,CAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,qBAAqB,CAAC,IAAI,CAAC,KAChC,OAAO,CAAC;IACb;;;;;;;;;OASG;IACH,6BAA6B,CAAC,EAAE,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,qBAAqB,KACxB,YAAY,GAAG,IAAI,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"use-conditional-formatting.d.ts","sourceRoot":"","sources":["../../../hooks/use-conditional-formatting.ts"],"names":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AC,EAAE,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,qBAAqB,KACxB,YAAY,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,QAAQ,EAAE,6NAa1D,6BAA6B,CAAC,CAAC,CAAC,wCA2vBlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,kBAAkB,OAAO,KACxB,aAAa,GAAG,aAIA,CAAC"}
|
|
@@ -54,7 +54,7 @@ const fullRangeRankValue = (stats, rule) => {
|
|
|
54
54
|
const value = stats.rankValue?.(rule.rank, top, !!rule.isPercent);
|
|
55
55
|
return value !== undefined && Number.isFinite(value) ? value : undefined;
|
|
56
56
|
};
|
|
57
|
-
export const useConditionalFormatting = ({ sheetId, theme, conditionalFormats, locale, getValidationValue, isNumberValue, getSheetRowCount, getSheetColumnCount, window: evaluationWindow, getConditionalFormatResult, getConditionalFormatRuleStats, }) => {
|
|
57
|
+
export const useConditionalFormatting = ({ sheetId, theme, conditionalFormats, locale, getValidationValue, isNumberValue, getSheetRowCount, getSheetColumnCount, window: evaluationWindow, getConditionalFormatResult, getConditionalFormatRuleStats, rightToLeft = false, }) => {
|
|
58
58
|
// Whole-range statistics of windowed rules, keyed by rule id. An entry is
|
|
59
59
|
// reused while the rule object and the data getters are unchanged —
|
|
60
60
|
// scrolling (a new window) re-runs the memo below without re-scanning the
|
|
@@ -564,9 +564,7 @@ export const useConditionalFormatting = ({ sheetId, theme, conditionalFormats, l
|
|
|
564
564
|
const axisColor = dataBarRule.axisColor
|
|
565
565
|
? getStringifiedColor(dataBarRule.axisColor, theme)
|
|
566
566
|
: undefined;
|
|
567
|
-
const direction = dataBarRule.direction
|
|
568
|
-
? "rightToLeft"
|
|
569
|
-
: "leftToRight";
|
|
567
|
+
const direction = resolveDataBarDirection(dataBarRule.direction, rightToLeft);
|
|
570
568
|
const hideValue = dataBarRule.showValue === false;
|
|
571
569
|
for (const cell of cellValues) {
|
|
572
570
|
const cellId = cellIdentifier(cell.rowIndex, cell.columnIndex);
|
|
@@ -625,5 +623,15 @@ export const useConditionalFormatting = ({ sheetId, theme, conditionalFormats, l
|
|
|
625
623
|
evaluationWindow,
|
|
626
624
|
getConditionalFormatResult,
|
|
627
625
|
getConditionalFormatRuleStats,
|
|
626
|
+
rightToLeft,
|
|
628
627
|
]);
|
|
629
628
|
};
|
|
629
|
+
/**
|
|
630
|
+
* A data bar's painted direction: `leftToRight` / `rightToLeft` are
|
|
631
|
+
* explicit; `context` (and unset) follows the sheet — right-to-left on a
|
|
632
|
+
* right-to-left sheet (Excel).
|
|
633
|
+
*/
|
|
634
|
+
export const resolveDataBarDirection = (direction, sheetRightToLeft) => direction === "rightToLeft" ||
|
|
635
|
+
(direction !== "leftToRight" && sheetRightToLeft)
|
|
636
|
+
? "rightToLeft"
|
|
637
|
+
: "leftToRight";
|
|
@@ -34,8 +34,13 @@ export type UseContexMenuProps = {
|
|
|
34
34
|
getContextMenu(activeCell: CellInterface): React.ReactElement<ContextMenuProps> | null;
|
|
35
35
|
getScrollPosition: React.ComponentRef<typeof Grid>["getScrollPosition"];
|
|
36
36
|
getCellOffsetFromCoords: React.ComponentRef<typeof Grid>["getCellOffsetFromCoords"];
|
|
37
|
+
/**
|
|
38
|
+
* Right-to-left sheet: the grid's positions are logical, the menu is placed
|
|
39
|
+
* physically — mirror its x back (`containerWidth - x`).
|
|
40
|
+
*/
|
|
41
|
+
toPhysicalX?: (x: number) => number;
|
|
37
42
|
};
|
|
38
|
-
export declare const useContextMenu: ({ getCellCoordsFromOffset, getRelativePositionFromOffset, getCellOffsetFromCoords, getScrollPosition, isRowHeader, isColumnHeader, getContextMenu, ContextMenuWrapper, }: UseContexMenuProps) => {
|
|
43
|
+
export declare const useContextMenu: ({ getCellCoordsFromOffset, getRelativePositionFromOffset, getCellOffsetFromCoords, getScrollPosition, isRowHeader, isColumnHeader, getContextMenu, ContextMenuWrapper, toPhysicalX, }: UseContexMenuProps) => {
|
|
39
44
|
onContextMenu: (e: React.MouseEvent) => void;
|
|
40
45
|
contextMenuComponent: React.JSX.Element;
|
|
41
46
|
onRequestClose: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-context-menu.d.ts","sourceRoot":"","sources":["../../../hooks/use-context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAiB,MAAM,oBAAoB,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kBAAkB,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,uBAAuB,CACrB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAClC,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,6BAA6B,EAAE,KAAK,CAAC,YAAY,CAC/C,OAAO,IAAI,CACZ,CAAC,+BAA+B,CAAC,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1C;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1C;;;OAGG;IACH,cAAc,CACZ,UAAU,EAAE,aAAa,GACxB,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IAC/C,iBAAiB,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC,mBAA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,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,uLAU5B,kBAAkB;uBAuDb,KAAK,CAAC,UAAU;;;4BA5Cb,aAAa,MAAM,MAAM,MAAM,MAAM;CAyF/C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,gDAMvC,uBAAuB,sBAYzB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { isNil } from "@rowsncolumns/utils";
|
|
|
2
2
|
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { ContextMenuDropdown } from "../components/context-menu/menu";
|
|
4
4
|
import { StyledContextMenuWrapper } from "../components/context-menu/style";
|
|
5
|
-
export const useContextMenu = ({ getCellCoordsFromOffset, getRelativePositionFromOffset, getCellOffsetFromCoords, getScrollPosition, isRowHeader, isColumnHeader, getContextMenu, ContextMenuWrapper = DefaultContextMenuWrapper, }) => {
|
|
5
|
+
export const useContextMenu = ({ getCellCoordsFromOffset, getRelativePositionFromOffset, getCellOffsetFromCoords, getScrollPosition, isRowHeader, isColumnHeader, getContextMenu, ContextMenuWrapper = DefaultContextMenuWrapper, toPhysicalX, }) => {
|
|
6
6
|
const [menuPosition, setMenuPosition] = useState({ left: 0, top: 0 });
|
|
7
7
|
const [isOpen, setIsOpen] = useState(false);
|
|
8
8
|
const activeCellRef = useRef(undefined);
|
|
@@ -33,7 +33,10 @@ export const useContextMenu = ({ getCellCoordsFromOffset, getRelativePositionFro
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
// Set menu position
|
|
36
|
-
setMenuPosition({
|
|
36
|
+
setMenuPosition({
|
|
37
|
+
left: toPhysicalX ? toPhysicalX(position.x) : position.x,
|
|
38
|
+
top: position.y,
|
|
39
|
+
});
|
|
37
40
|
// Show menu
|
|
38
41
|
showMenu();
|
|
39
42
|
}, [
|
|
@@ -41,6 +44,7 @@ export const useContextMenu = ({ getCellCoordsFromOffset, getRelativePositionFro
|
|
|
41
44
|
getCellOffsetFromCoords,
|
|
42
45
|
getScrollPosition,
|
|
43
46
|
showMenu,
|
|
47
|
+
toPhysicalX,
|
|
44
48
|
]);
|
|
45
49
|
// Called when user right-clicks on the sheet
|
|
46
50
|
const handleContextMenu = useCallback((e) => {
|
|
@@ -283,9 +283,14 @@ export type UseSelectionOptions<T extends AreaStyle = AreaStyle> = {
|
|
|
283
283
|
* direction (or stays put). Absent: every range is selectable.
|
|
284
284
|
*/
|
|
285
285
|
isRangeSelectable?: (range: GridRange) => boolean;
|
|
286
|
+
/**
|
|
287
|
+
* The sheet is mirrored (right-to-left): ← / → move physically, so ← goes
|
|
288
|
+
* to the next column, as in Excel.
|
|
289
|
+
*/
|
|
290
|
+
rightToLeft?: boolean;
|
|
286
291
|
};
|
|
287
292
|
export type NewSelectionMode = "clear" | "modify" | "append";
|
|
288
|
-
export declare const useSelection: <T extends AreaStyle>({ sheetId, activeCell, onChangeActiveCell: onChangeActiveCellProp, selections, onChangeSelections: onChangeSelectionsProp, columnCount, rowCount, selectionPolicy, newSelectionMode, allowDeselectSelection, onFill, onFillHandleRelease, onFillShrink, onInsertCutCells, onCopySelection, onInsertCopiedCells, onSelectionDragMenu, confirmMoveOverwrite, isHiddenRow, isHiddenColumn, alwaysScrollToActiveCell, selectionTopBound, selectionBottomBound, selectionLeftBound, selectionRightBound, mouseDownInterceptor, mouseMoveInterceptor, mergedCells, merges, canSelectionSpanMergedCells, getValue, onMoveSelection, getCellCoordsFromOffset, getCellBounds, getViewPort, focus, scrollToCell, isMergedCell, enableSelectOnEnterKey, enterKeyDirection, formulaMode, isTouchDevice, getDataRowCount, getDataColumnCount, getDataRegion, isRowHeader, isColumnHeader, enableDataBoundaryNavigation, tables, onInsertTableRow, isRangeSelectable: isRangeSelectableProp, }: UseSelectionOptions<T>) => {
|
|
293
|
+
export declare const useSelection: <T extends AreaStyle>({ sheetId, activeCell, onChangeActiveCell: onChangeActiveCellProp, selections, onChangeSelections: onChangeSelectionsProp, columnCount, rowCount, selectionPolicy, newSelectionMode, allowDeselectSelection, onFill, onFillHandleRelease, onFillShrink, onInsertCutCells, onCopySelection, onInsertCopiedCells, onSelectionDragMenu, confirmMoveOverwrite, isHiddenRow, isHiddenColumn, alwaysScrollToActiveCell, selectionTopBound, selectionBottomBound, selectionLeftBound, selectionRightBound, mouseDownInterceptor, mouseMoveInterceptor, mergedCells, merges, canSelectionSpanMergedCells, getValue, onMoveSelection, getCellCoordsFromOffset, getCellBounds, getViewPort, focus, scrollToCell, isMergedCell, enableSelectOnEnterKey, enterKeyDirection, formulaMode, isTouchDevice, getDataRowCount, getDataColumnCount, getDataRegion, isRowHeader, isColumnHeader, enableDataBoundaryNavigation, tables, onInsertTableRow, isRangeSelectable: isRangeSelectableProp, rightToLeft, }: UseSelectionOptions<T>) => {
|
|
289
294
|
isDragging: boolean;
|
|
290
295
|
/** True while a selection-border drag would copy on release (Ctrl / ⌥ held). */
|
|
291
296
|
isDragCopy: boolean;
|