pivotkit-react 0.0.0-stage → 0.2.0

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 (89) hide show
  1. package/CHANGELOG.md +442 -0
  2. package/LICENSE +21 -0
  3. package/README.md +77 -2
  4. package/dist/chunks/chunk-53ZMK4BH.js +177 -0
  5. package/dist/chunks/chunk-F6MVUAQD.js +741 -0
  6. package/dist/chunks/chunk-LQCWFJBS.js +310 -0
  7. package/dist/chunks/chunk-OYY4BKIL.js +93 -0
  8. package/dist/chunks/chunk-QBD4FOBB.js +254 -0
  9. package/dist/chunks/chunk-X7H7BAVT.js +1752 -0
  10. package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
  11. package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
  12. package/dist/echarts.js +347 -0
  13. package/dist/index.js +3482 -0
  14. package/dist/labels.js +21 -0
  15. package/dist/menu-texts-de.js +6 -0
  16. package/dist/menus.js +1681 -0
  17. package/dist/styles.css +2529 -0
  18. package/package.json +70 -4
  19. package/types/PivotReport.d.ts +20 -0
  20. package/types/all-labels.d.ts +5 -0
  21. package/types/chart-decorate.d.ts +16 -0
  22. package/types/chart-layout.d.ts +111 -0
  23. package/types/chart-options.d.ts +23 -0
  24. package/types/chart-summary.d.ts +12 -0
  25. package/types/chart-tooltip.d.ts +38 -0
  26. package/types/chart-types.d.ts +61 -0
  27. package/types/chart.d.ts +39 -0
  28. package/types/chip-menus.d.ts +32 -0
  29. package/types/clear-input.d.ts +20 -0
  30. package/types/dnd-moves.d.ts +45 -0
  31. package/types/dnd.d.ts +101 -0
  32. package/types/dom.d.ts +52 -0
  33. package/types/drill-export.d.ts +42 -0
  34. package/types/drill-panel.d.ts +22 -0
  35. package/types/drill-table.d.ts +71 -0
  36. package/types/drill.d.ts +26 -0
  37. package/types/echarts.d.ts +4 -0
  38. package/types/export-run.d.ts +59 -0
  39. package/types/field-info.d.ts +34 -0
  40. package/types/fields.d.ts +32 -0
  41. package/types/files.d.ts +27 -0
  42. package/types/filter.d.ts +21 -0
  43. package/types/help.d.ts +21 -0
  44. package/types/icons.d.ts +80 -0
  45. package/types/index.d.ts +536 -0
  46. package/types/info.d.ts +34 -0
  47. package/types/iso.d.ts +2 -0
  48. package/types/labels.d.ts +663 -0
  49. package/types/lazy-menus.d.ts +28 -0
  50. package/types/menu-labels-de.d.ts +2 -0
  51. package/types/menu-labels.d.ts +317 -0
  52. package/types/menu-ops.d.ts +145 -0
  53. package/types/menu-texts.d.ts +2 -0
  54. package/types/menus.d.ts +7 -0
  55. package/types/names.d.ts +80 -0
  56. package/types/numbers.d.ts +13 -0
  57. package/types/overflow.d.ts +62 -0
  58. package/types/place.d.ts +43 -0
  59. package/types/popover.d.ts +93 -0
  60. package/types/rove.d.ts +20 -0
  61. package/types/section.d.ts +25 -0
  62. package/types/sections.d.ts +2 -0
  63. package/types/share-actions.d.ts +99 -0
  64. package/types/share.d.ts +114 -0
  65. package/types/skeleton.d.ts +9 -0
  66. package/types/storage.d.ts +24 -0
  67. package/types/table.d.ts +29 -0
  68. package/types/templates.d.ts +46 -0
  69. package/types/theme.d.ts +24 -0
  70. package/types/tip-list.d.ts +20 -0
  71. package/types/tips.d.ts +300 -0
  72. package/types/toasts.d.ts +26 -0
  73. package/types/toolbar-panels.d.ts +93 -0
  74. package/types/toolbar.d.ts +5 -0
  75. package/types/unused-load.d.ts +23 -0
  76. package/types/unused-texts-de.d.ts +2 -0
  77. package/types/unused-texts.d.ts +130 -0
  78. package/types/unused.d.ts +22 -0
  79. package/types/use-big-result.d.ts +29 -0
  80. package/types/use-export.d.ts +7 -0
  81. package/types/use-theme.d.ts +11 -0
  82. package/types/use-view-history.d.ts +37 -0
  83. package/types/version.d.ts +2 -0
  84. package/types/view-history.d.ts +106 -0
  85. package/types/view-ops.d.ts +293 -0
  86. package/types/view-save.d.ts +76 -0
  87. package/types/view-store.d.ts +59 -0
  88. package/types/virtual.d.ts +44 -0
  89. package/types/zones.d.ts +42 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The identity of a data set's columns: names and types.
