pivotkit-react 0.1.0 → 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.
- package/CHANGELOG.md +143 -1
- package/README.md +48 -298
- package/dist/chunks/chunk-53ZMK4BH.js +177 -0
- package/dist/chunks/{chunk-ILHFIV2P.js → chunk-F6MVUAQD.js} +35 -78
- package/dist/chunks/chunk-LQCWFJBS.js +310 -0
- package/dist/chunks/chunk-OYY4BKIL.js +93 -0
- package/dist/chunks/chunk-QBD4FOBB.js +254 -0
- package/dist/chunks/{chunk-KKJO36W5.js → chunk-X7H7BAVT.js} +243 -324
- package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
- package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
- package/dist/echarts.js +96 -11
- package/dist/index.js +619 -527
- package/dist/labels.js +13 -4
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +787 -191
- package/dist/styles.css +113 -31
- package/package.json +2 -2
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-types.d.ts +0 -91
- package/types/drill-panel.d.ts +5 -22
- package/types/drill-table.d.ts +71 -0
- package/types/drill.d.ts +0 -36
- package/types/help.d.ts +21 -0
- package/types/icons.d.ts +4 -0
- package/types/labels.d.ts +43 -101
- package/types/lazy-menus.d.ts +16 -4
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +71 -9
- package/types/menu-ops.d.ts +145 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menus.d.ts +1 -1
- package/types/names.d.ts +19 -19
- package/types/overflow.d.ts +4 -1
- package/types/popover.d.ts +10 -6
- package/types/section.d.ts +7 -24
- package/types/sections.d.ts +2 -0
- package/types/share-actions.d.ts +99 -0
- package/types/share.d.ts +0 -9
- package/types/table.d.ts +9 -3
- package/types/templates.d.ts +7 -1
- package/types/tips.d.ts +9 -7
- package/types/toolbar-panels.d.ts +8 -5
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +130 -0
- package/types/unused.d.ts +22 -0
- package/types/use-view-history.d.ts +7 -4
- package/types/view-history.d.ts +23 -6
- package/types/view-ops.d.ts +72 -123
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +13 -6
- package/dist/chunks/chunk-C32TYSHG.js +0 -441
- package/dist/chunks/chunk-XYP47DJ3.js +0 -123
package/dist/styles.css
CHANGED
|
@@ -583,6 +583,42 @@
|
|
|
583
583
|
.pk-grow {
|
|
584
584
|
flex: 1;
|
|
585
585
|
}
|
|
586
|
+
.pk-toolbar > .pk-view-name {
|
|
587
|
+
display: inline-flex;
|
|
588
|
+
flex: 0 1 auto;
|
|
589
|
+
align-items: center;
|
|
590
|
+
gap: 0.4em;
|
|
591
|
+
min-width: 4em;
|
|
592
|
+
max-width: 18em;
|
|
593
|
+
min-height: var(--pk-target);
|
|
594
|
+
padding: 0 0.3em;
|
|
595
|
+
border: 0;
|
|
596
|
+
border-radius: var(--pk-radius);
|
|
597
|
+
background: none;
|
|
598
|
+
color: var(--pk-muted);
|
|
599
|
+
font: inherit;
|
|
600
|
+
cursor: pointer;
|
|
601
|
+
}
|
|
602
|
+
.pk-toolbar.pk-wrap > .pk-view-name {
|
|
603
|
+
flex: 1 1 0;
|
|
604
|
+
max-width: none;
|
|
605
|
+
}
|
|
606
|
+
.pk-toolbar > .pk-view-name:hover {
|
|
607
|
+
color: var(--pk-text);
|
|
608
|
+
text-decoration: underline;
|
|
609
|
+
}
|
|
610
|
+
.pk-view-name-text {
|
|
611
|
+
overflow: hidden;
|
|
612
|
+
white-space: nowrap;
|
|
613
|
+
text-overflow: ellipsis;
|
|
614
|
+
}
|
|
615
|
+
.pk-view-changed {
|
|
616
|
+
flex: none;
|
|
617
|
+
width: 0.55em;
|
|
618
|
+
height: 0.55em;
|
|
619
|
+
border-radius: 50%;
|
|
620
|
+
background: var(--pk-accent);
|
|
621
|
+
}
|
|
586
622
|
.pk-zones {
|
|
587
623
|
display: grid;
|
|
588
624
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
@@ -990,11 +1026,19 @@
|
|
|
990
1026
|
cursor: pointer;
|
|
991
1027
|
}
|
|
992
1028
|
.pk-root .pk-section-toggle {
|
|
1029
|
+
color: var(--pk-text);
|
|
1030
|
+
}
|
|
1031
|
+
.pk-section-state {
|
|
1032
|
+
margin-left: auto;
|
|
993
1033
|
color: var(--pk-muted);
|
|
1034
|
+
font-weight: 400;
|
|
1035
|
+
}
|
|
1036
|
+
.pk-section-mark,
|
|
1037
|
+
.pk-state-line .pk-link {
|
|
1038
|
+
color: var(--pk-accent);
|
|
994
1039
|
}
|
|
995
1040
|
.pk-root .pk-section-toggle:hover {
|
|
996
1041
|
background: var(--pk-surface-3);
|
|
997
|
-
color: var(--pk-text);
|
|
998
1042
|
}
|
|
999
1043
|
.pk-section.pk-folded {
|
|
1000
1044
|
padding-bottom: 2px;
|
|
@@ -1341,36 +1385,44 @@
|
|
|
1341
1385
|
justify-content: flex-end;
|
|
1342
1386
|
gap: 6px;
|
|
1343
1387
|
}
|
|
1344
|
-
.pk-issues {
|
|
1345
|
-
display: flex;
|
|
1388
|
+
.pk-note.pk-issues {
|
|
1346
1389
|
align-items: flex-start;
|
|
1347
|
-
|
|
1348
|
-
padding: 0.3em
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1390
|
+
flex-wrap: nowrap;
|
|
1391
|
+
padding-right: 0.3em;
|
|
1392
|
+
}
|
|
1393
|
+
.pk-issues > .pk-icon {
|
|
1394
|
+
flex: none;
|
|
1395
|
+
margin-top: 0.3em;
|
|
1353
1396
|
}
|
|
1354
1397
|
.pk-issues > details {
|
|
1355
1398
|
flex: 1;
|
|
1356
1399
|
min-width: 0;
|
|
1357
|
-
padding: 0.2em 0;
|
|
1358
|
-
}
|
|
1359
|
-
.pk-issues-x {
|
|
1360
|
-
flex: none;
|
|
1361
|
-
width: var(--pk-target);
|
|
1362
|
-
height: var(--pk-target);
|
|
1363
1400
|
}
|
|
1364
1401
|
.pk-issues summary {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
gap: 0.5em;
|
|
1402
|
+
padding: 0.15em 0;
|
|
1403
|
+
font-weight: 600;
|
|
1368
1404
|
cursor: pointer;
|
|
1369
|
-
color: var(--pk-muted);
|
|
1370
1405
|
}
|
|
1371
1406
|
.pk-issues ul {
|
|
1372
|
-
margin: 0.
|
|
1373
|
-
padding-left: 1.
|
|
1407
|
+
margin: 0.2em 0 0.3em;
|
|
1408
|
+
padding-left: 1.2em;
|
|
1409
|
+
}
|
|
1410
|
+
.pk-issues li + li {
|
|
1411
|
+
margin-top: 0.35em;
|
|
1412
|
+
}
|
|
1413
|
+
.pk-issues-more {
|
|
1414
|
+
margin: 0 0 0.3em 1.2em;
|
|
1415
|
+
}
|
|
1416
|
+
.pk-issues-path {
|
|
1417
|
+
display: block;
|
|
1418
|
+
color: var(--pk-muted);
|
|
1419
|
+
font-size: var(--pk-small);
|
|
1420
|
+
overflow-wrap: anywhere;
|
|
1421
|
+
}
|
|
1422
|
+
.pk-issues-x {
|
|
1423
|
+
flex: none;
|
|
1424
|
+
width: var(--pk-target);
|
|
1425
|
+
height: var(--pk-target);
|
|
1374
1426
|
}
|
|
1375
1427
|
.pk-result-head {
|
|
1376
1428
|
display: flex;
|
|
@@ -1553,6 +1605,38 @@
|
|
|
1553
1605
|
.pk-draggable.pk-dragging {
|
|
1554
1606
|
opacity: 0.5;
|
|
1555
1607
|
}
|
|
1608
|
+
.pk-th-sort {
|
|
1609
|
+
display: inline-flex;
|
|
1610
|
+
align-items: center;
|
|
1611
|
+
gap: 0.2em;
|
|
1612
|
+
min-width: 0;
|
|
1613
|
+
min-height: var(--pk-target);
|
|
1614
|
+
padding: 0;
|
|
1615
|
+
border: 0;
|
|
1616
|
+
border-radius: 4px;
|
|
1617
|
+
background: transparent;
|
|
1618
|
+
color: inherit;
|
|
1619
|
+
font: inherit;
|
|
1620
|
+
text-align: inherit;
|
|
1621
|
+
cursor: pointer;
|
|
1622
|
+
}
|
|
1623
|
+
.pk-th-arrow {
|
|
1624
|
+
flex: none;
|
|
1625
|
+
opacity: 0;
|
|
1626
|
+
transition: opacity var(--pk-duration);
|
|
1627
|
+
}
|
|
1628
|
+
.pk-th-sort:is(:hover, :focus) .pk-th-arrow {
|
|
1629
|
+
opacity: 0.6;
|
|
1630
|
+
}
|
|
1631
|
+
@media (hover: none) {
|
|
1632
|
+
.pk-th-arrow {
|
|
1633
|
+
opacity: 0.35;
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
.pk-th-sort.pk-sorted .pk-th-arrow {
|
|
1637
|
+
opacity: 1;
|
|
1638
|
+
color: var(--pk-accent);
|
|
1639
|
+
}
|
|
1556
1640
|
.pk-td {
|
|
1557
1641
|
text-align: right !important;
|
|
1558
1642
|
background: var(--pk-surface);
|
|
@@ -1956,11 +2040,6 @@
|
|
|
1956
2040
|
line-height: 1.45;
|
|
1957
2041
|
overflow-wrap: anywhere;
|
|
1958
2042
|
}
|
|
1959
|
-
.pk-menu-desc {
|
|
1960
|
-
padding: 6px 8px 8px;
|
|
1961
|
-
border-bottom: 1px solid var(--pk-border);
|
|
1962
|
-
color: var(--pk-muted);
|
|
1963
|
-
}
|
|
1964
2043
|
.pk-learn-more {
|
|
1965
2044
|
color: var(--pk-accent);
|
|
1966
2045
|
font-weight: 600;
|
|
@@ -2023,6 +2102,13 @@
|
|
|
2023
2102
|
flex: 1 1 100%;
|
|
2024
2103
|
font-weight: 600;
|
|
2025
2104
|
}
|
|
2105
|
+
.pk-save-confirm {
|
|
2106
|
+
display: flex;
|
|
2107
|
+
flex-wrap: wrap;
|
|
2108
|
+
align-items: center;
|
|
2109
|
+
gap: 6px;
|
|
2110
|
+
padding: 4px 6px;
|
|
2111
|
+
}
|
|
2026
2112
|
.pk-root[data-pk-size=narrow] .pk-layout {
|
|
2027
2113
|
grid-template-columns: minmax(0, 1fr);
|
|
2028
2114
|
}
|
|
@@ -2174,10 +2260,6 @@
|
|
|
2174
2260
|
padding: 2px 8px 6px;
|
|
2175
2261
|
font-size: var(--pk-small);
|
|
2176
2262
|
}
|
|
2177
|
-
.pk-remove-filter {
|
|
2178
|
-
align-self: flex-start;
|
|
2179
|
-
margin-bottom: 6px;
|
|
2180
|
-
}
|
|
2181
2263
|
.pk-load-view .pk-hint {
|
|
2182
2264
|
flex-basis: 100%;
|
|
2183
2265
|
margin: 0;
|
|
@@ -2440,7 +2522,7 @@
|
|
|
2440
2522
|
padding: 4px;
|
|
2441
2523
|
}
|
|
2442
2524
|
@media (pointer: coarse) {
|
|
2443
|
-
.pk-root :is(.pk-chip-x, .pk-info, .pk-field-menu, .pk-handle, .pk-tip-x, .pk-toast-x, .pk-issues-x) {
|
|
2525
|
+
.pk-root :is(.pk-chip-x, .pk-info, .pk-field-menu, .pk-handle, .pk-tip-x, .pk-toast-x, .pk-issues-x, .pk-th-sort, .pk-section-toggle) {
|
|
2444
2526
|
min-width: var(--pk-target-touch);
|
|
2445
2527
|
min-height: var(--pk-target-touch);
|
|
2446
2528
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters, templates as JSON, undo, Excel and CSV export.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "eizedev <oss@eize.dev>",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@dnd-kit/core": "6.3.1",
|
|
62
62
|
"@dnd-kit/sortable": "10.0.0",
|
|
63
|
-
"pivotkit-core": "^0.
|
|
63
|
+
"pivotkit-core": "^0.2.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"echarts": "6.1.0"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Room (px) above and below a pie for the labels outside it, for a chart `height` px high: 5 % of the
|
|
3
|
+
* height, at most 24 px. The pie's radius is a share of its box, so in a low box the top and bottom
|
|
4
|
+
* labels would reach past the canvas; a tall box keeps nearly all of its pie.
|
|
5
|
+
* @param {number} height
|
|
6
|
+
*/
|
|
7
|
+
export declare function pieLabelRoom(height: number): number;
|
|
8
|
+
/**
|
|
9
|
+
* The least width (px) of a chart that keeps a legend on its right: the legend's column takes 160 px
|
|
10
|
+
* (pivotkit-core), so a narrower chart (a phone) would squeeze the pie or the plot into a sliver. Below
|
|
11
|
+
* it the legend is drawn at the bottom instead, with the room pivotkit-core gives a bottom legend.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RIGHT_LEGEND_MIN_WIDTH = 480;
|
|
14
|
+
/** Room (px) pivotkit-core gives a legend at the bottom of a chart. */
|
|
15
|
+
export declare const BOTTOM_LEGEND_ROOM = 32;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the numbers written inside a donut's ring fit across it: the ring is the outer less the
|
|
18
|
+
* inner radius, both a share (ECharts' "70%") of half the smaller side of the pie's box. A pie (no
|
|
19
|
+
* inner radius) has room from its centre and always fits.
|
|
20
|
+
* @param {[string | number, string | number]} radius the series' radius, inner and outer
|
|
21
|
+
* @param {{ width: number, height: number }} box the pie's box: the chart less the room around it
|
|
22
|
+
* @param {string[]} texts the labels written on the slices
|
|
23
|
+
*/
|
|
24
|
+
export declare function ringLabelsFit(radius: [string | number, string | number], box: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}, texts: string[]): boolean;
|
|
28
|
+
/** Width (px) a slanted column name of a heatmap takes at most; a longer one ends in "…". */
|
|
29
|
+
export declare const SLANTED_LABEL_WIDTH = 120;
|
|
30
|
+
/**
|
|
31
|
+
* How a heatmap writes its column names along the x axis of a chart `width` px wide: straight when
|
|
32
|
+
* the longest fits its column, else slanted by 45 degrees and cut at SLANTED_LABEL_WIDTH. Every name is
|
|
33
|
+
* shown (the core sets interval 0); the width of a character is estimated as 0.55 of the font size.
|
|
34
|
+
* @param {string[]} names
|
|
35
|
+
* @param {number} width the chart's width in px
|
|
36
|
+
* @param {number} [fontSize] px, ECharts' default for axis labels
|
|
37
|
+
* @returns {{ rotate: number, width?: number, overflow?: "truncate" }}
|
|
38
|
+
*/
|
|
39
|
+
export declare function columnLabelLayout(names: string[], width: number, fontSize?: number): {
|
|
40
|
+
rotate: number;
|
|
41
|
+
width?: number;
|
|
42
|
+
overflow?: "truncate";
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* True when the cells of a heatmap of `columns` x `rows` in a chart of `width` x `height` px hold their
|
|
46
|
+
* numbers as the chart writes them (`texts`, formatted: "1,234.5", "-12.3%"): the longest, estimated at
|
|
47
|
+
* 0.55 of the font size per character, fits a cell's width with room on both sides, and a line its height.
|
|
48
|
+
* @param {number} columns
|
|
49
|
+
* @param {number} rows
|
|
50
|
+
* @param {number} width
|
|
51
|
+
* @param {number} height
|
|
52
|
+
* @param {string[]} texts
|
|
53
|
+
* @param {number} [fontSize] px, ECharts' default for labels
|
|
54
|
+
*/
|
|
55
|
+
export declare function heatmapCellLabels(columns: number, rows: number, width: number, height: number, texts: string[], fontSize?: number): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Which row names of a heatmap the y axis writes in a chart `height` px high: every one (0) when a line
|
|
58
|
+
* fits each row, else every n-th (ECharts' interval: n - 1 names left out between two shown), so the
|
|
59
|
+
* names never overlap and the first one is always there.
|
|
60
|
+
* @param {number} rows
|
|
61
|
+
* @param {number} height
|
|
62
|
+
*/
|
|
63
|
+
export declare function rowLabelInterval(rows: number, height: number): number;
|
|
64
|
+
/** Width (px) a category label of bars, lines and areas takes at most: a longer one ends in "…" (the tooltip has it whole). */
|
|
65
|
+
export declare const CATEGORY_LABEL_WIDTH = 120;
|
|
66
|
+
/**
|
|
67
|
+
* How the category axis of bars, lines and areas writes its labels (`chart.axisLabels`):
|
|
68
|
+
* - "auto": every label straight when the longest fits its slot, else slanted by 45 degrees while a
|
|
69
|
+
* line fits each slot, else every n-th slanted (`every` > 1, the chart says so in a note);
|
|
70
|
+
* - "all": every label, slanted when they do not fit straight;
|
|
71
|
+
* - "nth": straight, every n-th so they never overlap.
|
|
72
|
+
* Along a vertical axis (horizontal bars) the labels stay straight: every one while a line fits each
|
|
73
|
+
* row, else every n-th. A label is cut at CATEGORY_LABEL_WIDTH; character width estimated at 0.55 of the font size.
|
|
74
|
+
* @param {string[]} names
|
|
75
|
+
* @param {{ width: number, height: number, horizontal?: boolean, mode?: string, fontSize?: number }} box
|
|
76
|
+
* @returns {{ rotate: number, interval: number, every: number, width: number, overflow: "truncate" }}
|
|
77
|
+
*/
|
|
78
|
+
export declare function categoryLabelLayout(names: string[], { width, height, horizontal, mode, fontSize }: {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
horizontal?: boolean;
|
|
82
|
+
mode?: string;
|
|
83
|
+
fontSize?: number;
|
|
84
|
+
}): {
|
|
85
|
+
rotate: number;
|
|
86
|
+
interval: number;
|
|
87
|
+
every: number;
|
|
88
|
+
width: number;
|
|
89
|
+
overflow: "truncate";
|
|
90
|
+
};
|
|
91
|
+
/** The least room (px) a group label needs along the axis, and the least size of a chart with group labels. */
|
|
92
|
+
export declare const GROUP_LABEL_ROOM: Readonly<{
|
|
93
|
+
along: 56;
|
|
94
|
+
across: 28;
|
|
95
|
+
width: 420;
|
|
96
|
+
height: 260;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether "auto" group labels fit a chart of `width` x `height` px with `count` categories whose
|
|
100
|
+
* smallest group has `groupSize` of them: each group's name needs GROUP_LABEL_ROOM.along px under the
|
|
101
|
+
* axis (across: a line per group beside a vertical axis), and the chart itself a least size, or the
|
|
102
|
+
* plot area left over is too small to read.
|
|
103
|
+
* @param {number} count
|
|
104
|
+
* @param {number} groupSize
|
|
105
|
+
* @param {{ width: number, height: number, horizontal?: boolean }} box
|
|
106
|
+
*/
|
|
107
|
+
export declare function groupLabelsFit(count: number, groupSize: number, { width, height, horizontal }: {
|
|
108
|
+
width: number;
|
|
109
|
+
height: number;
|
|
110
|
+
horizontal?: boolean;
|
|
111
|
+
}): boolean;
|
package/types/chart-types.d.ts
CHANGED
|
@@ -59,94 +59,3 @@ export declare function chartPlan(view: {
|
|
|
59
59
|
export declare const MANY_SERIES = 8;
|
|
60
60
|
/** Categories a chart draws at most; the rest are left out with a note. */
|
|
61
61
|
export declare const MAX_CATEGORIES = 50;
|
|
62
|
-
/**
|
|
63
|
-
* Room (px) above and below a pie for the labels outside it, for a chart `height` px high: 5 % of the
|
|
64
|
-
* height, at most 24 px. The pie's radius is a share of its box, so in a low box the top and bottom
|
|
65
|
-
* labels would reach past the canvas; a tall box keeps nearly all of its pie.
|
|
66
|
-
* @param {number} height
|
|
67
|
-
*/
|
|
68
|
-
export declare function pieLabelRoom(height: number): number;
|
|
69
|
-
/** Width (px) a slanted column name of a heatmap takes at most; a longer one ends in "…". */
|
|
70
|
-
export declare const SLANTED_LABEL_WIDTH = 120;
|
|
71
|
-
/**
|
|
72
|
-
* How a heatmap writes its column names along the x axis of a chart `width` px wide: straight when
|
|
73
|
-
* the longest fits its column, else slanted by 45 degrees and cut at SLANTED_LABEL_WIDTH. Every name is
|
|
74
|
-
* shown (the core sets interval 0); the width of a character is estimated as 0.55 of the font size.
|
|
75
|
-
* @param {string[]} names
|
|
76
|
-
* @param {number} width the chart's width in px
|
|
77
|
-
* @param {number} [fontSize] px, ECharts' default for axis labels
|
|
78
|
-
* @returns {{ rotate: number, width?: number, overflow?: "truncate" }}
|
|
79
|
-
*/
|
|
80
|
-
export declare function columnLabelLayout(names: string[], width: number, fontSize?: number): {
|
|
81
|
-
rotate: number;
|
|
82
|
-
width?: number;
|
|
83
|
-
overflow?: "truncate";
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* True when the cells of a heatmap of `columns` x `rows` in a chart of `width` x `height` px hold their
|
|
87
|
-
* numbers as the chart writes them (`texts`, formatted: "1,234.5", "-12.3%"): the longest, estimated at
|
|
88
|
-
* 0.55 of the font size per character, fits a cell's width with room on both sides, and a line its height.
|
|
89
|
-
* @param {number} columns
|
|
90
|
-
* @param {number} rows
|
|
91
|
-
* @param {number} width
|
|
92
|
-
* @param {number} height
|
|
93
|
-
* @param {string[]} texts
|
|
94
|
-
* @param {number} [fontSize] px, ECharts' default for labels
|
|
95
|
-
*/
|
|
96
|
-
export declare function heatmapCellLabels(columns: number, rows: number, width: number, height: number, texts: string[], fontSize?: number): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Which row names of a heatmap the y axis writes in a chart `height` px high: every one (0) when a line
|
|
99
|
-
* fits each row, else every n-th (ECharts' interval: n - 1 names left out between two shown), so the
|
|
100
|
-
* names never overlap and the first one is always there.
|
|
101
|
-
* @param {number} rows
|
|
102
|
-
* @param {number} height
|
|
103
|
-
*/
|
|
104
|
-
export declare function rowLabelInterval(rows: number, height: number): number;
|
|
105
|
-
/** Width (px) a category label of bars, lines and areas takes at most: a longer one ends in "…" (the tooltip has it whole). */
|
|
106
|
-
export declare const CATEGORY_LABEL_WIDTH = 120;
|
|
107
|
-
/**
|
|
108
|
-
* How the category axis of bars, lines and areas writes its labels (`chart.axisLabels`):
|
|
109
|
-
* - "auto": every label straight when the longest fits its slot, else slanted by 45 degrees while a
|
|
110
|
-
* line fits each slot, else every n-th slanted (`every` > 1, the chart says so in a note);
|
|
111
|
-
* - "all": every label, slanted when they do not fit straight;
|
|
112
|
-
* - "nth": straight, every n-th so they never overlap.
|
|
113
|
-
* Along a vertical axis (horizontal bars) the labels stay straight: every one while a line fits each
|
|
114
|
-
* row, else every n-th. A label is cut at CATEGORY_LABEL_WIDTH; character width estimated at 0.55 of the font size.
|
|
115
|
-
* @param {string[]} names
|
|
116
|
-
* @param {{ width: number, height: number, horizontal?: boolean, mode?: string, fontSize?: number }} box
|
|
117
|
-
* @returns {{ rotate: number, interval: number, every: number, width: number, overflow: "truncate" }}
|
|
118
|
-
*/
|
|
119
|
-
export declare function categoryLabelLayout(names: string[], { width, height, horizontal, mode, fontSize }: {
|
|
120
|
-
width: number;
|
|
121
|
-
height: number;
|
|
122
|
-
horizontal?: boolean;
|
|
123
|
-
mode?: string;
|
|
124
|
-
fontSize?: number;
|
|
125
|
-
}): {
|
|
126
|
-
rotate: number;
|
|
127
|
-
interval: number;
|
|
128
|
-
every: number;
|
|
129
|
-
width: number;
|
|
130
|
-
overflow: "truncate";
|
|
131
|
-
};
|
|
132
|
-
/** The least room (px) a group label needs along the axis, and the least size of a chart with group labels. */
|
|
133
|
-
export declare const GROUP_LABEL_ROOM: Readonly<{
|
|
134
|
-
along: 56;
|
|
135
|
-
across: 28;
|
|
136
|
-
width: 420;
|
|
137
|
-
height: 260;
|
|
138
|
-
}>;
|
|
139
|
-
/**
|
|
140
|
-
* Whether "auto" group labels fit a chart of `width` x `height` px with `count` categories whose
|
|
141
|
-
* smallest group has `groupSize` of them: each group's name needs GROUP_LABEL_ROOM.along px under the
|
|
142
|
-
* axis (across: a line per group beside a vertical axis), and the chart itself a least size, or the
|
|
143
|
-
* plot area left over is too small to read.
|
|
144
|
-
* @param {number} count
|
|
145
|
-
* @param {number} groupSize
|
|
146
|
-
* @param {{ width: number, height: number, horizontal?: boolean }} box
|
|
147
|
-
*/
|
|
148
|
-
export declare function groupLabelsFit(count: number, groupSize: number, { width, height, horizontal }: {
|
|
149
|
-
width: number;
|
|
150
|
-
height: number;
|
|
151
|
-
horizontal?: boolean;
|
|
152
|
-
}): boolean;
|
package/types/drill-panel.d.ts
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export type Drill =
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
count: number;
|
|
6
|
-
locale: string;
|
|
7
|
-
indices: ArrayLike<number>;
|
|
8
|
-
formats: Record<string, string>;
|
|
9
|
-
columns: Array<{
|
|
10
|
-
name: string;
|
|
11
|
-
numeric: boolean;
|
|
12
|
-
label?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
}>;
|
|
15
|
-
rows: string[][];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {{ title: string, name: string, count: number, locale: string, indices: ArrayLike<number>, formats: Record<string, string>,
|
|
19
|
-
* columns: Array<{ name: string, numeric: boolean, label?: string, description?: string }>, rows: string[][] }} Drill
|
|
20
|
-
*/
|
|
2
|
+
export type Drill = import("./drill-table.js").Drill;
|
|
3
|
+
/** @typedef {import("./drill-table.js").Drill} Drill */
|
|
21
4
|
/**
|
|
22
|
-
* @param {{ drill:
|
|
5
|
+
* @param {{ drill: import("./drill-table.js").DrillSource | null, onClose: () => void, labels: import("./labels.js").UiLabels, locale: string,
|
|
23
6
|
* exportContext?: { encoded: import("pivotkit-core").Encoded, onExport?: (file: import("./export-run.js").ExportFile) => unknown,
|
|
24
7
|
* announce: (text: string, extra?: { tone?: "error" }) => void, root: React.RefObject<HTMLElement | null> } }} props
|
|
25
8
|
*/
|
|
26
|
-
export declare function DrillPanel({ drill, onClose, labels, locale, exportContext }: {
|
|
27
|
-
drill:
|
|
9
|
+
export declare function DrillPanel({ drill: source, onClose, labels, locale, exportContext }: {
|
|
10
|
+
drill: import("./drill-table.js").DrillSource | null;
|
|
28
11
|
onClose: () => void;
|
|
29
12
|
labels: import("./labels.js").UiLabels;
|
|
30
13
|
locale: string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type DrillSource = {
|
|
2
|
+
result: import("pivotkit-core").PivotResult;
|
|
3
|
+
rowPath: unknown[];
|
|
4
|
+
colPath: unknown[];
|
|
5
|
+
count: number;
|
|
6
|
+
indices: ArrayLike<number>;
|
|
7
|
+
formatOf: (field: string) => unknown;
|
|
8
|
+
nameOf: (field: string) => string;
|
|
9
|
+
infoOf: (field: string) => {
|
|
10
|
+
description?: string;
|
|
11
|
+
} | null | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type Drill = {
|
|
14
|
+
title: string;
|
|
15
|
+
name: string;
|
|
16
|
+
count: number;
|
|
17
|
+
locale: string;
|
|
18
|
+
indices: ArrayLike<number>;
|
|
19
|
+
formats: Record<string, string>;
|
|
20
|
+
columns: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
numeric: boolean;
|
|
23
|
+
label?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}>;
|
|
26
|
+
rows: string[][];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The text of one column's values: a date as the table shows it (its day, with the time when the
|
|
30
|
+
* column has times), a number with `format` (a format of pivotkit-core: "text" shows an identifier
|
|
31
|
+
* as it is, "40072") or else in the locale with up to 6 decimals, yes/no with the labels' words.
|
|
32
|
+
* @param {import("pivotkit-core").Column} column
|
|
33
|
+
* @param {{ locale: string, labels: import("pivotkit-core").Labels, format?: unknown }} options
|
|
34
|
+
* @returns {{ text: (value: unknown) => string, numeric: boolean }}
|
|
35
|
+
*/
|
|
36
|
+
export declare function columnText(column: import("pivotkit-core").Column, { locale, labels, format }: {
|
|
37
|
+
locale: string;
|
|
38
|
+
labels: import("pivotkit-core").Labels;
|
|
39
|
+
format?: unknown;
|
|
40
|
+
}): {
|
|
41
|
+
text: (value: unknown) => string;
|
|
42
|
+
numeric: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The rows of the drill-down panel as text, from the encoded columns: one entry per column (its name,
|
|
46
|
+
* whether it is right-aligned as a number) and per row the texts; a blank value is "".
|
|
47
|
+
* @param {import("pivotkit-core").Encoded} encoded
|
|
48
|
+
* @param {ArrayLike<number>} indices positions of the rows in the data (drillRows)
|
|
49
|
+
* @param {{ locale: string, labels: import("pivotkit-core").Labels, formatOf?: (column: string) => unknown }} options
|
|
50
|
+
* `formatOf`: the host's format for a column's values (fieldDefaults)
|
|
51
|
+
* @returns {{ columns: Array<{ name: string, numeric: boolean }>, rows: string[][] }}
|
|
52
|
+
*/
|
|
53
|
+
export declare function drillTable(encoded: import("pivotkit-core").Encoded, indices: ArrayLike<number>, { locale, labels, formatOf }: {
|
|
54
|
+
locale: string;
|
|
55
|
+
labels: import("pivotkit-core").Labels;
|
|
56
|
+
formatOf?: (column: string) => unknown;
|
|
57
|
+
}): {
|
|
58
|
+
columns: Array<{
|
|
59
|
+
name: string;
|
|
60
|
+
numeric: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
rows: string[][];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The panel's contents for a clicked value: its title, its table, and the formats the panel's exports
|
|
66
|
+
* use (pivotkit-core's rows exporters write them as the table shows them).
|
|
67
|
+
* @param {DrillSource} source
|
|
68
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
69
|
+
* @returns {Drill}
|
|
70
|
+
*/
|
|
71
|
+
export declare function drillOf({ result, rowPath, colPath, count, indices, formatOf, nameOf, infoOf }: DrillSource, labels: import("./labels.js").UiLabels): Drill;
|
package/types/drill.d.ts
CHANGED
|
@@ -24,39 +24,3 @@ export declare function drillRows(result: import("pivotkit-core").PivotResult, {
|
|
|
24
24
|
rows: object[];
|
|
25
25
|
indices: Int32Array;
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
28
|
-
* The text of one column's values: a date as the table shows it (its day, with the time when the
|
|
29
|
-
* column has times), a number with `format` (a format of pivotkit-core: "text" shows an identifier
|
|
30
|
-
* as it is, "40072") or else in the locale with up to 6 decimals, yes/no with the labels' words.
|
|
31
|
-
* @param {import("pivotkit-core").Column} column
|
|
32
|
-
* @param {{ locale: string, labels: import("pivotkit-core").Labels, format?: unknown }} options
|
|
33
|
-
* @returns {{ text: (value: unknown) => string, numeric: boolean }}
|
|
34
|
-
*/
|
|
35
|
-
export declare function columnText(column: import("pivotkit-core").Column, { locale, labels, format }: {
|
|
36
|
-
locale: string;
|
|
37
|
-
labels: import("pivotkit-core").Labels;
|
|
38
|
-
format?: unknown;
|
|
39
|
-
}): {
|
|
40
|
-
text: (value: unknown) => string;
|
|
41
|
-
numeric: boolean;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* The rows of the drill-down panel as text, from the encoded columns: one entry per column (its name,
|
|
45
|
-
* whether it is right-aligned as a number) and per row the texts; a blank value is "".
|
|
46
|
-
* @param {import("pivotkit-core").Encoded} encoded
|
|
47
|
-
* @param {ArrayLike<number>} indices positions of the rows in the data (drillRows)
|
|
48
|
-
* @param {{ locale: string, labels: import("pivotkit-core").Labels, formatOf?: (column: string) => unknown }} options
|
|
49
|
-
* `formatOf`: the host's format for a column's values (fieldDefaults)
|
|
50
|
-
* @returns {{ columns: Array<{ name: string, numeric: boolean }>, rows: string[][] }}
|
|
51
|
-
*/
|
|
52
|
-
export declare function drillTable(encoded: import("pivotkit-core").Encoded, indices: ArrayLike<number>, { locale, labels, formatOf }: {
|
|
53
|
-
locale: string;
|
|
54
|
-
labels: import("pivotkit-core").Labels;
|
|
55
|
-
formatOf?: (column: string) => unknown;
|
|
56
|
-
}): {
|
|
57
|
-
columns: Array<{
|
|
58
|
-
name: string;
|
|
59
|
-
numeric: boolean;
|
|
60
|
-
}>;
|
|
61
|
-
rows: string[][];
|
|
62
|
-
};
|
package/types/help.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type Help = {
|
|
2
|
+
/**
|
|
3
|
+
* the "i" of the settings are shown
|
|
4
|
+
*/
|
|
5
|
+
explain: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* whether a section is open
|
|
8
|
+
*/
|
|
9
|
+
isOpen: (id: string) => boolean;
|
|
10
|
+
setOpen: (id: string, open: boolean) => void;
|
|
11
|
+
labels: import("./labels.js").UiLabels | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {object} Help
|
|
15
|
+
* @property {boolean} explain the "i" of the settings are shown
|
|
16
|
+
* @property {(id: string) => boolean} isOpen whether a section is open
|
|
17
|
+
* @property {(id: string, open: boolean) => void} setOpen
|
|
18
|
+
* @property {import("./labels.js").UiLabels | null} labels
|
|
19
|
+
*/
|
|
20
|
+
/** @type {import("react").Context<Help>} */
|
|
21
|
+
export declare const HelpContext: import("react").Context<Help>;
|
package/types/icons.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ declare const PATHS: {
|
|
|
9
9
|
x: string;
|
|
10
10
|
chevronDown: string;
|
|
11
11
|
chevronRight: string;
|
|
12
|
+
arrowUp: string;
|
|
13
|
+
arrowDown: string;
|
|
12
14
|
undo: string;
|
|
13
15
|
redo: string;
|
|
14
16
|
reset: string;
|
|
@@ -39,8 +41,10 @@ declare const PATHS: {
|
|
|
39
41
|
cols: string;
|
|
40
42
|
sigma: string;
|
|
41
43
|
info: string;
|
|
44
|
+
warn: string;
|
|
42
45
|
image: string;
|
|
43
46
|
file: string;
|
|
47
|
+
newFile: string;
|
|
44
48
|
swap: string;
|
|
45
49
|
top: string;
|
|
46
50
|
link: string;
|