ooxml-core 1.30.1 → 1.31.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/automation/index.cjs +5829 -3266
- package/dist/automation/index.mjs +5829 -3266
- package/dist/automation/node.cjs +2 -1
- package/dist/automation/node.d.ts.map +1 -1
- package/dist/automation/node.mjs +2 -1
- package/dist/automation/tools/define.d.ts +2 -0
- package/dist/automation/tools/define.d.ts.map +1 -1
- package/dist/automation/tools/types.d.ts +6 -0
- package/dist/automation/tools/types.d.ts.map +1 -1
- package/dist/collab/index.cjs +35 -4
- package/dist/collab/index.mjs +35 -4
- package/dist/collab/websocket-transport.d.ts +9 -1
- package/dist/collab/websocket-transport.d.ts.map +1 -1
- package/dist/docx/data-binding.d.ts +9 -0
- package/dist/docx/data-binding.d.ts.map +1 -0
- package/dist/docx/document-parts.d.ts +1 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1383 -609
- package/dist/docx/embedded.mjs +1383 -609
- package/dist/docx/index.cjs +1394 -618
- package/dist/docx/index.mjs +1394 -618
- package/dist/docx/inline-model.d.ts +2 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/equation-object.d.ts +1 -1
- package/dist/docx/layout/equation-object.d.ts.map +1 -1
- package/dist/docx/layout/floats.d.ts +1 -1
- package/dist/docx/layout/floats.d.ts.map +1 -1
- package/dist/docx/layout/flow-paragraph.d.ts +4 -0
- package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +452 -203
- package/dist/docx/layout/index.mjs +452 -203
- package/dist/docx/layout/input.d.ts +12 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/nested-frame-profile.d.ts +3 -1
- package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -1
- package/dist/docx/layout/page-cursor.d.ts +11 -2
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts +5 -0
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +4 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts +2 -0
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-layout.d.ts +4 -14
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-merged-rows.d.ts +21 -0
- package/dist/docx/layout/table-merged-rows.d.ts.map +1 -0
- package/dist/docx/layout/table-row-split.d.ts +16 -0
- package/dist/docx/layout/table-row-split.d.ts.map +1 -0
- package/dist/docx/layout/wrap.d.ts +2 -0
- package/dist/docx/layout/wrap.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +1397 -623
- package/dist/docx/load/index.mjs +1397 -623
- package/dist/docx/model-paragraph.d.ts +4 -1
- package/dist/docx/model-paragraph.d.ts.map +1 -1
- package/dist/docx/model.d.ts +24 -1
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/paragraph-properties.d.ts.map +1 -1
- package/dist/docx/paragraph-styles.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/run-segmentation.d.ts.map +1 -1
- package/dist/docx/save-modified.d.ts +4 -0
- package/dist/docx/save-modified.d.ts.map +1 -0
- package/dist/docx/save.d.ts +2 -2
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/style-formatting-package.d.ts +9 -0
- package/dist/docx/style-formatting-package.d.ts.map +1 -0
- package/dist/docx/style-numbering-package.d.ts +4 -1
- package/dist/docx/style-numbering-package.d.ts.map +1 -1
- package/dist/docx/table-grid.d.ts +35 -0
- package/dist/docx/table-grid.d.ts.map +1 -0
- package/dist/docx/table-structure-cells.d.ts +19 -0
- package/dist/docx/table-structure-cells.d.ts.map +1 -0
- package/dist/docx/table-structure-check.d.ts +12 -0
- package/dist/docx/table-structure-check.d.ts.map +1 -0
- package/dist/docx/table-structure-merge.d.ts +28 -0
- package/dist/docx/table-structure-merge.d.ts.map +1 -0
- package/dist/docx/table-structure.d.ts +30 -0
- package/dist/docx/table-structure.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +717 -256
- package/dist/docx/ui/index.d.ts +4 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +703 -257
- package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
- package/dist/docx/ui/table-structure-guard.d.ts +2 -0
- package/dist/docx/ui/table-structure-guard.d.ts.map +1 -1
- package/dist/docx/word-content-control-docs.d.ts +5 -0
- package/dist/docx/word-content-control-docs.d.ts.map +1 -0
- package/dist/docx/word-corpus-gaps.d.ts +10 -0
- package/dist/docx/word-corpus-gaps.d.ts.map +1 -0
- package/dist/docx/word-measurer.d.ts +6 -0
- package/dist/docx/word-measurer.d.ts.map +1 -0
- package/dist/docx/word-spacing-docs.d.ts +12 -0
- package/dist/docx/word-spacing-docs.d.ts.map +1 -0
- package/dist/docx/word-table-docs.d.ts +9 -0
- package/dist/docx/word-table-docs.d.ts.map +1 -0
- package/dist/docx/write-drawing.d.ts.map +1 -1
- package/dist/docx/write-fallback.d.ts +5 -0
- package/dist/docx/write-fallback.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts +1 -0
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table-structure.d.ts +14 -0
- package/dist/docx/write-table-structure.d.ts.map +1 -0
- package/dist/docx/write-table.d.ts +3 -4
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/index.cjs +22 -22
- package/dist/index.mjs +22 -22
- package/dist/math/index.cjs +22 -22
- package/dist/math/index.mjs +22 -22
- package/dist/math/omml-box-grouped.d.ts.map +1 -1
- package/dist/math/omml-box-layout.d.ts +3 -1
- package/dist/math/omml-box-layout.d.ts.map +1 -1
- package/dist/math/omml-box-structures.d.ts.map +1 -1
- package/dist/math/omml-box.d.ts +2 -0
- package/dist/math/omml-box.d.ts.map +1 -1
- package/dist/math/omml-svg.d.ts +6 -2
- package/dist/math/omml-svg.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +1 -0
- package/dist/pptx/automation/index.d.ts +6 -0
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +1 -0
- package/dist/teams/chat-rooms.d.ts.map +1 -1
- package/dist/teams/chat.d.ts +7 -0
- package/dist/teams/chat.d.ts.map +1 -1
- package/dist/teams/files.d.ts +1 -1
- package/dist/teams/files.d.ts.map +1 -1
- package/dist/teams/index.cjs +2735 -1148
- package/dist/teams/index.d.ts +3 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +2710 -1148
- package/dist/teams/message-transfer.d.ts +1 -1
- package/dist/teams/message-transfer.d.ts.map +1 -1
- package/dist/teams/protocol.d.ts +30 -0
- package/dist/teams/protocol.d.ts.map +1 -0
- package/dist/teams/schema.d.ts +59 -0
- package/dist/teams/schema.d.ts.map +1 -0
- package/dist/teams/server-config.d.ts +19 -2
- package/dist/teams/server-config.d.ts.map +1 -1
- package/dist/teams/server-file-storage.d.ts +11 -1
- package/dist/teams/server-file-storage.d.ts.map +1 -1
- package/dist/teams/server-session.d.ts +2 -0
- package/dist/teams/server-session.d.ts.map +1 -1
- package/dist/teams/signaling.d.ts +2 -0
- package/dist/teams/signaling.d.ts.map +1 -1
- package/dist/teams/store.d.ts +9 -0
- package/dist/teams/store.d.ts.map +1 -1
- package/dist/teams/stored-file.d.ts +1 -1
- package/dist/teams/stored-file.d.ts.map +1 -1
- package/dist/teams/sync-transport.d.ts.map +1 -1
- package/dist/teams/validate-members.d.ts +28 -0
- package/dist/teams/validate-members.d.ts.map +1 -0
- package/dist/teams/validate-owned.d.ts +20 -0
- package/dist/teams/validate-owned.d.ts.map +1 -0
- package/dist/teams/validate-update.d.ts +70 -0
- package/dist/teams/validate-update.d.ts.map +1 -0
- package/dist/teams/workspace.d.ts +12 -0
- package/dist/teams/workspace.d.ts.map +1 -1
- package/dist/visio/connector-route-walk.d.ts +2 -0
- package/dist/visio/connector-route-walk.d.ts.map +1 -1
- package/dist/visio/edit-connector-reroute.d.ts.map +1 -1
- package/dist/visio/edit-connector.d.ts +2 -0
- package/dist/visio/edit-connector.d.ts.map +1 -1
- package/dist/visio/edit-delete.d.ts.map +1 -1
- package/dist/visio/edit-duplicate-line.d.ts +40 -0
- package/dist/visio/edit-duplicate-line.d.ts.map +1 -0
- package/dist/visio/edit-duplicate.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts +5 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-instance-duplicate.d.ts +2 -1
- package/dist/visio/edit-instance-duplicate.d.ts.map +1 -1
- package/dist/visio/edit-master-move.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts +23 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-text.d.ts +12 -0
- package/dist/visio/edit-recalculate-text.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
- package/dist/visio/edit-recalculate.d.ts +15 -3
- package/dist/visio/edit-recalculate.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector-layout.d.ts +1 -1
- package/dist/visio/edit-stencil-connector-layout.d.ts.map +1 -1
- package/dist/visio/edit-text-scope.d.ts +4 -1
- package/dist/visio/edit-text-scope.d.ts.map +1 -1
- package/dist/visio/formula-analyze.d.ts +18 -0
- package/dist/visio/formula-analyze.d.ts.map +1 -0
- package/dist/visio/formula-bound.d.ts +4 -0
- package/dist/visio/formula-bound.d.ts.map +1 -0
- package/dist/visio/formula-evaluate.d.ts +2 -9
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/formula-extra-functions.d.ts +23 -0
- package/dist/visio/formula-extra-functions.d.ts.map +1 -0
- package/dist/visio/formula-indirect.d.ts +6 -0
- package/dist/visio/formula-indirect.d.ts.map +1 -0
- package/dist/visio/formula-master.d.ts +1 -0
- package/dist/visio/formula-master.d.ts.map +1 -1
- package/dist/visio/formula-operators.d.ts +6 -0
- package/dist/visio/formula-operators.d.ts.map +1 -0
- package/dist/visio/formula-text-functions.d.ts +5 -1
- package/dist/visio/formula-text-functions.d.ts.map +1 -1
- package/dist/visio/formula.d.ts +12 -0
- package/dist/visio/formula.d.ts.map +1 -1
- package/dist/visio/index.cjs +1354 -396
- package/dist/visio/index.mjs +1354 -396
- package/dist/visio/ui/index.cjs +1341 -383
- package/dist/visio/ui/index.mjs +1341 -383
- package/dist/xlsx/collab/apply.d.ts.map +1 -1
- package/dist/xlsx/collab/codec.d.ts +2 -0
- package/dist/xlsx/collab/codec.d.ts.map +1 -1
- package/dist/xlsx/collab/dirty.d.ts +4 -1
- package/dist/xlsx/collab/dirty.d.ts.map +1 -1
- package/dist/xlsx/collab/index.cjs +551 -106
- package/dist/xlsx/collab/index.mjs +551 -106
- package/dist/xlsx/collab/keyed.d.ts +36 -0
- package/dist/xlsx/collab/keyed.d.ts.map +1 -0
- package/dist/xlsx/collab/names.d.ts +2 -0
- package/dist/xlsx/collab/names.d.ts.map +1 -1
- package/dist/xlsx/collab/part-specs.d.ts +13 -0
- package/dist/xlsx/collab/part-specs.d.ts.map +1 -0
- package/dist/xlsx/collab/schema.d.ts +8 -0
- package/dist/xlsx/collab/schema.d.ts.map +1 -1
- package/dist/xlsx/collab/sheet-parts.d.ts +19 -0
- package/dist/xlsx/collab/sheet-parts.d.ts.map +1 -0
- package/dist/xlsx/collab/sheets.d.ts +6 -0
- package/dist/xlsx/collab/sheets.d.ts.map +1 -1
- package/dist/xlsx/collab/write.d.ts +3 -0
- package/dist/xlsx/collab/write.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-areas.d.ts +17 -0
- package/dist/xlsx/edit/clipboard-areas.d.ts.map +1 -0
- package/dist/xlsx/edit/custom-views.d.ts +21 -0
- package/dist/xlsx/edit/custom-views.d.ts.map +1 -0
- package/dist/xlsx/edit/data-table.d.ts.map +1 -1
- package/dist/xlsx/edit/history.d.ts +1 -1
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +2 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/paste-selection.d.ts.map +1 -1
- package/dist/xlsx/edit/scenario-merge.d.ts +7 -0
- package/dist/xlsx/edit/scenario-merge.d.ts.map +1 -0
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-data-tables.d.ts +7 -0
- package/dist/xlsx/edit/shift-data-tables.d.ts.map +1 -0
- package/dist/xlsx/edit/shift-scenarios.d.ts +7 -0
- package/dist/xlsx/edit/shift-scenarios.d.ts.map +1 -0
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/sparkline-grouping.d.ts +10 -0
- package/dist/xlsx/edit/sparkline-grouping.d.ts.map +1 -0
- package/dist/xlsx/edit/types.d.ts +21 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/ets-excel-compare.d.ts +24 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-core.d.ts +36 -0
- package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-grid.d.ts +15 -0
- package/dist/xlsx/formula/functions/ets-grid.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts +15 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-input.d.ts +13 -0
- package/dist/xlsx/formula/functions/ets-input.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-season.d.ts +6 -0
- package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/forecast-ets.d.ts +3 -0
- package/dist/xlsx/formula/functions/forecast-ets.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +4444 -2447
- package/dist/xlsx/index.mjs +4423 -2448
- package/dist/xlsx/layout/form-control-link.d.ts +20 -0
- package/dist/xlsx/layout/form-control-link.d.ts.map +1 -0
- package/dist/xlsx/layout/form-control-state.d.ts +49 -0
- package/dist/xlsx/layout/form-control-state.d.ts.map +1 -0
- package/dist/xlsx/layout/form-control-view.d.ts +11 -0
- package/dist/xlsx/layout/form-control-view.d.ts.map +1 -0
- package/dist/xlsx/layout/header-footer-edit.d.ts +4 -2
- package/dist/xlsx/layout/header-footer-edit.d.ts.map +1 -1
- package/dist/xlsx/layout/header-footer.d.ts +16 -0
- package/dist/xlsx/layout/header-footer.d.ts.map +1 -1
- package/dist/xlsx/layout/index.d.ts +5 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/ref-evaluator.d.ts +6 -0
- package/dist/xlsx/layout/ref-evaluator.d.ts.map +1 -1
- package/dist/xlsx/layout/shape-paint.d.ts +25 -0
- package/dist/xlsx/layout/shape-paint.d.ts.map +1 -0
- package/dist/xlsx/layout/shape-view.d.ts +15 -0
- package/dist/xlsx/layout/shape-view.d.ts.map +1 -0
- package/dist/xlsx/load/index.cjs +2134 -1103
- package/dist/xlsx/load/index.mjs +2134 -1103
- package/dist/xlsx/model-custom-views.d.ts +33 -0
- package/dist/xlsx/model-custom-views.d.ts.map +1 -0
- package/dist/xlsx/model-shapes.d.ts +78 -0
- package/dist/xlsx/model-shapes.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +38 -1
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/custom-views.d.ts +5 -0
- package/dist/xlsx/read/custom-views.d.ts.map +1 -0
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/form-control.d.ts +14 -0
- package/dist/xlsx/read/form-control.d.ts.map +1 -0
- package/dist/xlsx/read/header-footer-images.d.ts +5 -0
- package/dist/xlsx/read/header-footer-images.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/shape.d.ts +5 -0
- package/dist/xlsx/read/shape.d.ts.map +1 -0
- package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +5 -1
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet-children.d.ts +3 -0
- package/dist/xlsx/read/worksheet-children.d.ts.map +1 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/what-if.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/what-if.d.ts +0 -1
- package/dist/xlsx/ui/commands/what-if.d.ts.map +1 -1
- package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts +51 -0
- package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts.map +1 -0
- package/dist/xlsx/ui/dialogs/scenario-summary.d.ts +15 -0
- package/dist/xlsx/ui/dialogs/scenario-summary.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +4411 -2195
- package/dist/xlsx/ui/index.d.ts +2 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +4404 -2194
- package/dist/xlsx/ui/locales/de/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/grid.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/grid.d.ts.map +1 -1
- package/dist/xlsx/write/custom-views.d.ts +4 -0
- package/dist/xlsx/write/custom-views.d.ts.map +1 -0
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/dist/xlsx/write/form-control.d.ts +4 -0
- package/dist/xlsx/write/form-control.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -205,19 +205,24 @@ var STYLES = "xlsx:styles";
|
|
|
205
205
|
var NAMES = "xlsx:names";
|
|
206
206
|
var SHEETS = "xlsx:sheets";
|
|
207
207
|
var SHEET_PARTS = ["props", "cells", "rows", "cols", "merges"];
|
|
208
|
+
var LIST_PARTS = ["comments", "replies", "cf", "dv", "links", "tables", "charts"];
|
|
208
209
|
function sharedWorkbook(doc) {
|
|
209
210
|
return {
|
|
210
211
|
meta: doc.getMap(META),
|
|
211
212
|
styles: doc.getMap(STYLES),
|
|
212
213
|
names: doc.getMap(NAMES),
|
|
213
|
-
sheets: doc.getMap(SHEETS)
|
|
214
|
+
sheets: doc.getMap(SHEETS),
|
|
215
|
+
parts: Object.fromEntries(
|
|
216
|
+
LIST_PARTS.map((part) => [part, doc.getMap(`xlsx:${part}`)])
|
|
217
|
+
)
|
|
214
218
|
};
|
|
215
219
|
}
|
|
216
220
|
var sharedTypes = (shared) => [
|
|
217
221
|
shared.meta,
|
|
218
222
|
shared.styles,
|
|
219
223
|
shared.names,
|
|
220
|
-
shared.sheets
|
|
224
|
+
shared.sheets,
|
|
225
|
+
...LIST_PARTS.map((part) => shared.parts[part])
|
|
221
226
|
];
|
|
222
227
|
function childMap(parent, key) {
|
|
223
228
|
const value = parent.get(key);
|
|
@@ -350,6 +355,8 @@ function encodeLine(info, keyOf, column = false) {
|
|
|
350
355
|
if (info.outlineLevel) entry.ol = info.outlineLevel;
|
|
351
356
|
if (info.collapsed) entry.c = 1;
|
|
352
357
|
if (column && info.bestFit) entry.bf = 1;
|
|
358
|
+
if (!column && info.thickTop) entry.tt = 1;
|
|
359
|
+
if (!column && info.thickBot) entry.tb = 1;
|
|
353
360
|
return entry;
|
|
354
361
|
}
|
|
355
362
|
function decodeLine(raw) {
|
|
@@ -372,6 +379,8 @@ function decodeRow(raw, idOf) {
|
|
|
372
379
|
if (styleId) info.styleId = styleId;
|
|
373
380
|
if (entry.ol) info.outlineLevel = entry.ol;
|
|
374
381
|
if (entry.c === 1) info.collapsed = true;
|
|
382
|
+
if (entry.tt === 1) info.thickTop = true;
|
|
383
|
+
if (entry.tb === 1) info.thickBot = true;
|
|
375
384
|
return info;
|
|
376
385
|
}
|
|
377
386
|
function decodeColumn(raw, min, max, idOf) {
|
|
@@ -486,6 +495,7 @@ function writeNames(names, list, sheetKeyAt) {
|
|
|
486
495
|
if (scope !== void 0) entry.k = scope;
|
|
487
496
|
if (name.hidden) entry.h = 1;
|
|
488
497
|
if (name.comment !== void 0) entry.c = name.comment;
|
|
498
|
+
if (name.extra) entry.x = { ...name.extra };
|
|
489
499
|
const key = nameKey(name.name, scope);
|
|
490
500
|
keys.add(key);
|
|
491
501
|
setIfChanged(names, key, entry);
|
|
@@ -506,11 +516,406 @@ function readNames(names, sheetIndexOf) {
|
|
|
506
516
|
}
|
|
507
517
|
if (raw.h === 1) name.hidden = true;
|
|
508
518
|
if (typeof raw.c === "string") name.comment = raw.c;
|
|
519
|
+
if (isRecord(raw.x)) {
|
|
520
|
+
const extra = Object.fromEntries(
|
|
521
|
+
Object.entries(raw.x).filter((e) => typeof e[1] === "string")
|
|
522
|
+
);
|
|
523
|
+
if (Object.keys(extra).length) name.extra = extra;
|
|
524
|
+
}
|
|
509
525
|
out.push(name);
|
|
510
526
|
}
|
|
511
527
|
return out;
|
|
512
528
|
}
|
|
513
529
|
|
|
530
|
+
// xlsx/collab/keyed.ts
|
|
531
|
+
var PrefixStore = class {
|
|
532
|
+
constructor(map, sheetKey) {
|
|
533
|
+
this.map = map;
|
|
534
|
+
this.prefix = `${sheetKey}/`;
|
|
535
|
+
}
|
|
536
|
+
map;
|
|
537
|
+
prefix;
|
|
538
|
+
*entries() {
|
|
539
|
+
for (const [key, value] of this.map.entries())
|
|
540
|
+
if (key.startsWith(this.prefix)) yield [key.slice(this.prefix.length), value];
|
|
541
|
+
}
|
|
542
|
+
has(key) {
|
|
543
|
+
return this.map.has(this.prefix + key);
|
|
544
|
+
}
|
|
545
|
+
keys() {
|
|
546
|
+
return [...this.entries()].map(([key]) => key);
|
|
547
|
+
}
|
|
548
|
+
delete(key) {
|
|
549
|
+
this.map.delete(this.prefix + key);
|
|
550
|
+
}
|
|
551
|
+
/** Sets `key` only when its JSON value differs. */
|
|
552
|
+
setIfChanged(key, value) {
|
|
553
|
+
if (!jsonEqual(this.map.get(this.prefix + key), value)) this.map.set(this.prefix + key, value);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
var PartIds = class {
|
|
557
|
+
byItem = /* @__PURE__ */ new WeakMap();
|
|
558
|
+
byKey = /* @__PURE__ */ new Map();
|
|
559
|
+
set(item, key) {
|
|
560
|
+
this.byItem.set(item, key);
|
|
561
|
+
this.byKey.set(key, item);
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
var isEntry = (raw) => isRecord(raw) && typeof raw.i === "number" && Number.isFinite(raw.i) && "d" in raw;
|
|
565
|
+
var naturalOf = (spec, encoded) => spec.natural ? spec.natural(encoded) : spec.fixedKey?.(encoded);
|
|
566
|
+
function push(index, key, value) {
|
|
567
|
+
const list = index.get(key);
|
|
568
|
+
if (list) list.push(value);
|
|
569
|
+
else index.set(key, [value]);
|
|
570
|
+
}
|
|
571
|
+
function positions(keys, known) {
|
|
572
|
+
const renumber = keys.map((_key, n) => n);
|
|
573
|
+
const current = keys.map((key) => key === void 0 ? void 0 : known.get(key));
|
|
574
|
+
let last;
|
|
575
|
+
let lastKey = "";
|
|
576
|
+
for (const [n, value] of current.entries()) {
|
|
577
|
+
const key = keys[n] ?? "";
|
|
578
|
+
if (value === void 0) continue;
|
|
579
|
+
if (last !== void 0 && !(last < value || last === value && lastKey < key)) return renumber;
|
|
580
|
+
last = value;
|
|
581
|
+
lastKey = key;
|
|
582
|
+
}
|
|
583
|
+
const out = [];
|
|
584
|
+
for (let n = 0; n < current.length; n++) {
|
|
585
|
+
const value = current[n];
|
|
586
|
+
if (value !== void 0) {
|
|
587
|
+
out.push(value);
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
const low = out[n - 1];
|
|
591
|
+
const high = current.slice(n + 1).find((v) => v !== void 0);
|
|
592
|
+
const next = high === void 0 ? (low ?? -1) + 1 : low === void 0 ? high - 1 : (low + high) / 2;
|
|
593
|
+
if (low !== void 0 && next <= low || high !== void 0 && next >= high) return renumber;
|
|
594
|
+
out.push(next);
|
|
595
|
+
}
|
|
596
|
+
return out;
|
|
597
|
+
}
|
|
598
|
+
function writeKeyed(map, items, ids, spec, mint) {
|
|
599
|
+
const existing = /* @__PURE__ */ new Map();
|
|
600
|
+
const position = /* @__PURE__ */ new Map();
|
|
601
|
+
for (const [key, raw] of map.entries())
|
|
602
|
+
if (isEntry(raw)) {
|
|
603
|
+
existing.set(key, raw.d);
|
|
604
|
+
position.set(key, raw.i);
|
|
605
|
+
}
|
|
606
|
+
const list = items.flatMap((item) => {
|
|
607
|
+
const encoded = spec.encode(item);
|
|
608
|
+
return encoded === void 0 ? [] : [{ item, encoded }];
|
|
609
|
+
});
|
|
610
|
+
const keys = list.map(() => void 0);
|
|
611
|
+
const used = /* @__PURE__ */ new Set();
|
|
612
|
+
if (spec.fixedKey) {
|
|
613
|
+
list.forEach(({ encoded }, n) => {
|
|
614
|
+
const base = spec.fixedKey?.(encoded) ?? "";
|
|
615
|
+
let key = base;
|
|
616
|
+
for (let dup = 2; used.has(key); dup++) key = `${base}#${dup}`;
|
|
617
|
+
used.add(key);
|
|
618
|
+
keys[n] = key;
|
|
619
|
+
});
|
|
620
|
+
} else {
|
|
621
|
+
list.forEach(({ item }, n) => {
|
|
622
|
+
const key = ids.byItem.get(item);
|
|
623
|
+
if (key !== void 0 && existing.has(key) && !used.has(key)) {
|
|
624
|
+
used.add(key);
|
|
625
|
+
keys[n] = key;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
const exact = /* @__PURE__ */ new Map();
|
|
629
|
+
const loose = /* @__PURE__ */ new Map();
|
|
630
|
+
for (const [key, d] of existing) {
|
|
631
|
+
if (used.has(key)) continue;
|
|
632
|
+
push(exact, JSON.stringify(d), key);
|
|
633
|
+
const nat = naturalOf(spec, d);
|
|
634
|
+
if (nat !== void 0) push(loose, nat, key);
|
|
635
|
+
}
|
|
636
|
+
const take = (index, at) => {
|
|
637
|
+
const found = at === void 0 ? void 0 : index.get(at);
|
|
638
|
+
while (found?.length) {
|
|
639
|
+
const key = found.shift();
|
|
640
|
+
if (key !== void 0 && !used.has(key)) return key;
|
|
641
|
+
}
|
|
642
|
+
return void 0;
|
|
643
|
+
};
|
|
644
|
+
for (const pass of ["exact", "natural"])
|
|
645
|
+
list.forEach(({ encoded }, n) => {
|
|
646
|
+
if (keys[n] !== void 0) return;
|
|
647
|
+
const key = pass === "exact" ? take(exact, JSON.stringify(encoded)) : take(loose, naturalOf(spec, encoded));
|
|
648
|
+
if (key !== void 0) {
|
|
649
|
+
used.add(key);
|
|
650
|
+
keys[n] = key;
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
const unmatched = list.flatMap((_entry, n) => keys[n] === void 0 ? [n] : []);
|
|
654
|
+
const spare = [...existing.keys()].filter((key) => !used.has(key)).sort((a, b) => (position.get(a) ?? 0) - (position.get(b) ?? 0) || (a < b ? -1 : 1));
|
|
655
|
+
if (unmatched.length > 0 && unmatched.length === spare.length)
|
|
656
|
+
unmatched.forEach((n, k) => {
|
|
657
|
+
const key = spare[k];
|
|
658
|
+
if (key === void 0) return;
|
|
659
|
+
used.add(key);
|
|
660
|
+
keys[n] = key;
|
|
661
|
+
});
|
|
662
|
+
list.forEach((_entry, n) => {
|
|
663
|
+
if (keys[n] !== void 0) return;
|
|
664
|
+
let key = mint();
|
|
665
|
+
while (map.has(key) || used.has(key)) key = mint();
|
|
666
|
+
used.add(key);
|
|
667
|
+
keys[n] = key;
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
const order = positions(keys, position);
|
|
671
|
+
list.forEach(({ item, encoded }, n) => {
|
|
672
|
+
const key = keys[n];
|
|
673
|
+
if (key === void 0) return;
|
|
674
|
+
ids.set(item, key);
|
|
675
|
+
map.setIfChanged(key, { i: order[n] ?? n, d: encoded });
|
|
676
|
+
});
|
|
677
|
+
for (const key of map.keys()) if (!used.has(key)) map.delete(key);
|
|
678
|
+
}
|
|
679
|
+
function readKeyed(map, local, ids, spec) {
|
|
680
|
+
const entries = [...map.entries()].filter((pair) => isEntry(pair[1])).sort((a, b) => a[1].i - b[1].i || (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));
|
|
681
|
+
const unclaimed = new Set(local);
|
|
682
|
+
const encodedOf = /* @__PURE__ */ new Map();
|
|
683
|
+
const encode = (item) => {
|
|
684
|
+
if (!encodedOf.has(item)) encodedOf.set(item, spec.encode(item));
|
|
685
|
+
return encodedOf.get(item);
|
|
686
|
+
};
|
|
687
|
+
let exact;
|
|
688
|
+
let loose;
|
|
689
|
+
const index = () => {
|
|
690
|
+
if (exact) return;
|
|
691
|
+
exact = /* @__PURE__ */ new Map();
|
|
692
|
+
loose = /* @__PURE__ */ new Map();
|
|
693
|
+
for (const item of local) {
|
|
694
|
+
const encoded = encode(item);
|
|
695
|
+
if (encoded === void 0) continue;
|
|
696
|
+
push(exact, JSON.stringify(encoded), item);
|
|
697
|
+
const nat = naturalOf(spec, encoded);
|
|
698
|
+
if (nat !== void 0) push(loose, nat, item);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
const claim = (found) => {
|
|
702
|
+
while (found?.length) {
|
|
703
|
+
const item = found.shift();
|
|
704
|
+
if (item !== void 0 && unclaimed.has(item)) return item;
|
|
705
|
+
}
|
|
706
|
+
return void 0;
|
|
707
|
+
};
|
|
708
|
+
const next = [];
|
|
709
|
+
const keep = /* @__PURE__ */ new Map();
|
|
710
|
+
for (const [key, entry] of entries) {
|
|
711
|
+
let counterpart = ids.byKey.get(key);
|
|
712
|
+
if (counterpart && !unclaimed.has(counterpart)) counterpart = void 0;
|
|
713
|
+
if (!counterpart) {
|
|
714
|
+
index();
|
|
715
|
+
const nat = naturalOf(spec, entry.d);
|
|
716
|
+
counterpart = claim(exact?.get(JSON.stringify(entry.d))) ?? claim(nat === void 0 ? void 0 : loose?.get(nat));
|
|
717
|
+
}
|
|
718
|
+
let item;
|
|
719
|
+
if (counterpart && jsonEqual(encode(counterpart), entry.d)) item = counterpart;
|
|
720
|
+
else {
|
|
721
|
+
item = spec.decode(entry.d);
|
|
722
|
+
if (!item) continue;
|
|
723
|
+
spec.adopt?.(item, counterpart);
|
|
724
|
+
}
|
|
725
|
+
if (counterpart) unclaimed.delete(counterpart);
|
|
726
|
+
keep.set(key, item);
|
|
727
|
+
next.push(item);
|
|
728
|
+
}
|
|
729
|
+
ids.byKey.clear();
|
|
730
|
+
for (const [key, item] of keep) ids.set(item, key);
|
|
731
|
+
if (next.length === local.length && next.every((item, n) => item === local[n])) return void 0;
|
|
732
|
+
return next;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// xlsx/collab/part-specs.ts
|
|
736
|
+
var clone = (value) => JSON.parse(JSON.stringify(value));
|
|
737
|
+
var isText2 = (v, max = 32767) => typeof v === "string" && v.length <= max;
|
|
738
|
+
var isIndex = (v, max) => typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= max;
|
|
739
|
+
function isRange(raw) {
|
|
740
|
+
if (!isRecord(raw) || !isRecord(raw.start) || !isRecord(raw.end)) return false;
|
|
741
|
+
return isIndex(raw.start.row, 1048575) && isIndex(raw.start.col, 16383) && isIndex(raw.end.row, 1048575) && isIndex(raw.end.col, 16383);
|
|
742
|
+
}
|
|
743
|
+
var rangeList = (raw) => Array.isArray(raw) && raw.length <= 4096 && raw.every(isRange);
|
|
744
|
+
var commentSpec = {
|
|
745
|
+
encode: (c) => ({ a: formatAddress(c.address), author: c.author, text: c.text }),
|
|
746
|
+
decode: (raw) => {
|
|
747
|
+
if (!isRecord(raw) || !isText2(raw.a, 12) || !isText2(raw.author, 1024) || !isText2(raw.text))
|
|
748
|
+
return void 0;
|
|
749
|
+
const address = parseAddress(raw.a);
|
|
750
|
+
return address ? { address, author: raw.author, text: raw.text } : void 0;
|
|
751
|
+
},
|
|
752
|
+
fixedKey: (e) => String(e.a),
|
|
753
|
+
adopt: (decoded, local) => {
|
|
754
|
+
if (local?.replies) decoded.replies = local.replies;
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
function replySpec(owner, decodedOwner) {
|
|
758
|
+
return {
|
|
759
|
+
encode: (r) => {
|
|
760
|
+
const c = owner.get(r) ?? decodedOwner.get(r);
|
|
761
|
+
if (c === void 0) return void 0;
|
|
762
|
+
const out = { c, author: r.author, text: r.text };
|
|
763
|
+
if (r.date !== void 0) out.date = r.date;
|
|
764
|
+
return out;
|
|
765
|
+
},
|
|
766
|
+
decode: (raw) => {
|
|
767
|
+
if (!isRecord(raw) || !isText2(raw.c, 12) || !isText2(raw.author, 1024) || !isText2(raw.text))
|
|
768
|
+
return void 0;
|
|
769
|
+
if (raw.date !== void 0 && !isText2(raw.date, 64)) return void 0;
|
|
770
|
+
const reply = { author: raw.author, text: raw.text };
|
|
771
|
+
if (raw.date !== void 0) reply.date = raw.date;
|
|
772
|
+
decodedOwner.set(reply, raw.c);
|
|
773
|
+
return reply;
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
var conditionalSpec = {
|
|
778
|
+
encode: (cf) => clone(cf),
|
|
779
|
+
decode: (raw) => isRecord(raw) && rangeList(raw.ranges) && Array.isArray(raw.rules) && raw.rules.length <= 1024 ? clone(raw) : void 0
|
|
780
|
+
};
|
|
781
|
+
var validationSpec = {
|
|
782
|
+
encode: (dv) => clone(dv),
|
|
783
|
+
decode: (raw) => isRecord(raw) && rangeList(raw.ranges) && isText2(raw.type, 32) ? clone(raw) : void 0
|
|
784
|
+
};
|
|
785
|
+
var linkSpec = {
|
|
786
|
+
encode: (link) => {
|
|
787
|
+
const { range, ...rest } = clone(link);
|
|
788
|
+
return { r: formatRange(range), ...rest };
|
|
789
|
+
},
|
|
790
|
+
decode: (raw) => {
|
|
791
|
+
if (!isRecord(raw) || !isText2(raw.r, 24)) return void 0;
|
|
792
|
+
const range = parseRange(raw.r);
|
|
793
|
+
if (!range) return void 0;
|
|
794
|
+
const { r: _r, ...rest } = clone(raw);
|
|
795
|
+
return { ...rest, range };
|
|
796
|
+
},
|
|
797
|
+
fixedKey: (e) => String(e.r)
|
|
798
|
+
};
|
|
799
|
+
function withoutPart(item) {
|
|
800
|
+
const out = clone(item);
|
|
801
|
+
delete out.partName;
|
|
802
|
+
return out;
|
|
803
|
+
}
|
|
804
|
+
var tableSpec = {
|
|
805
|
+
encode: (table) => withoutPart(table),
|
|
806
|
+
decode: (raw) => isRecord(raw) && isRange(raw.range) && isText2(raw.name, 255) && isText2(raw.displayName, 255) && Array.isArray(raw.columns) && raw.columns.length <= 16384 ? clone(raw) : void 0,
|
|
807
|
+
natural: (e) => String(e.displayName),
|
|
808
|
+
adopt: (decoded, local) => {
|
|
809
|
+
if (local?.partName !== void 0) decoded.partName = local.partName;
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
var chartSpec = {
|
|
813
|
+
encode: (chart) => withoutPart(chart),
|
|
814
|
+
decode: (raw) => isRecord(raw) && raw.kind === "chart" && isRecord(raw.anchor) && isRecord(raw.anchor.from) ? clone(raw) : void 0,
|
|
815
|
+
natural: (e) => {
|
|
816
|
+
const name = e.name;
|
|
817
|
+
return typeof name === "string" ? name : void 0;
|
|
818
|
+
},
|
|
819
|
+
adopt: (decoded, local) => {
|
|
820
|
+
if (local?.partName !== void 0) decoded.partName = local.partName;
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// xlsx/collab/sheet-parts.ts
|
|
825
|
+
var repliesOwners = (comments) => {
|
|
826
|
+
const owner = /* @__PURE__ */ new Map();
|
|
827
|
+
for (const comment of comments)
|
|
828
|
+
for (const reply of comment.replies ?? []) owner.set(reply, formatAddress(comment.address));
|
|
829
|
+
return owner;
|
|
830
|
+
};
|
|
831
|
+
var allReplies = (comments) => comments.flatMap((comment) => comment.replies ?? []);
|
|
832
|
+
function writeSheetParts(sheet, host, options) {
|
|
833
|
+
const put = (part, items, spec) => writeKeyed(host.store(part), items, host.ids(part), spec, host.mint);
|
|
834
|
+
put("comments", sheet.comments, commentSpec);
|
|
835
|
+
put("replies", allReplies(sheet.comments), replySpec(repliesOwners(sheet.comments), /* @__PURE__ */ new Map()));
|
|
836
|
+
put("cf", sheet.conditionalFormats, conditionalSpec);
|
|
837
|
+
put("dv", sheet.dataValidations, validationSpec);
|
|
838
|
+
put("links", sheet.hyperlinks, linkSpec);
|
|
839
|
+
put("tables", sheet.tables, tableSpec);
|
|
840
|
+
if (options.charts)
|
|
841
|
+
put(
|
|
842
|
+
"charts",
|
|
843
|
+
sheet.drawings.filter(
|
|
844
|
+
(d) => d.kind === "chart"
|
|
845
|
+
),
|
|
846
|
+
chartSpec
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
function applySheetParts(sheet, host, parts) {
|
|
850
|
+
const wants = (part) => !parts || parts.has(part) ? host.store(part) : void 0;
|
|
851
|
+
let changed = false;
|
|
852
|
+
const swap = (part, list, spec, rebuild) => {
|
|
853
|
+
const shared = wants(part);
|
|
854
|
+
const next = shared && readKeyed(shared, list, host.ids(part), spec);
|
|
855
|
+
if (!next) return;
|
|
856
|
+
rebuild(next);
|
|
857
|
+
changed = true;
|
|
858
|
+
};
|
|
859
|
+
const inPlace = (list) => (next) => void list.splice(0, list.length, ...next);
|
|
860
|
+
const commentsShared = wants("comments");
|
|
861
|
+
const repliesShared = wants("replies");
|
|
862
|
+
if (commentsShared || repliesShared) {
|
|
863
|
+
const owners = repliesOwners(sheet.comments);
|
|
864
|
+
const local = allReplies(sheet.comments);
|
|
865
|
+
let commentsNext;
|
|
866
|
+
if (commentsShared) {
|
|
867
|
+
commentsNext = readKeyed(commentsShared, sheet.comments, host.ids("comments"), commentSpec);
|
|
868
|
+
if (commentsNext) sheet.comments.splice(0, sheet.comments.length, ...commentsNext);
|
|
869
|
+
}
|
|
870
|
+
const decoded = /* @__PURE__ */ new Map();
|
|
871
|
+
const repliesNext = repliesShared ? readKeyed(repliesShared, local, host.ids("replies"), replySpec(owners, decoded)) : void 0;
|
|
872
|
+
if (commentsNext || repliesNext) {
|
|
873
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
874
|
+
for (const reply of repliesNext ?? local) {
|
|
875
|
+
const at = decoded.get(reply) ?? owners.get(reply);
|
|
876
|
+
if (at === void 0) continue;
|
|
877
|
+
const list = grouped.get(at);
|
|
878
|
+
if (list) list.push(reply);
|
|
879
|
+
else grouped.set(at, [reply]);
|
|
880
|
+
}
|
|
881
|
+
const same = (x, y) => (x?.length ?? 0) === (y?.length ?? 0) && (x ?? []).every((r, n) => r === y?.[n]);
|
|
882
|
+
sheet.comments.forEach((comment) => {
|
|
883
|
+
const replies = grouped.get(formatAddress(comment.address));
|
|
884
|
+
if (same(replies, comment.replies)) return;
|
|
885
|
+
if (replies) comment.replies = replies;
|
|
886
|
+
else delete comment.replies;
|
|
887
|
+
});
|
|
888
|
+
changed = true;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
swap("cf", sheet.conditionalFormats, conditionalSpec, inPlace(sheet.conditionalFormats));
|
|
892
|
+
swap("dv", sheet.dataValidations, validationSpec, inPlace(sheet.dataValidations));
|
|
893
|
+
swap("links", sheet.hyperlinks, linkSpec, inPlace(sheet.hyperlinks));
|
|
894
|
+
swap("tables", sheet.tables, tableSpec, (next) => {
|
|
895
|
+
const used = /* @__PURE__ */ new Set();
|
|
896
|
+
let max = next.reduce((m, t) => Math.max(m, t.id), 0);
|
|
897
|
+
for (const table of next) {
|
|
898
|
+
if (used.has(table.id)) table.id = ++max;
|
|
899
|
+
used.add(table.id);
|
|
900
|
+
}
|
|
901
|
+
inPlace(sheet.tables)(next);
|
|
902
|
+
});
|
|
903
|
+
const charts = sheet.drawings.filter(
|
|
904
|
+
(d) => d.kind === "chart"
|
|
905
|
+
);
|
|
906
|
+
swap("charts", charts, chartSpec, (next) => {
|
|
907
|
+
let k = 0;
|
|
908
|
+
const merged = [];
|
|
909
|
+
for (const drawing of sheet.drawings) {
|
|
910
|
+
if (drawing.kind !== "chart") merged.push(drawing);
|
|
911
|
+
else if (k < next.length) merged.push(next[k++]);
|
|
912
|
+
}
|
|
913
|
+
while (k < next.length) merged.push(next[k++]);
|
|
914
|
+
sheet.drawings.splice(0, sheet.drawings.length, ...merged);
|
|
915
|
+
});
|
|
916
|
+
return changed;
|
|
917
|
+
}
|
|
918
|
+
|
|
514
919
|
// xlsx/collab/sheets.ts
|
|
515
920
|
var STATES = ["visible", "hidden", "veryHidden"];
|
|
516
921
|
var isNumber = (v) => typeof v === "number" && Number.isFinite(v);
|
|
@@ -563,9 +968,21 @@ var SheetKeys = class {
|
|
|
563
968
|
clientId;
|
|
564
969
|
byObject = /* @__PURE__ */ new WeakMap();
|
|
565
970
|
counter = 0;
|
|
971
|
+
partIds = /* @__PURE__ */ new Map();
|
|
566
972
|
remember(sheet, key) {
|
|
567
973
|
this.byObject.set(sheet, key);
|
|
568
974
|
}
|
|
975
|
+
/** Item identity of a keyed part of the sheet with `sheetKey`. */
|
|
976
|
+
ids(sheetKey, part) {
|
|
977
|
+
const id = `${sheetKey}/${part}`;
|
|
978
|
+
let ids = this.partIds.get(id);
|
|
979
|
+
if (!ids) this.partIds.set(id, ids = new PartIds());
|
|
980
|
+
return ids;
|
|
981
|
+
}
|
|
982
|
+
/** A new key for a part item, unique to this peer. */
|
|
983
|
+
mint() {
|
|
984
|
+
return `${this.clientId.toString(36)}-${(this.counter++).toString(36)}`;
|
|
985
|
+
}
|
|
569
986
|
/** The key of a known sheet object, else of the shared sheet with its sheetId. */
|
|
570
987
|
find(sheet, entries) {
|
|
571
988
|
const known = this.byObject.get(sheet);
|
|
@@ -734,7 +1151,120 @@ var StyleBridge = class {
|
|
|
734
1151
|
};
|
|
735
1152
|
};
|
|
736
1153
|
|
|
1154
|
+
// xlsx/collab/write.ts
|
|
1155
|
+
var partHost = (shared, keys, sheetKey) => ({
|
|
1156
|
+
store: (part) => new PrefixStore(shared.parts[part], sheetKey),
|
|
1157
|
+
ids: (part) => keys.ids(sheetKey, part),
|
|
1158
|
+
mint: () => keys.mint()
|
|
1159
|
+
});
|
|
1160
|
+
var PROBE_LIMIT = 4096;
|
|
1161
|
+
function writeWorkbook(shared, keys, workbook, scope) {
|
|
1162
|
+
const { meta, sheets } = shared;
|
|
1163
|
+
setIfChanged(meta, "v", SCHEMA_VERSION);
|
|
1164
|
+
setIfChanged(meta, "parts", 1);
|
|
1165
|
+
let defaultKey = meta.get("defaultStyle");
|
|
1166
|
+
if (typeof defaultKey !== "string") {
|
|
1167
|
+
const base = workbook.styles[0];
|
|
1168
|
+
defaultKey = base ? sharedStyleKey(base) : "";
|
|
1169
|
+
meta.set("defaultStyle", defaultKey);
|
|
1170
|
+
}
|
|
1171
|
+
const styles = new StyleBridge(workbook, shared.styles, defaultKey, true);
|
|
1172
|
+
styles.keyOf(0);
|
|
1173
|
+
const entries = sheetEntries(sheets);
|
|
1174
|
+
const known = workbook.sheets.map((sheet) => keys.find(sheet, entries));
|
|
1175
|
+
const full = scope.kind === "all" || known.some((key) => key === void 0 || !sheets.has(key));
|
|
1176
|
+
if (full) setIfChanged(meta, "date1904", workbook.date1904);
|
|
1177
|
+
const keyList = workbook.sheets.map((sheet) => keys.resolve(sheet, entries, sheets));
|
|
1178
|
+
if (full) {
|
|
1179
|
+
const live = new Set(keyList);
|
|
1180
|
+
for (const key of [...sheets.keys()]) if (!live.has(key)) sheets.delete(key);
|
|
1181
|
+
for (const part of LIST_PARTS)
|
|
1182
|
+
for (const key of [...shared.parts[part].keys()])
|
|
1183
|
+
if (!live.has(key.slice(0, key.indexOf("/")))) shared.parts[part].delete(key);
|
|
1184
|
+
}
|
|
1185
|
+
workbook.sheets.forEach((sheet, index) => {
|
|
1186
|
+
const key = keyList[index];
|
|
1187
|
+
if (key === void 0) return;
|
|
1188
|
+
let map = childMap(sheets, key);
|
|
1189
|
+
const created = !map;
|
|
1190
|
+
if (!map) {
|
|
1191
|
+
map = newSheetMap();
|
|
1192
|
+
sheets.set(key, map);
|
|
1193
|
+
}
|
|
1194
|
+
if (!full && !created && scope.kind === "sheet" && scope.sheet !== index) {
|
|
1195
|
+
writeProps(map, sheet);
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
writeProps(map, sheet);
|
|
1199
|
+
writeLines(
|
|
1200
|
+
sheet,
|
|
1201
|
+
{
|
|
1202
|
+
rows: sheetPart(map, "rows"),
|
|
1203
|
+
cols: sheetPart(map, "cols"),
|
|
1204
|
+
merges: sheetPart(map, "merges")
|
|
1205
|
+
},
|
|
1206
|
+
styles.keyOf
|
|
1207
|
+
);
|
|
1208
|
+
const ranges = !full && scope.kind === "sheet" ? scope.ranges : void 0;
|
|
1209
|
+
writeCells(sheet, sheetPart(map, "cells"), styles.keyOf, ranges);
|
|
1210
|
+
writeSheetParts(sheet, partHost(shared, keys, key), { charts: ranges === void 0 });
|
|
1211
|
+
});
|
|
1212
|
+
writeOrder(sheets, keyList, entries);
|
|
1213
|
+
writeNames(shared.names, workbook.definedNames, (index) => keyList[index]);
|
|
1214
|
+
}
|
|
1215
|
+
function writeProps(map, sheet) {
|
|
1216
|
+
const props = sheetPart(map, "props");
|
|
1217
|
+
setIfChanged(props, "name", sheet.name);
|
|
1218
|
+
setIfChanged(props, "sheetId", sheet.sheetId);
|
|
1219
|
+
setIfChanged(props, "state", sheet.state);
|
|
1220
|
+
setIfChanged(props, "tab", sheet.tabColor ? structuredClone(sheet.tabColor) : void 0);
|
|
1221
|
+
setIfChanged(props, "rh", sheet.defaultRowHeight);
|
|
1222
|
+
setIfChanged(props, "cw", sheet.defaultColWidth);
|
|
1223
|
+
}
|
|
1224
|
+
function writeOrder(sheets, keyList, entries) {
|
|
1225
|
+
const orders = new Map(entries.map((entry) => [entry.key, entry.order]));
|
|
1226
|
+
const current = keyList.map((key) => {
|
|
1227
|
+
const props = childMap(sheets, key);
|
|
1228
|
+
return props && childMap(props, "props")?.has("order") ? orders.get(key) : void 0;
|
|
1229
|
+
});
|
|
1230
|
+
for (const [index, order] of reorder(current)) {
|
|
1231
|
+
const key = keyList[index];
|
|
1232
|
+
const props = key === void 0 ? void 0 : childMap(sheets, key);
|
|
1233
|
+
if (props) sheetPart(props, "props").set("order", order);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
function writeCells(sheet, cells, keyOf, ranges) {
|
|
1237
|
+
const write = (row, col) => {
|
|
1238
|
+
const key = formatAddress({ row, col });
|
|
1239
|
+
const cell = getCell(sheet, row, col);
|
|
1240
|
+
setIfChanged(cells, key, cell && encodeCell(cell, keyOf));
|
|
1241
|
+
return key;
|
|
1242
|
+
};
|
|
1243
|
+
if (!ranges) {
|
|
1244
|
+
const live = /* @__PURE__ */ new Set();
|
|
1245
|
+
forEachCell(sheet, (_cell, row, col) => live.add(write(row, col)));
|
|
1246
|
+
for (const key of [...cells.keys()]) if (!live.has(key)) cells.delete(key);
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
for (const raw of ranges) {
|
|
1250
|
+
const range = normalizeRange(raw);
|
|
1251
|
+
const area = (range.end.row - range.start.row + 1) * (range.end.col - range.start.col + 1);
|
|
1252
|
+
if (area <= PROBE_LIMIT) {
|
|
1253
|
+
for (let row = range.start.row; row <= range.end.row; row++)
|
|
1254
|
+
for (let col = range.start.col; col <= range.end.col; col++) write(row, col);
|
|
1255
|
+
continue;
|
|
1256
|
+
}
|
|
1257
|
+
const live = /* @__PURE__ */ new Set();
|
|
1258
|
+
forEachCellInRange(sheet, range, (_cell, row, col) => live.add(write(row, col)));
|
|
1259
|
+
for (const key of [...cells.keys()]) {
|
|
1260
|
+
const at = parseAddress(key);
|
|
1261
|
+
if (!live.has(key) && at && rangeContains(range, at)) cells.delete(key);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
|
|
737
1266
|
// xlsx/collab/apply.ts
|
|
1267
|
+
var sharesParts = (shared) => shared.meta.get("parts") === 1;
|
|
738
1268
|
function applyShared(shared, keys, workbook, dirty, label = "Remote change") {
|
|
739
1269
|
const defaultKey = shared.meta.get("defaultStyle");
|
|
740
1270
|
const styles = new StyleBridge(workbook, shared.styles, String(defaultKey ?? ""), false);
|
|
@@ -774,6 +1304,8 @@ function applyShared(shared, keys, workbook, dirty, label = "Remote change") {
|
|
|
774
1304
|
applyMerges(sheet, merges);
|
|
775
1305
|
sheetsTouched.add(index);
|
|
776
1306
|
}
|
|
1307
|
+
if (sharesParts(shared) && applySheetParts(sheet, partHost(shared, keys, key), full ? void 0 : part.parts))
|
|
1308
|
+
sheetsTouched.add(index);
|
|
777
1309
|
const cells = childMap(map, "cells");
|
|
778
1310
|
if (!cells) continue;
|
|
779
1311
|
const put = (address) => {
|
|
@@ -853,7 +1385,14 @@ var isDirty = (dirty) => dirty.all || dirty.list || dirty.names || dirty.sheets.
|
|
|
853
1385
|
function sheetDirty(dirty, key) {
|
|
854
1386
|
let entry = dirty.sheets.get(key);
|
|
855
1387
|
if (!entry) {
|
|
856
|
-
entry = {
|
|
1388
|
+
entry = {
|
|
1389
|
+
full: false,
|
|
1390
|
+
rows: /* @__PURE__ */ new Set(),
|
|
1391
|
+
cols: false,
|
|
1392
|
+
merges: false,
|
|
1393
|
+
cells: /* @__PURE__ */ new Set(),
|
|
1394
|
+
parts: /* @__PURE__ */ new Set()
|
|
1395
|
+
};
|
|
857
1396
|
dirty.sheets.set(key, entry);
|
|
858
1397
|
}
|
|
859
1398
|
return entry;
|
|
@@ -869,6 +1408,14 @@ function collectDirty(dirty, top, events) {
|
|
|
869
1408
|
dirty.names = true;
|
|
870
1409
|
return;
|
|
871
1410
|
}
|
|
1411
|
+
if (top !== "sheets") {
|
|
1412
|
+
for (const event of events)
|
|
1413
|
+
for (const key of changedKeys(event)) {
|
|
1414
|
+
const sheet = key.slice(0, Math.max(0, key.indexOf("/")));
|
|
1415
|
+
if (sheet) sheetDirty(dirty, sheet).parts.add(top);
|
|
1416
|
+
}
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
872
1419
|
for (const event of events) {
|
|
873
1420
|
const path = event.path;
|
|
874
1421
|
const key = path[0];
|
|
@@ -889,108 +1436,6 @@ function collectDirty(dirty, top, events) {
|
|
|
889
1436
|
}
|
|
890
1437
|
}
|
|
891
1438
|
|
|
892
|
-
// xlsx/collab/write.ts
|
|
893
|
-
var PROBE_LIMIT = 4096;
|
|
894
|
-
function writeWorkbook(shared, keys, workbook, scope) {
|
|
895
|
-
const { meta, sheets } = shared;
|
|
896
|
-
setIfChanged(meta, "v", SCHEMA_VERSION);
|
|
897
|
-
let defaultKey = meta.get("defaultStyle");
|
|
898
|
-
if (typeof defaultKey !== "string") {
|
|
899
|
-
const base = workbook.styles[0];
|
|
900
|
-
defaultKey = base ? sharedStyleKey(base) : "";
|
|
901
|
-
meta.set("defaultStyle", defaultKey);
|
|
902
|
-
}
|
|
903
|
-
const styles = new StyleBridge(workbook, shared.styles, defaultKey, true);
|
|
904
|
-
styles.keyOf(0);
|
|
905
|
-
const entries = sheetEntries(sheets);
|
|
906
|
-
const known = workbook.sheets.map((sheet) => keys.find(sheet, entries));
|
|
907
|
-
const full = scope.kind === "all" || known.some((key) => key === void 0 || !sheets.has(key));
|
|
908
|
-
if (full) setIfChanged(meta, "date1904", workbook.date1904);
|
|
909
|
-
const keyList = workbook.sheets.map((sheet) => keys.resolve(sheet, entries, sheets));
|
|
910
|
-
if (full) {
|
|
911
|
-
const live = new Set(keyList);
|
|
912
|
-
for (const key of [...sheets.keys()]) if (!live.has(key)) sheets.delete(key);
|
|
913
|
-
}
|
|
914
|
-
workbook.sheets.forEach((sheet, index) => {
|
|
915
|
-
const key = keyList[index];
|
|
916
|
-
if (key === void 0) return;
|
|
917
|
-
let map = childMap(sheets, key);
|
|
918
|
-
const created = !map;
|
|
919
|
-
if (!map) {
|
|
920
|
-
map = newSheetMap();
|
|
921
|
-
sheets.set(key, map);
|
|
922
|
-
}
|
|
923
|
-
if (!full && !created && scope.kind === "sheet" && scope.sheet !== index) {
|
|
924
|
-
writeProps(map, sheet);
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
writeProps(map, sheet);
|
|
928
|
-
writeLines(
|
|
929
|
-
sheet,
|
|
930
|
-
{
|
|
931
|
-
rows: sheetPart(map, "rows"),
|
|
932
|
-
cols: sheetPart(map, "cols"),
|
|
933
|
-
merges: sheetPart(map, "merges")
|
|
934
|
-
},
|
|
935
|
-
styles.keyOf
|
|
936
|
-
);
|
|
937
|
-
const ranges = !full && scope.kind === "sheet" ? scope.ranges : void 0;
|
|
938
|
-
writeCells(sheet, sheetPart(map, "cells"), styles.keyOf, ranges);
|
|
939
|
-
});
|
|
940
|
-
writeOrder(sheets, keyList, entries);
|
|
941
|
-
writeNames(shared.names, workbook.definedNames, (index) => keyList[index]);
|
|
942
|
-
}
|
|
943
|
-
function writeProps(map, sheet) {
|
|
944
|
-
const props = sheetPart(map, "props");
|
|
945
|
-
setIfChanged(props, "name", sheet.name);
|
|
946
|
-
setIfChanged(props, "sheetId", sheet.sheetId);
|
|
947
|
-
setIfChanged(props, "state", sheet.state);
|
|
948
|
-
setIfChanged(props, "tab", sheet.tabColor ? structuredClone(sheet.tabColor) : void 0);
|
|
949
|
-
setIfChanged(props, "rh", sheet.defaultRowHeight);
|
|
950
|
-
setIfChanged(props, "cw", sheet.defaultColWidth);
|
|
951
|
-
}
|
|
952
|
-
function writeOrder(sheets, keyList, entries) {
|
|
953
|
-
const orders = new Map(entries.map((entry) => [entry.key, entry.order]));
|
|
954
|
-
const current = keyList.map((key) => {
|
|
955
|
-
const props = childMap(sheets, key);
|
|
956
|
-
return props && childMap(props, "props")?.has("order") ? orders.get(key) : void 0;
|
|
957
|
-
});
|
|
958
|
-
for (const [index, order] of reorder(current)) {
|
|
959
|
-
const key = keyList[index];
|
|
960
|
-
const props = key === void 0 ? void 0 : childMap(sheets, key);
|
|
961
|
-
if (props) sheetPart(props, "props").set("order", order);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
function writeCells(sheet, cells, keyOf, ranges) {
|
|
965
|
-
const write = (row, col) => {
|
|
966
|
-
const key = formatAddress({ row, col });
|
|
967
|
-
const cell = getCell(sheet, row, col);
|
|
968
|
-
setIfChanged(cells, key, cell && encodeCell(cell, keyOf));
|
|
969
|
-
return key;
|
|
970
|
-
};
|
|
971
|
-
if (!ranges) {
|
|
972
|
-
const live = /* @__PURE__ */ new Set();
|
|
973
|
-
forEachCell(sheet, (_cell, row, col) => live.add(write(row, col)));
|
|
974
|
-
for (const key of [...cells.keys()]) if (!live.has(key)) cells.delete(key);
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
for (const raw of ranges) {
|
|
978
|
-
const range = normalizeRange(raw);
|
|
979
|
-
const area = (range.end.row - range.start.row + 1) * (range.end.col - range.start.col + 1);
|
|
980
|
-
if (area <= PROBE_LIMIT) {
|
|
981
|
-
for (let row = range.start.row; row <= range.end.row; row++)
|
|
982
|
-
for (let col = range.start.col; col <= range.end.col; col++) write(row, col);
|
|
983
|
-
continue;
|
|
984
|
-
}
|
|
985
|
-
const live = /* @__PURE__ */ new Set();
|
|
986
|
-
forEachCellInRange(sheet, range, (_cell, row, col) => live.add(write(row, col)));
|
|
987
|
-
for (const key of [...cells.keys()]) {
|
|
988
|
-
const at = parseAddress(key);
|
|
989
|
-
if (!live.has(key) && at && rangeContains(range, at)) cells.delete(key);
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
|
|
994
1439
|
// xlsx/collab/adapter.ts
|
|
995
1440
|
var isSharedWorkbookEmpty = (doc) => sharedWorkbook(doc).sheets.size === 0;
|
|
996
1441
|
function readSharedWorkbook(doc, base) {
|
|
@@ -1131,7 +1576,7 @@ function bindWorkbookSession(host, edit, options = {}) {
|
|
|
1131
1576
|
unsent = false;
|
|
1132
1577
|
};
|
|
1133
1578
|
const observers = types.map((type, i) => {
|
|
1134
|
-
const top = ["meta", "styles", "names", "sheets"][i] ?? "sheets";
|
|
1579
|
+
const top = [...["meta", "styles", "names", "sheets"], ...LIST_PARTS][i] ?? "sheets";
|
|
1135
1580
|
const observer = (events, transaction) => {
|
|
1136
1581
|
const origin = transaction.origin;
|
|
1137
1582
|
if (origin === XLSX_EDIT_ORIGIN || origin === XLSX_SYNC_ORIGIN) return;
|