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

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 (99) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/{Eccqvu_ltQH3yLm8.mjs → 1nN0NNMaAIsgiI3e.mjs} +3 -3
  3. package/browser/esm/{kQVuIBGvAYMVXPYJ.mjs → BDR2ekvOkyo3laAm.mjs} +4 -4
  4. package/browser/esm/{D3EZj2DZtqvEw39q.mjs → BMlHmy5KHq4fpX89.mjs} +2 -2
  5. package/browser/esm/{mQlxlB1jsEg5m2tk.mjs → Bt2sBBEyKZJu0p0G.mjs} +3 -3
  6. package/browser/esm/{CCL1HOWXz62tDziU.mjs → BuI1QOZfQOLRxv4Q.mjs} +2 -2
  7. package/browser/esm/{CBAt-J0K7H2yH-2w.mjs → C1C6etLFfhuqi99X.mjs} +2 -2
  8. package/browser/esm/{YYwEGf_7TmjEmW6k.mjs → C8xSJkoMQ48a6FUE.mjs} +2 -2
  9. package/browser/esm/{DFGGb7jiCJcfCaYj.mjs → CKxfHbnDDNWdSgCa.mjs} +2 -2
  10. package/browser/esm/{CW3DK5L4GYrbHYn3.mjs → Ce1bW8Vmpp1o5nH7.mjs} +4 -4
  11. package/browser/esm/{CmX0QHgElbcLT_eT.mjs → CttfqXbX8QGBlLUy.mjs} +7 -7
  12. package/browser/esm/{CnmhZ0sv8-uJ3jIh.mjs → D2ttaxNfmCgJPpIL.mjs} +2 -2
  13. package/browser/esm/{CJAAYqzB5y5hTJ85.mjs → D4UxXbJprFoh8e8r.mjs} +2 -2
  14. package/browser/esm/{B7PnGz42UySqvnvf.mjs → DD8k94MkULtCDCqI.mjs} +4 -4
  15. package/browser/esm/{W9-RoLMW94RtA2yw.mjs → DGAgjGwo1pLorNXf.mjs} +2 -2
  16. package/browser/esm/{DCUlR5K3bBO-sXSf.mjs → DK2-0QyEDqx8d0XH.mjs} +5 -5
  17. package/browser/esm/{CqZpzm1L_Z2tVGiu.mjs → DL8bI9YEl5Otd-ih.mjs} +2 -2
  18. package/browser/esm/{CWdNVd2X-jRKlB_b.mjs → MmP_sX1FvMvViZZD.mjs} +3 -3
  19. package/browser/esm/{DOQHq7WB1-h05twR.mjs → UiFSvM9Z6y0t72hV.mjs} +7 -7
  20. package/browser/esm/{BSaF1NUo5Ilp--Rg.mjs → Z5bFuSFQeh75HMWA.mjs} +6 -6
  21. package/browser/esm/chart.mjs +4 -4
  22. package/browser/esm/control.mjs +3 -3
  23. package/browser/esm/{Jsf-8NM-LoKvVsYf.mjs → dAnrqhgO4VFyrocf.mjs} +2 -2
  24. package/browser/esm/{NshsRiPQnC1BkiQA.mjs → ep5bfXSko9E1UYpO.mjs} +2 -2
  25. package/browser/esm/group.mjs +4 -4
  26. package/browser/esm/{CWLi88m6LfSPOUoJ.mjs → hjwXRlBRxr2wVnGG.mjs} +2 -2
  27. package/browser/esm/index.mjs +10720 -9114
  28. package/browser/esm/note.mjs +5 -5
  29. package/browser/esm/picture.mjs +3 -3
  30. package/browser/esm/shape.mjs +3 -3
  31. package/browser/esm/slicer.mjs +5 -5
  32. package/browser/esm/{CvedGF4lbJchD_Tg.mjs → xnubiISd6zDiHAww.mjs} +2 -2
  33. package/node/esm/{CfFmAB75wf0KyCat.mjs → B6FEw5vtIODLY_8C.mjs} +6 -6
  34. package/node/esm/{BzxeGvZj4Pgqhney.mjs → BShOuK0OXwR9NSdj.mjs} +5 -5
  35. package/node/esm/{CnTs_0-4eOpvZg8R.mjs → BZxcC1cfoQJEQCbW.mjs} +2 -2
  36. package/node/esm/{eQJQMKkYOP7uVRYY.mjs → BvtqxTJsH9qrs0oo.mjs} +2 -2
  37. package/node/esm/{BE_wecWj_wouzvwo.mjs → CQyoYz8uAb2rwRgR.mjs} +2 -2
  38. package/node/esm/{CBKs0BGWFyKb6fAa.mjs → CW9MYVxiw-BHoWOv.mjs} +2 -2
  39. package/node/esm/{FEK43PhLZa-Z0PJl.mjs → CZ4oenvKO_nsgqT3.mjs} +2 -2
  40. package/node/esm/{CHJu5Pijhfp2u8iw.mjs → CaqQCNAPYBQPStW6.mjs} +3 -3
  41. package/node/esm/{DuoOyDpiOAdK8IZQ.mjs → CczY1geYlm7dZykP.mjs} +2 -2
  42. package/node/esm/{CDFWR8VuVJHAYNNI.mjs → CeDLAkScaM4r3aRY.mjs} +2 -2
  43. package/node/esm/{XLCT3m2EOLskQps9.mjs → Cxg42ySbHoSgZz4m.mjs} +2 -2
  44. package/node/esm/{D87-gdOPXyqWeq9r.mjs → D1kwQ7kj4CIEHF6o.mjs} +2 -2
  45. package/node/esm/{a4vck0pT0feFFXSx.mjs → DBdfrbP95AgBwjj2.mjs} +3 -3
  46. package/node/esm/{ZTIwQN07Ioz-tn17.mjs → DF1hQLrsJatoimsP.mjs} +2 -2
  47. package/node/esm/{Df37YYiPX3A6lmeA.mjs → DNioL3BfDain0oLO.mjs} +2 -2
  48. package/node/esm/{qOitqMlh9UUnFpG4.mjs → DYHX-Y0Lgclu8imk.mjs} +3 -3
  49. package/node/esm/{BWvLL25LXIqgwEQR.mjs → OB-WWDXKQNnQq71Y.mjs} +2 -2
  50. package/node/esm/{DHwhGqtfOi4qGI5j.mjs → RfipyLtZiGFsXmFH.mjs} +3 -3
  51. package/node/esm/chart.mjs +3 -3
  52. package/node/esm/control.mjs +3 -3
  53. package/node/esm/{CNZvdFLLo0flJEA-.mjs → gbWplmokh3BEFa8d.mjs} +2 -2
  54. package/node/esm/group.mjs +4 -4
  55. package/node/esm/index.mjs +8307 -6746
  56. package/node/esm/note.mjs +5 -5
  57. package/node/esm/picture.mjs +6 -6
  58. package/node/esm/shape.mjs +7 -7
  59. package/node/esm/slicer.mjs +5 -5
  60. package/node/esm/{C9D9KK3BOuRjzee8.mjs → stixLaWCsDf8jtRL.mjs} +2 -2
  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/ui.msg.json +47 -0
  67. package/resources/locales/de/workbook.cmd.json +1 -1
  68. package/resources/locales/en/pivot.cmd.json +71 -0
  69. package/resources/locales/en/sheet.cmd.json +40 -0
  70. package/resources/locales/en/ui.msg.json +47 -0
  71. package/resources/locales/en/workbook.cmd.json +1 -1
  72. package/types/src/cell/PivotButton.d.ts +55 -0
  73. package/types/src/cell/_DropdownFace.d.ts +29 -0
  74. package/types/src/cell/index.d.ts +1 -0
  75. package/types/src/frame/CommandContext.d.ts +31 -1
  76. package/types/src/index.d.ts +3 -0
  77. package/types/src/layer/PivotLayer.d.ts +47 -0
  78. package/types/src/layer/PivotToolbar.d.ts +29 -0
  79. package/types/src/layer/RangeToolbar.d.ts +75 -0
  80. package/types/src/layer/SheetCellLayer.d.ts +2 -2
  81. package/types/src/layer/SheetPivotCommandLayer.d.ts +13 -0
  82. package/types/src/layer/TableToolbar.d.ts +6 -25
  83. package/types/src/layer/_tableColor.d.ts +5 -3
  84. package/types/src/layer/index.d.ts +3 -0
  85. package/types/src/pivot/PivotAreas.d.ts +16 -0
  86. package/types/src/pivot/PivotChip.d.ts +33 -0
  87. package/types/src/pivot/PivotChipMenu.d.ts +74 -0
  88. package/types/src/pivot/PivotCommands.d.ts +24 -0
  89. package/types/src/pivot/PivotFieldList.d.ts +14 -0
  90. package/types/src/pivot/PivotFields.d.ts +47 -0
  91. package/types/src/pivot/PivotFieldsModel.d.ts +143 -0
  92. package/types/src/pivot/PivotTablePane.d.ts +49 -0
  93. package/types/src/pivot/_PivotFieldsContext.d.ts +41 -0
  94. package/types/src/pivot/_pivotNew.d.ts +12 -0
  95. package/types/src/pivot/_pivotRegion.d.ts +14 -0
  96. package/types/src/pivot/index.d.ts +9 -0
  97. package/types/src/pivot/usePivotFields.d.ts +17 -0
  98. package/types/src/sheet/IWorksheetElement.d.ts +10 -2
  99. package/types/src/workbook/IWorkbookElement.d.ts +11 -1
