pivotkit-react 0.2.0 → 0.3.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 (39) hide show
  1. package/CHANGELOG.md +164 -1
  2. package/README.md +1 -1
  3. package/dist/chunks/{chunk-F6MVUAQD.js → chunk-32Z33U6S.js} +23 -0
  4. package/dist/chunks/{chunk-QBD4FOBB.js → chunk-7CC4JHDY.js} +123 -14
  5. package/dist/chunks/{chunk-LQCWFJBS.js → chunk-APB4NW4O.js} +146 -22
  6. package/dist/chunks/{chunk-53ZMK4BH.js → chunk-EM23V5GH.js} +6 -0
  7. package/dist/chunks/{chunk-X7H7BAVT.js → chunk-IOPAM4JD.js} +307 -179
  8. package/dist/chunks/{chunk-OYY4BKIL.js → chunk-RWYHJRQO.js} +6 -0
  9. package/dist/chunks/{unused-texts-YTNJCFFC.js → unused-texts-K3VFH65P.js} +1 -1
  10. package/dist/chunks/{unused-texts-de-SGOHV4N7.js → unused-texts-de-OW4TGIVX.js} +1 -1
  11. package/dist/index.js +58 -56
  12. package/dist/labels.js +5 -5
  13. package/dist/menu-texts-de.js +1 -1
  14. package/dist/menus.js +2429 -670
  15. package/dist/styles.css +557 -117
  16. package/package.json +2 -2
  17. package/types/chip-menus.d.ts +20 -4
  18. package/types/dnd.d.ts +8 -4
  19. package/types/filter-level.d.ts +16 -0
  20. package/types/filter.d.ts +31 -0
  21. package/types/help.d.ts +0 -7
  22. package/types/labels.d.ts +71 -0
  23. package/types/lazy-menus.d.ts +2 -2
  24. package/types/levels.d.ts +105 -0
  25. package/types/menu-fields.d.ts +80 -0
  26. package/types/menu-labels.d.ts +214 -19
  27. package/types/menu-ops.d.ts +150 -9
  28. package/types/menu-topics.d.ts +293 -0
  29. package/types/menus.d.ts +1 -1
  30. package/types/names.d.ts +141 -1
  31. package/types/place.d.ts +44 -0
  32. package/types/section.d.ts +8 -11
  33. package/types/tips.d.ts +1 -36
  34. package/types/toolbar-panels.d.ts +15 -8
  35. package/types/unused-texts.d.ts +6 -0
  36. package/types/use-view-history.d.ts +2 -1
  37. package/types/view-ops.d.ts +12 -0
  38. package/types/zones.d.ts +5 -4
  39. package/types/sections.d.ts +0 -2
@@ -21,6 +21,218 @@ export declare const en: {
21
21
  newReport: string;
22
22
  valuesFilter: string;
23
23
  };
