@rowsncolumns/spreadsheet 10.8.2 → 10.9.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/api/index-ranges.d.ts +36 -0
- package/dist/cjs/api/index-ranges.d.ts.map +1 -0
- package/dist/cjs/api/index-ranges.js +178 -0
- package/dist/cjs/api/multi-selection.d.ts +15 -0
- package/dist/cjs/api/multi-selection.d.ts.map +1 -1
- package/dist/cjs/api/multi-selection.js +40 -1
- package/dist/cjs/api/scheduler.d.ts +1 -1
- package/dist/cjs/api/scheduler.d.ts.map +1 -1
- package/dist/cjs/api/scheduler.js +2 -4
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/copied-range.atom.d.ts +13 -0
- package/dist/cjs/atoms/copied-range.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/copied-range.atom.js +15 -0
- package/dist/cjs/atoms/index.d.ts +2 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +2 -0
- package/dist/cjs/atoms/selected-chart-embed.atom.d.ts +27 -1
- package/dist/cjs/atoms/selected-chart-embed.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/selected-chart-embed.atom.js +66 -3
- package/dist/cjs/atoms/selected-object-formula.atom.d.ts +12 -0
- package/dist/cjs/atoms/selected-object-formula.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/selected-object-formula.atom.js +19 -0
- package/dist/cjs/components/canvas-grid/helpers.d.ts +7 -0
- package/dist/cjs/components/canvas-grid/helpers.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/helpers.js +35 -1
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +283 -90
- package/dist/cjs/components/canvas-grid/typings.d.ts +69 -3
- 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 +1 -1
- package/dist/cjs/components/cell-arrow/index.d.ts +7 -1
- package/dist/cjs/components/cell-arrow/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-arrow/index.js +27 -3
- 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 +7 -3
- package/dist/cjs/components/context-menu/index.d.ts +19 -3
- package/dist/cjs/components/context-menu/index.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.js +69 -47
- package/dist/cjs/components/embeds/embed-component.d.ts +7 -1
- package/dist/cjs/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +5 -1
- package/dist/cjs/components/embeds/embed-draggable.d.ts +3 -1
- package/dist/cjs/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.js +10 -1
- package/dist/cjs/components/embeds/index.d.ts +1 -0
- package/dist/cjs/components/embeds/index.d.ts.map +1 -1
- package/dist/cjs/components/embeds/index.js +1 -0
- package/dist/cjs/components/embeds/linked-picture.d.ts +54 -0
- package/dist/cjs/components/embeds/linked-picture.d.ts.map +1 -0
- package/dist/cjs/components/embeds/linked-picture.js +217 -0
- package/dist/cjs/components/outline-gutter/index.d.ts.map +1 -1
- package/dist/cjs/components/outline-gutter/index.js +96 -48
- package/dist/cjs/components/outline-gutter/offsets.d.ts +32 -0
- package/dist/cjs/components/outline-gutter/offsets.d.ts.map +1 -0
- package/dist/cjs/components/outline-gutter/offsets.js +59 -0
- package/dist/cjs/components/page-layout-view/compute-page-layout.d.ts +86 -0
- package/dist/cjs/components/page-layout-view/compute-page-layout.d.ts.map +1 -0
- package/dist/cjs/components/page-layout-view/compute-page-layout.js +196 -0
- package/dist/cjs/components/page-layout-view/header-footer-codes.d.ts +32 -0
- package/dist/cjs/components/page-layout-view/header-footer-codes.d.ts.map +1 -0
- package/dist/cjs/components/page-layout-view/header-footer-codes.js +173 -0
- package/dist/cjs/components/page-layout-view/index.d.ts +4 -0
- package/dist/cjs/components/page-layout-view/index.d.ts.map +1 -0
- package/dist/cjs/components/page-layout-view/index.js +17 -0
- package/dist/cjs/components/page-layout-view/page-layout-chrome.d.ts +50 -0
- package/dist/cjs/components/page-layout-view/page-layout-chrome.d.ts.map +1 -0
- package/dist/cjs/components/page-layout-view/page-layout-chrome.js +432 -0
- package/dist/cjs/components/print-preview/use-page-layout.d.ts +5 -0
- package/dist/cjs/components/print-preview/use-page-layout.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/use-page-layout.js +4 -3
- package/dist/cjs/components/toolbar/text-horizontal-align-selector.d.ts +5 -0
- package/dist/cjs/components/toolbar/text-horizontal-align-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-horizontal-align-selector.js +36 -30
- package/dist/cjs/components/toolbar/text-vertical-align-selector.d.ts +5 -0
- package/dist/cjs/components/toolbar/text-vertical-align-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-vertical-align-selector.js +26 -21
- package/dist/cjs/components/toolbar/text-wrap-selector.d.ts +3 -0
- package/dist/cjs/components/toolbar/text-wrap-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-wrap-selector.js +33 -28
- package/dist/cjs/config.d.ts +1 -1
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +2 -1
- package/dist/cjs/helpers.d.ts +6 -0
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +17 -1
- package/dist/cjs/hooks/use-cell-renderer.d.ts +6 -4
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +5 -4
- package/dist/cjs/hooks/use-context-setter.d.ts.map +1 -1
- package/dist/cjs/hooks/use-context-setter.js +5 -1
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/cjs/hooks/use-copy-paste-cut.js +14 -3
- package/dist/cjs/hooks/use-embeds-charts.d.ts +13 -2
- package/dist/cjs/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/cjs/hooks/use-embeds-charts.js +151 -17
- package/dist/cjs/hooks/use-get-tooltip.d.ts +6 -1
- package/dist/cjs/hooks/use-get-tooltip.d.ts.map +1 -1
- package/dist/cjs/hooks/use-get-tooltip.js +4 -2
- package/dist/cjs/hooks/use-grid-children.d.ts +3 -1
- package/dist/cjs/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/cjs/hooks/use-grid-children.js +10 -5
- package/dist/cjs/hooks/use-header-actions.d.ts +6 -3
- package/dist/cjs/hooks/use-header-actions.d.ts.map +1 -1
- package/dist/cjs/hooks/use-header-actions.js +7 -8
- package/dist/cjs/hooks/use-keyboard-handler.d.ts +7 -5
- package/dist/cjs/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +14 -31
- package/dist/cjs/hooks/use-move-columns-rows.d.ts +5 -2
- package/dist/cjs/hooks/use-move-columns-rows.d.ts.map +1 -1
- package/dist/cjs/hooks/use-move-columns-rows.js +36 -32
- package/dist/cjs/hooks/use-selected-rows-columns.d.ts +24 -6
- package/dist/cjs/hooks/use-selected-rows-columns.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selected-rows-columns.js +42 -35
- package/dist/cjs/hooks/use-selection.d.ts +10 -1
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +35 -18
- package/dist/cjs/hooks/use-shown-notes.d.ts +56 -0
- package/dist/cjs/hooks/use-shown-notes.d.ts.map +1 -0
- package/dist/cjs/hooks/use-shown-notes.js +142 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +36 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/utils/z-order.d.ts +12 -0
- package/dist/cjs/utils/z-order.d.ts.map +1 -1
- package/dist/cjs/utils/z-order.js +56 -1
- package/dist/esm/api/index-ranges.d.ts +36 -0
- package/dist/esm/api/index-ranges.d.ts.map +1 -0
- package/dist/esm/api/index-ranges.js +114 -0
- package/dist/esm/api/multi-selection.d.ts +15 -0
- package/dist/esm/api/multi-selection.d.ts.map +1 -1
- package/dist/esm/api/multi-selection.js +21 -0
- package/dist/esm/api/scheduler.d.ts +1 -1
- package/dist/esm/api/scheduler.d.ts.map +1 -1
- package/dist/esm/api/scheduler.js +2 -2
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/copied-range.atom.d.ts +13 -0
- package/dist/esm/atoms/copied-range.atom.d.ts.map +1 -0
- package/dist/esm/atoms/copied-range.atom.js +10 -0
- package/dist/esm/atoms/index.d.ts +2 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +2 -0
- package/dist/esm/atoms/selected-chart-embed.atom.d.ts +27 -1
- package/dist/esm/atoms/selected-chart-embed.atom.d.ts.map +1 -1
- package/dist/esm/atoms/selected-chart-embed.atom.js +63 -3
- package/dist/esm/atoms/selected-object-formula.atom.d.ts +12 -0
- package/dist/esm/atoms/selected-object-formula.atom.d.ts.map +1 -0
- package/dist/esm/atoms/selected-object-formula.atom.js +10 -0
- package/dist/esm/components/canvas-grid/helpers.d.ts +7 -0
- package/dist/esm/components/canvas-grid/helpers.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/helpers.js +22 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +208 -26
- package/dist/esm/components/canvas-grid/typings.d.ts +69 -3
- 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 +1 -1
- package/dist/esm/components/cell-arrow/index.d.ts +7 -1
- package/dist/esm/components/cell-arrow/index.d.ts.map +1 -1
- package/dist/esm/components/cell-arrow/index.js +24 -2
- 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 +7 -3
- package/dist/esm/components/context-menu/index.d.ts +19 -3
- package/dist/esm/components/context-menu/index.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.js +67 -45
- package/dist/esm/components/embeds/embed-component.d.ts +7 -1
- package/dist/esm/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +5 -1
- package/dist/esm/components/embeds/embed-draggable.d.ts +3 -1
- package/dist/esm/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.js +10 -1
- package/dist/esm/components/embeds/index.d.ts +1 -0
- package/dist/esm/components/embeds/index.d.ts.map +1 -1
- package/dist/esm/components/embeds/index.js +1 -0
- package/dist/esm/components/embeds/linked-picture.d.ts +54 -0
- package/dist/esm/components/embeds/linked-picture.d.ts.map +1 -0
- package/dist/esm/components/embeds/linked-picture.js +193 -0
- package/dist/esm/components/outline-gutter/index.d.ts.map +1 -1
- package/dist/esm/components/outline-gutter/index.js +90 -45
- package/dist/esm/components/outline-gutter/offsets.d.ts +32 -0
- package/dist/esm/components/outline-gutter/offsets.d.ts.map +1 -0
- package/dist/esm/components/outline-gutter/offsets.js +46 -0
- package/dist/esm/components/page-layout-view/compute-page-layout.d.ts +86 -0
- package/dist/esm/components/page-layout-view/compute-page-layout.d.ts.map +1 -0
- package/dist/esm/components/page-layout-view/compute-page-layout.js +152 -0
- package/dist/esm/components/page-layout-view/header-footer-codes.d.ts +32 -0
- package/dist/esm/components/page-layout-view/header-footer-codes.d.ts.map +1 -0
- package/dist/esm/components/page-layout-view/header-footer-codes.js +149 -0
- package/dist/esm/components/page-layout-view/index.d.ts +4 -0
- package/dist/esm/components/page-layout-view/index.d.ts.map +1 -0
- package/dist/esm/components/page-layout-view/index.js +3 -0
- package/dist/esm/components/page-layout-view/page-layout-chrome.d.ts +50 -0
- package/dist/esm/components/page-layout-view/page-layout-chrome.d.ts.map +1 -0
- package/dist/esm/components/page-layout-view/page-layout-chrome.js +351 -0
- package/dist/esm/components/print-preview/use-page-layout.d.ts +5 -0
- package/dist/esm/components/print-preview/use-page-layout.d.ts.map +1 -1
- package/dist/esm/components/print-preview/use-page-layout.js +1 -1
- package/dist/esm/components/toolbar/text-horizontal-align-selector.d.ts +5 -0
- package/dist/esm/components/toolbar/text-horizontal-align-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-horizontal-align-selector.js +29 -25
- package/dist/esm/components/toolbar/text-vertical-align-selector.d.ts +5 -0
- package/dist/esm/components/toolbar/text-vertical-align-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-vertical-align-selector.js +23 -20
- package/dist/esm/components/toolbar/text-wrap-selector.d.ts +3 -0
- package/dist/esm/components/toolbar/text-wrap-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-wrap-selector.js +30 -27
- package/dist/esm/config.d.ts +1 -1
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +1 -1
- package/dist/esm/helpers.d.ts +6 -0
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +15 -0
- package/dist/esm/hooks/use-cell-renderer.d.ts +6 -4
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +5 -4
- package/dist/esm/hooks/use-context-setter.d.ts.map +1 -1
- package/dist/esm/hooks/use-context-setter.js +5 -1
- package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/esm/hooks/use-copy-paste-cut.js +16 -4
- package/dist/esm/hooks/use-embeds-charts.d.ts +13 -2
- package/dist/esm/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/esm/hooks/use-embeds-charts.js +146 -18
- package/dist/esm/hooks/use-get-tooltip.d.ts +6 -1
- package/dist/esm/hooks/use-get-tooltip.d.ts.map +1 -1
- package/dist/esm/hooks/use-get-tooltip.js +4 -2
- package/dist/esm/hooks/use-grid-children.d.ts +3 -1
- package/dist/esm/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/esm/hooks/use-grid-children.js +6 -1
- package/dist/esm/hooks/use-header-actions.d.ts +6 -3
- package/dist/esm/hooks/use-header-actions.d.ts.map +1 -1
- package/dist/esm/hooks/use-header-actions.js +7 -8
- package/dist/esm/hooks/use-keyboard-handler.d.ts +7 -5
- package/dist/esm/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +16 -19
- package/dist/esm/hooks/use-move-columns-rows.d.ts +5 -2
- package/dist/esm/hooks/use-move-columns-rows.d.ts.map +1 -1
- package/dist/esm/hooks/use-move-columns-rows.js +13 -9
- package/dist/esm/hooks/use-selected-rows-columns.d.ts +24 -6
- package/dist/esm/hooks/use-selected-rows-columns.d.ts.map +1 -1
- package/dist/esm/hooks/use-selected-rows-columns.js +38 -34
- package/dist/esm/hooks/use-selection.d.ts +10 -1
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +33 -16
- package/dist/esm/hooks/use-shown-notes.d.ts +56 -0
- package/dist/esm/hooks/use-shown-notes.d.ts.map +1 -0
- package/dist/esm/hooks/use-shown-notes.js +128 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +36 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils/z-order.d.ts +12 -0
- package/dist/esm/utils/z-order.d.ts.map +1 -1
- package/dist/esm/utils/z-order.js +59 -0
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
// What Page Layout view draws around the cells: the desk between pages, each
|
|
2
|
+
// page's white margins, the rulers, and the header and footer in the top and
|
|
3
|
+
// bottom margins, editable in place (Excel: click the header area of a page,
|
|
4
|
+
// type in its left, center or right section; click a cell to finish).
|
|
5
|
+
//
|
|
6
|
+
// The cells themselves are the grid's: the grid leaves the margins and the
|
|
7
|
+
// desk empty (`Grid`'s `getRowGap` / `getColumnGap`), and this layer, placed
|
|
8
|
+
// in the grid's children with the grid's own offsets, covers exactly that
|
|
9
|
+
// space — so gridlines and spilled text stop at the page edge.
|
|
10
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
11
|
+
import { DPI } from "../print-preview/settings";
|
|
12
|
+
import { resolveHeaderFooter } from "../print-preview/sheet-page-setup";
|
|
13
|
+
import { PAGE_LAYOUT_RULER_SIZE } from "./compute-page-layout";
|
|
14
|
+
import { buildHeaderFooter, headerFooterKey, parseHeaderFooter, withHeaderFooterText, } from "./header-footer-codes";
|
|
15
|
+
export const PAGE_LAYOUT_DESK_COLOR = "#E6E6E6";
|
|
16
|
+
const PAPER_COLOR = "#FFFFFF";
|
|
17
|
+
const RULER_COLOR = "#F3F3F3";
|
|
18
|
+
const RULER_MARGIN_COLOR = "#D9D9D9";
|
|
19
|
+
const RULER_TICK_COLOR = "#8A8A8A";
|
|
20
|
+
const ZONE_HOVER_BORDER = "#A6A6A6";
|
|
21
|
+
const PLACEHOLDER_COLOR = "#7F7F7F";
|
|
22
|
+
/** Excel's default header / footer font: Calibri 11 pt. */
|
|
23
|
+
const HEADER_FONT_PX = (11 * DPI) / 72;
|
|
24
|
+
const SECTIONS = ["left", "center", "right"];
|
|
25
|
+
const visibleBands = (bandOf, start, stop, count) => {
|
|
26
|
+
const first = Math.max(0, bandOf(Math.max(1, start ?? 1)) - 1);
|
|
27
|
+
const lastBand = bandOf(Math.max(1, stop ?? 1));
|
|
28
|
+
const last = Math.min(count - 1, (lastBand === -1 ? count - 1 : lastBand) + 1);
|
|
29
|
+
const bands = [];
|
|
30
|
+
for (let band = first; band <= last; band++)
|
|
31
|
+
bands.push(band);
|
|
32
|
+
return bands;
|
|
33
|
+
};
|
|
34
|
+
/** The pages the grid's rendered rows and columns touch, and where they sit. */
|
|
35
|
+
export const getVisiblePageBoxes = (layout, zoom, grid) => {
|
|
36
|
+
const { getRowOffset, getColumnOffset } = grid;
|
|
37
|
+
if (!getRowOffset || !getColumnOffset)
|
|
38
|
+
return [];
|
|
39
|
+
const rows = visibleBands(layout.rowBandOf, grid.rowStartIndex, grid.rowStopIndex, layout.rowBands.length);
|
|
40
|
+
const columns = visibleBands(layout.columnBandOf, grid.columnStartIndex, grid.columnStopIndex, layout.columnBands.length);
|
|
41
|
+
const boxes = [];
|
|
42
|
+
for (const rowBand of rows) {
|
|
43
|
+
const rowSpan = layout.rowBands[rowBand];
|
|
44
|
+
const usedTop = getRowOffset(rowSpan.start);
|
|
45
|
+
const top = usedTop - layout.margins.top * zoom;
|
|
46
|
+
for (const columnBand of columns) {
|
|
47
|
+
const columnSpan = layout.columnBands[columnBand];
|
|
48
|
+
const usedLeft = getColumnOffset(columnSpan.start);
|
|
49
|
+
const left = usedLeft - layout.margins.left * zoom;
|
|
50
|
+
boxes.push({
|
|
51
|
+
rowBand,
|
|
52
|
+
columnBand,
|
|
53
|
+
page: layout.pageAt(rowBand, columnBand),
|
|
54
|
+
left,
|
|
55
|
+
top,
|
|
56
|
+
width: layout.paper.width * zoom,
|
|
57
|
+
height: layout.paper.height * zoom,
|
|
58
|
+
usedLeft,
|
|
59
|
+
usedTop,
|
|
60
|
+
usedRight: usedLeft + columnSpan.size * zoom,
|
|
61
|
+
usedBottom: usedTop + rowSpan.size * zoom,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return boxes;
|
|
66
|
+
};
|
|
67
|
+
const rect = (key, left, top, width, height, background, extra) => width > 0 && height > 0 ? (React.createElement("div", { key: key, style: {
|
|
68
|
+
position: "absolute",
|
|
69
|
+
left,
|
|
70
|
+
top,
|
|
71
|
+
width,
|
|
72
|
+
height,
|
|
73
|
+
background,
|
|
74
|
+
// The desk and the margins are not cells: a click there selects none.
|
|
75
|
+
pointerEvents: "auto",
|
|
76
|
+
...extra,
|
|
77
|
+
} })) : null;
|
|
78
|
+
/** A ruler along one edge of a page: inches, ticks every eighth, the margins shaded. */
|
|
79
|
+
const Ruler = ({ orientation, left, top, length, thickness, zoom, marginStart, marginEnd, }) => {
|
|
80
|
+
const horizontal = orientation === "horizontal";
|
|
81
|
+
const eighth = (DPI / 8) * zoom;
|
|
82
|
+
const ticks = [];
|
|
83
|
+
const count = Math.floor(length / eighth);
|
|
84
|
+
for (let i = 1; i <= count; i++) {
|
|
85
|
+
const at = i * eighth;
|
|
86
|
+
const inch = i % 8 === 0;
|
|
87
|
+
const half = i % 4 === 0;
|
|
88
|
+
const size = inch
|
|
89
|
+
? thickness * 0.5
|
|
90
|
+
: half
|
|
91
|
+
? thickness * 0.3
|
|
92
|
+
: thickness * 0.18;
|
|
93
|
+
ticks.push(React.createElement("div", { key: i, style: {
|
|
94
|
+
position: "absolute",
|
|
95
|
+
background: RULER_TICK_COLOR,
|
|
96
|
+
...(horizontal
|
|
97
|
+
? { left: at, bottom: 0, width: 1, height: size }
|
|
98
|
+
: { top: at, right: 0, height: 1, width: size }),
|
|
99
|
+
} }));
|
|
100
|
+
if (inch) {
|
|
101
|
+
ticks.push(React.createElement("span", { key: `n${i}`, style: {
|
|
102
|
+
position: "absolute",
|
|
103
|
+
fontSize: Math.max(8, 9 * zoom),
|
|
104
|
+
lineHeight: 1,
|
|
105
|
+
color: RULER_TICK_COLOR,
|
|
106
|
+
...(horizontal
|
|
107
|
+
? { left: at - 3, top: 1 }
|
|
108
|
+
: { top: at - 4, left: 1 }),
|
|
109
|
+
} }, i / 8));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return (React.createElement("div", { "data-page-layout-ruler": orientation, style: {
|
|
113
|
+
position: "absolute",
|
|
114
|
+
left,
|
|
115
|
+
top,
|
|
116
|
+
width: horizontal ? length : thickness,
|
|
117
|
+
height: horizontal ? thickness : length,
|
|
118
|
+
background: RULER_COLOR,
|
|
119
|
+
overflow: "hidden",
|
|
120
|
+
} },
|
|
121
|
+
React.createElement("div", { style: {
|
|
122
|
+
position: "absolute",
|
|
123
|
+
background: RULER_MARGIN_COLOR,
|
|
124
|
+
...(horizontal
|
|
125
|
+
? { left: 0, top: 0, height: thickness, width: marginStart }
|
|
126
|
+
: { left: 0, top: 0, width: thickness, height: marginStart }),
|
|
127
|
+
} }),
|
|
128
|
+
React.createElement("div", { style: {
|
|
129
|
+
position: "absolute",
|
|
130
|
+
background: RULER_MARGIN_COLOR,
|
|
131
|
+
...(horizontal
|
|
132
|
+
? { right: 0, top: 0, height: thickness, width: marginEnd }
|
|
133
|
+
: { left: 0, bottom: 0, width: thickness, height: marginEnd }),
|
|
134
|
+
} }),
|
|
135
|
+
ticks));
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* One page's header (or footer): three sections across the space between
|
|
139
|
+
* the left and right margins. Shows what prints; in edit mode, the stored
|
|
140
|
+
* text with Excel's display codes.
|
|
141
|
+
*/
|
|
142
|
+
const HeaderFooterZone = ({ kind, box, layout, zoom, stored, context, editing, editable, onStartEdit, onCommit, onCancel, }) => {
|
|
143
|
+
const { margins } = layout;
|
|
144
|
+
const left = box.left + margins.left * zoom;
|
|
145
|
+
const width = box.width - (margins.left + margins.right) * zoom;
|
|
146
|
+
const fontSize = HEADER_FONT_PX * zoom * layout.scale;
|
|
147
|
+
const minHeight = Math.max(fontSize * 1.4, 16 * zoom);
|
|
148
|
+
const position = kind === "header"
|
|
149
|
+
? { top: box.top + margins.header * zoom }
|
|
150
|
+
: { top: box.top + box.height - margins.footer * zoom - minHeight };
|
|
151
|
+
const resolved = resolveHeaderFooter(stored, {
|
|
152
|
+
pageNumber: layout.firstPageNumber - 1 + box.page.ordinal,
|
|
153
|
+
pageCount: layout.pageCount,
|
|
154
|
+
...context,
|
|
155
|
+
});
|
|
156
|
+
const empty = !resolved;
|
|
157
|
+
const groupRef = useRef(null);
|
|
158
|
+
// Escape discards: a blur that follows (the editor unmounting) must not commit.
|
|
159
|
+
const cancelledRef = useRef(false);
|
|
160
|
+
const [draft, setDraft] = useState();
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
cancelledRef.current = false;
|
|
163
|
+
if (editing)
|
|
164
|
+
setDraft(parseHeaderFooter(stored));
|
|
165
|
+
else
|
|
166
|
+
setDraft(undefined);
|
|
167
|
+
// Start from the stored text each time editing starts.
|
|
168
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
169
|
+
}, [editing !== undefined]);
|
|
170
|
+
const zoneLabel = kind === "header" ? "Header" : "Footer";
|
|
171
|
+
const common = {
|
|
172
|
+
position: "absolute",
|
|
173
|
+
left,
|
|
174
|
+
width,
|
|
175
|
+
minHeight,
|
|
176
|
+
display: "flex",
|
|
177
|
+
pointerEvents: "auto",
|
|
178
|
+
fontFamily: "Calibri, Carlito, Arial, sans-serif",
|
|
179
|
+
fontSize,
|
|
180
|
+
lineHeight: 1.2,
|
|
181
|
+
color: "#000",
|
|
182
|
+
...position,
|
|
183
|
+
};
|
|
184
|
+
if (editing && draft) {
|
|
185
|
+
return (React.createElement("div", { ref: groupRef, role: "group", "aria-label": zoneLabel, "data-page-layout-zone": kind, "data-editing": "", style: { ...common, outline: `1px dashed ${ZONE_HOVER_BORDER}` }, onMouseDown: (event) => event.stopPropagation(), onBlur: (event) => {
|
|
186
|
+
if (cancelledRef.current)
|
|
187
|
+
return;
|
|
188
|
+
if (groupRef.current?.contains(event.relatedTarget))
|
|
189
|
+
return;
|
|
190
|
+
onCommit(draft);
|
|
191
|
+
} }, SECTIONS.map((section) => (React.createElement("textarea", { key: section, "aria-label": `${zoneLabel} ${section} section`, "data-page-layout-section": section, autoFocus: section === editing, value: draft[section].text, rows: Math.max(1, draft[section].text.split("\n").length), onChange: (event) => setDraft({
|
|
192
|
+
...draft,
|
|
193
|
+
[section]: { ...draft[section], text: event.target.value },
|
|
194
|
+
}), onKeyDown: (event) => {
|
|
195
|
+
event.stopPropagation();
|
|
196
|
+
if (event.key === "Escape") {
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
cancelledRef.current = true;
|
|
199
|
+
onCancel();
|
|
200
|
+
}
|
|
201
|
+
}, style: {
|
|
202
|
+
flex: 1,
|
|
203
|
+
minWidth: 0,
|
|
204
|
+
resize: "none",
|
|
205
|
+
border: `1px solid ${ZONE_HOVER_BORDER}`,
|
|
206
|
+
background: PAPER_COLOR,
|
|
207
|
+
font: "inherit",
|
|
208
|
+
textAlign: section,
|
|
209
|
+
padding: 1,
|
|
210
|
+
outline: "none",
|
|
211
|
+
} })))));
|
|
212
|
+
}
|
|
213
|
+
return (React.createElement("div", { role: "group", "aria-label": zoneLabel, "data-page-layout-zone": kind, className: "group", style: { ...common, cursor: editable ? "text" : undefined }, onMouseDown: (event) => {
|
|
214
|
+
// The margin is not a cell: a click here never selects one.
|
|
215
|
+
event.stopPropagation();
|
|
216
|
+
} }, SECTIONS.map((section) => (React.createElement("div", { key: section, "data-page-layout-section": section, onClick: editable ? () => onStartEdit(section) : undefined, className: editable
|
|
217
|
+
? "group-hover:outline group-hover:outline-1 group-hover:outline-dashed"
|
|
218
|
+
: undefined, style: {
|
|
219
|
+
flex: 1,
|
|
220
|
+
minWidth: 0,
|
|
221
|
+
whiteSpace: "pre-wrap",
|
|
222
|
+
overflow: "hidden",
|
|
223
|
+
textAlign: section,
|
|
224
|
+
outlineColor: ZONE_HOVER_BORDER,
|
|
225
|
+
} },
|
|
226
|
+
resolved?.[section] ?? "",
|
|
227
|
+
empty && editable && section === "center" ? (React.createElement("span", { "data-page-layout-placeholder": kind, className: kind === "footer" ? "invisible group-hover:visible" : undefined, style: {
|
|
228
|
+
color: PLACEHOLDER_COLOR,
|
|
229
|
+
fontSize: Math.max(10, 12 * zoom),
|
|
230
|
+
} }, kind === "header"
|
|
231
|
+
? "Click to add header"
|
|
232
|
+
: "Click to add footer")) : null)))));
|
|
233
|
+
};
|
|
234
|
+
/** Body layer: desk, margins, rulers, headers and footers of the visible pages. */
|
|
235
|
+
export const PageLayoutChrome = ({ layout, zoom, grid, headerFooter, context, onChangeHeaderFooter, }) => {
|
|
236
|
+
// Read on every grid render: the offsets move with resizes and scrolling.
|
|
237
|
+
const boxes = getVisiblePageBoxes(layout, zoom, grid);
|
|
238
|
+
const [editing, setEditing] = useState();
|
|
239
|
+
const commit = useCallback((kind, ordinal, sections) => {
|
|
240
|
+
setEditing(undefined);
|
|
241
|
+
const key = headerFooterKey(headerFooter, kind, ordinal);
|
|
242
|
+
const before = headerFooter?.[key] ?? undefined;
|
|
243
|
+
const after = buildHeaderFooter(sections);
|
|
244
|
+
if ((before ?? "") === (after ?? ""))
|
|
245
|
+
return;
|
|
246
|
+
onChangeHeaderFooter?.(withHeaderFooterText(headerFooter, key, after));
|
|
247
|
+
}, [headerFooter, onChangeHeaderFooter]);
|
|
248
|
+
const { scrollLeft, scrollTop, containerWidth, containerHeight } = grid;
|
|
249
|
+
const viewLeft = scrollLeft + grid.frozenColumnWidth;
|
|
250
|
+
const viewTop = scrollTop + grid.frozenRowHeight;
|
|
251
|
+
const viewRight = scrollLeft + containerWidth;
|
|
252
|
+
const viewBottom = scrollTop + containerHeight;
|
|
253
|
+
const ruler = layout.rulers ? PAGE_LAYOUT_RULER_SIZE * zoom : 0;
|
|
254
|
+
const nodes = [];
|
|
255
|
+
// Desk: above and between page rows, left of and between page columns.
|
|
256
|
+
const rowTops = new Map();
|
|
257
|
+
const columnLefts = new Map();
|
|
258
|
+
for (const box of boxes) {
|
|
259
|
+
if (!rowTops.has(box.rowBand))
|
|
260
|
+
rowTops.set(box.rowBand, box);
|
|
261
|
+
if (!columnLefts.has(box.columnBand))
|
|
262
|
+
columnLefts.set(box.columnBand, box);
|
|
263
|
+
}
|
|
264
|
+
for (const [rowBand, box] of rowTops) {
|
|
265
|
+
const above = rowTops.get(rowBand - 1);
|
|
266
|
+
const from = rowBand === 0
|
|
267
|
+
? Math.min(grid.frozenRowHeight, box.top)
|
|
268
|
+
: above
|
|
269
|
+
? above.top + above.height
|
|
270
|
+
: box.top - layout.deskGap * zoom - ruler;
|
|
271
|
+
nodes.push(rect(`desk-r${rowBand}`, viewLeft, from, viewRight - viewLeft, box.top - from, PAGE_LAYOUT_DESK_COLOR));
|
|
272
|
+
}
|
|
273
|
+
for (const [columnBand, box] of columnLefts) {
|
|
274
|
+
const before = columnLefts.get(columnBand - 1);
|
|
275
|
+
const from = columnBand === 0
|
|
276
|
+
? Math.min(grid.frozenColumnWidth, box.left)
|
|
277
|
+
: before
|
|
278
|
+
? before.left + before.width
|
|
279
|
+
: box.left - layout.deskGap * zoom - ruler;
|
|
280
|
+
nodes.push(rect(`desk-c${columnBand}`, from, viewTop, box.left - from, viewBottom - viewTop, PAGE_LAYOUT_DESK_COLOR));
|
|
281
|
+
}
|
|
282
|
+
// Below the last page row / right of the last page column the sheet ends.
|
|
283
|
+
const lastRow = layout.rowBands.length - 1;
|
|
284
|
+
const lastColumn = layout.columnBands.length - 1;
|
|
285
|
+
for (const box of boxes) {
|
|
286
|
+
const key = `${box.rowBand}:${box.columnBand}`;
|
|
287
|
+
const right = box.left + box.width;
|
|
288
|
+
const bottom = box.top + box.height;
|
|
289
|
+
// White margins around the cells (the leftover of a short page included).
|
|
290
|
+
nodes.push(rect(`m-t${key}`, box.left, box.top, box.width, box.usedTop - box.top, PAPER_COLOR), rect(`m-b${key}`, box.left, box.usedBottom, box.width, bottom - box.usedBottom, PAPER_COLOR), rect(`m-l${key}`, box.left, box.usedTop, box.usedLeft - box.left, box.usedBottom - box.usedTop, PAPER_COLOR), rect(`m-r${key}`, box.usedRight, box.usedTop, right - box.usedRight, box.usedBottom - box.usedTop, PAPER_COLOR));
|
|
291
|
+
if (box.rowBand === lastRow) {
|
|
292
|
+
nodes.push(rect(`desk-end-r${key}`, box.left - layout.deskGap * zoom - ruler, bottom, box.width + layout.deskGap * zoom + ruler, Math.max(0, viewBottom - bottom), PAGE_LAYOUT_DESK_COLOR));
|
|
293
|
+
}
|
|
294
|
+
if (box.columnBand === lastColumn) {
|
|
295
|
+
nodes.push(rect(`desk-end-c${key}`, right, box.top - layout.deskGap * zoom - ruler, Math.max(0, viewRight - right), box.height + layout.deskGap * zoom + ruler, PAGE_LAYOUT_DESK_COLOR));
|
|
296
|
+
}
|
|
297
|
+
if (layout.rulers) {
|
|
298
|
+
nodes.push(React.createElement(Ruler, { key: `ruler-h${key}`, orientation: "horizontal", left: box.left, top: box.top - ruler, length: box.width, thickness: ruler, zoom: zoom, marginStart: layout.margins.left * zoom, marginEnd: layout.margins.right * zoom }), React.createElement(Ruler, { key: `ruler-v${key}`, orientation: "vertical", left: box.left - ruler, top: box.top, length: box.height, thickness: ruler, zoom: zoom, marginStart: layout.margins.top * zoom, marginEnd: layout.margins.bottom * zoom }));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// Headers and footers, on the pages that print.
|
|
302
|
+
const editable = !!onChangeHeaderFooter;
|
|
303
|
+
for (const box of boxes) {
|
|
304
|
+
const page = box.page;
|
|
305
|
+
if (!page)
|
|
306
|
+
continue;
|
|
307
|
+
for (const kind of ["header", "footer"]) {
|
|
308
|
+
const isEditing = editing?.kind === kind &&
|
|
309
|
+
editing.rowBand === box.rowBand &&
|
|
310
|
+
editing.columnBand === box.columnBand;
|
|
311
|
+
const key = headerFooterKey(headerFooter, kind, page.ordinal);
|
|
312
|
+
nodes.push(React.createElement(HeaderFooterZone, { key: `${kind}-${box.rowBand}:${box.columnBand}`, kind: kind, box: { ...box, page }, layout: layout, zoom: zoom, stored: headerFooter?.[key] ?? undefined, context: context, editing: isEditing ? editing.section : undefined, editable: editable, onStartEdit: (section) => setEditing({
|
|
313
|
+
kind,
|
|
314
|
+
rowBand: box.rowBand,
|
|
315
|
+
columnBand: box.columnBand,
|
|
316
|
+
section,
|
|
317
|
+
}), onCommit: (sections) => commit(kind, page.ordinal, sections), onCancel: () => setEditing(undefined) }));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return (React.createElement("div", { "data-page-layout-view": "", style: { position: "absolute", left: 0, top: 0 } }, nodes));
|
|
321
|
+
};
|
|
322
|
+
/** Frozen heading strips: the desk between pages under the column / beside the row headings. */
|
|
323
|
+
export const PageLayoutHeadingGaps = ({ layout, zoom, grid, axis, }) => {
|
|
324
|
+
const boxes = getVisiblePageBoxes(layout, zoom, grid);
|
|
325
|
+
const seen = new Set();
|
|
326
|
+
const nodes = [];
|
|
327
|
+
for (const box of boxes) {
|
|
328
|
+
const band = axis === "columns" ? box.columnBand : box.rowBand;
|
|
329
|
+
if (seen.has(band))
|
|
330
|
+
continue;
|
|
331
|
+
seen.add(band);
|
|
332
|
+
// Everything of the heading strip outside the page's cells is desk.
|
|
333
|
+
if (axis === "columns") {
|
|
334
|
+
const previous = boxes.find((b) => b.columnBand === band - 1);
|
|
335
|
+
const from = previous ? previous.usedRight : grid.frozenColumnWidth;
|
|
336
|
+
nodes.push(rect(`hc${band}`, from, 0, box.usedLeft - from, grid.frozenRowHeight, PAGE_LAYOUT_DESK_COLOR));
|
|
337
|
+
if (band === layout.columnBands.length - 1) {
|
|
338
|
+
nodes.push(rect(`hc-end`, box.usedRight, 0, Math.max(0, grid.scrollLeft + grid.containerWidth - box.usedRight), grid.frozenRowHeight, PAGE_LAYOUT_DESK_COLOR));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
const previous = boxes.find((b) => b.rowBand === band - 1);
|
|
343
|
+
const from = previous ? previous.usedBottom : grid.frozenRowHeight;
|
|
344
|
+
nodes.push(rect(`hr${band}`, 0, from, grid.frozenColumnWidth, box.usedTop - from, PAGE_LAYOUT_DESK_COLOR));
|
|
345
|
+
if (band === layout.rowBands.length - 1) {
|
|
346
|
+
nodes.push(rect(`hr-end`, 0, box.usedBottom, grid.frozenColumnWidth, Math.max(0, grid.scrollTop + grid.containerHeight - box.usedBottom), PAGE_LAYOUT_DESK_COLOR));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return React.createElement(React.Fragment, null, nodes);
|
|
351
|
+
};
|
|
@@ -103,6 +103,11 @@ export type PageLayoutInput = {
|
|
|
103
103
|
rowBreaks?: readonly number[];
|
|
104
104
|
columnBreaks?: readonly number[];
|
|
105
105
|
};
|
|
106
|
+
export declare const sliceAxis: (start: number, end: number, getSize: (i: number) => number, limit: number, scale: number, breaks?: ReadonlySet<number>) => Array<{
|
|
107
|
+
start: number;
|
|
108
|
+
end: number;
|
|
109
|
+
size: number;
|
|
110
|
+
}>;
|
|
106
111
|
export declare const computePageLayout: (input: PageLayoutInput) => PageBlock[];
|
|
107
112
|
/**
|
|
108
113
|
* Total natural width / height of the print range (unscaled). Used by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-page-layout.d.ts","sourceRoot":"","sources":["../../../../components/print-preview/use-page-layout.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"use-page-layout.d.ts","sourceRoot":"","sources":["../../../../components/print-preview/use-page-layout.ts"],"names":[],"mappings":"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"}
|
|
@@ -80,7 +80,7 @@ export const placeChartsOnPages = ({ charts, sheetId, blocks, startRow, startCol
|
|
|
80
80
|
* early, spilling the last column onto its own page.
|
|
81
81
|
*/
|
|
82
82
|
const EPSILON = 0.5;
|
|
83
|
-
const sliceAxis = (start, end, getSize, limit, scale, breaks = new Set()) => {
|
|
83
|
+
export const sliceAxis = (start, end, getSize, limit, scale, breaks = new Set()) => {
|
|
84
84
|
const bands = [];
|
|
85
85
|
if (start > end || limit <= 0)
|
|
86
86
|
return bands;
|
|
@@ -13,6 +13,11 @@ export declare const EXTENDED_HORIZONTAL_ALIGNMENTS: ReadonlyArray<{
|
|
|
13
13
|
value: HorizontalAlign;
|
|
14
14
|
label: string;
|
|
15
15
|
}>;
|
|
16
|
+
export declare const TextHorizontalAlignSelectorContent: ({ value, onChange, close, }: {
|
|
17
|
+
value: HorizontalAlign | undefined | null;
|
|
18
|
+
onChange(value: HorizontalAlign): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
}) => React.JSX.Element;
|
|
16
21
|
export declare const TextHorizontalAlignSelector: ({ value, onChange, disabled, }: TextHorizontalAlignSelectorProps) => React.JSX.Element;
|
|
17
22
|
export {};
|
|
18
23
|
//# sourceMappingURL=text-horizontal-align-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-horizontal-align-selector.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/text-horizontal-align-selector.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,gCAAgC,GAAG;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,aAAa,CAAC;IACzD,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAGA,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,gCAIzC,gCAAgC,
|
|
1
|
+
{"version":3,"file":"text-horizontal-align-selector.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/text-horizontal-align-selector.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,gCAAgC,GAAG;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,aAAa,CAAC;IACzD,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAGA,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,6BAIhD;IACD,KAAK,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IACvC,KAAK,IAAI,IAAI,CAAC;CACf,sBAqEA,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,gCAIzC,gCAAgC,sBAkClC,CAAC"}
|
|
@@ -12,41 +12,45 @@ export const EXTENDED_HORIZONTAL_ALIGNMENTS = [
|
|
|
12
12
|
{ value: "distributed", label: "Distributed" },
|
|
13
13
|
{ value: "fill", label: "Fill" },
|
|
14
14
|
];
|
|
15
|
-
export const
|
|
15
|
+
export const TextHorizontalAlignSelectorContent = ({ value, onChange, close, }) => {
|
|
16
16
|
const focusSheet = useFocusSheet();
|
|
17
|
-
const [isOpen, onOpenChange] = useState(false);
|
|
18
|
-
const close = () => onOpenChange(false);
|
|
19
17
|
const select = (next) => {
|
|
20
18
|
onChange(next);
|
|
21
19
|
focusSheet?.();
|
|
22
20
|
close();
|
|
23
21
|
};
|
|
22
|
+
return (React.createElement(React.Fragment, null,
|
|
23
|
+
React.createElement(Stack, { direction: "horizontal", className: "gap-1 max-w-[140px] flex-wrap" },
|
|
24
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "left", onClick: () => {
|
|
25
|
+
onChange("left");
|
|
26
|
+
focusSheet?.();
|
|
27
|
+
close();
|
|
28
|
+
} },
|
|
29
|
+
React.createElement(MdFormatAlignLeft, null)),
|
|
30
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "center", onClick: () => {
|
|
31
|
+
onChange("center");
|
|
32
|
+
focusSheet?.();
|
|
33
|
+
close();
|
|
34
|
+
} },
|
|
35
|
+
React.createElement(MdFormatAlignCenter, null)),
|
|
36
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "right", onClick: () => {
|
|
37
|
+
onChange("right");
|
|
38
|
+
focusSheet?.();
|
|
39
|
+
close();
|
|
40
|
+
} },
|
|
41
|
+
React.createElement(MdFormatAlignRight, null)),
|
|
42
|
+
React.createElement(IconButton, { size: "lg", tooltip: "Justify", "aria-label": "Justify", isActive: value === "justify", onClick: () => select("justify") },
|
|
43
|
+
React.createElement(MdFormatAlignJustify, null))),
|
|
44
|
+
React.createElement(Stack, { direction: "horizontal", className: "gap-1 pt-1 max-w-[140px]" }, EXTENDED_HORIZONTAL_ALIGNMENTS.map(({ value: option, label }) => (React.createElement(Button, { key: option, type: "button", variant: value === option ? "secondary" : "ghost", size: "xs", "aria-pressed": value === option, onClick: () => select(option) }, label))))));
|
|
45
|
+
};
|
|
46
|
+
export const TextHorizontalAlignSelector = ({ value = "left", onChange, disabled, }) => {
|
|
47
|
+
const [isOpen, onOpenChange] = useState(false);
|
|
48
|
+
const close = () => onOpenChange(false);
|
|
24
49
|
return (React.createElement(Popover, { open: isOpen, onOpenChange: onOpenChange },
|
|
25
50
|
React.createElement(PopoverTrigger, { asChild: true },
|
|
26
51
|
React.createElement(IconButton, { size: "lg", tooltip: "Horizontal align", "aria-label": "Horizontal align", disabled: disabled },
|
|
27
52
|
value === "right" ? (React.createElement(MdFormatAlignRight, null)) : value === "center" || value === "centerContinuous" ? (React.createElement(MdFormatAlignCenter, null)) : value === "justify" || value === "distributed" ? (React.createElement(MdFormatAlignJustify, null)) : (React.createElement(MdFormatAlignLeft, null)),
|
|
28
53
|
React.createElement(MdOutlineArrowDropDown, null))),
|
|
29
54
|
React.createElement(PopoverContent, { align: "start" },
|
|
30
|
-
React.createElement(
|
|
31
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "left", onClick: () => {
|
|
32
|
-
onChange("left");
|
|
33
|
-
focusSheet?.();
|
|
34
|
-
close();
|
|
35
|
-
} },
|
|
36
|
-
React.createElement(MdFormatAlignLeft, null)),
|
|
37
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "center", onClick: () => {
|
|
38
|
-
onChange("center");
|
|
39
|
-
focusSheet?.();
|
|
40
|
-
close();
|
|
41
|
-
} },
|
|
42
|
-
React.createElement(MdFormatAlignCenter, null)),
|
|
43
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "right", onClick: () => {
|
|
44
|
-
onChange("right");
|
|
45
|
-
focusSheet?.();
|
|
46
|
-
close();
|
|
47
|
-
} },
|
|
48
|
-
React.createElement(MdFormatAlignRight, null)),
|
|
49
|
-
React.createElement(IconButton, { size: "lg", tooltip: "Justify", "aria-label": "Justify", isActive: value === "justify", onClick: () => select("justify") },
|
|
50
|
-
React.createElement(MdFormatAlignJustify, null))),
|
|
51
|
-
React.createElement(Stack, { direction: "horizontal", className: "gap-1 pt-1 max-w-[140px]" }, EXTENDED_HORIZONTAL_ALIGNMENTS.map(({ value: option, label }) => (React.createElement(Button, { key: option, type: "button", variant: value === option ? "secondary" : "ghost", size: "xs", "aria-pressed": value === option, onClick: () => select(option) }, label)))))));
|
|
55
|
+
React.createElement(TextHorizontalAlignSelectorContent, { value: value, onChange: onChange, close: close }))));
|
|
52
56
|
};
|
|
@@ -4,6 +4,11 @@ type TextVerticalAlignSelectorProps = {
|
|
|
4
4
|
value: VerticalAlign | undefined | null;
|
|
5
5
|
onChange(value: VerticalAlign): void;
|
|
6
6
|
};
|
|
7
|
+
export declare const TextVerticalAlignSelectorContent: ({ value, onChange, close, }: {
|
|
8
|
+
value?: VerticalAlign | null;
|
|
9
|
+
onChange(value: VerticalAlign): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
}) => React.JSX.Element;
|
|
7
12
|
export declare const TextVerticalAlignSelector: ({ value, onChange, }: TextVerticalAlignSelectorProps) => React.JSX.Element;
|
|
8
13
|
export {};
|
|
9
14
|
//# sourceMappingURL=text-vertical-align-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-vertical-align-selector.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/text-vertical-align-selector.tsx"],"names":[],"mappings":"AASA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,sBAGvC,8BAA8B,
|
|
1
|
+
{"version":3,"file":"text-vertical-align-selector.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/text-vertical-align-selector.tsx"],"names":[],"mappings":"AASA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,6BAI9C;IACD,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,KAAK,IAAI,IAAI,CAAC;CACf,sBAuCA,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,sBAGvC,8BAA8B,sBA2BhC,CAAC"}
|
|
@@ -4,8 +4,29 @@ import { Popover, PopoverContent, PopoverTrigger } from "@rowsncolumns/ui";
|
|
|
4
4
|
import { Stack } from "@rowsncolumns/ui";
|
|
5
5
|
import React, { useState } from "react";
|
|
6
6
|
import { useFocusSheet } from "../../atoms";
|
|
7
|
-
export const
|
|
7
|
+
export const TextVerticalAlignSelectorContent = ({ value, onChange, close, }) => {
|
|
8
8
|
const focusSheet = useFocusSheet();
|
|
9
|
+
return (React.createElement(Stack, { direction: "horizontal", className: "gap-1 flex-wrap max-w-[140px]" },
|
|
10
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "top", onClick: () => {
|
|
11
|
+
onChange("top");
|
|
12
|
+
focusSheet?.();
|
|
13
|
+
close();
|
|
14
|
+
} },
|
|
15
|
+
React.createElement(MdVerticalAlignTop, null)),
|
|
16
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "middle", onClick: () => {
|
|
17
|
+
onChange("middle");
|
|
18
|
+
focusSheet?.();
|
|
19
|
+
close();
|
|
20
|
+
} },
|
|
21
|
+
React.createElement(MdVerticalAlignCenter, null)),
|
|
22
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "bottom", onClick: () => {
|
|
23
|
+
onChange("bottom");
|
|
24
|
+
focusSheet?.();
|
|
25
|
+
close();
|
|
26
|
+
} },
|
|
27
|
+
React.createElement(MdVerticalAlignBottom, null))));
|
|
28
|
+
};
|
|
29
|
+
export const TextVerticalAlignSelector = ({ value = "bottom", onChange, }) => {
|
|
9
30
|
const [isOpen, onOpenChange] = useState(false);
|
|
10
31
|
const close = () => onOpenChange(false);
|
|
11
32
|
return (React.createElement(Popover, { open: isOpen, onOpenChange: onOpenChange },
|
|
@@ -14,23 +35,5 @@ export const TextVerticalAlignSelector = ({ value = "bottom", onChange, }) => {
|
|
|
14
35
|
value === "top" ? (React.createElement(MdVerticalAlignTop, null)) : value === "middle" ? (React.createElement(MdVerticalAlignCenter, null)) : (React.createElement(MdVerticalAlignBottom, null)),
|
|
15
36
|
React.createElement(MdOutlineArrowDropDown, null))),
|
|
16
37
|
React.createElement(PopoverContent, { align: "start" },
|
|
17
|
-
React.createElement(
|
|
18
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "top", onClick: () => {
|
|
19
|
-
onChange("top");
|
|
20
|
-
focusSheet?.();
|
|
21
|
-
close();
|
|
22
|
-
} },
|
|
23
|
-
React.createElement(MdVerticalAlignTop, null)),
|
|
24
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "middle", onClick: () => {
|
|
25
|
-
onChange("middle");
|
|
26
|
-
focusSheet?.();
|
|
27
|
-
close();
|
|
28
|
-
} },
|
|
29
|
-
React.createElement(MdVerticalAlignCenter, null)),
|
|
30
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "bottom", onClick: () => {
|
|
31
|
-
onChange("bottom");
|
|
32
|
-
focusSheet?.();
|
|
33
|
-
close();
|
|
34
|
-
} },
|
|
35
|
-
React.createElement(MdVerticalAlignBottom, null))))));
|
|
38
|
+
React.createElement(TextVerticalAlignSelectorContent, { value: value, onChange: onChange, close: close }))));
|
|
36
39
|
};
|
|
@@ -10,6 +10,9 @@ type TextWrapSelectorProps = {
|
|
|
10
10
|
shrinkToFit?: boolean | null;
|
|
11
11
|
onChangeShrinkToFit?(value: boolean): void;
|
|
12
12
|
};
|
|
13
|
+
export declare const TextWrapSelectorContent: ({ value, onChange, shrinkToFit, onChangeShrinkToFit, close, }: TextWrapSelectorProps & {
|
|
14
|
+
close(): void;
|
|
15
|
+
}) => React.JSX.Element;
|
|
13
16
|
export declare const TextWrapSelector: ({ value, onChange, shrinkToFit, onChangeShrinkToFit, }: TextWrapSelectorProps) => React.JSX.Element;
|
|
14
17
|
export {};
|
|
15
18
|
//# sourceMappingURL=text-wrap-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-wrap-selector.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/text-wrap-selector.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,KAAK,qBAAqB,GAAG;IAC3B,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,mBAAmB,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,wDAK9B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"text-wrap-selector.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/text-wrap-selector.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,KAAK,qBAAqB,GAAG;IAC3B,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,mBAAmB,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,+DAMrC,qBAAqB,GAAG;IACzB,KAAK,IAAI,IAAI,CAAC;CACf,sBA6DA,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,wDAK9B,qBAAqB,sBAiCvB,CAAC"}
|
|
@@ -3,8 +3,36 @@ import { MdOutlineArrowDropDown } from "@rowsncolumns/icons";
|
|
|
3
3
|
import { IconButton, Popover, PopoverContent, PopoverTrigger, Stack, } from "@rowsncolumns/ui";
|
|
4
4
|
import React, { useState } from "react";
|
|
5
5
|
import { useFocusSheet } from "../../atoms";
|
|
6
|
-
export const
|
|
6
|
+
export const TextWrapSelectorContent = ({ value, onChange, shrinkToFit, onChangeShrinkToFit, close, }) => {
|
|
7
7
|
const focusSheet = useFocusSheet();
|
|
8
|
+
return (React.createElement(Stack, { direction: "horizontal", className: "flex-wrap gap-1 max-w-[140px]" },
|
|
9
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "overflow", tooltip: "Overflow", onClick: () => {
|
|
10
|
+
onChange("overflow");
|
|
11
|
+
focusSheet?.();
|
|
12
|
+
close();
|
|
13
|
+
} },
|
|
14
|
+
React.createElement(TextOverflowIcon, null)),
|
|
15
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "wrap", tooltip: "Wrap", onClick: () => {
|
|
16
|
+
onChange("wrap");
|
|
17
|
+
focusSheet?.();
|
|
18
|
+
close();
|
|
19
|
+
} },
|
|
20
|
+
React.createElement(TextOverflowWrapIcon, null)),
|
|
21
|
+
React.createElement(IconButton, { size: "lg", isActive: value === "clip", tooltip: "Clip", onClick: () => {
|
|
22
|
+
onChange("clip");
|
|
23
|
+
focusSheet?.();
|
|
24
|
+
close();
|
|
25
|
+
} },
|
|
26
|
+
React.createElement(TextoverflowClipIcon, null)),
|
|
27
|
+
onChangeShrinkToFit ? (React.createElement(IconButton, { size: "lg", isActive: !!shrinkToFit, "aria-pressed": !!shrinkToFit, tooltip: "Shrink text to fit the cell", "aria-label": "Shrink text to fit the cell", className: "w-full justify-start gap-1", onClick: () => {
|
|
28
|
+
onChangeShrinkToFit(!shrinkToFit);
|
|
29
|
+
focusSheet?.();
|
|
30
|
+
close();
|
|
31
|
+
} },
|
|
32
|
+
React.createElement(TextoverflowClipIcon, null),
|
|
33
|
+
React.createElement("span", { className: "text-xs" }, "Shrink to fit"))) : null));
|
|
34
|
+
};
|
|
35
|
+
export const TextWrapSelector = ({ value = "overflow", onChange, shrinkToFit, onChangeShrinkToFit, }) => {
|
|
8
36
|
const [isOpen, onOpenChange] = useState(false);
|
|
9
37
|
const close = () => onOpenChange(false);
|
|
10
38
|
return (React.createElement(Popover, { open: isOpen, onOpenChange: onOpenChange },
|
|
@@ -13,30 +41,5 @@ export const TextWrapSelector = ({ value = "overflow", onChange, shrinkToFit, on
|
|
|
13
41
|
value === "overflow" ? (React.createElement(TextOverflowIcon, null)) : value === "wrap" ? (React.createElement(TextOverflowWrapIcon, null)) : (React.createElement(TextoverflowClipIcon, null)),
|
|
14
42
|
React.createElement(MdOutlineArrowDropDown, null))),
|
|
15
43
|
React.createElement(PopoverContent, { align: "start" },
|
|
16
|
-
React.createElement(
|
|
17
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "overflow", tooltip: "Overflow", onClick: () => {
|
|
18
|
-
onChange("overflow");
|
|
19
|
-
focusSheet?.();
|
|
20
|
-
close();
|
|
21
|
-
} },
|
|
22
|
-
React.createElement(TextOverflowIcon, null)),
|
|
23
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "wrap", tooltip: "Wrap", onClick: () => {
|
|
24
|
-
onChange("wrap");
|
|
25
|
-
focusSheet?.();
|
|
26
|
-
close();
|
|
27
|
-
} },
|
|
28
|
-
React.createElement(TextOverflowWrapIcon, null)),
|
|
29
|
-
React.createElement(IconButton, { size: "lg", isActive: value === "clip", tooltip: "Clip", onClick: () => {
|
|
30
|
-
onChange("clip");
|
|
31
|
-
focusSheet?.();
|
|
32
|
-
close();
|
|
33
|
-
} },
|
|
34
|
-
React.createElement(TextoverflowClipIcon, null)),
|
|
35
|
-
onChangeShrinkToFit ? (React.createElement(IconButton, { size: "lg", isActive: !!shrinkToFit, "aria-pressed": !!shrinkToFit, tooltip: "Shrink text to fit the cell", "aria-label": "Shrink text to fit the cell", className: "w-full justify-start gap-1", onClick: () => {
|
|
36
|
-
onChangeShrinkToFit(!shrinkToFit);
|
|
37
|
-
focusSheet?.();
|
|
38
|
-
close();
|
|
39
|
-
} },
|
|
40
|
-
React.createElement(TextoverflowClipIcon, null),
|
|
41
|
-
React.createElement("span", { className: "text-xs" }, "Shrink to fit"))) : null))));
|
|
44
|
+
React.createElement(TextWrapSelectorContent, { value: value, onChange: onChange, shrinkToFit: shrinkToFit, onChangeShrinkToFit: onChangeShrinkToFit, close: close }))));
|
|
42
45
|
};
|