@casualoffice/sheets 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-DJhuCjhn.d.cts → api-cyO4EA4_.d.cts} +1 -1
- package/dist/{api-DJhuCjhn.d.ts → api-cyO4EA4_.d.ts} +1 -1
- package/dist/{attachCollab-BmCRT4V_.d.ts → attachCollab-BT4fVzxP.d.ts} +1 -1
- package/dist/{attachCollab-DIUQCCrq.d.cts → attachCollab-DHjb5XYK.d.cts} +1 -1
- package/dist/chrome.cjs +60 -3
- package/dist/chrome.cjs.map +1 -1
- package/dist/chrome.d.cts +3 -3
- package/dist/chrome.d.ts +3 -3
- package/dist/chrome.js +60 -3
- package/dist/chrome.js.map +1 -1
- package/dist/collab.d.cts +2 -2
- package/dist/collab.d.ts +2 -2
- package/dist/embed/embed-runtime.js +205 -161
- package/dist/{extensions-DZnqTEN2.d.ts → extensions-Cni7mbEm.d.ts} +1 -1
- package/dist/{extensions-FFqdLpk_.d.cts → extensions-DMmPnIYB.d.cts} +1 -1
- package/dist/index.cjs +6424 -1559
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6409 -1530
- package/dist/index.js.map +1 -1
- package/dist/sheets.cjs +5426 -561
- package/dist/sheets.cjs.map +1 -1
- package/dist/sheets.d.cts +5 -5
- package/dist/sheets.d.ts +5 -5
- package/dist/sheets.js +5415 -536
- package/dist/sheets.js.map +1 -1
- package/package.json +8 -7
- package/src/charts/ChartContextMenu.tsx +264 -0
- package/src/charts/ChartLayer.tsx +333 -0
- package/src/charts/ChartOverlay.tsx +293 -0
- package/src/charts/ChartsPanel.tsx +232 -0
- package/src/charts/FormatChartDialog.tsx +419 -0
- package/src/charts/InsertChartDialog.tsx +478 -0
- package/src/charts/build-option.ts +476 -0
- package/src/charts/charts-context.tsx +205 -0
- package/src/charts/echarts-init.ts +58 -0
- package/src/charts/hit-test.ts +130 -0
- package/src/charts/insert-chart.ts +106 -0
- package/src/charts/naming.ts +38 -0
- package/src/charts/render-to-png.ts +117 -0
- package/src/charts/resources.ts +108 -0
- package/src/charts/types.ts +239 -0
- package/src/charts/univer-dom.ts +102 -0
- package/src/chrome/CommentsPanel.tsx +418 -0
- package/src/chrome/HistoryPanel.tsx +304 -0
- package/src/chrome/InsertPivotDialog.tsx +74 -2
- package/src/chrome/PanelHost.tsx +56 -0
- package/src/chrome/PanelRail.tsx +90 -0
- package/src/chrome/PivotFieldsPanel.tsx +1021 -0
- package/src/chrome/TablesPanel.tsx +283 -0
- package/src/chrome/Toolbar.tsx +7 -1
- package/src/chrome/panel-context.tsx +55 -0
- package/src/chrome/panel-registry.ts +48 -0
- package/src/chrome/panel-shell.tsx +151 -0
- package/src/pivots/apply.ts +139 -0
- package/src/pivots/compute.ts +604 -0
- package/src/pivots/fields-model.ts +267 -0
- package/src/pivots/types.ts +137 -0
- package/src/sheets/CasualSheets.tsx +61 -35
- package/src/sheets/api.ts +37 -2
package/dist/chrome.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { C as CasualSheetsAPI } from './api-
|
|
4
|
-
import { C as ChromeExtensions, c as DialogKind, D as DialogComponentProps } from './extensions-
|
|
5
|
-
export { a as DialogController, b as DialogExtension, d as DialogProvider, e as DialogProviderProps, M as MenuExtension, f as MenuTarget, P as PanelComponentProps, g as PanelExtension, T as ToolbarExtension, h as hasBuiltInDialog, u as useDialogs } from './extensions-
|
|
3
|
+
import { C as CasualSheetsAPI } from './api-cyO4EA4_.cjs';
|
|
4
|
+
import { C as ChromeExtensions, c as DialogKind, D as DialogComponentProps } from './extensions-DMmPnIYB.cjs';
|
|
5
|
+
export { a as DialogController, b as DialogExtension, d as DialogProvider, e as DialogProviderProps, M as MenuExtension, f as MenuTarget, P as PanelComponentProps, g as PanelExtension, T as ToolbarExtension, h as hasBuiltInDialog, u as useDialogs } from './extensions-DMmPnIYB.cjs';
|
|
6
6
|
import '@univerjs/core/facade';
|
|
7
7
|
import '@univerjs/core';
|
|
8
8
|
|
package/dist/chrome.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { C as CasualSheetsAPI } from './api-
|
|
4
|
-
import { C as ChromeExtensions, c as DialogKind, D as DialogComponentProps } from './extensions-
|
|
5
|
-
export { a as DialogController, b as DialogExtension, d as DialogProvider, e as DialogProviderProps, M as MenuExtension, f as MenuTarget, P as PanelComponentProps, g as PanelExtension, T as ToolbarExtension, h as hasBuiltInDialog, u as useDialogs } from './extensions-
|
|
3
|
+
import { C as CasualSheetsAPI } from './api-cyO4EA4_.js';
|
|
4
|
+
import { C as ChromeExtensions, c as DialogKind, D as DialogComponentProps } from './extensions-Cni7mbEm.js';
|
|
5
|
+
export { a as DialogController, b as DialogExtension, d as DialogProvider, e as DialogProviderProps, M as MenuExtension, f as MenuTarget, P as PanelComponentProps, g as PanelExtension, T as ToolbarExtension, h as hasBuiltInDialog, u as useDialogs } from './extensions-Cni7mbEm.js';
|
|
6
6
|
import '@univerjs/core/facade';
|
|
7
7
|
import '@univerjs/core';
|
|
8
8
|
|
package/dist/chrome.js
CHANGED
|
@@ -3962,6 +3962,28 @@ function toA1(row, col) {
|
|
|
3962
3962
|
} while (n >= 0);
|
|
3963
3963
|
return `${letters}${row + 1}`;
|
|
3964
3964
|
}
|
|
3965
|
+
var PIVOTS_RESOURCE_NAME = "__casual_sheets_pivots__";
|
|
3966
|
+
function persistPivotModel(api, model) {
|
|
3967
|
+
const data = api.getContent();
|
|
3968
|
+
if (!data) return;
|
|
3969
|
+
const resources = data.resources ? [...data.resources] : [];
|
|
3970
|
+
const idx = resources.findIndex((r) => r.name === PIVOTS_RESOURCE_NAME);
|
|
3971
|
+
let pivots = [];
|
|
3972
|
+
if (idx >= 0 && resources[idx]?.data) {
|
|
3973
|
+
try {
|
|
3974
|
+
const parsed = JSON.parse(resources[idx].data);
|
|
3975
|
+
if (parsed?.v === 1 && Array.isArray(parsed.pivots)) pivots = parsed.pivots;
|
|
3976
|
+
} catch {
|
|
3977
|
+
pivots = [];
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
const merged = pivots.some((p) => p.id === model.id) ? pivots.map((p) => p.id === model.id ? model : p) : [...pivots, model];
|
|
3981
|
+
const entry = { name: PIVOTS_RESOURCE_NAME, data: JSON.stringify({ v: 1, pivots: merged }) };
|
|
3982
|
+
if (idx >= 0) resources[idx] = entry;
|
|
3983
|
+
else resources.push(entry);
|
|
3984
|
+
const nextData = { ...data, resources };
|
|
3985
|
+
api.setContent(nextData);
|
|
3986
|
+
}
|
|
3965
3987
|
var RANGE_NOTE_STYLE10 = {
|
|
3966
3988
|
fontSize: 12,
|
|
3967
3989
|
color: "var(--cs-chrome-muted, #605e5c)",
|
|
@@ -4021,13 +4043,27 @@ function InsertPivotDialog({ api, onClose }) {
|
|
|
4021
4043
|
setError("No active workbook.");
|
|
4022
4044
|
return;
|
|
4023
4045
|
}
|
|
4046
|
+
const srcRange = activeRange11(api);
|
|
4047
|
+
const activeWs = wb.getActiveSheet();
|
|
4048
|
+
const srcRow = srcRange?.getRow?.() ?? 0;
|
|
4049
|
+
const srcCol = srcRange?.getColumn?.() ?? 0;
|
|
4050
|
+
const sourceSheetId = activeWs?.getSheetId?.() ?? "";
|
|
4051
|
+
const sourceRange = {
|
|
4052
|
+
startRow: srcRow,
|
|
4053
|
+
startColumn: srcCol,
|
|
4054
|
+
endRow: srcRow + source.length - 1,
|
|
4055
|
+
endColumn: srcCol + (source[0]?.length ?? 1) - 1
|
|
4056
|
+
};
|
|
4057
|
+
let targetSheetId = sourceSheetId;
|
|
4058
|
+
let target = { row: 0, column: 0 };
|
|
4024
4059
|
try {
|
|
4025
4060
|
if (state.destination === "newSheet") {
|
|
4026
4061
|
const name = state.sheetName.trim() || "Pivot";
|
|
4027
4062
|
const rows = Math.max(pivot.grid.length + 2, 10);
|
|
4028
4063
|
const sheet = wb.create(name, rows, 4);
|
|
4029
|
-
|
|
4030
|
-
|
|
4064
|
+
sheet.getRange(`A1:${toA1(pivot.grid.length - 1, 1)}`).setValues(pivot.grid);
|
|
4065
|
+
targetSheetId = sheet.getSheetId?.() ?? sourceSheetId;
|
|
4066
|
+
target = { row: 0, column: 0 };
|
|
4031
4067
|
} else {
|
|
4032
4068
|
const anchor = state.anchor.trim().toUpperCase();
|
|
4033
4069
|
if (!/^[A-Z]+[0-9]+$/.test(anchor)) {
|
|
@@ -4046,11 +4082,26 @@ function InsertPivotDialog({ api, onClose }) {
|
|
|
4046
4082
|
const startRow = Number(m[2]) - 1;
|
|
4047
4083
|
const end = toA1(startRow + pivot.grid.length - 1, col + 1);
|
|
4048
4084
|
sheet.getRange(`${anchor}:${end}`).setValues(pivot.grid);
|
|
4085
|
+
target = { row: startRow, column: col };
|
|
4049
4086
|
}
|
|
4050
4087
|
} catch (e) {
|
|
4051
4088
|
setError(e instanceof Error ? e.message : "Failed to create the pivot table.");
|
|
4052
4089
|
return;
|
|
4053
4090
|
}
|
|
4091
|
+
if (state.useHeader && sourceSheetId && targetSheetId) {
|
|
4092
|
+
persistPivotModel(api, {
|
|
4093
|
+
id: `pivot-${targetSheetId}-${target.row}-${target.column}`,
|
|
4094
|
+
sourceSheetId,
|
|
4095
|
+
source: sourceRange,
|
|
4096
|
+
targetSheetId,
|
|
4097
|
+
target,
|
|
4098
|
+
rows: [{ column: state.groupCol }],
|
|
4099
|
+
cols: [],
|
|
4100
|
+
values: [{ column: state.valueCol, agg: state.aggFn }],
|
|
4101
|
+
filters: [],
|
|
4102
|
+
lastOutputExtent: { rows: pivot.grid.length, cols: pivot.grid[0]?.length ?? 0 }
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
4054
4105
|
onClose();
|
|
4055
4106
|
};
|
|
4056
4107
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -4576,7 +4627,13 @@ var BAR_STYLE = {
|
|
|
4576
4627
|
background: "var(--cs-chrome-bg, #eef1f5)",
|
|
4577
4628
|
flex: "0 0 auto",
|
|
4578
4629
|
userSelect: "none",
|
|
4579
|
-
|
|
4630
|
+
// Single row that scrolls horizontally when the controls don't fit — never
|
|
4631
|
+
// wrap into a broken second row with orphaned icons (matches Google Sheets /
|
|
4632
|
+
// the standalone app's overflow-scroll toolbar). Scrollbar hidden; the row
|
|
4633
|
+
// stays one line and the groups keep their order.
|
|
4634
|
+
flexWrap: "nowrap",
|
|
4635
|
+
overflowX: "auto",
|
|
4636
|
+
scrollbarWidth: "none"
|
|
4580
4637
|
};
|
|
4581
4638
|
var BTN_STYLE4 = {
|
|
4582
4639
|
width: 30,
|