24
+ back: string;
25
+ backTo: string;
26
+ levelTitle: string;
27
+ searchMenu: string;
28
+ searchMenuShort: string;
29
+ searchResults: string;
30
+ searchNothing: string;
31
+ sortByValue: string;
32
+ sortOldestShort: string;
33
+ sortNewestShort: string;
34
+ filterTopic: string;
35
+ filterAll: string;
36
+ groupTopic: string;
37
+ groupNoneShort: string;
38
+ off: string;
39
+ moveToTitle: string;
40
+ topOwn: string;
41
+ binsOff: string;
42
+ valueConditionTitle: string;
43
+ nameHint: string;
44
+ showAsKeywords: string;
45
+ nameKeywords: string;
46
+ filterKeywords: string;
47
+ formatDecimals: {
48
+ one: string;
49
+ other: string;
50
+ };
51
+ listAnd: string;
52
+ summaryAll: string;
53
+ summarySome: string;
54
+ summaryNone: string;
55
+ summaryOk: string;
56
+ summaryKept: string;
57
+ summaryQuickOnly: string;
58
+ summaryPicks: string;
59
+ summaryQuick: string;
60
+ summaryRules: {
61
+ one: string;
62
+ other: string;
63
+ };
64
+ summaryTotals: {
65
+ one: string;
66
+ other: string;
67
+ };
68
+ summaryRows: string;
69
+ summaryData: string;
70
+ yearsAll: string;
71
+ yearsOne: string;
72
+ emptyPicks: string;
73
+ emptyRules: string;
74
+ emptyTotal: string;
75
+ totalSpread: string;
76
+ totalWords: string;
77
+ totalWordsTwo: string;
78
+ resetFilter: string;
79
+ nouns: {
80
+ item: {
81
+ one: string;
82
+ other: string;
83
+ };
84
+ value: {
85
+ one: string;
86
+ other: string;
87
+ };
88
+ date: {
89
+ one: string;
90
+ other: string;
91
+ };
92
+ year: {
93
+ one: string;
94
+ other: string;
95
+ };
96
+ quarter: {
97
+ one: string;
98
+ other: string;
99
+ };
100
+ month: {
101
+ one: string;
102
+ other: string;
103
+ };
104
+ week: {
105
+ one: string;
106
+ other: string;
107
+ };
108
+ day: {
109
+ one: string;
110
+ other: string;
111
+ };
112
+ weekday: {
113
+ one: string;
114
+ other: string;
115
+ };
116
+ hour: {
117
+ one: string;
118
+ other: string;
119
+ };
120
+ range: {
121
+ one: string;
122
+ other: string;
123
+ };
124
+ };
125
+ quickTitle: string;
126
+ quickCount: {
127
+ year: string;
128
+ month: string;
129
+ day: string;
130
+ };
131
+ quickLast: {
132
+ year: {
133
+ one: string;
134
+ other: string;
135
+ };
136
+ month: {
137
+ one: string;
138
+ other: string;
139
+ };
140
+ day: {
141
+ one: string;
142
+ other: string;
143
+ };
144
+ };
145
+ quickRows: string;
146
+ quickHidden: {
147
+ one: string;
148
+ other: string;
149
+ };
150
+ anchorLabel: string;
151
+ anchorToday: string;
152
+ anchorLatest: string;
153
+ quickLine: string;
154
+ changeAbove: string;
155
+ yearsCombined: string;
156
+ yearsCombinedHint: string;
157
+ yearsCombinedOne: string;
158
+ pickItems: string;
159
+ picksState: string;
160
+ picksAll: string;
161
+ clear: string;
162
+ clearPicks: string;
163
+ rulesState: {
164
+ one: string;
165
+ other: string;
166
+ };
167
+ rulesNoneState: string;
168
+ removeAll: string;
169
+ removeRules: string;
170
+ tailOut: {
171
+ one: string;
172
+ other: string;
173
+ };
174
+ rulesKeep: string;
175
+ rulesNone: string;
176
+ ruleKeeps: string;
177
+ ruleKeepsNone: string;
178
+ ruleIncomplete: string;
179
+ explainRule: string;
180
+ ruleInfo: {
181
+ number: string;
182
+ date: string;
183
+ group: string;
184
+ cyclic: string;
185
+ total: string;
186
+ name: string;
187
+ };
188
+ scopeItems: string;
189
+ scopeDates: string;
190
+ scopeRows: string;
191
+ pickerSearch: string;
192
+ pickerMatch: string;
193
+ pickerNone: string;
194
+ rulesTitle: string;
195
+ ruleAnd: string;
196
+ addRule: string;
197
+ addRuleItem: string;
198
+ addRuleTotal: string;
199
+ addRuleName: string;
200
+ removeRule: string;
201
+ rulesFull: string;
202
+ ruleName: string;
203
+ ruleValue: string;
204
+ ruleDate: string;
205
+ dateOps: {
206
+ "=": string;
207
+ "!=": string;
208
+ ">": string;
209
+ ">=": string;
210
+ "<": string;
211
+ "<=": string;
212
+ between: string;
213
+ notBetween: string;
214
+ };
215
+ lastOp: {
216
+ one: string;
217
+ other: string;
218
+ };
219
+ ruleUnits: {
220
+ year: {
221
+ one: string;
222
+ other: string;
223
+ };
224
+ month: {
225
+ one: string;
226
+ other: string;
227
+ };
228
+ day: {
229
+ one: string;
230
+ other: string;
231
+ };
232
+ };
233
+ ruleWhose: string;
234
+ blanksOut: string;
235
+ ruleUnit: string;
24
236
  moveLeft: string;
25
237
  moveRight: string;
26
238
  remove: string;
