@sheetxl/react 0.8.0-beta.14 → 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/{BNyPX5tVpHU3d3Vj.mjs → 1nN0NNMaAIsgiI3e.mjs} +3 -3
  3. package/browser/esm/{nm3DZw1nJMIh89Dx.mjs → BDR2ekvOkyo3laAm.mjs} +4 -4
  4. package/browser/esm/{wQh060x4Bo_NqUYk.mjs → BMlHmy5KHq4fpX89.mjs} +2 -2
  5. package/browser/esm/{C1yjI8GDwCp8bC1Z.mjs → Bt2sBBEyKZJu0p0G.mjs} +3 -3
  6. package/browser/esm/{BCZ5elyhp4P5oEuf.mjs → BuI1QOZfQOLRxv4Q.mjs} +2 -2
  7. package/browser/esm/{Bk4hW9MxdjC3CGlC.mjs → C1C6etLFfhuqi99X.mjs} +2 -2
  8. package/browser/esm/{BSqY5OuRUNgKmwp8.mjs → C8xSJkoMQ48a6FUE.mjs} +2 -2
  9. package/browser/esm/{B9bUlu6d3vrRZxS-.mjs → CKxfHbnDDNWdSgCa.mjs} +2 -2
  10. package/browser/esm/{BAhJx_sa3wR4i_0q.mjs → Ce1bW8Vmpp1o5nH7.mjs} +4 -4
  11. package/browser/esm/{DxwO-Y_gJ9IaBQ4B.mjs → CttfqXbX8QGBlLUy.mjs} +7 -7
  12. package/browser/esm/{CuPu7ToiaqUerd85.mjs → D2ttaxNfmCgJPpIL.mjs} +2 -2
  13. package/browser/esm/{K9YyKehkJlT3axZh.mjs → D4UxXbJprFoh8e8r.mjs} +2 -2
  14. package/browser/esm/{3bA4ZNVK9px28j8g.mjs → DD8k94MkULtCDCqI.mjs} +4 -4
  15. package/browser/esm/{B1mBZyt2eP2CpVwp.mjs → DGAgjGwo1pLorNXf.mjs} +2 -2
  16. package/browser/esm/{CDf6czK5WuKJhq0y.mjs → DK2-0QyEDqx8d0XH.mjs} +5 -5
  17. package/browser/esm/{BoJ5N_Kc7V9zyftG.mjs → DL8bI9YEl5Otd-ih.mjs} +2 -2
  18. package/browser/esm/{PL83wgS5ferhptps.mjs → MmP_sX1FvMvViZZD.mjs} +3 -3
  19. package/browser/esm/{NG_Q0Dq4JXnEWACp.mjs → UiFSvM9Z6y0t72hV.mjs} +7 -7
  20. package/browser/esm/{BLYs69szBviI7Jjh.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/{CAT9L5BY3HAluoJf.mjs → dAnrqhgO4VFyrocf.mjs} +2 -2
  24. package/browser/esm/{C6TgQuQt88nz0-jL.mjs → ep5bfXSko9E1UYpO.mjs} +2 -2
  25. package/browser/esm/group.mjs +4 -4
  26. package/browser/esm/{D0Sg0TONmNBjIlEg.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/{CoRairrEG42TjiZk.mjs → xnubiISd6zDiHAww.mjs} +2 -2
  33. package/node/esm/{CMSfxUMv1tFyNlRJ.mjs → B6FEw5vtIODLY_8C.mjs} +6 -6
  34. package/node/esm/{CZfiN5xD1_Zws8z-.mjs → BShOuK0OXwR9NSdj.mjs} +5 -5
  35. package/node/esm/{CEyXz1TulkCpAv0t.mjs → BZxcC1cfoQJEQCbW.mjs} +2 -2
  36. package/node/esm/{DA6UdPMREzxobL8H.mjs → BvtqxTJsH9qrs0oo.mjs} +2 -2
  37. package/node/esm/{BBm7LjTGVud73kml.mjs → CQyoYz8uAb2rwRgR.mjs} +2 -2
  38. package/node/esm/{ShpbUw8_QnOxZu2h.mjs → CW9MYVxiw-BHoWOv.mjs} +2 -2
  39. package/node/esm/{BgH9YejvQpQrZeHl.mjs → CZ4oenvKO_nsgqT3.mjs} +2 -2
  40. package/node/esm/{Duu2zmr8YkGTo-iP.mjs → CaqQCNAPYBQPStW6.mjs} +3 -3
  41. package/node/esm/{fhOm7EkeM-0FAdDI.mjs → CczY1geYlm7dZykP.mjs} +2 -2
  42. package/node/esm/{Dztz6JUUcE4NG6sn.mjs → CeDLAkScaM4r3aRY.mjs} +2 -2
  43. package/node/esm/{C0HgFe1pYpEl1EgM.mjs → Cxg42ySbHoSgZz4m.mjs} +2 -2
  44. package/node/esm/{_OzLYz_iliC3tcW2.mjs → D1kwQ7kj4CIEHF6o.mjs} +2 -2
  45. package/node/esm/{D2dDGnBtilmmDxBJ.mjs → DBdfrbP95AgBwjj2.mjs} +3 -3
  46. package/node/esm/{eG-mlQfoOvRwAwU1.mjs → DF1hQLrsJatoimsP.mjs} +2 -2
  47. package/node/esm/{wtQ7d7f37N1tuJZB.mjs → DNioL3BfDain0oLO.mjs} +2 -2
  48. package/node/esm/{BayAQ4VhPgK40T5V.mjs → DYHX-Y0Lgclu8imk.mjs} +3 -3
  49. package/node/esm/{r0Bg1Uwd5WHBFQyj.mjs → OB-WWDXKQNnQq71Y.mjs} +2 -2
  50. package/node/esm/{6VFNx4NTcuHaXbnF.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/{ByTkh2-kGcBTZn9j.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/{D-lQa7ydREp9WwxP.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,143 @@
1
+ import { IPivotTable } from '@sheetxl/sdk';
2
+ /**
3
+ * A pivot table's field list as a user works it, with no UI: what each field is and where it sits,
4
+ * the four areas in order, and one method per gesture (DESIGN-PIVOT-UI §3). A view renders
5
+ * {@link getSnapshot} and calls the gestures; it hears every change, the table's own and those made
6
+ * by script, undo or another view, through {@link subscribe}.
7
+ *
8
+ * @remarks
9
+ * Reads and writes through the public {@link IPivotTable} only, so the same model drives a task pane
10
+ * beside a sheet and a pivot widget with no grid. Each gesture is one step to undo, two calls
11
+ * included, and gestures run one after another in the order they are asked for. A refused gesture
12
+ * rejects with the table's error and changes nothing.
13
+ *
14
+ * While anything subscribes, the snapshot is the same object until the table changes, as
15
+ * `useSyncExternalStore` needs; otherwise each call reads the table afresh.
16
+ */
17
+ export declare class PivotFieldsModel {
18
+ private _pivot;
19
+ private _snapshot;
20
+ private _listeners;
21
+ private _removeSheetListener;
22
+ private _queue;
23
+ constructor(pivot: IPivotTable);
24
+ /** The table the model works. */
25
+ getPivotTable(): IPivotTable;
26
+ /** The table as the field list shows it now. */
27
+ getSnapshot(): PivotFieldsModel.Snapshot;
28
+ /**
29
+ * Calls `listener` after each change to the table; returns the call that stops it. The model
30
+ * listens to the table's sheet while anything listens to it.
31
+ */
32
+ subscribe(listener: () => void): () => void;
33
+ /** Stops listening to the table, whoever still subscribes. */
34
+ close(): void;
35
+ /**
36
+ * Ticks a field in the list: a field of numbers goes to the values, as a Sum; any other to the
37
+ * rows, after the last ({@link IPivotTable.IField.getDataType}). Nothing for a field already ticked.
38
+ */
39
+ tick(field: string): Promise<void>;
40
+ /** Unticks a field in the list: it comes off its axis and every value summarizing it goes. */
41
+ untick(field: string): Promise<void>;
42
+ /**
43
+ * Puts a chip, or a field from the list, in an area at `index` (counted from 0 among the area's
44
+ * chips, the values' slot among them); absent, after the last.
45
+ *
46
+ * @remarks
47
+ * - A field to the rows, columns or filters moves there; within its own area it changes place.
48
+ * - A field to the values is summarized, leaving any axis it was on, as Excel's does.
49
+ * - A value to another area: it goes, and its field takes that area.
50
+ * - The values' slot moves between the rows and the columns only.
51
+ */
52
+ place(item: PivotFieldsModel.Draggable, area: PivotFieldsModel.Area, index?: number): Promise<void>;
53
+ /**
54
+ * Takes a chip off the table: a field off its axis, a value deleted. The values' slot deletes every
55
+ * value, as Excel's does.
56
+ */
57
+ remove(item: PivotFieldsModel.Draggable): Promise<void>;
58
+ /** Changes what a value computes; a caption the table made follows it, as Excel's does. */
59
+ setFunction(value: string, fn: IPivotTable.IDataField.Function): Promise<void>;
60
+ /**
61
+ * Changes a value's settings as one step to undo: its function, then how it is shown, then its
62
+ * number format, then its caption. What `settings` leaves out stays.
63
+ *
64
+ * @remarks
65
+ * The order is the dialog's: a function rewrites the caption and a kind of show-as the format, so a
66
+ * caption or a format asked for with them is the one the value keeps.
67
+ */
68
+ applyValueSettings(value: string, settings: PivotFieldsModel.ValueSettings): Promise<void>;
69
+ /** Renames a chip: a field, a value, or the values' slot. */
70
+ rename(item: PivotFieldsModel.Draggable, name: string): Promise<void>;
71
+ /** A field to a row, column or page area at `position`, or along it when it is there already. */
72
+ private _toAxis;
73
+ private _field;
74
+ private _data;
75
+ /** Runs `gesture` after those asked for before it. */
76
+ private _run;
77
+ /** Runs calls as one step to undo, on the table as the batch's workbook reaches it. */
78
+ private _batch;
79
+ private _changed;
80
+ private _stopListening;
81
+ }
82
+ export declare namespace PivotFieldsModel {
83
+ /** An area of the field list, by the axis it puts a field on. */
84
+ type Area = 'row' | 'column' | 'page' | 'values';
85
+ /** A field of the table's source, as the list shows it. */
86
+ interface Field {
87
+ /** Its caption. */
88
+ readonly name: string;
89
+ readonly dataType: IPivotTable.IField.DataType;
90
+ /** On an axis or summarized: its box is ticked. */
91
+ readonly ticked: boolean;
92
+ readonly axis: IPivotTable.Axis | null;
93
+ readonly filtered: boolean;
94
+ }
95
+ /** A field on the rows, columns or filters. */
96
+ interface FieldChip {
97
+ readonly kind: 'field';
98
+ readonly name: string;
99
+ readonly filtered: boolean;
100
+ }
101
+ /** Where the values sit among the rows or columns (`Σ Values`), with two values or more. */
102
+ interface ValuesChip {
103
+ readonly kind: 'values';
104
+ readonly name: string;
105
+ }
106
+ /** A value: a field summarized by a function. */
107
+ interface DataChip {
108
+ readonly kind: 'data';
109
+ readonly name: string;
110
+ /** The caption of the field it summarizes. */
111
+ readonly field: string;
112
+ readonly function: IPivotTable.IDataField.Function;
113
+ }
114
+ type Chip = FieldChip | ValuesChip | DataChip;
115
+ /** A value's settings to change ({@link PivotFieldsModel.applyValueSettings}); what is absent stays. */
116
+ interface ValueSettings {
117
+ readonly function?: IPivotTable.IDataField.Function;
118
+ /** `null` shows it as it is. */
119
+ readonly showAs?: IPivotTable.IDataField.ShowAs | null;
120
+ /** A format code. */
121
+ readonly numberFormat?: string;
122
+ readonly name?: string;
123
+ }
124
+ /** What a gesture takes: a chip, or a field from the list by its caption. */
125
+ type Draggable = Chip | {
126
+ readonly kind: 'field';
127
+ readonly name: string;
128
+ };
129
+ interface Snapshot {
130
+ /** The table is gone: deleted, or its sheet closed. */
131
+ readonly deleted: boolean;
132
+ readonly name: string;
133
+ /** As {@link IPivotTable.getSource}. */
134
+ readonly source: string | null;
135
+ /** Its location, without the page fields: `A3:D20`. */
136
+ readonly location: string | null;
137
+ /** The source's fields, in its order. */
138
+ readonly fields: readonly Field[];
139
+ /** Each area's chips, outermost or first first. */
140
+ readonly areas: Readonly<Record<Area, readonly Chip[]>>;
141
+ }
142
+ }
143
+ //# sourceMappingURL=PivotFieldsModel.d.ts.map
@@ -0,0 +1,49 @@
1
+ import { default as React } from 'react';
2
+ import { IPivotTable } from '@sheetxl/sdk';
3
+ import { TaskPaneProps } from '../taskPane/ITaskPane';
4
+ import { PivotFieldsProps } from './PivotFields';
5
+ /** The key the PivotTable Fields pane is registered under. */
6
+ export declare const PIVOT_TABLE_PANE_KEY = "pivotTableFields";
7
+ /** What the PivotTable Fields pane can be asked to show (`activateTaskPane(key, { args })`). */
8
+ export interface PivotTablePaneArgs {
9
+ /** The table to show; absent, the one the selection is in. */
10
+ pivot?: IPivotTable;
11
+ }
12
+ /** What {@link PivotTablePaneProps.renderHeader} is handed. */
13
+ export interface PivotTableHeaderProps {
14
+ /** The table the pane shows. */
15
+ pivot: IPivotTable;
16
+ /** Its name now. */
17
+ name: string;
18
+ /** Its source now, as {@link IPivotTable.getSource}. */
19
+ source: string | null;
20
+ /** Shows an error from a change the header made. */
21
+ onError: (error: unknown) => void;
22
+ }
23
+ /** Props for {@link PivotTablePane}. */
24
+ export interface PivotTablePaneProps extends TaskPaneProps<any, PivotTablePaneArgs> {
25
+ /** As {@link PivotFieldsProps.renderMenu}. */
26
+ renderMenu?: PivotFieldsProps['renderMenu'];
27
+ /** As {@link PivotFieldsProps.renderFilter}. */
28
+ renderFilter?: PivotFieldsProps['renderFilter'];
29
+ /**
30
+ * The table's name and source above its fields, for a host that edits them. Absent, the name is
31
+ * shown as text.
32
+ */
33
+ renderHeader?: (props: PivotTableHeaderProps) => React.ReactNode;
34
+ }
35
+ /**
36
+ * The PivotTable Fields pane: the {@link PivotFields} of one pivot table.
37
+ *
38
+ * @remarks
39
+ * It opens on the table it is asked for, or the one the active cell is in, and then follows the
40
+ * active cell: into another pivot table, or out of every table to an empty pane.
41
+ */
42
+ export declare const PivotTablePane: (props: PivotTablePaneProps) => React.ReactElement;
43
+ /**
44
+ * Registers the PivotTable Fields pane ({@link PivotTablePane}) with the default task pane registry,
45
+ * unless a pane is already registered under its key. The `editPivotTable` command calls it before
46
+ * opening the pane.
47
+ */
48
+ export declare function registerPivotTablePane(): void;
49
+ //# sourceMappingURL=PivotTablePane.d.ts.map
@@ -0,0 +1,41 @@
1
+ import { default as React } from 'react';
2
+ import { PivotFieldsModel } from './PivotFieldsModel';
3
+ import { PivotChipMenuRenderProps } from './PivotChipMenu';
4
+ import { PivotMenuRenderProps } from '../workbook/IWorkbookElement';
5
+ /** What the field list and the areas share under a {@link PivotDragContext}. */
6
+ export interface PivotFieldsContextValue {
7
+ model: PivotFieldsModel;
8
+ snapshot: PivotFieldsModel.Snapshot;
9
+ /** Runs a gesture; a refused one goes to the host's error handler. */
10
+ run: (gesture: Promise<void>) => void;
11
+ /** As {@link PivotDragContextProps.renderMenu}. */
12
+ renderMenu: ((props: PivotChipMenuRenderProps) => React.ReactNode) | null | undefined;
13
+ /** As {@link PivotDragContextProps.renderFilter}. */
14
+ renderFilter: ((props: PivotMenuRenderProps) => React.ReactNode) | null | undefined;
15
+ }
16
+ export declare const PivotFieldsContext: React.Context<PivotFieldsContextValue | null>;
17
+ export declare const usePivotFieldsContext: () => PivotFieldsContextValue;
18
+ /** The droppable that is the field list: a chip dropped on it comes off the table. */
19
+ export declare const LIST_ID = "pivot-list";
20
+ /** The droppable that is the whole drag context: a drop on it, between the areas, does nothing. */
21
+ export declare const ROOT_ID = "pivot-root";
22
+ /** An area's droppable: a drop on its empty space goes after its last chip. */
23
+ export declare const areaId: (area: PivotFieldsModel.Area) => string;
24
+ /** A chip's id, unique across the areas. */
25
+ export declare const chipId: (area: PivotFieldsModel.Area, chip: PivotFieldsModel.Chip) => string;
26
+ /** A list row's id. */
27
+ export declare const rowId: (field: string) => string;
28
+ /** What a draggable carries, and what a chip carries as a drop target. */
29
+ export interface PivotDragData {
30
+ item: PivotFieldsModel.Draggable;
31
+ /** The area it is in; `null` for a row of the list. */
32
+ area: PivotFieldsModel.Area | null;
33
+ /** Its place in its area. */
34
+ index?: number;
35
+ }
36
+ /** What an area or the list carries as a drop target. */
37
+ export interface PivotDropData {
38
+ area?: PivotFieldsModel.Area;
39
+ list?: boolean;
40
+ }
41
+ //# sourceMappingURL=_PivotFieldsContext.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { ICellRanges, IWorksheet } from '@sheetxl/sdk';
2
+ import { CommandContext } from '../frame';
3
+ /** The name `add` gives a new table: one past the highest `PivotTableN` in the workbook. */
4
+ export declare const nextPivotName: (sheet: IWorksheet) => string;
5
+ /** The sheet a new table at `location` goes on: `location`'s, or `sheet` while there is none. */
6
+ export declare const pivotSheetOf: (sheet: IWorksheet, location: ICellRanges | null) => IWorksheet;
7
+ /**
8
+ * What the New PivotTable dialog checks as it is filled in, before `add` would refuse: the name, as
9
+ * a table's on the sheet it goes on, and that nothing is in the empty table's cells.
10
+ */
11
+ export declare const pivotTableTargetOf: (sheet: IWorksheet) => CommandContext.PivotTableTarget;
12
+ //# sourceMappingURL=_pivotNew.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { RangeCoords } from '@sheetxl/utils';
2
+ import { IPivotTable, IWorksheet } from '@sheetxl/sdk';
3
+ /** A table's regions: its body, then the page fields above it when it has any. */
4
+ export declare const pivotRegions: (pivot: IPivotTable) => RangeCoords[];
5
+ /** The smallest range holding all of a table's regions. */
6
+ export declare const pivotBounds: (pivot: IPivotTable) => RangeCoords;
7
+ /**
8
+ * The pivot table `range` lies entirely within, in its body or in its page fields, as Excel's
9
+ * PivotTable tab opens for either. Tables per sheet are few, so the scan is cheap.
10
+ */
11
+ export declare const pivotOfRange: (sheet: IWorksheet, range: RangeCoords) => IPivotTable | null;
12
+ /** The pivot table the selection's active cell is in, in its body or its page fields. */
13
+ export declare const pivotOfActiveCell: (sheet: IWorksheet) => IPivotTable | null;
14
+ //# sourceMappingURL=_pivotRegion.d.ts.map
@@ -0,0 +1,9 @@
1
+ export * from './PivotFieldsModel';
2
+ export * from './usePivotFields';
3
+ export * from './PivotFields';
4
+ export * from './PivotFieldList';
5
+ export * from './PivotAreas';
6
+ export * from './PivotChip';
7
+ export { PIVOT_VALUE_SETTINGS_WINDOW, type PivotChipMenuItem, type PivotChipMenuRenderProps } from './PivotChipMenu';
8
+ export * from './PivotTablePane';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { IPivotTable } from '@sheetxl/sdk';
2
+ import { PivotFieldsModel } from './PivotFieldsModel';
3
+ /** What {@link usePivotFields} returns for a table. */
4
+ export interface PivotFieldsState {
5
+ /** The gestures. */
6
+ model: PivotFieldsModel;
7
+ /** The table as the field list shows it now; a new object after each change. */
8
+ snapshot: PivotFieldsModel.Snapshot;
9
+ }
10
+ /**
11
+ * A {@link PivotFieldsModel} over `pivot` and its current snapshot. The component re-renders on every
12
+ * change to the table, its own or one made by script, undo or another view.
13
+ *
14
+ * @returns `null` while `pivot` is `null`.
15
+ */
16
+ export declare function usePivotFields(pivot: IPivotTable | null): PivotFieldsState | null;
17
+ //# sourceMappingURL=usePivotFields.d.ts.map
@@ -1,13 +1,14 @@
1
1
  import { IWorksheet, ICell, IMovable } from '@sheetxl/sdk';
2
2
  import { ViewportMetrics, ScrollPaneProps, Viewport, ThemeMode, LoadingPanelProps, ErrorPanelProps, RenderSlotFn } from '@sheetxl/utils-react';
3
3
  import { GridSurfaceProps, IGridSurface, IEditable, LayerNode } from '@sheetxl/grid-react';
4
- import { CellTextRendererProps, ColumnButtonConfigProps, OutlineProps } from '../cell';
4
+ import { CellTextRendererProps, ColumnButtonConfigProps, PivotButtonConfigProps, OutlineProps } from '../cell';
5
5
  import { MovableElementProps } from '../movable';
6
6
  import { CommentCardRenderProps } from '../comment';
7
7
  import { HyperlinkCardRenderProps, HyperlinkLayerProps } from '../layer/HyperlinkLayer';
8
8
  import { CellErrorTip } from '../layer/CellErrorLayer';
9
9
  import { ValidationPromptRenderProps, ValidationAlertRenderProps } from '../layer/ValidationPromptLayer';
10
10
  import { TableToolbarRenderProps } from '../layer/TableToolbar';
11
+ import { PivotToolbarRenderProps } from '../layer/PivotToolbar';
11
12
  import { CommandContext } from '../frame';
12
13
  import { ISheetHeaderElement, SheetHeaderProps } from './ISheetHeaderElement';
13
14
  export interface SheetLocation {
@@ -194,6 +195,13 @@ export interface WorksheetElementProps extends React.HTMLAttributes<HTMLDivEleme
194
195
  * @param props - {@link TableToolbarRenderProps}
195
196
  */
196
197
  renderTableToolbar?: RenderSlotFn<TableToolbarRenderProps> | null;
198
+ /**
199
+ * Renders the toolbar that floats at a hovered pivot table's top-right corner: a quick action and a
200
+ * dropdown of the pivot table's commands. Omit for the plain default split button; `null` for none.
201
+ *
202
+ * @param props - {@link PivotToolbarRenderProps}
203
+ */
204
+ renderPivotToolbar?: RenderSlotFn<PivotToolbarRenderProps> | null;
197
205
  /**
198
206
  * Render element(s) directly onto the `GridSurface`, bottom → top — the same {@link LayerNode} the
199
207
  * grid takes for its children (a node or an array of them). Each layer reads its pane from context
@@ -214,7 +222,7 @@ export interface WorksheetElementProps extends React.HTMLAttributes<HTMLDivEleme
214
222
  * This is used to customize columnButton popup action and any other customizations desired.
215
223
  * This does not invalidate the rendering
216
224
  */
217
- propsCellRender?: Partial<CellTextRendererProps> & ColumnButtonConfigProps;
225
+ propsCellRender?: Partial<CellTextRendererProps> & ColumnButtonConfigProps & PivotButtonConfigProps;
218
226
  /**
219
227
  * Props for the outline: the gutters that show row and column groups, and their level buttons.
220
228
  *
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { UndoManager } from '@sheetxl/utils';
3
- import { IWorkbook, IWorkbookIO, IMovable, ITable } from '@sheetxl/sdk';
3
+ import { IWorkbook, IWorkbookIO, IMovable, ITable, IPivotTable } from '@sheetxl/sdk';
4
4
  import { LoadingPanelProps, ErrorPanelProps, RenderFloatPanel, FloatPanelProps, FloatReference, RenderSlotFn, ThemeMode, Command } from '@sheetxl/utils-react';
5
5
  import { WorksheetElementProps, IWorksheetElement, OpaqueSheetElementProps } from '../sheet';
6
6
  import { SheetEditable } from '../editor';
@@ -64,6 +64,11 @@ export interface ColumnMenuRenderProps extends WorkbookMenuRenderProps {
64
64
  /** The table column whose button was pressed. */
65
65
  column: ITable.IColumn;
66
66
  }
67
+ /** What {@link WorkbookElementProps.renderPivotMenu} is handed. */
68
+ export interface PivotMenuRenderProps extends WorkbookMenuRenderProps {
69
+ /** The fields of the pivot table's button that was pressed: one, or a compact header's row or column fields. */
70
+ fields: readonly IPivotTable.IField[];
71
+ }
67
72
  /** What {@link WorkbookElementProps.renderMovableMenu} is handed. */
68
73
  export interface MovableMenuRenderProps extends WorkbookMenuRenderProps {
69
74
  movable: IMovable;
@@ -181,6 +186,11 @@ export interface WorkbookElementProps extends Omit<React.HTMLAttributes<HTMLDivE
181
186
  * Render the filter menu of a table column's button. The default renders none.
182
187
  */
183
188
  renderColumnMenu?: RenderSlotFn<ColumnMenuRenderProps> | null;
189
+ /**
190
+ * Render the menu of a pivot table's field button: its items to show or hide, or a page field's
191
+ * item to choose. The default renders none.
192
+ */
193
+ renderPivotMenu?: RenderSlotFn<PivotMenuRenderProps> | null;
184
194
  /**
185
195
  * Render the context menu of a chart, shape or other movable. The default renders none.
186
196
  */