@@ -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';
@@ -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
@@ -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
@@ -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';
@@ -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
@@ -0,0 +1,74 @@
1
+ import { default as React } from 'react';
2
+ import { FloatReference } from '@sheetxl/utils-react';
3
+ import { PivotMenuRenderProps } from '../workbook/IWorkbookElement';
4
+ import { PivotFieldsModel } from './PivotFieldsModel';
5
+ /** An entry of a chip's menu. */
6
+ export interface PivotChipMenuItem {
7
+ /** Names the entry: `moveUp`, `moveTo.row`, `function.sum`, `remove`. */
8
+ readonly key: string;
9
+ /** Translated. */
10
+ readonly label: string;
11
+ /** Set on a choice, a value's function: whether it is the one in effect. */
12
+ readonly checked?: boolean;
13
+ readonly disabled?: boolean;
14
+ /** Closes the menu and runs the entry. */
15
+ readonly run: () => void;
16
+ }
17
+ /** What a chip menu renderer ({@link PivotDragContextProps.renderMenu}) is handed. */
18
+ export interface PivotChipMenuRenderProps {
19
+ readonly chip: PivotFieldsModel.Chip;
20
+ readonly area: PivotFieldsModel.Area;
21
+ /** The entries, in groups; draw a divider between two groups. */
22
+ readonly groups: readonly (readonly PivotChipMenuItem[])[];
23
+ /** The menu's float. */
24
+ readonly floatReference: FloatReference;
25
+ }
26
+ /** The window a value's *Value settings…* opens (`showWindow`), given a {@link CommandContext.PivotValueSettings}. */
27
+ export declare const PIVOT_VALUE_SETTINGS_WINDOW = "pivotValueSettings";
28
+ /** A chip and where it is. */
29
+ export interface ChipPlace {
30
+ chip: PivotFieldsModel.Chip;
31
+ area: PivotFieldsModel.Area;
32
+ index: number;
33
+ /** How many chips its area has. */
34
+ count: number;
35
+ }
36
+ /** What a chip's entries act through. */
37
+ export interface ChipMenuActions {
38
+ model: PivotFieldsModel;
39
+ run: (gesture: Promise<void>) => void;
40
+ t: (key: string) => string;
41
+ /** Closes the menu. */
42
+ close: () => void;
43
+ /** Handed the id a moved chip will have, when it keeps one. */
44
+ focus: (id: string) => void;
45
+ /** Opens a value's settings. */
46
+ openValueSettings: (value: string) => void;
47
+ /** Opens a field's sort and filter; `null` when the host has none. */
48
+ openFilter: ((field: string) => void) | null;
49
+ }
50
+ /**
51
+ * A chip's menu entries: a value's functions, its moves along its area, its moves to the other
52
+ * areas, a field's sort and filter, Remove, and a value's settings.
53
+ */
54
+ export declare const chipMenuGroups: (place: ChipPlace, actions: ChipMenuActions) => PivotChipMenuItem[][];
55
+ /** Options for {@link useChipMenu}. */
56
+ export interface ChipMenuOptions {
57
+ place: ChipPlace;
58
+ model: PivotFieldsModel;
59
+ run: (gesture: Promise<void>) => void;
60
+ /** As {@link PivotDragContextProps.renderMenu}. */
61
+ renderMenu: ((props: PivotChipMenuRenderProps) => React.ReactNode) | null | undefined;
62
+ /** As {@link PivotDragContextProps.renderFilter}. */
63
+ renderFilter: ((props: PivotMenuRenderProps) => React.ReactNode) | null | undefined;
64
+ focus: (id: string) => void;
65
+ }
66
+ /** A chip's menu: the ▾ that opens it, and `open` for the chip's own ways in (right-click, Shift+F10). */
67
+ export interface ChipMenu {
68
+ /** `null` when the host renders no chip menus. */
69
+ button: React.ReactElement | null;
70
+ open: () => void;
71
+ }
72
+ /** The ▾ menu of one chip, in the float stack, anchored to its button. */
73
+ export declare const useChipMenu: (options: ChipMenuOptions) => ChipMenu;
74
+ //# sourceMappingURL=PivotChipMenu.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { RemoveListener, UndoManager } from '@sheetxl/utils';
2
+ import { IWorksheet } from '@sheetxl/sdk';
3
+ import { Command, IReactNotifier } from '@sheetxl/utils-react';
4
+ /** Options for {@link contributePivotCommands}. */
5
+ export interface ContributePivotCommandsOptions {
6
+ /** Busy + error UI for the transactional middleware. */
7
+ notifier?: IReactNotifier;
8
+ /** Undo manager the sheet records into — enables F4 / redo-as-repeat. */
9
+ manager?: UndoManager;
10
+ }
11
+ /** The single `data` bundle {@link contributePivotCommands} takes (the `DynamicCommandContributor` shape). */
12
+ export interface PivotCommandData extends ContributePivotCommandsOptions {
13
+ sheet: IWorksheet | null;
14
+ }
15
+ /**
16
+ * **Pivot table command behavior**: which parts of the style of the pivot table the active cell is
17
+ * in show. The `pivot` scope's behavior (chrome in the catalog, `pivot.cmd.json`); the ops and the
18
+ * PivotTable tab are contributed only while the active cell is in a pivot table, as the table
19
+ * scope's are ({@link contributeTableCommands}). The style itself (`formatPivotStyle`) is a `sheet`
20
+ * command: the pivot table toolbar's gallery opens on the press that puts the active cell in the
21
+ * table, before this scope's ops are contributed.
22
+ */
23
+ export declare function contributePivotCommands(contribution: Command.CommandContribution, data: PivotCommandData): RemoveListener;
24
+ //# sourceMappingURL=PivotCommands.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ /** Props for {@link PivotFieldList}. */
3
+ export interface PivotFieldListProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ }
5
+ /**
6
+ * The source's fields, a search box over them, and a box to tick for each: a tick places the field
7
+ * by what it holds (numbers to the values, anything else to the rows), an untick takes it off the
8
+ * table. Each field shows what it holds and whether it is filtered, and drags into an area.
9
+ *
10
+ * @remarks
11
+ * Goes inside a {@link PivotDragContext}. A chip dropped on the list comes off the table.
12
+ */
13
+ export declare const PivotFieldList: (props: PivotFieldListProps) => React.ReactElement;
14
+ //# sourceMappingURL=PivotFieldList.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { default as React } from 'react';
2
+ import { PivotFieldsState } from './usePivotFields';
3
+ import { PivotChipMenuRenderProps } from './PivotChipMenu';
4
+ import { PivotMenuRenderProps } from '../workbook/IWorkbookElement';
5
+ /** Props for {@link PivotDragContext}. */
6
+ export interface PivotDragContextProps extends React.HTMLAttributes<HTMLDivElement> {
7
+ /** The table, from {@link usePivotFields}. */
8
+ fields: PivotFieldsState;
9
+ /** A gesture the table refused; it changed nothing. */
10
+ onError?: (error: unknown) => void;
11
+ /**
12
+ * The menu a chip's ▾ opens. `null` for chips with no menu.
13
+ * @defaultValue a plain list of the chip's entries
14
+ */
15
+ renderMenu?: ((props: PivotChipMenuRenderProps) => React.ReactNode) | null;
16
+ /**
17
+ * A field's sort and filter, which its chip's *Sort and filter…* opens: the pivot field menu, as
18
+ * the workbook's `renderPivotMenu` draws it at a field's button in the table. Absent or `null`, the
19
+ * menu leaves the entry out.
20
+ */
21
+ renderFilter?: ((props: PivotMenuRenderProps) => React.ReactNode) | null;
22
+ }
23
+ /**
24
+ * The drag and drop between a {@link PivotFieldList} and {@link PivotAreas}: both go inside it, laid
25
+ * out however the host likes.
26
+ *
27
+ * @remarks
28
+ * - A field dropped in an area goes there, before the chip it is dropped on or after the last.
29
+ * - A chip dropped on the field list, or outside this element, comes off the table.
30
+ * - A drop elsewhere inside this element, between the areas, does nothing.
31
+ */
32
+ export declare const PivotDragContext: (props: PivotDragContextProps) => React.ReactElement;
33
+ /** Props for {@link PivotFields}. */
34
+ export interface PivotFieldsProps extends Omit<PivotDragContextProps, 'children'> {
35
+ }
36
+ /**
37
+ * A pivot table's field list over its four areas, as Excel's PivotTable Fields pane lays them out:
38
+ * tick a field to place it by what it holds, drag fields and chips between the areas, and move a
39
+ * focused chip with Alt+↑ / Alt+↓ or take it off with Delete.
40
+ *
41
+ * @remarks
42
+ * Needs no sheet, selection or task pane: a host with no grid mounts it beside its own view of the
43
+ * table. For another layout, put {@link PivotFieldList} and {@link PivotAreas} in a
44
+ * {@link PivotDragContext} directly.
45
+ */
46
+ export declare const PivotFields: (props: PivotFieldsProps) => React.ReactElement;
47
+ //# sourceMappingURL=PivotFields.d.ts.map