pivotkit-react 0.8.2 → 0.9.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 (56) hide show
  1. package/CHANGELOG.md +93 -1
  2. package/dist/chunks/chunk-24T2VRMU.js +1010 -0
  3. package/dist/chunks/chunk-6R7TJHS3.js +212 -0
  4. package/dist/chunks/{chunk-GUSQWPTH.js → chunk-EPGRJSPP.js} +20 -5
  5. package/dist/chunks/{chunk-JAOOFDNR.js → chunk-FAAQZSR4.js} +4 -1
  6. package/dist/chunks/{chunk-2N2UGSIG.js → chunk-FI22Z6CC.js} +5 -2
  7. package/dist/chunks/{chunk-ZM45YU3W.js → chunk-G3R5C3J7.js} +28 -6
  8. package/dist/chunks/{chunk-MU5BTKSY.js → chunk-QCBVEI23.js} +6 -2
  9. package/dist/chunks/{chunk-6OWC6X5W.js → chunk-QVE7JM4G.js} +1 -1
  10. package/dist/chunks/{chunk-3WWWKPB4.js → chunk-V233JHVY.js} +75 -336
  11. package/dist/chunks/chunk-W6BG3GGS.js +679 -0
  12. package/dist/chunks/chunk-YAT2TFMK.js +138 -0
  13. package/dist/chunks/chunk-ZQ2M3U74.js +341 -0
  14. package/dist/chunks/{unused-texts-de-GB3IWWEM.js → labels-de-ZC3CSQZR.js} +1 -1
  15. package/dist/chunks/tips-SYGQPI3Q.js +22 -0
  16. package/dist/chunks/{unused-texts-LRYVWFFN.js → unused-texts-ERQ6ACNX.js} +1 -1
  17. package/dist/chunks/unused-texts-de-AC5GS3FS.js +6 -0
  18. package/dist/deferred-late.js +13 -0
  19. package/dist/deferred.js +18 -0
  20. package/dist/echarts.js +30 -6
  21. package/dist/import-ui.js +3 -3
  22. package/dist/index.js +427 -202
  23. package/dist/labels.js +15 -12
  24. package/dist/menu-texts-de.js +1 -1
  25. package/dist/menus.js +518 -381
  26. package/dist/styles.css +128 -9
  27. package/package.json +5 -4
  28. package/types/PivotReport.d.ts +3 -1
  29. package/types/chart-tooltip.d.ts +18 -1
  30. package/types/chart-types.d.ts +7 -2
  31. package/types/chart.d.ts +10 -2
  32. package/types/chip-menus.d.ts +1 -1
  33. package/types/deferred-late.d.ts +2 -0
  34. package/types/deferred.d.ts +28 -0
  35. package/types/field-info.d.ts +6 -3
  36. package/types/fields.d.ts +3 -2
  37. package/types/icons.d.ts +2 -0
  38. package/types/index.d.ts +20 -10
  39. package/types/labels-de.d.ts +2 -0
  40. package/types/labels.d.ts +55 -459
  41. package/types/lazy-menus.d.ts +2 -2
  42. package/types/menu-labels.d.ts +20 -0
  43. package/types/menu-ops.d.ts +33 -0
  44. package/types/menu-topics.d.ts +6 -3
  45. package/types/menus.d.ts +1 -0
  46. package/types/names.d.ts +20 -2
  47. package/types/notices.d.ts +212 -0
  48. package/types/point-menu.d.ts +21 -0
  49. package/types/quick-choices.d.ts +28 -0
  50. package/types/side-by-side.d.ts +19 -0
  51. package/types/tip-state.d.ts +97 -0
  52. package/types/tips.d.ts +13 -250
  53. package/types/unused-texts.d.ts +3 -0
  54. package/types/view-ops.d.ts +27 -14
  55. package/types/view-tabs.d.ts +4 -3
  56. package/dist/chunks/chunk-W2SVDHGN.js +0 -1898
package/dist/styles.css CHANGED
@@ -109,6 +109,7 @@
109
109
  --pk-chart-7: #6250d6;
110
110
  --pk-chart-8: #e34948;
111
111
  --pk-chart-reference: var(--pk-muted);
112
+ --pk-chart-other: var(--pk-muted);
112
113
  }
