@sheetxl/react 0.8.0-beta.15 → 0.8.0-beta.17

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.
Files changed (106) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/{CWdNVd2X-jRKlB_b.mjs → -mdWrNwKPMBQbhpW.mjs} +3 -3
  3. package/browser/esm/{D3EZj2DZtqvEw39q.mjs → 9YeNE9FbgAbj-kFJ.mjs} +2 -2
  4. package/browser/esm/{Jsf-8NM-LoKvVsYf.mjs → B0tm14veV7VbqCXF.mjs} +2 -2
  5. package/browser/esm/{CWLi88m6LfSPOUoJ.mjs → B1rrVGz1PwKbTLA2.mjs} +2 -2
  6. package/browser/esm/{CnmhZ0sv8-uJ3jIh.mjs → B7yfrZvX62qlpS-V.mjs} +2 -2
  7. package/browser/esm/{CCL1HOWXz62tDziU.mjs → B9r44M1lVTxnLqBb.mjs} +2 -2
  8. package/browser/esm/{YYwEGf_7TmjEmW6k.mjs → BeVkpREgRD5DVvqq.mjs} +2 -2
  9. package/browser/esm/{DOQHq7WB1-h05twR.mjs → BxmM4_1EU7z1fS8J.mjs} +7 -7
  10. package/browser/esm/{DCUlR5K3bBO-sXSf.mjs → BzLeA0HlYOPeNbAo.mjs} +5 -5
  11. package/browser/esm/{DFGGb7jiCJcfCaYj.mjs → CNv5ABj97zChkI-j.mjs} +2 -2
  12. package/browser/esm/{CqZpzm1L_Z2tVGiu.mjs → CWZ7Dx5SBWu4aU9Z.mjs} +2 -2
  13. package/browser/esm/{mQlxlB1jsEg5m2tk.mjs → CWwumtsC8-1gwMAu.mjs} +3 -3
  14. package/browser/esm/{CJAAYqzB5y5hTJ85.mjs → CYEzd5w4p9LRScYN.mjs} +2 -2
  15. package/browser/esm/{CBAt-J0K7H2yH-2w.mjs → CmDfYf-7BEMQKyqH.mjs} +2 -2
  16. package/browser/esm/{Eccqvu_ltQH3yLm8.mjs → DQ7lWEbxzkSksQvK.mjs} +3 -3
  17. package/browser/esm/{kQVuIBGvAYMVXPYJ.mjs → DcFFrmHW4tX2q1az.mjs} +4 -4
  18. package/browser/esm/{CW3DK5L4GYrbHYn3.mjs → Dm5_yXkbckf2odQK.mjs} +4 -4
  19. package/browser/esm/{NshsRiPQnC1BkiQA.mjs → DmIj68EaqzbpmhGu.mjs} +2 -2
  20. package/browser/esm/{W9-RoLMW94RtA2yw.mjs → E7Yhe921O7ju1JLF.mjs} +2 -2
  21. package/browser/esm/{CmX0QHgElbcLT_eT.mjs → Ip8RHzHhXWuXTW8Z.mjs} +7 -7
  22. package/browser/esm/{BSaF1NUo5Ilp--Rg.mjs → NUXuZQHZmiYexulZ.mjs} +6 -6
  23. package/browser/esm/{B7PnGz42UySqvnvf.mjs → Z57bAJBcfLMsZG74.mjs} +4 -4
  24. package/browser/esm/chart.mjs +4 -4
  25. package/browser/esm/control.mjs +3 -3
  26. package/browser/esm/group.mjs +4 -4
  27. package/browser/esm/index.mjs +12308 -10628
  28. package/browser/esm/note.mjs +5 -5
  29. package/browser/esm/picture.mjs +3 -3
  30. package/browser/esm/{CvedGF4lbJchD_Tg.mjs → qmxmy7tirF1as3Xs.mjs} +2 -2
  31. package/browser/esm/shape.mjs +3 -3
  32. package/browser/esm/slicer.mjs +5 -5
  33. package/node/esm/{CDFWR8VuVJHAYNNI.mjs → B-M8LEF1gQC4VTti.mjs} +2 -2
  34. package/node/esm/{DuoOyDpiOAdK8IZQ.mjs → BLyZ6mSICbKNrNXK.mjs} +2 -2
  35. package/node/esm/{CNZvdFLLo0flJEA-.mjs → BN9TsBId0PUOF3YQ.mjs} +2 -2
  36. package/node/esm/{FEK43PhLZa-Z0PJl.mjs → BPEE8SA9ZAebcfZs.mjs} +2 -2
  37. package/node/esm/{CnTs_0-4eOpvZg8R.mjs → BXwXN7P_JyLZbQ1F.mjs} +2 -2
  38. package/node/esm/{BWvLL25LXIqgwEQR.mjs → BzAvJXwmJZ2aBZff.mjs} +2 -2
  39. package/node/esm/{DHwhGqtfOi4qGI5j.mjs → C8lBxk7g8FU777JZ.mjs} +3 -3
  40. package/node/esm/{BE_wecWj_wouzvwo.mjs → CXe6zO8r3qcKa8eD.mjs} +2 -2
  41. package/node/esm/{a4vck0pT0feFFXSx.mjs → Cp8J0CabzCF6tfAx.mjs} +3 -3
  42. package/node/esm/{CHJu5Pijhfp2u8iw.mjs → D1o8P8Vu5yBBWDkw.mjs} +3 -3
  43. package/node/esm/{eQJQMKkYOP7uVRYY.mjs → D4wcZkeFJ9g3E1Wx.mjs} +2 -2
  44. package/node/esm/{C9D9KK3BOuRjzee8.mjs → D6T6RsUdqj-dsOrE.mjs} +2 -2
  45. package/node/esm/{Df37YYiPX3A6lmeA.mjs → DOmvQX0Ox-3oN9aN.mjs} +2 -2
  46. package/node/esm/{qOitqMlh9UUnFpG4.mjs → DQ7xw--8XAi5NYEh.mjs} +3 -3
  47. package/node/esm/{CfFmAB75wf0KyCat.mjs → DSA6_IsV7Vneo5Za.mjs} +6 -6
  48. package/node/esm/{CBKs0BGWFyKb6fAa.mjs → DdXBknb60h6u7ljS.mjs} +2 -2
  49. package/node/esm/{D87-gdOPXyqWeq9r.mjs → DrGBVKfXN46SccPc.mjs} +2 -2
  50. package/node/esm/{XLCT3m2EOLskQps9.mjs → SRhq2ObYt2tWPLDG.mjs} +2 -2
  51. package/node/esm/{ZTIwQN07Ioz-tn17.mjs → arYXYwcOVpS7tQUp.mjs} +2 -2
  52. package/node/esm/chart.mjs +3 -3
  53. package/node/esm/control.mjs +3 -3
  54. package/node/esm/group.mjs +4 -4
  55. package/node/esm/index.mjs +8485 -6850
  56. package/node/esm/note.mjs +5 -5
  57. package/node/esm/picture.mjs +6 -6
  58. package/node/esm/{BzxeGvZj4Pgqhney.mjs → roCYJ0G69HBpAkf3.mjs} +5 -5
  59. package/node/esm/shape.mjs +7 -7
  60. package/node/esm/slicer.mjs +5 -5
  61. package/package.json +8 -8
  62. package/resources/contents.json +6 -0
  63. package/resources/locales/contents.json +14 -0
  64. package/resources/locales/de/pivot.cmd.json +71 -0
  65. package/resources/locales/de/sheet.cmd.json +40 -0
  66. package/resources/locales/de/table.cmd.json +4 -1
  67. package/resources/locales/de/ui.msg.json +47 -0
  68. package/resources/locales/de/workbook.cmd.json +1 -1
  69. package/resources/locales/en/pivot.cmd.json +71 -0
  70. package/resources/locales/en/sheet.cmd.json +40 -0
  71. package/resources/locales/en/table.cmd.json +4 -1
  72. package/resources/locales/en/ui.msg.json +47 -0
  73. package/resources/locales/en/workbook.cmd.json +1 -1
  74. package/types/src/border/useBorders.d.ts +20 -1
  75. package/types/src/cell/PivotButton.d.ts +55 -0
  76. package/types/src/cell/_DropdownFace.d.ts +29 -0
  77. package/types/src/cell/index.d.ts +1 -0
  78. package/types/src/frame/CommandContext.d.ts +31 -1
  79. package/types/src/index.d.ts +3 -0
  80. package/types/src/layer/BorderLayer.d.ts +3 -0
  81. package/types/src/layer/PivotLayer.d.ts +47 -0
  82. package/types/src/layer/PivotToolbar.d.ts +29 -0
  83. package/types/src/layer/RangeToolbar.d.ts +75 -0
  84. package/types/src/layer/SheetCellLayer.d.ts +2 -2
  85. package/types/src/layer/SheetGridLineLayer.d.ts +18 -6
  86. package/types/src/layer/SheetPivotCommandLayer.d.ts +13 -0
  87. package/types/src/layer/TableToolbar.d.ts +6 -25
  88. package/types/src/layer/_sheetBorders.d.ts +6 -0
  89. package/types/src/layer/_tableColor.d.ts +5 -3
  90. package/types/src/layer/index.d.ts +3 -0
  91. package/types/src/layer/useSheetVisibleCells.d.ts +3 -4
  92. package/types/src/pivot/PivotAreas.d.ts +16 -0
  93. package/types/src/pivot/PivotChip.d.ts +33 -0
  94. package/types/src/pivot/PivotChipMenu.d.ts +74 -0
  95. package/types/src/pivot/PivotCommands.d.ts +24 -0
  96. package/types/src/pivot/PivotFieldList.d.ts +14 -0
  97. package/types/src/pivot/PivotFields.d.ts +47 -0
  98. package/types/src/pivot/PivotFieldsModel.d.ts +143 -0
  99. package/types/src/pivot/PivotTablePane.d.ts +49 -0
  100. package/types/src/pivot/_PivotFieldsContext.d.ts +41 -0
  101. package/types/src/pivot/_pivotNew.d.ts +12 -0
  102. package/types/src/pivot/_pivotRegion.d.ts +14 -0
  103. package/types/src/pivot/index.d.ts +9 -0
  104. package/types/src/pivot/usePivotFields.d.ts +17 -0
  105. package/types/src/sheet/IWorksheetElement.d.ts +10 -2
  106. package/types/src/workbook/IWorkbookElement.d.ts +11 -1
