ooxml-ui 1.34.0 → 1.35.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/{chunk-6TS7ASDJ.js → chunk-C4KI635Q.js} +2 -17
- package/dist/chunk-D5IRYZLP.js +19 -0
- package/dist/{chunk-CALEXPBD.js → chunk-GZNBWWJ5.js} +840 -51
- package/dist/{chunk-SWDVBUBW.js → chunk-TGG36HHF.js} +2 -2
- package/dist/docx/print-picture.d.ts +4 -0
- package/dist/docx.js +46 -7
- package/dist/fonts/catalog.d.ts +0 -1
- package/dist/image-native-size.d.ts +43 -0
- package/dist/image-native-size.d.ts.map +1 -0
- package/dist/index.js +3 -3
- package/dist/picture-artistic-filters.d.ts +9 -0
- package/dist/picture-artistic-filters.d.ts.map +1 -0
- package/dist/picture-artistic-preview.d.ts +3 -0
- package/dist/picture-artistic-preview.d.ts.map +1 -0
- package/dist/picture-effects.d.ts +3 -1
- package/dist/picture-effects.d.ts.map +1 -0
- package/dist/picture-paint.d.ts +23 -0
- package/dist/picture-paint.d.ts.map +1 -0
- package/dist/picture-pixels.d.ts +11 -0
- package/dist/picture-pixels.d.ts.map +1 -0
- package/dist/picture-standard-filter.d.ts +6 -0
- package/dist/picture-standard-filter.d.ts.map +1 -0
- package/dist/picture-view.d.ts +10 -0
- package/dist/picture-view.d.ts.map +1 -0
- package/dist/pptx/{chart-3d-view-scene-HNL4NWJT.mjs → chart-3d-view-scene-BKNMGRGO.mjs} +3 -25
- package/dist/pptx/{chart-3d-view-scene-OPVBTZL5.cjs → chart-3d-view-scene-V55XPBBF.cjs} +39 -61
- package/dist/pptx/{chunk-7DT3UJQB.mjs → chunk-5EERUTDC.mjs} +7 -3
- package/dist/pptx/{chunk-S3L5NNCK.cjs → chunk-FROIGMTI.cjs} +1 -1
- package/dist/pptx/{chunk-ZS5EVODY.cjs → chunk-GKQULDFF.cjs} +52 -48
- package/dist/pptx/{chunk-CH4Z6H6C.mjs → chunk-GPQP2R5Y.mjs} +1017 -371
- package/dist/pptx/{chunk-S5I64Y55.cjs → chunk-HIRBPTML.cjs} +12 -12
- package/dist/pptx/{chunk-D4LJJ7Z7.cjs → chunk-KJICUZXM.cjs} +171 -540
- package/dist/pptx/{chunk-TDIJHLS5.cjs → chunk-NPYNJOK2.cjs} +1351 -699
- package/dist/pptx/{chunk-RZVEPTLN.mjs → chunk-QK6LJT3K.mjs} +140 -529
- package/dist/pptx/{chunk-LCCRLB7Q.mjs → chunk-UHDWWRTX.mjs} +1 -1
- package/dist/pptx/{chunk-SPOECCPV.mjs → chunk-WZHYA2B3.mjs} +1 -1
- package/dist/pptx/dom/elements/smartart.d.ts.map +1 -1
- package/dist/pptx/dom/index.cjs +424 -424
- package/dist/pptx/dom/index.mjs +8 -8
- package/dist/pptx/export/html2canvas-clone.cjs +6 -6
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/index.cjs +3356 -3352
- package/dist/pptx/index.mjs +4 -4
- package/dist/pptx/render/chart-3d-projection.d.ts +5 -54
- package/dist/pptx/render/chart-3d-projection.d.ts.map +1 -1
- package/dist/pptx/render/chart-3d-shading.d.ts +7 -10
- package/dist/pptx/render/chart-3d-shading.d.ts.map +1 -1
- package/dist/pptx/render/chart-combo-stock.cjs +3 -3
- package/dist/pptx/render/chart-combo-stock.mjs +1 -1
- package/dist/pptx/render/chart-funnel-sunburst.d.ts +1 -1
- package/dist/pptx/render/chart-funnel-sunburst.d.ts.map +1 -1
- package/dist/pptx/render/chart-map-projection.d.ts +2 -37
- package/dist/pptx/render/chart-map-projection.d.ts.map +1 -1
- package/dist/pptx/render/chart-overlays.cjs +7 -7
- package/dist/pptx/render/chart-overlays.mjs +1 -1
- package/dist/pptx/render/chart-region-map-alias.d.ts +1 -11
- package/dist/pptx/render/chart-region-map-alias.d.ts.map +1 -1
- package/dist/pptx/render/chart-region-map-colors.d.ts +1 -3
- package/dist/pptx/render/chart-region-map-colors.d.ts.map +1 -1
- package/dist/pptx/render/chart-region-map-data.d.ts +2 -44
- package/dist/pptx/render/chart-region-map-data.d.ts.map +1 -1
- package/dist/pptx/render/chart-region-map-view.d.ts.map +1 -1
- package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
- package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
- package/dist/pptx/render/chart-view-model-types.d.ts +2 -0
- package/dist/pptx/render/chart-view-model-types.d.ts.map +1 -1
- package/dist/pptx/render/chart-view-model.cjs +44 -44
- package/dist/pptx/render/chart-view-model.mjs +1 -1
- package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
- package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
- package/dist/pptx/render/editor-key-target.d.ts.map +1 -1
- package/dist/pptx/render/image-effect-filter-values.d.ts +1 -10
- package/dist/pptx/render/image-effect-filter-values.d.ts.map +1 -1
- package/dist/pptx/render/image-effects.d.ts +1 -0
- package/dist/pptx/render/image-effects.d.ts.map +1 -1
- package/dist/pptx/render/image-native-size.d.ts +1 -42
- package/dist/pptx/render/image-native-size.d.ts.map +1 -1
- package/dist/pptx/render/image-tiling.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +1 -1
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/render-cache.d.ts +1 -3
- package/dist/pptx/render/render-cache.d.ts.map +1 -1
- package/dist/pptx/render/smartart-drawing.d.ts +3 -0
- package/dist/pptx/render/smartart-drawing.d.ts.map +1 -1
- package/dist/pptx/render/smartart-picture-image.d.ts +9 -0
- package/dist/pptx/render/smartart-picture-image.d.ts.map +1 -0
- package/dist/pptx/render/smartart-reflow-to-shapes.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-RQUFRLSV.mjs → smartart-insert-preview-6BITTUI4.mjs} +5 -5
- package/dist/pptx/{smartart-insert-preview-YKNB37GE.cjs → smartart-insert-preview-BUOS5XQR.cjs} +6 -6
- package/dist/render-cache.d.ts +4 -0
- package/dist/render-cache.d.ts.map +1 -0
- package/dist/smartart/smartart-paint.d.ts +2 -1
- package/dist/smartart/smartart-picture.d.ts +4 -3
- package/dist/smartart.d.ts +3 -0
- package/dist/smartart.js +1 -1
- package/dist/teams.js +1 -1
- package/dist/theme-bridge.d.ts +0 -1
- package/dist/visio/viewer-chart-editor.d.ts +2 -1
- package/dist/visio.js +43 -11
- package/dist/xlsx/dialogs/custom-autofilter.d.ts +12 -0
- package/dist/xlsx/dialogs/filter-dates.d.ts +4 -0
- package/dist/xlsx/dialogs/help-dialogs.d.ts +2 -2
- package/dist/xlsx/dialogs/text-to-columns.d.ts +0 -7
- package/dist/xlsx/dialogs/top10-filter.d.ts +5 -0
- package/dist/xlsx/grid/filter-buttons.d.ts +11 -0
- package/dist/xlsx/grid/filter-menu.d.ts +10 -0
- package/dist/xlsx/grid/filter-presets.d.ts +19 -0
- package/dist/xlsx/grid/styles.d.ts +1 -1
- package/dist/xlsx.js +874 -168
- package/package.json +2 -2
- /package/dist/{chunk-3AOIYE3R.js → chunk-FFM3WVLU.js} +0 -0
package/dist/xlsx.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { statusLayout, watchStatusWidth, defineChartExOptions
|
|
1
|
+
import { statusLayout, watchStatusWidth, defineChartExOptions } from './chunk-C4KI635Q.js';
|
|
2
2
|
import { trackPointerGesture } from './chunk-GSXOZCAN.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import { chartExSpaceFormatSource } from './chunk-D5IRYZLP.js';
|
|
4
|
+
import './chunk-TGG36HHF.js';
|
|
4
5
|
import './chunk-DA57FPSN.js';
|
|
5
6
|
import { createHostBackstagePages, syncRibbonAddIns, withHostMenuItems } from './chunk-CDC5MAZS.js';
|
|
6
7
|
export { RIBBON_ADD_IN_EVENT } from './chunk-CDC5MAZS.js';
|
|
7
|
-
import { pictureEffectFilter, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, smartArtStylesGalleryState, smartArtColorsGalleryState, safeColor, svgTile } from './chunk-
|
|
8
|
-
import { withExtension, saveExtension, downloadBytes, emit, emitEvent, blobFor, announceFileCommand, pickFile } from './chunk-
|
|
9
|
-
export { XLSX_EDITOR_EVENTS } from './chunk-
|
|
8
|
+
import { needsPicturePixels, pictureSvg, pictureEffectFilter, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, smartArtStylesGalleryState, smartArtColorsGalleryState, safeColor, svgTile } from './chunk-GZNBWWJ5.js';
|
|
9
|
+
import { withExtension, saveExtension, downloadBytes, emit, emitEvent, blobFor, announceFileCommand, pickFile } from './chunk-FFM3WVLU.js';
|
|
10
|
+
export { XLSX_EDITOR_EVENTS } from './chunk-FFM3WVLU.js';
|
|
10
11
|
import './chunk-BOTLS2PR.js';
|
|
11
12
|
import './chunk-CDAXY5KC.js';
|
|
12
13
|
import './chunk-NDUD5JJB.js';
|
|
@@ -21,7 +22,7 @@ import { withTokens } from './chunk-QLHCGV4C.js';
|
|
|
21
22
|
import './chunk-XL77FR4B.js';
|
|
22
23
|
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
24
|
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, 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,
|
|
25
|
+
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, hasFilterCriteria, 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, filterMenuModel, displayText, 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, checklistCriteria, pageBreakPreview, pasteAreas, normalizeRange, currentRegion, autoFitColumnWidth, chartGradientStopTransparency, paginateWorksheet, colorFilterCriteria, 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, decodeCondition, customFilter, topFilterCriteria, parseInputCell, 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, parseBreakPositions, splitFixedWidth, splitDelimited, scenariosOf, PAGE_VIEW_GAP, pivotPageItems, pivotPageItemLabel, pivotSerialToIso, previewScenario, customViewsOf, BUILTIN_NUMBER_FORMATS, validateTableName, pixelsToEmu, pageViewHit, resizedFrameAnchor, headerFooterKey, splitHeaderFooter, composeHeaderFooter } from 'ooxml-core/xlsx';
|
|
25
26
|
import { isCapabilityEnabled, capabilityHiddenActions, saveToStorage, documentSaveMeta, withoutHiddenEntries } from 'ooxml-core/embedding';
|
|
26
27
|
import { hyperlinkPolicy } from 'ooxml-core/opc';
|
|
27
28
|
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 +79,34 @@ var DEFAULT_AUTHOR_NAME = "Author";
|
|
|
78
79
|
function isXlsxEditorAttribute(name) {
|
|
79
80
|
return XLSX_EDITOR_ATTRIBUTES.includes(name);
|
|
80
81
|
}
|
|
81
|
-
function applyAttribute(
|
|
82
|
+
function applyAttribute(target42, name, value) {
|
|
82
83
|
switch (name) {
|
|
83
84
|
case "locale":
|
|
84
|
-
if (normalizeEditorLocale(value ?? "en") !==
|
|
85
|
+
if (normalizeEditorLocale(value ?? "en") !== target42.locale) target42.locale = value ?? "en";
|
|
85
86
|
return;
|
|
86
87
|
case "read-only":
|
|
87
|
-
|
|
88
|
+
target42.readOnly = value !== null && value !== "false";
|
|
88
89
|
return;
|
|
89
90
|
case "file-name": {
|
|
90
91
|
const next = value || DEFAULT_FILE_NAME;
|
|
91
|
-
if (next !==
|
|
92
|
+
if (next !== target42.fileName) target42.fileName = next;
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
95
|
case "author-name": {
|
|
95
96
|
const next = value || DEFAULT_AUTHOR_NAME;
|
|
96
|
-
if (next !==
|
|
97
|
+
if (next !== target42.authorName) target42.authorName = next;
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
100
|
case "theme": {
|
|
100
101
|
const next = normalizeThemeMode(value);
|
|
101
|
-
if (next !==
|
|
102
|
+
if (next !== target42.theme) target42.theme = next;
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
case "show-toolbar":
|
|
105
|
-
if (value !== "false" !==
|
|
106
|
+
if (value !== "false" !== target42.showToolbar) target42.showToolbar = value !== "false";
|
|
106
107
|
return;
|
|
107
108
|
case "show-formula-bar":
|
|
108
|
-
if (value !== "false" !==
|
|
109
|
+
if (value !== "false" !== target42.showFormulaBar) target42.showFormulaBar = value !== "false";
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
function reflectAttribute(element, name, value) {
|
|
@@ -593,9 +594,9 @@ function printHtml(doc, html) {
|
|
|
593
594
|
frame.setAttribute("sandbox", "allow-same-origin allow-modals");
|
|
594
595
|
frame.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden";
|
|
595
596
|
doc.body.append(frame);
|
|
596
|
-
const
|
|
597
|
+
const target42 = frame.contentWindow;
|
|
597
598
|
const frameDoc = frame.contentDocument;
|
|
598
|
-
if (!
|
|
599
|
+
if (!target42 || !frameDoc) {
|
|
599
600
|
frame.remove();
|
|
600
601
|
return;
|
|
601
602
|
}
|
|
@@ -605,18 +606,18 @@ function printHtml(doc, html) {
|
|
|
605
606
|
let safety;
|
|
606
607
|
const cleanup = () => {
|
|
607
608
|
if (safety !== void 0) clearTimeout(safety);
|
|
608
|
-
|
|
609
|
+
target42.removeEventListener("afterprint", cleanup);
|
|
609
610
|
frame.remove();
|
|
610
611
|
if (pendingFrames.get(doc) === cleanup) pendingFrames.delete(doc);
|
|
611
612
|
};
|
|
612
613
|
pendingFrames.set(doc, cleanup);
|
|
613
|
-
|
|
614
|
+
target42.addEventListener("afterprint", cleanup);
|
|
614
615
|
safety = setTimeout(cleanup, PRINT_FRAME_TIMEOUT_MS);
|
|
615
616
|
setTimeout(() => {
|
|
616
617
|
if (!frame.isConnected) return;
|
|
617
618
|
try {
|
|
618
|
-
|
|
619
|
-
|
|
619
|
+
target42.focus();
|
|
620
|
+
target42.print();
|
|
620
621
|
} catch (error) {
|
|
621
622
|
cleanup();
|
|
622
623
|
console.error("xlsx-editor: printing failed", error);
|
|
@@ -1995,10 +1996,10 @@ function findShortcut(event, mac) {
|
|
|
1995
1996
|
return SHORTCUTS.find((shortcut) => shortcut.keys.some((spec) => matchesKeys(event, spec, mac)));
|
|
1996
1997
|
}
|
|
1997
1998
|
function inTextField(event) {
|
|
1998
|
-
const
|
|
1999
|
-
if (!(
|
|
2000
|
-
if (
|
|
2001
|
-
return
|
|
1999
|
+
const target42 = event.composedPath()[0];
|
|
2000
|
+
if (!(target42 instanceof Element)) return false;
|
|
2001
|
+
if (target42.closest(".xve-grid-host")) return false;
|
|
2002
|
+
return target42.matches(
|
|
2002
2003
|
'input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select, [contenteditable=""], [contenteditable="true"]'
|
|
2003
2004
|
);
|
|
2004
2005
|
}
|
|
@@ -2168,11 +2169,11 @@ function alignmentTab(init) {
|
|
|
2168
2169
|
const alignment = patch();
|
|
2169
2170
|
return Object.keys(alignment).length ? { alignment } : {};
|
|
2170
2171
|
},
|
|
2171
|
-
apply: (
|
|
2172
|
+
apply: (target42) => {
|
|
2172
2173
|
if (!changed.has("merge") || merge.input.checked === merged) return;
|
|
2173
|
-
for (const range2 of
|
|
2174
|
-
if (merge.input.checked)
|
|
2175
|
-
else
|
|
2174
|
+
for (const range2 of target42.ranges)
|
|
2175
|
+
if (merge.input.checked) target42.session.merge(target42.sheet, range2, "merge");
|
|
2176
|
+
else target42.session.unmerge(target42.sheet, range2);
|
|
2176
2177
|
},
|
|
2177
2178
|
focus: () => horizontal.focus()
|
|
2178
2179
|
};
|
|
@@ -3312,9 +3313,9 @@ function openGoTo(ctx) {
|
|
|
3312
3313
|
buttons: [special],
|
|
3313
3314
|
opened: () => reference.focus(),
|
|
3314
3315
|
submit: () => {
|
|
3315
|
-
const
|
|
3316
|
-
if (!
|
|
3317
|
-
selectOn(ctx,
|
|
3316
|
+
const target42 = resolveReference(ctx, reference.value);
|
|
3317
|
+
if (!target42) return invalid(ctx, reference, "Reference is not valid.");
|
|
3318
|
+
selectOn(ctx, target42.sheet, target42.range);
|
|
3318
3319
|
return reference.value.trim();
|
|
3319
3320
|
}
|
|
3320
3321
|
},
|
|
@@ -4528,19 +4529,21 @@ var SUPPORTED_FEATURES = [
|
|
|
4528
4529
|
"Hyperlinks",
|
|
4529
4530
|
"Data validation",
|
|
4530
4531
|
"Sort and filter",
|
|
4532
|
+
"AutoFilter drop-down: value checklist with search, Text, Number and Date filters, Top 10, Above and Below Average, colour and custom criteria",
|
|
4531
4533
|
"Freeze panes"
|
|
4532
4534
|
];
|
|
4533
4535
|
var UNSUPPORTED_FEATURES = [
|
|
4534
4536
|
"Unmodeled PivotTable layouts, grouping, slicers and external data sources (preserved)",
|
|
4535
4537
|
"Multiple/dynamic report filters and repeated column captions (preserved)",
|
|
4536
|
-
"
|
|
4537
|
-
"
|
|
4538
|
-
"
|
|
4539
|
-
"
|
|
4538
|
+
"AutoFilter on table headers, the date-hierarchy checklist and icon filters from the menu",
|
|
4539
|
+
"Sorting by cell colour, font colour or icon",
|
|
4540
|
+
"Flash Fill, Subtotal and Consolidate",
|
|
4541
|
+
"Split panes (Freeze Panes works)",
|
|
4542
|
+
"Formula auditing: Trace Precedents, Trace Dependents, Evaluate Formula, Watch Window",
|
|
4543
|
+
"Opening .xlsb binary workbooks",
|
|
4540
4544
|
"Editing threaded comment replies",
|
|
4541
4545
|
"Macros (VBA is kept in the file but never run)",
|
|
4542
|
-
"Changing the workbook theme"
|
|
4543
|
-
"Page Layout view"
|
|
4546
|
+
"Changing the workbook theme"
|
|
4544
4547
|
];
|
|
4545
4548
|
function bullets(ctx, items2) {
|
|
4546
4549
|
const list = el(ctx, "ul");
|
|
@@ -4935,9 +4938,9 @@ function describeRule(ctx, rule2) {
|
|
|
4935
4938
|
const t = ctx.t;
|
|
4936
4939
|
switch (rule2.type) {
|
|
4937
4940
|
case "cellIs": {
|
|
4938
|
-
const
|
|
4941
|
+
const op2 = OPERATORS.find(([o]) => o === rule2.operator)?.[1] ?? rule2.operator;
|
|
4939
4942
|
const values = rule2.formulas.map(operandText).join(` ${t("and")} `);
|
|
4940
|
-
return `${t("Cell Value")} ${t(
|
|
4943
|
+
return `${t("Cell Value")} ${t(op2)} ${values}`;
|
|
4941
4944
|
}
|
|
4942
4945
|
case "expression":
|
|
4943
4946
|
return `${t("Formula:")} =${rule2.formula}`;
|
|
@@ -5046,7 +5049,7 @@ function containsPanel(ctx) {
|
|
|
5046
5049
|
],
|
|
5047
5050
|
"cellIs"
|
|
5048
5051
|
);
|
|
5049
|
-
const
|
|
5052
|
+
const op2 = select(ctx, OPERATORS, "between");
|
|
5050
5053
|
const textOp = select(ctx, TEXT_OPS, "containsText");
|
|
5051
5054
|
const v1 = textInput(ctx);
|
|
5052
5055
|
const v2 = textInput(ctx);
|
|
@@ -5054,7 +5057,7 @@ function containsPanel(ctx) {
|
|
|
5054
5057
|
const period = select(ctx, TIME_PERIOD_LABELS, "yesterday");
|
|
5055
5058
|
const f1 = field(ctx, "Value", v1);
|
|
5056
5059
|
const f2 = field(ctx, "and", v2);
|
|
5057
|
-
const fOp = field(ctx, "Operator",
|
|
5060
|
+
const fOp = field(ctx, "Operator", op2);
|
|
5058
5061
|
const fTextOp = field(ctx, "Text operator", textOp);
|
|
5059
5062
|
const fText = field(ctx, "Text", textValue);
|
|
5060
5063
|
const fPeriod = field(ctx, "Date", period);
|
|
@@ -5063,13 +5066,13 @@ function containsPanel(ctx) {
|
|
|
5063
5066
|
const text3 = what.value === "text";
|
|
5064
5067
|
fOp.hidden = !cell;
|
|
5065
5068
|
f1.hidden = !cell;
|
|
5066
|
-
f2.hidden = !cell ||
|
|
5069
|
+
f2.hidden = !cell || op2.value !== "between" && op2.value !== "notBetween";
|
|
5067
5070
|
fTextOp.hidden = !text3;
|
|
5068
5071
|
fText.hidden = !text3;
|
|
5069
5072
|
fPeriod.hidden = what.value !== "timePeriod";
|
|
5070
5073
|
};
|
|
5071
5074
|
what.addEventListener("change", sync);
|
|
5072
|
-
|
|
5075
|
+
op2.addEventListener("change", sync);
|
|
5073
5076
|
sync();
|
|
5074
5077
|
return {
|
|
5075
5078
|
element: panel2(
|
|
@@ -5087,7 +5090,7 @@ function containsPanel(ctx) {
|
|
|
5087
5090
|
load(rule2) {
|
|
5088
5091
|
if (rule2.type === "cellIs") {
|
|
5089
5092
|
what.value = "cellIs";
|
|
5090
|
-
|
|
5093
|
+
op2.value = rule2.operator;
|
|
5091
5094
|
v1.value = operandText(rule2.formulas[0]);
|
|
5092
5095
|
v2.value = operandText(rule2.formulas[1]);
|
|
5093
5096
|
} else if (rule2.type === "containsText" || rule2.type === "notContainsText" || rule2.type === "beginsWith" || rule2.type === "endsWith") {
|
|
@@ -5103,13 +5106,13 @@ function containsPanel(ctx) {
|
|
|
5103
5106
|
read(style2) {
|
|
5104
5107
|
const priority = 1;
|
|
5105
5108
|
if (what.value === "cellIs") {
|
|
5106
|
-
const two =
|
|
5109
|
+
const two = op2.value === "between" || op2.value === "notBetween";
|
|
5107
5110
|
if (!v1.value.trim()) return { error: "Enter a value.", control: v1 };
|
|
5108
5111
|
if (two && !v2.value.trim()) return { error: "Enter a value.", control: v2 };
|
|
5109
5112
|
const formulas = two ? [operand(v1.value), operand(v2.value)] : [operand(v1.value)];
|
|
5110
5113
|
return {
|
|
5111
5114
|
type: "cellIs",
|
|
5112
|
-
operator:
|
|
5115
|
+
operator: op2.value,
|
|
5113
5116
|
formulas,
|
|
5114
5117
|
style: style2,
|
|
5115
5118
|
priority
|
|
@@ -6740,6 +6743,163 @@ function openCreateTable(ctx, props2 = {}) {
|
|
|
6740
6743
|
}
|
|
6741
6744
|
});
|
|
6742
6745
|
}
|
|
6746
|
+
function dateInputToSerial(value, date1904) {
|
|
6747
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
6748
|
+
if (!match) return void 0;
|
|
6749
|
+
const ms = Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
|
6750
|
+
return Number.isNaN(ms) ? void 0 : Math.floor(dateToSerial(new Date(ms), date1904));
|
|
6751
|
+
}
|
|
6752
|
+
function serialToDateInput(serial, date1904 = false) {
|
|
6753
|
+
const n = Number(serial);
|
|
6754
|
+
if (serial.trim() === "" || !Number.isFinite(n)) return "";
|
|
6755
|
+
return serialToDate(n, date1904).toISOString().slice(0, 10);
|
|
6756
|
+
}
|
|
6757
|
+
|
|
6758
|
+
// src/xlsx/dialogs/custom-autofilter.ts
|
|
6759
|
+
var OPERATORS2 = [
|
|
6760
|
+
["equals", "equals"],
|
|
6761
|
+
["notEquals", "does not equal"],
|
|
6762
|
+
["greaterThan", "is greater than"],
|
|
6763
|
+
["greaterThanOrEqual", "is greater than or equal to"],
|
|
6764
|
+
["lessThan", "is less than"],
|
|
6765
|
+
["lessThanOrEqual", "is less than or equal to"],
|
|
6766
|
+
["beginsWith", "begins with"],
|
|
6767
|
+
["notBeginsWith", "does not begin with"],
|
|
6768
|
+
["endsWith", "ends with"],
|
|
6769
|
+
["notEndsWith", "does not end with"],
|
|
6770
|
+
["contains", "contains"],
|
|
6771
|
+
["notContains", "does not contain"]
|
|
6772
|
+
];
|
|
6773
|
+
var DATE_OPERATORS = /* @__PURE__ */ new Set([
|
|
6774
|
+
"equals",
|
|
6775
|
+
"notEquals",
|
|
6776
|
+
"greaterThan",
|
|
6777
|
+
"greaterThanOrEqual",
|
|
6778
|
+
"lessThan",
|
|
6779
|
+
"lessThanOrEqual"
|
|
6780
|
+
]);
|
|
6781
|
+
function openCustomAutoFilter(ctx, props2) {
|
|
6782
|
+
const t = target(ctx);
|
|
6783
|
+
const filter = t?.ws.autoFilter;
|
|
6784
|
+
if (!t || !filter) return Promise.resolve(void 0);
|
|
6785
|
+
const col = props2.col ?? t.active.col;
|
|
6786
|
+
const offset = col - filter.range.start.col;
|
|
6787
|
+
const column = filter.columns?.find((c) => c.offset === offset);
|
|
6788
|
+
const kind = props2.kind ?? "text";
|
|
6789
|
+
const head = displayText(t.workbook, getCell(t.ws, filter.range.start.row, col));
|
|
6790
|
+
const rows = (column?.custom?.conditions ?? []).map(decodeCondition);
|
|
6791
|
+
const first = rows[0] ?? {
|
|
6792
|
+
op: props2.between ? "greaterThanOrEqual" : props2.operator ?? "equals",
|
|
6793
|
+
value: ""
|
|
6794
|
+
};
|
|
6795
|
+
const second = props2.between ? { op: "lessThanOrEqual", value: "" } : rows[1];
|
|
6796
|
+
const date = kind === "date";
|
|
6797
|
+
const operators = date ? OPERATORS2.filter(([op2]) => DATE_OPERATORS.has(op2)) : OPERATORS2;
|
|
6798
|
+
const build = (initial) => {
|
|
6799
|
+
const op2 = select(ctx, operators, initial?.op ?? "equals");
|
|
6800
|
+
op2.setAttribute("aria-label", ctx.t("Operator"));
|
|
6801
|
+
const value = el(ctx, "input", "xve-input");
|
|
6802
|
+
value.type = date ? "date" : "text";
|
|
6803
|
+
value.setAttribute("aria-label", ctx.t("Value"));
|
|
6804
|
+
value.value = initial ? date ? serialToDateInput(initial.value) : initial.value : "";
|
|
6805
|
+
return { op: op2, value };
|
|
6806
|
+
};
|
|
6807
|
+
const a = build(first);
|
|
6808
|
+
const b = build(second);
|
|
6809
|
+
const join = radios(
|
|
6810
|
+
ctx,
|
|
6811
|
+
"Combine with",
|
|
6812
|
+
[
|
|
6813
|
+
["and", "And"],
|
|
6814
|
+
["or", "Or"]
|
|
6815
|
+
],
|
|
6816
|
+
props2.between || column?.custom?.and ? "and" : "or"
|
|
6817
|
+
);
|
|
6818
|
+
const wrap = (parts) => {
|
|
6819
|
+
const row2 = el(ctx, "div", "xve-row");
|
|
6820
|
+
row2.append(parts.op, parts.value);
|
|
6821
|
+
return row2;
|
|
6822
|
+
};
|
|
6823
|
+
const hint = date ? text(ctx, "Pick a date for each comparison.") : text(
|
|
6824
|
+
ctx,
|
|
6825
|
+
"Use ? to represent any single character and * to represent any series of characters."
|
|
6826
|
+
);
|
|
6827
|
+
return showDialog(ctx, {
|
|
6828
|
+
name: "custom-autofilter",
|
|
6829
|
+
heading: "Custom AutoFilter",
|
|
6830
|
+
body: [
|
|
6831
|
+
text(ctx, "Show rows where: {name}", "xve-note", { name: head }),
|
|
6832
|
+
field(ctx, "First condition", wrap(a)),
|
|
6833
|
+
join.element,
|
|
6834
|
+
field(ctx, "Second condition", wrap(b)),
|
|
6835
|
+
hint
|
|
6836
|
+
],
|
|
6837
|
+
opened: () => a.value.focus(),
|
|
6838
|
+
submit: () => {
|
|
6839
|
+
const entries = [];
|
|
6840
|
+
for (const part of [a, b]) {
|
|
6841
|
+
const raw = part.value.value.trim();
|
|
6842
|
+
if (!raw && part === b) continue;
|
|
6843
|
+
if (date) {
|
|
6844
|
+
const serial = dateInputToSerial(part.value.value, t.workbook.date1904);
|
|
6845
|
+
if (serial === void 0) {
|
|
6846
|
+
ctx.toast(ctx.t("Pick a date for each comparison."), "warning");
|
|
6847
|
+
return void 0;
|
|
6848
|
+
}
|
|
6849
|
+
entries.push({ op: part.op.value, value: String(serial) });
|
|
6850
|
+
} else entries.push({ op: part.op.value, value: part.value.value });
|
|
6851
|
+
}
|
|
6852
|
+
t.session.setFilterCriteria(t.sheet, col, customFilter(entries, join.get() === "and"));
|
|
6853
|
+
return true;
|
|
6854
|
+
}
|
|
6855
|
+
});
|
|
6856
|
+
}
|
|
6857
|
+
function openTop10Filter(ctx, props2) {
|
|
6858
|
+
const t = target(ctx);
|
|
6859
|
+
const filter = t?.ws.autoFilter;
|
|
6860
|
+
if (!t || !filter) return Promise.resolve(void 0);
|
|
6861
|
+
const col = props2.col ?? t.active.col;
|
|
6862
|
+
const current = filter.columns?.find((c) => c.offset === col - filter.range.start.col)?.top10;
|
|
6863
|
+
const side = select(
|
|
6864
|
+
ctx,
|
|
6865
|
+
[
|
|
6866
|
+
["top", "Top"],
|
|
6867
|
+
["bottom", "Bottom"]
|
|
6868
|
+
],
|
|
6869
|
+
current && !current.top ? "bottom" : "top"
|
|
6870
|
+
);
|
|
6871
|
+
side.setAttribute("aria-label", ctx.t("Top or bottom"));
|
|
6872
|
+
const count = numberInput(ctx, current?.value ?? 10, 1, 500);
|
|
6873
|
+
count.setAttribute("aria-label", ctx.t("Number of items"));
|
|
6874
|
+
const unit = select(
|
|
6875
|
+
ctx,
|
|
6876
|
+
[
|
|
6877
|
+
["items", "Items"],
|
|
6878
|
+
["percent", "Percent"]
|
|
6879
|
+
],
|
|
6880
|
+
current?.percent ? "percent" : "items"
|
|
6881
|
+
);
|
|
6882
|
+
unit.setAttribute("aria-label", ctx.t("Items or percent"));
|
|
6883
|
+
return showDialog(ctx, {
|
|
6884
|
+
name: "top10-filter",
|
|
6885
|
+
heading: "Top 10 AutoFilter",
|
|
6886
|
+
body: [field(ctx, "Show", row(ctx, side, count, unit))],
|
|
6887
|
+
opened: () => count.focus(),
|
|
6888
|
+
submit: () => {
|
|
6889
|
+
const value = Number(count.value);
|
|
6890
|
+
if (!Number.isFinite(value) || value < 1 || value > 500) {
|
|
6891
|
+
ctx.toast(ctx.t("Enter a number from 1 to 500."), "warning");
|
|
6892
|
+
return void 0;
|
|
6893
|
+
}
|
|
6894
|
+
t.session.setFilterCriteria(
|
|
6895
|
+
t.sheet,
|
|
6896
|
+
col,
|
|
6897
|
+
topFilterCriteria(side.value === "top", unit.value === "percent", Math.floor(value))
|
|
6898
|
+
);
|
|
6899
|
+
return true;
|
|
6900
|
+
}
|
|
6901
|
+
});
|
|
6902
|
+
}
|
|
6743
6903
|
function seriesValues(start, count, type, step2, options = {}) {
|
|
6744
6904
|
const out = [start];
|
|
6745
6905
|
let value = start;
|
|
@@ -7966,30 +8126,6 @@ function openSymbol(ctx) {
|
|
|
7966
8126
|
}
|
|
7967
8127
|
);
|
|
7968
8128
|
}
|
|
7969
|
-
function splitLine(line, options) {
|
|
7970
|
-
const out = [];
|
|
7971
|
-
let current = "";
|
|
7972
|
-
let quoted = false;
|
|
7973
|
-
for (let i = 0; i < line.length; i++) {
|
|
7974
|
-
const ch = line[i] ?? "";
|
|
7975
|
-
if (options.qualifier && ch === options.qualifier) {
|
|
7976
|
-
if (quoted && line[i + 1] === options.qualifier) {
|
|
7977
|
-
current += ch;
|
|
7978
|
-
i++;
|
|
7979
|
-
} else quoted = !quoted;
|
|
7980
|
-
continue;
|
|
7981
|
-
}
|
|
7982
|
-
if (!quoted && options.delimiters.includes(ch)) {
|
|
7983
|
-
out.push(current);
|
|
7984
|
-
current = "";
|
|
7985
|
-
if (options.consecutive) while (options.delimiters.includes(line[i + 1] ?? "\0")) i++;
|
|
7986
|
-
continue;
|
|
7987
|
-
}
|
|
7988
|
-
current += ch;
|
|
7989
|
-
}
|
|
7990
|
-
out.push(current);
|
|
7991
|
-
return out;
|
|
7992
|
-
}
|
|
7993
8129
|
var cellText = (value) => value === null || value === void 0 ? "" : typeof value === "object" ? String(value.error) : String(value);
|
|
7994
8130
|
function openTextToColumns(ctx) {
|
|
7995
8131
|
const t = target(ctx);
|
|
@@ -7999,6 +8135,15 @@ function openTextToColumns(ctx) {
|
|
|
7999
8135
|
const lines = [];
|
|
8000
8136
|
for (let rowIndex = r.start.row; rowIndex <= r.end.row; rowIndex++)
|
|
8001
8137
|
lines.push(cellText(getCell(t.ws, rowIndex, col)?.value));
|
|
8138
|
+
const kind = radios(
|
|
8139
|
+
ctx,
|
|
8140
|
+
"Original data type",
|
|
8141
|
+
[
|
|
8142
|
+
["delimited", "Delimited"],
|
|
8143
|
+
["fixed", "Fixed width"]
|
|
8144
|
+
],
|
|
8145
|
+
"delimited"
|
|
8146
|
+
);
|
|
8002
8147
|
const tab = checkbox(ctx, "Tab", true);
|
|
8003
8148
|
const semicolon = checkbox(ctx, "Semicolon");
|
|
8004
8149
|
const comma = checkbox(ctx, "Comma");
|
|
@@ -8018,6 +8163,8 @@ function openTextToColumns(ctx) {
|
|
|
8018
8163
|
'"',
|
|
8019
8164
|
true
|
|
8020
8165
|
);
|
|
8166
|
+
const breaks = textInput(ctx);
|
|
8167
|
+
breaks.placeholder = "5, 12";
|
|
8021
8168
|
const destination = textInput(ctx, formatAddress(r.start));
|
|
8022
8169
|
const preview = el(ctx, "div", "xve-results");
|
|
8023
8170
|
preview.setAttribute("aria-label", ctx.t("Data preview"));
|
|
@@ -8032,19 +8179,54 @@ function openTextToColumns(ctx) {
|
|
|
8032
8179
|
consecutive: consecutive.input.checked,
|
|
8033
8180
|
qualifier: qualifier.value
|
|
8034
8181
|
});
|
|
8182
|
+
const splitter = () => {
|
|
8183
|
+
if (kind.get() === "fixed") {
|
|
8184
|
+
const positions = parseBreakPositions(breaks.value);
|
|
8185
|
+
return positions ? (line) => splitFixedWidth(line, positions) : void 0;
|
|
8186
|
+
}
|
|
8187
|
+
const opts = options();
|
|
8188
|
+
return (line) => splitDelimited(line, opts);
|
|
8189
|
+
};
|
|
8035
8190
|
const refresh = () => {
|
|
8191
|
+
const split = splitter();
|
|
8192
|
+
breaks.setAttribute("aria-invalid", split ? "false" : "true");
|
|
8036
8193
|
const table = el(ctx, "table");
|
|
8037
|
-
|
|
8038
|
-
const
|
|
8039
|
-
|
|
8040
|
-
const
|
|
8041
|
-
|
|
8042
|
-
|
|
8194
|
+
if (split)
|
|
8195
|
+
for (const line of lines.slice(0, 5)) {
|
|
8196
|
+
const tr = el(ctx, "tr");
|
|
8197
|
+
for (const part of split(line)) {
|
|
8198
|
+
const td = el(ctx, "td");
|
|
8199
|
+
td.textContent = part;
|
|
8200
|
+
tr.append(td);
|
|
8201
|
+
}
|
|
8202
|
+
table.append(tr);
|
|
8043
8203
|
}
|
|
8044
|
-
table.append(tr);
|
|
8045
|
-
}
|
|
8046
8204
|
preview.replaceChildren(table);
|
|
8047
8205
|
};
|
|
8206
|
+
const delimitedPart = el(ctx, "div");
|
|
8207
|
+
delimitedPart.append(
|
|
8208
|
+
fieldset(
|
|
8209
|
+
ctx,
|
|
8210
|
+
"Delimiters",
|
|
8211
|
+
row(ctx, tab.wrapper, semicolon.wrapper, comma.wrapper, space.wrapper),
|
|
8212
|
+
row(ctx, other.wrapper, otherChar)
|
|
8213
|
+
),
|
|
8214
|
+
consecutive.wrapper,
|
|
8215
|
+
field(ctx, "Text qualifier:", qualifier)
|
|
8216
|
+
);
|
|
8217
|
+
const fixedPart = el(ctx, "div");
|
|
8218
|
+
fixedPart.append(
|
|
8219
|
+
field(ctx, "Break positions:", breaks),
|
|
8220
|
+
text(ctx, "Each number ends a column after that character, for example 5, 12.")
|
|
8221
|
+
);
|
|
8222
|
+
fixedPart.hidden = true;
|
|
8223
|
+
const showKind = () => {
|
|
8224
|
+
const fixed2 = kind.get() === "fixed";
|
|
8225
|
+
delimitedPart.hidden = fixed2;
|
|
8226
|
+
fixedPart.hidden = !fixed2;
|
|
8227
|
+
refresh();
|
|
8228
|
+
};
|
|
8229
|
+
kind.inputs.forEach((input) => input.addEventListener("change", showKind));
|
|
8048
8230
|
for (const control of [
|
|
8049
8231
|
tab.input,
|
|
8050
8232
|
semicolon.input,
|
|
@@ -8059,25 +8241,20 @@ function openTextToColumns(ctx) {
|
|
|
8059
8241
|
if (otherChar.value) other.input.checked = true;
|
|
8060
8242
|
refresh();
|
|
8061
8243
|
});
|
|
8244
|
+
breaks.addEventListener("input", refresh);
|
|
8062
8245
|
refresh();
|
|
8063
8246
|
return showDialog(ctx, {
|
|
8064
8247
|
name: "text-to-columns",
|
|
8065
8248
|
heading: "Convert Text to Columns",
|
|
8066
8249
|
wide: true,
|
|
8067
8250
|
body: [
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
row(ctx, tab.wrapper, semicolon.wrapper, comma.wrapper, space.wrapper),
|
|
8072
|
-
row(ctx, other.wrapper, otherChar)
|
|
8073
|
-
),
|
|
8074
|
-
consecutive.wrapper,
|
|
8075
|
-
field(ctx, "Text qualifier:", qualifier),
|
|
8251
|
+
kind.element,
|
|
8252
|
+
delimitedPart,
|
|
8253
|
+
fixedPart,
|
|
8076
8254
|
field(ctx, "Destination:", destination),
|
|
8077
|
-
preview
|
|
8078
|
-
text(ctx, "Only delimited text is supported; fixed width splitting is not available yet.")
|
|
8255
|
+
preview
|
|
8079
8256
|
],
|
|
8080
|
-
opened: () =>
|
|
8257
|
+
opened: () => kind.inputs[0]?.focus(),
|
|
8081
8258
|
submit: () => {
|
|
8082
8259
|
const dest = parseAddress(
|
|
8083
8260
|
destination.value.trim().replace(/^=/, "").replace(/^.*!/, "")
|
|
@@ -8087,12 +8264,18 @@ function openTextToColumns(ctx) {
|
|
|
8087
8264
|
destination.focus();
|
|
8088
8265
|
return void 0;
|
|
8089
8266
|
}
|
|
8090
|
-
const
|
|
8267
|
+
const split = splitter();
|
|
8268
|
+
if (!split)
|
|
8269
|
+
return invalid(
|
|
8270
|
+
ctx,
|
|
8271
|
+
breaks,
|
|
8272
|
+
"Enter break positions as whole numbers from 1, separated by commas."
|
|
8273
|
+
);
|
|
8091
8274
|
let written = 0;
|
|
8092
8275
|
t.session.batch("Text to Columns", () => {
|
|
8093
8276
|
lines.forEach((line, i) => {
|
|
8094
8277
|
if (!line) return;
|
|
8095
|
-
|
|
8278
|
+
split(line).forEach((part, j) => {
|
|
8096
8279
|
t.session.setCellInput(t.sheet, dest.row + i, dest.col + j, part);
|
|
8097
8280
|
written++;
|
|
8098
8281
|
});
|
|
@@ -9998,6 +10181,11 @@ function registerToolDialogs(ctx) {
|
|
|
9998
10181
|
d.register("delete-cells", (c) => openCellShift(c, "delete"));
|
|
9999
10182
|
d.register("group", (c) => openOutlineAxis(c, "group"));
|
|
10000
10183
|
d.register("ungroup", (c) => openOutlineAxis(c, "ungroup"));
|
|
10184
|
+
d.register(
|
|
10185
|
+
"custom-autofilter",
|
|
10186
|
+
(c, p) => openCustomAutoFilter(c, props(p))
|
|
10187
|
+
);
|
|
10188
|
+
d.register("top10-filter", (c, p) => openTop10Filter(c, props(p)));
|
|
10001
10189
|
d.register("remove-duplicates", (c) => openRemoveDuplicates(c));
|
|
10002
10190
|
d.register("text-to-columns", (c) => openTextToColumns(c));
|
|
10003
10191
|
d.register("goal-seek", (c) => openGoalSeek(c));
|
|
@@ -10234,6 +10422,9 @@ function place(node, left, top, width, height) {
|
|
|
10234
10422
|
node.style.width = `${Math.max(0, width)}px`;
|
|
10235
10423
|
node.style.height = `${Math.max(0, height)}px`;
|
|
10236
10424
|
}
|
|
10425
|
+
function toggleClass(node, name, on) {
|
|
10426
|
+
if (node.classList.contains(name) !== on) node.classList.toggle(name, on);
|
|
10427
|
+
}
|
|
10237
10428
|
function svgNode(doc, markup) {
|
|
10238
10429
|
const holder = doc.createElement("div");
|
|
10239
10430
|
holder.innerHTML = markup;
|
|
@@ -10305,7 +10496,10 @@ function paintSmartArt(ctx, node, obj2, theme, size = {
|
|
|
10305
10496
|
art.schemeColors = smartArtSchemeColors(theme);
|
|
10306
10497
|
art.schemeFonts = theme ? { major: theme.majorFont, minor: theme.minorFont } : {};
|
|
10307
10498
|
if (pictureResolver) art.pictureResolver = pictureResolver;
|
|
10308
|
-
art.drawing =
|
|
10499
|
+
art.drawing = {
|
|
10500
|
+
...diagram,
|
|
10501
|
+
extentEmu: { width: Math.round(size.w * 9525), height: Math.round(size.h * 9525) }
|
|
10502
|
+
};
|
|
10309
10503
|
node.append(art);
|
|
10310
10504
|
} else {
|
|
10311
10505
|
node.classList.add("xg-smartart-placeholder");
|
|
@@ -12161,8 +12355,8 @@ function workbookChartTheme(workbook) {
|
|
|
12161
12355
|
return { scheme: (name) => scheme[name] };
|
|
12162
12356
|
}
|
|
12163
12357
|
var FILL_PARTS = ["chartArea", "plotArea", "title", "legend", "series"];
|
|
12164
|
-
var xlsxFillsTarget = (
|
|
12165
|
-
function xlsxChartFormatSource(chart, space, theme,
|
|
12358
|
+
var xlsxFillsTarget = (target42) => FILL_PARTS.includes(target42.kind);
|
|
12359
|
+
function xlsxChartFormatSource(chart, space, theme, target42) {
|
|
12166
12360
|
const source = chartSpaceFormatSource(space, { theme });
|
|
12167
12361
|
const spacing = chartBarSpacing(chart);
|
|
12168
12362
|
return {
|
|
@@ -12178,7 +12372,7 @@ function xlsxChartFormatSource(chart, space, theme, target40) {
|
|
|
12178
12372
|
sliders: true
|
|
12179
12373
|
};
|
|
12180
12374
|
},
|
|
12181
|
-
...
|
|
12375
|
+
...target42 && xlsxFillsTarget(target42) && source.element(target42).fill.kind !== "pattern" ? { slots: { fill: XLSX_CHART_FILL_SLOT } } : {},
|
|
12182
12376
|
flat: true,
|
|
12183
12377
|
picker: { key: "chartFormat.chartElement", fallback: "Chart element" }
|
|
12184
12378
|
};
|
|
@@ -12583,10 +12777,10 @@ function createGradientTypeField(ctx, onPick) {
|
|
|
12583
12777
|
};
|
|
12584
12778
|
}
|
|
12585
12779
|
function createChartGradientPreview(root, drawing, series, gradient) {
|
|
12586
|
-
const
|
|
12780
|
+
const target42 = typeof series === "number" ? `s${series}` : series;
|
|
12587
12781
|
const nodes = Array.from(
|
|
12588
12782
|
root.querySelectorAll(
|
|
12589
|
-
`.xg-obj[data-index="${drawing}"] :is(linearGradient,radialGradient,pattern)[id$="-${
|
|
12783
|
+
`.xg-obj[data-index="${drawing}"] :is(linearGradient,radialGradient,pattern)[id$="-${target42}"]`
|
|
12590
12784
|
)
|
|
12591
12785
|
);
|
|
12592
12786
|
const originals = nodes.map((node) => ({
|
|
@@ -13223,7 +13417,7 @@ function createChartFormatPane(ctx) {
|
|
|
13223
13417
|
const element = doc.createElement("office-ui-chart-format-pane");
|
|
13224
13418
|
element.className = "xve-chart-series-pane";
|
|
13225
13419
|
element.hidden = true;
|
|
13226
|
-
let
|
|
13420
|
+
let target42 = "chartArea";
|
|
13227
13421
|
let seriesIndex = 0;
|
|
13228
13422
|
let part = "chartArea";
|
|
13229
13423
|
const seriesFill = createSeriesFill(ctx, () => seriesIndex);
|
|
@@ -13236,7 +13430,7 @@ function createChartFormatPane(ctx) {
|
|
|
13236
13430
|
fill.element.slot = XLSX_CHART_FILL_SLOT;
|
|
13237
13431
|
fill.element.querySelector("h3")?.setAttribute("hidden", "");
|
|
13238
13432
|
}
|
|
13239
|
-
const parsed = () => parseChartFormatTargetKey(
|
|
13433
|
+
const parsed = () => parseChartFormatTargetKey(target42);
|
|
13240
13434
|
const isSeries = () => parsed()?.kind === "series";
|
|
13241
13435
|
const commandId = () => isSeries() ? "chart.format-series" : "chart.format-area";
|
|
13242
13436
|
const close = () => {
|
|
@@ -13261,10 +13455,10 @@ function createChartFormatPane(ctx) {
|
|
|
13261
13455
|
const space = chartSpaceOf(book, found.chart);
|
|
13262
13456
|
const theme = workbookChartTheme(book);
|
|
13263
13457
|
const listed = xlsxChartFormatSource(found.chart, space, theme, void 0);
|
|
13264
|
-
if (!listed.targets.some((option) => option.key ===
|
|
13458
|
+
if (!listed.targets.some((option) => option.key === target42)) target42 = "chartArea";
|
|
13265
13459
|
const selected2 = parsed();
|
|
13266
13460
|
seriesIndex = selected2?.kind === "series" ? selected2.seriesIndex : 0;
|
|
13267
|
-
part = BACKGROUNDS.includes(
|
|
13461
|
+
part = BACKGROUNDS.includes(target42) ? target42 : "chartArea";
|
|
13268
13462
|
const slotted = selected2 !== void 0 && xlsxFillsTarget(selected2) && listed.element(selected2).fill.kind !== "pattern";
|
|
13269
13463
|
const [active2, idle] = isSeries() ? [seriesFill, backgroundFill] : [backgroundFill, seriesFill];
|
|
13270
13464
|
idle.refresh(void 0, void 0);
|
|
@@ -13277,11 +13471,11 @@ function createChartFormatPane(ctx) {
|
|
|
13277
13471
|
active2.element.remove();
|
|
13278
13472
|
}
|
|
13279
13473
|
element.source = xlsxChartFormatSource(found.chart, space, theme, selected2);
|
|
13280
|
-
element.target =
|
|
13474
|
+
element.target = target42;
|
|
13281
13475
|
element.disabled = !ctx.commands.isEnabled(commandId());
|
|
13282
13476
|
};
|
|
13283
13477
|
element.addEventListener("office-chart-format-target", (event) => {
|
|
13284
|
-
|
|
13478
|
+
target42 = event.detail.target;
|
|
13285
13479
|
refresh();
|
|
13286
13480
|
});
|
|
13287
13481
|
element.addEventListener("office-chart-format-close", close);
|
|
@@ -13322,13 +13516,13 @@ function createChartFormatPane(ctx) {
|
|
|
13322
13516
|
element.shadowRoot?.querySelector(focus)?.focus();
|
|
13323
13517
|
};
|
|
13324
13518
|
ctx.dialogs.register("format-chart-area", async (_ctx, arg) => {
|
|
13325
|
-
|
|
13519
|
+
target42 = typeof arg === "string" && BACKGROUNDS.includes(arg) ? arg : "chartArea";
|
|
13326
13520
|
open("[data-chart-format-target]");
|
|
13327
13521
|
});
|
|
13328
13522
|
ctx.dialogs.register("format-chart-series", async (_ctx, arg) => {
|
|
13329
13523
|
const found = activeChart(ctx);
|
|
13330
13524
|
const index = typeof arg === "number" && Number.isInteger(arg) && found?.chart.series[arg] ? arg : 0;
|
|
13331
|
-
|
|
13525
|
+
target42 = `series:${index}`;
|
|
13332
13526
|
open('[data-chart-format-field="series.overlap"] input');
|
|
13333
13527
|
});
|
|
13334
13528
|
relocalize();
|
|
@@ -14070,11 +14264,11 @@ var CellEditor = class {
|
|
|
14070
14264
|
}
|
|
14071
14265
|
const refs = [];
|
|
14072
14266
|
for (const ref of this.field.references()) {
|
|
14073
|
-
const
|
|
14074
|
-
if (!
|
|
14075
|
-
if (
|
|
14267
|
+
const target42 = referenceTarget(ref.text);
|
|
14268
|
+
if (!target42) continue;
|
|
14269
|
+
if (target42.sheet !== void 0 && target42.sheet.toLowerCase() !== sheet.name.toLowerCase())
|
|
14076
14270
|
continue;
|
|
14077
|
-
refs.push({ range:
|
|
14271
|
+
refs.push({ range: target42.range, color: ref.color });
|
|
14078
14272
|
}
|
|
14079
14273
|
view.overlay.references = refs.length ? refs : void 0;
|
|
14080
14274
|
view.schedule();
|
|
@@ -14443,7 +14637,7 @@ function pressFormControl(view, event, control, node, hooks) {
|
|
|
14443
14637
|
const controls = sheet.drawings.filter((d) => d.kind === "formControl");
|
|
14444
14638
|
const sheetIndex = view.sheetIndex();
|
|
14445
14639
|
const resolved = controlStateIn(workbook, sheetIndex, controls, control);
|
|
14446
|
-
const
|
|
14640
|
+
const target42 = controlLinkCell(workbook, sheetIndex, resolved.link);
|
|
14447
14641
|
const write = (action) => {
|
|
14448
14642
|
const value = applyControlAction(
|
|
14449
14643
|
control,
|
|
@@ -14451,9 +14645,9 @@ function pressFormControl(view, event, control, node, hooks) {
|
|
|
14451
14645
|
action,
|
|
14452
14646
|
resolved.radioIndex
|
|
14453
14647
|
);
|
|
14454
|
-
if (value === void 0 || !
|
|
14648
|
+
if (value === void 0 || !target42) return;
|
|
14455
14649
|
try {
|
|
14456
|
-
session.setCellValue(
|
|
14650
|
+
session.setCellValue(target42.sheet, target42.row, target42.col, value);
|
|
14457
14651
|
} catch (error) {
|
|
14458
14652
|
view.ctx.toast(view.ctx.t(error instanceof Error ? error.message : String(error)), "warning");
|
|
14459
14653
|
}
|
|
@@ -14613,7 +14807,25 @@ var DrawingLayer = class {
|
|
|
14613
14807
|
const doc = view.doc;
|
|
14614
14808
|
node.replaceChildren();
|
|
14615
14809
|
node.className = "xg-obj";
|
|
14616
|
-
if (drawing.kind === "image") {
|
|
14810
|
+
if (drawing.kind === "image" && (needsPicturePixels(drawing.effects ?? []) || drawing.layout?.tile || Object.values(drawing.layout?.fillRect ?? {}).some((value) => value !== 0))) {
|
|
14811
|
+
const url = this.#url(drawing.partName, drawing.contentType);
|
|
14812
|
+
if (url)
|
|
14813
|
+
node.append(
|
|
14814
|
+
pictureSvg(
|
|
14815
|
+
doc,
|
|
14816
|
+
{
|
|
14817
|
+
kind: "picture",
|
|
14818
|
+
...drawing.crop ? { crop: drawing.crop } : {},
|
|
14819
|
+
...drawing.effects ? { effects: drawing.effects } : {},
|
|
14820
|
+
...drawing.layout ? { layout: drawing.layout } : {}
|
|
14821
|
+
},
|
|
14822
|
+
url,
|
|
14823
|
+
box.w,
|
|
14824
|
+
box.h
|
|
14825
|
+
)
|
|
14826
|
+
);
|
|
14827
|
+
node.setAttribute("role", "img");
|
|
14828
|
+
} else if (drawing.kind === "image") {
|
|
14617
14829
|
const img = h(doc, "img", "", {
|
|
14618
14830
|
alt: drawing.description ?? drawing.name ?? "",
|
|
14619
14831
|
draggable: "false"
|
|
@@ -14812,11 +15024,11 @@ var DrawingLayer = class {
|
|
|
14812
15024
|
}
|
|
14813
15025
|
/** Handles a press on a timeline control; false lets the press move or resize the frame. */
|
|
14814
15026
|
#pressTimeline(event, index, frame, node) {
|
|
14815
|
-
const
|
|
15027
|
+
const target42 = event.target;
|
|
14816
15028
|
const view = this.#view;
|
|
14817
|
-
const list =
|
|
14818
|
-
const clear =
|
|
14819
|
-
const cell =
|
|
15029
|
+
const list = target42.closest("[data-timeline-action=level]");
|
|
15030
|
+
const clear = target42.closest("[data-timeline-action=clear]");
|
|
15031
|
+
const cell = target42.closest("[data-period]");
|
|
14820
15032
|
if (!list && !clear && !cell) return false;
|
|
14821
15033
|
view.ctx.selection.set({ drawing: index });
|
|
14822
15034
|
if (list) return true;
|
|
@@ -14871,10 +15083,10 @@ var DrawingLayer = class {
|
|
|
14871
15083
|
}
|
|
14872
15084
|
/** Handles a press on a slicer button; false lets the press move or resize the slicer. */
|
|
14873
15085
|
#pressSlicer(event, index, frame, pointer = true) {
|
|
14874
|
-
const
|
|
15086
|
+
const target42 = event.target;
|
|
14875
15087
|
const view = this.#view;
|
|
14876
|
-
const item =
|
|
14877
|
-
const tool =
|
|
15088
|
+
const item = target42.closest("[data-slicer-item]");
|
|
15089
|
+
const tool = target42.closest("[data-slicer-action]");
|
|
14878
15090
|
if (!item && !tool) return false;
|
|
14879
15091
|
view.ctx.selection.set({ drawing: index });
|
|
14880
15092
|
if (pointer) view.ctx.grid()?.focus();
|
|
@@ -15471,8 +15683,8 @@ function openMenuAtActive(view, refocus) {
|
|
|
15471
15683
|
}
|
|
15472
15684
|
function wireMenus(view, refocus) {
|
|
15473
15685
|
const onMenu = (event) => {
|
|
15474
|
-
const
|
|
15475
|
-
if (
|
|
15686
|
+
const target42 = event.target;
|
|
15687
|
+
if (target42.closest(".xg-editor-host.xg-editing, .xg-popup")) return;
|
|
15476
15688
|
event.preventDefault();
|
|
15477
15689
|
const hit = view.hitClient(event.clientX, event.clientY);
|
|
15478
15690
|
const kind = hit.area === "row-header" ? "row" : hit.area === "col-header" ? "col" : "cell";
|
|
@@ -15533,8 +15745,8 @@ function startHeaderResize(view, axis, index, event) {
|
|
|
15533
15745
|
}
|
|
15534
15746
|
};
|
|
15535
15747
|
draw();
|
|
15536
|
-
const
|
|
15537
|
-
|
|
15748
|
+
const target42 = view.view;
|
|
15749
|
+
target42.setPointerCapture?.(event.pointerId);
|
|
15538
15750
|
const move = (e) => {
|
|
15539
15751
|
const { x, y } = view.clientToView(e.clientX, e.clientY);
|
|
15540
15752
|
size = Math.max(0, Math.round((axis === "col" ? x : y) - start));
|
|
@@ -15542,9 +15754,9 @@ function startHeaderResize(view, axis, index, event) {
|
|
|
15542
15754
|
guide.title = String(toFileSize(view, axis, size));
|
|
15543
15755
|
};
|
|
15544
15756
|
const up = (e) => {
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15757
|
+
target42.removeEventListener("pointermove", move, true);
|
|
15758
|
+
target42.removeEventListener("pointerup", up, true);
|
|
15759
|
+
target42.releasePointerCapture?.(e.pointerId);
|
|
15548
15760
|
guide.remove();
|
|
15549
15761
|
const indices = resizeTargets(view, axis, index);
|
|
15550
15762
|
const sheet = view.sheetIndex();
|
|
@@ -15552,8 +15764,8 @@ function startHeaderResize(view, axis, index, event) {
|
|
|
15552
15764
|
else if (axis === "col") session.setColumnWidth(sheet, indices, toFileSize(view, "col", size));
|
|
15553
15765
|
else session.setRowHeight(sheet, indices, toFileSize(view, "row", size));
|
|
15554
15766
|
};
|
|
15555
|
-
|
|
15556
|
-
|
|
15767
|
+
target42.addEventListener("pointermove", move, true);
|
|
15768
|
+
target42.addEventListener("pointerup", up, true);
|
|
15557
15769
|
}
|
|
15558
15770
|
function autoFit(view, axis, index) {
|
|
15559
15771
|
const session = view.ctx.session();
|
|
@@ -15643,8 +15855,8 @@ function wirePointer(host) {
|
|
|
15643
15855
|
}, 40);
|
|
15644
15856
|
};
|
|
15645
15857
|
const onDown = (event) => {
|
|
15646
|
-
const
|
|
15647
|
-
if (
|
|
15858
|
+
const target42 = event.target;
|
|
15859
|
+
if (target42.closest(".xg-editor-host, .xg-obj, .xg-dd, .xg-popup, .xg-assist")) return;
|
|
15648
15860
|
const { x, y } = view.clientToView(event.clientX, event.clientY);
|
|
15649
15861
|
const g = view.geometry;
|
|
15650
15862
|
const hit = g.hit(x, y);
|
|
@@ -15661,7 +15873,7 @@ function wirePointer(host) {
|
|
|
15661
15873
|
event.preventDefault();
|
|
15662
15874
|
const sheet = view.sheet();
|
|
15663
15875
|
const editable = !view.ctx.readOnly();
|
|
15664
|
-
if (
|
|
15876
|
+
if (target42.closest('[data-handle="fill"]') && editable) {
|
|
15665
15877
|
drag = { kind: "fill", anchor: selection.get().active, pointer: event.pointerId, x, y };
|
|
15666
15878
|
el4.setPointerCapture?.(event.pointerId);
|
|
15667
15879
|
return;
|
|
@@ -15747,17 +15959,17 @@ function wirePointer(host) {
|
|
|
15747
15959
|
drag = void 0;
|
|
15748
15960
|
el4.releasePointerCapture?.(event.pointerId);
|
|
15749
15961
|
if (finished.kind === "fill") {
|
|
15750
|
-
const
|
|
15962
|
+
const target42 = view.overlay.fillPreview;
|
|
15751
15963
|
view.overlay.fillPreview = void 0;
|
|
15752
15964
|
const source = selection.get().ranges[selection.get().ranges.length - 1];
|
|
15753
|
-
if (
|
|
15965
|
+
if (target42 && source) host.fill(source, target42);
|
|
15754
15966
|
view.schedule();
|
|
15755
15967
|
}
|
|
15756
15968
|
if (finished.kind === "point") editor.focus();
|
|
15757
15969
|
};
|
|
15758
15970
|
const onDblClick = (event) => {
|
|
15759
|
-
const
|
|
15760
|
-
if (
|
|
15971
|
+
const target42 = event.target;
|
|
15972
|
+
if (target42.closest(".xg-editor-host, .xg-obj, .xg-popup")) return;
|
|
15761
15973
|
const { x, y } = view.clientToView(event.clientX, event.clientY);
|
|
15762
15974
|
const g = view.geometry;
|
|
15763
15975
|
const hit = g.hit(x, y);
|
|
@@ -16741,8 +16953,8 @@ function wireTooltips(view) {
|
|
|
16741
16953
|
tip.append(who, view.doc.createTextNode(reply.text));
|
|
16742
16954
|
}
|
|
16743
16955
|
} else if (link) {
|
|
16744
|
-
const
|
|
16745
|
-
tip.textContent = `${link.tooltip ??
|
|
16956
|
+
const target42 = link.target ?? link.location ?? "";
|
|
16957
|
+
tip.textContent = `${link.tooltip ?? target42}
|
|
16746
16958
|
${view.ctx.t("Ctrl+click to follow the link.")}`;
|
|
16747
16959
|
}
|
|
16748
16960
|
const g = view.geometry;
|
|
@@ -16777,8 +16989,8 @@ ${view.ctx.t("Ctrl+click to follow the link.")}`;
|
|
|
16777
16989
|
tip.remove();
|
|
16778
16990
|
};
|
|
16779
16991
|
}
|
|
16780
|
-
function workbookLocation(
|
|
16781
|
-
const value =
|
|
16992
|
+
function workbookLocation(target42) {
|
|
16993
|
+
const value = target42.trim();
|
|
16782
16994
|
if (value.startsWith("#")) return value.slice(1);
|
|
16783
16995
|
return /^[a-z][a-z0-9+.-]+:/i.test(value) || /[\\/]/.test(value) ? void 0 : value;
|
|
16784
16996
|
}
|
|
@@ -16808,13 +17020,13 @@ function goTo(view, selection, location) {
|
|
|
16808
17020
|
if (!workbook) return false;
|
|
16809
17021
|
const text3 = location.replace(/^#/, "");
|
|
16810
17022
|
const name = workbook.definedNames.find((n) => n.name.toLowerCase() === text3.toLowerCase());
|
|
16811
|
-
const
|
|
16812
|
-
if (!
|
|
16813
|
-
const sheetIndex =
|
|
17023
|
+
const target42 = referenceTarget(name ? name.formula : text3);
|
|
17024
|
+
if (!target42) return false;
|
|
17025
|
+
const sheetIndex = target42.sheet ? workbook.sheets.indexOf(sheetByName(workbook, target42.sheet)) : view.sheetIndex();
|
|
16814
17026
|
if (sheetIndex < 0) return false;
|
|
16815
17027
|
if (sheetIndex !== view.sheetIndex()) view.ctx.setActiveSheet(sheetIndex);
|
|
16816
|
-
const next = selectCell(sheetIndex, workbook.sheets[sheetIndex],
|
|
16817
|
-
selection.set({ ...next, ranges: [
|
|
17028
|
+
const next = selectCell(sheetIndex, workbook.sheets[sheetIndex], target42.range.start);
|
|
17029
|
+
selection.set({ ...next, ranges: [target42.range] }, target42.range.start);
|
|
16818
17030
|
return true;
|
|
16819
17031
|
}
|
|
16820
17032
|
|
|
@@ -16907,6 +17119,30 @@ var GRID_CSS = `
|
|
|
16907
17119
|
.xg-dd{position:absolute;z-index:6;width:17px;height:17px;box-sizing:border-box;border:1px solid #c8c8c8;background:#f3f3f3;
|
|
16908
17120
|
display:flex;align-items:center;justify-content:center;cursor:default;pointer-events:auto}
|
|
16909
17121
|
.xg-dd::before{content:"";border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #444}
|
|
17122
|
+
.xg-fb{position:absolute;z-index:6;box-sizing:border-box;padding:0;border:1px solid #c8c8c8;background:#f3f3f3;display:flex;align-items:center;justify-content:center;cursor:default;pointer-events:auto}
|
|
17123
|
+
.xg-fb::before{content:"";border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #444}
|
|
17124
|
+
.xg-fb-active{background:#dcebe1;border-color:var(--xve-selection-border, var(--office-accent, #217346))}
|
|
17125
|
+
.xg-fb-active::before{border:0;width:8px;height:8px;background:var(--xve-selection-border, var(--office-accent, #217346));clip-path:polygon(0 0,100% 0,62% 50%,62% 100%,38% 85%,38% 50%)}
|
|
17126
|
+
.xg-fmenu{padding:4px 0;font-size:13px;max-height:calc(100% - 8px)}
|
|
17127
|
+
.xg-fm-row{position:relative}
|
|
17128
|
+
.xg-fm-sep{border-top:1px solid var(--xve-border, var(--office-border, #d8d8d8));margin-top:3px;padding-top:3px}
|
|
17129
|
+
.xg-fm-item{display:block;width:100%;text-align:left;padding:4px 14px;border:0;background:transparent;color:inherit;font:inherit;cursor:default}
|
|
17130
|
+
.xg-fm-item:hover:not(:disabled),.xg-fm-item:focus-visible{background:var(--xve-accent, var(--office-selected, #e1efe6));outline:none}
|
|
17131
|
+
.xg-fm-item:disabled{opacity:.45}
|
|
17132
|
+
.xg-fm-parent::after{content:"";position:absolute;right:10px;top:50%;margin-top:-4px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:5px solid currentColor}
|
|
17133
|
+
.xg-fm-sub{position:absolute;left:100%;top:-4px;min-width:200px;padding:4px 0;max-height:360px;overflow:auto}
|
|
17134
|
+
.xg-fm-sub[hidden]{display:none}
|
|
17135
|
+
.xg-fm-head{padding:4px 14px;font-weight:600}
|
|
17136
|
+
.xg-fm-swatches{display:flex;flex-wrap:wrap;gap:3px;padding:2px 14px 6px;max-width:220px}
|
|
17137
|
+
.xg-fm-swatch{width:18px;height:18px;border:1px solid #888;padding:0}
|
|
17138
|
+
.xg-fm-values{padding:4px 10px 6px;border-top:1px solid var(--xve-border, var(--office-border, #d8d8d8));margin-top:3px}
|
|
17139
|
+
.xg-fm-search{box-sizing:border-box;width:100%;margin:4px 0;padding:3px 6px;font:inherit;border:1px solid var(--xve-border, var(--office-border, #c8c8c8));background:transparent;color:inherit}
|
|
17140
|
+
.xg-fm-list{list-style:none;margin:2px 0;padding:0 0 0 4px;max-height:180px;overflow:auto;border:1px solid var(--xve-border, var(--office-border, #d8d8d8))}
|
|
17141
|
+
.xg-fm-check{display:flex;align-items:center;gap:6px;padding:2px 4px;white-space:nowrap}
|
|
17142
|
+
.xg-fm-empty{padding:4px;opacity:.7}
|
|
17143
|
+
.xg-fm-buttons{display:flex;gap:6px;justify-content:flex-end;margin-top:6px}
|
|
17144
|
+
.xg-fm-buttons button{min-width:64px;padding:3px 10px;border:1px solid var(--xve-border, var(--office-border, #c8c8c8));border-radius:3px;background:var(--xve-secondary, var(--office-surface, #f3f3f3));color:inherit;font:inherit}
|
|
17145
|
+
.xg-fm-buttons .xg-fm-ok{background:var(--xve-selection-border, var(--office-accent, #217346));color:#fff;border-color:transparent}
|
|
16910
17146
|
.xg-popup{position:absolute;z-index:20;background:var(--xve-popover, var(--office-popover, #fff));color:var(--xve-popover-foreground, var(--office-popover-foreground, #222));
|
|
16911
17147
|
border:1px solid var(--xve-border, var(--office-border, #c8c8c8));box-shadow:0 4px 12px rgba(0,0,0,.18);font-size:13px;border-radius:4px}
|
|
16912
17148
|
.xg-list{max-height:220px;overflow:auto;min-width:120px;padding:2px 0;margin:0;list-style:none}
|
|
@@ -16983,6 +17219,466 @@ var GRID_CSS = `
|
|
|
16983
17219
|
.xg-timeline button:focus-visible,.xg-timeline select:focus-visible{outline:2px solid var(--xve-selection-border, var(--office-accent, #217346));outline-offset:-2px}
|
|
16984
17220
|
.xg-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
16985
17221
|
`;
|
|
17222
|
+
|
|
17223
|
+
// src/xlsx/grid/filter-presets.ts
|
|
17224
|
+
var op = (label, operator) => ({
|
|
17225
|
+
label,
|
|
17226
|
+
custom: { operator }
|
|
17227
|
+
});
|
|
17228
|
+
var dyn = (label, dynamic) => ({ label, dynamic });
|
|
17229
|
+
var MONTHS = [
|
|
17230
|
+
"January",
|
|
17231
|
+
"February",
|
|
17232
|
+
"March",
|
|
17233
|
+
"April",
|
|
17234
|
+
"May",
|
|
17235
|
+
"June",
|
|
17236
|
+
"July",
|
|
17237
|
+
"August",
|
|
17238
|
+
"September",
|
|
17239
|
+
"October",
|
|
17240
|
+
"November",
|
|
17241
|
+
"December"
|
|
17242
|
+
];
|
|
17243
|
+
function presetItems(kind) {
|
|
17244
|
+
if (kind === "text")
|
|
17245
|
+
return [
|
|
17246
|
+
op("Equals...", "equals"),
|
|
17247
|
+
op("Does Not Equal...", "notEquals"),
|
|
17248
|
+
{ ...op("Begins With...", "beginsWith"), separatorBefore: true },
|
|
17249
|
+
op("Ends With...", "endsWith"),
|
|
17250
|
+
{ ...op("Contains...", "contains"), separatorBefore: true },
|
|
17251
|
+
op("Does Not Contain...", "notContains"),
|
|
17252
|
+
{ label: "Custom Filter...", custom: {}, separatorBefore: true }
|
|
17253
|
+
];
|
|
17254
|
+
if (kind === "number")
|
|
17255
|
+
return [
|
|
17256
|
+
op("Equals...", "equals"),
|
|
17257
|
+
op("Does Not Equal...", "notEquals"),
|
|
17258
|
+
{ ...op("Greater Than...", "greaterThan"), separatorBefore: true },
|
|
17259
|
+
op("Greater Than Or Equal To...", "greaterThanOrEqual"),
|
|
17260
|
+
op("Less Than...", "lessThan"),
|
|
17261
|
+
op("Less Than Or Equal To...", "lessThanOrEqual"),
|
|
17262
|
+
{ label: "Between...", custom: { between: true } },
|
|
17263
|
+
{ label: "Top 10...", top10: true, separatorBefore: true },
|
|
17264
|
+
{ ...dyn("Above Average", "aboveAverage"), separatorBefore: true },
|
|
17265
|
+
dyn("Below Average", "belowAverage"),
|
|
17266
|
+
{ label: "Custom Filter...", custom: {}, separatorBefore: true }
|
|
17267
|
+
];
|
|
17268
|
+
return [
|
|
17269
|
+
op("Equals...", "equals"),
|
|
17270
|
+
{ ...op("Before...", "lessThan"), separatorBefore: true },
|
|
17271
|
+
op("After...", "greaterThan"),
|
|
17272
|
+
{ label: "Between...", custom: { between: true } },
|
|
17273
|
+
{ ...dyn("Tomorrow", "tomorrow"), separatorBefore: true },
|
|
17274
|
+
dyn("Today", "today"),
|
|
17275
|
+
dyn("Yesterday", "yesterday"),
|
|
17276
|
+
{ ...dyn("Next Week", "nextWeek"), separatorBefore: true },
|
|
17277
|
+
dyn("This Week", "thisWeek"),
|
|
17278
|
+
dyn("Last Week", "lastWeek"),
|
|
17279
|
+
{ ...dyn("Next Month", "nextMonth"), separatorBefore: true },
|
|
17280
|
+
dyn("This Month", "thisMonth"),
|
|
17281
|
+
dyn("Last Month", "lastMonth"),
|
|
17282
|
+
{ ...dyn("Next Quarter", "nextQuarter"), separatorBefore: true },
|
|
17283
|
+
dyn("This Quarter", "thisQuarter"),
|
|
17284
|
+
dyn("Last Quarter", "lastQuarter"),
|
|
17285
|
+
{ ...dyn("Next Year", "nextYear"), separatorBefore: true },
|
|
17286
|
+
dyn("This Year", "thisYear"),
|
|
17287
|
+
dyn("Last Year", "lastYear"),
|
|
17288
|
+
{ ...dyn("Year to Date", "yearToDate"), separatorBefore: true },
|
|
17289
|
+
{
|
|
17290
|
+
label: "All Dates in the Period",
|
|
17291
|
+
children: [
|
|
17292
|
+
...[1, 2, 3, 4].map((q) => dyn(`Quarter ${q}`, `Q${q}`)),
|
|
17293
|
+
...MONTHS.map((m, i) => ({
|
|
17294
|
+
...dyn(m, `M${i + 1}`),
|
|
17295
|
+
...i === 0 ? { separatorBefore: true } : {}
|
|
17296
|
+
}))
|
|
17297
|
+
]
|
|
17298
|
+
},
|
|
17299
|
+
{ label: "Custom Filter...", custom: {}, separatorBefore: true }
|
|
17300
|
+
];
|
|
17301
|
+
}
|
|
17302
|
+
var presetTitle = (kind) => kind === "text" ? "Text Filters" : kind === "number" ? "Number Filters" : "Date Filters";
|
|
17303
|
+
var sortLabels = (kind) => kind === "text" ? ["Sort A to Z", "Sort Z to A"] : kind === "number" ? ["Sort Smallest to Largest", "Sort Largest to Smallest"] : ["Sort Oldest to Newest", "Sort Newest to Oldest"];
|
|
17304
|
+
|
|
17305
|
+
// src/xlsx/grid/filter-menu.ts
|
|
17306
|
+
var MAX_LISTED = 2e3;
|
|
17307
|
+
function openFilterMenu(view, col, anchor, onClose, refocus) {
|
|
17308
|
+
const ctx = view.ctx;
|
|
17309
|
+
const workbook = view.workbook();
|
|
17310
|
+
const sheet = view.sheet();
|
|
17311
|
+
const session = ctx.session();
|
|
17312
|
+
const filter = sheet?.autoFilter;
|
|
17313
|
+
if (!workbook || !sheet || !session || !filter) return void 0;
|
|
17314
|
+
const sheetIndex = view.sheetIndex();
|
|
17315
|
+
const offset = col - filter.range.start.col;
|
|
17316
|
+
const model = filterMenuModel(workbook, sheet, filter, offset);
|
|
17317
|
+
const header = displayText(workbook, getCell(sheet, filter.range.start.row, col));
|
|
17318
|
+
const name = header || ctx.t("Column {name}", { name: String(col + 1) });
|
|
17319
|
+
const doc = view.doc;
|
|
17320
|
+
const popup = h(doc, "div", "xg-popup xg-fmenu", {
|
|
17321
|
+
role: "dialog",
|
|
17322
|
+
"aria-label": ctx.t("Filter menu")
|
|
17323
|
+
});
|
|
17324
|
+
let closed = false;
|
|
17325
|
+
const dismiss = (event) => {
|
|
17326
|
+
if (!event.composedPath().includes(popup)) close();
|
|
17327
|
+
};
|
|
17328
|
+
const onKey = (event) => {
|
|
17329
|
+
if (event.key === "Escape") {
|
|
17330
|
+
event.stopPropagation();
|
|
17331
|
+
close(true);
|
|
17332
|
+
}
|
|
17333
|
+
};
|
|
17334
|
+
const close = (focus = false) => {
|
|
17335
|
+
if (closed) return;
|
|
17336
|
+
closed = true;
|
|
17337
|
+
doc.removeEventListener("pointerdown", dismiss, true);
|
|
17338
|
+
popup.remove();
|
|
17339
|
+
onClose();
|
|
17340
|
+
if (focus) refocus();
|
|
17341
|
+
};
|
|
17342
|
+
const apply = (criteria) => {
|
|
17343
|
+
close(true);
|
|
17344
|
+
session.setFilterCriteria(sheetIndex, col, criteria);
|
|
17345
|
+
};
|
|
17346
|
+
const openDialog = (dialog, props2) => {
|
|
17347
|
+
close();
|
|
17348
|
+
void ctx.dialogs.open(dialog, { col, kind: model.kind, ...props2 });
|
|
17349
|
+
};
|
|
17350
|
+
const itemButton = (item) => {
|
|
17351
|
+
const wrap = h(doc, "div", item.separatorBefore ? "xg-fm-row xg-fm-sep" : "xg-fm-row");
|
|
17352
|
+
const button2 = h(doc, "button", "xg-fm-item", { type: "button", role: "menuitem" });
|
|
17353
|
+
button2.textContent = item.raw ? item.label : ctx.t(item.label);
|
|
17354
|
+
if (item.disabled) button2.disabled = true;
|
|
17355
|
+
if (item.children) {
|
|
17356
|
+
button2.setAttribute("aria-haspopup", "menu");
|
|
17357
|
+
button2.setAttribute("aria-expanded", "false");
|
|
17358
|
+
button2.classList.add("xg-fm-parent");
|
|
17359
|
+
const sub = item.children;
|
|
17360
|
+
sub.hidden = true;
|
|
17361
|
+
const toggle = (show) => {
|
|
17362
|
+
sub.hidden = !show;
|
|
17363
|
+
button2.setAttribute("aria-expanded", String(show));
|
|
17364
|
+
};
|
|
17365
|
+
button2.addEventListener("click", () => toggle(true));
|
|
17366
|
+
button2.addEventListener("mouseenter", () => !item.disabled && toggle(true));
|
|
17367
|
+
wrap.addEventListener("mouseleave", () => toggle(false));
|
|
17368
|
+
button2.addEventListener("keydown", (event) => {
|
|
17369
|
+
if (event.key === "ArrowRight") toggle(true);
|
|
17370
|
+
else if (event.key === "ArrowLeft") toggle(false);
|
|
17371
|
+
});
|
|
17372
|
+
wrap.append(button2, sub);
|
|
17373
|
+
} else {
|
|
17374
|
+
button2.addEventListener("click", () => item.run?.());
|
|
17375
|
+
wrap.append(button2);
|
|
17376
|
+
}
|
|
17377
|
+
return wrap;
|
|
17378
|
+
};
|
|
17379
|
+
const submenu = (items2) => {
|
|
17380
|
+
const box = h(doc, "div", "xg-popup xg-fm-sub", { role: "menu" });
|
|
17381
|
+
for (const item of items2) box.append(itemButton(item));
|
|
17382
|
+
return box;
|
|
17383
|
+
};
|
|
17384
|
+
const presetMenu = (items2) => items2.map((preset) => ({
|
|
17385
|
+
label: preset.label,
|
|
17386
|
+
...preset.separatorBefore ? { separatorBefore: true } : {},
|
|
17387
|
+
...preset.children ? { children: submenu(presetMenu(preset.children)) } : {},
|
|
17388
|
+
...preset.dynamic ? { run: () => apply({ dynamic: { type: preset.dynamic } }) } : preset.top10 ? { run: () => openDialog("top10-filter", {}) } : preset.custom ? { run: () => openDialog("custom-autofilter", preset.custom) } : {}
|
|
17389
|
+
}));
|
|
17390
|
+
const [asc, desc] = sortLabels(model.kind);
|
|
17391
|
+
const sort = (descending) => () => {
|
|
17392
|
+
close(true);
|
|
17393
|
+
session.sortByColumn(sheetIndex, col, descending);
|
|
17394
|
+
};
|
|
17395
|
+
const hasColors = model.fills.length > 0 || model.fonts.some((c) => c !== "#000000");
|
|
17396
|
+
const top = [
|
|
17397
|
+
{ label: asc, run: sort(false) },
|
|
17398
|
+
{ label: desc, run: sort(true) },
|
|
17399
|
+
{
|
|
17400
|
+
label: ctx.t('Clear Filter From "{name}"', { name }),
|
|
17401
|
+
run: () => apply(void 0),
|
|
17402
|
+
disabled: !model.hasCriteria,
|
|
17403
|
+
raw: true,
|
|
17404
|
+
separatorBefore: true
|
|
17405
|
+
},
|
|
17406
|
+
{
|
|
17407
|
+
label: "Filter by Color",
|
|
17408
|
+
disabled: !hasColors,
|
|
17409
|
+
children: submenu([])
|
|
17410
|
+
},
|
|
17411
|
+
{
|
|
17412
|
+
label: presetTitle(model.kind),
|
|
17413
|
+
children: submenu(presetMenu(presetItems(model.kind)))
|
|
17414
|
+
}
|
|
17415
|
+
];
|
|
17416
|
+
const colorHost = top[3].children;
|
|
17417
|
+
colorHost.append(...colorSections(view, model, apply));
|
|
17418
|
+
for (const item of top) {
|
|
17419
|
+
popup.append(itemButton(item));
|
|
17420
|
+
}
|
|
17421
|
+
const checklist = checklistPanel(view, model, apply, close);
|
|
17422
|
+
popup.append(checklist);
|
|
17423
|
+
popup.addEventListener("keydown", onKey);
|
|
17424
|
+
popup.addEventListener("pointerdown", (event) => event.stopPropagation());
|
|
17425
|
+
const width = 250;
|
|
17426
|
+
const left = Math.max(
|
|
17427
|
+
view.geometry.headerW,
|
|
17428
|
+
Math.min(anchor.x + anchor.w - width, view.geometry.width - width - 4)
|
|
17429
|
+
);
|
|
17430
|
+
popup.style.left = `${left}px`;
|
|
17431
|
+
popup.style.top = `${anchor.y + anchor.h + 1}px`;
|
|
17432
|
+
popup.style.width = `${width}px`;
|
|
17433
|
+
view.view.append(popup);
|
|
17434
|
+
doc.addEventListener("pointerdown", dismiss, true);
|
|
17435
|
+
checklist.querySelector("input[type=search]")?.focus();
|
|
17436
|
+
return { close: () => close() };
|
|
17437
|
+
}
|
|
17438
|
+
function colorSections(view, model, apply) {
|
|
17439
|
+
const { doc, ctx } = view;
|
|
17440
|
+
const section = (title, colors, noFill, cell) => {
|
|
17441
|
+
const box = h(doc, "div", "xg-fm-colors", { role: "group", "aria-label": ctx.t(title) });
|
|
17442
|
+
const head = h(doc, "div", "xg-fm-head");
|
|
17443
|
+
head.textContent = ctx.t(title);
|
|
17444
|
+
box.append(head);
|
|
17445
|
+
const swatches = h(doc, "div", "xg-fm-swatches");
|
|
17446
|
+
for (const color of colors) {
|
|
17447
|
+
const b = h(doc, "button", "xg-fm-swatch", {
|
|
17448
|
+
type: "button",
|
|
17449
|
+
"aria-label": color,
|
|
17450
|
+
title: color
|
|
17451
|
+
});
|
|
17452
|
+
b.style.background = color;
|
|
17453
|
+
b.addEventListener("click", () => apply(colorFilterCriteria(color, cell)));
|
|
17454
|
+
swatches.append(b);
|
|
17455
|
+
}
|
|
17456
|
+
box.append(swatches);
|
|
17457
|
+
if (noFill) {
|
|
17458
|
+
const b = h(doc, "button", "xg-fm-item", { type: "button", role: "menuitem" });
|
|
17459
|
+
b.textContent = ctx.t(cell ? "No Fill" : "Automatic");
|
|
17460
|
+
b.addEventListener("click", () => apply(colorFilterCriteria(void 0, cell)));
|
|
17461
|
+
box.append(b);
|
|
17462
|
+
}
|
|
17463
|
+
return box;
|
|
17464
|
+
};
|
|
17465
|
+
const out = [];
|
|
17466
|
+
if (model.fills.length || model.noFill)
|
|
17467
|
+
out.push(
|
|
17468
|
+
section("Filter by Cell Color", model.fills, model.noFill && model.fills.length > 0, true)
|
|
17469
|
+
);
|
|
17470
|
+
const fonts = model.fonts.filter((c) => c !== "#000000");
|
|
17471
|
+
if (fonts.length) out.push(section("Filter by Font Color", fonts, true, false));
|
|
17472
|
+
return out;
|
|
17473
|
+
}
|
|
17474
|
+
function checklistPanel(view, model, apply, close) {
|
|
17475
|
+
const { doc, ctx } = view;
|
|
17476
|
+
const panel3 = h(doc, "div", "xg-fm-values");
|
|
17477
|
+
const search = h(doc, "input", "xg-fm-search", {
|
|
17478
|
+
type: "search",
|
|
17479
|
+
placeholder: ctx.t("Search"),
|
|
17480
|
+
"aria-label": ctx.t("Search")
|
|
17481
|
+
});
|
|
17482
|
+
const list = h(doc, "ul", "xg-fm-list", { role: "group", "aria-label": ctx.t("Values") });
|
|
17483
|
+
const checked = new Set(model.values.filter((v) => v.checked).map((v) => v.text));
|
|
17484
|
+
let blanks = model.blanks?.checked ?? false;
|
|
17485
|
+
let query = "";
|
|
17486
|
+
const selectAll = h(doc, "input", "", { type: "checkbox", "aria-label": ctx.t("(Select All)") });
|
|
17487
|
+
const visible = () => model.values.filter((v) => !query || v.text.toLowerCase().includes(query)).slice(0, MAX_LISTED);
|
|
17488
|
+
const showBlanks = () => !!model.blanks && (!query || "(blanks)".includes(query));
|
|
17489
|
+
const entry = (label, on, toggle) => {
|
|
17490
|
+
const li = h(doc, "li");
|
|
17491
|
+
const row2 = h(doc, "label", "xg-fm-check");
|
|
17492
|
+
const box = h(doc, "input", "", { type: "checkbox" });
|
|
17493
|
+
box.checked = on;
|
|
17494
|
+
box.addEventListener("change", () => {
|
|
17495
|
+
toggle(box.checked);
|
|
17496
|
+
sync();
|
|
17497
|
+
});
|
|
17498
|
+
const text3 = h(doc, "span");
|
|
17499
|
+
text3.textContent = label;
|
|
17500
|
+
row2.append(box, text3);
|
|
17501
|
+
li.append(row2);
|
|
17502
|
+
return li;
|
|
17503
|
+
};
|
|
17504
|
+
const sync = () => {
|
|
17505
|
+
const shown3 = visible();
|
|
17506
|
+
const total = shown3.length + (showBlanks() ? 1 : 0);
|
|
17507
|
+
const on = shown3.filter((v) => checked.has(v.text)).length + (showBlanks() && blanks ? 1 : 0);
|
|
17508
|
+
selectAll.checked = total > 0 && on === total;
|
|
17509
|
+
selectAll.indeterminate = on > 0 && on < total;
|
|
17510
|
+
};
|
|
17511
|
+
const render2 = () => {
|
|
17512
|
+
list.replaceChildren();
|
|
17513
|
+
for (const v of visible())
|
|
17514
|
+
list.append(
|
|
17515
|
+
entry(
|
|
17516
|
+
v.text,
|
|
17517
|
+
checked.has(v.text),
|
|
17518
|
+
(on) => on ? checked.add(v.text) : checked.delete(v.text)
|
|
17519
|
+
)
|
|
17520
|
+
);
|
|
17521
|
+
if (showBlanks()) list.append(entry(ctx.t("(Blanks)"), blanks, (on) => blanks = on));
|
|
17522
|
+
if (!list.childElementCount) {
|
|
17523
|
+
const empty = h(doc, "li", "xg-fm-empty");
|
|
17524
|
+
empty.textContent = ctx.t("(No values)");
|
|
17525
|
+
list.append(empty);
|
|
17526
|
+
}
|
|
17527
|
+
sync();
|
|
17528
|
+
};
|
|
17529
|
+
selectAll.addEventListener("change", () => {
|
|
17530
|
+
for (const v of visible()) {
|
|
17531
|
+
if (selectAll.checked) checked.add(v.text);
|
|
17532
|
+
else checked.delete(v.text);
|
|
17533
|
+
}
|
|
17534
|
+
if (showBlanks()) blanks = selectAll.checked;
|
|
17535
|
+
render2();
|
|
17536
|
+
});
|
|
17537
|
+
search.addEventListener("input", () => {
|
|
17538
|
+
query = search.value.trim().toLowerCase();
|
|
17539
|
+
checked.clear();
|
|
17540
|
+
for (const v of visible()) checked.add(v.text);
|
|
17541
|
+
blanks = showBlanks();
|
|
17542
|
+
render2();
|
|
17543
|
+
});
|
|
17544
|
+
const all = h(doc, "label", "xg-fm-check xg-fm-all");
|
|
17545
|
+
const allText = h(doc, "span");
|
|
17546
|
+
allText.textContent = ctx.t("(Select All)");
|
|
17547
|
+
all.append(selectAll, allText);
|
|
17548
|
+
const buttons = h(doc, "div", "xg-fm-buttons");
|
|
17549
|
+
const ok = h(doc, "button", "xg-fm-ok", { type: "button" });
|
|
17550
|
+
ok.textContent = ctx.t("OK");
|
|
17551
|
+
const cancel = h(doc, "button", "", { type: "button" });
|
|
17552
|
+
cancel.textContent = ctx.t("Cancel");
|
|
17553
|
+
ok.addEventListener("click", () => {
|
|
17554
|
+
apply(
|
|
17555
|
+
query ? { values: [...checked], ...blanks && showBlanks() ? { blank: true } : {} } : checklistCriteria(model, checked, blanks)
|
|
17556
|
+
);
|
|
17557
|
+
});
|
|
17558
|
+
cancel.addEventListener("click", () => close(true));
|
|
17559
|
+
search.addEventListener("keydown", (event) => {
|
|
17560
|
+
if (event.key === "Enter") ok.click();
|
|
17561
|
+
});
|
|
17562
|
+
buttons.append(ok, cancel);
|
|
17563
|
+
panel3.append(search, all, list, buttons);
|
|
17564
|
+
render2();
|
|
17565
|
+
return panel3;
|
|
17566
|
+
}
|
|
17567
|
+
|
|
17568
|
+
// src/xlsx/grid/filter-buttons.ts
|
|
17569
|
+
var FilterButtons = class {
|
|
17570
|
+
#view;
|
|
17571
|
+
#refocus;
|
|
17572
|
+
#buttons = /* @__PURE__ */ new Map();
|
|
17573
|
+
#menu;
|
|
17574
|
+
#openCol = -1;
|
|
17575
|
+
constructor(view, refocus) {
|
|
17576
|
+
this.#view = view;
|
|
17577
|
+
this.#refocus = refocus;
|
|
17578
|
+
view.hooks.add(() => this.position());
|
|
17579
|
+
}
|
|
17580
|
+
get isOpen() {
|
|
17581
|
+
return !!this.#menu;
|
|
17582
|
+
}
|
|
17583
|
+
#button(col) {
|
|
17584
|
+
let button2 = this.#buttons.get(col);
|
|
17585
|
+
if (button2) return button2;
|
|
17586
|
+
const view = this.#view;
|
|
17587
|
+
button2 = h(view.doc, "button", "xg-fb", { type: "button", "aria-haspopup": "dialog" });
|
|
17588
|
+
button2.addEventListener("pointerdown", (event) => {
|
|
17589
|
+
event.preventDefault();
|
|
17590
|
+
event.stopPropagation();
|
|
17591
|
+
if (this.#openCol === col) this.close();
|
|
17592
|
+
else this.open(col);
|
|
17593
|
+
});
|
|
17594
|
+
button2.addEventListener("keydown", (event) => {
|
|
17595
|
+
if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
|
|
17596
|
+
event.preventDefault();
|
|
17597
|
+
event.stopPropagation();
|
|
17598
|
+
this.open(col);
|
|
17599
|
+
}
|
|
17600
|
+
});
|
|
17601
|
+
view.view.append(button2);
|
|
17602
|
+
this.#buttons.set(col, button2);
|
|
17603
|
+
return button2;
|
|
17604
|
+
}
|
|
17605
|
+
/** Positions the buttons for the columns on screen and removes the rest. */
|
|
17606
|
+
position() {
|
|
17607
|
+
const view = this.#view;
|
|
17608
|
+
const sheet = view.sheet();
|
|
17609
|
+
const filter = sheet?.autoFilter;
|
|
17610
|
+
const g = view.geometry;
|
|
17611
|
+
if (!filter || view.ctx.readOnly()) {
|
|
17612
|
+
this.#clear();
|
|
17613
|
+
return;
|
|
17614
|
+
}
|
|
17615
|
+
const row2 = filter.range.start.row;
|
|
17616
|
+
const used = /* @__PURE__ */ new Set();
|
|
17617
|
+
const rowHidden = view.metrics.rowHeight(row2) === 0;
|
|
17618
|
+
for (let col = filter.range.start.col; col <= filter.range.end.col; col++) {
|
|
17619
|
+
const column = filter.columns?.find((c) => c.offset === col - filter.range.start.col);
|
|
17620
|
+
if (rowHidden || column?.hiddenButton || view.metrics.colWidth(col) === 0) continue;
|
|
17621
|
+
const box = g.rangeBox({ start: { row: row2, col }, end: { row: row2, col } });
|
|
17622
|
+
const frozenCol = col < g.fCols;
|
|
17623
|
+
const frozenRow = row2 < g.fRows;
|
|
17624
|
+
const minX = g.headerW + (frozenCol ? 0 : g.frozenW);
|
|
17625
|
+
const minY = g.headerH + (frozenRow ? 0 : g.frozenH);
|
|
17626
|
+
if (box.x < minX || box.y < minY || box.x + box.w > g.width || box.y + box.h > g.height)
|
|
17627
|
+
continue;
|
|
17628
|
+
const size = Math.min(Math.max(13, Math.round(17 * (view.metrics.zoom / 100))), box.h, box.w);
|
|
17629
|
+
const button2 = this.#button(col);
|
|
17630
|
+
used.add(col);
|
|
17631
|
+
place(button2, box.x + box.w - size - 1, box.y + box.h - size - 1, size, size);
|
|
17632
|
+
const active2 = hasFilterCriteria(column);
|
|
17633
|
+
toggleClass(button2, "xg-fb-active", active2);
|
|
17634
|
+
button2.setAttribute(
|
|
17635
|
+
"aria-label",
|
|
17636
|
+
view.ctx.t(active2 ? "Filter drop-down (filtered)" : "Filter drop-down")
|
|
17637
|
+
);
|
|
17638
|
+
}
|
|
17639
|
+
for (const [col, button2] of this.#buttons)
|
|
17640
|
+
if (!used.has(col)) {
|
|
17641
|
+
if (col === this.#openCol) this.close();
|
|
17642
|
+
button2.remove();
|
|
17643
|
+
this.#buttons.delete(col);
|
|
17644
|
+
}
|
|
17645
|
+
}
|
|
17646
|
+
open(col) {
|
|
17647
|
+
const view = this.#view;
|
|
17648
|
+
this.close();
|
|
17649
|
+
const filter = view.sheet()?.autoFilter;
|
|
17650
|
+
if (!filter) return;
|
|
17651
|
+
const box = view.geometry.rangeBox({
|
|
17652
|
+
start: { row: filter.range.start.row, col },
|
|
17653
|
+
end: { row: filter.range.start.row, col }
|
|
17654
|
+
});
|
|
17655
|
+
this.#openCol = col;
|
|
17656
|
+
this.#menu = openFilterMenu(
|
|
17657
|
+
view,
|
|
17658
|
+
col,
|
|
17659
|
+
box,
|
|
17660
|
+
() => {
|
|
17661
|
+
this.#menu = void 0;
|
|
17662
|
+
this.#openCol = -1;
|
|
17663
|
+
},
|
|
17664
|
+
this.#refocus
|
|
17665
|
+
);
|
|
17666
|
+
if (!this.#menu) this.#openCol = -1;
|
|
17667
|
+
}
|
|
17668
|
+
close() {
|
|
17669
|
+
this.#menu?.close();
|
|
17670
|
+
this.#menu = void 0;
|
|
17671
|
+
this.#openCol = -1;
|
|
17672
|
+
}
|
|
17673
|
+
#clear() {
|
|
17674
|
+
this.close();
|
|
17675
|
+
for (const button2 of this.#buttons.values()) button2.remove();
|
|
17676
|
+
this.#buttons.clear();
|
|
17677
|
+
}
|
|
17678
|
+
destroy() {
|
|
17679
|
+
this.#clear();
|
|
17680
|
+
}
|
|
17681
|
+
};
|
|
16986
17682
|
var textOf = (value) => value === null ? "" : typeof value === "boolean" ? value ? "TRUE" : "FALSE" : isCellError(value) ? value.error : String(value);
|
|
16987
17683
|
function columnPickList(view, row2, col, limit = 500) {
|
|
16988
17684
|
const sheet = view.sheet();
|
|
@@ -17224,7 +17920,7 @@ function installPageBreakPreview(view) {
|
|
|
17224
17920
|
return result;
|
|
17225
17921
|
};
|
|
17226
17922
|
const offModel = view.ctx.onModelChange(() => cache = void 0);
|
|
17227
|
-
const
|
|
17923
|
+
const target42 = (grab, clientX, clientY) => {
|
|
17228
17924
|
const g = view.geometry;
|
|
17229
17925
|
const { x, y } = view.clientToView(clientX, clientY);
|
|
17230
17926
|
const horizontal = grab.kind === "line" ? grab.line.axis === "col" : grab.edge === "left" || grab.edge === "right";
|
|
@@ -17273,7 +17969,7 @@ function installPageBreakPreview(view) {
|
|
|
17273
17969
|
layer.append(ghost);
|
|
17274
17970
|
let boundary = -1;
|
|
17275
17971
|
const move = (e) => {
|
|
17276
|
-
boundary =
|
|
17972
|
+
boundary = target42(grab, e.clientX, e.clientY);
|
|
17277
17973
|
const g = view.geometry;
|
|
17278
17974
|
if (axis === "row") place(ghost, g.headerW, g.rowY(boundary) - 1, g.cellsW, 3);
|
|
17279
17975
|
else place(ghost, g.colX(boundary) - 1, g.headerH, 3, g.cellsH);
|
|
@@ -17390,6 +18086,7 @@ function mountGrid(ctx, container) {
|
|
|
17390
18086
|
const sink = editor.field.input;
|
|
17391
18087
|
const drawings = new DrawingLayer(view);
|
|
17392
18088
|
const list = new ValidationList(view, () => editor.focus());
|
|
18089
|
+
const filters = new FilterButtons(view, () => editor.focus());
|
|
17393
18090
|
const a11y = new GridA11y(view, sink);
|
|
17394
18091
|
const removeRemote = installRemoteSelections(view);
|
|
17395
18092
|
const removePageBreaks = installPageBreakPreview(view);
|
|
@@ -17412,12 +18109,20 @@ function mountGrid(ctx, container) {
|
|
|
17412
18109
|
});
|
|
17413
18110
|
}
|
|
17414
18111
|
});
|
|
18112
|
+
const openFilterAtActive = () => {
|
|
18113
|
+
const filter = view.sheet()?.autoFilter;
|
|
18114
|
+
const { row: row2, col } = ctx.selection.get().active;
|
|
18115
|
+
if (!filter || row2 !== filter.range.start.row || col < filter.range.start.col || col > filter.range.end.col)
|
|
18116
|
+
return false;
|
|
18117
|
+
filters.open(col);
|
|
18118
|
+
return true;
|
|
18119
|
+
};
|
|
17415
18120
|
const keyHost = {
|
|
17416
18121
|
view,
|
|
17417
18122
|
selection,
|
|
17418
18123
|
editor,
|
|
17419
18124
|
openCellMenu: () => openMenuAtActive(view, () => editor.focus()),
|
|
17420
|
-
openValidationList: () => list.open(true),
|
|
18125
|
+
openValidationList: () => openFilterAtActive() || list.open(true),
|
|
17421
18126
|
clearMarquee: () => clipboard.clearMarquee(),
|
|
17422
18127
|
prepareCopy: (cut) => clipboard.prepareNativeCopy(cut)
|
|
17423
18128
|
};
|
|
@@ -17433,9 +18138,9 @@ function mountGrid(ctx, container) {
|
|
|
17433
18138
|
selection,
|
|
17434
18139
|
editor,
|
|
17435
18140
|
followLink: (row2, col) => followLink(view, selection, row2, col),
|
|
17436
|
-
fill(source,
|
|
17437
|
-
ctx.session()?.fill(view.sheetIndex(), source,
|
|
17438
|
-
selection.set({ ...selection.get(), ranges: [
|
|
18141
|
+
fill(source, target42) {
|
|
18142
|
+
ctx.session()?.fill(view.sheetIndex(), source, target42);
|
|
18143
|
+
selection.set({ ...selection.get(), ranges: [target42] });
|
|
17439
18144
|
}
|
|
17440
18145
|
}),
|
|
17441
18146
|
wireTooltips(view),
|
|
@@ -17457,7 +18162,7 @@ function mountGrid(ctx, container) {
|
|
|
17457
18162
|
cancelEdit: () => editor.cancel(),
|
|
17458
18163
|
isEditing: () => editor.editing,
|
|
17459
18164
|
selectAll: () => selection.all(),
|
|
17460
|
-
openValidationList: () => list.open(true)
|
|
18165
|
+
openValidationList: () => openFilterAtActive() || list.open(true)
|
|
17461
18166
|
})
|
|
17462
18167
|
);
|
|
17463
18168
|
let shownSheet = view.sheet();
|
|
@@ -17533,6 +18238,7 @@ function mountGrid(ctx, container) {
|
|
|
17533
18238
|
for (const dispose of disposers) dispose();
|
|
17534
18239
|
clipboard.destroy();
|
|
17535
18240
|
list.close();
|
|
18241
|
+
filters.destroy();
|
|
17536
18242
|
drawings.destroy();
|
|
17537
18243
|
editor.destroy();
|
|
17538
18244
|
a11y.destroy();
|
|
@@ -18325,13 +19031,13 @@ function mountSheetTabs(ctx, container) {
|
|
|
18325
19031
|
const visible = visibleSheetIndices(workbook);
|
|
18326
19032
|
const at = visible.indexOf(sheet);
|
|
18327
19033
|
const focusAt = (i) => {
|
|
18328
|
-
const
|
|
18329
|
-
if (
|
|
18330
|
-
focusable =
|
|
19034
|
+
const target43 = visible[Math.max(0, Math.min(visible.length - 1, i))];
|
|
19035
|
+
if (target43 === void 0) return;
|
|
19036
|
+
focusable = target43;
|
|
18331
19037
|
for (const tab of strip.querySelectorAll(".xst-tab"))
|
|
18332
|
-
tab.tabIndex = tab.dataset.sheet === String(
|
|
18333
|
-
scrollIntoView(
|
|
18334
|
-
tabFor(strip,
|
|
19038
|
+
tab.tabIndex = tab.dataset.sheet === String(target43) ? 0 : -1;
|
|
19039
|
+
scrollIntoView(target43);
|
|
19040
|
+
tabFor(strip, target43)?.focus();
|
|
18335
19041
|
};
|
|
18336
19042
|
const moves = {
|
|
18337
19043
|
ArrowLeft: at - 1,
|
|
@@ -18339,12 +19045,12 @@ function mountSheetTabs(ctx, container) {
|
|
|
18339
19045
|
Home: 0,
|
|
18340
19046
|
End: visible.length - 1
|
|
18341
19047
|
};
|
|
18342
|
-
const
|
|
19048
|
+
const target42 = moves[event.key];
|
|
18343
19049
|
const menuKey = event.key === "ContextMenu" || event.key === "F10" && event.shiftKey;
|
|
18344
|
-
if (
|
|
19050
|
+
if (target42 === void 0 && !menuKey && !["Enter", " ", "F2"].includes(event.key)) return;
|
|
18345
19051
|
event.preventDefault();
|
|
18346
19052
|
event.stopPropagation();
|
|
18347
|
-
if (
|
|
19053
|
+
if (target42 !== void 0) focusAt(target42);
|
|
18348
19054
|
else if (event.key === "F2") rename(sheet);
|
|
18349
19055
|
else if (menuKey) {
|
|
18350
19056
|
const box = event.target.getBoundingClientRect();
|
|
@@ -18953,8 +19659,8 @@ function createPageLayoutView(ctx, host, fileName) {
|
|
|
18953
19659
|
};
|
|
18954
19660
|
root.addEventListener("pointerdown", (event) => {
|
|
18955
19661
|
if (event.button !== 0 || !layout || !metrics || editor.editing) return;
|
|
18956
|
-
const
|
|
18957
|
-
if (
|
|
19662
|
+
const target42 = event.target;
|
|
19663
|
+
if (target42.closest(".xpl-ruler-h,.xpl-ruler-v,.xpl-corner") || bandEditing) return;
|
|
18958
19664
|
const { x, y } = toCanvas(event.clientX, event.clientY);
|
|
18959
19665
|
const hit = pageViewHit(layout, metrics, x, y);
|
|
18960
19666
|
if (!hit) return;
|
|
@@ -19165,7 +19871,7 @@ function collectKeyTips(panel3) {
|
|
|
19165
19871
|
};
|
|
19166
19872
|
targets.push({ key: COMMAND_KEYS[labelOf(control)] ?? "", element: control, activate });
|
|
19167
19873
|
}
|
|
19168
|
-
assignKeyTips(targets, (
|
|
19874
|
+
assignKeyTips(targets, (target42) => target42.element.getAttribute("aria-label") ?? "");
|
|
19169
19875
|
return targets;
|
|
19170
19876
|
}
|
|
19171
19877
|
var runTips = (root, targets, onDone) => (
|
|
@@ -19183,7 +19889,7 @@ function showTabKeyTips(root, select2) {
|
|
|
19183
19889
|
const id = panel3.dataset.tab ?? "";
|
|
19184
19890
|
const tab = tabButton(root, id);
|
|
19185
19891
|
if (!tab || isTabHidden(panel3)) continue;
|
|
19186
|
-
const used = targets.map((
|
|
19892
|
+
const used = targets.map((target42) => target42.key);
|
|
19187
19893
|
let key = TAB_KEYS[id] ?? "";
|
|
19188
19894
|
if (!key || used.includes(key))
|
|
19189
19895
|
key = [...(tab.textContent ?? id).toUpperCase().replace(/[^A-Z]/g, "")].find(
|
|
@@ -20059,9 +20765,9 @@ function buildShell(core) {
|
|
|
20059
20765
|
if (action === "help") return help.open();
|
|
20060
20766
|
if (action === "keytips") return ribbon.showKeyTips();
|
|
20061
20767
|
if (action === "context-menu") {
|
|
20062
|
-
const
|
|
20063
|
-
const box =
|
|
20064
|
-
|
|
20768
|
+
const target42 = root.activeElement ?? gridHost;
|
|
20769
|
+
const box = target42.getBoundingClientRect();
|
|
20770
|
+
target42.dispatchEvent(
|
|
20065
20771
|
new MouseEvent("contextmenu", {
|
|
20066
20772
|
bubbles: true,
|
|
20067
20773
|
composed: true,
|