113
114
  :where(.pk-root[data-pk-theme=dark]) {
114
115
  color-scheme: dark;
@@ -155,6 +156,7 @@
155
156
  --pk-chart-7: #9085e9;
156
157
  --pk-chart-8: #e66767;
157
158
  --pk-chart-reference: var(--pk-muted);
159
+ --pk-chart-other: #6b7280;
158
160
  }
159
161
  @media (prefers-reduced-motion: reduce) {
160
162
  :where(.pk-root) {
@@ -569,6 +571,14 @@
569
571
  white-space: normal;
570
572
  line-height: 1.3;
571
573
  }
574
+ .pk-field-source {
575
+ display: block;
576
+ overflow: hidden;
577
+ color: var(--pk-muted);
578
+ font-size: var(--pk-small);
579
+ text-overflow: ellipsis;
580
+ white-space: nowrap;
581
+ }
572
582
  .pk-field-title .pk-word {
573
583
  display: inline-block;
574
584
  max-width: 100%;
@@ -1056,6 +1066,19 @@
1056
1066
  width: 420px;
1057
1067
  max-width: min(420px, calc(100vw - 16px));
1058
1068
  }
1069
+ .pk-scale-swatch {
1070
+ flex: none;
1071
+ width: 3.5em;
1072
+ height: 0.9em;
1073
+ margin-left: auto;
1074
+ border: 1px solid var(--pk-border);
1075
+ border-radius: var(--pk-radius-xs);
1076
+ background: var(--pk-swatch);
1077
+ box-shadow: inset 0 0 0 100vmax color-mix(in srgb, var(--pk-surface) 52%, transparent);
1078
+ }
1079
+ .pk-root[data-pk-theme=dark] .pk-scale-swatch {
1080
+ box-shadow: inset 0 0 0 100vmax color-mix(in srgb, var(--pk-surface) 70%, transparent);
1081
+ }
1059
1082
  .pk-tag {
1060
1083
  display: inline-flex;
1061
1084
  flex: none;
@@ -1927,9 +1950,10 @@
1927
1950
  }
1928
1951
  .pk-popover-head {
1929
1952
  display: flex;
1953
+ flex-wrap: wrap;
1930
1954
  align-items: baseline;
1931
1955
  justify-content: space-between;
1932
- gap: 1em;
1956
+ gap: 0 1em;
1933
1957
  }
1934
1958
  .pk-popover-head h3 {
1935
1959
  font-size: 1em;
@@ -2328,16 +2352,25 @@
2328
2352
  }
2329
2353
  .pk-th-arrow {
2330
2354
  flex: none;
2331
- opacity: 0;
2355
+ opacity: 0.35;
2332
2356
  transition: opacity var(--pk-duration);
2333
2357
  }
2334
2358
  .pk-th-sort:is(:hover, :focus) .pk-th-arrow {
2335
2359
  opacity: 0.6;
2336
2360
  }
2337
- @media (hover: none) {
2338
- .pk-th-arrow {
2339
- opacity: 0.35;
2340
- }
2361
+ .pk-th-sort-aside {
2362
+ position: relative;
2363
+ }
2364
+ .pk-th-sort-aside .pk-th-arrow {
2365
+ position: absolute;
2366
+ top: 50%;
2367
+ width: 0.8em;
2368
+ height: 0.8em;
2369
+ translate: 0 -50%;
2370
+ }
2371
+ .pk-colHeader .pk-th-sort-aside .pk-th-arrow {
2372
+ right: 100%;
2373
+ margin-right: 0.05em;
2341
2374
  }
2342
2375
  .pk-th-sort.pk-sorted .pk-th-arrow {
2343
2376
  opacity: 1;
@@ -2430,6 +2463,57 @@
2430
2463
  .pk-fresh :is(td, th) {
2431
2464
  animation: pk-fade-in calc(var(--pk-duration) * 1.4) ease-out;
2432
2465
  }
2466
+ .pk-both {
2467
+ display: grid;
2468
+ grid-template-columns: minmax(0, var(--pk-split, 50%)) 9px minmax(0, 1fr);
2469
+ flex: 1;
2470
+ min-width: 0;
2471
+ min-height: 0;
2472
+ }
2473
+ .pk-both-part {
2474
+ display: flex;
2475
+ min-width: 0;
2476
+ min-height: 0;
2477
+ }
2478
+ .pk-both-divider {
2479
+ position: relative;
2480
+ cursor: col-resize;
2481
+ touch-action: none;
2482
+ }
2483
+ .pk-both-divider::before {
2484
+ content: "";
2485
+ position: absolute;
2486
+ inset: 0 4px;
2487
+ background: var(--pk-border);
2488
+ }
2489
+ .pk-both-divider:is(:hover, :focus-visible, :active)::before {
2490
+ inset: 0 3px;
2491
+ background: var(--pk-accent);
2492
+ }
2493
+ .pk-both-divider::after {
2494
+ content: "";
2495
+ position: absolute;
2496
+ top: 50%;
2497
+ left: 50%;
2498
+ width: 5px;
2499
+ height: 28px;
2500
+ border-radius: var(--pk-radius-xs);
2501
+ background: var(--pk-border-strong);
2502
+ translate: -50% -50%;
2503
+ }
2504
+ .pk-both-divider:focus-visible {
2505
+ outline: var(--pk-focus-width) solid var(--pk-focus);
2506
+ outline-offset: calc(-1 * var(--pk-focus-width));
2507
+ border-radius: var(--pk-radius-xs);
2508
+ }
2509
+ @media (pointer: coarse) {
2510
+ .pk-both {
2511
+ grid-template-columns: minmax(0, var(--pk-split, 50%)) 24px minmax(0, 1fr);
2512
+ }
2513
+ .pk-both-divider::before {
2514
+ inset: 0 11px;
2515
+ }
2516
+ }
2433
2517
  .pk-chart-wrap {
2434
2518
  display: flex;
2435
2519
  flex-direction: column;
@@ -2451,12 +2535,21 @@
2451
2535
  outline: var(--pk-focus-width) solid var(--pk-focus);
2452
2536
  outline-offset: var(--pk-focus-offset);
2453
2537
  }
2538
+ .pk-point-anchor {
2539
+ position: absolute;
2540
+ width: 0;
2541
+ height: 0;
2542
+ pointer-events: none;
2543
+ }
2454
2544
  .pk-chart {
2455
2545
  width: 100%;
2456
2546
  height: 100%;
2457
2547
  min-height: 0;
2458
2548
  animation: pk-fade-in calc(var(--pk-duration) * 1.4) ease-out;
2459
2549
  }
2550
+ .pk-chart:focus {
2551
+ outline: none;
2552
+ }
2460
2553
  .pk-chart-note {
2461
2554
  position: absolute;
2462
2555
  inset: 0;
@@ -3208,21 +3301,44 @@
3208
3301
  min-width: var(--pk-target-touch);
3209
3302
  min-height: var(--pk-target-touch);
3210
3303
  }
3211
- .pk-root :is(.pk-levels .pk-option, .pk-level-back) {
3304
+ .pk-root :is(.pk-btn, .pk-icon-btn, .pk-tab, .pk-section-fold, .pk-chip-label, .pk-segmented > button, .pk-search, .pk-option, .pk-level-back, .pk-action, .pk-link, .pk-fsection-toggle, .pk-value > label) {
3305
+ min-height: var(--pk-target-touch);
3306
+ }
3307
+ .pk-root :is(.pk-btn, .pk-icon-btn, .pk-action, .pk-link) {
3308
+ min-width: var(--pk-target-touch);
3309
+ }
3310
+ .pk-root :is(select, input:is([type=text], [type=date])):not(.pk-search input) {
3212
3311
  min-height: var(--pk-target-touch);
3213
3312
  }
3313
+ .pk-root select {
3314
+ height: var(--pk-target-touch);
3315
+ }
3316
+ .pk-root .pk-chip {
3317
+ height: calc(var(--pk-target-touch) + 2px);
3318
+ }
3319
+ .pk-root .pk-toggle {
3320
+ position: relative;
3321
+ }
3322
+ .pk-root .pk-toggle::after {
3323
+ content: "";
3324
+ position: absolute;
3325
+ top: calc((100% - var(--pk-row-h)) / 2);
3326
+ bottom: calc((100% - var(--pk-row-h)) / 2);
3327
+ left: 0;
3328
+ width: var(--pk-target-touch);
3329
+ }
3214
3330
  .pk-root .pk-field {
3215
3331
  margin-bottom: max(3px, calc(var(--pk-target-touch) - 2.4em));
3216
3332
  }
3217
3333
  .pk-root .pk-field-list {
3218
3334
  padding-top: 6px;
3219
3335
  }
3220
- .pk-root .pk-field :is(.pk-handle, .pk-info, .pk-field-menu) {
3336
+ .pk-root .pk-field :is(.pk-handle, .pk-info, .pk-field-menu, .pk-field-name) {
3221
3337
  position: relative;
3222
3338
  min-width: 0;
3223
3339
  min-height: var(--pk-target);
3224
3340
  }
3225
- .pk-root .pk-field :is(.pk-handle, .pk-info, .pk-field-menu)::after {
3341
+ .pk-root .pk-field :is(.pk-handle, .pk-info, .pk-field-menu, .pk-field-name)::after {
3226
3342
  content: "";
3227
3343
  position: absolute;
3228
3344
  top: calc(50% - var(--pk-target-touch) / 2);
@@ -3230,6 +3346,9 @@
3230
3346
  left: -1px;
3231
3347
  right: -1px;
3232
3348
  }
3349
+ .pk-root .pk-field .pk-field-name {
3350
+ overflow: visible;
3351
+ }
3233
3352
  .pk-root .pk-field .pk-handle::after {
3234
3353
  left: calc(50% - var(--pk-target-touch) / 2);
3235
3354
  right: calc(50% - var(--pk-target-touch) / 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pivotkit-react",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters, views as JSON files, undo, Excel and CSV export.",
5
5
  "license": "MIT",
6
6
  "author": "eizedev <oss@eize.dev>",
@@ -26,7 +26,8 @@
26
26
  "type": "module",
27
27
  "sideEffects": [
28
28
  "*.css",
29
- "./dist/echarts.js"
29
+ "./dist/echarts.js",
30
+ "./dist/chunks/*.js"
30
31
  ],
31
32
  "exports": {
32
33
  ".": {
@@ -68,8 +69,8 @@
68
69
  "dependencies": {
69
70
  "@dnd-kit/core": "6.3.1",
70
71
  "@dnd-kit/sortable": "10.0.0",
71
- "pivotkit-core": "^0.8.0",
72
- "pivotkit-report": "^0.4.0"
72
+ "pivotkit-core": "^0.9.0",
73
+ "pivotkit-report": "^0.5.0"
73
74
  },
74
75
  "devDependencies": {
75
76
  "echarts": "6.1.0"
@@ -20,7 +20,9 @@ export declare const DEFER_ROWS = 10000;
20
20
  /**
21
21
  * The pivot report builder. While the host's data loads (`loading`) or a large data set is encoded for
22
22
  * the first time, the report shows its skeleton; once shown, the report stays (its view and history
23
- * too) and a later `loading` covers its result only.
23
+ * too) and a later `loading` covers its result only. A language whose texts load on demand
24
+ * (pivotkit-element: deferred-late.js) is waited for: before it the skeleton shows without a word, and
25
+ * a report that changes its language keeps the last one's texts until the new ones are here.
24
26
  * @param {import("./index.js").PivotReportProps} props
25
27
  */
26
28
  export declare function PivotReport(props: import("./index.js").PivotReportProps): React.JSX.Element;
@@ -117,9 +117,26 @@ export declare function linesSummary(lines: ReturnType<typeof import("pivotkit-c
117
117
  chartLines: string;
118
118
  chartTrendSpan: string;
119
119
  }): string;
120
+ /**
121
+ * The high and low points in the chart's text alternative, with the words of its highest and lowest
122
+ * value (labels.chartExtremes): one sentence per series, or of a stack's total. Empty without points,
123
+ * and for one series alone, whose highest and lowest the text alternative names already.
124
+ * @param {ReturnType<typeof import("pivotkit-core/chart").extremePoints>} points pivotkit-core's extremePoints
125
+ * @param {{ categories: string[], series: { name: string }[] }} s the chart's series (toSeries)
126
+ * @param {{ chartExtremes: string, chartTotal: string }} labels
127
+ */
128
+ export declare function pointsSummary(points: ReturnType<typeof import("pivotkit-core/chart").extremePoints>, s: {
129
+ categories: string[];
130
+ series: {
131
+ name: string;
132
+ }[];
133
+ }, labels: {
134
+ chartExtremes: string;
135
+ chartTotal: string;
136
+ }): string;
120
137
  /**
121
138
  * A drawn chart's reference lines (chart.jsx): the lines as numbers for the tooltip, their sentence
122
- * for the text alternative (linesSummary) and which ones the chart can draw, with the first series'
139
+ * and the high and low points' for the text alternative (linesSummary, pointsSummary) and which ones the chart can draw, with the first series'
123
140
  * format (pivotkit-core's referenceLineChecks), for the Display menu.
124
141
  * @param {import("pivotkit-core").PivotResult} result
125
142
  * @param {{ series: ReturnType<typeof import("pivotkit-core").toSeries>, chart?: { type: string, stacked: boolean, horizontal: boolean } | null, labels: any, locale: string }} options
@@ -6,15 +6,20 @@ export type ChartTypeEntry = {
6
6
  };
7
7
  icon: string;
8
8
  axis: boolean;
9
+ lines?: boolean;
10
+ values?: number;
9
11
  };
10
- /** @typedef {{ chart: { type: string, stacked: boolean, horizontal: boolean }, icon: string, axis: boolean }} ChartTypeEntry */
12
+ /** @typedef {{ chart: { type: string, stacked: boolean, horizontal: boolean }, icon: string, axis: boolean, lines?: boolean, values?: number }} ChartTypeEntry */
11
13
  /**
12
14
  * @type {Readonly<Record<string, ChartTypeEntry>>} axis: drawn along a category axis (series hints
13
- * apply). "auto" is the view's default: the data decides (chartPlan), until the user picks a type.
15
+ * apply); lines: false where it draws no reference lines (two value axes); values: the values it
16
+ * needs at least. "auto" is the view's default: the data decides (chartPlan), until the user picks a type.
14
17
  */
15
18
  export declare const CHART_TYPES: Readonly<Record<string, ChartTypeEntry>>;
16
19
  /** The picker entries drawn as slices of a circle (pivotkit-core's SLICE_CHART_TYPES). */
17
20
  export declare const SLICE_TYPES: readonly string[];
21
+ /** The picker entries that draw one mark per category (a slice, a tile): their legend entries are the categories. */
22
+ export declare const ITEM_TYPES: readonly string[];
18
23
  /** The picker entries in their order. */
19
24
  export declare const CHART_TYPE_NAMES: readonly string[];
20
25
  /**
package/types/chart.d.ts CHANGED
@@ -5,8 +5,9 @@ export declare function loadECharts(): Promise<any>;
5
5
  * @param {{ result: import("pivotkit-core").PivotResult, series: ReturnType<typeof import("pivotkit-core").toSeries> | null,
6
6
  * labels: import("./labels.js").UiLabels, locale: string,
7
7
  * themeName: string, root: React.RefObject<HTMLElement>, onInstance: (chart: any) => void,
8
- * onPoint: (point: { rowPath: any[], colPath: any[], valueIndex: number, value: unknown }) => void,
9
- * onLines?: (checks: { average: boolean, trend: boolean, target: boolean, notes: string[], format?: string } | null) => void,
8
+ * onPoint: (point: { rowPath: any[], colPath: any[], valueIndex: number, value: unknown, slice?: boolean, direct?: boolean, anchor?: HTMLElement | null,
9
+ * home?: HTMLElement | null, rowLabel?: string, colLabel?: string }) => void,
10
+ * onLines?: (checks: { average: boolean, trend: boolean, target: boolean, extremes: boolean, notes: string[], format?: string } | null) => void,
10
11
  * onLegend?: (change: { name: string, shown: boolean }) => void,
11
12
  * valueNames: string[], chartOptions?: Record<string, unknown> | null, colorMap?: unknown,
12
13
  * plan?: { name: string, chart: { type: string, stacked: boolean, horizontal: boolean } } }} props
@@ -31,11 +32,18 @@ export declare function PivotChart({ result, series, labels, locale, themeName,
31
32
  colPath: any[];
32
33
  valueIndex: number;
33
34
  value: unknown;
35
+ slice?: boolean;
36
+ direct?: boolean;
37
+ anchor?: HTMLElement | null;
38
+ home?: HTMLElement | null;
39
+ rowLabel?: string;
40
+ colLabel?: string;
34
41
  }) => void;
35
42
  onLines?: (checks: {
36
43
  average: boolean;
37
44
  trend: boolean;
38
45
  target: boolean;
46
+ extremes: boolean;
39
47
  notes: string[];
40
48
  format?: string;
41
49
  } | null) => void;
@@ -17,7 +17,7 @@ export declare function AxisMenu({ view, zone, index, field, types, labels, comm
17
17
  view: any;
18
18
  zone: any;
19
19
  }): React.JSX.Element;
20
- /** The menu of a chip in Filters (the whole report): the same Filter level, Move to. */
20
+ /** The menu of a chip in Filters (the whole report): the same Filter level, Group for a date, Move to. */
21
21
  export declare function FilterMenu({ view, index, field, types, labels, commit, close, onRemove, locale, info, state, encoded }: {
22
22
  close: any;
23
23
  commit: any;
@@ -0,0 +1,2 @@
1
+ /** @type {import("./deferred.js").Deferred} */
2
+ export declare const DEFERRED: import("./deferred.js").Deferred;
@@ -0,0 +1,28 @@
1
+ export type Deferred = {
2
+ /**
3
+ * the tips' table; null until loaded (the notices are in notices.js)
4
+ */
5
+ tips: TipsTable | null;
6
+ /**
7
+ * loads them; null when they are here
8
+ */
9
+ loadTips: (() => Promise<TipsTable>) | null;
10
+ /**
11
+ * per language not here yet: adds
12
+ * its first-load texts (labels.js addLabels)
13
+ */
14
+ loadLabels: Readonly<Record<string, () => Promise<void>>>;
15
+ };
16
+ export type TipsTable = {
17
+ TIPS: readonly import("./notices.js").TipEntry[];
18
+ };
19
+ /**
20
+ * @typedef {object} Deferred
21
+ * @property {TipsTable | null} tips the tips' table; null until loaded (the notices are in notices.js)
22
+ * @property {(() => Promise<TipsTable>) | null} loadTips loads them; null when they are here
23
+ * @property {Readonly<Record<string, () => Promise<void>>>} loadLabels per language not here yet: adds
24
+ * its first-load texts (labels.js addLabels)
25
+ */
26
+ /** @typedef {{ TIPS: readonly import("./notices.js").TipEntry[] }} TipsTable the notices and the tips (tips.js) */
27
+ /** @type {Deferred} */
28
+ export declare const DEFERRED: Deferred;
@@ -27,12 +27,14 @@ export declare function displayNames(info: Map<string, FieldInfo>, fieldNames?:
27
27
  */
28
28
  export declare function typesOf(fieldDefaults: unknown): Record<string, string> | null;
29
29
  /**
30
- * Whether a field matches the search of the field list: its name, its display name or its description.
30
+ * Whether a field matches the search of the field list: its name, its display name, the name the
31
+ * report gives it (#158) or its description.
31
32
  * @param {string} field
32
33
  * @param {string} query lower case, trimmed
33
34
  * @param {FieldInfo | undefined} info
35
+ * @param {string} [shown] the name the report shows for it
34
36
  */
35
- export declare function fieldMatches(field: string, query: string, info: FieldInfo | undefined): boolean;
37
+ export declare function fieldMatches(field: string, query: string, info: FieldInfo | undefined, shown?: string): boolean;
36
38
  /**
37
39
  * The fields a search shows: the field list's and the "+ Add" menus' search, by name, display name and
38
40
  * description (fieldMatches), in the data's order.
@@ -40,11 +42,12 @@ export declare function fieldMatches(field: string, query: string, info: FieldIn
40
42
  * @param {F[]} fields
41
43
  * @param {string} query as typed
42
44
  * @param {Map<string, FieldInfo>} info the host's descriptions by lower-case field name
45
+ * @param {(field: string) => string} [nameOf] the name the report shows for a field
43
46
  * @returns {F[]}
44
47
  */
45
48
  export declare function matchingFields<F extends {
46
49
  name: string;
47
- }>(fields: F[], query: string, info: Map<string, FieldInfo>): F[];
50
+ }>(fields: F[], query: string, info: Map<string, FieldInfo>, nameOf?: (field: string) => string): F[];
48
51
  /** Whether a field's name says it is an identifier: pivotkit-core's rule, which its suggestions share. */
49
52
  export { isIdentifierName };
50
53
  /**
package/types/fields.d.ts CHANGED
@@ -3,14 +3,14 @@ import React from "react";
3
3
  * @param {{ fields: Array<{ name: string, type: string }>, placed: Map<string, string[]>, labels: import("./labels.js").UiLabels,
4
4
  * onAdd: (field: string, zone: string) => void, onNote: (text: string) => void, drawer: boolean, open: boolean, onClose: () => void,
5
5
  * onFilter?: (field: string, anchor: HTMLElement | null) => void, showInfo?: boolean,
6
- * nameOf: (field: string) => string, info: Map<string, import("./field-info.js").FieldInfo>, onSkip?: () => void,
6
+ * nameOf: (field: string) => string, sourceNameOf?: (field: string) => string, info: Map<string, import("./field-info.js").FieldInfo>, onSkip?: () => void,
7
7
  * collapsed?: boolean, onCollapse?: (collapsed: boolean) => void }} props
8
8
  * `nameOf`: a field's display name; `info`: the host's descriptions by lower-case field name;
9
9
  * `onSkip`: the link past the list to the toolbar (not in the drawer, which the toolbar opens);
10
10
  * `collapsed`, `onCollapse`: the list folded to a rail ("Fields" and a search button) beside the
11
11
  * report, and the change of it (not in the drawer)
12
12
  */
13
- export declare function FieldPanel({ fields, placed, labels, onAdd, onNote, onFilter, drawer, open, onClose, nameOf, info, showInfo, onSkip, collapsed, onCollapse }: {
13
+ export declare function FieldPanel({ fields, placed, labels, onAdd, onNote, onFilter, drawer, open, onClose, nameOf, sourceNameOf, info, showInfo, onSkip, collapsed, onCollapse }: {
14
14
  fields: Array<{
15
15
  name: string;
16
16
  type: string;
@@ -25,6 +25,7 @@ export declare function FieldPanel({ fields, placed, labels, onAdd, onNote, onFi
25
25
  onFilter?: (field: string, anchor: HTMLElement | null) => void;
26
26
  showInfo?: boolean;
27
27
  nameOf: (field: string) => string;
28
+ sourceNameOf?: (field: string) => string;
28
29
  info: Map<string, import("./field-info.js").FieldInfo>;
29
30
  onSkip?: () => void;
30
31
  collapsed?: boolean;
package/types/icons.d.ts CHANGED
@@ -23,6 +23,8 @@ declare const PATHS: {
23
23
  pie: string;
24
24
  donut: string;
25
25
  heatmap: string;
26
+ combo: string;
27
+ treemap: string;
26
28
  download: string;
27
29
  bookmark: string;
28
30
  sliders: string;
package/types/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export type View = import("pivotkit-core").View;
2
- export type ViewInput = {
2
+ export type PivotView = {
3
3
  [K in keyof View]?: View[K] extends Array<infer T> ? Array<T extends object ? Partial<T> : T> : View[K] extends object ? Partial<View[K]> : View[K];
4
4
  };
5
+ export type ViewInput = PivotView;
5
6
  export type UiLabels = import("./labels.js").UiLabels;
6
7
  export type PartialLabels = import("./labels.js").PartialLabels;
7
8
  export type Template = {
@@ -9,7 +10,7 @@ export type Template = {
9
10
  * shown in the menu; default the view file's name (an entry without a name is left out)
10
11
  */
11
12
  name?: string;
12
- view?: ViewInput;
13
+ view?: PivotView;
13
14
  /**
14
15
  * a view file ("pivotkit-view", its object or text)
15
16
  * instead of `view`, read by pivotkit-core's fromViewFile
@@ -159,11 +160,11 @@ export type PivotReportProps = {
159
160
  /**
160
161
  * controlled: the view to show; pass back what onViewChange gives
161
162
  */
162
- view?: ViewInput;
163
+ view?: PivotView;
163
164
  /**
164
165
  * uncontrolled: the start view; the report keeps the view itself
165
166
  */
166
- defaultView?: ViewInput;
167
+ defaultView?: PivotView;
167
168
  /**
168
169
  * every change, normalized
169
170
  */
@@ -191,7 +192,7 @@ export type PivotReportProps = {
191
192
  * view was made for: the data shown (null without a source id), or the data a view file or a view of
192
193
  * the browser store names (its id and sheet; its name when that is the data shown)
193
194
  */
194
- onPublishTemplate?: (name: string, view: ViewInput, where: {
195
+ onPublishTemplate?: (name: string, view: PivotView, where: {
195
196
  source: TemplateSource | null;
196
197
  }) => unknown;
197
198
  /**
@@ -460,14 +461,23 @@ export type TipDismiss = {
460
461
  * A view of pivotkit-core: what the report shows, as JSON. Hosts store and pass it; a partial view is
461
462
  * filled with defaults, anything unknown is dropped (pivotkit-core's normalize()).
462
463
  * @typedef {import("pivotkit-core").View} View
463
- * @typedef {{ [K in keyof View]?: View[K] extends Array<infer T> ? Array<T extends object ? Partial<T> : T> : View[K] extends object ? Partial<View[K]> : View[K] }} ViewInput
464
+ * @typedef {{ [K in keyof View]?: View[K] extends Array<infer T> ? Array<T extends object ? Partial<T> : T> : View[K] extends object ? Partial<View[K]> : View[K] }} PivotView
465
+ * a view as a host passes it: the name pivotkit-element uses too (#563)
466
+ */
467
+ /**
468
+ * The old name of PivotView.
469
+ * @typedef {PivotView} ViewInput
470
+ * @deprecated PK-DEP-0001: use `PivotView`, the same type under the name both packages use.
471
+ * `ViewInput` goes no earlier than 2.0.0.
472
+ */
473
+ /**
464
474
  * @typedef {import("./labels.js").UiLabels} UiLabels
465
475
  * @typedef {import("./labels.js").PartialLabels} PartialLabels
466
476
  */
467
477
  /**
468
478
  * @typedef {object} Template an entry of the Views menu: a view, or a view file
469
479
  * @property {string} [name] shown in the menu; default the view file's name (an entry without a name is left out)
470
- * @property {ViewInput} [view]
480
+ * @property {PivotView} [view]
471
481
  * @property {Record<string, unknown> | string} [file] a view file ("pivotkit-view", its object or text)
472
482
  * instead of `view`, read by pivotkit-core's fromViewFile
473
483
  * @property {"shared" | "user"} [scope] the group: "Shared views" (for everyone) or "My views" (the
@@ -540,8 +550,8 @@ export type TipDismiss = {
540
550
  * per array or object, or once per `dataKey`
541
551
  * @property {string | number} [dataKey] identity of `data`: a new array with the same key is not encoded again
542
552
  * @property {import("pivotkit-core").Encoded} [encoded] already encoded data, instead of `data`
543
- * @property {ViewInput} [view] controlled: the view to show; pass back what onViewChange gives
544
- * @property {ViewInput} [defaultView] uncontrolled: the start view; the report keeps the view itself
553
+ * @property {PivotView} [view] controlled: the view to show; pass back what onViewChange gives
554
+ * @property {PivotView} [defaultView] uncontrolled: the start view; the report keeps the view itself
545
555
  * @property {(view: View) => void} [onViewChange] every change, normalized
546
556
  * @property {Template[]} [templates] the entries of the Views menu, in two groups by `scope`
547
557
  * @property {(name: string, view: View, where: TemplateScope) => unknown} [onSaveTemplate] shows
@@ -550,7 +560,7 @@ export type TipDismiss = {
550
560
  * rejects. It wins over `templateStore`
551
561
  * @property {(name: string, where: TemplateScope) => unknown} [onDeleteTemplate] deletes a template
552
562
  * marked `deletable` (`where.scope`: its group); the entry goes when it returns (or its promise resolves)
553
- * @property {(name: string, view: ViewInput, where: { source: TemplateSource | null }) => unknown} [onPublishTemplate] with `canPublish`:
563
+ * @property {(name: string, view: PivotView, where: { source: TemplateSource | null }) => unknown} [onPublishTemplate] with `canPublish`:
554
564
  * "Publish as shared view" on each of the user's views; the host makes it a shared entry of
555
565
  * `templates`; "published" is shown when it returns or its promise resolves; `where.source` the data the
556
566
  * view was made for: the data shown (null without a source id), or the data a view file or a view of
@@ -0,0 +1,2 @@
1
+ /** @type {typeof import("./labels.js").en} */
2
+ export declare const de: typeof import("./labels.js").en;