@rowsncolumns/charts 27.0.33 → 28.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,5 +7,6 @@ export * from "./interface/create-chart";
7
7
  export * from "./interface/delete-chart";
8
8
  export * from "./interface/move-chart";
9
9
  export * from "./interface/resize-chart";
10
+ export * from "./interface/shift-chart-ranges";
10
11
  export * from "./interface/update-chart";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAI9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAI9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -15,4 +15,5 @@ tslib_1.__exportStar(require("./interface/create-chart"), exports);
15
15
  tslib_1.__exportStar(require("./interface/delete-chart"), exports);
16
16
  tslib_1.__exportStar(require("./interface/move-chart"), exports);
17
17
  tslib_1.__exportStar(require("./interface/resize-chart"), exports);
18
+ tslib_1.__exportStar(require("./interface/shift-chart-ranges"), exports);
18
19
  tslib_1.__exportStar(require("./interface/update-chart"), exports);
@@ -0,0 +1,17 @@
1
+ import type { CellData } from "@rowsncolumns/spreadsheet";
2
+ import { type StructuralAxis, type StructuralOp } from "@rowsncolumns/spreadsheet-state";
3
+ import type { UseOnMoveChartProps } from "../hooks/use-on-move-chart";
4
+ /**
5
+ * Relocate every chart on `sheetId` after a whole row / column insert or
6
+ * delete, the way Excel does: the chart frame moves with its anchor cell
7
+ * (snapping to the deletion index when its own row/column is removed; size
8
+ * unchanged), and the ranges its series read shift like references — insert
9
+ * inside grows, delete inside shrinks, delete of the whole span removes the
10
+ * source (`#REF!`).
11
+ *
12
+ * `useSpreadsheetState` already applies this through `onChangeCharts` inside
13
+ * `insertRow` / `deleteRow` / `insertColumn` / `deleteColumn`; this interface
14
+ * is for hosts that drive structural edits themselves.
15
+ */
16
+ export declare const shiftChartRanges: <T extends CellData>({ onChangeCharts, createHistory, }: UseOnMoveChartProps<T>) => (sheetId: number, axis: StructuralAxis, op: StructuralOp, index: number, count: number) => void;
17
+ //# sourceMappingURL=shift-chart-ranges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shift-chart-ranges.d.ts","sourceRoot":"","sources":["../../../interface/shift-chart-ranges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKtE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,QAAQ,EAAE,oCAGlD,mBAAmB,CAAC,CAAC,CAAC,MAErB,SAAS,MAAM,EACf,MAAM,cAAc,EACpB,IAAI,YAAY,EAChB,OAAO,MAAM,EACb,OAAO,MAAM,SAsBhB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shiftChartRanges = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var spreadsheet_state_1 = require("@rowsncolumns/spreadsheet-state");
6
+ var immer_1 = require("immer");
7
+ // For external interface
8
+ (0, immer_1.enablePatches)();
9
+ /**
10
+ * Relocate every chart on `sheetId` after a whole row / column insert or
11
+ * delete, the way Excel does: the chart frame moves with its anchor cell
12
+ * (snapping to the deletion index when its own row/column is removed; size
13
+ * unchanged), and the ranges its series read shift like references — insert
14
+ * inside grows, delete inside shrinks, delete of the whole span removes the
15
+ * source (`#REF!`).
16
+ *
17
+ * `useSpreadsheetState` already applies this through `onChangeCharts` inside
18
+ * `insertRow` / `deleteRow` / `insertColumn` / `deleteColumn`; this interface
19
+ * is for hosts that drive structural edits themselves.
20
+ */
21
+ var shiftChartRanges = function (_a) {
22
+ var onChangeCharts = _a.onChangeCharts, createHistory = _a.createHistory;
23
+ return function (sheetId, axis, op, index, count) {
24
+ if (count <= 0)
25
+ return;
26
+ var saveHistory = createHistory();
27
+ onChangeCharts === null || onChangeCharts === void 0 ? void 0 : onChangeCharts(function (prevCharts) {
28
+ var _a = tslib_1.__read((0, immer_1.produceWithPatches)(prevCharts, function (draft) {
29
+ (0, spreadsheet_state_1.shiftChartsOnStructuralChange)(draft, sheetId, axis, op, index, count);
30
+ }), 3), nextState = _a[0], patches = _a[1], inversePatches = _a[2];
31
+ saveHistory({ charts: { patches: patches, inversePatches: inversePatches } });
32
+ return nextState;
33
+ });
34
+ };
35
+ };
36
+ exports.shiftChartRanges = shiftChartRanges;
@@ -1 +1 @@
1
- {"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.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.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/update-chart.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/chart-spec-utils.ts","../../utils/echarts-gl-loader.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.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","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.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.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/chart-spec-utils.ts","../../utils/echarts-gl-loader.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
@@ -7,5 +7,6 @@ export * from "./interface/create-chart";
7
7
  export * from "./interface/delete-chart";
8
8
  export * from "./interface/move-chart";
9
9
  export * from "./interface/resize-chart";
10
+ export * from "./interface/shift-chart-ranges";
10
11
  export * from "./interface/update-chart";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAI9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAI9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC"}
package/dist/esm/index.js CHANGED
@@ -10,4 +10,5 @@ export * from "./interface/create-chart";
10
10
  export * from "./interface/delete-chart";
11
11
  export * from "./interface/move-chart";
12
12
  export * from "./interface/resize-chart";
13
+ export * from "./interface/shift-chart-ranges";
13
14
  export * from "./interface/update-chart";
@@ -0,0 +1,17 @@
1
+ import type { CellData } from "@rowsncolumns/spreadsheet";
2
+ import { type StructuralAxis, type StructuralOp } from "@rowsncolumns/spreadsheet-state";
3
+ import type { UseOnMoveChartProps } from "../hooks/use-on-move-chart";
4
+ /**
5
+ * Relocate every chart on `sheetId` after a whole row / column insert or
6
+ * delete, the way Excel does: the chart frame moves with its anchor cell
7
+ * (snapping to the deletion index when its own row/column is removed; size
8
+ * unchanged), and the ranges its series read shift like references — insert
9
+ * inside grows, delete inside shrinks, delete of the whole span removes the
10
+ * source (`#REF!`).
11
+ *
12
+ * `useSpreadsheetState` already applies this through `onChangeCharts` inside
13
+ * `insertRow` / `deleteRow` / `insertColumn` / `deleteColumn`; this interface
14
+ * is for hosts that drive structural edits themselves.
15
+ */
16
+ export declare const shiftChartRanges: <T extends CellData>({ onChangeCharts, createHistory, }: UseOnMoveChartProps<T>) => (sheetId: number, axis: StructuralAxis, op: StructuralOp, index: number, count: number) => void;
17
+ //# sourceMappingURL=shift-chart-ranges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shift-chart-ranges.d.ts","sourceRoot":"","sources":["../../../interface/shift-chart-ranges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKtE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,QAAQ,EAAE,oCAGlD,mBAAmB,CAAC,CAAC,CAAC,MAErB,SAAS,MAAM,EACf,MAAM,cAAc,EACpB,IAAI,YAAY,EAChB,OAAO,MAAM,EACb,OAAO,MAAM,SAsBhB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { shiftChartsOnStructuralChange, } from "@rowsncolumns/spreadsheet-state";
2
+ import { enablePatches, produceWithPatches } from "immer";
3
+ // For external interface
4
+ enablePatches();
5
+ /**
6
+ * Relocate every chart on `sheetId` after a whole row / column insert or
7
+ * delete, the way Excel does: the chart frame moves with its anchor cell
8
+ * (snapping to the deletion index when its own row/column is removed; size
9
+ * unchanged), and the ranges its series read shift like references — insert
10
+ * inside grows, delete inside shrinks, delete of the whole span removes the
11
+ * source (`#REF!`).
12
+ *
13
+ * `useSpreadsheetState` already applies this through `onChangeCharts` inside
14
+ * `insertRow` / `deleteRow` / `insertColumn` / `deleteColumn`; this interface
15
+ * is for hosts that drive structural edits themselves.
16
+ */
17
+ export const shiftChartRanges = ({ onChangeCharts, createHistory, }) => {
18
+ return (sheetId, axis, op, index, count) => {
19
+ if (count <= 0)
20
+ return;
21
+ const saveHistory = createHistory();
22
+ onChangeCharts?.((prevCharts) => {
23
+ const [nextState, patches, inversePatches] = produceWithPatches(prevCharts, (draft) => {
24
+ shiftChartsOnStructuralChange(draft, sheetId, axis, op, index, count);
25
+ });
26
+ saveHistory({ charts: { patches, inversePatches } });
27
+ return nextState;
28
+ });
29
+ };
30
+ };
@@ -1 +1 @@
1
- {"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.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.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/update-chart.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/chart-spec-utils.ts","../../utils/echarts-gl-loader.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.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","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.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.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/chart-spec-utils.ts","../../utils/echarts-gl-loader.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/charts",
3
- "version": "27.0.33",
3
+ "version": "28.0.0",
4
4
  "author": "Vinay M",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "./dist/cjs/index.js",
@@ -64,13 +64,14 @@
64
64
  "world-atlas": "^2.0.2"
65
65
  },
66
66
  "devDependencies": {
67
- "@rowsncolumns/calculator": ">=7.2.31",
67
+ "@rowsncolumns/calculator": ">=7.3.0",
68
68
  "@rowsncolumns/grid": ">=13.2.33",
69
- "@rowsncolumns/spreadsheet": ">=10.2.76",
70
- "@rowsncolumns/spreadsheet-state": ">=28.0.75",
71
- "@rowsncolumns/toolkit": ">=24.4.3",
72
- "@rowsncolumns/ui": ">=15.0.42",
73
- "@rowsncolumns/utils": ">=9.2.43",
69
+ "@rowsncolumns/icons": ">=7.2.32",
70
+ "@rowsncolumns/spreadsheet": ">=10.3.0",
71
+ "@rowsncolumns/spreadsheet-state": ">=29.0.0",
72
+ "@rowsncolumns/toolkit": ">=24.4.5",
73
+ "@rowsncolumns/ui": ">=16.0.0",
74
+ "@rowsncolumns/utils": ">=9.3.0",
74
75
  "@types/react-plotly.js": "^2.6.3",
75
76
  "echarts": "^5.6.0",
76
77
  "formik": "^2.4.6",
@@ -79,13 +80,14 @@
79
80
  "react-plotly.js": "^2.6.0"
80
81
  },
81
82
  "peerDependencies": {
82
- "@rowsncolumns/calculator": ">=7.2.31",
83
+ "@rowsncolumns/calculator": ">=7.3.0",
83
84
  "@rowsncolumns/grid": ">=13.2.33",
84
- "@rowsncolumns/spreadsheet": ">=10.2.76",
85
- "@rowsncolumns/spreadsheet-state": ">=28.0.75",
86
- "@rowsncolumns/toolkit": ">=24.4.3",
87
- "@rowsncolumns/ui": ">=15.0.42",
88
- "@rowsncolumns/utils": ">=9.2.43",
85
+ "@rowsncolumns/icons": ">=7.2.32",
86
+ "@rowsncolumns/spreadsheet": ">=10.3.0",
87
+ "@rowsncolumns/spreadsheet-state": ">=29.0.0",
88
+ "@rowsncolumns/toolkit": ">=24.4.5",
89
+ "@rowsncolumns/ui": ">=16.0.0",
90
+ "@rowsncolumns/utils": ">=9.3.0",
89
91
  "immer": ">10.0.0",
90
92
  "jotai": ">=2.10.3",
91
93
  "plotly.js": ">=3",