@rowsncolumns/charts 28.1.18 → 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/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/basic-chart/basic-chart.js +338 -233
- 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.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +21 -12
- 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/tsconfig.cjs.tsbuildinfo +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/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/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +177 -38
- 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.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +12 -1
- 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/tsconfig.esm.tsbuildinfo +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/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/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;
|
|
@@ -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,7 +56,7 @@ 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 _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;
|
|
59
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)();
|
|
61
62
|
var chartTypes = (0, config_1.getChartTypes)({ enable3D: enable3D });
|
|
@@ -76,7 +77,7 @@ var ChartEditor = function (_a) {
|
|
|
76
77
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
78
|
[chart === null || chart === void 0 ? void 0 : chart.chartId]);
|
|
78
79
|
// Formik
|
|
79
|
-
var
|
|
80
|
+
var _2 = (0, formik_1.useFormik)({
|
|
80
81
|
initialValues: initialValues,
|
|
81
82
|
enableReinitialize: true,
|
|
82
83
|
onSubmit: function (values) {
|
|
@@ -88,7 +89,7 @@ var ChartEditor = function (_a) {
|
|
|
88
89
|
// Close dialog
|
|
89
90
|
closeDialog();
|
|
90
91
|
},
|
|
91
|
-
}), handleSubmit =
|
|
92
|
+
}), handleSubmit = _2.handleSubmit, setFieldValue = _2.setFieldValue, resetForm = _2.resetForm, values = _2.values;
|
|
92
93
|
var onCancelForm = function () {
|
|
93
94
|
resetForm();
|
|
94
95
|
closeDialog();
|
|
@@ -340,10 +341,15 @@ var ChartEditor = function (_a) {
|
|
|
340
341
|
react_1.default.createElement(Section, { title: "Chart style", defaultOpen: true },
|
|
341
342
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
342
343
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Chart title"),
|
|
343
|
-
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),
|
|
344
350
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
345
351
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Subtitle"),
|
|
346
|
-
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" })),
|
|
347
353
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
348
354
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Style"),
|
|
349
355
|
react_1.default.createElement("div", { className: "grid grid-cols-4 gap-1", role: "radiogroup" }, chart_styles_1.CHART_STYLES.map(function (style) {
|
|
@@ -372,7 +378,7 @@ var ChartEditor = function (_a) {
|
|
|
372
378
|
}))),
|
|
373
379
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
374
380
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Quick layout"),
|
|
375
|
-
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) {
|
|
376
382
|
var layout = chart_styles_1.CHART_QUICK_LAYOUTS.find(function (entry) { return String(entry.id) === e.target.value; });
|
|
377
383
|
if (layout) {
|
|
378
384
|
setFieldValue("spec", (0, chart_styles_1.applyChartQuickLayout)(values.spec, layout));
|
|
@@ -391,7 +397,7 @@ var ChartEditor = function (_a) {
|
|
|
391
397
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
392
398
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Fill"),
|
|
393
399
|
react_1.default.createElement("div", { className: "flex items-center gap-1" },
|
|
394
|
-
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) {
|
|
395
401
|
return setFieldValue("spec.backgroundColor", e.target.value);
|
|
396
402
|
}, className: "h-6 w-8 p-0 border border-rnc-border rounded-sm bg-transparent cursor-pointer", "aria-label": "Chart area fill" }),
|
|
397
403
|
values.spec.backgroundColor ? (react_1.default.createElement(ui_1.IconButton, { type: "button", onClick: function () {
|
|
@@ -401,7 +407,7 @@ var ChartEditor = function (_a) {
|
|
|
401
407
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
402
408
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Border"),
|
|
403
409
|
react_1.default.createElement("div", { className: "flex items-center gap-1" },
|
|
404
|
-
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" }),
|
|
405
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" },
|
|
406
412
|
react_1.default.createElement(icons_1.CrossCircledIcon, null))) : (react_1.default.createElement("span", { className: "font-system text-xs text-rnc-text-weak" }, "None")))),
|
|
407
413
|
react_1.default.createElement("label", { className: "font-system text-sm flex items-center gap-1" },
|
|
@@ -412,7 +418,7 @@ var ChartEditor = function (_a) {
|
|
|
412
418
|
caps.hasLegend ? (react_1.default.createElement(Section, { title: "Legend" },
|
|
413
419
|
react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
414
420
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Legend"),
|
|
415
|
-
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) {
|
|
416
422
|
return setFieldValue("spec.legend.position", e.target.value || undefined);
|
|
417
423
|
} },
|
|
418
424
|
react_1.default.createElement("option", { value: "" }, "Auto"),
|
|
@@ -422,13 +428,13 @@ var ChartEditor = function (_a) {
|
|
|
422
428
|
react_1.default.createElement("option", { value: "right" }, "Right"),
|
|
423
429
|
react_1.default.createElement("option", { value: "topRight" }, "Top right"),
|
|
424
430
|
react_1.default.createElement("option", { value: "none" }, "None"))),
|
|
425
|
-
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) {
|
|
426
432
|
return setFieldValue("spec.legend.textFormat", textFormat);
|
|
427
433
|
} }))) : null,
|
|
428
434
|
caps.hasAxisTitles || caps.hasValueAxis ? (react_1.default.createElement(Section, { title: "Vertical axis" },
|
|
429
435
|
caps.hasAxisTitles ? (react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
430
436
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Vertical axis title"),
|
|
431
|
-
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) {
|
|
432
438
|
return setFieldValue("spec.verticalAxisTitle", e.target.value);
|
|
433
439
|
}, className: "text-xs", placeholder: "Vertical axis title" }))) : null,
|
|
434
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,
|
|
@@ -439,12 +445,15 @@ var ChartEditor = function (_a) {
|
|
|
439
445
|
caps.hasAxisTitles || caps.hasCategoryAxis ? (react_1.default.createElement(Section, { title: "Horizontal axis" },
|
|
440
446
|
caps.hasAxisTitles ? (react_1.default.createElement(ui_1.Stack, { direction: "vertical", className: "gap-1 pb-2" },
|
|
441
447
|
react_1.default.createElement("label", { className: "font-system text-sm" }, "Horizontal axis title"),
|
|
442
|
-
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) {
|
|
443
449
|
return setFieldValue("spec.horizontalAxisTitle", e.target.value);
|
|
444
450
|
}, className: "text-xs", placeholder: "Horizontal axis title" }))) : null,
|
|
445
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) {
|
|
446
452
|
return setFieldValue("spec.categoryAxisOptions", next);
|
|
447
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,
|
|
448
457
|
caps.hasDataLabels ? (react_1.default.createElement(Section, { title: "Data labels" },
|
|
449
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,
|
|
450
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor-capabilities.ts","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../components/editors/fields/axis-options-fields.tsx","../../components/editors/fields/chart-type-options.tsx","../../components/editors/fields/data-labels-fields.tsx","../../components/editors/fields/primitives.tsx","../../components/editors/fields/series-format-fields.tsx","../../components/editors/fields/series-name-field.tsx","../../components/editors/fields/text-format-fields.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/plot.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/doughnut.ts","../../utils/echarts-gl-loader.ts","../../utils/echarts-overlays.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/legend-layout.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/series-name.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor-capabilities.ts","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../components/editors/fields/axis-options-fields.tsx","../../components/editors/fields/chart-elements-fields.tsx","../../components/editors/fields/chart-type-options.tsx","../../components/editors/fields/data-labels-fields.tsx","../../components/editors/fields/primitives.tsx","../../components/editors/fields/series-format-fields.tsx","../../components/editors/fields/series-name-field.tsx","../../components/editors/fields/text-format-fields.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/plot.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-lines.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/data-table.ts","../../utils/doughnut.ts","../../utils/echarts-gl-loader.ts","../../utils/echarts-overlays.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/excel-axis-scale.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/legend-layout.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/series-name.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's line-chart analysis elements (Chart Design → Add Chart Element →
|
|
3
|
+
* Lines / Up/Down Bars, demo-app-monorepo#49969 FT-08) as echarts bar series
|
|
4
|
+
* over the category axis:
|
|
5
|
+
*
|
|
6
|
+
* - High-low lines — a thin vertical line per category from the lowest to the
|
|
7
|
+
* highest value of all the line series (`<c:hiLowLines/>`).
|
|
8
|
+
* - Up/down bars — a bar per category from the first line series' value to
|
|
9
|
+
* the last one's: an up bar (white) where the last is higher, a down bar
|
|
10
|
+
* (dark) where it is lower (`<c:upDownBars>`).
|
|
11
|
+
* - Drop lines — a thin vertical line per category from the axis to the
|
|
12
|
+
* highest point (`<c:dropLines/>`).
|
|
13
|
+
*
|
|
14
|
+
* Each is a stack of an invisible base plus a visible span, so the bars can
|
|
15
|
+
* start anywhere on the value axis; `barGap: "-100%"` lays every one of them
|
|
16
|
+
* over the category's centre instead of side by side.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CHART_LINE_SERIES_PREFIX = "rnc-chart-lines-";
|
|
19
|
+
export type ChartLineOptions = {
|
|
20
|
+
hiLowLines?: boolean | null;
|
|
21
|
+
dropLines?: boolean | null;
|
|
22
|
+
upDownBars?: {
|
|
23
|
+
gapWidth?: number | null;
|
|
24
|
+
upColor?: string | null;
|
|
25
|
+
downColor?: string | null;
|
|
26
|
+
} | null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The extra series for `options`, given the data of the chart's line series
|
|
30
|
+
* on one value axis, in spec order.
|
|
31
|
+
*/
|
|
32
|
+
export declare const buildChartLineSeries: (options: ChartLineOptions, lines: ReadonlyArray<ReadonlyArray<unknown>>, { isDarkMode, yAxisIndex }?: {
|
|
33
|
+
isDarkMode?: boolean;
|
|
34
|
+
yAxisIndex?: number;
|
|
35
|
+
}) => Record<string, unknown>[];
|
|
36
|
+
//# sourceMappingURL=chart-lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-lines.d.ts","sourceRoot":"","sources":["../../../utils/chart-lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,GAAG,IAAI,CAAC;CACV,CAAC;AAqDF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,gBAAgB,EACzB,OAAO,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAC5C,6BAA4B;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,KAC7E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAuEzB,CAAC"}
|