@rowsncolumns/charts 28.1.17 → 28.1.19
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/Readme.md +18 -1
- 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 +371 -242
- package/dist/cjs/basic-chart/helpers.d.ts +7 -3
- package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/basic-chart/helpers.js +30 -4
- package/dist/cjs/basic-chart/index.d.ts +7 -0
- package/dist/cjs/basic-chart/index.d.ts.map +1 -1
- package/dist/cjs/basic-chart/index.js +19 -2
- package/dist/cjs/components/editors/chart-editor.d.ts +7 -1
- package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +24 -14
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts +6 -3
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts.map +1 -1
- package/dist/cjs/components/editors/fields/axis-options-fields.js +69 -7
- package/dist/cjs/components/editors/fields/chart-elements-fields.d.ts +15 -0
- package/dist/cjs/components/editors/fields/chart-elements-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/chart-elements-fields.js +23 -0
- package/dist/cjs/components/editors/fields/series-format-fields.d.ts.map +1 -1
- package/dist/cjs/components/editors/fields/series-format-fields.js +16 -2
- package/dist/cjs/config.d.ts +10 -0
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +45 -10
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +10 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/utils/chart-lines.d.ts +36 -0
- package/dist/cjs/utils/chart-lines.d.ts.map +1 -0
- package/dist/cjs/utils/chart-lines.js +111 -0
- package/dist/cjs/utils/data-table.d.ts +31 -0
- package/dist/cjs/utils/data-table.d.ts.map +1 -0
- package/dist/cjs/utils/data-table.js +61 -0
- package/dist/cjs/utils/echarts-gl-loader.d.ts +6 -0
- package/dist/cjs/utils/echarts-gl-loader.d.ts.map +1 -1
- package/dist/cjs/utils/echarts-gl-loader.js +42 -1
- package/dist/cjs/utils/excel-axis-scale.d.ts +35 -0
- package/dist/cjs/utils/excel-axis-scale.d.ts.map +1 -0
- package/dist/cjs/utils/excel-axis-scale.js +210 -0
- package/dist/cjs/utils/overrides.d.ts +24 -3
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +119 -14
- package/dist/cjs/utils/three-d.d.ts +12 -1
- package/dist/cjs/utils/three-d.d.ts.map +1 -1
- package/dist/cjs/utils/three-d.js +4 -1
- 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 +237 -73
- package/dist/esm/basic-chart/helpers.d.ts +7 -3
- package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/basic-chart/helpers.js +26 -3
- package/dist/esm/basic-chart/index.d.ts +7 -0
- package/dist/esm/basic-chart/index.d.ts.map +1 -1
- package/dist/esm/basic-chart/index.js +15 -1
- package/dist/esm/components/editors/chart-editor.d.ts +7 -1
- package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +16 -4
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts +6 -3
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts.map +1 -1
- package/dist/esm/components/editors/fields/axis-options-fields.js +56 -5
- package/dist/esm/components/editors/fields/chart-elements-fields.d.ts +15 -0
- package/dist/esm/components/editors/fields/chart-elements-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/chart-elements-fields.js +17 -0
- package/dist/esm/components/editors/fields/series-format-fields.d.ts.map +1 -1
- package/dist/esm/components/editors/fields/series-format-fields.js +9 -1
- package/dist/esm/config.d.ts +10 -0
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +20 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +10 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils/chart-lines.d.ts +36 -0
- package/dist/esm/utils/chart-lines.d.ts.map +1 -0
- package/dist/esm/utils/chart-lines.js +121 -0
- package/dist/esm/utils/data-table.d.ts +31 -0
- package/dist/esm/utils/data-table.d.ts.map +1 -0
- package/dist/esm/utils/data-table.js +48 -0
- package/dist/esm/utils/echarts-gl-loader.d.ts +6 -0
- package/dist/esm/utils/echarts-gl-loader.d.ts.map +1 -1
- package/dist/esm/utils/echarts-gl-loader.js +40 -0
- package/dist/esm/utils/excel-axis-scale.d.ts +35 -0
- package/dist/esm/utils/excel-axis-scale.d.ts.map +1 -0
- package/dist/esm/utils/excel-axis-scale.js +122 -0
- package/dist/esm/utils/overrides.d.ts +24 -3
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +111 -10
- package/dist/esm/utils/three-d.d.ts +12 -1
- package/dist/esm/utils/three-d.d.ts.map +1 -1
- package/dist/esm/utils/three-d.js +4 -1
- package/package.json +7 -7
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { EmbeddedChart } from "@rowsncolumns/spreadsheet";
|
|
2
2
|
export declare const chartTypeToEchartsType: (type: EmbeddedChart["spec"]["chartType"]) => "bar" | "line" | "pie" | "radar" | "boxplot" | "funnel" | "treemap" | "sunburst" | "scatter" | "map";
|
|
3
|
+
export declare const mapMarkerSymbolToEcharts: (symbol: string | undefined | null) => string | undefined;
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* The marker Excel draws for a "Line with Markers" series that names no
|
|
6
|
+
* symbol of its own (`<c:lineChart><c:marker val="1"/>` with no
|
|
7
|
+
* `<c:ser><c:marker>`): the automatic cycle by series index — diamond,
|
|
8
|
+
* square, triangle, x, star, circle, plus (LV-05).
|
|
6
9
|
*/
|
|
7
|
-
export declare const
|
|
10
|
+
export declare const EXCEL_AUTOMATIC_MARKERS: readonly ["diamond", "square", "triangle", "x", "star", "circle", "plus"];
|
|
11
|
+
export declare const automaticMarkerSymbol: (seriesIndex: number) => "x" | "plus" | "circle" | "square" | "diamond" | "triangle" | "star";
|
|
8
12
|
/** Pie and doughnut — the pie-family types whose points are slices. */
|
|
9
13
|
export declare const isCircularChartType: (type: EmbeddedChart["spec"]["chartType"] | undefined) => boolean;
|
|
10
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../basic-chart/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yGA6DzC,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../basic-chart/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yGA6DzC,CAAC;AAcF,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAChC,MAAM,GAAG,SAqBX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,2EAQ1B,CAAC;AAEX,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,yEAKtD,CAAC;AAEJ,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,GAC9B,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,GAAG,SAAS,KACnD,OAAgD,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,aAAa,CAAC,OAAO,CAAC,KAC7B,MAAM,EAmBR,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;;aASzC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,YAmBjE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.showXAxis = exports.getEchartsSeriesStyle = exports.circularLegendEntries = exports.isCircularChartType = exports.mapMarkerSymbolToEcharts = exports.chartTypeToEchartsType = void 0;
|
|
3
|
+
exports.showXAxis = exports.getEchartsSeriesStyle = exports.circularLegendEntries = exports.isCircularChartType = exports.automaticMarkerSymbol = exports.EXCEL_AUTOMATIC_MARKERS = exports.mapMarkerSymbolToEcharts = exports.chartTypeToEchartsType = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var chartTypeToEchartsType = function (type) {
|
|
6
6
|
switch (type) {
|
|
@@ -55,6 +55,13 @@ exports.chartTypeToEchartsType = chartTypeToEchartsType;
|
|
|
55
55
|
* Map OOXML `<c:marker><c:symbol>` values to echarts symbol names.
|
|
56
56
|
* Returns undefined for "auto" / unknown — caller defaults to "circle".
|
|
57
57
|
*/
|
|
58
|
+
/** Excel's x / plus / asterisk / dash markers as echarts path symbols (filled outlines). */
|
|
59
|
+
var MARKER_PATHS = {
|
|
60
|
+
x: "path://M2,0L5,3L8,0L10,2L7,5L10,8L8,10L5,7L2,10L0,8L3,5L0,2Z",
|
|
61
|
+
plus: "path://M4,0H6V4H10V6H6V10H4V6H0V4H4Z",
|
|
62
|
+
star: "path://M4.3,0H5.7V3.8L9,1.9L9.7,3.1L6.4,5L9.7,6.9L9,8.1L5.7,6.2V10H4.3V6.2L1,8.1L0.3,6.9L3.6,5L0.3,3.1L1,1.9L4.3,3.8Z",
|
|
63
|
+
dash: "path://M0,4H10V6H0Z",
|
|
64
|
+
};
|
|
58
65
|
var mapMarkerSymbolToEcharts = function (symbol) {
|
|
59
66
|
switch (symbol) {
|
|
60
67
|
case "circle":
|
|
@@ -68,11 +75,9 @@ var mapMarkerSymbolToEcharts = function (symbol) {
|
|
|
68
75
|
return "triangle";
|
|
69
76
|
case "x":
|
|
70
77
|
case "plus":
|
|
71
|
-
return "pin";
|
|
72
78
|
case "star":
|
|
73
|
-
return "diamond";
|
|
74
79
|
case "dash":
|
|
75
|
-
return
|
|
80
|
+
return MARKER_PATHS[symbol];
|
|
76
81
|
case "none":
|
|
77
82
|
return "none";
|
|
78
83
|
default:
|
|
@@ -80,6 +85,27 @@ var mapMarkerSymbolToEcharts = function (symbol) {
|
|
|
80
85
|
}
|
|
81
86
|
};
|
|
82
87
|
exports.mapMarkerSymbolToEcharts = mapMarkerSymbolToEcharts;
|
|
88
|
+
/**
|
|
89
|
+
* The marker Excel draws for a "Line with Markers" series that names no
|
|
90
|
+
* symbol of its own (`<c:lineChart><c:marker val="1"/>` with no
|
|
91
|
+
* `<c:ser><c:marker>`): the automatic cycle by series index — diamond,
|
|
92
|
+
* square, triangle, x, star, circle, plus (LV-05).
|
|
93
|
+
*/
|
|
94
|
+
exports.EXCEL_AUTOMATIC_MARKERS = [
|
|
95
|
+
"diamond",
|
|
96
|
+
"square",
|
|
97
|
+
"triangle",
|
|
98
|
+
"x",
|
|
99
|
+
"star",
|
|
100
|
+
"circle",
|
|
101
|
+
"plus",
|
|
102
|
+
];
|
|
103
|
+
var automaticMarkerSymbol = function (seriesIndex) {
|
|
104
|
+
return exports.EXCEL_AUTOMATIC_MARKERS[((seriesIndex % exports.EXCEL_AUTOMATIC_MARKERS.length) +
|
|
105
|
+
exports.EXCEL_AUTOMATIC_MARKERS.length) %
|
|
106
|
+
exports.EXCEL_AUTOMATIC_MARKERS.length];
|
|
107
|
+
};
|
|
108
|
+
exports.automaticMarkerSymbol = automaticMarkerSymbol;
|
|
83
109
|
/** Pie and doughnut — the pie-family types whose points are slices. */
|
|
84
110
|
var isCircularChartType = function (type) { return type === "pie" || type === "doughnut"; };
|
|
85
111
|
exports.isCircularChartType = isCircularChartType;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { EChartComponentProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Excel's chart area outline: a thin Text 1 at 15% line (#D9D9D9), no drop
|
|
5
|
+
* shadow (LV-05). A chart with its own Format Chart Area border
|
|
6
|
+
* (`EmbeddedChart.borderColor`) is outlined by the grid's embed frame
|
|
7
|
+
* instead, so it gets none here.
|
|
8
|
+
*/
|
|
9
|
+
export declare const chartFrameBorder: (chart: EChartComponentProps["chart"], isDarkMode?: boolean) => string | undefined;
|
|
3
10
|
export declare const ChartComponent: (props: EChartComponentProps) => React.JSX.Element;
|
|
4
11
|
export default ChartComponent;
|
|
5
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../basic-chart/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,cAAc,GAAI,OAAO,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../basic-chart/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,oBAAoB,CAAC,OAAO,CAAC,EACpC,aAAa,OAAO,KACnB,MAAM,GAAG,SAGyD,CAAC;AAEtE,eAAO,MAAM,cAAc,GAAI,OAAO,oBAAoB,sBAazD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChartComponent = void 0;
|
|
3
|
+
exports.ChartComponent = exports.chartFrameBorder = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
var basic_chart_1 = require("./basic-chart");
|
|
7
|
+
/**
|
|
8
|
+
* Excel's chart area outline: a thin Text 1 at 15% line (#D9D9D9), no drop
|
|
9
|
+
* shadow (LV-05). A chart with its own Format Chart Area border
|
|
10
|
+
* (`EmbeddedChart.borderColor`) is outlined by the grid's embed frame
|
|
11
|
+
* instead, so it gets none here.
|
|
12
|
+
*/
|
|
13
|
+
var chartFrameBorder = function (chart, isDarkMode) {
|
|
14
|
+
return (chart === null || chart === void 0 ? void 0 : chart.borderColor)
|
|
15
|
+
? undefined
|
|
16
|
+
: "1px solid ".concat(isDarkMode ? "rgba(255,255,255,0.2)" : "#D9D9D9");
|
|
17
|
+
};
|
|
18
|
+
exports.chartFrameBorder = chartFrameBorder;
|
|
7
19
|
var ChartComponent = function (props) {
|
|
8
|
-
return (react_1.default.createElement("div", { className: "
|
|
20
|
+
return (react_1.default.createElement("div", { className: "bg-rnc-background flex-1 flex break-words flex-col",
|
|
21
|
+
// An inset outline: drawn over the plot's edge without shrinking it.
|
|
22
|
+
style: {
|
|
23
|
+
outline: (0, exports.chartFrameBorder)(props.chart, props.isDarkMode),
|
|
24
|
+
outlineOffset: -1,
|
|
25
|
+
} },
|
|
9
26
|
react_1.default.createElement(basic_chart_1.BasicChart, tslib_1.__assign({}, props))));
|
|
10
27
|
};
|
|
11
28
|
exports.ChartComponent = ChartComponent;
|
|
@@ -16,7 +16,13 @@ type ChartEditorProps = {
|
|
|
16
16
|
* from the data range. Without it the switched series are unnamed.
|
|
17
17
|
*/
|
|
18
18
|
getFormattedValue?: ChartCellLabelGetter;
|
|
19
|
+
/**
|
|
20
|
+
* Mirror of the renderer's `enable3D`: `false` hides the presets that
|
|
21
|
+
* render through echarts-gl (3-D Column / Bar / Line / Area / Surface).
|
|
22
|
+
* An existing 3-D spec keeps its `sourceChartType`. Default `true`.
|
|
23
|
+
*/
|
|
24
|
+
enable3D?: boolean;
|
|
19
25
|
};
|
|
20
|
-
export declare const ChartEditor: ({ chart, sheetId, onSubmit, onRequestMoveChart, getFormattedValue, }: ChartEditorProps) => React.JSX.Element;
|
|
26
|
+
export declare const ChartEditor: ({ chart, sheetId, onSubmit, onRequestMoveChart, getFormattedValue, enable3D, }: ChartEditorProps) => React.JSX.Element;
|
|
21
27
|
export default ChartEditor;
|
|
22
28
|
//# sourceMappingURL=chart-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-editor.d.ts","sourceRoot":"","sources":["../../../../components/editors/chart-editor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,2BAA2B,CAAC;AAwBnC,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-editor.d.ts","sourceRoot":"","sources":["../../../../components/editors/chart-editor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,2BAA2B,CAAC;AAwBnC,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,+BAA+B,CAAC;AAwDvC,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC;;;;OAIG;IACH,kBAAkB,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAChD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAuBF,eAAO,MAAM,WAAW,GAAI,gFAOzB,gBAAgB,sBAujClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -18,6 +18,7 @@ var chart_styles_1 = require("../../utils/chart-styles");
|
|
|
18
18
|
var chart_editor_capabilities_1 = require("./chart-editor-capabilities");
|
|
19
19
|
var chart_range_input_1 = require("./chart-range-input");
|
|
20
20
|
var axis_options_fields_1 = require("./fields/axis-options-fields");
|
|
21
|
+
var chart_elements_fields_1 = require("./fields/chart-elements-fields");
|
|
21
22
|
var chart_type_options_1 = require("./fields/chart-type-options");
|
|
22
23
|
var data_labels_fields_1 = require("./fields/data-labels-fields");
|
|
23
24
|
var series_format_fields_1 = require("./fields/series-format-fields");
|
|
@@ -55,9 +56,10 @@ var Section = function (_a) {
|
|
|
55
56
|
react_1.default.createElement("div", { className: "flex flex-col gap-2 pb-3" }, children)));
|
|
56
57
|
};
|
|
57
58
|
var ChartEditor = function (_a) {
|
|
58
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
59
|
-
var chart = _a.chart, sheetId = _a.sheetId, onSubmit = _a.onSubmit, onRequestMoveChart = _a.onRequestMoveChart, getFormattedValue = _a.getFormattedValue;
|
|
59
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
60
|
+
var chart = _a.chart, sheetId = _a.sheetId, onSubmit = _a.onSubmit, onRequestMoveChart = _a.onRequestMoveChart, getFormattedValue = _a.getFormattedValue, enable3D = _a.enable3D;
|
|
60
61
|
var setChartDialogState = (0, editing_chart_atom_1.useSetChartEditorDialogState)();
|
|
62
|
+
var chartTypes = (0, config_1.getChartTypes)({ enable3D: enable3D });
|
|
61
63
|
// Close dialog
|
|
62
64
|
var closeDialog = function () { return setChartDialogState(false); };
|
|
63
65
|
// Keyed on chart identity so a position sync (move/resize while the
|
|
@@ -75,7 +77,7 @@ var ChartEditor = function (_a) {
|
|
|
75
77
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
78
|
[chart === null || chart === void 0 ? void 0 : chart.chartId]);
|
|
77
79
|
// Formik
|
|
78
|
-
var
|
|
80
|
+
var _2 = (0, formik_1.useFormik)({
|
|
79
81
|
initialValues: initialValues,
|
|
80
82
|
enableReinitialize: true,
|
|
81
83
|
onSubmit: function (values) {
|
|
@@ -87,7 +89,7 @@ var ChartEditor = function (_a) {
|
|
|
87
89
|
// Close dialog
|
|
88
90
|
closeDialog();
|
|
89
91
|
},
|
|
90
|
-
}), handleSubmit =
|
|
92
|
+
}), handleSubmit = _2.handleSubmit, setFieldValue = _2.setFieldValue, resetForm = _2.resetForm, values = _2.values;
|
|
91
93
|
var onCancelForm = function () {
|
|
92
94
|
resetForm();
|
|
93
95
|
closeDialog();
|
|
@@ -232,7 +234,7 @@ var ChartEditor = function (_a) {
|
|
|
232
234
|
react_1.default.createElement(ui_1.DropdownRightSlot, null,
|
|
233
235
|
react_1.default.createElement(icons_1.TriangleDownIcon, null)))),
|
|
234
236
|
react_1.default.createElement(ui_1.DropdownMenuPortal, null,
|
|
235
|
-
react_1.default.createElement(ui_1.DropdownMenuContent, { align: "start", sideOffset: 0 },
|
|
237
|
+
react_1.default.createElement(ui_1.DropdownMenuContent, { align: "start", sideOffset: 0 }, chartTypes.map(function (_a) {
|
|
236
238
|
var _b = tslib_1.__read(_a, 2), category = _b[0], types = _b[1];
|
|
237
239
|
return (react_1.default.createElement(ui_1.DropdownMenuSub, { key: category },
|
|
238
240
|
react_1.default.createElement(ui_1.DropdownMenuSubTrigger, null,
|
|
@@ -339,10 +341,15 @@ var ChartEditor = function (_a) {
|
|
|
339
341
|
react_1.default.createElement(Section, { title: "Chart style", defaultOpen: true },
|
|
340
342
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
341
343
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Chart title"),
|
|
342
|
-
react_1.default.createElement(ui_1.Input, { value: (_r = values === null || values === void 0 ? void 0 : values.spec.title) !== null && _r !== void 0 ? _r : "", type: "text", onChange: function (e) { return setFieldValue("spec.title", e.target.value); }, className: "text-xs", placeholder: "Enter chart title" })
|
|
344
|
+
react_1.default.createElement(ui_1.Input, { value: (_r = values === null || values === void 0 ? void 0 : values.spec.title) !== null && _r !== void 0 ? _r : "", type: "text", onChange: function (e) { return setFieldValue("spec.title", e.target.value); }, className: "text-xs", placeholder: "Enter chart title" }),
|
|
345
|
+
react_1.default.createElement("label", { className: "font-system text-xs" }, "Link title to cell"),
|
|
346
|
+
react_1.default.createElement(chart_range_input_1.ChartRangeInput, { sheetId: sheetId, range: (_s = values.spec.titleSource) !== null && _s !== void 0 ? _s : undefined, onChangeRange: function (titleSource) {
|
|
347
|
+
return setFieldValue("spec.titleSource", tslib_1.__assign(tslib_1.__assign({}, titleSource), { endRowIndex: titleSource.startRowIndex, endColumnIndex: titleSource.startColumnIndex }));
|
|
348
|
+
}, placeholder: "Select a cell", className: "mb-0" }),
|
|
349
|
+
values.spec.titleSource ? (react_1.default.createElement("button", { type: "button", className: "font-system text-xs text-rnc-muted-foreground underline self-start", onClick: function () { return setFieldValue("spec.titleSource", undefined); } }, "Unlink title")) : null),
|
|
343
350
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
344
351
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Subtitle"),
|
|
345
|
-
react_1.default.createElement(ui_1.Input, { value: (
|
|
352
|
+
react_1.default.createElement(ui_1.Input, { value: (_t = values.spec.subtitle) !== null && _t !== void 0 ? _t : "", type: "text", onChange: function (e) { return setFieldValue("spec.subtitle", e.target.value || undefined); }, className: "text-xs", placeholder: "Enter chart subtitle", "aria-label": "Chart subtitle" })),
|
|
346
353
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
347
354
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Style"),
|
|
348
355
|
react_1.default.createElement("div", { className: "grid grid-cols-4 gap-1", role: "radiogroup" }, chart_styles_1.CHART_STYLES.map(function (style) {
|
|
@@ -371,7 +378,7 @@ var ChartEditor = function (_a) {
|
|
|
371
378
|
}))),
|
|
372
379
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
373
380
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Quick layout"),
|
|
374
|
-
react_1.default.createElement("select", { className: "border border-rnc-border rounded-sm px-1 py-1 text-xs bg-transparent w-32", value: (
|
|
381
|
+
react_1.default.createElement("select", { className: "border border-rnc-border rounded-sm px-1 py-1 text-xs bg-transparent w-32", value: (_u = values.spec.quickLayout) !== null && _u !== void 0 ? _u : "", "aria-label": "Quick layout", onChange: function (e) {
|
|
375
382
|
var layout = chart_styles_1.CHART_QUICK_LAYOUTS.find(function (entry) { return String(entry.id) === e.target.value; });
|
|
376
383
|
if (layout) {
|
|
377
384
|
setFieldValue("spec", (0, chart_styles_1.applyChartQuickLayout)(values.spec, layout));
|
|
@@ -390,7 +397,7 @@ var ChartEditor = function (_a) {
|
|
|
390
397
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
391
398
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Fill"),
|
|
392
399
|
react_1.default.createElement("div", { className: "flex items-center gap-1" },
|
|
393
|
-
react_1.default.createElement("input", { type: "color", value: (
|
|
400
|
+
react_1.default.createElement("input", { type: "color", value: (_v = values.spec.backgroundColor) !== null && _v !== void 0 ? _v : "#FFFFFF", onChange: function (e) {
|
|
394
401
|
return setFieldValue("spec.backgroundColor", e.target.value);
|
|
395
402
|
}, className: "h-6 w-8 p-0 border border-rnc-border rounded-sm bg-transparent cursor-pointer", "aria-label": "Chart area fill" }),
|
|
396
403
|
values.spec.backgroundColor ? (react_1.default.createElement(ui_1.IconButton, { type: "button", onClick: function () {
|
|
@@ -400,7 +407,7 @@ var ChartEditor = function (_a) {
|
|
|
400
407
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
401
408
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Border"),
|
|
402
409
|
react_1.default.createElement("div", { className: "flex items-center gap-1" },
|
|
403
|
-
react_1.default.createElement("input", { type: "color", value: (
|
|
410
|
+
react_1.default.createElement("input", { type: "color", value: (_w = values.borderColor) !== null && _w !== void 0 ? _w : "#D9D9D9", onChange: function (e) { return setFieldValue("borderColor", e.target.value); }, className: "h-6 w-8 p-0 border border-rnc-border rounded-sm bg-transparent cursor-pointer", "aria-label": "Chart area border" }),
|
|
404
411
|
values.borderColor ? (react_1.default.createElement(ui_1.IconButton, { type: "button", onClick: function () { return setFieldValue("borderColor", undefined); }, "aria-label": "No border", title: "No border" },
|
|
405
412
|
react_1.default.createElement(icons_1.CrossCircledIcon, null))) : (react_1.default.createElement("span", { className: "font-system text-xs text-rnc-text-weak" }, "None")))),
|
|
406
413
|
react_1.default.createElement("label", { className: "font-system text-sm flex items-center gap-1" },
|
|
@@ -411,7 +418,7 @@ var ChartEditor = function (_a) {
|
|
|
411
418
|
caps.hasLegend ? (react_1.default.createElement(Section, { title: "Legend" },
|
|
412
419
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
413
420
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Legend"),
|
|
414
|
-
react_1.default.createElement("select", { className: "border border-rnc-border rounded-sm px-1 py-1 text-xs bg-transparent w-32", "aria-label": "Legend position", value: (
|
|
421
|
+
react_1.default.createElement("select", { className: "border border-rnc-border rounded-sm px-1 py-1 text-xs bg-transparent w-32", "aria-label": "Legend position", value: (_y = (_x = values === null || values === void 0 ? void 0 : values.spec.legend) === null || _x === void 0 ? void 0 : _x.position) !== null && _y !== void 0 ? _y : "", onChange: function (e) {
|
|
415
422
|
return setFieldValue("spec.legend.position", e.target.value || undefined);
|
|
416
423
|
} },
|
|
417
424
|
react_1.default.createElement("option", { value: "" }, "Auto"),
|
|
@@ -421,13 +428,13 @@ var ChartEditor = function (_a) {
|
|
|
421
428
|
react_1.default.createElement("option", { value: "right" }, "Right"),
|
|
422
429
|
react_1.default.createElement("option", { value: "topRight" }, "Top right"),
|
|
423
430
|
react_1.default.createElement("option", { value: "none" }, "None"))),
|
|
424
|
-
react_1.default.createElement(text_format_fields_1.TextFormatFields, { label: "Legend font", collapsible: true, value: (
|
|
431
|
+
react_1.default.createElement(text_format_fields_1.TextFormatFields, { label: "Legend font", collapsible: true, value: (_z = values.spec.legend) === null || _z === void 0 ? void 0 : _z.textFormat, onChange: function (textFormat) {
|
|
425
432
|
return setFieldValue("spec.legend.textFormat", textFormat);
|
|
426
433
|
} }))) : null,
|
|
427
434
|
caps.hasAxisTitles || caps.hasValueAxis ? (react_1.default.createElement(Section, { title: "Vertical axis" },
|
|
428
435
|
caps.hasAxisTitles ? (react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
429
436
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Vertical axis title"),
|
|
430
|
-
react_1.default.createElement(ui_1.Input, { value: (
|
|
437
|
+
react_1.default.createElement(ui_1.Input, { value: (_0 = values === null || values === void 0 ? void 0 : values.spec.verticalAxisTitle) !== null && _0 !== void 0 ? _0 : "", type: "text", onChange: function (e) {
|
|
431
438
|
return setFieldValue("spec.verticalAxisTitle", e.target.value);
|
|
432
439
|
}, className: "text-xs", placeholder: "Vertical axis title" }))) : null,
|
|
433
440
|
caps.hasValueAxis ? (react_1.default.createElement(axis_options_fields_1.AxisOptionsFields, { label: "Value axis", kind: "value", value: values.spec.valueAxisOptions, onChange: function (next) { return setFieldValue("spec.valueAxisOptions", next); } })) : null,
|
|
@@ -438,12 +445,15 @@ var ChartEditor = function (_a) {
|
|
|
438
445
|
caps.hasAxisTitles || caps.hasCategoryAxis ? (react_1.default.createElement(Section, { title: "Horizontal axis" },
|
|
439
446
|
caps.hasAxisTitles ? (react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
440
447
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Horizontal axis title"),
|
|
441
|
-
react_1.default.createElement(ui_1.Input, { value: (
|
|
448
|
+
react_1.default.createElement(ui_1.Input, { value: (_1 = values === null || values === void 0 ? void 0 : values.spec.horizontalAxisTitle) !== null && _1 !== void 0 ? _1 : "", type: "text", onChange: function (e) {
|
|
442
449
|
return setFieldValue("spec.horizontalAxisTitle", e.target.value);
|
|
443
450
|
}, className: "text-xs", placeholder: "Horizontal axis title" }))) : null,
|
|
444
451
|
caps.hasCategoryAxis ? (react_1.default.createElement(axis_options_fields_1.AxisOptionsFields, { label: "Category axis", kind: caps.category === "bubble" ? "value" : "category", value: values.spec.categoryAxisOptions, gridlinesDefault: false, onChange: function (next) {
|
|
445
452
|
return setFieldValue("spec.categoryAxisOptions", next);
|
|
446
453
|
} })) : null)) : null,
|
|
454
|
+
caps.hasValueAxis &&
|
|
455
|
+
["line", "area", "column", "combo"].includes(values.spec.chartType) ? (react_1.default.createElement(Section, { title: "Chart elements" },
|
|
456
|
+
react_1.default.createElement(chart_elements_fields_1.ChartElementsFields, { chartType: values.spec.chartType, spec: values.spec, onChange: function (key, value) { return setFieldValue("spec.".concat(key), value); } }))) : null,
|
|
447
457
|
caps.hasDataLabels ? (react_1.default.createElement(Section, { title: "Data labels" },
|
|
448
458
|
react_1.default.createElement(data_labels_fields_1.DataLabelsFields, { value: values.spec.dataLabels, capabilities: caps, onChange: function (dataLabels) { return setFieldValue("spec.dataLabels", dataLabels); } }))) : null,
|
|
449
459
|
hasTypeOptions ? (react_1.default.createElement(Section, { title: "Chart options" },
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { ChartAxisOptions } from "@rowsncolumns/spreadsheet";
|
|
2
2
|
import React from "react";
|
|
3
3
|
/**
|
|
4
|
-
* One axis' options (`ChartAxisOptions`)
|
|
5
|
-
* (
|
|
6
|
-
* and
|
|
4
|
+
* One axis' options (`ChartAxisOptions`) — Excel's Format Axis pane
|
|
5
|
+
* (demo-app-monorepo#49969 FT-08): a value axis has its bounds, log scale
|
|
6
|
+
* and base, major / minor units, display units and number format; a
|
|
7
|
+
* category axis its label / tick-mark intervals; both have where the other
|
|
8
|
+
* axis crosses, direction, major / minor gridlines, tick marks, visibility
|
|
9
|
+
* and tick-label font.
|
|
7
10
|
*/
|
|
8
11
|
export declare const AxisOptionsFields: ({ label, kind, value, onChange, gridlinesDefault, }: {
|
|
9
12
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis-options-fields.d.ts","sourceRoot":"","sources":["../../../../../components/editors/fields/axis-options-fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"axis-options-fields.d.ts","sourceRoot":"","sources":["../../../../../components/editors/fields/axis-options-fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,MAAM,OAAO,CAAC;AAgC1B;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,qDAM/B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,sBAkNA,CAAC"}
|
|
@@ -5,14 +5,35 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
var primitives_1 = require("./primitives");
|
|
7
7
|
var text_format_fields_1 = require("./text-format-fields");
|
|
8
|
+
var TICK_MARKS = [
|
|
9
|
+
{ value: "none", label: "None" },
|
|
10
|
+
{ value: "in", label: "Inside" },
|
|
11
|
+
{ value: "out", label: "Outside" },
|
|
12
|
+
{ value: "cross", label: "Cross" },
|
|
13
|
+
];
|
|
14
|
+
var DISPLAY_UNIT_OPTIONS = [
|
|
15
|
+
{ value: "", label: "None" },
|
|
16
|
+
{ value: "hundreds", label: "Hundreds" },
|
|
17
|
+
{ value: "thousands", label: "Thousands" },
|
|
18
|
+
{ value: "tenThousands", label: "10000" },
|
|
19
|
+
{ value: "hundredThousands", label: "100000" },
|
|
20
|
+
{ value: "millions", label: "Millions" },
|
|
21
|
+
{ value: "tenMillions", label: "10000000" },
|
|
22
|
+
{ value: "hundredMillions", label: "100000000" },
|
|
23
|
+
{ value: "billions", label: "Billions" },
|
|
24
|
+
{ value: "trillions", label: "Trillions" },
|
|
25
|
+
];
|
|
8
26
|
/**
|
|
9
|
-
* One axis' options (`ChartAxisOptions`)
|
|
10
|
-
* (
|
|
11
|
-
* and
|
|
27
|
+
* One axis' options (`ChartAxisOptions`) — Excel's Format Axis pane
|
|
28
|
+
* (demo-app-monorepo#49969 FT-08): a value axis has its bounds, log scale
|
|
29
|
+
* and base, major / minor units, display units and number format; a
|
|
30
|
+
* category axis its label / tick-mark intervals; both have where the other
|
|
31
|
+
* axis crosses, direction, major / minor gridlines, tick marks, visibility
|
|
32
|
+
* and tick-label font.
|
|
12
33
|
*/
|
|
13
34
|
var AxisOptionsFields = function (_a) {
|
|
14
|
-
var _b;
|
|
15
|
-
var label = _a.label, kind = _a.kind, value = _a.value, onChange = _a.onChange,
|
|
35
|
+
var _b, _c, _d, _e;
|
|
36
|
+
var label = _a.label, kind = _a.kind, value = _a.value, onChange = _a.onChange, _f = _a.gridlinesDefault, gridlinesDefault = _f === void 0 ? true : _f;
|
|
16
37
|
var set = function (patch) {
|
|
17
38
|
return onChange(tslib_1.__assign(tslib_1.__assign({}, (value !== null && value !== void 0 ? value : {})), patch));
|
|
18
39
|
};
|
|
@@ -21,9 +42,50 @@ var AxisOptionsFields = function (_a) {
|
|
|
21
42
|
kind === "value" ? (react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
22
43
|
react_1.default.createElement(primitives_1.NumberField, { label: "Min", ariaLabel: "".concat(label, " min"), value: value === null || value === void 0 ? void 0 : value.min, onChange: function (min) { return set({ min: min }); }, placeholder: "Auto" }),
|
|
23
44
|
react_1.default.createElement(primitives_1.NumberField, { label: "Max", ariaLabel: "".concat(label, " max"), value: value === null || value === void 0 ? void 0 : value.max, onChange: function (max) { return set({ max: max }); }, placeholder: "Auto" }))) : null,
|
|
24
|
-
kind === "value" ? (react_1.default.createElement(
|
|
45
|
+
kind === "value" ? (react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
46
|
+
react_1.default.createElement(primitives_1.NumberField, { label: "Major unit", ariaLabel: "".concat(label, " major unit"), value: value === null || value === void 0 ? void 0 : value.majorUnit, min: 0, onChange: function (majorUnit) { return set({ majorUnit: majorUnit }); }, placeholder: "Auto" }),
|
|
47
|
+
react_1.default.createElement(primitives_1.NumberField, { label: "Minor unit", ariaLabel: "".concat(label, " minor unit"), value: value === null || value === void 0 ? void 0 : value.minorUnit, min: 0, onChange: function (minorUnit) { return set({ minorUnit: minorUnit }); }, placeholder: "Auto" }))) : (react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
48
|
+
react_1.default.createElement(primitives_1.NumberField, { label: "Label interval", ariaLabel: "".concat(label, " interval between labels"), value: value === null || value === void 0 ? void 0 : value.tickLabelSkip, min: 1, step: 1, onChange: function (tickLabelSkip) { return set({ tickLabelSkip: tickLabelSkip }); }, placeholder: "Auto" }),
|
|
49
|
+
react_1.default.createElement(primitives_1.NumberField, { label: "Tick interval", ariaLabel: "".concat(label, " interval between tick marks"), value: value === null || value === void 0 ? void 0 : value.tickMarkSkip, min: 1, step: 1, onChange: function (tickMarkSkip) { return set({ tickMarkSkip: tickMarkSkip }); }, placeholder: "1" }))),
|
|
50
|
+
kind === "value" ? (react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
51
|
+
react_1.default.createElement(primitives_1.CheckboxField, { label: "Logarithmic scale", ariaLabel: "".concat(label, " logarithmic scale"), checked: Boolean(value === null || value === void 0 ? void 0 : value.logarithmic), onChange: function (on) { return set({ logarithmic: on || undefined }); } }),
|
|
52
|
+
(value === null || value === void 0 ? void 0 : value.logarithmic) ? (react_1.default.createElement(primitives_1.NumberField, { label: "Base", ariaLabel: "".concat(label, " logarithmic base"), value: value === null || value === void 0 ? void 0 : value.logBase, min: 2, max: 1000, onChange: function (logBase) { return set({ logBase: logBase }); }, placeholder: "10" })) : null)) : null,
|
|
53
|
+
kind === "value" ? (react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
54
|
+
react_1.default.createElement(primitives_1.SelectField, { label: "Display units", ariaLabel: "".concat(label, " display units"), value: ((_b = value === null || value === void 0 ? void 0 : value.displayUnits) !== null && _b !== void 0 ? _b : ""), options: DISPLAY_UNIT_OPTIONS, onChange: function (unit) {
|
|
55
|
+
return set({ displayUnits: unit === "" ? undefined : unit });
|
|
56
|
+
} }),
|
|
57
|
+
(value === null || value === void 0 ? void 0 : value.displayUnits) ? (react_1.default.createElement(primitives_1.CheckboxField, { label: "Show display units label", ariaLabel: "".concat(label, " show display units label"), checked: (value === null || value === void 0 ? void 0 : value.showDisplayUnitsLabel) !== false, onChange: function (on) {
|
|
58
|
+
return set({ showDisplayUnitsLabel: on ? undefined : false });
|
|
59
|
+
} })) : null)) : null,
|
|
60
|
+
react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
61
|
+
react_1.default.createElement(primitives_1.SelectField, { label: "Crosses other axis", ariaLabel: "".concat(label, " crosses"), value: typeof (value === null || value === void 0 ? void 0 : value.crossesAt) === "number"
|
|
62
|
+
? "value"
|
|
63
|
+
: (value === null || value === void 0 ? void 0 : value.crosses) === "max"
|
|
64
|
+
? "max"
|
|
65
|
+
: "autoZero", options: [
|
|
66
|
+
{ value: "autoZero", label: "Automatic" },
|
|
67
|
+
{ value: "value", label: "At value" },
|
|
68
|
+
{ value: "max", label: "At maximum" },
|
|
69
|
+
], onChange: function (crossing) {
|
|
70
|
+
var _a;
|
|
71
|
+
return set(crossing === "value"
|
|
72
|
+
? { crosses: undefined, crossesAt: (_a = value === null || value === void 0 ? void 0 : value.crossesAt) !== null && _a !== void 0 ? _a : 0 }
|
|
73
|
+
: {
|
|
74
|
+
crosses: crossing === "max" ? "max" : undefined,
|
|
75
|
+
crossesAt: undefined,
|
|
76
|
+
});
|
|
77
|
+
} }),
|
|
78
|
+
typeof (value === null || value === void 0 ? void 0 : value.crossesAt) === "number" ? (react_1.default.createElement(primitives_1.NumberField, { label: "At", ariaLabel: "".concat(label, " crosses at"), value: value.crossesAt, onChange: function (crossesAt) { return set({ crossesAt: crossesAt !== null && crossesAt !== void 0 ? crossesAt : 0 }); } })) : null),
|
|
25
79
|
react_1.default.createElement(primitives_1.CheckboxField, { label: "Reverse direction", ariaLabel: "".concat(label, " reverse direction"), checked: Boolean(value === null || value === void 0 ? void 0 : value.reverse), onChange: function (on) { return set({ reverse: on || undefined }); } }),
|
|
26
|
-
react_1.default.createElement(primitives_1.CheckboxField, { label: "Gridlines", ariaLabel: "".concat(label, " gridlines"), checked: (
|
|
80
|
+
react_1.default.createElement(primitives_1.CheckboxField, { label: "Gridlines", ariaLabel: "".concat(label, " gridlines"), checked: (_c = value === null || value === void 0 ? void 0 : value.showMajorGridlines) !== null && _c !== void 0 ? _c : gridlinesDefault, onChange: function (showMajorGridlines) { return set({ showMajorGridlines: showMajorGridlines }); } }),
|
|
81
|
+
kind === "value" ? (react_1.default.createElement(primitives_1.CheckboxField, { label: "Minor gridlines", ariaLabel: "".concat(label, " minor gridlines"), checked: Boolean(value === null || value === void 0 ? void 0 : value.showMinorGridlines), onChange: function (on) { return set({ showMinorGridlines: on || undefined }); } })) : null,
|
|
82
|
+
react_1.default.createElement("div", { className: "flex flex-wrap gap-2 items-end" },
|
|
83
|
+
react_1.default.createElement(primitives_1.SelectField, { label: "Major tick marks", ariaLabel: "".concat(label, " major tick marks"), value: (_d = value === null || value === void 0 ? void 0 : value.majorTickMark) !== null && _d !== void 0 ? _d : "out", options: TICK_MARKS, onChange: function (mark) {
|
|
84
|
+
return set({ majorTickMark: mark === "out" ? undefined : mark });
|
|
85
|
+
} }),
|
|
86
|
+
react_1.default.createElement(primitives_1.SelectField, { label: "Minor tick marks", ariaLabel: "".concat(label, " minor tick marks"), value: (_e = value === null || value === void 0 ? void 0 : value.minorTickMark) !== null && _e !== void 0 ? _e : "none", options: TICK_MARKS, onChange: function (mark) {
|
|
87
|
+
return set({ minorTickMark: mark === "none" ? undefined : mark });
|
|
88
|
+
} })),
|
|
27
89
|
react_1.default.createElement(primitives_1.CheckboxField, { label: "Show axis", ariaLabel: "".concat(label, " visible"), checked: (value === null || value === void 0 ? void 0 : value.visible) !== false, onChange: function (on) { return set({ visible: on ? undefined : false }); } }),
|
|
28
90
|
kind === "value" ? (react_1.default.createElement(primitives_1.TextField, { label: "Number format", ariaLabel: "".concat(label, " number format"), value: value === null || value === void 0 ? void 0 : value.numberFormatPattern, onChange: function (numberFormatPattern) { return set({ numberFormatPattern: numberFormatPattern }); }, placeholder: "Linked to source" })) : null,
|
|
29
91
|
react_1.default.createElement(text_format_fields_1.TextFormatFields, { label: "".concat(label, " font"), collapsible: true, value: value === null || value === void 0 ? void 0 : value.textFormat, onChange: function (textFormat) { return set({ textFormat: textFormat }); } })));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ElementKey = "hiLowLines" | "dropLines" | "upDownBars" | "dataTable";
|
|
3
|
+
/**
|
|
4
|
+
* Excel's Add Chart Element → Lines (High-Low, Drop), Up/Down Bars and Data
|
|
5
|
+
* Table (demo-app-monorepo#49969 FT-08). High-low lines and up/down bars are
|
|
6
|
+
* line-chart elements, drop lines line and area; every category chart can
|
|
7
|
+
* carry a data table.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ChartElementsFields: ({ chartType, spec, onChange, }: {
|
|
10
|
+
chartType: string;
|
|
11
|
+
spec: Partial<Record<ElementKey, any>>;
|
|
12
|
+
onChange(key: ElementKey | "dataTable.showLegendKeys", value: unknown): void;
|
|
13
|
+
}) => React.JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=chart-elements-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-elements-fields.d.ts","sourceRoot":"","sources":["../../../../../components/editors/fields/chart-elements-fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAE1E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,gCAIjC;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,0BAA0B,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9E,sBAuCA,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChartElementsFields = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
var primitives_1 = require("./primitives");
|
|
7
|
+
/**
|
|
8
|
+
* Excel's Add Chart Element → Lines (High-Low, Drop), Up/Down Bars and Data
|
|
9
|
+
* Table (demo-app-monorepo#49969 FT-08). High-low lines and up/down bars are
|
|
10
|
+
* line-chart elements, drop lines line and area; every category chart can
|
|
11
|
+
* carry a data table.
|
|
12
|
+
*/
|
|
13
|
+
var ChartElementsFields = function (_a) {
|
|
14
|
+
var chartType = _a.chartType, spec = _a.spec, onChange = _a.onChange;
|
|
15
|
+
var isLine = chartType === "line";
|
|
16
|
+
return (react_1.default.createElement("div", { className: "flex flex-col gap-1 pb-2" },
|
|
17
|
+
isLine ? (react_1.default.createElement(primitives_1.CheckboxField, { label: "High-low lines", checked: Boolean(spec.hiLowLines), onChange: function (on) { return onChange("hiLowLines", on || undefined); } })) : null,
|
|
18
|
+
isLine || chartType === "area" ? (react_1.default.createElement(primitives_1.CheckboxField, { label: "Drop lines", checked: Boolean(spec.dropLines), onChange: function (on) { return onChange("dropLines", on || undefined); } })) : null,
|
|
19
|
+
isLine ? (react_1.default.createElement(primitives_1.CheckboxField, { label: "Up/down bars", checked: Boolean(spec.upDownBars), onChange: function (on) { return onChange("upDownBars", on ? {} : undefined); } })) : null,
|
|
20
|
+
react_1.default.createElement(primitives_1.CheckboxField, { label: "Data table", checked: Boolean(spec.dataTable), onChange: function (on) { return onChange("dataTable", on ? {} : undefined); } }),
|
|
21
|
+
spec.dataTable ? (react_1.default.createElement(primitives_1.CheckboxField, { label: "Show legend keys", checked: spec.dataTable.showLegendKeys !== false, onChange: function (on) { return onChange("dataTable.showLegendKeys", on ? undefined : false); } })) : null));
|
|
22
|
+
};
|
|
23
|
+
exports.ChartElementsFields = ChartElementsFields;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series-format-fields.d.ts","sourceRoot":"","sources":["../../../../../components/editors/fields/series-format-fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAqC5E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,8CAKhC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,uBAAuB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CAC3C,
|
|
1
|
+
{"version":3,"file":"series-format-fields.d.ts","sourceRoot":"","sources":["../../../../../components/editors/fields/series-format-fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAqC5E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,8CAKhC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,uBAAuB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CAC3C,sBAkZA,CAAC"}
|
|
@@ -36,7 +36,7 @@ var MARKER_SYMBOLS = [
|
|
|
36
36
|
* (`capabilities`) render.
|
|
37
37
|
*/
|
|
38
38
|
var SeriesFormatFields = function (_a) {
|
|
39
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
39
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
40
40
|
var sheetId = _a.sheetId, series = _a.series, capabilities = _a.capabilities, onChange = _a.onChange;
|
|
41
41
|
var trendline = (_b = series.trendlines) === null || _b === void 0 ? void 0 : _b[0];
|
|
42
42
|
var setTrendline = function (patch) {
|
|
@@ -160,6 +160,20 @@ var SeriesFormatFields = function (_a) {
|
|
|
160
160
|
], false),
|
|
161
161
|
});
|
|
162
162
|
} }, "Add point color")))) : null,
|
|
163
|
-
capabilities.hasDataLabels ? (react_1.default.createElement(data_labels_fields_1.DataLabelsFields, { perSeries: true, value: series.dataLabels, capabilities: capabilities, onChange: function (dataLabels) { return onChange({ dataLabels: dataLabels }); } })) : null
|
|
163
|
+
capabilities.hasDataLabels ? (react_1.default.createElement(data_labels_fields_1.DataLabelsFields, { perSeries: true, value: series.dataLabels, capabilities: capabilities, onChange: function (dataLabels) { return onChange({ dataLabels: dataLabels }); } })) : null,
|
|
164
|
+
capabilities.hasDataLabels ? (react_1.default.createElement("div", { className: "flex flex-col gap-1" },
|
|
165
|
+
react_1.default.createElement("label", { className: "font-system text-xs" }, "Label values from cells"),
|
|
166
|
+
react_1.default.createElement(chart_range_input_1.ChartRangeInput, { sheetId: sheetId, range: (_q = (_p = series.dataLabels) === null || _p === void 0 ? void 0 : _p.valueFromCells) !== null && _q !== void 0 ? _q : undefined, onChangeRange: function (valueFromCells) {
|
|
167
|
+
var _a;
|
|
168
|
+
return onChange({
|
|
169
|
+
dataLabels: tslib_1.__assign(tslib_1.__assign({}, ((_a = series.dataLabels) !== null && _a !== void 0 ? _a : {})), { show: true, valueFromCells: valueFromCells }),
|
|
170
|
+
});
|
|
171
|
+
}, placeholder: "Select a label range", className: "mb-0" }),
|
|
172
|
+
((_r = series.dataLabels) === null || _r === void 0 ? void 0 : _r.valueFromCells) ? (react_1.default.createElement("button", { type: "button", className: "font-system text-xs text-rnc-muted-foreground underline self-start", onClick: function () {
|
|
173
|
+
var _a;
|
|
174
|
+
return onChange({
|
|
175
|
+
dataLabels: tslib_1.__assign(tslib_1.__assign({}, ((_a = series.dataLabels) !== null && _a !== void 0 ? _a : {})), { valueFromCells: undefined }),
|
|
176
|
+
});
|
|
177
|
+
} }, "Clear label range")) : null)) : null));
|
|
164
178
|
};
|
|
165
179
|
exports.SeriesFormatFields = SeriesFormatFields;
|
package/dist/cjs/config.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ChartSpec } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import { type ThreeDRenderOptions } from "./utils/three-d";
|
|
2
3
|
export declare const CHART_TYPES: Array<[string, Array<[string, Partial<ChartSpec>]>]>;
|
|
4
|
+
/**
|
|
5
|
+
* The Chart editor's preset list. With `enable3D: false` the presets the
|
|
6
|
+
* renderer would draw through echarts-gl (3-D Column / Bar / Line / Area,
|
|
7
|
+
* their stacked variants and 3-D Surface) are left out; 3-D Pie and
|
|
8
|
+
* Contour stay since they never render in WebGL. A spec that already
|
|
9
|
+
* carries a 3-D `sourceChartType` is not rewritten — only the picker
|
|
10
|
+
* changes (rowsncolumns/spreadsheet#1187).
|
|
11
|
+
*/
|
|
12
|
+
export declare const getChartTypes: (options?: ThreeDRenderOptions) => Array<[string, Array<[string, Partial<ChartSpec>]>]>;
|
|
3
13
|
/**
|
|
4
14
|
* True when a spec is doughnut-shaped: the first-class
|
|
5
15
|
* `chartType: "doughnut"` token, or the two legacy pie encodings —
|
package/dist/cjs/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAsRhF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAgB1E,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,mBAAmB,KAC5B,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAarD,CAAC;AAYF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,OAAO,CAAC,SAAS,CAAC,KAAG,OAQzD,CAAC;AAuBF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,OAAO,CAAC,SAAS,CAAC,KAAG,MA4B9D,CAAC"}
|