@@ -103,7 +315,6 @@ export declare const en: {
103
315
  rename: string;
104
316
  sortOldest: string;
105
317
  sortNewest: string;
106
- groupBy: string;
107
318
  groupNone: string;
108
319
  groupTimeline: string;
109
320
  groupCyclic: string;
@@ -121,16 +332,12 @@ export declare const en: {
121
332
  bin: string;
122
333
  };
123
334
  bins: string;
124
- binsStart: string;
125
335
  binsState: string;
126
336
  binSize: string;
127
337
  binStart: string;
128
338
  binStartFar: string;
129
339
  apply: string;
130
- change: string;
131
- removeSetting: string;
132
340
  topN: string;
133
- topStart: string;
134
341
  topCount: string;
135
342
  bottom: string;
136
343
  topBy: string;
@@ -173,8 +380,6 @@ export declare const en: {
173
380
  showTips: string;
174
381
  showSettingInfo: string;
175
382
  resetTips: string;
176
- resetSections: string;
177
- resetSectionsDone: string;
178
383
  sectionChanged: string;
179
384
  help: string;
180
385
  shortcutsTitle: string;
@@ -233,6 +438,7 @@ export declare const en: {
233
438
  off: string;
234
439
  };
235
440
  defaultName: string;
441
+ shareThisView: string;
236
442
  share: string;
237
443
  copyLink: string;
238
444
  copyJson: string;
@@ -249,9 +455,8 @@ export declare const en: {
249
455
  switchStartsFresh: string;
250
456
  numberInvalid: string;
251
457
  countInvalid: string;
458
+ countMax: string;
252
459
  sizeInvalid: string;
253
- chooseValues: string;
254
- valueFilter: string;
255
460
  valueFilterBy: string;
256
461
  valueFilterOp: string;
257
462
  valueFilterNumber: string;
@@ -266,7 +471,6 @@ export declare const en: {
266
471
  between: string;
267
472
  notBetween: string;
268
473
  };
269
- removeFilter: string;
270
474
  moreFormats: string;
271
475
  totals: string;
272
476
  grandTotalRow: string;
@@ -289,15 +493,6 @@ export declare const en: {
289
493
  other: string;
290
494
  };
291
495
  chartDisplay: string;
292
- labelOps: {
293
- equals: string;
294
- notEquals: string;
295
- contains: string;
296
- notContains: string;
297
- beginsWith: string;
298
- endsWith: string;
299
- };
300
- filterIs: string;
301
496
  toastExported: string;
302
497
  toastLinkCopied: string;
303
498
  toastJsonCopied: string;
@@ -71,6 +71,147 @@ export declare function setValueFilter(view: any, field: string, condition: {
71
71
  value: number;
72
72
  value2?: number;
73
73
  } | null, previous?: object): any;
74
+ /** The filter types the rule editor of the Filter level holds: on the item, its total, its name. */
75
+ export declare const RULE_TYPES: readonly string[];
76
+ /** The most rules one field takes in the Filter level (the view's `limits.filters` counts all fields). */
77
+ export declare const RULES_MAX = 10;
78
+ /**
79
+ * Replaces one rule of a field, `previous` (the view's own entry, matched by its content), with
80
+ * `entry` (a filter of RULE_TYPES), removes it when `entry` is null, or adds `entry` after the field's
81
+ * other filters without `previous`.
82
+ * @param {any} view
83
+ * @param {string} field
84
+ * @param {object | null} previous
85
+ * @param {object | null} entry
86
+ */
87
+ export declare const setRule: (view: any, field: string, previous: object | null, entry: object | null) => any;
88
+ /**
89
+ * How the Filter level's rules compare a field's items. `item`: "number" (a number typed), "date" (a
90
+ * date field or a day grouping: a day chosen), "group" (another grouping: one of its items chosen),
91
+ * null (text and yes/no have no comparison). `dates`: its source is a date (the words "from",
92
+ * "before", the relative ranges); `cyclic`: a grouping that combines the years ("month of the year":
93
+ * Years combined instead of the quick choices); `quick`: the quick choices are offered (a date along
94
+ * the time line); `months`: "Last N months" among them (not for a grouping by year or quarter);
95
+ * `days`: "Last N days" too (a date field or a day grouping). `unit`: the grouping's unit, for the
96
+ * noun of its items.
97
+ * @param {import("pivotkit-core").Encoded} encoded
98
+ * @param {any} view
99
+ * @param {string} field
100
+ * @returns {{ item: "number" | "date" | "group" | null, dates: boolean, cyclic: boolean, quick: boolean, months: boolean, days: boolean, unit: string | null }}
101
+ */
102
+ export declare function ruleKind(encoded: import("pivotkit-core").Encoded, view: any, field: string): {
103
+ item: "number" | "date" | "group" | null;
104
+ dates: boolean;
105
+ cyclic: boolean;
106
+ quick: boolean;
107
+ months: boolean;
108
+ days: boolean;
109
+ unit: string | null;
110
+ };
111
+ /**
112
+ * A rule (RULE_TYPES) in short, as the chip and the Filter level say it: "last 5 years (2022–2026)",
113
+ * "from 2022", "Count of Released > 3", "contains “an”".
114
+ * @param {any} view
115
+ * @param {any} f
116
+ * @param {{ labels: any, locale: string, timeZone: string, date: boolean, labelOf?: (v: number) => string | undefined, span?: { min: number, max: number } | null }} options
117
+ */
118
+ export declare function ruleText(view: any, f: any, { labels, locale, timeZone, date, labelOf, span }: {
119
+ labels: any;
120
+ locale: string;
121
+ timeZone: string;
122
+ date: boolean;
123
+ labelOf?: (v: number) => string | undefined;
124
+ span?: {
125
+ min: number;
126
+ max: number;
127
+ } | null;
128
+ }): string;
129
+ /**
130
+ * The quick choice of a date field's Filter level its filters match: "all" (no relative range),
131
+ * "thisYear", "years", "months" or "days" with their count and anchor (the field's first relative
132
+ * range of a unit that is offered: months and days only where they are) and the filter itself; the
133
+ * field's other ranges and its comparisons are rules. For a cyclic grouping "yearsCombined" with the
134
+ * years its whole-year comparisons keep (`years`, ascending, from `all`, the years of the data) and
135
+ * those filters, "all" without any, else "custom" (its comparisons hold more).
136
+ * @param {any} view
137
+ * @param {string} field
138
+ * @param {{ cyclic: boolean, months: boolean, days: boolean }} fk ruleKind()
139
+ * @param {number[]} [all] the years of the data, for a cyclic grouping
140
+ * @returns {{ id: "all" | "thisYear" | "years" | "months" | "days" | "yearsCombined" | "custom", count?: number, anchor?: string, years?: number[], filters: any[] }}
141
+ */
142
+ export declare function quickChoice(view: any, field: string, fk: {
143
+ cyclic: boolean;
144
+ months: boolean;
145
+ days: boolean;
146
+ }, all?: number[]): {
147
+ id: "all" | "thisYear" | "years" | "months" | "days" | "yearsCombined" | "custom";
148
+ count?: number;
149
+ anchor?: string;
150
+ years?: number[];
151
+ filters: any[];
152
+ };
153
+ /** A comparison of whole years of days (Jan 1 to Dec 31), as Years combined writes them. */
154
+ export declare const isWholeYear: (f: any) => boolean;
155
+ /** The whole-year comparisons that keep `years` of `all` (ascending): the span they cover, less each gap in it. */
156
+ export declare function yearRules(field: any, years: any, all: any): {
157
+ field: any;
158
+ type: string;
159
+ op: any;
160
+ value: string;
161
+ value2: string;
162
+ }[];
163
+ /**
164
+ * Years combined of a cyclic grouping: its whole-year comparisons are replaced by the ones that keep
165
+ * `years` (yearRules); all of the data's years keep none. Its other filters, its other comparisons
166
+ * (rules such as "is from Jun") among them, stay.
167
+ * @param {any} view
168
+ * @param {string} field
169
+ * @param {number[]} years ascending
170
+ * @param {number[]} all the years of the data
171
+ */
172
+ export declare function setYearsCombined(view: any, field: string, years: number[], all: number[]): any;
173
+ /**
174
+ * A quick choice applied: the field's relative ranges are replaced by one range ({ unit, count,
175
+ * anchor }, the anchor "today" not written), or removed for All (null). Its other filters, the
176
+ * comparisons of the item among them, stay: picks, quick choice and rules apply together.
177
+ * @param {any} view
178
+ * @param {string} field
179
+ * @param {{ unit: string, count: number, anchor?: string } | null} range
180
+ */
181
+ export declare function setQuickRange(view: any, field: string, range: {
182
+ unit: string;
183
+ count: number;
184
+ anchor?: string;
185
+ } | null): any;
186
+ /**
187
+ * What the field's relative ranges count back from: "today" (not written) or "latest", the data's
188
+ * latest record. Every range of the field takes it; the view stays the same without one.
189
+ * @param {any} view
190
+ * @param {string} field
191
+ * @param {"today" | "latest"} anchor
192
+ */
193
+ export declare function setAnchor(view: any, field: string, anchor: "today" | "latest"): any;
194
+ /** Takes the whole filter of a field off: its picks, its quick choice and its rules; Top N stays. */
195
+ export declare const resetFilter: (view: any, field: any) => any;
196
+ /**
197
+ * The totals a rule on the total compares, as the table's Grand Total shows them: one per item of
198
+ * the field, the measure over every row the view's other filters and the field's own filters on
199
+ * items leave (`filters`: those to apply; the field's rules on totals are left out, so each rule
200
+ * can say what it keeps). Blank keys are null, as the items' values.
201
+ * @param {import("pivotkit-core").Encoded} encoded
202
+ * @param {any} view normalized
203
+ * @param {string} field
204
+ * @param {{ field: string | null, agg: string }} by
205
+ * @param {any[]} filters
206
+ * @returns {{ totals: Map<string, number | null>, rows: number }} totals by the item's key (JSON), and the rows left
207
+ */
208
+ export declare function itemTotals(encoded: import("pivotkit-core").Encoded, view: any, field: string, by: {
209
+ field: string | null;
210
+ agg: string;
211
+ }, filters: any[]): {
212
+ totals: Map<string, number | null>;
213
+ rows: number;
214
+ };
74
215
  /**
75
216
  * The measures to choose from with `ref` among them: a sort, a top N or a condition may go by a
76
217
  * measure the view no longer shows (its value was removed); it stays a choice, so applying the form
@@ -101,12 +242,10 @@ export declare function measureChoices(view: any, typeOf: (field: string) => str
101
242
  agg: string;
102
243
  }>;
103
244
  /**
104
- * Removes what the filter of a field keeps out: its item list, its text condition and a value
105
- * condition; Top N has its own control and stays. A field in the Filters zone stays there, unfiltered.
245
+ * Removes the rules of a field (RULE_TYPES); its picks and Top N stay, and so do `keep`, the filters
246
+ * of the quick choice (quickChoice().filters), in their place.
106
247
  */
107
- export declare function removeFilters(view: any, field: any): any;
108
- /** True when a field has an item, text or value filter that removes something (Top N is not counted). */
109
- export declare function hasFilter(view: any, field: any): any;
248
+ export declare function removeRules(view: any, field: any, keep?: any[]): any;
110
249
  /** The four totals of Options, in their order. */
111
250
  export declare const TOTALS: readonly string[];
112
251
  /**
@@ -129,17 +268,19 @@ export declare function totalNoEffect(view: any, key: string): string | null;
129
268
  */
130
269
  export declare function conditionKind(encoded: import("pivotkit-core").Encoded, view: any, field: string): "text" | "number" | null;
131
270
  /**
132
- * What the filter of a field keeps, for its menu: "Filter: 15 of 45", "Filter: contains “abc”",
133
- * "Filter: Sum of Revenue > 1,000"; null without a filter.
271
+ * What the filter of a field keeps, in short, for its menu's first level and the chip: "15 of 45",
272
+ * "last 5 years (2022–2026)", "from 2022", "contains “abc”", "Sum of Revenue > 1,000", joined by
273
+ * commas; null without a filter.
134
274
  * @param {any} view
135
275
  * @param {string} field
136
- * @param {{ summary: { shown: number, total: number } | null } | null | undefined} state the chip's state (zones.jsx)
276
+ * @param {{ summary: { shown: number, total: number } | null, rules?: string[] } | null | undefined} state the chip's state (zones.jsx), with its rules in short
137
277
  * @param {import("./labels.js").UiLabels} labels
138
278
  * @param {string} locale
139
279
  */
140
- export declare function filterText(view: any, field: string, state: {
280
+ export declare function filterState(view: any, field: string, state: {
141
281
  summary: {
142
282
  shown: number;
143
283
  total: number;
144
284
  } | null;
285
+ rules?: string[];
145
286
  } | null | undefined, labels: import("./labels.js").UiLabels, locale: string): string | null;