3
+ * @param {import("pivotkit-core").Encoded} encoded
4
+ */
5
+ export declare function schemaKeyOf(encoded: import("pivotkit-core").Encoded): string;
6
+ /**
7
+ * @param {{ encoded: import("pivotkit-core").Encoded, view: object | undefined, defaultView: object | undefined,
8
+ * onViewChange?: (view: import("pivotkit-core").View) => void, limits: object | undefined, outsideNote: string,
9
+ * orderOf?: (field: string) => unknown[] | undefined }} options `orderOf`: the host's custom order of a
10
+ * field (fieldDefaults.order), applied to every view shown (withHostOrders); keep it stable
11
+ * @returns {{ view: import("pivotkit-core").View, viewKey: string, tag: any, setTag: (tag: any) => void, commit: (next: object, note: string, tag?: any) => boolean,
12
+ * undo: () => string | null, redo: () => string | null, reset: (note: string) => void,
13
+ * restore: (view: object, tag?: any) => void, keyOf: (view: object) => string, canUndo: boolean, canRedo: boolean, canReset: boolean }}
14
+ */
15
+ export declare function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outsideNote, orderOf }: {
16
+ encoded: import("pivotkit-core").Encoded;
17
+ view: object | undefined;
18
+ defaultView: object | undefined;
19
+ onViewChange?: (view: import("pivotkit-core").View) => void;
20
+ limits: object | undefined;
21
+ outsideNote: string;
22
+ orderOf?: (field: string) => unknown[] | undefined;
23
+ }): {
24
+ view: import("pivotkit-core").View;
25
+ viewKey: string;
26
+ tag: any;
27
+ setTag: (tag: any) => void;
28
+ commit: (next: object, note: string, tag?: any) => boolean;
29
+ undo: () => string | null;
30
+ redo: () => string | null;
31
+ reset: (note: string) => void;
32
+ restore: (view: object, tag?: any) => void;
33
+ keyOf: (view: object) => string;
34
+ canUndo: boolean;
35
+ canRedo: boolean;
36
+ canReset: boolean;
37
+ };
@@ -0,0 +1,2 @@
1
+ /** @type {string} */
2
+ export declare const VERSION: string;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * The saved view a step's tag names, for the data shown now: none when it was loaded for another
3
+ * source (one with the same columns keeps the history, not the name).
4
+ * @param {any} tag
5
+ * @param {string | undefined} sourceId
6
+ */
7
+ export declare const tagFor: (tag: any, sourceId: string | undefined) => any;
8
+ /** Steps kept for undo. */
9
+ export declare const HISTORY_LIMIT = 100;
10
+ export type HistoryState = {
11
+ /**
12
+ * the schema the views were normalized against
13
+ */
14
+ schema: string;
15
+ /**
16
+ * the start view, the target of reset
17
+ */
18
+ start: string;
19
+ /**
20
+ * the view the history is at
21
+ */
22
+ present: string;
23
+ /**
24
+ * older views, each with the note of the step that left it
25
+ */
26
+ past: Array<{
27
+ view: string;
28
+ note: string;
29
+ tag: any;
30
+ }>;
31
+ /**
32
+ * views undone, newest undo last
33
+ */
34
+ future: Array<{
35
+ view: string;
36
+ note: string;
37
+ tag: any;
38
+ }>;
39
+ /**
40
+ * the saved view `present` is (an object), or null
41
+ */
42
+ tag: any;
43
+ };
44
+ /**
45
+ * @typedef {object} HistoryState
46
+ * @property {string} schema the schema the views were normalized against
47
+ * @property {string} start the start view, the target of reset
48
+ * @property {string} present the view the history is at
49
+ * @property {Array<{ view: string, note: string, tag: any }>} past older views, each with the note of the step that left it
50
+ * @property {Array<{ view: string, note: string, tag: any }>} future views undone, newest undo last
51
+ * @property {any} tag the saved view `present` is (an object), or null
52
+ */
53
+ /**
54
+ * @param {string} schema
55
+ * @param {string} start JSON of the start view
56
+ * @param {string} [current] JSON of the view shown now, default the start
57
+ * @param {any} [tag] the saved view it is
58
+ * @returns {HistoryState}
59
+ */
60
+ export declare function createState(schema: string, start: string, current?: string, tag?: any): HistoryState;
61
+ /**
62
+ * The state a step works on: a new history when the schema changed, and the view the report shows
63
+ * recorded first when it differs from the history (a controlled host passed another view).
64
+ * @param {HistoryState} state
65
+ * @param {{ schema: string, start: string, shown: string, outside: string }} at
66
+ */
67
+ export declare function settle(state: HistoryState, at: {
68
+ schema: string;
69
+ start: string;
70
+ shown: string;
71
+ outside: string;
72
+ }): HistoryState;
73
+ /**
74
+ * A new step; an unchanged view is none (only its tag changes, when another is given). Clears the
75
+ * steps that were undone.
76
+ * @param {HistoryState} state
77
+ * @param {string} view JSON
78
+ * @param {string} note
79
+ * @param {any} [tag] the saved view the step shows; default the tag of the view before
80
+ * @returns {HistoryState}
81
+ */
82
+ export declare function record(state: HistoryState, view: string, note: string, tag?: any): HistoryState;
83
+ /**
84
+ * One step back; `note` says what was undone (null when there was nothing to undo).
85
+ * @param {HistoryState} state
86
+ * @returns {{ state: HistoryState, note: string | null }}
87
+ */
88
+ export declare function undo(state: HistoryState): {
89
+ state: HistoryState;
90
+ note: string | null;
91
+ };
92
+ /**
93
+ * One undone step again.
94
+ * @param {HistoryState} state
95
+ * @returns {{ state: HistoryState, note: string | null }}
96
+ */
97
+ export declare function redo(state: HistoryState): {
98
+ state: HistoryState;
99
+ note: string | null;
100
+ };
101
+ /**
102
+ * Back to the start view, as one step that can be undone; the start is no saved view (tag null).
103
+ * @param {HistoryState} state
104
+ * @param {string} note
105
+ */
106
+ export declare function reset(state: HistoryState, note: string): HistoryState;
@@ -0,0 +1,293 @@
1
+ export type Zone = "rows" | "cols" | "values" | "filters";
2
+ /** @typedef {"rows" | "cols" | "values" | "filters"} Zone */
3
+ export declare const ZONES: readonly Zone[];
4
+ export declare const clone: (view: any) => any;
5
+ export declare const same: (a: any, b: any) => boolean;
6
+ /** The fields shown in the Filters zone: filtered fields that are on no axis, once each. */
7
+ export declare function filterZoneFields(view: any): any[];
8
+ /** The axis a field is on, or null. */
9
+ export declare function axisOf(view: any, field: any): "cols" | "rows" | null;
10
+ /**
11
+ * The aggregator a new value of a field gets: the host's choice for the field when it fits the type
12
+ * (fieldDefaults), else sum for numbers and count for anything else.
13
+ * @param {string | undefined} type
14
+ * @param {string} [wanted]
15
+ */
16
+ export declare function defaultAgg(type: string | undefined, wanted?: string): string;
17
+ export type AddOptions = {
18
+ /**
19
+ * position in the zone, default the end
20
+ */
21
+ index?: number;
22
+ /**
23
+ * the field's column type, for the aggregator
24
+ */
25
+ type?: string;
26
+ /**
27
+ * the host's settings for
28
+ * the field: a new value's aggregator and format, the custom order of its items on an axis
29
+ */
30
+ defaults?: {
31
+ agg?: string;
32
+ format?: string;
33
+ order?: unknown[];
34
+ };
35
+ /**
36
+ * a date grouping to place instead of the raw date (rows, columns, filters)
37
+ */
38
+ dateUnit?: string | null;
39
+ /**
40
+ * the name of that grouping's derived field
41
+ */
42
+ groupName?: string;
43
+ };
44
+ /**
45
+ * @typedef {object} AddOptions
46
+ * @property {number} [index] position in the zone, default the end
47
+ * @property {string} [type] the field's column type, for the aggregator
48
+ * @property {{ agg?: string, format?: string, order?: unknown[] }} [defaults] the host's settings for
49
+ * the field: a new value's aggregator and format, the custom order of its items on an axis
50
+ * @property {string | null} [dateUnit] a date grouping to place instead of the raw date (rows, columns, filters)
51
+ * @property {string} [groupName] the name of that grouping's derived field
52
+ */
53
+ /**
54
+ * The first zone of a view with more entries than pivotkit-core keeps (Rows and Columns:
55
+ * `limits.axisFields`, Values: `limits.values`), with that maximum; null when every zone fits.
56
+ * normalize() would drop the rest without a word, so the UI refuses such a step or says what it left
57
+ * out.
58
+ * @param {any} view
59
+ * @param {Partial<import("pivotkit-core").Limits> | undefined} limits the host's, over LIMITS
60
+ * @returns {{ zone: "rows" | "cols" | "values", max: number } | null}
61
+ */
62
+ export declare function zoneOverLimit(view: any, limits: Partial<import("pivotkit-core").Limits> | undefined): {
63
+ zone: "rows" | "cols" | "values";
64
+ max: number;
65
+ } | null;
66
+ /**
67
+ * Places a field in a zone at an index (default the end). On an axis the field leaves the other axis
68
+ * (a field is on one axis only); in Values it is added as a new value, so a field can be summed and
69
+ * averaged at once; in Filters it gets an empty filter unless it has one. With `dateUnit` a date is
70
+ * placed grouped (by month, say), as its derived field.
71
+ * @param {any} view
72
+ * @param {string} field
73
+ * @param {Zone} zone
74
+ * @param {AddOptions} [options]
75
+ */
76
+ export declare function addField(view: any, field: string, zone: Zone, options?: AddOptions): any;
77
+ /**
78
+ * Removes the entry at `index` of a zone. A field leaving an axis or the Filters zone takes its
79
+ * filters and its sort with it, as in Excel; a value leaves only that value.
80
+ */
81
+ export declare function removeAt(view: any, zone: any, index: any): any;
82
+ /** The field name of the entry at `index` of a zone. */
83
+ export declare function fieldAt(view: any, zone: any, index: any): any;
84
+ /**
85
+ * Moves an entry from one zone to another (or within one zone) to an index of the target zone. A value
86
+ * moved to an axis or Filters places its field there; an axis field moved to Values adds a value and
87
+ * leaves the axis.
88
+ */
89
+ /**
90
+ * @param {any} view
91
+ * @param {Zone} from
92
+ * @param {number} fromIndex
93
+ * @param {Zone} to
94
+ * @param {number | undefined} toIndex
95
+ * @param {AddOptions} [options]
96
+ */
97
+ export declare function moveField(view: any, from: Zone, fromIndex: number, to: Zone, toIndex: number | undefined, options?: AddOptions): any;
98
+ /** Moves an entry within a zone. */
99
+ export declare function reorder(view: any, zone: any, from: any, to: any): any;
100
+ /**
101
+ * The smallest and the largest number of a number column, for the range form; null without numbers.
102
+ * @param {import("pivotkit-core").Encoded} encoded
103
+ * @param {string} field
104
+ * @returns {{ min: number, max: number } | null}
105
+ */
106
+ export declare function numberRange(encoded: import("pivotkit-core").Encoded, field: string): {
107
+ min: number;
108
+ max: number;
109
+ } | null;
110
+ /**
111
+ * The derived field a grouping makes of a field on an axis: replaces it in place. `unit` null removes
112
+ * the grouping (back to the source field). Returns the view and the new field's name.
113
+ * @param {any} view
114
+ * @param {string} field the field on the axis (a source field or a derived one)
115
+ * @param {string | null} unit a DERIVED unit of pivotkit-core ("year", "month", "bin", ...)
116
+ * @param {{ size?: number, origin?: number, name?: string }} [options] bins: size and origin (the
117
+ * start of the ranges; without one a range field keeps its own, else 0); name: the derived field's name
118
+ */
119
+ export declare function groupField(view: any, field: string, unit: string | null, options?: {
120
+ size?: number;
121
+ origin?: number;
122
+ name?: string;
123
+ }): {
124
+ view: any;
125
+ field: any;
126
+ };
127
+ /** The grouping of a field: its derived spec, or null for a plain field. */
128
+ export declare function groupingOf(view: any, field: any): any;
129
+ /** The source field of a field: itself, or the field a derived field groups. */
130
+ export declare function sourceOf(view: any, field: any): any;
131
+ /**
132
+ * Sort of a field: { by: "label" | "value" | "custom", order, value?, items? }; null removes the field's sort entry
133
+ * (natural label order).
134
+ */
135
+ export declare function setSort(view: any, field: any, sort: any): any;
136
+ /**
137
+ * The view with the host's custom order (fieldDefaults.order) for every field on Rows or Columns that
138
+ * has no sort entry: a saved or default view sorts such a field as placing it in the UI does
139
+ * (addField). A field with an entry keeps it, "A to Z" included; a grouping has items of its own.
140
+ * Returns the same view when there is nothing to add.
141
+ * @param {any} view normalized
142
+ * @param {(field: string) => unknown[] | undefined} orderOf the host's order of a source field
143
+ */
144
+ export declare function withHostOrders(view: any, orderOf: (field: string) => unknown[] | undefined): any;
145
+ /** The sort entry of a field, or null. */
146
+ export declare function sortOf(view: any, field: any): any;
147
+ /**
148
+ * The entry setSort writes for a sort the user chose: A to Z is the default without an entry, except
149
+ * for a field with the host's order, which keeps it as an entry, or the host's order would come back
150
+ * (withHostOrders).
151
+ * @param {{ by: string, order: string }} spec
152
+ * @param {boolean} [hostOrdered] the field has the host's order (fieldDefaults.order)
153
+ */
154
+ export declare function sortEntry(spec: {
155
+ by: string;
156
+ order: string;
157
+ }, hostOrdered?: boolean): {
158
+ by: string;
159
+ order: string;
160
+ } | null;
161
+ /**
162
+ * What a click on a header of the table sorts: a row field's name sorts that field by label; a value's
163
+ * name sorts the innermost row field by that value. Only a value's header that stands for the whole
164
+ * row does (its column path is empty: the one value header over all columns, the values without
165
+ * column fields, the grand total column), and only a value that gives a number (numericResult). Null
166
+ * for every other header.
167
+ * @param {any} view
168
+ * @param {{ kind: string, field?: string, valueIndex?: number, colPath?: any[] }} cell a header cell of the grid
169
+ * @param {(field: string) => string | undefined} typeOf the column type of a field
170
+ * @returns {{ field: string, ref?: { field: string | null, agg: string } } | null}
171
+ */
172
+ export declare function headerSortTarget(view: any, cell: {
173
+ kind: string;
174
+ field?: string;
175
+ valueIndex?: number;
176
+ colPath?: any[];
177
+ }, typeOf: (field: string) => string | undefined): {
178
+ field: string;
179
+ ref?: {
180
+ field: string | null;
181
+ agg: string;
182
+ };
183
+ } | null;
184
+ /**
185
+ * The sort a header shows (aria-sort): "ascending", "descending", "other" (a custom order), or null
186
+ * when the rows are not in its order; `chosen` when a sort entry of the view puts them in it (the
187
+ * default A to Z of a field without an entry is not chosen).
188
+ * @param {any} view
189
+ * @param {{ field: string, ref?: { field: string | null, agg: string } }} target headerSortTarget's
190
+ * @returns {{ order: "ascending" | "descending" | "other" | null, chosen: boolean }}
191
+ */
192
+ export declare function headerSortState(view: any, target: {
193
+ field: string;
194
+ ref?: {
195
+ field: string | null;
196
+ agg: string;
197
+ };
198
+ }): {
199
+ order: "ascending" | "descending" | "other" | null;
200
+ chosen: boolean;
201
+ };
202
+ /**
203
+ * The field's sort entry after a click on a header (setSort's argument): a value's header goes from
204
+ * largest first to smallest first to no sort by it (the field's default order); a row field's name
205
+ * from A to Z to Z to A and back, and to A to Z from a sort by a value or a custom order.
206
+ * @param {any} view
207
+ * @param {{ field: string, ref?: { field: string | null, agg: string } }} target headerSortTarget's
208
+ * @param {boolean} [hostOrdered] the field has the host's order (fieldDefaults.order)
209
+ */
210
+ export declare function nextHeaderSort(view: any, target: {
211
+ field: string;
212
+ ref?: {
213
+ field: string | null;
214
+ agg: string;
215
+ };
216
+ }, hostOrdered?: boolean): {
217
+ by: string;
218
+ order: string;
219
+ } | {
220
+ by: string;
221
+ order: string;
222
+ value: any;
223
+ } | null;
224
+ /** Filters of one type of a field. */
225
+ export declare function filtersOf(view: any, field: any, types: any): any;
226
+ /** The values an item filter lets through, from the field's values; all of them without a filter. */
227
+ export declare function selectedItems(view: any, field: any, all: any): any;
228
+ /**
229
+ * True when a value gives a number for each cell, so it can be shown as a share, formatted, highlighted,
230
+ * sorted by and filtered by: not a list of distinct values, not the first or last entry of a text,
231
+ * not an average, median, minimum or maximum of dates.
232
+ * @param {{ agg: string }} spec
233
+ * @param {string} type the column type of the value's field ("number" for a row count)
234
+ */
235
+ export declare function numericResult(spec: {
236
+ agg: string;
237
+ }, type: string): boolean;
238
+ /** True when two value references ({ field, agg }) name the same measure. */
239
+ export declare function sameRef(a: any, b: any): boolean;
240
+ /** True when a field has a filter that removes something. */
241
+ export declare function isFiltered(view: any, field: any): any;
242
+ /** Collapses or expands one group of an axis. */
243
+ export declare function toggleCollapsed(view: any, axis: any, path: any): any;
244
+ /**
245
+ * What "Expand all" and "Collapse all" would do for the rows: each is offered only when it changes
246
+ * something. `outer` are the groups that can collapse (every level but the last, from the pivot's
247
+ * tree); `why` names the reason when one of them would change nothing.
248
+ * @param {any} view
249
+ * @param {Array<Array<unknown>>} outer
250
+ * @returns {{ canExpand: boolean, canCollapse: boolean, collapsed: number, open: number, why: { expand: string | null, collapse: string | null } }}
251
+ */
252
+ export declare function rowFolding(view: any, outer: Array<Array<unknown>>): {
253
+ canExpand: boolean;
254
+ canCollapse: boolean;
255
+ collapsed: number;
256
+ open: number;
257
+ why: {
258
+ expand: string | null;
259
+ collapse: string | null;
260
+ };
261
+ };
262
+ /**
263
+ * Collapses every group of the outer levels of an axis (paths from the pivot's tree), or expands all.
264
+ * @param {any} view
265
+ * @param {"rows" | "cols"} axis
266
+ * @param {Array<Array<unknown>> | null} paths the paths to collapse; null expands everything
267
+ */
268
+ export declare function setCollapsed(view: any, axis: "rows" | "cols", paths: Array<Array<unknown>> | null): any;
269
+ /** Turns one of the totals on or off. */
270
+ export declare function setTotal(view: any, key: any, on: any): any;
271
+ /** Table or chart. */
272
+ export declare function setDisplay(view: any, display: any): any;
273
+ /** Switches to the chart with a picker entry's settings (chart-types.js); its display settings stay. */
274
+ export declare function setChart(view: any, name: any): any;
275
+ /**
276
+ * Changes how the chart is drawn: { valueLabels, legend, title, smooth } (pivotkit-core's chart
277
+ * settings); the chart type stays.
278
+ * @param {any} view
279
+ * @param {{ valueLabels?: string, legend?: string, title?: string | null, smooth?: boolean }} patch
280
+ */
281
+ export declare function setChartDisplay(view: any, patch: {
282
+ valueLabels?: string;
283
+ legend?: string;
284
+ title?: string | null;
285
+ smooth?: boolean;
286
+ }): any;
287
+ /**
288
+ * Swaps the fields of Rows and Columns, with their collapsed groups; a calculation along an axis
289
+ * ("running total along Rows") goes along the other one, so it still runs along the same fields.
290
+ */
291
+ export declare function swapAxes(view: any): any;
292
+ /** True when nothing is placed: the UI shows its first steps. */
293
+ export declare function isEmptyView(view: any): boolean;
@@ -0,0 +1,76 @@
1
+ export type LoadedView = {
2
+ name: string;
3
+ scope: "user" | "shared" | null;
4
+ store: boolean;
5
+ storeSource?: string | null;
6
+ };
7
+ export type SaveRights = {
8
+ host: boolean;
9
+ store: boolean;
10
+ publish: boolean;
11
+ sourceId?: string;
12
+ };
13
+ export type SaveWrite = {
14
+ kind: "store";
15
+ at?: number;
16
+ storeSource: string | null;
17
+ } | {
18
+ kind: "host";
19
+ } | {
20
+ kind: "publish";
21
+ };
22
+ export type SaveTarget = SaveWrite | {
23
+ kind: null;
24
+ why: "saveSharedLocked" | "saveNotInViews" | "exportNeedsField";
25
+ };
26
+ export type Entry = {
27
+ name: string;
28
+ scope: string;
29
+ at?: number;
30
+ sourceId?: string;
31
+ };
32
+ /**
33
+ * @typedef {{ name: string, scope: "user" | "shared" | null, store: boolean, storeSource?: string | null }} LoadedView
34
+ * the view loaded: its name, its group (null: a file or a link), whether the browser store keeps it
35
+ * and, there, the data it names
36
+ * @typedef {{ host: boolean, store: boolean, publish: boolean, sourceId?: string }} SaveRights
37
+ * onSaveTemplate is set, the browser store is on, the user may publish (canPublish with
38
+ * onPublishTemplate); the data shown
39
+ * @typedef {{ kind: "store", at?: number, storeSource: string | null } | { kind: "host" } | { kind: "publish" }} SaveWrite
40
+ * where a save goes; `at`: the browser store's view it writes over (none: a view added)
41
+ * @typedef {SaveWrite | { kind: null, why: "saveSharedLocked" | "saveNotInViews" | "exportNeedsField" }} SaveTarget
42
+ * `why`: the label that says why Save is off
43
+ * @typedef {{ name: string, scope: string, at?: number, sourceId?: string }} Entry an entry of the Views menu
44
+ */
45
+ /** Whether Save as can write anywhere. @param {SaveRights} can */
46
+ export declare const canSaveAs: (can: SaveRights) => boolean;
47
+ /**
48
+ * Whether an entry of the Views menu is the view loaded: its name, its group, and for the browser
49
+ * store the data it names.
50
+ * @param {Entry} t
51
+ * @param {LoadedView | null | undefined} loaded
52
+ */
53
+ export declare const isLoadedEntry: (t: Entry, loaded: LoadedView | null | undefined) => boolean;
54
+ /**
55
+ * Where Save writes the loaded view, or why it is off; null when there is no Save to offer (nothing
56
+ * loaded, or no way to save at all).
57
+ * @param {LoadedView | null} loaded
58
+ * @param {ReadonlyArray<Entry>} entries the Views menu's entries
59
+ * @param {SaveRights} can
60
+ * @param {boolean} [empty] the report has no field placed
61
+ * @returns {SaveTarget | null}
62
+ */
63
+ export declare function saveTarget(loaded: LoadedView | null, entries: ReadonlyArray<Entry>, can: SaveRights, empty?: boolean): SaveTarget | null;
64
+ /**
65
+ * Where Save as writes a view named `name`, and the user's view it would replace (null: none, so
66
+ * nothing to ask): the host's own view of that name when the host takes the saves, else the browser
67
+ * store's for this data (or saved without named data).
68
+ * @template {Entry} T
69
+ * @param {string} name
70
+ * @param {ReadonlyArray<T>} entries
71
+ * @param {SaveRights} can
72
+ * @returns {SaveWrite & { replaces: T | null }}
73
+ */
74
+ export declare function saveAsTarget<T extends Entry>(name: string, entries: ReadonlyArray<T>, can: SaveRights): SaveWrite & {
75
+ replaces: T | null;
76
+ };
@@ -0,0 +1,59 @@
1
+ /** The most the browser store keeps per storageKey: views, and characters of their JSON. */
2
+ export declare const VIEW_STORE_LIMITS: Readonly<{
3
+ count: 100;
4
+ text: 500000;
5
+ }>;
6
+ /**
7
+ * The browser store's views from its text, those for the data shown: made for `sourceId` or for no
8
+ * named data.
9
+ * @param {string | null} raw
10
+ * @param {string | undefined} sourceId
11
+ * `sourceId` of an entry: the data it names (none for a view saved without), which tells two views
12
+ * of the same name apart (one for no named data, one for this data).
13
+ * @returns {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string }>}
14
+ */
15
+ export declare function storedViews(raw: string | null, sourceId: string | undefined): Array<{
16
+ name: string;
17
+ view: Record<string, unknown>;
18
+ at: number;
19
+ sourceId?: string;
20
+ }>;
21
+ /**
22
+ * The browser store's text after a change: `name` saved for `sourceId` (replacing a view of the same
23
+ * name for the same data), the view at `replace` written over in its place (Save, and Save as onto a
24
+ * name that exists: its data and its place in the list stay), or the view at `remove` taken out. A
25
+ * delete and a replace check that the view there is still the one named `removeName` or `name`
26
+ * (another tab may have changed the store since the menu was drawn) and throw "changed" when it is
27
+ * not, so the wrong view is never deleted or overwritten. The caps apply to a save
28
+ * only: a store over them (older caps, changed by hand) can always shrink.
29
+ * @param {string | null} raw
30
+ * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string, replace?: number }} change
31
+ * @param {(kind: "count" | "text" | "changed", max: number) => string} message the Error's message
32
+ * @returns {string | null} null when nothing is left
33
+ */
34
+ export declare function changedViews(raw: string | null, change: {
35
+ name?: string;
36
+ view?: object;
37
+ sourceId?: string;
38
+ remove?: number;
39
+ removeName?: string;
40
+ replace?: number;
41
+ }, message: (kind: "count" | "text" | "changed", max: number) => string): string | null;
42
+ /**
43
+ * Saves or deletes a view in the browser store (see changedViews). Throws an Error with the reason in
44
+ * the labels' words when the store would hold too much, changed since the menu was drawn, or the
45
+ * browser refused to keep it.
46
+ * @param {string | null} raw the store's text now
47
+ * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string, replace?: number }} change
48
+ * @param {any} labels with the menus' texts
49
+ * @param {string} locale for the numbers
50
+ * @param {(text: string | null) => boolean} keep writes the text (storage.js: writeItem), false when the browser refused
51
+ */
52
+ export declare function storeViews(raw: string | null, change: {
53
+ name?: string;
54
+ view?: object;
55
+ sourceId?: string;
56
+ remove?: number;
57
+ removeName?: string;
58
+ replace?: number;
59
+ }, labels: any, locale: string, keep: (text: string | null) => boolean): void;
@@ -0,0 +1,44 @@
1
+ /** Body rows from which the table body is virtualized. */
2
+ export declare const VIRTUAL_FROM = 300;
3
+ /**
4
+ * The window of rows to render.
5
+ * @param {{ count: number, scrollTop: number, viewport: number, rowHeight: number, overscan?: number }} p
6
+ * @returns {{ start: number, end: number, padTop: number, padBottom: number }}
7
+ */
8
+ export declare function windowOf({ count, scrollTop, viewport, rowHeight, overscan }: {
9
+ count: number;
10
+ scrollTop: number;
11
+ viewport: number;
12
+ rowHeight: number;
13
+ overscan?: number;
14
+ }): {
15
+ start: number;
16
+ end: number;
17
+ padTop: number;
18
+ padBottom: number;
19
+ };
20
+ /**
21
+ * The cells of the body rows start..end-1 of a grid, with row spans cut to the window.
22
+ * @param {import("pivotkit-core").Grid} grid
23
+ * @param {number} start body row index (0 is the first row after the header)
24
+ * @param {number} end exclusive
25
+ * @returns {Array<{ index: number, cells: Array<{ cell: import("pivotkit-core").GridCell, col: number, rowSpan: number, colSpan: number }> }>}
26
+ */
27
+ export declare function sliceRows(grid: import("pivotkit-core").Grid, start: number, end: number): Array<{
28
+ index: number;
29
+ cells: Array<{
30
+ cell: import("pivotkit-core").GridCell;
31
+ col: number;
32
+ rowSpan: number;
33
+ colSpan: number;
34
+ }>;
35
+ }>;
36
+ /**
37
+ * The whole row label of body row `r`, every level joined with " / " ("Linux / Ubuntu"): in the
38
+ * virtual table a label is cut to one line, and this is how a focused value or a tapped label shows it
39
+ * in full. A level merged down from a row above is read there; the empty rest of a label spanning
40
+ * sideways is skipped.
41
+ * @param {import("pivotkit-core").Grid} grid
42
+ * @param {number} r body row index
43
+ */
44
+ export declare function rowLabelOf(grid: import("pivotkit-core").Grid, r: number): string;
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ /** Chip entries of every zone: id, field, text, type (of the source field: a grouped date stays a date). */
3
+ export declare function zoneEntries(view: any, types: any, labels: any): {
4
+ filters: {
5
+ id: string;
6
+ field: any;
7
+ text: string;
8
+ type: any;
9
+ index: number;
10
+ }[];
11
+ cols: any;
12
+ rows: any;
13
+ values: any;
14
+ };
15
+ /**
16
+ * @param {{ view: any, types: Map<string, string>, labels: import("./labels.js").UiLabels,
17
+ * commit: (view: object, note?: any) => void, openFilter: (field: string, anchor: HTMLElement) => void,
18
+ * encoded: import("pivotkit-core").Encoded, locale: string, onSwap: () => void,
19
+ * id: string, folded: boolean, onShow: () => void, defaultsOf?: (field: string) => import("./index.js").FieldDefaults | undefined,
20
+ * infoOf?: (field: string) => import("./field-info.js").FieldInfo | undefined, explain?: boolean, showInfo?: boolean }} props
21
+ * `explain`: an "i" next to each zone's title that says what the zone does; `showInfo` false: no "i"
22
+ * of a field description on the chips (Options → Help)
23
+ * `folded`: the compact layout's one line; `defaultsOf`: the host's settings for a source field (fieldDefaults);
24
+ * `infoOf`: the host's description of a field (its source field's for a grouping)
25
+ */
26
+ export declare function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwap, id, folded, onShow, defaultsOf, infoOf, explain, showInfo }: {
27
+ view: any;
28
+ types: Map<string, string>;
29
+ labels: import("./labels.js").UiLabels;
30
+ commit: (view: object, note?: any) => void;
31
+ openFilter: (field: string, anchor: HTMLElement) => void;
32
+ encoded: import("pivotkit-core").Encoded;
33
+ locale: string;
34
+ onSwap: () => void;
35
+ id: string;
36
+ folded: boolean;
37
+ onShow: () => void;
38
+ defaultsOf?: (field: string) => import("./index.js").FieldDefaults | undefined;
39
+ infoOf?: (field: string) => import("./field-info.js").FieldInfo | undefined;
40
+ explain?: boolean;
41
+ showInfo?: boolean;
42
+ }): React.JSX.Element;