@rowsncolumns/charts 28.0.0 → 28.1.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/dist/cjs/atoms/pivot-chart.atom.d.ts +14 -0
- package/dist/cjs/atoms/pivot-chart.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/pivot-chart.atom.js +9 -0
- package/dist/cjs/basic-chart/basic-chart.d.ts +1 -1
- package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/basic-chart/basic-chart.js +863 -371
- package/dist/cjs/components/dialogs/pivot-chart-dialog.d.ts +39 -0
- package/dist/cjs/components/dialogs/pivot-chart-dialog.d.ts.map +1 -0
- package/dist/cjs/components/dialogs/pivot-chart-dialog.js +100 -0
- package/dist/cjs/components/editors/chart-editor.d.ts +13 -1
- package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +225 -59
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +149 -12
- package/dist/cjs/hooks/use-charts.d.ts +21 -6
- package/dist/cjs/hooks/use-charts.d.ts.map +1 -1
- package/dist/cjs/hooks/use-charts.js +13 -1
- package/dist/cjs/hooks/use-on-create-chart.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-create-chart.js +7 -1
- package/dist/cjs/hooks/use-on-move-chart-to-sheet.d.ts +12 -0
- package/dist/cjs/hooks/use-on-move-chart-to-sheet.d.ts.map +1 -0
- package/dist/cjs/hooks/use-on-move-chart-to-sheet.js +26 -0
- package/dist/cjs/hooks/use-on-move-chart.d.ts +1 -1
- package/dist/cjs/hooks/use-on-move-chart.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-move-chart.js +2 -2
- package/dist/cjs/hooks/use-on-resize-chart.d.ts +1 -1
- package/dist/cjs/hooks/use-on-resize-chart.d.ts.map +1 -1
- package/dist/cjs/hooks/use-on-resize-chart.js +2 -2
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +34 -1
- package/dist/cjs/interface/create-chart.d.ts.map +1 -1
- package/dist/cjs/interface/create-chart.js +33 -42
- package/dist/cjs/interface/delete-chart.d.ts.map +1 -1
- package/dist/cjs/interface/delete-chart.js +4 -0
- package/dist/cjs/interface/move-chart-to-sheet.d.ts +13 -0
- package/dist/cjs/interface/move-chart-to-sheet.d.ts.map +1 -0
- package/dist/cjs/interface/move-chart-to-sheet.js +136 -0
- package/dist/cjs/interface/move-chart.d.ts +2 -2
- package/dist/cjs/interface/move-chart.d.ts.map +1 -1
- package/dist/cjs/interface/move-chart.js +7 -1
- package/dist/cjs/interface/resize-chart.d.ts +2 -2
- package/dist/cjs/interface/resize-chart.d.ts.map +1 -1
- package/dist/cjs/interface/resize-chart.js +7 -1
- package/dist/cjs/interface/update-chart.d.ts.map +1 -1
- package/dist/cjs/interface/update-chart.js +4 -0
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +970 -585
- package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/helpers.js +3 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +7 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/utils/axis-number-format.d.ts +69 -0
- package/dist/cjs/utils/axis-number-format.d.ts.map +1 -0
- package/dist/cjs/utils/axis-number-format.js +217 -0
- package/dist/cjs/utils/category-levels.d.ts +27 -0
- package/dist/cjs/utils/category-levels.d.ts.map +1 -0
- package/dist/cjs/utils/category-levels.js +80 -0
- package/dist/cjs/utils/chart-image.d.ts +8 -0
- package/dist/cjs/utils/chart-image.d.ts.map +1 -0
- package/dist/cjs/utils/chart-image.js +28 -0
- package/dist/cjs/utils/chart-orientation.d.ts +67 -0
- package/dist/cjs/utils/chart-orientation.d.ts.map +1 -0
- package/dist/cjs/utils/chart-orientation.js +265 -0
- package/dist/cjs/utils/chart-spec-utils.d.ts +3 -0
- package/dist/cjs/utils/chart-spec-utils.d.ts.map +1 -1
- package/dist/cjs/utils/chart-spec-utils.js +12 -4
- package/dist/cjs/utils/chart-styles.d.ts +75 -0
- package/dist/cjs/utils/chart-styles.d.ts.map +1 -0
- package/dist/cjs/utils/chart-styles.js +283 -0
- package/dist/cjs/utils/empty-cells.d.ts +30 -0
- package/dist/cjs/utils/empty-cells.d.ts.map +1 -0
- package/dist/cjs/utils/empty-cells.js +91 -0
- package/dist/cjs/utils/overrides.d.ts +6 -1
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +19 -7
- package/dist/cjs/utils/pie-explosion.d.ts +30 -0
- package/dist/cjs/utils/pie-explosion.d.ts.map +1 -0
- package/dist/cjs/utils/pie-explosion.js +55 -0
- package/dist/cjs/utils/plotly-click.d.ts +34 -0
- package/dist/cjs/utils/plotly-click.d.ts.map +1 -0
- package/dist/cjs/utils/plotly-click.js +49 -0
- package/dist/cjs/utils/plotly-surface.d.ts +14 -0
- package/dist/cjs/utils/plotly-surface.d.ts.map +1 -0
- package/dist/cjs/utils/plotly-surface.js +64 -0
- package/dist/cjs/utils/plotly-title.d.ts +12 -0
- package/dist/cjs/utils/plotly-title.d.ts.map +1 -0
- package/dist/cjs/utils/plotly-title.js +24 -0
- package/dist/cjs/utils/series-click.d.ts +39 -0
- package/dist/cjs/utils/series-click.d.ts.map +1 -0
- package/dist/cjs/utils/series-click.js +75 -0
- package/dist/cjs/utils/three-d.d.ts +17 -1
- package/dist/cjs/utils/three-d.d.ts.map +1 -1
- package/dist/cjs/utils/three-d.js +32 -4
- package/dist/esm/atoms/pivot-chart.atom.d.ts +14 -0
- package/dist/esm/atoms/pivot-chart.atom.d.ts.map +1 -0
- package/dist/esm/atoms/pivot-chart.atom.js +4 -0
- package/dist/esm/basic-chart/basic-chart.d.ts +1 -1
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +680 -178
- package/dist/esm/components/dialogs/pivot-chart-dialog.d.ts +39 -0
- package/dist/esm/components/dialogs/pivot-chart-dialog.d.ts.map +1 -0
- package/dist/esm/components/dialogs/pivot-chart-dialog.js +89 -0
- package/dist/esm/components/editors/chart-editor.d.ts +13 -1
- package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +164 -20
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +149 -12
- package/dist/esm/hooks/use-charts.d.ts +21 -6
- package/dist/esm/hooks/use-charts.d.ts.map +1 -1
- package/dist/esm/hooks/use-charts.js +13 -1
- package/dist/esm/hooks/use-on-create-chart.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-create-chart.js +7 -1
- package/dist/esm/hooks/use-on-move-chart-to-sheet.d.ts +12 -0
- package/dist/esm/hooks/use-on-move-chart-to-sheet.d.ts.map +1 -0
- package/dist/esm/hooks/use-on-move-chart-to-sheet.js +19 -0
- package/dist/esm/hooks/use-on-move-chart.d.ts +1 -1
- package/dist/esm/hooks/use-on-move-chart.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-move-chart.js +2 -2
- package/dist/esm/hooks/use-on-resize-chart.d.ts +1 -1
- package/dist/esm/hooks/use-on-resize-chart.d.ts.map +1 -1
- package/dist/esm/hooks/use-on-resize-chart.js +2 -2
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -0
- package/dist/esm/interface/create-chart.d.ts.map +1 -1
- package/dist/esm/interface/create-chart.js +36 -58
- package/dist/esm/interface/delete-chart.d.ts.map +1 -1
- package/dist/esm/interface/delete-chart.js +4 -0
- package/dist/esm/interface/move-chart-to-sheet.d.ts +13 -0
- package/dist/esm/interface/move-chart-to-sheet.d.ts.map +1 -0
- package/dist/esm/interface/move-chart-to-sheet.js +126 -0
- package/dist/esm/interface/move-chart.d.ts +2 -2
- package/dist/esm/interface/move-chart.d.ts.map +1 -1
- package/dist/esm/interface/move-chart.js +7 -1
- package/dist/esm/interface/resize-chart.d.ts +2 -2
- package/dist/esm/interface/resize-chart.d.ts.map +1 -1
- package/dist/esm/interface/resize-chart.js +7 -1
- package/dist/esm/interface/update-chart.d.ts.map +1 -1
- package/dist/esm/interface/update-chart.js +4 -0
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +858 -463
- package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/helpers.js +3 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +7 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils/axis-number-format.d.ts +69 -0
- package/dist/esm/utils/axis-number-format.d.ts.map +1 -0
- package/dist/esm/utils/axis-number-format.js +170 -0
- package/dist/esm/utils/category-levels.d.ts +27 -0
- package/dist/esm/utils/category-levels.d.ts.map +1 -0
- package/dist/esm/utils/category-levels.js +65 -0
- package/dist/esm/utils/chart-image.d.ts +8 -0
- package/dist/esm/utils/chart-image.d.ts.map +1 -0
- package/dist/esm/utils/chart-image.js +24 -0
- package/dist/esm/utils/chart-orientation.d.ts +67 -0
- package/dist/esm/utils/chart-orientation.d.ts.map +1 -0
- package/dist/esm/utils/chart-orientation.js +234 -0
- package/dist/esm/utils/chart-spec-utils.d.ts +3 -0
- package/dist/esm/utils/chart-spec-utils.d.ts.map +1 -1
- package/dist/esm/utils/chart-spec-utils.js +10 -2
- package/dist/esm/utils/chart-styles.d.ts +75 -0
- package/dist/esm/utils/chart-styles.d.ts.map +1 -0
- package/dist/esm/utils/chart-styles.js +357 -0
- package/dist/esm/utils/empty-cells.d.ts +30 -0
- package/dist/esm/utils/empty-cells.d.ts.map +1 -0
- package/dist/esm/utils/empty-cells.js +67 -0
- package/dist/esm/utils/overrides.d.ts +6 -1
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +14 -2
- package/dist/esm/utils/pie-explosion.d.ts +30 -0
- package/dist/esm/utils/pie-explosion.d.ts.map +1 -0
- package/dist/esm/utils/pie-explosion.js +43 -0
- package/dist/esm/utils/plotly-click.d.ts +34 -0
- package/dist/esm/utils/plotly-click.d.ts.map +1 -0
- package/dist/esm/utils/plotly-click.js +44 -0
- package/dist/esm/utils/plotly-surface.d.ts +14 -0
- package/dist/esm/utils/plotly-surface.d.ts.map +1 -0
- package/dist/esm/utils/plotly-surface.js +45 -0
- package/dist/esm/utils/plotly-title.d.ts +12 -0
- package/dist/esm/utils/plotly-title.d.ts.map +1 -0
- package/dist/esm/utils/plotly-title.js +20 -0
- package/dist/esm/utils/series-click.d.ts +39 -0
- package/dist/esm/utils/series-click.d.ts.map +1 -0
- package/dist/esm/utils/series-click.js +66 -0
- package/dist/esm/utils/three-d.d.ts +17 -1
- package/dist/esm/utils/three-d.d.ts.map +1 -1
- package/dist/esm/utils/three-d.js +29 -3
- package/package.json +10 -6
package/dist/cjs/config.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getChartPresetLabel = exports.isDoughnutSpec = exports.CHART_TYPES = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
var pie_explosion_1 = require("./utils/pie-explosion");
|
|
5
6
|
// Excel's 3-D chart classes degrade to a 2-D chartType with the authored
|
|
6
7
|
// class kept as `sourceChartType` (BAR_3D, LINE_3D, PIE_3D, AREA_3D,
|
|
7
8
|
// SURFACE, SURFACE_3D). The renderer draws BAR_3D / LINE_3D / AREA_3D /
|
|
@@ -9,14 +10,85 @@ var tslib_1 = require("tslib");
|
|
|
9
10
|
// 2-D pie) and both exporters write the matching `<c:…3DChart>` element.
|
|
10
11
|
// A 2-D preset in the same family carries no token, and mergeChartSpec
|
|
11
12
|
// clears a picker-authored one on that pick.
|
|
13
|
+
//
|
|
14
|
+
// Every preset in a family sets every field that distinguishes its
|
|
15
|
+
// siblings (PRESET_DISCRIMINATORS): a preset that omits one keeps whatever
|
|
16
|
+
// the previous pick left behind — rowsncolumns/spreadsheet#85 was "Line"
|
|
17
|
+
// staying stacked after "Stacked line" because it never wrote stackedType.
|
|
12
18
|
var LINE_CHART_TYPES = [
|
|
13
|
-
[
|
|
19
|
+
[
|
|
20
|
+
"Line",
|
|
21
|
+
{
|
|
22
|
+
chartType: "line",
|
|
23
|
+
smooth: false,
|
|
24
|
+
stackedType: "UNSTACKED",
|
|
25
|
+
showMarkers: false,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
14
28
|
[
|
|
15
29
|
"Stacked line",
|
|
16
|
-
{
|
|
30
|
+
{
|
|
31
|
+
chartType: "line",
|
|
32
|
+
smooth: false,
|
|
33
|
+
stackedType: "STACKED",
|
|
34
|
+
showMarkers: false,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
"100% stacked line",
|
|
39
|
+
{
|
|
40
|
+
chartType: "line",
|
|
41
|
+
smooth: false,
|
|
42
|
+
stackedType: "PERCENT_STACKED",
|
|
43
|
+
showMarkers: false,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"Line with markers",
|
|
48
|
+
{
|
|
49
|
+
chartType: "line",
|
|
50
|
+
smooth: false,
|
|
51
|
+
stackedType: "UNSTACKED",
|
|
52
|
+
showMarkers: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
"Stacked line with markers",
|
|
57
|
+
{
|
|
58
|
+
chartType: "line",
|
|
59
|
+
smooth: false,
|
|
60
|
+
stackedType: "STACKED",
|
|
61
|
+
showMarkers: true,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
"100% stacked line with markers",
|
|
66
|
+
{
|
|
67
|
+
chartType: "line",
|
|
68
|
+
smooth: false,
|
|
69
|
+
stackedType: "PERCENT_STACKED",
|
|
70
|
+
showMarkers: true,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
"Smooth line",
|
|
75
|
+
{
|
|
76
|
+
chartType: "line",
|
|
77
|
+
smooth: true,
|
|
78
|
+
stackedType: "UNSTACKED",
|
|
79
|
+
showMarkers: false,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
"3-D Line",
|
|
84
|
+
{
|
|
85
|
+
chartType: "line",
|
|
86
|
+
smooth: false,
|
|
87
|
+
stackedType: "UNSTACKED",
|
|
88
|
+
showMarkers: false,
|
|
89
|
+
sourceChartType: "LINE_3D",
|
|
90
|
+
},
|
|
17
91
|
],
|
|
18
|
-
["Smooth line", { chartType: "line", smooth: true }],
|
|
19
|
-
["3-D Line", { chartType: "line", smooth: false, sourceChartType: "LINE_3D" }],
|
|
20
92
|
];
|
|
21
93
|
var COLUMN_CHART_TYPES = [
|
|
22
94
|
["Clustered Column", { chartType: "column", stackedType: "UNSTACKED" }],
|
|
@@ -29,6 +101,18 @@ var COLUMN_CHART_TYPES = [
|
|
|
29
101
|
"3-D Column",
|
|
30
102
|
{ chartType: "column", stackedType: "UNSTACKED", sourceChartType: "BAR_3D" },
|
|
31
103
|
],
|
|
104
|
+
[
|
|
105
|
+
"3-D Stacked column",
|
|
106
|
+
{ chartType: "column", stackedType: "STACKED", sourceChartType: "BAR_3D" },
|
|
107
|
+
],
|
|
108
|
+
[
|
|
109
|
+
"3-D 100% stacked column",
|
|
110
|
+
{
|
|
111
|
+
chartType: "column",
|
|
112
|
+
stackedType: "PERCENT_STACKED",
|
|
113
|
+
sourceChartType: "BAR_3D",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
32
116
|
];
|
|
33
117
|
var BAR_CHART_TYPES = [
|
|
34
118
|
["Clustered Bar", { chartType: "bar", stackedType: "UNSTACKED" }],
|
|
@@ -38,6 +122,18 @@ var BAR_CHART_TYPES = [
|
|
|
38
122
|
"3-D Bar",
|
|
39
123
|
{ chartType: "bar", stackedType: "UNSTACKED", sourceChartType: "BAR_3D" },
|
|
40
124
|
],
|
|
125
|
+
[
|
|
126
|
+
"3-D Stacked Bar",
|
|
127
|
+
{ chartType: "bar", stackedType: "STACKED", sourceChartType: "BAR_3D" },
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
"3-D 100% stacked Bar",
|
|
131
|
+
{
|
|
132
|
+
chartType: "bar",
|
|
133
|
+
stackedType: "PERCENT_STACKED",
|
|
134
|
+
sourceChartType: "BAR_3D",
|
|
135
|
+
},
|
|
136
|
+
],
|
|
41
137
|
];
|
|
42
138
|
var AREA_CHART_TYPES = [
|
|
43
139
|
["Area", { chartType: "area", stackedType: "UNSTACKED" }],
|
|
@@ -54,16 +150,43 @@ var SURFACE_CHART_TYPES = [
|
|
|
54
150
|
["3-D Surface", { chartType: "area", sourceChartType: "SURFACE_3D" }],
|
|
55
151
|
["Contour", { chartType: "area", sourceChartType: "SURFACE" }],
|
|
56
152
|
];
|
|
153
|
+
// Pie presets set `explosion` explicitly (0 vs Excel's 25) so picking
|
|
154
|
+
// "2D Pie" after "Exploded pie" pulls the slices back together.
|
|
57
155
|
var PIE_CHART_TYPES = [
|
|
58
156
|
[
|
|
59
157
|
"2D Pie",
|
|
60
|
-
{
|
|
158
|
+
{
|
|
159
|
+
chartType: "pie",
|
|
160
|
+
stackedType: "UNSTACKED",
|
|
161
|
+
radius: [0, "75%"],
|
|
162
|
+
explosion: 0,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"Exploded pie",
|
|
167
|
+
{
|
|
168
|
+
chartType: "pie",
|
|
169
|
+
stackedType: "UNSTACKED",
|
|
170
|
+
radius: [0, "75%"],
|
|
171
|
+
explosion: pie_explosion_1.DEFAULT_PIE_EXPLOSION,
|
|
172
|
+
},
|
|
61
173
|
],
|
|
62
174
|
// A first-class doughnut token. The hole is controlled by
|
|
63
175
|
// spec.doughnutHoleSize (0-1 fraction, renderer default 0.5) via the
|
|
64
176
|
// editor's "Chart options" section; the preset deliberately omits it
|
|
65
177
|
// so re-picking "Doughnut" never clobbers an authored hole size.
|
|
66
|
-
[
|
|
178
|
+
[
|
|
179
|
+
"Doughnut",
|
|
180
|
+
{ chartType: "doughnut", stackedType: "UNSTACKED", explosion: 0 },
|
|
181
|
+
],
|
|
182
|
+
[
|
|
183
|
+
"Exploded doughnut",
|
|
184
|
+
{
|
|
185
|
+
chartType: "doughnut",
|
|
186
|
+
stackedType: "UNSTACKED",
|
|
187
|
+
explosion: pie_explosion_1.DEFAULT_PIE_EXPLOSION,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
67
190
|
[
|
|
68
191
|
"3-D Pie",
|
|
69
192
|
{
|
|
@@ -127,9 +250,13 @@ var RADAR_CHART_TYPES = [
|
|
|
127
250
|
["Radar with markers", { chartType: "radar", radarStyle: "marker" }],
|
|
128
251
|
["Filled radar", { chartType: "radar", radarStyle: "filled" }],
|
|
129
252
|
];
|
|
253
|
+
// Excel's four stock layouts, named by the series they take in order.
|
|
254
|
+
// The V-variants lead with a volume series drawn as a column sub-pane.
|
|
130
255
|
var STOCK_CHART_TYPES = [
|
|
131
256
|
["Stock (HLC)", { chartType: "stock", stockVariant: "HLC" }],
|
|
132
257
|
["Stock (OHLC)", { chartType: "stock", stockVariant: "OHLC" }],
|
|
258
|
+
["Stock (VHLC)", { chartType: "stock", stockVariant: "VHLC" }],
|
|
259
|
+
["Stock (VOHLC)", { chartType: "stock", stockVariant: "VOHLC" }],
|
|
133
260
|
];
|
|
134
261
|
exports.CHART_TYPES = [
|
|
135
262
|
["Bar", BAR_CHART_TYPES],
|
|
@@ -180,16 +307,20 @@ exports.isDoughnutSpec = isDoughnutSpec;
|
|
|
180
307
|
/**
|
|
181
308
|
* Fields that distinguish presets sharing a chartType, with the value
|
|
182
309
|
* an absent field is equivalent to (e.g. no stackedType renders
|
|
183
|
-
* unstacked, so `{ chartType: "column" }` is "Clustered Column").
|
|
310
|
+
* unstacked, so `{ chartType: "column" }` is "Clustered Column"). An
|
|
311
|
+
* optional normalizer folds a range of authored values onto the preset's
|
|
312
|
+
* (any explosion percentage is "exploded").
|
|
184
313
|
*/
|
|
185
314
|
var PRESET_DISCRIMINATORS = [
|
|
186
315
|
["stackedType", "UNSTACKED"],
|
|
187
316
|
["smooth", false],
|
|
317
|
+
["showMarkers", false],
|
|
188
318
|
["radarStyle", "standard"],
|
|
189
319
|
["stockVariant", "HLC"],
|
|
190
320
|
// 3-D / of-pie variants share a chartType with their 2-D preset.
|
|
191
321
|
["sourceChartType", undefined],
|
|
192
322
|
["ofPieType", "pie"],
|
|
323
|
+
["explosion", 0, function (value) { return typeof value === "number" && value > 0; }],
|
|
193
324
|
];
|
|
194
325
|
/**
|
|
195
326
|
* Derive the picker label for an existing spec — the inverse of the
|
|
@@ -201,11 +332,15 @@ var PRESET_DISCRIMINATORS = [
|
|
|
201
332
|
var getChartPresetLabel = function (spec) {
|
|
202
333
|
var e_1, _a, e_2, _b;
|
|
203
334
|
var _c;
|
|
335
|
+
var loose = spec;
|
|
204
336
|
// Doughnut first — it has several encodings (see isDoughnutSpec) and
|
|
205
337
|
// the legacy pie-based ones would otherwise match the pie presets.
|
|
206
|
-
if ((0, exports.isDoughnutSpec)(spec))
|
|
207
|
-
|
|
208
|
-
|
|
338
|
+
if ((0, exports.isDoughnutSpec)(spec)) {
|
|
339
|
+
var explosion = loose.explosion;
|
|
340
|
+
return typeof explosion === "number" && explosion > 0
|
|
341
|
+
? "Exploded doughnut"
|
|
342
|
+
: "Doughnut";
|
|
343
|
+
}
|
|
209
344
|
try {
|
|
210
345
|
for (var CHART_TYPES_1 = tslib_1.__values(exports.CHART_TYPES), CHART_TYPES_1_1 = CHART_TYPES_1.next(); !CHART_TYPES_1_1.done; CHART_TYPES_1_1 = CHART_TYPES_1.next()) {
|
|
211
346
|
var _d = tslib_1.__read(CHART_TYPES_1_1.value, 2), presets = _d[1];
|
|
@@ -215,10 +350,12 @@ var getChartPresetLabel = function (spec) {
|
|
|
215
350
|
var looseConfig = config;
|
|
216
351
|
var matches = PRESET_DISCRIMINATORS.every(function (_a) {
|
|
217
352
|
var _b, _c;
|
|
218
|
-
var _d = tslib_1.__read(_a,
|
|
353
|
+
var _d = tslib_1.__read(_a, 3), key = _d[0], absentValue = _d[1], normalize = _d[2];
|
|
219
354
|
var presetValue = (_b = looseConfig[key]) !== null && _b !== void 0 ? _b : absentValue;
|
|
220
355
|
var specValue = (_c = loose[key]) !== null && _c !== void 0 ? _c : absentValue;
|
|
221
|
-
return
|
|
356
|
+
return normalize
|
|
357
|
+
? normalize(presetValue) === normalize(specValue)
|
|
358
|
+
: presetValue === specValue;
|
|
222
359
|
});
|
|
223
360
|
if (matches)
|
|
224
361
|
return { value: name_1 };
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import type { EmbeddedChart } from "@rowsncolumns/spreadsheet";
|
|
2
|
-
import type { UseSpreadsheetProps, useSpreadsheetState } from "@rowsncolumns/spreadsheet-state";
|
|
3
|
-
export type UseChartsProps = {
|
|
1
|
+
import type { EmbeddedChart, Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { GeneratedNames, UseSpreadsheetProps, useSpreadsheetState } from "@rowsncolumns/spreadsheet-state";
|
|
3
|
+
export type UseChartsProps<S extends Sheet = Sheet> = {
|
|
4
4
|
/**
|
|
5
5
|
* Callback when chart state is changed
|
|
6
6
|
*/
|
|
7
7
|
onChangeCharts?: React.Dispatch<React.SetStateAction<EmbeddedChart[]>>;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when sheets change. Required for `onMoveChartToSheet` (Excel's
|
|
10
|
+
* "Move Chart…"), which adds / removes chartsheets.
|
|
11
|
+
*/
|
|
12
|
+
onChangeSheets?: React.Dispatch<React.SetStateAction<S[]>>;
|
|
13
|
+
/**
|
|
14
|
+
* Switch the active sheet — `onMoveChartToSheet` follows the chart to its
|
|
15
|
+
* destination sheet like Excel.
|
|
16
|
+
*/
|
|
17
|
+
onChangeActiveSheet?: (sheetId: number) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Generated-name formatters (`Chart1` for a new chartsheet).
|
|
20
|
+
*/
|
|
21
|
+
generatedNames?: GeneratedNames;
|
|
8
22
|
/**
|
|
9
23
|
* Create a spreadsheet history
|
|
10
24
|
*/
|
|
@@ -22,14 +36,15 @@ export type UseChartsProps = {
|
|
|
22
36
|
*/
|
|
23
37
|
idCreationStrategy?: UseSpreadsheetProps["idCreationStrategy"];
|
|
24
38
|
};
|
|
25
|
-
export declare const useCharts: ({ onChangeCharts, getFormattedValue, getEffectiveValue, createHistory, idCreationStrategy, }: UseChartsProps) => {
|
|
39
|
+
export declare const useCharts: <S extends Sheet = Sheet>({ onChangeCharts, onChangeSheets, onChangeActiveSheet, getFormattedValue, getEffectiveValue, createHistory, idCreationStrategy, generatedNames, }: UseChartsProps<S>) => {
|
|
26
40
|
selectedChart: EmbeddedChart | undefined;
|
|
27
41
|
onRequestEditChart: (chart: EmbeddedChart) => void;
|
|
28
42
|
updateSelectedChartPosition: (chartId: string | number, overlayPosition: Partial<import("@rowsncolumns/spreadsheet").OverlayPosition>) => void;
|
|
29
43
|
onCreateChart: (sheetId: number, activeCell: import("@rowsncolumns/grid").CellInterface, selections: import("@rowsncolumns/grid").SelectionArea<import("@rowsncolumns/spreadsheet").SelectionAttributes>[], chartSpec?: EmbeddedChart) => EmbeddedChart;
|
|
30
44
|
onDeleteChart: (chartId: string | number) => void;
|
|
31
|
-
onMoveChart: (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number) => void;
|
|
32
|
-
|
|
45
|
+
onMoveChart: (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number, toAnchor?: import("@rowsncolumns/spreadsheet").OverlayToAnchor) => void;
|
|
46
|
+
onMoveChartToSheet: ((chart: EmbeddedChart, target: import("@rowsncolumns/spreadsheet").MoveChartTarget) => number | undefined) | undefined;
|
|
47
|
+
onResizeChart: (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number, width: number, height: number, toAnchor?: import("@rowsncolumns/spreadsheet").OverlayToAnchor) => void;
|
|
33
48
|
onUpdateChart: (chart: EmbeddedChart) => void;
|
|
34
49
|
};
|
|
35
50
|
//# sourceMappingURL=use-charts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-charts.d.ts","sourceRoot":"","sources":["../../../hooks/use-charts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-charts.d.ts","sourceRoot":"","sources":["../../../hooks/use-charts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,aAAa,EACb,KAAK,EACN,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAWzC,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,IAAI;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IACvE;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;IACvE;;OAEG;IACH,iBAAiB,EAAE,UAAU,CAC3B,OAAO,mBAAmB,CAC3B,CAAC,mBAAmB,CAAC,CAAC;IACvB;;OAEG;IACH,iBAAiB,EAAE,UAAU,CAC3B,OAAO,mBAAmB,CAC3B,CAAC,mBAAmB,CAAC,CAAC;IACvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CAChE,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,KAAK,GAAG,KAAK,EAAE,mJAShD,cAAc,CAAC,CAAC,CAAC;;;;;;;;;;CAwFnB,CAAC"}
|
|
@@ -5,11 +5,12 @@ var react_1 = require("react");
|
|
|
5
5
|
var use_chart_editor_1 = require("./use-chart-editor");
|
|
6
6
|
var use_on_delete_chart_1 = require("./use-on-delete-chart");
|
|
7
7
|
var use_on_move_chart_1 = require("./use-on-move-chart");
|
|
8
|
+
var use_on_move_chart_to_sheet_1 = require("./use-on-move-chart-to-sheet");
|
|
8
9
|
var use_on_resize_chart_1 = require("./use-on-resize-chart");
|
|
9
10
|
var use_on_update_chart_1 = require("./use-on-update-chart");
|
|
10
11
|
var use_on_create_chart_1 = require("./use-on-create-chart");
|
|
11
12
|
var useCharts = function (_a) {
|
|
12
|
-
var onChangeCharts = _a.onChangeCharts, getFormattedValue = _a.getFormattedValue, getEffectiveValue = _a.getEffectiveValue, createHistory = _a.createHistory, idCreationStrategy = _a.idCreationStrategy;
|
|
13
|
+
var onChangeCharts = _a.onChangeCharts, onChangeSheets = _a.onChangeSheets, onChangeActiveSheet = _a.onChangeActiveSheet, getFormattedValue = _a.getFormattedValue, getEffectiveValue = _a.getEffectiveValue, createHistory = _a.createHistory, idCreationStrategy = _a.idCreationStrategy, generatedNames = _a.generatedNames;
|
|
13
14
|
var _b = (0, use_chart_editor_1.useChartEditor)(), selectedChart = _b.selectedChart, onRequestEditChart = _b.onRequestEditChart, updateSelectedChartPosition = _b.updateSelectedChartPosition;
|
|
14
15
|
var onDeleteChart = (0, use_on_delete_chart_1.useOnDeleteChart)({
|
|
15
16
|
onChangeCharts: onChangeCharts,
|
|
@@ -46,6 +47,15 @@ var useCharts = function (_a) {
|
|
|
46
47
|
onChangeCharts: onChangeCharts,
|
|
47
48
|
createHistory: createHistory,
|
|
48
49
|
});
|
|
50
|
+
var handleMoveChartToSheet = (0, use_on_move_chart_to_sheet_1.useOnMoveChartToSheet)({
|
|
51
|
+
onChangeCharts: onChangeCharts,
|
|
52
|
+
onChangeSheets: onChangeSheets !== null && onChangeSheets !== void 0 ? onChangeSheets : noopDispatch,
|
|
53
|
+
onChangeActiveSheet: onChangeActiveSheet,
|
|
54
|
+
createHistory: createHistory,
|
|
55
|
+
idCreationStrategy: idCreationStrategy,
|
|
56
|
+
generatedNames: generatedNames,
|
|
57
|
+
});
|
|
58
|
+
var onMoveChartToSheet = onChangeSheets ? handleMoveChartToSheet : undefined;
|
|
49
59
|
var onCreateChart = (0, use_on_create_chart_1.useOnCreateChart)({
|
|
50
60
|
onChangeCharts: onChangeCharts,
|
|
51
61
|
createHistory: createHistory,
|
|
@@ -60,8 +70,10 @@ var useCharts = function (_a) {
|
|
|
60
70
|
onCreateChart: onCreateChart,
|
|
61
71
|
onDeleteChart: onDeleteChart,
|
|
62
72
|
onMoveChart: onMoveChart,
|
|
73
|
+
onMoveChartToSheet: onMoveChartToSheet,
|
|
63
74
|
onResizeChart: onResizeChart,
|
|
64
75
|
onUpdateChart: onUpdateChart,
|
|
65
76
|
};
|
|
66
77
|
};
|
|
67
78
|
exports.useCharts = useCharts;
|
|
79
|
+
var noopDispatch = function () { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-on-create-chart.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-create-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,KAAK,QAAQ,EACb,mBAAmB,EACnB,aAAa,
|
|
1
|
+
{"version":3,"file":"use-on-create-chart.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-create-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,KAAK,QAAQ,EACb,mBAAmB,EACnB,aAAa,EAEd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,QAAQ,IAAI;IACtD,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;IACvE,iBAAiB,EAAE,UAAU,CAC3B,OAAO,mBAAmB,CAC3B,CAAC,mBAAmB,CAAC,CAAC;IACvB,iBAAiB,EAAE,UAAU,CAC3B,OAAO,mBAAmB,CAC3B,CAAC,mBAAmB,CAAC,CAAC;IACvB,kBAAkB,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,QAAQ,EAAE,8FAMlD,qBAAqB,CAAC,CAAC,CAAC,eAIZ,MAAM,cACH,aAAa,cACb,aAAa,CAAC,mBAAmB,CAAC,EAAE,cACpC,aAAa,kBAsB9B,CAAC"}
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOnCreateChart = void 0;
|
|
4
|
+
var spreadsheet_1 = require("@rowsncolumns/spreadsheet");
|
|
4
5
|
var react_1 = require("react");
|
|
5
6
|
var create_chart_1 = require("../interface/create-chart");
|
|
6
7
|
var useOnCreateChart = function (_a) {
|
|
7
8
|
var onChangeCharts = _a.onChangeCharts, getFormattedValue = _a.getFormattedValue, getEffectiveValue = _a.getEffectiveValue, createHistory = _a.createHistory, idCreationStrategy = _a.idCreationStrategy;
|
|
9
|
+
var focusEmbedOrChart = (0, spreadsheet_1.useFocusEmbedOrChart)();
|
|
8
10
|
return (0, react_1.useCallback)(function (sheetId, activeCell, selections, chartSpec) {
|
|
9
|
-
|
|
11
|
+
var chart = (0, create_chart_1.createChart)({
|
|
10
12
|
onChangeCharts: onChangeCharts,
|
|
11
13
|
getFormattedValue: getFormattedValue,
|
|
12
14
|
getEffectiveValue: getEffectiveValue,
|
|
13
15
|
createHistory: createHistory,
|
|
14
16
|
idCreationStrategy: idCreationStrategy,
|
|
15
17
|
})(sheetId, activeCell, selections, chartSpec);
|
|
18
|
+
// Excel selects a freshly inserted chart.
|
|
19
|
+
focusEmbedOrChart(chart.chartId);
|
|
20
|
+
return chart;
|
|
16
21
|
}, [
|
|
17
22
|
onChangeCharts,
|
|
18
23
|
getFormattedValue,
|
|
19
24
|
getEffectiveValue,
|
|
20
25
|
createHistory,
|
|
21
26
|
idCreationStrategy,
|
|
27
|
+
focusEmbedOrChart,
|
|
22
28
|
]);
|
|
23
29
|
};
|
|
24
30
|
exports.useOnCreateChart = useOnCreateChart;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CellData, EmbeddedChart, MoveChartTarget, Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { GeneratedNames, UseSpreadsheetProps, useSpreadsheetState } from "@rowsncolumns/spreadsheet-state";
|
|
3
|
+
export type UseOnMoveChartToSheetProps<T extends CellData, S extends Sheet = Sheet> = {
|
|
4
|
+
onChangeCharts: UseSpreadsheetProps<T>["onChangeCharts"];
|
|
5
|
+
onChangeSheets: React.Dispatch<React.SetStateAction<S[]>>;
|
|
6
|
+
onChangeActiveSheet?: (sheetId: number) => void;
|
|
7
|
+
createHistory: ReturnType<typeof useSpreadsheetState>["createHistory"];
|
|
8
|
+
idCreationStrategy?: UseSpreadsheetProps<T>["idCreationStrategy"];
|
|
9
|
+
generatedNames?: GeneratedNames;
|
|
10
|
+
};
|
|
11
|
+
export declare const useOnMoveChartToSheet: <T extends CellData, S extends Sheet = Sheet>({ onChangeCharts, onChangeSheets, onChangeActiveSheet, createHistory, idCreationStrategy, generatedNames, }: UseOnMoveChartToSheetProps<T, S>) => (chart: EmbeddedChart, target: MoveChartTarget) => number | undefined;
|
|
12
|
+
//# sourceMappingURL=use-on-move-chart-to-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-on-move-chart-to-sheet.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-chart-to-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAKzC,MAAM,MAAM,0BAA0B,CACpC,CAAC,SAAS,QAAQ,EAClB,CAAC,SAAS,KAAK,GAAG,KAAK,IACrB;IACF,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzD,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;IACvE,kBAAkB,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,CAAC,SAAS,QAAQ,EAClB,CAAC,SAAS,KAAK,GAAG,KAAK,EACvB,6GAOC,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,aAEvB,aAAa,UAAU,eAAe,uBAkBjD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOnMoveChartToSheet = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var move_chart_to_sheet_1 = require("../interface/move-chart-to-sheet");
|
|
6
|
+
var useOnMoveChartToSheet = function (_a) {
|
|
7
|
+
var onChangeCharts = _a.onChangeCharts, onChangeSheets = _a.onChangeSheets, onChangeActiveSheet = _a.onChangeActiveSheet, createHistory = _a.createHistory, idCreationStrategy = _a.idCreationStrategy, generatedNames = _a.generatedNames;
|
|
8
|
+
return (0, react_1.useCallback)(function (chart, target) {
|
|
9
|
+
return (0, move_chart_to_sheet_1.moveChartToSheet)({
|
|
10
|
+
onChangeCharts: onChangeCharts,
|
|
11
|
+
onChangeSheets: onChangeSheets,
|
|
12
|
+
onChangeActiveSheet: onChangeActiveSheet,
|
|
13
|
+
createHistory: createHistory,
|
|
14
|
+
idCreationStrategy: idCreationStrategy,
|
|
15
|
+
generatedNames: generatedNames,
|
|
16
|
+
})(chart, target);
|
|
17
|
+
}, [
|
|
18
|
+
onChangeCharts,
|
|
19
|
+
onChangeSheets,
|
|
20
|
+
onChangeActiveSheet,
|
|
21
|
+
createHistory,
|
|
22
|
+
idCreationStrategy,
|
|
23
|
+
generatedNames,
|
|
24
|
+
]);
|
|
25
|
+
};
|
|
26
|
+
exports.useOnMoveChartToSheet = useOnMoveChartToSheet;
|
|
@@ -4,5 +4,5 @@ export type UseOnMoveChartProps<T extends CellData> = {
|
|
|
4
4
|
onChangeCharts: UseSpreadsheetProps<T>["onChangeCharts"];
|
|
5
5
|
createHistory: ReturnType<typeof useSpreadsheetState>["createHistory"];
|
|
6
6
|
};
|
|
7
|
-
export declare const useOnMoveChart: <T extends CellData>({ onChangeCharts, createHistory, }: UseOnMoveChartProps<T>) => (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number) => void;
|
|
7
|
+
export declare const useOnMoveChart: <T extends CellData>({ onChangeCharts, createHistory, }: UseOnMoveChartProps<T>) => (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number, toAnchor?: import("@rowsncolumns/spreadsheet").OverlayToAnchor) => void;
|
|
8
8
|
//# sourceMappingURL=use-on-move-chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-on-move-chart.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAKzC,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,QAAQ,IAAI;IACpD,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,oCAGhD,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"use-on-move-chart.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-move-chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAKzC,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,QAAQ,IAAI;IACpD,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,QAAQ,EAAE,oCAGhD,mBAAmB,CAAC,CAAC,CAAC,6MAUxB,CAAC"}
|
|
@@ -5,11 +5,11 @@ var react_1 = require("react");
|
|
|
5
5
|
var move_chart_1 = require("../interface/move-chart");
|
|
6
6
|
var useOnMoveChart = function (_a) {
|
|
7
7
|
var onChangeCharts = _a.onChangeCharts, createHistory = _a.createHistory;
|
|
8
|
-
return (0, react_1.useCallback)(function (chartId, anchorCell, offsetXPixels, offsetYPixels) {
|
|
8
|
+
return (0, react_1.useCallback)(function (chartId, anchorCell, offsetXPixels, offsetYPixels, toAnchor) {
|
|
9
9
|
(0, move_chart_1.moveChart)({
|
|
10
10
|
onChangeCharts: onChangeCharts,
|
|
11
11
|
createHistory: createHistory,
|
|
12
|
-
})(chartId, anchorCell, offsetXPixels, offsetYPixels);
|
|
12
|
+
})(chartId, anchorCell, offsetXPixels, offsetYPixels, toAnchor);
|
|
13
13
|
}, [onChangeCharts, createHistory]);
|
|
14
14
|
};
|
|
15
15
|
exports.useOnMoveChart = useOnMoveChart;
|
|
@@ -4,5 +4,5 @@ export type UseOnResizeChartProps<T extends CellData> = {
|
|
|
4
4
|
onChangeCharts: UseSpreadsheetProps<T>["onChangeCharts"];
|
|
5
5
|
createHistory: ReturnType<typeof useSpreadsheetState>["createHistory"];
|
|
6
6
|
};
|
|
7
|
-
export declare const useOnResizeChart: <T extends CellData>({ onChangeCharts, createHistory, }: UseOnResizeChartProps<T>) => (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number, width: number, height: number) => void;
|
|
7
|
+
export declare const useOnResizeChart: <T extends CellData>({ onChangeCharts, createHistory, }: UseOnResizeChartProps<T>) => (chartId: string | number, anchorCell: import("@rowsncolumns/grid").CellInterface, offsetXPixels: number, offsetYPixels: number, width: number, height: number, toAnchor?: import("@rowsncolumns/spreadsheet").OverlayToAnchor) => void;
|
|
8
8
|
//# sourceMappingURL=use-on-resize-chart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-on-resize-chart.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-resize-chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAKzC,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,QAAQ,IAAI;IACtD,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,QAAQ,EAAE,oCAGlD,qBAAqB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"use-on-resize-chart.d.ts","sourceRoot":"","sources":["../../../hooks/use-on-resize-chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAKzC,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,QAAQ,IAAI;IACtD,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzD,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,QAAQ,EAAE,oCAGlD,qBAAqB,CAAC,CAAC,CAAC,4OA0B1B,CAAC"}
|
|
@@ -5,11 +5,11 @@ var react_1 = require("react");
|
|
|
5
5
|
var resize_chart_1 = require("../interface/resize-chart");
|
|
6
6
|
var useOnResizeChart = function (_a) {
|
|
7
7
|
var onChangeCharts = _a.onChangeCharts, createHistory = _a.createHistory;
|
|
8
|
-
return (0, react_1.useCallback)(function (chartId, anchorCell, offsetXPixels, offsetYPixels, width, height) {
|
|
8
|
+
return (0, react_1.useCallback)(function (chartId, anchorCell, offsetXPixels, offsetYPixels, width, height, toAnchor) {
|
|
9
9
|
(0, resize_chart_1.resizeChart)({
|
|
10
10
|
onChangeCharts: onChangeCharts,
|
|
11
11
|
createHistory: createHistory,
|
|
12
|
-
})(chartId, anchorCell, offsetXPixels, offsetYPixels, width, height);
|
|
12
|
+
})(chartId, anchorCell, offsetXPixels, offsetYPixels, width, height, toAnchor);
|
|
13
13
|
}, [onChangeCharts, createHistory]);
|
|
14
14
|
};
|
|
15
15
|
exports.useOnResizeChart = useOnResizeChart;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -2,11 +2,22 @@ export * from "./hooks/use-charts";
|
|
|
2
2
|
export * from "./components/dialogs/chart-editor-dialog";
|
|
3
3
|
export * from "./components/editors/chart-editor";
|
|
4
4
|
export * from "./basic-chart";
|
|
5
|
+
export { canSwitchRowColumn, deriveChartSeriesFromRange, inferSeriesOrientation, pickSeriesOrientationForRange, switchRowColumn, } from "./utils/chart-orientation";
|
|
6
|
+
export type { ChartCellLabelGetter, SeriesOrientation, } from "./utils/chart-orientation";
|
|
7
|
+
export { applyEmptyCellsPolicy, connectsAcrossEmptyCells, getEmptyCellsPolicy, } from "./utils/empty-cells";
|
|
8
|
+
export type { EmptyCellsPolicy } from "./utils/empty-cells";
|
|
5
9
|
export { registerChartGeoMap } from "./utils/region-map-loader";
|
|
6
10
|
export * from "./interface/create-chart";
|
|
7
11
|
export * from "./interface/delete-chart";
|
|
8
12
|
export * from "./interface/move-chart";
|
|
13
|
+
export * from "./interface/move-chart-to-sheet";
|
|
14
|
+
export * from "./hooks/use-on-move-chart-to-sheet";
|
|
9
15
|
export * from "./interface/resize-chart";
|
|
10
16
|
export * from "./interface/shift-chart-ranges";
|
|
11
17
|
export * from "./interface/update-chart";
|
|
18
|
+
export { applyChartColorPalette, applyChartQuickLayout, applyChartStyle, CHART_COLOR_PALETTES, CHART_QUICK_LAYOUTS, CHART_STYLES, getChartPalette, resetChartToMatchStyle, } from "./utils/chart-styles";
|
|
19
|
+
export type { ChartColorPalette, ChartQuickLayout, ChartStylePreset, } from "./utils/chart-styles";
|
|
20
|
+
export * from "./components/dialogs/pivot-chart-dialog";
|
|
21
|
+
export { pivotChartRequestAtom, usePivotChartRequest, useSetPivotChartRequest, } from "./atoms/pivot-chart.atom";
|
|
22
|
+
export type { PivotChartRequest } from "./atoms/pivot-chart.atom";
|
|
12
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAI9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAI9B,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC7B,eAAe,GAChB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AAKzC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAI9B,cAAc,yCAAyC,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerChartGeoMap = void 0;
|
|
3
|
+
exports.useSetPivotChartRequest = exports.usePivotChartRequest = exports.pivotChartRequestAtom = exports.resetChartToMatchStyle = exports.getChartPalette = exports.CHART_STYLES = exports.CHART_QUICK_LAYOUTS = exports.CHART_COLOR_PALETTES = exports.applyChartStyle = exports.applyChartQuickLayout = exports.applyChartColorPalette = exports.registerChartGeoMap = exports.getEmptyCellsPolicy = exports.connectsAcrossEmptyCells = exports.applyEmptyCellsPolicy = exports.switchRowColumn = exports.pickSeriesOrientationForRange = exports.inferSeriesOrientation = exports.deriveChartSeriesFromRange = exports.canSwitchRowColumn = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./hooks/use-charts"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./components/dialogs/chart-editor-dialog"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./components/editors/chart-editor"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./basic-chart"), exports);
|
|
9
|
+
// Series orientation (Excel's Switch Row/Column) and the "Hidden and
|
|
10
|
+
// Empty Cells" policy — pure spec utilities hosts can drive themselves.
|
|
11
|
+
var chart_orientation_1 = require("./utils/chart-orientation");
|
|
12
|
+
Object.defineProperty(exports, "canSwitchRowColumn", { enumerable: true, get: function () { return chart_orientation_1.canSwitchRowColumn; } });
|
|
13
|
+
Object.defineProperty(exports, "deriveChartSeriesFromRange", { enumerable: true, get: function () { return chart_orientation_1.deriveChartSeriesFromRange; } });
|
|
14
|
+
Object.defineProperty(exports, "inferSeriesOrientation", { enumerable: true, get: function () { return chart_orientation_1.inferSeriesOrientation; } });
|
|
15
|
+
Object.defineProperty(exports, "pickSeriesOrientationForRange", { enumerable: true, get: function () { return chart_orientation_1.pickSeriesOrientationForRange; } });
|
|
16
|
+
Object.defineProperty(exports, "switchRowColumn", { enumerable: true, get: function () { return chart_orientation_1.switchRowColumn; } });
|
|
17
|
+
var empty_cells_1 = require("./utils/empty-cells");
|
|
18
|
+
Object.defineProperty(exports, "applyEmptyCellsPolicy", { enumerable: true, get: function () { return empty_cells_1.applyEmptyCellsPolicy; } });
|
|
19
|
+
Object.defineProperty(exports, "connectsAcrossEmptyCells", { enumerable: true, get: function () { return empty_cells_1.connectsAcrossEmptyCells; } });
|
|
20
|
+
Object.defineProperty(exports, "getEmptyCellsPolicy", { enumerable: true, get: function () { return empty_cells_1.getEmptyCellsPolicy; } });
|
|
9
21
|
// Region-map (filled map / choropleth) host API — register additional
|
|
10
22
|
// geo scopes (e.g. a US-states GeoJSON) for `chartType: "regionMap"`.
|
|
11
23
|
var region_map_loader_1 = require("./utils/region-map-loader");
|
|
@@ -14,6 +26,27 @@ Object.defineProperty(exports, "registerChartGeoMap", { enumerable: true, get: f
|
|
|
14
26
|
tslib_1.__exportStar(require("./interface/create-chart"), exports);
|
|
15
27
|
tslib_1.__exportStar(require("./interface/delete-chart"), exports);
|
|
16
28
|
tslib_1.__exportStar(require("./interface/move-chart"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./interface/move-chart-to-sheet"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./hooks/use-on-move-chart-to-sheet"), exports);
|
|
17
31
|
tslib_1.__exportStar(require("./interface/resize-chart"), exports);
|
|
18
32
|
tslib_1.__exportStar(require("./interface/shift-chart-ranges"), exports);
|
|
19
33
|
tslib_1.__exportStar(require("./interface/update-chart"), exports);
|
|
34
|
+
// Excel's Chart Design tab as spec transforms — Chart Styles, Change
|
|
35
|
+
// Colors, Quick Layouts, Reset to Match Style — and the palette both
|
|
36
|
+
// renderers resolve series colours through.
|
|
37
|
+
var chart_styles_1 = require("./utils/chart-styles");
|
|
38
|
+
Object.defineProperty(exports, "applyChartColorPalette", { enumerable: true, get: function () { return chart_styles_1.applyChartColorPalette; } });
|
|
39
|
+
Object.defineProperty(exports, "applyChartQuickLayout", { enumerable: true, get: function () { return chart_styles_1.applyChartQuickLayout; } });
|
|
40
|
+
Object.defineProperty(exports, "applyChartStyle", { enumerable: true, get: function () { return chart_styles_1.applyChartStyle; } });
|
|
41
|
+
Object.defineProperty(exports, "CHART_COLOR_PALETTES", { enumerable: true, get: function () { return chart_styles_1.CHART_COLOR_PALETTES; } });
|
|
42
|
+
Object.defineProperty(exports, "CHART_QUICK_LAYOUTS", { enumerable: true, get: function () { return chart_styles_1.CHART_QUICK_LAYOUTS; } });
|
|
43
|
+
Object.defineProperty(exports, "CHART_STYLES", { enumerable: true, get: function () { return chart_styles_1.CHART_STYLES; } });
|
|
44
|
+
Object.defineProperty(exports, "getChartPalette", { enumerable: true, get: function () { return chart_styles_1.getChartPalette; } });
|
|
45
|
+
Object.defineProperty(exports, "resetChartToMatchStyle", { enumerable: true, get: function () { return chart_styles_1.resetChartToMatchStyle; } });
|
|
46
|
+
// Excel's Insert → PivotChart: the pick-a-pivot dialog and the request atom
|
|
47
|
+
// hosts drive it with (#668 C-23).
|
|
48
|
+
tslib_1.__exportStar(require("./components/dialogs/pivot-chart-dialog"), exports);
|
|
49
|
+
var pivot_chart_atom_1 = require("./atoms/pivot-chart.atom");
|
|
50
|
+
Object.defineProperty(exports, "pivotChartRequestAtom", { enumerable: true, get: function () { return pivot_chart_atom_1.pivotChartRequestAtom; } });
|
|
51
|
+
Object.defineProperty(exports, "usePivotChartRequest", { enumerable: true, get: function () { return pivot_chart_atom_1.usePivotChartRequest; } });
|
|
52
|
+
Object.defineProperty(exports, "useSetPivotChartRequest", { enumerable: true, get: function () { return pivot_chart_atom_1.useSetPivotChartRequest; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-chart.d.ts","sourceRoot":"","sources":["../../../interface/create-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,KAAK,QAAQ,EACb,mBAAmB,EACnB,aAAa,EAKd,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"create-chart.d.ts","sourceRoot":"","sources":["../../../interface/create-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,KAAK,QAAQ,EACb,mBAAmB,EACnB,aAAa,EAKd,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAiB1E;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,GAAG,SAAS,EAC5B,UAAU,MAAM,KACf,MAAkF,CAAC;AAEtF,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EAAE,8FAM7C,qBAAqB,CAAC,CAAC,CAAC,MAEvB,SAAS,MAAM,EACf,YAAY,aAAa,EACzB,YAAY,aAAa,CAAC,mBAAmB,CAAC,EAAE,EAChD,YAAY,aAAa,kBAuH5B,CAAC"}
|