ooxml-ui 1.32.0 → 1.34.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/custom-elements.json +10 -0
- package/dist/building-block-styles.d.ts +1 -0
- package/dist/chart/format-pane-3d.d.ts +1 -0
- package/dist/chart/format-pane-analysis.d.ts +1 -0
- package/dist/chart/format-pane-fill-line.d.ts +1 -0
- package/dist/chart/format-pane-text.d.ts +1 -0
- package/dist/{chunk-OKEFAQJT.js → chunk-3AOIYE3R.js} +87 -20
- package/dist/{chunk-WYKMVMX4.js → chunk-BOTLS2PR.js} +45 -0
- package/dist/{chunk-32P252JS.js → chunk-SWDVBUBW.js} +1 -1
- package/dist/docx/editor-attributes.d.ts +7 -0
- package/dist/docx/format-dialogs.d.ts +1 -1
- package/dist/docx/locales/en.d.ts +4 -0
- package/dist/docx/locales/split-cells.d.ts +10 -0
- package/dist/docx/localization-strings.d.ts +4 -0
- package/dist/docx/ribbon-icons.d.ts +2 -0
- package/dist/docx/split-cells-dialog.d.ts +4 -0
- package/dist/docx/table-commands.d.ts +9 -3
- package/dist/docx/table-model-adapter.d.ts +5 -0
- package/dist/docx/table-restructure-commands.d.ts +36 -0
- package/dist/docx/table-restructure-convert.d.ts +10 -0
- package/dist/docx/table-restructure.d.ts +22 -0
- package/dist/docx.js +652 -46
- package/dist/index.js +3 -3
- package/dist/{presentation-preview-XGJMARKI.js → presentation-preview-ZVJNGOJO.js} +1 -1
- package/dist/teams/app/chat-people-dialog.d.ts +5 -0
- package/dist/teams/app/teams-app.d.ts +3 -0
- package/dist/teams/chat-list.d.ts +5 -0
- package/dist/teams/i18n/locales/de.d.ts +9 -0
- package/dist/teams/i18n/locales/en/chat.d.ts +2 -0
- package/dist/teams/i18n/locales/en/shell.d.ts +7 -0
- package/dist/teams/i18n/locales/en.d.ts +9 -0
- package/dist/teams/i18n/locales/es.d.ts +9 -0
- package/dist/teams/i18n/locales/fr.d.ts +9 -0
- package/dist/teams/i18n/locales/zh-CN.d.ts +9 -0
- package/dist/teams.js +2 -2
- package/dist/theme-bridge.d.ts +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/xlsx/dialogs/custom-views.d.ts +2 -0
- package/dist/xlsx/dialogs/forecast-sheet.d.ts +2 -0
- package/dist/xlsx/dialogs/scenario-extras.d.ts +8 -0
- package/dist/xlsx/grid/shapes.d.ts +21 -0
- package/dist/xlsx/grid/styles.d.ts +1 -1
- package/dist/xlsx/header-image.d.ts +8 -0
- package/dist/xlsx.js +656 -126
- package/package.json +2 -2
package/dist/xlsx.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { statusLayout, watchStatusWidth, defineChartExOptions, chartExSpaceFormatSource } from './chunk-6TS7ASDJ.js';
|
|
2
2
|
import { trackPointerGesture } from './chunk-GSXOZCAN.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-SWDVBUBW.js';
|
|
4
4
|
import './chunk-DA57FPSN.js';
|
|
5
5
|
import { createHostBackstagePages, syncRibbonAddIns, withHostMenuItems } from './chunk-CDC5MAZS.js';
|
|
6
6
|
export { RIBBON_ADD_IN_EVENT } from './chunk-CDC5MAZS.js';
|
|
7
7
|
import { pictureEffectFilter, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, smartArtStylesGalleryState, smartArtColorsGalleryState, safeColor, svgTile } from './chunk-CALEXPBD.js';
|
|
8
|
-
import { withExtension, saveExtension, downloadBytes, emit, emitEvent, blobFor, announceFileCommand, pickFile } from './chunk-
|
|
9
|
-
export { XLSX_EDITOR_EVENTS } from './chunk-
|
|
10
|
-
import './chunk-
|
|
8
|
+
import { withExtension, saveExtension, downloadBytes, emit, emitEvent, blobFor, announceFileCommand, pickFile } from './chunk-3AOIYE3R.js';
|
|
9
|
+
export { XLSX_EDITOR_EVENTS } from './chunk-3AOIYE3R.js';
|
|
10
|
+
import './chunk-BOTLS2PR.js';
|
|
11
11
|
import './chunk-CDAXY5KC.js';
|
|
12
12
|
import './chunk-NDUD5JJB.js';
|
|
13
13
|
import './chunk-KJMAVPQB.js';
|
|
@@ -19,9 +19,9 @@ import { definePresence } from './chunk-YZH2QS7J.js';
|
|
|
19
19
|
import './chunk-FN7IF6M6.js';
|
|
20
20
|
import { withTokens } from './chunk-QLHCGV4C.js';
|
|
21
21
|
import './chunk-XL77FR4B.js';
|
|
22
|
-
import { SPECIAL_CODES, FRACTION_CODES, translate, INSERT_CHART_TYPES, AUTOSUM_FUNCTIONS, ICON_ACCENTS, ICON_PATHS, normalizeEditorLocale, EXCEL_CAPABILITY_BACKSTAGE_PAGES, EXCEL_CAPABILITY_COMMANDS, normalizeThemeMode, applyThemeColors, parseSelectionRef, selectionRef, fontCommands, alignmentCommands, numberCommands, editBridge, FONT_SIZES, FONT_NAMES, style, activeRef, numberFormatOptions, selectionFormatting, DirtyState, createCommandRegistry, createDialogRegistry, createSelectionModel, SheetSelections, translator, initialSelection, sheetBaseName, historyOf, onRibbonTabsChange, activeChart, CellViewCache, QUADRANTS, columnHeaderHeight, rowHeaderWidth, GridGeometry, cellRange, scrollToReveal, buildItems, fitNumber, cssFont, clampAddress, selectCell, movingEnd, extendSelection, moveWithinSelection, rowsRange, colsRange, ALL_RANGE, ribbonTabs, isTabHidden, selectTab, setTabHidden, tabButton, searchCommands, formatNumber, target, activeSmartArt, isSingleCell, spanRange, selectionCellCount, addRange, TEMPLATES, createTemplateWorkbook, fillPaint, iconSvg, colSelected, rowSelected, rowHeaderMenu, columnHeaderMenu, cellMenu, isMenuSeparator, textDecoration, justify, alignItems, textAlign, hasBorders, edgeCss, diagonalSvg, registerRibbonTabs, installFormatPainter, SHEET_ICONS, clipboardCommands, cellCommands, editingCommands, pageLayoutCommands, pageBreakCommands, formulaCommands, dataCommands, whatIfCommands, contextualCommands, reviewTab, viewTab, helpTab, tabMenu, editing, icon, DATA_BAR_COLORS, dataBarRule, COLOR_SCALES, colorScaleRule, iconSetRule, tableAt, timelineSourceAt, slicerSourceAt, viewing, activeTable, BORDER_PRESETS, ORIENTATIONS, ACCOUNTING_FORMATS, themePaletteItems, MARGIN_PRESETS, PAPER_SIZES, FUNCTION_MENUS, MORE_FUNCTION_CATEGORIES, functionsIn, activeSlicer, activeTimeline, activeStyle, selectSpecial, insertFunctionCall, guessHeader, regionOf, evaluateRef, editChart, HIGHLIGHT_STYLES, ICON_SETS, TABLE_STYLES, tableStylePreview, resolveNameBox, absoluteReference, nameForRange, recentFunctions, buildChart, detectCategory, CATEGORIES, TIME_CODES, DATE_CODES, DEFAULT_OPTIONS, cellStyleItems, SYMBOLS, buildCode, UNSET, dxfCss, negativeCodes, iconCount, iconThresholds, rowsOf, colsOf } from 'ooxml-core/xlsx/ui';
|
|
22
|
+
import { SPECIAL_CODES, FRACTION_CODES, translate, INSERT_CHART_TYPES, AUTOSUM_FUNCTIONS, ICON_ACCENTS, ICON_PATHS, normalizeEditorLocale, EXCEL_CAPABILITY_BACKSTAGE_PAGES, EXCEL_CAPABILITY_COMMANDS, normalizeThemeMode, applyThemeColors, parseSelectionRef, selectionRef, fontCommands, alignmentCommands, numberCommands, editBridge, FONT_SIZES, FONT_NAMES, style, activeRef, numberFormatOptions, selectionFormatting, DirtyState, createCommandRegistry, createDialogRegistry, createSelectionModel, SheetSelections, translator, initialSelection, sheetBaseName, historyOf, onRibbonTabsChange, activeChart, CellViewCache, QUADRANTS, columnHeaderHeight, rowHeaderWidth, GridGeometry, cellRange, scrollToReveal, buildItems, fitNumber, cssFont, clampAddress, selectCell, movingEnd, extendSelection, moveWithinSelection, rowsRange, colsRange, ALL_RANGE, ribbonTabs, isTabHidden, selectTab, setTabHidden, tabButton, searchCommands, formatNumber, target, activeSmartArt, isSingleCell, spanRange, selectionCellCount, addRange, TEMPLATES, createTemplateWorkbook, fillPaint, iconSvg, colSelected, rowSelected, rowHeaderMenu, columnHeaderMenu, cellMenu, isMenuSeparator, textDecoration, justify, alignItems, textAlign, hasBorders, edgeCss, diagonalSvg, registerRibbonTabs, installFormatPainter, SHEET_ICONS, clipboardCommands, cellCommands, editingCommands, pageLayoutCommands, pageBreakCommands, formulaCommands, dataCommands, whatIfCommands, contextualCommands, reviewTab, viewTab, helpTab, tabMenu, editing, icon, DATA_BAR_COLORS, dataBarRule, COLOR_SCALES, colorScaleRule, iconSetRule, tableAt, timelineSourceAt, slicerSourceAt, viewing, activeTable, BORDER_PRESETS, ORIENTATIONS, ACCOUNTING_FORMATS, themePaletteItems, MARGIN_PRESETS, PAPER_SIZES, FUNCTION_MENUS, MORE_FUNCTION_CATEGORIES, functionsIn, activeSlicer, activeTimeline, activeStyle, selectSpecial, insertFunctionCall, guessHeader, regionOf, evaluateRef, editChart, suggestForecastEnd, FORECAST_AGGREGATIONS, createForecastSheet, ForecastError, forecastMessage, HIGHLIGHT_STYLES, ICON_SETS, TABLE_STYLES, tableStylePreview, resolveNameBox, absoluteReference, nameForRange, recentFunctions, buildChart, createScenarioSummary, detectCategory, CATEGORIES, TIME_CODES, DATE_CODES, DEFAULT_OPTIONS, cellStyleItems, SYMBOLS, buildCode, UNSET, dxfCss, negativeCodes, iconCount, iconThresholds, rowsOf, colsOf } from 'ooxml-core/xlsx/ui';
|
|
23
23
|
export { EDITOR_LOCALES, EXCEL_CAPABILITY_IDS, THEME_KEYS, normalizeEditorLocale, registerRibbonTabs, themeToCssVars, darkTheme as xlsxDarkTheme, lightTheme as xlsxLightTheme } from 'ooxml-core/xlsx/ui';
|
|
24
|
-
import { createWorksheet, cellInputText, createEditSession, approximateMeasure, createWorkbook, MAX_ROW, MAX_COL, createGridMetrics, mergeAt, visibleCells, getCell, FUNCTION_CATALOG, closeParens, isFormulaText, parseCellInput, formatAddress, referenceTarget, navigate, anchorToPixelBox, createRefEvaluator, chartView, renderChartSvg, CHART_FILL_PARTS, selectionOfPeriods, pixelBoxToAnchor, listValidationOptions, validationAt, getValue, resolvePasteOptions, selectionStats, formatSelectionStat, chartSpaceOf, xlsxChartExDataSheet, pictureAnchorAt, nameAtCaret, functionMatches, callAtCaret, acceptsReference, formatRange, splice, translateFormula, slicerStyleColors, slicerGeometry, timelineGeometry, TIMELINE_PERIOD_WIDTH, TIMELINE_METRICS, timelineView, slicerItems, selectionAfterClick, isCellError, layoutRemoteSelections, parseHtmlTable, toggleAbsolute, rangeContains, printRange, chartSeriesTransparencyPatch, chartSeriesTransparency, chartSeriesGradientPatch, chartSeriesSolidFillPatch, chartSeriesFillPatch, chartWithElementFills, chartElementTransparencyPatch, chartElementTransparency, chartElementGradientPatch, chartElementSolidFillPatch, chartElementFillPatch, chartElementFill, chartColorScheme, chartBarSpacing, columnLabel, coloredReferences, syntaxParams, activeParam, drawingSchemeColors, pageBreakPreview, normalizeRange, currentRegion, autoFitColumnWidth, chartGradientStopTransparency, paginateWorksheet, resolveColor, DEFAULT_THEME, pageHeaderFooter, createPrintMergeIndex, cellView, pixelsToColumnWidth, renderHeaderFooterRuns, planBreakDrag, resizePrintArea, nextSheetName, sheetByName, pivotGroupableFields, pivotGroupableDateFields, pivotSubtotalFields, DEFAULT_COL_WIDTH, pageViewLayout, formatValue, isDateFormat, selectedSparklineGroups, pivotTableAt, validateDefinedName, usedRange, pivotAxisChoices, parseAddress, PIVOT_DATE_UNITS, PIVOT_SUBTOTAL_ORDER, parseRange, parseInputCell, displayText, styleAt, rangesIntersect, chartStylePresetOf, chartTakesQuickLayout, SLICER_STYLE_NAMES, slicerStyleLabel, slicerStylePreview, pageViewCellRect, pageOfCell, validateSheetName, dateToSerial, IMAGE_EXTENSIONS, verifySheetPassword, verifyWorkbookPassword, quoteSheetName, pivotRowFields, pivotValuesIndex, pivotSourceData, defaultFieldGroup, defaultDateGroup, dateGroupDays, pivotIsoToSerial, fieldSubtotalFunctions, printTitles, formatPrintTitleSpan, parsePrintTitleSpan, scenariosOf, PAGE_VIEW_GAP, pivotPageItems, pivotPageItemLabel, pivotSerialToIso, previewScenario,
|
|
24
|
+
import { createWorksheet, cellInputText, createEditSession, approximateMeasure, createWorkbook, MAX_ROW, MAX_COL, createGridMetrics, mergeAt, visibleCells, getCell, FUNCTION_CATALOG, closeParens, isFormulaText, parseCellInput, formatAddress, referenceTarget, navigate, anchorToPixelBox, createRefEvaluator, chartView, renderChartSvg, CHART_FILL_PARTS, selectionOfPeriods, pixelBoxToAnchor, listValidationOptions, validationAt, getValue, resolvePasteOptions, selectionStats, formatSelectionStat, chartSpaceOf, xlsxChartExDataSheet, pictureAnchorAt, nameAtCaret, functionMatches, callAtCaret, acceptsReference, formatRange, splice, translateFormula, slicerStyleColors, slicerGeometry, timelineGeometry, TIMELINE_PERIOD_WIDTH, TIMELINE_METRICS, controlStateIn, controlListItems, formControlSvg, shapeSvg, controlLinkCell, controlValueAtFraction, timelineView, slicerItems, selectionAfterClick, isCellError, layoutRemoteSelections, parseHtmlTable, CUT_MULTIPLE, toggleAbsolute, rangeContains, printRange, chartSeriesTransparencyPatch, chartSeriesTransparency, chartSeriesGradientPatch, chartSeriesSolidFillPatch, chartSeriesFillPatch, chartWithElementFills, chartElementTransparencyPatch, chartElementTransparency, chartElementGradientPatch, chartElementSolidFillPatch, chartElementFillPatch, chartElementFill, chartColorScheme, chartBarSpacing, columnLabel, coloredReferences, syntaxParams, activeParam, drawingSchemeColors, applyControlAction, pageBreakPreview, pasteAreas, normalizeRange, currentRegion, autoFitColumnWidth, chartGradientStopTransparency, paginateWorksheet, resolveColor, DEFAULT_THEME, pageHeaderFooter, createPrintMergeIndex, cellView, pixelsToColumnWidth, renderHeaderFooterRuns, planBreakDrag, resizePrintArea, headerFooterPicture, nextSheetName, sheetByName, pivotGroupableFields, pivotGroupableDateFields, pivotSubtotalFields, DEFAULT_COL_WIDTH, pageViewLayout, formatValue, isDateFormat, selectedSparklineGroups, pivotTableAt, validateDefinedName, usedRange, pivotAxisChoices, parseAddress, PIVOT_DATE_UNITS, PIVOT_SUBTOTAL_ORDER, parseRange, parseInputCell, displayText, serialToDate, styleAt, rangesIntersect, chartStylePresetOf, chartTakesQuickLayout, SLICER_STYLE_NAMES, slicerStyleLabel, slicerStylePreview, pageViewCellRect, pageOfCell, validateSheetName, dateToSerial, IMAGE_EXTENSIONS, verifySheetPassword, verifyWorkbookPassword, quoteSheetName, pivotRowFields, pivotValuesIndex, pivotSourceData, defaultFieldGroup, defaultDateGroup, dateGroupDays, pivotIsoToSerial, fieldSubtotalFunctions, printTitles, formatPrintTitleSpan, parsePrintTitleSpan, scenariosOf, PAGE_VIEW_GAP, pivotPageItems, pivotPageItemLabel, pivotSerialToIso, previewScenario, customViewsOf, BUILTIN_NUMBER_FORMATS, validateTableName, pixelsToEmu, pageViewHit, resizedFrameAnchor, headerFooterKey, splitHeaderFooter, composeHeaderFooter } from 'ooxml-core/xlsx';
|
|
25
25
|
import { isCapabilityEnabled, capabilityHiddenActions, saveToStorage, documentSaveMeta, withoutHiddenEntries } from 'ooxml-core/embedding';
|
|
26
26
|
import { hyperlinkPolicy } from 'ooxml-core/opc';
|
|
27
27
|
import { previewDiagramLayout, resolveDiagramDrawingStyles, DIAGRAM_INSERT_CATEGORIES, DIAGRAM_INSERT_PRESETS, RECT_GRADIENT_DIRECTIONS, OFFICE_GRADIENT_PRESETS, officeGradientPresetId, officeGradientPresetFill, resolveDrawingColor, drawingColorBrightness, drawingColorCss, rectGradientDirection, DIAGRAM_DESIGN_COMMANDS, DIAGRAM_COLOR_ENTRIES, DIAGRAM_STYLE_ENTRIES, DIAGRAM_ADD_SHAPE_LABEL, DIAGRAM_DESIGN_GROUPS, DIAGRAM_ADD_SHAPE_COMMANDS } from 'ooxml-core/diagram';
|
|
@@ -78,34 +78,34 @@ var DEFAULT_AUTHOR_NAME = "Author";
|
|
|
78
78
|
function isXlsxEditorAttribute(name) {
|
|
79
79
|
return XLSX_EDITOR_ATTRIBUTES.includes(name);
|
|
80
80
|
}
|
|
81
|
-
function applyAttribute(
|
|
81
|
+
function applyAttribute(target40, name, value) {
|
|
82
82
|
switch (name) {
|
|
83
83
|
case "locale":
|
|
84
|
-
if (normalizeEditorLocale(value ?? "en") !==
|
|
84
|
+
if (normalizeEditorLocale(value ?? "en") !== target40.locale) target40.locale = value ?? "en";
|
|
85
85
|
return;
|
|
86
86
|
case "read-only":
|
|
87
|
-
|
|
87
|
+
target40.readOnly = value !== null && value !== "false";
|
|
88
88
|
return;
|
|
89
89
|
case "file-name": {
|
|
90
90
|
const next = value || DEFAULT_FILE_NAME;
|
|
91
|
-
if (next !==
|
|
91
|
+
if (next !== target40.fileName) target40.fileName = next;
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
case "author-name": {
|
|
95
95
|
const next = value || DEFAULT_AUTHOR_NAME;
|
|
96
|
-
if (next !==
|
|
96
|
+
if (next !== target40.authorName) target40.authorName = next;
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
case "theme": {
|
|
100
100
|
const next = normalizeThemeMode(value);
|
|
101
|
-
if (next !==
|
|
101
|
+
if (next !== target40.theme) target40.theme = next;
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
case "show-toolbar":
|
|
105
|
-
if (value !== "false" !==
|
|
105
|
+
if (value !== "false" !== target40.showToolbar) target40.showToolbar = value !== "false";
|
|
106
106
|
return;
|
|
107
107
|
case "show-formula-bar":
|
|
108
|
-
if (value !== "false" !==
|
|
108
|
+
if (value !== "false" !== target40.showFormulaBar) target40.showFormulaBar = value !== "false";
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function reflectAttribute(element, name, value) {
|
|
@@ -465,6 +465,26 @@ function cellCss(view) {
|
|
|
465
465
|
else if (fill && "pattern" in fill) parts.push(`background:${fill.fg}`);
|
|
466
466
|
return parts.join(";");
|
|
467
467
|
}
|
|
468
|
+
|
|
469
|
+
// src/xlsx/header-image.ts
|
|
470
|
+
var urls = /* @__PURE__ */ new WeakMap();
|
|
471
|
+
function headerFooterImageUrl(workbook, image) {
|
|
472
|
+
const bytes = workbook.source?.parts.get(image.partName);
|
|
473
|
+
if (!bytes) return void 0;
|
|
474
|
+
const cached = urls.get(bytes);
|
|
475
|
+
if (cached) return cached;
|
|
476
|
+
let binary = "";
|
|
477
|
+
for (let i = 0; i < bytes.length; i += 32768)
|
|
478
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
479
|
+
const url = `data:${image.contentType};base64,${btoa(binary)}`;
|
|
480
|
+
urls.set(bytes, url);
|
|
481
|
+
return url;
|
|
482
|
+
}
|
|
483
|
+
function headerFooterImageSize(image, scale) {
|
|
484
|
+
return { width: image.widthPt * 96 * scale / 72, height: image.heightPt * 96 * scale / 72 };
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// src/xlsx/print-header.ts
|
|
468
488
|
function printPageHeaders(workbook, sheetIndex, layout, page, title, options) {
|
|
469
489
|
const sheet = workbook.sheets[sheetIndex];
|
|
470
490
|
const setup = sheet.pageSetup ?? {};
|
|
@@ -476,7 +496,8 @@ function printPageHeaders(workbook, sheetIndex, layout, page, title, options) {
|
|
|
476
496
|
sheet: sheet.name,
|
|
477
497
|
file: (options.fileName ?? title).split(/[\\/]/).at(-1),
|
|
478
498
|
...options.date ? { date: options.date } : {},
|
|
479
|
-
...options.locale ? { locale: options.locale } : {}
|
|
499
|
+
...options.locale ? { locale: options.locale } : {},
|
|
500
|
+
themeColors: workbook.theme.colors
|
|
480
501
|
};
|
|
481
502
|
const left = (setup.alignWithMargins === false ? 0.7 : layout.margins.left) * 96;
|
|
482
503
|
const right = (setup.alignWithMargins === false ? 0.7 : layout.margins.right) * 96;
|
|
@@ -484,14 +505,26 @@ function printPageHeaders(workbook, sheetIndex, layout, page, title, options) {
|
|
|
484
505
|
const band2 = (kind, value) => {
|
|
485
506
|
if (!value) return "";
|
|
486
507
|
const sections = renderHeaderFooterRuns(value, context).sections;
|
|
487
|
-
const runs = (section) => sections[section].map(({ text: text4, style: style2 }) => {
|
|
508
|
+
const runs = (section) => sections[section].map(({ text: text4, style: style2, picture }) => {
|
|
509
|
+
if (picture) {
|
|
510
|
+
const image = headerFooterPicture(sheet, kind, section, page, number);
|
|
511
|
+
const url = image ? headerFooterImageUrl(workbook, image) : void 0;
|
|
512
|
+
if (!image || !url) return "";
|
|
513
|
+
const { width, height } = headerFooterImageSize(
|
|
514
|
+
image,
|
|
515
|
+
setup.scaleWithDoc === false ? 1 : layout.scale
|
|
516
|
+
);
|
|
517
|
+
return `<img src="${escapeHtml(url)}" alt="" style="width:${width}px;height:${height}px;vertical-align:top">`;
|
|
518
|
+
}
|
|
488
519
|
const css2 = [
|
|
489
520
|
style2.font ? `font-family:${style2.font.replace(/["\\;<>]/g, "")}` : "",
|
|
490
521
|
style2.size ? `font-size:${style2.size / 11 * size}px` : "",
|
|
491
522
|
style2.color ? `color:${style2.color}` : "",
|
|
492
523
|
`font-weight:${style2.bold ? 700 : 400}`,
|
|
493
524
|
`font-style:${style2.italic ? "italic" : "normal"}`,
|
|
494
|
-
`text-decoration:${[style2.underline ? "underline" : "", style2.strike ? "line-through" : ""].filter(Boolean).join(" ") || "none"}
|
|
525
|
+
`text-decoration:${[style2.underline || style2.doubleUnderline ? "underline" : "", style2.strike ? "line-through" : ""].filter(Boolean).join(" ") || "none"}${style2.doubleUnderline ? ";text-decoration-style:double" : ""}`,
|
|
526
|
+
style2.superscript ? "vertical-align:super;font-size:smaller" : "",
|
|
527
|
+
style2.subscript ? "vertical-align:sub;font-size:smaller" : ""
|
|
495
528
|
].filter(Boolean).join(";");
|
|
496
529
|
return `<span style="${escapeHtml(css2)}">${escapeHtml(text4)}</span>`;
|
|
497
530
|
}).join("");
|
|
@@ -560,9 +593,9 @@ function printHtml(doc, html) {
|
|
|
560
593
|
frame.setAttribute("sandbox", "allow-same-origin allow-modals");
|
|
561
594
|
frame.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden";
|
|
562
595
|
doc.body.append(frame);
|
|
563
|
-
const
|
|
596
|
+
const target40 = frame.contentWindow;
|
|
564
597
|
const frameDoc = frame.contentDocument;
|
|
565
|
-
if (!
|
|
598
|
+
if (!target40 || !frameDoc) {
|
|
566
599
|
frame.remove();
|
|
567
600
|
return;
|
|
568
601
|
}
|
|
@@ -572,18 +605,18 @@ function printHtml(doc, html) {
|
|
|
572
605
|
let safety;
|
|
573
606
|
const cleanup = () => {
|
|
574
607
|
if (safety !== void 0) clearTimeout(safety);
|
|
575
|
-
|
|
608
|
+
target40.removeEventListener("afterprint", cleanup);
|
|
576
609
|
frame.remove();
|
|
577
610
|
if (pendingFrames.get(doc) === cleanup) pendingFrames.delete(doc);
|
|
578
611
|
};
|
|
579
612
|
pendingFrames.set(doc, cleanup);
|
|
580
|
-
|
|
613
|
+
target40.addEventListener("afterprint", cleanup);
|
|
581
614
|
safety = setTimeout(cleanup, PRINT_FRAME_TIMEOUT_MS);
|
|
582
615
|
setTimeout(() => {
|
|
583
616
|
if (!frame.isConnected) return;
|
|
584
617
|
try {
|
|
585
|
-
|
|
586
|
-
|
|
618
|
+
target40.focus();
|
|
619
|
+
target40.print();
|
|
587
620
|
} catch (error) {
|
|
588
621
|
cleanup();
|
|
589
622
|
console.error("xlsx-editor: printing failed", error);
|
|
@@ -1962,10 +1995,10 @@ function findShortcut(event, mac) {
|
|
|
1962
1995
|
return SHORTCUTS.find((shortcut) => shortcut.keys.some((spec) => matchesKeys(event, spec, mac)));
|
|
1963
1996
|
}
|
|
1964
1997
|
function inTextField(event) {
|
|
1965
|
-
const
|
|
1966
|
-
if (!(
|
|
1967
|
-
if (
|
|
1968
|
-
return
|
|
1998
|
+
const target40 = event.composedPath()[0];
|
|
1999
|
+
if (!(target40 instanceof Element)) return false;
|
|
2000
|
+
if (target40.closest(".xve-grid-host")) return false;
|
|
2001
|
+
return target40.matches(
|
|
1969
2002
|
'input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select, [contenteditable=""], [contenteditable="true"]'
|
|
1970
2003
|
);
|
|
1971
2004
|
}
|
|
@@ -2135,11 +2168,11 @@ function alignmentTab(init) {
|
|
|
2135
2168
|
const alignment = patch();
|
|
2136
2169
|
return Object.keys(alignment).length ? { alignment } : {};
|
|
2137
2170
|
},
|
|
2138
|
-
apply: (
|
|
2171
|
+
apply: (target40) => {
|
|
2139
2172
|
if (!changed.has("merge") || merge.input.checked === merged) return;
|
|
2140
|
-
for (const range2 of
|
|
2141
|
-
if (merge.input.checked)
|
|
2142
|
-
else
|
|
2173
|
+
for (const range2 of target40.ranges)
|
|
2174
|
+
if (merge.input.checked) target40.session.merge(target40.sheet, range2, "merge");
|
|
2175
|
+
else target40.session.unmerge(target40.sheet, range2);
|
|
2143
2176
|
},
|
|
2144
2177
|
focus: () => horizontal.focus()
|
|
2145
2178
|
};
|
|
@@ -3279,9 +3312,9 @@ function openGoTo(ctx) {
|
|
|
3279
3312
|
buttons: [special],
|
|
3280
3313
|
opened: () => reference.focus(),
|
|
3281
3314
|
submit: () => {
|
|
3282
|
-
const
|
|
3283
|
-
if (!
|
|
3284
|
-
selectOn(ctx,
|
|
3315
|
+
const target40 = resolveReference(ctx, reference.value);
|
|
3316
|
+
if (!target40) return invalid(ctx, reference, "Reference is not valid.");
|
|
3317
|
+
selectOn(ctx, target40.sheet, target40.range);
|
|
3285
3318
|
return reference.value.trim();
|
|
3286
3319
|
}
|
|
3287
3320
|
},
|
|
@@ -8123,8 +8156,8 @@ function workbookViewCommands() {
|
|
|
8123
8156
|
id: "view.custom-views",
|
|
8124
8157
|
label: "Custom Views",
|
|
8125
8158
|
icon: icon("customViews"),
|
|
8126
|
-
enabled: () =>
|
|
8127
|
-
run: () => void
|
|
8159
|
+
enabled: (ctx) => !!ctx.session() && !ctx.readOnly(),
|
|
8160
|
+
run: (ctx) => void ctx.dialogs.open("custom-views")
|
|
8128
8161
|
}
|
|
8129
8162
|
];
|
|
8130
8163
|
}
|
|
@@ -8352,6 +8385,201 @@ function openDataTable(ctx) {
|
|
|
8352
8385
|
}
|
|
8353
8386
|
});
|
|
8354
8387
|
}
|
|
8388
|
+
function readRange(text3) {
|
|
8389
|
+
const ref = text3.trim().replace(/^=/, "").replace(/^.*!/, "").replace(/\$/g, "");
|
|
8390
|
+
const range2 = ref ? parseRange(ref) : void 0;
|
|
8391
|
+
return range2 ? normalizeRange(range2) : void 0;
|
|
8392
|
+
}
|
|
8393
|
+
var addressOf = (r) => {
|
|
8394
|
+
const a = (row2, col) => {
|
|
8395
|
+
let letters = "";
|
|
8396
|
+
for (let n = col + 1; n > 0; n = Math.floor((n - 1) / 26))
|
|
8397
|
+
letters = String.fromCharCode(65 + (n - 1) % 26) + letters;
|
|
8398
|
+
return `$${letters}$${row2 + 1}`;
|
|
8399
|
+
};
|
|
8400
|
+
const start = a(r.start.row, r.start.col);
|
|
8401
|
+
const end = a(r.end.row, r.end.col);
|
|
8402
|
+
return start === end ? start : `${start}:${end}`;
|
|
8403
|
+
};
|
|
8404
|
+
function suggestedRanges(range2) {
|
|
8405
|
+
if (range2.end.col <= range2.start.col) return void 0;
|
|
8406
|
+
return {
|
|
8407
|
+
timeline: { start: range2.start, end: { row: range2.end.row, col: range2.start.col } },
|
|
8408
|
+
values: {
|
|
8409
|
+
start: { row: range2.start.row, col: range2.start.col + 1 },
|
|
8410
|
+
end: { row: range2.end.row, col: range2.start.col + 1 }
|
|
8411
|
+
}
|
|
8412
|
+
};
|
|
8413
|
+
}
|
|
8414
|
+
function parseEnd(text3, date1904) {
|
|
8415
|
+
const trimmed = text3.trim();
|
|
8416
|
+
if (trimmed === "") return Number.NaN;
|
|
8417
|
+
const number = Number(trimmed);
|
|
8418
|
+
if (Number.isFinite(number)) return number;
|
|
8419
|
+
const parsed = Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(trimmed) ? `${trimmed}T00:00:00Z` : trimmed);
|
|
8420
|
+
return Number.isNaN(parsed) ? Number.NaN : Math.floor(dateToSerial(new Date(parsed), date1904));
|
|
8421
|
+
}
|
|
8422
|
+
function openForecastSheet(ctx) {
|
|
8423
|
+
const t = target(ctx);
|
|
8424
|
+
if (!t) return Promise.resolve(void 0);
|
|
8425
|
+
const guess = suggestedRanges(regionOf(t));
|
|
8426
|
+
const timeline = textInput(ctx, guess ? addressOf(guess.timeline) : "");
|
|
8427
|
+
const values = textInput(ctx, guess ? addressOf(guess.values) : "");
|
|
8428
|
+
const date1904 = Boolean(t.workbook.date1904);
|
|
8429
|
+
const suggestion = guess ? suggestForecastEnd(t.session, { sheet: t.sheet, ...guess }) : void 0;
|
|
8430
|
+
const endText = suggestion ? suggestion.date ? serialToDate(suggestion.end, date1904).toISOString().slice(0, 10) : String(suggestion.end) : "";
|
|
8431
|
+
const end = textInput(ctx, endText);
|
|
8432
|
+
const interval = checkbox(ctx, "Confidence interval", true);
|
|
8433
|
+
const level = numberInput(ctx, 95, 1, 99);
|
|
8434
|
+
level.setAttribute("aria-label", ctx.t("Confidence level (%)"));
|
|
8435
|
+
const seasonMode = radios(
|
|
8436
|
+
ctx,
|
|
8437
|
+
"Seasonality",
|
|
8438
|
+
[
|
|
8439
|
+
["auto", "Detect automatically"],
|
|
8440
|
+
["manual", "Set manually"]
|
|
8441
|
+
],
|
|
8442
|
+
"auto"
|
|
8443
|
+
);
|
|
8444
|
+
const season = numberInput(ctx, 1, 0, 8760);
|
|
8445
|
+
season.setAttribute("aria-label", ctx.t("Season length"));
|
|
8446
|
+
const fill = select(
|
|
8447
|
+
ctx,
|
|
8448
|
+
[
|
|
8449
|
+
["interpolate", "Interpolation"],
|
|
8450
|
+
["zeros", "Zeros"]
|
|
8451
|
+
],
|
|
8452
|
+
"interpolate"
|
|
8453
|
+
);
|
|
8454
|
+
const aggregate = select(
|
|
8455
|
+
ctx,
|
|
8456
|
+
FORECAST_AGGREGATIONS.map(([code, name]) => [String(code), name]),
|
|
8457
|
+
"1"
|
|
8458
|
+
);
|
|
8459
|
+
const statistics = checkbox(ctx, "Include forecast statistics", false);
|
|
8460
|
+
const chart = select(
|
|
8461
|
+
ctx,
|
|
8462
|
+
[
|
|
8463
|
+
["line", "Line chart"],
|
|
8464
|
+
["column", "Column chart"]
|
|
8465
|
+
],
|
|
8466
|
+
"line"
|
|
8467
|
+
);
|
|
8468
|
+
const syncEnabled = () => {
|
|
8469
|
+
level.disabled = !interval.input.checked;
|
|
8470
|
+
season.disabled = seasonMode.get() !== "manual";
|
|
8471
|
+
};
|
|
8472
|
+
interval.input.addEventListener("change", syncEnabled);
|
|
8473
|
+
for (const input of seasonMode.inputs) input.addEventListener("change", syncEnabled);
|
|
8474
|
+
syncEnabled();
|
|
8475
|
+
return showDialog(ctx, {
|
|
8476
|
+
name: "forecast-sheet",
|
|
8477
|
+
heading: "Create Forecast Worksheet",
|
|
8478
|
+
body: [
|
|
8479
|
+
field(ctx, "Timeline range:", timeline),
|
|
8480
|
+
field(ctx, "Values range:", values),
|
|
8481
|
+
field(ctx, "Forecast end:", end),
|
|
8482
|
+
row(ctx, interval.wrapper, level),
|
|
8483
|
+
fieldset(ctx, "Seasonality", seasonMode.element, field(ctx, "Season length", season)),
|
|
8484
|
+
field(ctx, "Fill missing points using:", fill),
|
|
8485
|
+
field(ctx, "Aggregate duplicates using:", aggregate),
|
|
8486
|
+
statistics.wrapper,
|
|
8487
|
+
field(ctx, "Chart type", chart)
|
|
8488
|
+
],
|
|
8489
|
+
opened: () => end.focus(),
|
|
8490
|
+
submit: () => {
|
|
8491
|
+
const timelineRange = readRange(timeline.value);
|
|
8492
|
+
const valuesRange = readRange(values.value);
|
|
8493
|
+
if (!timelineRange || !valuesRange) {
|
|
8494
|
+
ctx.toast(ctx.t("Reference is not valid."), "warning");
|
|
8495
|
+
(timelineRange ? values : timeline).focus();
|
|
8496
|
+
return void 0;
|
|
8497
|
+
}
|
|
8498
|
+
const endValue = parseEnd(end.value, date1904);
|
|
8499
|
+
if (Number.isNaN(endValue)) {
|
|
8500
|
+
ctx.toast(ctx.t("Enter the forecast end as a date or a number."), "warning");
|
|
8501
|
+
end.focus();
|
|
8502
|
+
return void 0;
|
|
8503
|
+
}
|
|
8504
|
+
try {
|
|
8505
|
+
const result = createForecastSheet(t.session, {
|
|
8506
|
+
sheet: t.sheet,
|
|
8507
|
+
timeline: timelineRange,
|
|
8508
|
+
values: valuesRange,
|
|
8509
|
+
end: endValue,
|
|
8510
|
+
confidence: interval.input.checked ? Number(level.value) / 100 : null,
|
|
8511
|
+
seasonality: seasonMode.get() === "manual" ? Number(season.value) : "auto",
|
|
8512
|
+
fill: fill.value === "zeros" ? "zeros" : "interpolate",
|
|
8513
|
+
aggregate: Number(aggregate.value),
|
|
8514
|
+
statistics: statistics.input.checked,
|
|
8515
|
+
chart: chart.value === "column" ? "column" : "line"
|
|
8516
|
+
});
|
|
8517
|
+
ctx.setActiveSheet(result.sheet);
|
|
8518
|
+
return result.sheet;
|
|
8519
|
+
} catch (error) {
|
|
8520
|
+
if (!(error instanceof ForecastError)) throw error;
|
|
8521
|
+
ctx.toast(ctx.t(forecastMessage(error.problem)), "warning");
|
|
8522
|
+
return void 0;
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8525
|
+
});
|
|
8526
|
+
}
|
|
8527
|
+
var report = (ctx, error) => ctx.toast(ctx.t(error instanceof Error ? error.message : String(error)), "warning");
|
|
8528
|
+
async function openScenarioSummary(ctx, t) {
|
|
8529
|
+
const kind = radios(ctx, "Report type", [["summary", "Scenario summary"]], "summary");
|
|
8530
|
+
const results = textInput(ctx, t.ws.scenarios?.sqref ?? "");
|
|
8531
|
+
const created = await showDialog(ctx, {
|
|
8532
|
+
name: "scenario-summary",
|
|
8533
|
+
heading: "Scenario Summary",
|
|
8534
|
+
body: [
|
|
8535
|
+
kind.element,
|
|
8536
|
+
field(ctx, "Result cells:", results),
|
|
8537
|
+
text(ctx, "Result cells are optional. Separate several references with commas.")
|
|
8538
|
+
],
|
|
8539
|
+
opened: () => results.focus(),
|
|
8540
|
+
submit: () => {
|
|
8541
|
+
try {
|
|
8542
|
+
const sheet = createScenarioSummary(t.session, {
|
|
8543
|
+
sheet: t.sheet,
|
|
8544
|
+
resultCells: results.value
|
|
8545
|
+
});
|
|
8546
|
+
ctx.setActiveSheet(sheet);
|
|
8547
|
+
return sheet;
|
|
8548
|
+
} catch (error) {
|
|
8549
|
+
report(ctx, error);
|
|
8550
|
+
return void 0;
|
|
8551
|
+
}
|
|
8552
|
+
}
|
|
8553
|
+
});
|
|
8554
|
+
return created !== void 0;
|
|
8555
|
+
}
|
|
8556
|
+
async function openScenarioMerge(ctx, t) {
|
|
8557
|
+
const sources = t.workbook.sheets.flatMap(
|
|
8558
|
+
(sheet2, index) => index !== t.sheet && scenariosOf(sheet2).length ? [[String(index), sheet2.name]] : []
|
|
8559
|
+
);
|
|
8560
|
+
if (!sources.length) {
|
|
8561
|
+
ctx.toast(ctx.t("No other sheet has scenarios to merge."), "warning");
|
|
8562
|
+
return 0;
|
|
8563
|
+
}
|
|
8564
|
+
const sheet = select(ctx, sources, sources[0][0], true);
|
|
8565
|
+
const added = await showDialog(ctx, {
|
|
8566
|
+
name: "scenario-merge",
|
|
8567
|
+
heading: "Merge Scenarios",
|
|
8568
|
+
body: [field(ctx, "Merge scenarios from sheet:", sheet)],
|
|
8569
|
+
opened: () => sheet.focus(),
|
|
8570
|
+
submit: () => {
|
|
8571
|
+
try {
|
|
8572
|
+
return t.session.mergeScenarios(t.sheet, Number(sheet.value));
|
|
8573
|
+
} catch (error) {
|
|
8574
|
+
report(ctx, error);
|
|
8575
|
+
return void 0;
|
|
8576
|
+
}
|
|
8577
|
+
}
|
|
8578
|
+
});
|
|
8579
|
+
return added ?? 0;
|
|
8580
|
+
}
|
|
8581
|
+
|
|
8582
|
+
// src/xlsx/dialogs/scenario-manager.ts
|
|
8355
8583
|
async function editScenario(ctx, t, existing) {
|
|
8356
8584
|
const name = textInput(ctx, existing?.scenario.name ?? "");
|
|
8357
8585
|
const cells = textInput(
|
|
@@ -8418,6 +8646,8 @@ function openScenarioManager(ctx) {
|
|
|
8418
8646
|
const add = button(ctx, "Add...");
|
|
8419
8647
|
const edit = button(ctx, "Edit...");
|
|
8420
8648
|
const del = button(ctx, "Delete");
|
|
8649
|
+
const merge = button(ctx, "Merge...");
|
|
8650
|
+
const summary = button(ctx, "Summary...");
|
|
8421
8651
|
const scenarios = () => scenariosOf(t.ws);
|
|
8422
8652
|
const chosen = () => {
|
|
8423
8653
|
const value = list.value();
|
|
@@ -8427,6 +8657,7 @@ function openScenarioManager(ctx) {
|
|
|
8427
8657
|
const index = chosen();
|
|
8428
8658
|
const scenario = index === void 0 ? void 0 : scenarios()[index];
|
|
8429
8659
|
edit.disabled = del.disabled = !scenario;
|
|
8660
|
+
summary.disabled = !scenarios().length;
|
|
8430
8661
|
if (!scenario) {
|
|
8431
8662
|
details.textContent = scenarios().length ? ctx.t("Select a scenario to see its changing cells.") : ctx.t("No Scenarios defined. Choose Add to add scenarios.");
|
|
8432
8663
|
return;
|
|
@@ -8460,6 +8691,8 @@ function openScenarioManager(ctx) {
|
|
|
8460
8691
|
add.addEventListener("click", () => void run("add"));
|
|
8461
8692
|
edit.addEventListener("click", () => void run("edit"));
|
|
8462
8693
|
del.addEventListener("click", () => void run("delete"));
|
|
8694
|
+
merge.addEventListener("click", () => void openScenarioMerge(ctx, t).then(refresh));
|
|
8695
|
+
summary.addEventListener("click", () => void openScenarioSummary(ctx, t).then(refresh));
|
|
8463
8696
|
refresh();
|
|
8464
8697
|
const first = scenarios()[t.ws.scenarios?.show ?? 0] ? t.ws.scenarios?.show ?? 0 : 0;
|
|
8465
8698
|
if (scenarios().length) list.select(String(first));
|
|
@@ -8468,7 +8701,7 @@ function openScenarioManager(ctx) {
|
|
|
8468
8701
|
heading: "Scenario Manager",
|
|
8469
8702
|
okLabel: "Show",
|
|
8470
8703
|
cancelLabel: "Close",
|
|
8471
|
-
buttons: [add, del, edit],
|
|
8704
|
+
buttons: [add, del, edit, merge, summary],
|
|
8472
8705
|
body: [list.element, details],
|
|
8473
8706
|
opened: () => list.element.focus(),
|
|
8474
8707
|
// Show keeps the dialog open, as Excel does.
|
|
@@ -8483,6 +8716,95 @@ function openScenarioManager(ctx) {
|
|
|
8483
8716
|
}
|
|
8484
8717
|
}).then(() => void 0);
|
|
8485
8718
|
}
|
|
8719
|
+
var report2 = (ctx, error) => ctx.toast(ctx.t(error instanceof Error ? error.message : String(error)), "warning");
|
|
8720
|
+
async function addView(ctx, t) {
|
|
8721
|
+
const name = textInput(ctx, "");
|
|
8722
|
+
const print = checkbox(ctx, "Print settings", true);
|
|
8723
|
+
const hidden = checkbox(ctx, "Hidden rows, columns and filter settings", true);
|
|
8724
|
+
const submitted = await showDialog(ctx, {
|
|
8725
|
+
name: "custom-view-add",
|
|
8726
|
+
heading: "Add View",
|
|
8727
|
+
body: [field(ctx, "Name:", name), print.wrapper, hidden.wrapper],
|
|
8728
|
+
opened: () => name.focus(),
|
|
8729
|
+
submit: () => {
|
|
8730
|
+
try {
|
|
8731
|
+
t.session.addCustomView({
|
|
8732
|
+
name: name.value,
|
|
8733
|
+
includePrintSettings: print.input.checked,
|
|
8734
|
+
includeHiddenRowCol: hidden.input.checked
|
|
8735
|
+
});
|
|
8736
|
+
return true;
|
|
8737
|
+
} catch (error) {
|
|
8738
|
+
report2(ctx, error);
|
|
8739
|
+
return void 0;
|
|
8740
|
+
}
|
|
8741
|
+
}
|
|
8742
|
+
});
|
|
8743
|
+
return submitted === true;
|
|
8744
|
+
}
|
|
8745
|
+
function openCustomViews(ctx) {
|
|
8746
|
+
const t = target(ctx);
|
|
8747
|
+
if (!t) return Promise.resolve(void 0);
|
|
8748
|
+
const list = listBox(
|
|
8749
|
+
ctx,
|
|
8750
|
+
"Views:",
|
|
8751
|
+
() => sync(),
|
|
8752
|
+
() => void show()
|
|
8753
|
+
);
|
|
8754
|
+
const note = el(ctx, "div", "xve-note");
|
|
8755
|
+
const add = button(ctx, "Add...");
|
|
8756
|
+
const del = button(ctx, "Delete");
|
|
8757
|
+
const views = () => customViewsOf(t.workbook);
|
|
8758
|
+
const chosen = () => {
|
|
8759
|
+
const guid = list.value();
|
|
8760
|
+
return views().find((v) => v.guid === guid);
|
|
8761
|
+
};
|
|
8762
|
+
function sync() {
|
|
8763
|
+
del.disabled = !chosen();
|
|
8764
|
+
note.textContent = views().length ? "" : ctx.t("No custom views are saved.");
|
|
8765
|
+
}
|
|
8766
|
+
const refresh = () => {
|
|
8767
|
+
list.setItems(views().map((v) => [v.guid, v.name]));
|
|
8768
|
+
sync();
|
|
8769
|
+
};
|
|
8770
|
+
const show = () => {
|
|
8771
|
+
const view = chosen();
|
|
8772
|
+
if (!view) {
|
|
8773
|
+
ctx.toast(ctx.t("Select a view to show."), "warning");
|
|
8774
|
+
return false;
|
|
8775
|
+
}
|
|
8776
|
+
try {
|
|
8777
|
+
t.session.showCustomView(view.guid);
|
|
8778
|
+
return true;
|
|
8779
|
+
} catch (error) {
|
|
8780
|
+
report2(ctx, error);
|
|
8781
|
+
return false;
|
|
8782
|
+
}
|
|
8783
|
+
};
|
|
8784
|
+
add.addEventListener("click", () => void addView(ctx, t).then(refresh));
|
|
8785
|
+
del.addEventListener("click", () => {
|
|
8786
|
+
const view = chosen();
|
|
8787
|
+
if (!view) return;
|
|
8788
|
+
try {
|
|
8789
|
+
t.session.deleteCustomView(view.guid);
|
|
8790
|
+
} catch (error) {
|
|
8791
|
+
report2(ctx, error);
|
|
8792
|
+
}
|
|
8793
|
+
refresh();
|
|
8794
|
+
});
|
|
8795
|
+
refresh();
|
|
8796
|
+
return showDialog(ctx, {
|
|
8797
|
+
name: "custom-views",
|
|
8798
|
+
heading: "Custom Views",
|
|
8799
|
+
okLabel: "Show",
|
|
8800
|
+
cancelLabel: "Close",
|
|
8801
|
+
buttons: [add, del],
|
|
8802
|
+
body: [list.element, note],
|
|
8803
|
+
opened: () => list.element.focus(),
|
|
8804
|
+
// Show closes the dialog, as in Excel; a missing choice keeps it open.
|
|
8805
|
+
submit: () => show() ? true : void 0
|
|
8806
|
+
}).then(() => void 0);
|
|
8807
|
+
}
|
|
8486
8808
|
var TYPES3 = [
|
|
8487
8809
|
["line", "Line"],
|
|
8488
8810
|
["column", "Column"],
|
|
@@ -9680,7 +10002,9 @@ function registerToolDialogs(ctx) {
|
|
|
9680
10002
|
d.register("text-to-columns", (c) => openTextToColumns(c));
|
|
9681
10003
|
d.register("goal-seek", (c) => openGoalSeek(c));
|
|
9682
10004
|
d.register("data-table", (c) => openDataTable(c));
|
|
10005
|
+
d.register("forecast-sheet", (c) => openForecastSheet(c));
|
|
9683
10006
|
d.register("scenario-manager", (c) => openScenarioManager(c));
|
|
10007
|
+
d.register("custom-views", (c) => openCustomViews(c));
|
|
9684
10008
|
d.register("symbol", (c) => openSymbol(c));
|
|
9685
10009
|
d.register("fill-series", (c) => openFillSeries(c));
|
|
9686
10010
|
d.register("create-table", (c, p) => openCreateTable(c, props(p)));
|
|
@@ -11382,6 +11706,8 @@ function insertTab() {
|
|
|
11382
11706
|
kind: "stack",
|
|
11383
11707
|
controls: [
|
|
11384
11708
|
{ kind: "button", command: "sparkline.settings" },
|
|
11709
|
+
{ kind: "button", command: "sparkline.group" },
|
|
11710
|
+
{ kind: "button", command: "sparkline.ungroup" },
|
|
11385
11711
|
{
|
|
11386
11712
|
kind: "menu",
|
|
11387
11713
|
label: "Clear Sparklines",
|
|
@@ -11553,6 +11879,22 @@ function sparklineCommands() {
|
|
|
11553
11879
|
enabled: hasSparklines,
|
|
11554
11880
|
run: (ctx) => void ctx.dialogs.open("sparkline-settings")
|
|
11555
11881
|
}),
|
|
11882
|
+
...[
|
|
11883
|
+
["group", "Group Sparklines", "groupSparklines"],
|
|
11884
|
+
["ungroup", "Ungroup Sparklines", "ungroupSparklines"]
|
|
11885
|
+
].map(
|
|
11886
|
+
([id, label, method]) => editing({
|
|
11887
|
+
id: `sparkline.${id}`,
|
|
11888
|
+
label,
|
|
11889
|
+
icon: icon("chartLine"),
|
|
11890
|
+
lock: "objects",
|
|
11891
|
+
enabled: hasSparklines,
|
|
11892
|
+
run: (ctx) => {
|
|
11893
|
+
const t = target(ctx);
|
|
11894
|
+
if (t) t.session[method](t.sheet, t.ranges);
|
|
11895
|
+
}
|
|
11896
|
+
})
|
|
11897
|
+
),
|
|
11556
11898
|
...[
|
|
11557
11899
|
["selected", false, "Clear Selected Sparklines"],
|
|
11558
11900
|
["groups", true, "Clear Sparkline Groups"]
|
|
@@ -11819,8 +12161,8 @@ function workbookChartTheme(workbook) {
|
|
|
11819
12161
|
return { scheme: (name) => scheme[name] };
|
|
11820
12162
|
}
|
|
11821
12163
|
var FILL_PARTS = ["chartArea", "plotArea", "title", "legend", "series"];
|
|
11822
|
-
var xlsxFillsTarget = (
|
|
11823
|
-
function xlsxChartFormatSource(chart, space, theme,
|
|
12164
|
+
var xlsxFillsTarget = (target40) => FILL_PARTS.includes(target40.kind);
|
|
12165
|
+
function xlsxChartFormatSource(chart, space, theme, target40) {
|
|
11824
12166
|
const source = chartSpaceFormatSource(space, { theme });
|
|
11825
12167
|
const spacing = chartBarSpacing(chart);
|
|
11826
12168
|
return {
|
|
@@ -11836,7 +12178,7 @@ function xlsxChartFormatSource(chart, space, theme, target37) {
|
|
|
11836
12178
|
sliders: true
|
|
11837
12179
|
};
|
|
11838
12180
|
},
|
|
11839
|
-
...
|
|
12181
|
+
...target40 && xlsxFillsTarget(target40) && source.element(target40).fill.kind !== "pattern" ? { slots: { fill: XLSX_CHART_FILL_SLOT } } : {},
|
|
11840
12182
|
flat: true,
|
|
11841
12183
|
picker: { key: "chartFormat.chartElement", fallback: "Chart element" }
|
|
11842
12184
|
};
|
|
@@ -12241,10 +12583,10 @@ function createGradientTypeField(ctx, onPick) {
|
|
|
12241
12583
|
};
|
|
12242
12584
|
}
|
|
12243
12585
|
function createChartGradientPreview(root, drawing, series, gradient) {
|
|
12244
|
-
const
|
|
12586
|
+
const target40 = typeof series === "number" ? `s${series}` : series;
|
|
12245
12587
|
const nodes = Array.from(
|
|
12246
12588
|
root.querySelectorAll(
|
|
12247
|
-
`.xg-obj[data-index="${drawing}"] :is(linearGradient,radialGradient,pattern)[id$="-${
|
|
12589
|
+
`.xg-obj[data-index="${drawing}"] :is(linearGradient,radialGradient,pattern)[id$="-${target40}"]`
|
|
12248
12590
|
)
|
|
12249
12591
|
);
|
|
12250
12592
|
const originals = nodes.map((node) => ({
|
|
@@ -12881,7 +13223,7 @@ function createChartFormatPane(ctx) {
|
|
|
12881
13223
|
const element = doc.createElement("office-ui-chart-format-pane");
|
|
12882
13224
|
element.className = "xve-chart-series-pane";
|
|
12883
13225
|
element.hidden = true;
|
|
12884
|
-
let
|
|
13226
|
+
let target40 = "chartArea";
|
|
12885
13227
|
let seriesIndex = 0;
|
|
12886
13228
|
let part = "chartArea";
|
|
12887
13229
|
const seriesFill = createSeriesFill(ctx, () => seriesIndex);
|
|
@@ -12894,7 +13236,7 @@ function createChartFormatPane(ctx) {
|
|
|
12894
13236
|
fill.element.slot = XLSX_CHART_FILL_SLOT;
|
|
12895
13237
|
fill.element.querySelector("h3")?.setAttribute("hidden", "");
|
|
12896
13238
|
}
|
|
12897
|
-
const parsed = () => parseChartFormatTargetKey(
|
|
13239
|
+
const parsed = () => parseChartFormatTargetKey(target40);
|
|
12898
13240
|
const isSeries = () => parsed()?.kind === "series";
|
|
12899
13241
|
const commandId = () => isSeries() ? "chart.format-series" : "chart.format-area";
|
|
12900
13242
|
const close = () => {
|
|
@@ -12919,10 +13261,10 @@ function createChartFormatPane(ctx) {
|
|
|
12919
13261
|
const space = chartSpaceOf(book, found.chart);
|
|
12920
13262
|
const theme = workbookChartTheme(book);
|
|
12921
13263
|
const listed = xlsxChartFormatSource(found.chart, space, theme, void 0);
|
|
12922
|
-
if (!listed.targets.some((option) => option.key ===
|
|
13264
|
+
if (!listed.targets.some((option) => option.key === target40)) target40 = "chartArea";
|
|
12923
13265
|
const selected2 = parsed();
|
|
12924
13266
|
seriesIndex = selected2?.kind === "series" ? selected2.seriesIndex : 0;
|
|
12925
|
-
part = BACKGROUNDS.includes(
|
|
13267
|
+
part = BACKGROUNDS.includes(target40) ? target40 : "chartArea";
|
|
12926
13268
|
const slotted = selected2 !== void 0 && xlsxFillsTarget(selected2) && listed.element(selected2).fill.kind !== "pattern";
|
|
12927
13269
|
const [active2, idle] = isSeries() ? [seriesFill, backgroundFill] : [backgroundFill, seriesFill];
|
|
12928
13270
|
idle.refresh(void 0, void 0);
|
|
@@ -12935,11 +13277,11 @@ function createChartFormatPane(ctx) {
|
|
|
12935
13277
|
active2.element.remove();
|
|
12936
13278
|
}
|
|
12937
13279
|
element.source = xlsxChartFormatSource(found.chart, space, theme, selected2);
|
|
12938
|
-
element.target =
|
|
13280
|
+
element.target = target40;
|
|
12939
13281
|
element.disabled = !ctx.commands.isEnabled(commandId());
|
|
12940
13282
|
};
|
|
12941
13283
|
element.addEventListener("office-chart-format-target", (event) => {
|
|
12942
|
-
|
|
13284
|
+
target40 = event.detail.target;
|
|
12943
13285
|
refresh();
|
|
12944
13286
|
});
|
|
12945
13287
|
element.addEventListener("office-chart-format-close", close);
|
|
@@ -12980,13 +13322,13 @@ function createChartFormatPane(ctx) {
|
|
|
12980
13322
|
element.shadowRoot?.querySelector(focus)?.focus();
|
|
12981
13323
|
};
|
|
12982
13324
|
ctx.dialogs.register("format-chart-area", async (_ctx, arg) => {
|
|
12983
|
-
|
|
13325
|
+
target40 = typeof arg === "string" && BACKGROUNDS.includes(arg) ? arg : "chartArea";
|
|
12984
13326
|
open("[data-chart-format-target]");
|
|
12985
13327
|
});
|
|
12986
13328
|
ctx.dialogs.register("format-chart-series", async (_ctx, arg) => {
|
|
12987
13329
|
const found = activeChart(ctx);
|
|
12988
13330
|
const index = typeof arg === "number" && Number.isInteger(arg) && found?.chart.series[arg] ? arg : 0;
|
|
12989
|
-
|
|
13331
|
+
target40 = `series:${index}`;
|
|
12990
13332
|
open('[data-chart-format-field="series.overlap"] input');
|
|
12991
13333
|
});
|
|
12992
13334
|
relocalize();
|
|
@@ -13043,16 +13385,20 @@ function createGridClipboard(host) {
|
|
|
13043
13385
|
const session = ctx.session();
|
|
13044
13386
|
const range2 = lastRange();
|
|
13045
13387
|
if (!session || !range2) return void 0;
|
|
13046
|
-
|
|
13047
|
-
|
|
13388
|
+
const ranges = ctx.selection.get().ranges;
|
|
13389
|
+
const sheet = ctx.activeSheet();
|
|
13390
|
+
let payload;
|
|
13391
|
+
try {
|
|
13392
|
+
if (ranges.length > 1 && cut) throw new RangeError(CUT_MULTIPLE);
|
|
13393
|
+
payload = ranges.length > 1 ? session.copyAreas(sheet, ranges) : cut && !ctx.readOnly() ? session.cut(sheet, range2) : session.copy(sheet, range2);
|
|
13394
|
+
} catch (error) {
|
|
13395
|
+
ctx.toast(ctx.t(error instanceof Error ? error.message : String(error)), "warning");
|
|
13048
13396
|
return void 0;
|
|
13049
13397
|
}
|
|
13050
|
-
const sheet = ctx.activeSheet();
|
|
13051
|
-
const payload = cut && !ctx.readOnly() ? session.cut(sheet, range2) : session.copy(sheet, range2);
|
|
13052
13398
|
internal = payload;
|
|
13053
13399
|
internalSheet = sheet;
|
|
13054
13400
|
marquee = true;
|
|
13055
|
-
host.setMarquee(range2, sheet);
|
|
13401
|
+
host.setMarquee(ranges.length > 1 ? ranges[0] ?? range2 : range2, sheet);
|
|
13056
13402
|
return payload;
|
|
13057
13403
|
};
|
|
13058
13404
|
const clearMarquee = () => {
|
|
@@ -13066,13 +13412,10 @@ function createGridClipboard(host) {
|
|
|
13066
13412
|
const session = ctx.session();
|
|
13067
13413
|
const at = lastRange();
|
|
13068
13414
|
if (!session || !at || ctx.readOnly()) return false;
|
|
13069
|
-
|
|
13070
|
-
ctx.toast(ctx.t("This action won't work on multiple selections."), "warning");
|
|
13071
|
-
return false;
|
|
13072
|
-
}
|
|
13415
|
+
const areas = ctx.selection.get().ranges;
|
|
13073
13416
|
try {
|
|
13074
13417
|
const wasCut = typeof payload !== "string" && payload.cut;
|
|
13075
|
-
const range2 = session.paste(ctx.activeSheet(), at, payload, mode);
|
|
13418
|
+
const range2 = areas.length > 1 ? pasteAreas(session, ctx.activeSheet(), areas, payload, mode) : session.paste(ctx.activeSheet(), at, payload, mode);
|
|
13076
13419
|
host.selectRange(range2);
|
|
13077
13420
|
if (typeof payload !== "string" && wasCut) {
|
|
13078
13421
|
internal = { ...payload, cut: false };
|
|
@@ -13727,11 +14070,11 @@ var CellEditor = class {
|
|
|
13727
14070
|
}
|
|
13728
14071
|
const refs = [];
|
|
13729
14072
|
for (const ref of this.field.references()) {
|
|
13730
|
-
const
|
|
13731
|
-
if (!
|
|
13732
|
-
if (
|
|
14073
|
+
const target40 = referenceTarget(ref.text);
|
|
14074
|
+
if (!target40) continue;
|
|
14075
|
+
if (target40.sheet !== void 0 && target40.sheet.toLowerCase() !== sheet.name.toLowerCase())
|
|
13733
14076
|
continue;
|
|
13734
|
-
refs.push({ range:
|
|
14077
|
+
refs.push({ range: target40.range, color: ref.color });
|
|
13735
14078
|
}
|
|
13736
14079
|
view.overlay.references = refs.length ? refs : void 0;
|
|
13737
14080
|
view.schedule();
|
|
@@ -14034,6 +14377,127 @@ function slicerClickResult(items2, key, event, state) {
|
|
|
14034
14377
|
const mode = event.shiftKey ? "range" : event.ctrlKey || event.metaKey || state.multi ? "toggle" : "single";
|
|
14035
14378
|
return selectionAfterClick(items2, key, mode, state.anchor);
|
|
14036
14379
|
}
|
|
14380
|
+
function paintShape(view, node, shape, box, idPrefix) {
|
|
14381
|
+
node.classList.add("xg-shape");
|
|
14382
|
+
node.setAttribute("role", "img");
|
|
14383
|
+
node.setAttribute("aria-label", shape.name ?? "");
|
|
14384
|
+
node.append(
|
|
14385
|
+
svgNode(
|
|
14386
|
+
view.doc,
|
|
14387
|
+
shapeSvg(shape, box.w, box.h, {
|
|
14388
|
+
theme: view.workbook()?.theme,
|
|
14389
|
+
scale: view.zoom() / 100,
|
|
14390
|
+
idPrefix
|
|
14391
|
+
})
|
|
14392
|
+
)
|
|
14393
|
+
);
|
|
14394
|
+
}
|
|
14395
|
+
function paintFormControl(view, node, control, box, open) {
|
|
14396
|
+
const workbook = view.workbook();
|
|
14397
|
+
const sheet = view.sheet();
|
|
14398
|
+
node.classList.add("xg-formcontrol");
|
|
14399
|
+
node.dataset.controlType = control.controlType;
|
|
14400
|
+
if (!workbook || !sheet) return;
|
|
14401
|
+
const controls = sheet.drawings.filter((d) => d.kind === "formControl");
|
|
14402
|
+
const index = view.sheetIndex();
|
|
14403
|
+
const { state } = controlStateIn(workbook, index, controls, control);
|
|
14404
|
+
const items2 = controlListItems(workbook, index, control);
|
|
14405
|
+
const markup = formControlSvg(control, state, box.w, box.h, {
|
|
14406
|
+
items: items2,
|
|
14407
|
+
scale: view.zoom() / 100
|
|
14408
|
+
});
|
|
14409
|
+
if (!markup) {
|
|
14410
|
+
node.classList.add("xg-obj-unsupported");
|
|
14411
|
+
node.textContent = control.name ?? control.controlType;
|
|
14412
|
+
return;
|
|
14413
|
+
}
|
|
14414
|
+
node.append(svgNode(view.doc, markup));
|
|
14415
|
+
node.setAttribute("role", "group");
|
|
14416
|
+
node.setAttribute("aria-label", control.caption ?? control.name ?? control.controlType);
|
|
14417
|
+
if (open && control.controlType === "dropdown") {
|
|
14418
|
+
const list = h(view.doc, "div", "xg-fc-pop");
|
|
14419
|
+
list.style.top = `${box.h}px`;
|
|
14420
|
+
list.style.width = `${box.w}px`;
|
|
14421
|
+
items2.forEach((item, i) => {
|
|
14422
|
+
const row2 = h(view.doc, "div", "xg-fc-item");
|
|
14423
|
+
row2.dataset.controlPart = "item";
|
|
14424
|
+
row2.dataset.controlIndex = String(i + 1);
|
|
14425
|
+
row2.textContent = item;
|
|
14426
|
+
if (state.selected === i + 1) row2.classList.add("xg-fc-on");
|
|
14427
|
+
list.append(row2);
|
|
14428
|
+
});
|
|
14429
|
+
node.append(list);
|
|
14430
|
+
}
|
|
14431
|
+
}
|
|
14432
|
+
function pressFormControl(view, event, control, node, hooks) {
|
|
14433
|
+
const part = event.target.closest("[data-control-part]");
|
|
14434
|
+
const name = part?.dataset.controlPart;
|
|
14435
|
+
if (!part || !name) {
|
|
14436
|
+
hooks.toggleOpen(false);
|
|
14437
|
+
return false;
|
|
14438
|
+
}
|
|
14439
|
+
const workbook = view.workbook();
|
|
14440
|
+
const sheet = view.sheet();
|
|
14441
|
+
const session = view.ctx.session();
|
|
14442
|
+
if (!workbook || !sheet || !session || view.ctx.readOnly()) return true;
|
|
14443
|
+
const controls = sheet.drawings.filter((d) => d.kind === "formControl");
|
|
14444
|
+
const sheetIndex = view.sheetIndex();
|
|
14445
|
+
const resolved = controlStateIn(workbook, sheetIndex, controls, control);
|
|
14446
|
+
const target40 = controlLinkCell(workbook, sheetIndex, resolved.link);
|
|
14447
|
+
const write = (action) => {
|
|
14448
|
+
const value = applyControlAction(
|
|
14449
|
+
control,
|
|
14450
|
+
controlStateIn(workbook, sheetIndex, controls, control).state,
|
|
14451
|
+
action,
|
|
14452
|
+
resolved.radioIndex
|
|
14453
|
+
);
|
|
14454
|
+
if (value === void 0 || !target40) return;
|
|
14455
|
+
try {
|
|
14456
|
+
session.setCellValue(target40.sheet, target40.row, target40.col, value);
|
|
14457
|
+
} catch (error) {
|
|
14458
|
+
view.ctx.toast(view.ctx.t(error instanceof Error ? error.message : String(error)), "warning");
|
|
14459
|
+
}
|
|
14460
|
+
};
|
|
14461
|
+
if (name === "drop") {
|
|
14462
|
+
hooks.toggleOpen(!hooks.isOpen());
|
|
14463
|
+
return true;
|
|
14464
|
+
}
|
|
14465
|
+
hooks.toggleOpen(false);
|
|
14466
|
+
if (name === "toggle") write({ type: "toggle" });
|
|
14467
|
+
else if (name === "item") write({ type: "select", index: Number(part.dataset.controlIndex) });
|
|
14468
|
+
else if (name === "step-up" || name === "step-down")
|
|
14469
|
+
write({ type: "step", delta: name === "step-up" ? 1 : -1 });
|
|
14470
|
+
else if (name === "track" || name === "thumb") {
|
|
14471
|
+
const svg = node.querySelector("svg");
|
|
14472
|
+
const track = node.querySelector('[data-control-part="track"]');
|
|
14473
|
+
const thumb = node.querySelector('[data-control-part="thumb"]');
|
|
14474
|
+
if (!svg || !track || !thumb) return true;
|
|
14475
|
+
const horizontal = control.horizontal ?? node.clientWidth >= node.clientHeight;
|
|
14476
|
+
const rect = svg.getBoundingClientRect();
|
|
14477
|
+
const zoom = view.zoom() / 100;
|
|
14478
|
+
const trackBox = track.getBBox();
|
|
14479
|
+
const thumbBox = thumb.getBBox();
|
|
14480
|
+
const span = (horizontal ? trackBox.width - thumbBox.width : trackBox.height - thumbBox.height) * zoom || 1;
|
|
14481
|
+
const coordinate = (e) => horizontal ? e.clientX - rect.left : e.clientY - rect.top;
|
|
14482
|
+
if (name === "track") {
|
|
14483
|
+
const thumbStart = (horizontal ? thumbBox.x : thumbBox.y) * zoom;
|
|
14484
|
+
write({ type: "page", direction: coordinate(event) > thumbStart ? 1 : -1 });
|
|
14485
|
+
} else {
|
|
14486
|
+
const grabOffset = coordinate(event) - (horizontal ? thumbBox.x : thumbBox.y) * zoom;
|
|
14487
|
+
const origin = (horizontal ? trackBox.x : trackBox.y) * zoom;
|
|
14488
|
+
trackPointerGesture(node, event.pointerId, {
|
|
14489
|
+
move: (e) => {
|
|
14490
|
+
const fraction = (coordinate(e) - grabOffset - origin) / span;
|
|
14491
|
+
write({ type: "set", value: controlValueAtFraction(control, fraction) });
|
|
14492
|
+
hooks.refresh();
|
|
14493
|
+
},
|
|
14494
|
+
commit: () => void 0,
|
|
14495
|
+
cancel: () => void 0
|
|
14496
|
+
});
|
|
14497
|
+
}
|
|
14498
|
+
}
|
|
14499
|
+
return true;
|
|
14500
|
+
}
|
|
14037
14501
|
var DrawingLayer = class {
|
|
14038
14502
|
#view;
|
|
14039
14503
|
#nodes = /* @__PURE__ */ new Map();
|
|
@@ -14041,6 +14505,9 @@ var DrawingLayer = class {
|
|
|
14041
14505
|
#generation = 0;
|
|
14042
14506
|
#cancelDrag;
|
|
14043
14507
|
#slicerStates = /* @__PURE__ */ new Map();
|
|
14508
|
+
/** Index of the form control drop-down whose list is open. */
|
|
14509
|
+
#openDrop;
|
|
14510
|
+
#closeDrop;
|
|
14044
14511
|
constructor(view) {
|
|
14045
14512
|
this.#view = view;
|
|
14046
14513
|
view.hooks.add(() => this.render());
|
|
@@ -14126,7 +14593,8 @@ var DrawingLayer = class {
|
|
|
14126
14593
|
if (node.parentNode !== parent) parent.append(node);
|
|
14127
14594
|
place(node, box.x, box.y, box.w, box.h);
|
|
14128
14595
|
const multi = drawing.kind === "slicer" && this.#slicerState(drawing.name).multi;
|
|
14129
|
-
const
|
|
14596
|
+
const open = this.#openDrop === index;
|
|
14597
|
+
const sig = `${drawing.kind}:${Math.round(box.w)}x${Math.round(box.h)}:${this.#generation}:${multi}:${open}`;
|
|
14130
14598
|
if (node.xgSig !== sig) {
|
|
14131
14599
|
node.xgSig = sig;
|
|
14132
14600
|
this.#paint(node, drawing, box);
|
|
@@ -14197,6 +14665,10 @@ var DrawingLayer = class {
|
|
|
14197
14665
|
box,
|
|
14198
14666
|
(part) => this.#url(part, imageContentType(part))
|
|
14199
14667
|
);
|
|
14668
|
+
} else if (drawing.kind === "formControl") {
|
|
14669
|
+
paintFormControl(view, node, drawing, box, this.#openDrop === Number(node.dataset.index));
|
|
14670
|
+
} else if (drawing.kind === "unsupported" && drawing.shape) {
|
|
14671
|
+
paintShape(view, node, drawing.shape, box, `xs${view.sheetIndex()}_${node.dataset.index}_`);
|
|
14200
14672
|
} else if (drawing.chartEx) {
|
|
14201
14673
|
this.#paintChart(node, drawing.chartEx, box);
|
|
14202
14674
|
} else {
|
|
@@ -14262,6 +14734,15 @@ var DrawingLayer = class {
|
|
|
14262
14734
|
const node = event.currentTarget;
|
|
14263
14735
|
if (drawing.kind === "slicer" && this.#pressSlicer(event, index, drawing)) return;
|
|
14264
14736
|
if (drawing.kind === "timeline" && this.#pressTimeline(event, index, drawing, node)) return;
|
|
14737
|
+
if (drawing.kind === "formControl" && pressFormControl(view, event, drawing, node, {
|
|
14738
|
+
isOpen: () => this.#openDrop === index,
|
|
14739
|
+
toggleOpen: (open) => this.#setOpen(open ? index : void 0),
|
|
14740
|
+
refresh: () => {
|
|
14741
|
+
this.invalidate();
|
|
14742
|
+
this.render();
|
|
14743
|
+
}
|
|
14744
|
+
}))
|
|
14745
|
+
return;
|
|
14265
14746
|
const series = event.target.closest("[data-chart-series]")?.dataset.chartSeries;
|
|
14266
14747
|
node.xgSeriesHit = series === void 0 ? void 0 : Number(series);
|
|
14267
14748
|
const part = event.target.closest("[data-chart-part]")?.dataset.chartPart;
|
|
@@ -14269,7 +14750,7 @@ var DrawingLayer = class {
|
|
|
14269
14750
|
view.ctx.selection.set({ drawing: index });
|
|
14270
14751
|
view.ctx.grid()?.focus();
|
|
14271
14752
|
const session = view.ctx.session();
|
|
14272
|
-
if (view.ctx.readOnly() || !session) return;
|
|
14753
|
+
if (view.ctx.readOnly() || !session || drawing.kind === "formControl") return;
|
|
14273
14754
|
const grip = event.target.closest("[data-grip]")?.dataset.grip;
|
|
14274
14755
|
const start = view.clientToView(event.clientX, event.clientY);
|
|
14275
14756
|
const origin = anchorToPixelBox(sheet, drawing.anchor, view.metrics);
|
|
@@ -14301,6 +14782,23 @@ var DrawingLayer = class {
|
|
|
14301
14782
|
}
|
|
14302
14783
|
});
|
|
14303
14784
|
}
|
|
14785
|
+
/** Opens or closes a form control drop-down list; a press anywhere else closes it. */
|
|
14786
|
+
#setOpen(index) {
|
|
14787
|
+
if (this.#openDrop === index) return;
|
|
14788
|
+
this.#closeDrop?.();
|
|
14789
|
+
this.#closeDrop = void 0;
|
|
14790
|
+
this.#openDrop = index;
|
|
14791
|
+
if (index !== void 0) {
|
|
14792
|
+
const doc = this.#view.doc;
|
|
14793
|
+
const close = (event) => {
|
|
14794
|
+
if (event.target?.closest?.(".xg-formcontrol")) return;
|
|
14795
|
+
this.#setOpen(void 0);
|
|
14796
|
+
};
|
|
14797
|
+
doc.addEventListener("pointerdown", close, true);
|
|
14798
|
+
this.#closeDrop = () => doc.removeEventListener("pointerdown", close, true);
|
|
14799
|
+
}
|
|
14800
|
+
this.render();
|
|
14801
|
+
}
|
|
14304
14802
|
/** Runs an edit from a timeline or slicer control and reports a refusal as a toast. */
|
|
14305
14803
|
#guard(run) {
|
|
14306
14804
|
try {
|
|
@@ -14314,11 +14812,11 @@ var DrawingLayer = class {
|
|
|
14314
14812
|
}
|
|
14315
14813
|
/** Handles a press on a timeline control; false lets the press move or resize the frame. */
|
|
14316
14814
|
#pressTimeline(event, index, frame, node) {
|
|
14317
|
-
const
|
|
14815
|
+
const target40 = event.target;
|
|
14318
14816
|
const view = this.#view;
|
|
14319
|
-
const list =
|
|
14320
|
-
const clear =
|
|
14321
|
-
const cell =
|
|
14817
|
+
const list = target40.closest("[data-timeline-action=level]");
|
|
14818
|
+
const clear = target40.closest("[data-timeline-action=clear]");
|
|
14819
|
+
const cell = target40.closest("[data-period]");
|
|
14322
14820
|
if (!list && !clear && !cell) return false;
|
|
14323
14821
|
view.ctx.selection.set({ drawing: index });
|
|
14324
14822
|
if (list) return true;
|
|
@@ -14373,10 +14871,10 @@ var DrawingLayer = class {
|
|
|
14373
14871
|
}
|
|
14374
14872
|
/** Handles a press on a slicer button; false lets the press move or resize the slicer. */
|
|
14375
14873
|
#pressSlicer(event, index, frame, pointer = true) {
|
|
14376
|
-
const
|
|
14874
|
+
const target40 = event.target;
|
|
14377
14875
|
const view = this.#view;
|
|
14378
|
-
const item =
|
|
14379
|
-
const tool =
|
|
14876
|
+
const item = target40.closest("[data-slicer-item]");
|
|
14877
|
+
const tool = target40.closest("[data-slicer-action]");
|
|
14380
14878
|
if (!item && !tool) return false;
|
|
14381
14879
|
view.ctx.selection.set({ drawing: index });
|
|
14382
14880
|
if (pointer) view.ctx.grid()?.focus();
|
|
@@ -14423,6 +14921,7 @@ var DrawingLayer = class {
|
|
|
14423
14921
|
}
|
|
14424
14922
|
destroy() {
|
|
14425
14923
|
this.#cancelDrag?.();
|
|
14924
|
+
this.#closeDrop?.();
|
|
14426
14925
|
const win = viewOf(this.#view.root);
|
|
14427
14926
|
for (const url of this.#urls.values()) win?.URL?.revokeObjectURL?.(url);
|
|
14428
14927
|
this.#urls.clear();
|
|
@@ -14972,8 +15471,8 @@ function openMenuAtActive(view, refocus) {
|
|
|
14972
15471
|
}
|
|
14973
15472
|
function wireMenus(view, refocus) {
|
|
14974
15473
|
const onMenu = (event) => {
|
|
14975
|
-
const
|
|
14976
|
-
if (
|
|
15474
|
+
const target40 = event.target;
|
|
15475
|
+
if (target40.closest(".xg-editor-host.xg-editing, .xg-popup")) return;
|
|
14977
15476
|
event.preventDefault();
|
|
14978
15477
|
const hit = view.hitClient(event.clientX, event.clientY);
|
|
14979
15478
|
const kind = hit.area === "row-header" ? "row" : hit.area === "col-header" ? "col" : "cell";
|
|
@@ -15034,8 +15533,8 @@ function startHeaderResize(view, axis, index, event) {
|
|
|
15034
15533
|
}
|
|
15035
15534
|
};
|
|
15036
15535
|
draw();
|
|
15037
|
-
const
|
|
15038
|
-
|
|
15536
|
+
const target40 = view.view;
|
|
15537
|
+
target40.setPointerCapture?.(event.pointerId);
|
|
15039
15538
|
const move = (e) => {
|
|
15040
15539
|
const { x, y } = view.clientToView(e.clientX, e.clientY);
|
|
15041
15540
|
size = Math.max(0, Math.round((axis === "col" ? x : y) - start));
|
|
@@ -15043,9 +15542,9 @@ function startHeaderResize(view, axis, index, event) {
|
|
|
15043
15542
|
guide.title = String(toFileSize(view, axis, size));
|
|
15044
15543
|
};
|
|
15045
15544
|
const up = (e) => {
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15545
|
+
target40.removeEventListener("pointermove", move, true);
|
|
15546
|
+
target40.removeEventListener("pointerup", up, true);
|
|
15547
|
+
target40.releasePointerCapture?.(e.pointerId);
|
|
15049
15548
|
guide.remove();
|
|
15050
15549
|
const indices = resizeTargets(view, axis, index);
|
|
15051
15550
|
const sheet = view.sheetIndex();
|
|
@@ -15053,8 +15552,8 @@ function startHeaderResize(view, axis, index, event) {
|
|
|
15053
15552
|
else if (axis === "col") session.setColumnWidth(sheet, indices, toFileSize(view, "col", size));
|
|
15054
15553
|
else session.setRowHeight(sheet, indices, toFileSize(view, "row", size));
|
|
15055
15554
|
};
|
|
15056
|
-
|
|
15057
|
-
|
|
15555
|
+
target40.addEventListener("pointermove", move, true);
|
|
15556
|
+
target40.addEventListener("pointerup", up, true);
|
|
15058
15557
|
}
|
|
15059
15558
|
function autoFit(view, axis, index) {
|
|
15060
15559
|
const session = view.ctx.session();
|
|
@@ -15144,8 +15643,8 @@ function wirePointer(host) {
|
|
|
15144
15643
|
}, 40);
|
|
15145
15644
|
};
|
|
15146
15645
|
const onDown = (event) => {
|
|
15147
|
-
const
|
|
15148
|
-
if (
|
|
15646
|
+
const target40 = event.target;
|
|
15647
|
+
if (target40.closest(".xg-editor-host, .xg-obj, .xg-dd, .xg-popup, .xg-assist")) return;
|
|
15149
15648
|
const { x, y } = view.clientToView(event.clientX, event.clientY);
|
|
15150
15649
|
const g = view.geometry;
|
|
15151
15650
|
const hit = g.hit(x, y);
|
|
@@ -15162,7 +15661,7 @@ function wirePointer(host) {
|
|
|
15162
15661
|
event.preventDefault();
|
|
15163
15662
|
const sheet = view.sheet();
|
|
15164
15663
|
const editable = !view.ctx.readOnly();
|
|
15165
|
-
if (
|
|
15664
|
+
if (target40.closest('[data-handle="fill"]') && editable) {
|
|
15166
15665
|
drag = { kind: "fill", anchor: selection.get().active, pointer: event.pointerId, x, y };
|
|
15167
15666
|
el4.setPointerCapture?.(event.pointerId);
|
|
15168
15667
|
return;
|
|
@@ -15248,17 +15747,17 @@ function wirePointer(host) {
|
|
|
15248
15747
|
drag = void 0;
|
|
15249
15748
|
el4.releasePointerCapture?.(event.pointerId);
|
|
15250
15749
|
if (finished.kind === "fill") {
|
|
15251
|
-
const
|
|
15750
|
+
const target40 = view.overlay.fillPreview;
|
|
15252
15751
|
view.overlay.fillPreview = void 0;
|
|
15253
15752
|
const source = selection.get().ranges[selection.get().ranges.length - 1];
|
|
15254
|
-
if (
|
|
15753
|
+
if (target40 && source) host.fill(source, target40);
|
|
15255
15754
|
view.schedule();
|
|
15256
15755
|
}
|
|
15257
15756
|
if (finished.kind === "point") editor.focus();
|
|
15258
15757
|
};
|
|
15259
15758
|
const onDblClick = (event) => {
|
|
15260
|
-
const
|
|
15261
|
-
if (
|
|
15759
|
+
const target40 = event.target;
|
|
15760
|
+
if (target40.closest(".xg-editor-host, .xg-obj, .xg-popup")) return;
|
|
15262
15761
|
const { x, y } = view.clientToView(event.clientX, event.clientY);
|
|
15263
15762
|
const g = view.geometry;
|
|
15264
15763
|
const hit = g.hit(x, y);
|
|
@@ -16242,8 +16741,8 @@ function wireTooltips(view) {
|
|
|
16242
16741
|
tip.append(who, view.doc.createTextNode(reply.text));
|
|
16243
16742
|
}
|
|
16244
16743
|
} else if (link) {
|
|
16245
|
-
const
|
|
16246
|
-
tip.textContent = `${link.tooltip ??
|
|
16744
|
+
const target40 = link.target ?? link.location ?? "";
|
|
16745
|
+
tip.textContent = `${link.tooltip ?? target40}
|
|
16247
16746
|
${view.ctx.t("Ctrl+click to follow the link.")}`;
|
|
16248
16747
|
}
|
|
16249
16748
|
const g = view.geometry;
|
|
@@ -16278,8 +16777,8 @@ ${view.ctx.t("Ctrl+click to follow the link.")}`;
|
|
|
16278
16777
|
tip.remove();
|
|
16279
16778
|
};
|
|
16280
16779
|
}
|
|
16281
|
-
function workbookLocation(
|
|
16282
|
-
const value =
|
|
16780
|
+
function workbookLocation(target40) {
|
|
16781
|
+
const value = target40.trim();
|
|
16283
16782
|
if (value.startsWith("#")) return value.slice(1);
|
|
16284
16783
|
return /^[a-z][a-z0-9+.-]+:/i.test(value) || /[\\/]/.test(value) ? void 0 : value;
|
|
16285
16784
|
}
|
|
@@ -16309,13 +16808,13 @@ function goTo(view, selection, location) {
|
|
|
16309
16808
|
if (!workbook) return false;
|
|
16310
16809
|
const text3 = location.replace(/^#/, "");
|
|
16311
16810
|
const name = workbook.definedNames.find((n) => n.name.toLowerCase() === text3.toLowerCase());
|
|
16312
|
-
const
|
|
16313
|
-
if (!
|
|
16314
|
-
const sheetIndex =
|
|
16811
|
+
const target40 = referenceTarget(name ? name.formula : text3);
|
|
16812
|
+
if (!target40) return false;
|
|
16813
|
+
const sheetIndex = target40.sheet ? workbook.sheets.indexOf(sheetByName(workbook, target40.sheet)) : view.sheetIndex();
|
|
16315
16814
|
if (sheetIndex < 0) return false;
|
|
16316
16815
|
if (sheetIndex !== view.sheetIndex()) view.ctx.setActiveSheet(sheetIndex);
|
|
16317
|
-
const next = selectCell(sheetIndex, workbook.sheets[sheetIndex],
|
|
16318
|
-
selection.set({ ...next, ranges: [
|
|
16816
|
+
const next = selectCell(sheetIndex, workbook.sheets[sheetIndex], target40.range.start);
|
|
16817
|
+
selection.set({ ...next, ranges: [target40.range] }, target40.range.start);
|
|
16319
16818
|
return true;
|
|
16320
16819
|
}
|
|
16321
16820
|
|
|
@@ -16429,6 +16928,13 @@ var GRID_CSS = `
|
|
|
16429
16928
|
.xg-obj.xg-obj-sel{outline:1px solid #8a8a8a;outline-offset:0}
|
|
16430
16929
|
.xg-obj .xg-grip{position:absolute;width:8px;height:8px;background:#fff;border:1px solid #555;box-sizing:border-box;border-radius:50%}
|
|
16431
16930
|
@media(pointer:coarse){.xg-grip::before{content:'';position:absolute;inset:-${(MIN_TOUCH_TARGET_PX - 8) / 2}px;touch-action:none}}
|
|
16931
|
+
.xg-obj.xg-shape svg{overflow:visible}
|
|
16932
|
+
.xg-obj.xg-formcontrol{overflow:visible}
|
|
16933
|
+
.xg-formcontrol svg [data-control-part]{pointer-events:auto;cursor:pointer}
|
|
16934
|
+
.xg-formcontrol[data-control-type=button] svg{pointer-events:auto}
|
|
16935
|
+
.xg-fc-pop{position:absolute;left:0;z-index:5;max-height:160px;overflow:auto;background:#fff;border:1px solid #7a7a7a;box-sizing:border-box;font:12px 'Segoe UI',Arial,sans-serif}
|
|
16936
|
+
.xg-fc-item{padding:2px 4px;cursor:pointer;white-space:nowrap}
|
|
16937
|
+
.xg-fc-item:hover,.xg-fc-on{background:#0078d7;color:#fff}
|
|
16432
16938
|
.xg-obj-unsupported{background:repeating-linear-gradient(45deg,#f6f6f6,#f6f6f6 6px,#ececec 6px,#ececec 12px);border:1px dashed #aaa;
|
|
16433
16939
|
font-size:11px;color:#555;display:flex;align-items:center;justify-content:center;text-align:center}
|
|
16434
16940
|
.xg-obj.xg-smartart{overflow:visible}
|
|
@@ -16718,7 +17224,7 @@ function installPageBreakPreview(view) {
|
|
|
16718
17224
|
return result;
|
|
16719
17225
|
};
|
|
16720
17226
|
const offModel = view.ctx.onModelChange(() => cache = void 0);
|
|
16721
|
-
const
|
|
17227
|
+
const target40 = (grab, clientX, clientY) => {
|
|
16722
17228
|
const g = view.geometry;
|
|
16723
17229
|
const { x, y } = view.clientToView(clientX, clientY);
|
|
16724
17230
|
const horizontal = grab.kind === "line" ? grab.line.axis === "col" : grab.edge === "left" || grab.edge === "right";
|
|
@@ -16767,7 +17273,7 @@ function installPageBreakPreview(view) {
|
|
|
16767
17273
|
layer.append(ghost);
|
|
16768
17274
|
let boundary = -1;
|
|
16769
17275
|
const move = (e) => {
|
|
16770
|
-
boundary =
|
|
17276
|
+
boundary = target40(grab, e.clientX, e.clientY);
|
|
16771
17277
|
const g = view.geometry;
|
|
16772
17278
|
if (axis === "row") place(ghost, g.headerW, g.rowY(boundary) - 1, g.cellsW, 3);
|
|
16773
17279
|
else place(ghost, g.colX(boundary) - 1, g.headerH, 3, g.cellsH);
|
|
@@ -16927,9 +17433,9 @@ function mountGrid(ctx, container) {
|
|
|
16927
17433
|
selection,
|
|
16928
17434
|
editor,
|
|
16929
17435
|
followLink: (row2, col) => followLink(view, selection, row2, col),
|
|
16930
|
-
fill(source,
|
|
16931
|
-
ctx.session()?.fill(view.sheetIndex(), source,
|
|
16932
|
-
selection.set({ ...selection.get(), ranges: [
|
|
17436
|
+
fill(source, target40) {
|
|
17437
|
+
ctx.session()?.fill(view.sheetIndex(), source, target40);
|
|
17438
|
+
selection.set({ ...selection.get(), ranges: [target40] });
|
|
16933
17439
|
}
|
|
16934
17440
|
}),
|
|
16935
17441
|
wireTooltips(view),
|
|
@@ -17819,13 +18325,13 @@ function mountSheetTabs(ctx, container) {
|
|
|
17819
18325
|
const visible = visibleSheetIndices(workbook);
|
|
17820
18326
|
const at = visible.indexOf(sheet);
|
|
17821
18327
|
const focusAt = (i) => {
|
|
17822
|
-
const
|
|
17823
|
-
if (
|
|
17824
|
-
focusable =
|
|
18328
|
+
const target41 = visible[Math.max(0, Math.min(visible.length - 1, i))];
|
|
18329
|
+
if (target41 === void 0) return;
|
|
18330
|
+
focusable = target41;
|
|
17825
18331
|
for (const tab of strip.querySelectorAll(".xst-tab"))
|
|
17826
|
-
tab.tabIndex = tab.dataset.sheet === String(
|
|
17827
|
-
scrollIntoView(
|
|
17828
|
-
tabFor(strip,
|
|
18332
|
+
tab.tabIndex = tab.dataset.sheet === String(target41) ? 0 : -1;
|
|
18333
|
+
scrollIntoView(target41);
|
|
18334
|
+
tabFor(strip, target41)?.focus();
|
|
17829
18335
|
};
|
|
17830
18336
|
const moves = {
|
|
17831
18337
|
ArrowLeft: at - 1,
|
|
@@ -17833,12 +18339,12 @@ function mountSheetTabs(ctx, container) {
|
|
|
17833
18339
|
Home: 0,
|
|
17834
18340
|
End: visible.length - 1
|
|
17835
18341
|
};
|
|
17836
|
-
const
|
|
18342
|
+
const target40 = moves[event.key];
|
|
17837
18343
|
const menuKey = event.key === "ContextMenu" || event.key === "F10" && event.shiftKey;
|
|
17838
|
-
if (
|
|
18344
|
+
if (target40 === void 0 && !menuKey && !["Enter", " ", "F2"].includes(event.key)) return;
|
|
17839
18345
|
event.preventDefault();
|
|
17840
18346
|
event.stopPropagation();
|
|
17841
|
-
if (
|
|
18347
|
+
if (target40 !== void 0) focusAt(target40);
|
|
17842
18348
|
else if (event.key === "F2") rename(sheet);
|
|
17843
18349
|
else if (menuKey) {
|
|
17844
18350
|
const box = event.target.getBoundingClientRect();
|
|
@@ -17932,7 +18438,8 @@ function renderBand(o, page, kind) {
|
|
|
17932
18438
|
sheet: sheet.name,
|
|
17933
18439
|
file: o.fileName,
|
|
17934
18440
|
date: o.date,
|
|
17935
|
-
locale: o.ctx.locale()
|
|
18441
|
+
locale: o.ctx.locale(),
|
|
18442
|
+
themeColors: o.ctx.workbook().theme.colors
|
|
17936
18443
|
});
|
|
17937
18444
|
const empty = !value;
|
|
17938
18445
|
for (const section of SECTIONS) {
|
|
@@ -17942,6 +18449,23 @@ function renderBand(o, page, kind) {
|
|
|
17942
18449
|
cell.style.textAlign = section;
|
|
17943
18450
|
const runs = rendered.sections[section];
|
|
17944
18451
|
for (const run of runs) {
|
|
18452
|
+
if (run.picture) {
|
|
18453
|
+
const workbook = o.ctx.workbook();
|
|
18454
|
+
const image = headerFooterPicture(sheet, kind, section, page.number, number);
|
|
18455
|
+
const url = image ? headerFooterImageUrl(workbook, image) : void 0;
|
|
18456
|
+
if (image && url) {
|
|
18457
|
+
const img = o.doc.createElement("img");
|
|
18458
|
+
const { width, height } = headerFooterImageSize(
|
|
18459
|
+
image,
|
|
18460
|
+
setup.scaleWithDoc === false ? 1 : o.layout.scale
|
|
18461
|
+
);
|
|
18462
|
+
img.src = url;
|
|
18463
|
+
img.alt = "";
|
|
18464
|
+
img.style.cssText = `width:${width}px;height:${height}px;vertical-align:top`;
|
|
18465
|
+
cell.append(img);
|
|
18466
|
+
}
|
|
18467
|
+
continue;
|
|
18468
|
+
}
|
|
17945
18469
|
const span = o.doc.createElement("span");
|
|
17946
18470
|
span.textContent = run.text;
|
|
17947
18471
|
const { style: style2 } = run;
|
|
@@ -17950,10 +18474,16 @@ function renderBand(o, page, kind) {
|
|
|
17950
18474
|
if (style2.color) span.style.color = style2.color;
|
|
17951
18475
|
if (style2.bold) span.style.fontWeight = "700";
|
|
17952
18476
|
if (style2.italic) span.style.fontStyle = "italic";
|
|
17953
|
-
const lines = [
|
|
17954
|
-
|
|
17955
|
-
|
|
18477
|
+
const lines = [
|
|
18478
|
+
(style2.underline || style2.doubleUnderline) && "underline",
|
|
18479
|
+
style2.strike && "line-through"
|
|
18480
|
+
].filter(Boolean);
|
|
17956
18481
|
if (lines.length) span.style.textDecoration = lines.join(" ");
|
|
18482
|
+
if (style2.doubleUnderline) span.style.textDecorationStyle = "double";
|
|
18483
|
+
if (style2.superscript || style2.subscript) {
|
|
18484
|
+
span.style.verticalAlign = style2.superscript ? "super" : "sub";
|
|
18485
|
+
span.style.fontSize = `${(style2.size ?? 11) / 11 * size * 0.7}px`;
|
|
18486
|
+
}
|
|
17957
18487
|
cell.append(span);
|
|
17958
18488
|
}
|
|
17959
18489
|
if (empty && section === "center") {
|
|
@@ -18423,8 +18953,8 @@ function createPageLayoutView(ctx, host, fileName) {
|
|
|
18423
18953
|
};
|
|
18424
18954
|
root.addEventListener("pointerdown", (event) => {
|
|
18425
18955
|
if (event.button !== 0 || !layout || !metrics || editor.editing) return;
|
|
18426
|
-
const
|
|
18427
|
-
if (
|
|
18956
|
+
const target40 = event.target;
|
|
18957
|
+
if (target40.closest(".xpl-ruler-h,.xpl-ruler-v,.xpl-corner") || bandEditing) return;
|
|
18428
18958
|
const { x, y } = toCanvas(event.clientX, event.clientY);
|
|
18429
18959
|
const hit = pageViewHit(layout, metrics, x, y);
|
|
18430
18960
|
if (!hit) return;
|
|
@@ -18635,7 +19165,7 @@ function collectKeyTips(panel3) {
|
|
|
18635
19165
|
};
|
|
18636
19166
|
targets.push({ key: COMMAND_KEYS[labelOf(control)] ?? "", element: control, activate });
|
|
18637
19167
|
}
|
|
18638
|
-
assignKeyTips(targets, (
|
|
19168
|
+
assignKeyTips(targets, (target40) => target40.element.getAttribute("aria-label") ?? "");
|
|
18639
19169
|
return targets;
|
|
18640
19170
|
}
|
|
18641
19171
|
var runTips = (root, targets, onDone) => (
|
|
@@ -18653,7 +19183,7 @@ function showTabKeyTips(root, select2) {
|
|
|
18653
19183
|
const id = panel3.dataset.tab ?? "";
|
|
18654
19184
|
const tab = tabButton(root, id);
|
|
18655
19185
|
if (!tab || isTabHidden(panel3)) continue;
|
|
18656
|
-
const used = targets.map((
|
|
19186
|
+
const used = targets.map((target40) => target40.key);
|
|
18657
19187
|
let key = TAB_KEYS[id] ?? "";
|
|
18658
19188
|
if (!key || used.includes(key))
|
|
18659
19189
|
key = [...(tab.textContent ?? id).toUpperCase().replace(/[^A-Z]/g, "")].find(
|
|
@@ -19529,9 +20059,9 @@ function buildShell(core) {
|
|
|
19529
20059
|
if (action === "help") return help.open();
|
|
19530
20060
|
if (action === "keytips") return ribbon.showKeyTips();
|
|
19531
20061
|
if (action === "context-menu") {
|
|
19532
|
-
const
|
|
19533
|
-
const box =
|
|
19534
|
-
|
|
20062
|
+
const target40 = root.activeElement ?? gridHost;
|
|
20063
|
+
const box = target40.getBoundingClientRect();
|
|
20064
|
+
target40.dispatchEvent(
|
|
19535
20065
|
new MouseEvent("contextmenu", {
|
|
19536
20066
|
bubbles: true,
|
|
19537
20067
|
composed: true,
|
|
@@ -19908,7 +20438,7 @@ var EditorCore = class {
|
|
|
19908
20438
|
emit(host, "dirty-change", { dirty });
|
|
19909
20439
|
this.requestRender();
|
|
19910
20440
|
});
|
|
19911
|
-
const
|
|
20441
|
+
const report3 = (what, error) => {
|
|
19912
20442
|
const message = error instanceof Error ? error.message : String(error);
|
|
19913
20443
|
this.shell?.toast(
|
|
19914
20444
|
this.ctx.t("{what} failed: {message}", {
|
|
@@ -19921,12 +20451,12 @@ var EditorCore = class {
|
|
|
19921
20451
|
emit(host, "workbook-error", { error: failure, message });
|
|
19922
20452
|
};
|
|
19923
20453
|
this.commands = createCommandRegistry(() => this.ctx, {
|
|
19924
|
-
onError: (id, error) =>
|
|
20454
|
+
onError: (id, error) => report3(this.commands.get(id)?.label ?? id, error),
|
|
19925
20455
|
isHidden: (id) => this.isHidden(id)
|
|
19926
20456
|
});
|
|
19927
20457
|
this.dialogs = createDialogRegistry(
|
|
19928
20458
|
() => this.ctx,
|
|
19929
|
-
(name, error) =>
|
|
20459
|
+
(name, error) => report3(name, error)
|
|
19930
20460
|
);
|
|
19931
20461
|
this.selection.onChange((selection) => {
|
|
19932
20462
|
if (selection.sheet === this.activeSheet)
|