@@ -140,7 +140,25 @@ export interface UseBorderOptions {
140
140
  * `null` draws none.
141
141
  */
142
142
  normalColumns?: BorderNormalLine | null;
143
+ /**
144
+ * Shared by layers that draw the same cells, so the cells are read into borders once for all of
145
+ * them. Layers share a read when `getVisibleCells` returns the same array and `getBorderAt`,
146
+ * `getMergeAt`, and `defaultColor` are the same.
147
+ */
148
+ cache?: BordersCache;
143
149
  }
150
+ declare const _BordersCacheBrand: unique symbol;
151
+ /**
152
+ * Lets several {@link useBorders} layers share the work of reading their cells into borders. Create
153
+ * one with {@link createBordersCache} and pass it to each layer as {@link UseBorderOptions.cache}.
154
+ */
155
+ export interface BordersCache {
156
+ readonly [_BordersCacheBrand]: true;
157
+ }
158
+ /**
159
+ * A new {@link BordersCache}.
160
+ */
161
+ export declare const createBordersCache: () => BordersCache;
144
162
  export interface UseBorderResults {
145
163
  /**
146
164
  * Draws a pane's borders, or `null` when it has none.
@@ -156,5 +174,6 @@ export interface UseBorderResults {
156
174
  * center of the double it meets, so two doubles open into each other where they cross, tee or
157
175
  * turn a corner. Strokes that are not double are outside the mask and never cut.
158
176
  */
159
- export declare const useBorders: ({ getBorderAt, getMergeAt, rendererBorder, getVisibleCells: propGetVisibleCells, forceThinBorder, defaultColor, mode, normalRows, normalColumns }: UseBorderOptions) => UseBorderResults;
177
+ export declare const useBorders: ({ getBorderAt, getMergeAt, rendererBorder, getVisibleCells: propGetVisibleCells, forceThinBorder, defaultColor, mode, normalRows, normalColumns, cache }: UseBorderOptions) => UseBorderResults;
178
+ export {};
160
179
  //# sourceMappingURL=useBorders.d.ts.map
@@ -0,0 +1,55 @@
1
+ import { default as React } from 'react';
2
+ import { Bounds } from '@sheetxl/utils';
3
+ import { IPivotTable } from '@sheetxl/sdk';
4
+ /**
5
+ * The pivot table button configuration.
6
+ *
7
+ * @remarks
8
+ * Rides the shared `propsCellRender` channel, as the column buttons' does. Consumed by the pivot
9
+ * layer (`PivotLayer`), not the text cell renderer.
10
+ */
11
+ export interface PivotButtonConfigProps {
12
+ /**
13
+ * Callback for when a pivot table's field dropdown has been pressed.
14
+ *
15
+ * @param event - The mouse event (its `currentTarget` anchors the menu)
16
+ * @param fields - The fields the button is for: one, or a compact header's row or column fields
17
+ */
18
+ onPivotButtonMouseDown?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>, fields: readonly IPivotTable.IField[]) => void;
19
+ }
20
+ /**
21
+ * Props for {@link PivotDropdownButton}.
22
+ */
23
+ export interface PivotDropdownButtonProps extends React.HTMLAttributes<HTMLElement> {
24
+ /** The cell's box the button pins itself into. */
25
+ bounds: Bounds;
26
+ zoom: number;
27
+ disabled: boolean;
28
+ /** The fields the button is for. */
29
+ fields: readonly IPivotTable.IField[];
30
+ onPivotButtonMouseDown?: PivotButtonConfigProps['onPivotButtonMouseDown'];
31
+ }
32
+ /**
33
+ * A pivot table field's dropdown: the column button's look, filtered while a field it is for shows
34
+ * less than all of its items.
35
+ */
36
+ export declare const PivotDropdownButton: (props: PivotDropdownButtonProps) => React.ReactElement;
37
+ /**
38
+ * Props for {@link PivotToggleButton}.
39
+ */
40
+ export interface PivotToggleButtonProps {
41
+ /** Whether the item's details show: the button collapses them. */
42
+ expanded: boolean;
43
+ /** The edge of the square, in pixels. */
44
+ size: number;
45
+ disabled?: boolean;
46
+ /** A localized description of what a press does. */
47
+ title?: string;
48
+ onToggle: () => void;
49
+ style?: React.CSSProperties;
50
+ }
51
+ /**
52
+ * A pivot table item's expand/collapse box: a square with a `+` or a `−`, as the outline's.
53
+ */
54
+ export declare const PivotToggleButton: (props: PivotToggleButtonProps) => React.ReactElement;
55
+ //# sourceMappingURL=PivotButton.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { default as React } from 'react';
2
+ import { Bounds } from '@sheetxl/utils';
3
+ export declare const PATH_CLEAR = "M 7.4530672,10.134098 2.6725085,5.2978998 3.370275,4.5911648 7.4530672,8.7264777 11.530095,4.5911648 l 0.697764,0.706735M 7.4529247,10.134098 2.9086709,5.2978998 3.5719465,4.5911648 7.4529247,8.7264777 11.328423,4.5911648 l 0.663274,0.70673";
4
+ export declare const PATH_FILTERED = "m 9.429858,10.25386 2,-1 v -3 l 3,-4 h -8 l 3,4 z M 0.75000004,9.15 4.3000002,13.094444 7.8500003,9.15 Z";
5
+ export declare const PATH_SORT_ASC = "m 13.109228,9.865914 h -1.607622 v -7.37612 h -1.071748 v 7.37612 H 8.822236 l 2.143496,2.950446 z M 0.75000004,9.15 4.3000002,13.094444 7.8500003,9.15 Z";
6
+ export declare const PATH_SORT_DES = "m 13.109228,5.44024 h -1.607622 v 7.37612 H 10.429858 V 5.44024 H 8.822236 L 10.965732,2.489794 Z M 0.75000004,9.15 4.3000002,13.094444 7.8500003,9.15 Z";
7
+ export declare const PATH_FILTER_SORT_DES = "m 9.429858,10.25386 2,-1 v -3 l 3,-4 h -8 l 3,4 z M 5.849492,5.0266248 H 4.24187 V 12.402744 H 3.170122 V 5.0266248 H 1.5625 l 2.143496,-2.950446 z";
8
+ export declare const PATH_FILTER_SORT_ASC = "m 9.429858,10.25386 2,-1 v -3 l 3,-4 h -8 l 3,4 z M 5.849492,9.452298 H 4.24187 V 2.0761788 H 3.170122 V 9.452298 H 1.5625 l 2.143496,2.950446 z";
9
+ /**
10
+ * Props for {@link DropdownFace}.
11
+ * @internal
12
+ */
13
+ export interface DropdownFaceProps extends React.HTMLAttributes<HTMLDivElement> {
14
+ /** The cell's box the button pins itself into. */
15
+ bounds: Bounds;
16
+ zoom: number;
17
+ disabled: boolean;
18
+ /** The glyph, in a 15x15 viewport. */
19
+ path: string;
20
+ /** A press; the grid never sees it, so the selection does not move. */
21
+ onPress?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
22
+ }
23
+ /**
24
+ * The box and glyph of a cell's dropdown button - a table column's, a pivot field's - pinned to
25
+ * the cell's right edge.
26
+ * @internal
27
+ */
28
+ export declare const DropdownFace: (props: DropdownFaceProps) => React.ReactElement;
29
+ //# sourceMappingURL=_DropdownFace.d.ts.map
@@ -10,6 +10,7 @@ export * from './CellFormulaRenderer';
10
10
  export * from './useFormulaViewAnchor';
11
11
  export * from './SheetHeaderRenderer';
12
12
  export * from './ColumnButton';
13
+ export * from './PivotButton';
13
14
  export * from './OutlineButton';
14
15
  export * from './CornerTriangle';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,5 @@
1
- import { IRange, ICell, ICellRanges, ICellRange, IColor, ITable, INamedCollection, IStyleCollection, ICellStyle, IBorders, ITheme, IThemeCollection, IFunction, IFunctionCollection, IWorkbook, ISlicer, IChart } from '@sheetxl/sdk';
1
+ import { IRange, ICell, ICellRanges, ICellRange, IColor, ITable, INamedCollection, IStyleCollection, ICellStyle, IBorders, ITheme, IThemeCollection, IFunction, IFunctionCollection, IWorkbook, ISlicer, IChart, IPivotTable } from '@sheetxl/sdk';
2
+ import { PivotFieldsModel } from '../pivot/PivotFieldsModel';
2
3
  /**
3
4
  * For providing Adjustable Color Commands additional rendering capabilities.
4
5
  *
@@ -46,6 +47,19 @@ export interface Table {
46
47
  */
47
48
  resolveRanges: (address: ICellRanges.Address) => ICellRanges;
48
49
  }
50
+ /** What the pivot table style gallery draws its previews with: the active pivot table and the workbook's styles. */
51
+ export interface Pivot {
52
+ /** `null` when the selection is in no pivot table. */
53
+ readonly pivot: () => IPivotTable | null;
54
+ readonly styles: () => IStyleCollection;
55
+ }
56
+ /** The pivot value settings window's value: one value of a pivot table, and what to change. */
57
+ export interface PivotValueSettings {
58
+ /** The value. The window starts from its settings, and reads its table's fields and their items. */
59
+ readonly value: IPivotTable.IDataField;
60
+ /** What the window hands back: the settings changed, the rest left out. */
61
+ readonly changes?: PivotFieldsModel.ValueSettings;
62
+ }
49
63
  /** What a slicer-style gallery draws its previews with. */
50
64
  export interface Slicer {
51
65
  readonly slicer: () => ISlicer;
@@ -120,6 +134,22 @@ export interface NewTable {
120
134
  /** The table's name. When omitted the next free default name is used. */
121
135
  name?: string;
122
136
  }
137
+ /** What the New PivotTable dialog makes, as `IPivotTableCollection.add` takes it. */
138
+ export interface NewPivotTable {
139
+ /** The cells to summarize: one range, or a table's or defined name's name. */
140
+ source: ICellRanges | string | null;
141
+ /** The table's top-left cell. */
142
+ location: ICellRanges | null;
143
+ /** The table's name. When omitted the next free default name is used. */
144
+ name?: string;
145
+ }
146
+ /** What the New PivotTable dialog asks of the workbook while it is open. */
147
+ export interface PivotTableTarget {
148
+ /** Throws for a name a new table cannot take on the sheet `location` is on. */
149
+ validateName(name: string, location: ICellRanges | null): void;
150
+ /** Why a new table cannot go at `location`, as a message key; `null` when it can. */
151
+ checkLocation(location: ICellRanges): string | null;
152
+ }
123
153
  export interface SelectedRange {
124
154
  range: ICellRange;
125
155
  cell?: ICell.Address;
@@ -22,13 +22,16 @@ export { SheetLayers, useGridSurface, type SheetLayersProps, type SheetLayersFil
22
22
  export * from './layer/RangeAnnotationLayer';
23
23
  export * from './layer/CellInsertLayer';
24
24
  export * from './layer/HyperlinkLayer';
25
+ export type { RangeToolbarRenderProps } from './layer/RangeToolbar';
25
26
  export type { TableToolbarRenderProps } from './layer/TableToolbar';
27
+ export type { PivotToolbarRenderProps } from './layer/PivotToolbar';
26
28
  export * from './picker';
27
29
  export * from './checklist';
28
30
  export * from './conditionalFormat';
29
31
  export * from './autoFill';
30
32
  export * from './protection';
31
33
  export * from './externalLink';
34
+ export * from './pivot';
32
35
  export * from './clipboard';
33
36
  export * from './commands';
34
37
  export * from './undo';
@@ -1,5 +1,6 @@
1
1
  import { IRange, IWorksheet, ICell } from '@sheetxl/sdk';
2
2
  import { LayerProps, IGridPane } from '@sheetxl/grid-react';
3
+ import { BordersCache } from '../border';
3
4
  export interface BorderLayerProps extends LayerProps {
4
5
  /** Class for the borders host box (devtools identification). */
5
6
  className?: string;
@@ -9,6 +10,8 @@ export interface BorderLayerProps extends LayerProps {
9
10
  value?: ICell;
10
11
  range?: IRange.Coords;
11
12
  }[];
13
+ /** Shared with the {@link SheetGridLineLayer} that draws the same cells. */
14
+ bordersCache?: BordersCache;
12
15
  }
13
16
  export declare const BorderLayer: import('react').NamedExoticComponent<BorderLayerProps & import('react').RefAttributes<HTMLDivElement>>;
14
17
  //# sourceMappingURL=BorderLayer.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { default as React } from 'react';
2
+ import { IWorksheet } from '@sheetxl/sdk';
3
+ import { LayerProps } from '@sheetxl/grid-react';
4
+ import { PivotButtonConfigProps } from '../cell/PivotButton';
5
+ export interface PivotLayerProps extends LayerProps, PivotButtonConfigProps {
6
+ /** The sheet whose pivot tables' controls are rendered. */
7
+ sheet: IWorksheet;
8
+ }
9
+ /**
10
+ * The sheet's pivot table controls: each field's dropdown and each item's expand/collapse box, drawn
11
+ * where Excel draws them - a dropdown pinned to its cell's right edge, a box after its label's
12
+ * indent and before its text.
13
+ *
14
+ * @remarks
15
+ * Sits above the selection, as the table column buttons do: a layer above the hit is offered a press
16
+ * first, so below the selection a press would move it before the button could stop it. The tables'
17
+ * empty boxes and outlines are {@link PivotFrameLayer}'s, below the selection. With no pivot table in
18
+ * the pane's view it renders nothing.
19
+ *
20
+ * A cell layer fed a pivot-aware source, as the table column buttons are: one walk of the
21
+ * sheet's pivot tables per pane, `[]` when none is in view, emitting only the cells that hold a
22
+ * control. Where the cells are is the table's (from its definition, with no calculation), so the
23
+ * layer draws for a table the moment it is placed.
24
+ *
25
+ * The box sits in the gutter {@link ICell.getInsets} already reserves on a label, so the text,
26
+ * wrapping, best-fit and the editor all start after it without this layer telling them to. A
27
+ * press changes the table's definition through {@link IPivotTable.IField} / {@link IPivotTable.IItem};
28
+ * the table announces the change and the layer redraws. Presses never reach the grid, so they do not
29
+ * move the selection.
30
+ */
31
+ export declare const PivotLayer: React.MemoExoticComponent<(props: PivotLayerProps) => React.JSX.Element | null>;
32
+ export interface PivotFrameLayerProps extends LayerProps {
33
+ /** The sheet whose pivot tables are framed. */
34
+ sheet: IWorksheet;
35
+ }
36
+ /**
37
+ * The frame of the sheet's pivot tables: the outline of the hovered table and of the active cell's,
38
+ * as a table's, and over a table with no fields yet its name, a hint and a picture of a pivot table,
39
+ * as Excel draws over its empty box. The hint says to pick fields once the active cell is in the
40
+ * table, and to click into it until then.
41
+ *
42
+ * @remarks
43
+ * Passive paint below the selection, so the selection draws over it. The table's controls are
44
+ * {@link PivotLayer}'s. With no pivot table in the pane's view it renders nothing.
45
+ */
46
+ export declare const PivotFrameLayer: React.MemoExoticComponent<(props: PivotFrameLayerProps) => React.JSX.Element | null>;
47
+ //# sourceMappingURL=PivotLayer.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { default as React } from 'react';
2
+ import { IPivotTable, IWorksheet } from '@sheetxl/sdk';
3
+ import { LayerProps } from '@sheetxl/grid-react';
4
+ import { RangeToolbarRenderProps } from './RangeToolbar';
5
+ /** What the pivot table toolbar is handed. */
6
+ export interface PivotToolbarRenderProps extends RangeToolbarRenderProps {
7
+ /**
8
+ * The hovered pivot table. A press anywhere on the toolbar first puts the selection in it when it
9
+ * is elsewhere, so the PivotTable tab and its pane follow.
10
+ */
11
+ pivot: IPivotTable;
12
+ }
13
+ /** Props for {@link PivotToolbarLayer}. */
14
+ export interface PivotToolbarLayerProps extends LayerProps {
15
+ sheet: IWorksheet;
16
+ /**
17
+ * The toolbar that floats at a hovered pivot table's top-right corner.
18
+ * @defaultValue a plain split button: edit the pivot table · a menu of its commands
19
+ */
20
+ renderToolbar?: ((props: PivotToolbarRenderProps) => React.ReactNode) | null;
21
+ }
22
+ /**
23
+ * The **pivot table toolbar**: hover a pivot table, its body or the page fields above it, and its
24
+ * commands float at its top-right corner, a quick action (edit it) and a dropdown of the rest, as the
25
+ * {@link TableToolbarFloat table toolbar} does for a table. The layer finds the hovered table itself;
26
+ * the float is a {@link RangeToolbarFloat}.
27
+ */
28
+ export declare const PivotToolbarLayer: React.MemoExoticComponent<(props: PivotToolbarLayerProps) => React.ReactElement>;
29
+ //# sourceMappingURL=PivotToolbar.d.ts.map
@@ -0,0 +1,75 @@
1
+ import { default as React } from 'react';
2
+ import { IRange, IWorksheet, ICell } from '@sheetxl/sdk';
3
+ import { HoverTipProps, StickyState } from '@sheetxl/grid-react';
4
+ /**
5
+ * What a toolbar floated over a hovered range is handed, whatever the range holds. Each kind adds
6
+ * the object it floats over: {@link TableToolbarRenderProps}, {@link PivotToolbarRenderProps}.
7
+ */
8
+ export interface RangeToolbarRenderProps {
9
+ sheet: IWorksheet;
10
+ /** Spread onto the toolbar root: it takes the pointer, and hovering it keeps the toolbar up. */
11
+ floatProps: HoverTipProps;
12
+ /**
13
+ * Keep the toolbar up while something it opened has the pointer, its dropdown. Call `true` when the
14
+ * dropdown opens and `false` when it closes.
15
+ */
16
+ setHeld: (held: boolean) => void;
17
+ state: StickyState;
18
+ }
19
+ /** An object a toolbar floats over: a table, a pivot table. */
20
+ interface Hoverable {
21
+ isDeleted(): boolean;
22
+ getName(): string;
23
+ }
24
+ /** What {@link RangeToolbarFloat} takes of the kind of object it floats over. */
25
+ export interface RangeToolbarFloatProps<T extends Hoverable> {
26
+ /** The float's name, unique per kind. */
27
+ name: string;
28
+ sheet: IWorksheet;
29
+ /** The object under the pointer, or `null`. */
30
+ hovered: T | null;
31
+ /** The cells the toolbar floats beside. */
32
+ rangeOf: (object: T) => IRange.Coords;
33
+ /** Whether the active cell is in the object already, so a press on the toolbar selects nothing. */
34
+ contains: (object: T, cell: ICell.Coords) => boolean;
35
+ /** Puts the selection in the object. */
36
+ select: (object: T) => void;
37
+ /** Draws the toolbar for the object, with what every toolbar is handed. */
38
+ render: (object: T, props: RangeToolbarRenderProps) => React.ReactNode;
39
+ }
40
+ /**
41
+ * A toolbar floated at a hovered object's top-right: a {@link VirtualRangeFloat} opened by hover but
42
+ * not a tooltip (it outlives a tip opening beside it and a press on its own buttons), `clamp`ed so it
43
+ * stays on screen while the object's top is scrolled away, and gone while a cell is edited.
44
+ *
45
+ * @remarks
46
+ * The commands act on the object under the active cell, so a press on the toolbar first puts the
47
+ * selection in the hovered object when it is elsewhere. While something it opened is up the toolbar
48
+ * is held (`setHeld`), as the pointer is there, not on the toolbar.
49
+ */
50
+ export declare const RangeToolbarFloat: <T extends Hoverable>(props: RangeToolbarFloatProps<T>) => React.ReactElement;
51
+ /** Draws a toolbar slot: the host's renderer, the default when it gives none, nothing for `null`. */
52
+ export declare const renderToolbarSlot: <P>(render: ((props: P) => React.ReactNode) | null | undefined, fallback: (props: P) => React.ReactNode, props: P) => React.ReactNode;
53
+ /** What {@link RangeToolbarSplitButton} is handed. */
54
+ export interface RangeToolbarSplitButtonProps {
55
+ /** The object the commands take. */
56
+ target: Hoverable;
57
+ /** The quick action first, then the dropdown's commands, by key. */
58
+ commandKeys: readonly string[];
59
+ /** The quick action's color. */
60
+ color: string;
61
+ /** The quick action's icon. */
62
+ iconKey: string;
63
+ /** The dropdown's float name. */
64
+ menuName: string;
65
+ floatProps: HoverTipProps;
66
+ setHeld: (held: boolean) => void;
67
+ }
68
+ /**
69
+ * The plain toolbar, with no UI kit: a quick action in the object's color and a dropdown listing it
70
+ * and the other commands. The dropdown opens in the float stack, so it closes under a context menu
71
+ * like any popup, and holds the toolbar up while open.
72
+ */
73
+ export declare const RangeToolbarSplitButton: React.FC<RangeToolbarSplitButtonProps>;
74
+ export {};
75
+ //# sourceMappingURL=RangeToolbar.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { IWorksheet, IWorksheetView } from '@sheetxl/sdk';
3
3
  import { CellRendererProps, IEditable, LayerProps } from '@sheetxl/grid-react';
4
- import { CellTextRendererProps, ColumnButtonConfigProps } from '../cell';
4
+ import { CellTextRendererProps, ColumnButtonConfigProps, PivotButtonConfigProps } from '../cell';
5
5
  import { EditRejectedNotice } from '../editor/useEditRejectedNotice';
6
6
  export interface SheetCellLayerProps extends LayerProps {
7
7
  /** Class for the layer (devtools identification). */
@@ -20,7 +20,7 @@ export interface SheetCellLayerProps extends LayerProps {
20
20
  * column-button members ride along on the shared type but are consumed by
21
21
  * `SheetColumnButtonLayer`, not here — they are stripped before the spread.
22
22
  */
23
- propsCellRender?: Partial<CellTextRendererProps> & ColumnButtonConfigProps;
23
+ propsCellRender?: Partial<CellTextRendererProps> & ColumnButtonConfigProps & PivotButtonConfigProps;
24
24
  /**
25
25
  * The shared editable. Subscribed so the edited cell is suppressed while its editor is open —
26
26
  * via the layer's live CSS channel (`suppressCell`), so no tile is ever invalidated by an edit
@@ -1,10 +1,22 @@
1
- import { IWorksheet, IWorksheetView } from '@sheetxl/sdk';
2
- import { LayerProps } from '@sheetxl/grid-react';
1
+ import { ICell, IRange, IWorksheet, IWorksheetView } from '@sheetxl/sdk';
2
+ import { IGridPane, LayerProps } from '@sheetxl/grid-react';
3
+ import { BordersCache } from '../border';
3
4
  export interface SheetGridLineLayerProps extends LayerProps {
4
5
  /** The sheet whose gridlines are rendered. */
5
6
  sheet: IWorksheet;
6
- /** The sheet view — drives styling, per-axis visibility, and which cells are scanned (for merges). */
7
+ /** The sheet view — drives styling and per-axis visibility. */
7
8
  sheetView: IWorksheetView;
9
+ /**
10
+ * The cells in view, shared with the fill and border layers; their borders and their merges and
11
+ * overflow are what the lines break around.
12
+ */
13
+ getVisibleCells: (pane: IGridPane) => {
14
+ cell: ICell.Coords;
15
+ value?: ICell;
16
+ range?: IRange.Coords;
17
+ }[];
18
+ /** Shared with the {@link BorderLayer} that draws the same cells. */
19
+ bordersCache?: BordersCache;
8
20
  }
9
21
  /**
10
22
  * The sheet's gridline layer: the view's gridline wherever no cell border owns the edge, so a
@@ -12,9 +24,9 @@ export interface SheetGridLineLayerProps extends LayerProps {
12
24
  * hides it. An axis whose Normal style has a border draws that border instead, in the
13
25
  * {@link BorderLayer} (it is a border on every cell, and draws above the fills).
14
26
  *
15
- * Self-subscribes to `onStyleChange` (sheet) and `onZoomScaleChange` (view) for the styling and
16
- * per-axis visibility, and to its pane's visible range via {@link useSheetVisibleCells} for the
17
- * merges and borders the lines break around. One per pane.
27
+ * Self-subscribes to `onStyleChange` and `onLayoutChange` (sheet) and `onZoomScaleChange` (view)
28
+ * for the styling, per-axis visibility, and the cells it breaks around, and to data changes in its
29
+ * pane's visible range. One per pane.
18
30
  */
19
31
  export declare const SheetGridLineLayer: import('react').MemoExoticComponent<(props: SheetGridLineLayerProps) => import("react").JSX.Element | null>;
20
32
  //# sourceMappingURL=SheetGridLineLayer.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { ReactElement } from 'react';
2
+ import { IWorksheet } from '@sheetxl/sdk';
3
+ import { LayerProps } from '@sheetxl/grid-react';
4
+ export interface SheetPivotCommandLayerProps extends LayerProps {
5
+ sheet: IWorksheet;
6
+ }
7
+ /**
8
+ * **Command-only layer for the `pivot` scope**: no visuals; it joins the pane's z-chain to contribute
9
+ * the {@link contributePivotCommands pivot table operations} while the selection is in a pivot
10
+ * table, as {@link SheetTableCommandLayer} does for tables.
11
+ */
12
+ export declare const SheetPivotCommandLayer: import('react').MemoExoticComponent<(props: SheetPivotCommandLayerProps) => ReactElement>;
13
+ //# sourceMappingURL=SheetPivotCommandLayer.d.ts.map
@@ -1,21 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { IWorksheet, ITable } from '@sheetxl/sdk';
3
- import { HoverTipProps, StickyState } from '@sheetxl/grid-react';
3
+ import { RangeToolbarRenderProps } from './RangeToolbar';
4
4
  /** What the table toolbar is handed. */
5
- export interface TableToolbarRenderProps {
6
- sheet: IWorksheet;
5
+ export interface TableToolbarRenderProps extends RangeToolbarRenderProps {
7
6
  /** The hovered table. A press anywhere on the toolbar makes it the current table first, so the table commands act on it. */
8
7
  table: ITable;
9
- /** The table's theme color, for chrome that wears it. */
10
- color: string;
11
- /** Spread onto the toolbar root: it takes the pointer, and hovering it keeps the toolbar up. */
12
- floatProps: HoverTipProps;
13
- /**
14
- * Keep the toolbar up while something it opened has the pointer — its dropdown. Call `true` when the
15
- * dropdown opens and `false` when it closes.
16
- */
17
- setHeld: (held: boolean) => void;
18
- state: StickyState;
19
8
  }
20
9
  /** What {@link TableLayer} hands its toolbar float. */
21
10
  export interface TableToolbarFloatProps {
@@ -25,18 +14,10 @@ export interface TableToolbarFloatProps {
25
14
  renderToolbar?: ((props: TableToolbarRenderProps) => React.ReactNode) | null;
26
15
  }
27
16
  /**
28
- * The **table toolbar** — hover a table and its commands float at its top-right corner: a quick action
29
- * (edit the table) and a dropdown of the rest. A {@link VirtualRangeFloat} inside the table layer, fed
30
- * the table the layer's own hover found: opened by hover but not a tooltip (it outlives a tip opening
31
- * beside it and a press on its own buttons), `clamp`ed so it stays on screen while the table's top is
32
- * scrolled away. What it draws is the host's (`renderToolbar`); its commands resolve from the pane like
33
- * any other.
34
- *
35
- * @remarks
36
- * The table commands act on the table under the active cell, so a press on the toolbar first makes the
37
- * hovered table that one (selecting it when the active cell is outside it). The dropdown opens in the
38
- * float stack, so it closes under a context menu like any popup; while it is open the toolbar is held
39
- * up (`setHeld`), as the pointer is on the dropdown, not the toolbar.
17
+ * The **table toolbar**: hover a table and its commands float at its top-right corner, a quick action
18
+ * (edit the table) and a dropdown of the rest. A {@link RangeToolbarFloat} inside the table layer, fed
19
+ * the table the layer's own hover found. What it draws is the host's (`renderToolbar`); its commands
20
+ * resolve from the pane like any other.
40
21
  */
41
22
  export declare const TableToolbarFloat: React.FC<TableToolbarFloatProps>;
42
23
  //# sourceMappingURL=TableToolbar.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { IBorders, ICell, IRange } from '@sheetxl/sdk';
2
+ /** The borders a visible cell draws. */
3
+ export declare const getSheetBorderAt: (value: ICell, _index: number) => IBorders;
4
+ /** A merged cell's extrusion is its merge (merged cells never overflow); `null` when not merged. */
5
+ export declare const getSheetMergeAt: (value: ICell, _index: number) => IRange.Coords | null;
6
+ //# sourceMappingURL=_sheetBorders.d.ts.map
@@ -1,4 +1,6 @@
1
- import { IWorksheet, ITable } from '@sheetxl/sdk';
2
- /** The table's theme color (header fill / whole-table top border) as CSS; grey when the style has none. */
3
- export declare const tableLabelColor: (table: ITable, sheet: IWorksheet) => string;
1
+ import { IWorksheet, ITable, IPivotTable, ITableStyle } from '@sheetxl/sdk';
2
+ /** A table style's theme color (header fill / whole-table top border) as CSS; `null` when it has none. */
3
+ export declare const tableStyleColor: (style: ITableStyle | null, sheet: IWorksheet) => string | null;
4
+ /** A table's or pivot table's theme color (header fill / whole-table top border) as CSS; grey when its style has none. */
5
+ export declare const tableLabelColor: (table: Pick<ITable, "getStyle"> | Pick<IPivotTable, "getStyle">, sheet: IWorksheet) => string;
4
6
  //# sourceMappingURL=_tableColor.d.ts.map
@@ -8,6 +8,8 @@ export * from './HyperlinkLayer';
8
8
  export * from './BorderLayer';
9
9
  export * from './SheetCellLayer';
10
10
  export * from './SheetColumnButtonLayer';
11
+ export * from './PivotLayer';
12
+ export * from './PivotToolbar';
11
13
  export * from './SheetGridLineLayer';
12
14
  export * from './SheetBackgroundLayer';
13
15
  export * from './SheetHeaderCellLayer';
@@ -16,6 +18,7 @@ export * from './SheetMovableLayer';
16
18
  export * from './TableLayer';
17
19
  export * from './TableToolbar';
18
20
  export * from './SheetTableCommandLayer';
21
+ export * from './SheetPivotCommandLayer';
19
22
  export * from './SpillLayer';
20
23
  export * from './ConditionalIcons';
21
24
  export * from './ConditionalBarLayer';
@@ -8,12 +8,12 @@ export type SheetVisibleCell = {
8
8
  /**
9
9
  * What the scan should treat as "worth rendering". Each layer passes ONLY the flags its own output
10
10
  * depends on — a flag change busts this hook's scan cache + token, so an unused flag would rebuild
11
- * the caller for nothing (e.g. gridlines must not rebuild on a show-zeros toggle).
11
+ * the caller for nothing (e.g. a layer that ignores zeros must not rebuild on a show-zeros toggle).
12
12
  */
13
13
  export interface SheetVisibleCellsOptions {
14
14
  /**
15
15
  * Formula view: formula-only cells render (even valueless), and text-overflow extrusions are
16
- * disabled (formulas never overflow-paint). Affects cells AND gridlines (extrusions break lines).
16
+ * disabled (formulas never overflow-paint). Affects the cells and their extrusions.
17
17
  * @defaultValue false
18
18
  */
19
19
  showFormulas?: boolean;
@@ -53,8 +53,7 @@ export interface SheetVisibleCells {
53
53
  * source flags change (e.g. `useModelSync(sheetView, ['onZoomScaleChange'])` — the view's setters all
54
54
  * funnel through `_notifyAll`, which fires that event). Each caller (one per layer per pane) gets its
55
55
  * OWN cache + subscription — the layers are deliberately decoupled, so a value edit re-renders only the
56
- * layer(s) that asked, never the grid above them. Used by {@link SheetCellLayer} and
57
- * {@link SheetGridLineLayer}.
56
+ * layer(s) that asked, never the grid above them. Used by {@link SheetCellLayer}.
58
57
  */
59
58
  export declare const useSheetVisibleCells: (sheet: IWorksheet, options?: SheetVisibleCellsOptions) => SheetVisibleCells;
60
59
  //# sourceMappingURL=useSheetVisibleCells.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ /** Props for {@link PivotAreas}. */
3
+ export interface PivotAreasProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ }
5
+ /**
6
+ * The four areas, Excel's Filters, Columns, Rows and Values, each a list of chips in the table's
7
+ * order. A chip drags within its area or to another one, and its ▾ menu (also a right-click, or
8
+ * Shift+F10) moves it, takes it off, or changes a value's function. A focused chip moves with
9
+ * Alt+↑ / Alt+↓, comes off the table with Delete, and is renamed with F2 or a double-click; Space or
10
+ * Enter picks it up to move with the arrow keys.
11
+ *
12
+ * @remarks
13
+ * Goes inside a {@link PivotDragContext}.
14
+ */
15
+ export declare const PivotAreas: (props: PivotAreasProps) => React.ReactElement;
16
+ //# sourceMappingURL=PivotAreas.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { default as React } from 'react';
2
+ import { PivotFieldsModel } from './PivotFieldsModel';
3
+ /** Props for {@link PivotChip}. */
4
+ export interface PivotChipProps extends React.HTMLAttributes<HTMLElement> {
5
+ /** What the chip shows. */
6
+ chip: PivotFieldsModel.Chip;
7
+ /** The area it is in: the values' slot says which way it lays the values out. */
8
+ area: PivotFieldsModel.Area;
9
+ /** Drawn as the copy that follows the pointer during a drag. */
10
+ overlay?: boolean;
11
+ /** The original, while its copy is dragged. */
12
+ dragging?: boolean;
13
+ /** Spread on the caption, which takes the chip's focus and starts its drag. */
14
+ propsCaption?: React.HTMLAttributes<HTMLElement> & {
15
+ ref?: React.Ref<HTMLElement>;
16
+ } & Record<`data-${string}`, string>;
17
+ /** Drawn at the chip's end: its ▾. */
18
+ menuButton?: React.ReactNode;
19
+ /** An input over the caption, to rename the chip. */
20
+ renaming?: boolean;
21
+ /** The name typed, when renaming ends; `null` when it was given up. */
22
+ onRename?: (name: string | null) => void;
23
+ ref?: React.Ref<HTMLElement>;
24
+ }
25
+ /**
26
+ * A field in an area: its caption (a value's reads `Sum of Sales`), a mark when the field is
27
+ * filtered, and its ▾. `Σ Values` says whether it lays the values out as columns or as rows.
28
+ *
29
+ * @remarks
30
+ * Presentational: {@link PivotAreas} makes it draggable and gives it its keys and its menu.
31
+ */
32
+ export declare const PivotChip: (props: PivotChipProps) => React.ReactElement;
33
+ //# sourceMappingURL=PivotChip.d.ts.map