@gct-paas/word 0.2.45-beta.0 → 1.0.1
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/README.md +455 -306
- package/dist/browser.js +1 -0
- package/dist/chunks/ModelEditor-GzaLnnX8.js +4621 -0
- package/dist/chunks/ModelEditor-GzaLnnX8.js.map +1 -0
- package/dist/chunks/NodeFactory-D9gVGSok.js +3348 -0
- package/dist/chunks/NodeFactory-D9gVGSok.js.map +1 -0
- package/dist/chunks/abortable-D4G3Ib7H.js +66 -0
- package/dist/chunks/abortable-D4G3Ib7H.js.map +1 -0
- package/dist/chunks/browser-CP0ycXqN.js +14038 -0
- package/dist/chunks/browser-CP0ycXqN.js.map +1 -0
- package/dist/chunks/change-set-DNOw1FXo.js +133 -0
- package/dist/chunks/change-set-DNOw1FXo.js.map +1 -0
- package/dist/chunks/fields-CAcm6X98.js +672 -0
- package/dist/chunks/fields-CAcm6X98.js.map +1 -0
- package/dist/chunks/sdk-DH5c-Bbt.js +33885 -0
- package/dist/chunks/sdk-DH5c-Bbt.js.map +1 -0
- package/dist/chunks/table-borders-Dwuj7lFp.js +50 -0
- package/dist/chunks/table-borders-Dwuj7lFp.js.map +1 -0
- package/dist/chunks/templates-Djcl21k4.js +57 -0
- package/dist/chunks/templates-Djcl21k4.js.map +1 -0
- package/dist/chunks/types-XXuIIZ9e.js +3046 -0
- package/dist/chunks/types-XXuIIZ9e.js.map +1 -0
- package/dist/chunks/word-fonts-BA_Tyfnj.js +14 -0
- package/dist/chunks/word-fonts-BA_Tyfnj.js.map +1 -0
- package/dist/docx.js +1310 -0
- package/dist/docx.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/pdf.js +181 -0
- package/dist/pdf.js.map +1 -0
- package/dist/platform.js +63 -0
- package/dist/platform.js.map +1 -0
- package/dist/style.css +10917 -0
- package/dist/types/adapters/browser/abortable.d.ts +2 -0
- package/dist/types/adapters/browser/canvas/CanvasPages.d.ts +43 -0
- package/dist/types/adapters/browser/canvas/field-background.d.ts +10 -0
- package/dist/types/adapters/browser/canvas/paint-border.d.ts +5 -0
- package/dist/types/adapters/browser/canvas/paint-code.d.ts +5 -0
- package/dist/types/adapters/browser/canvas/paint-context.d.ts +24 -0
- package/dist/types/adapters/browser/canvas/paint-decorations.d.ts +5 -0
- package/dist/types/adapters/browser/canvas/paint-field.d.ts +5 -0
- package/dist/types/adapters/browser/canvas/paint-guides.d.ts +8 -0
- package/dist/types/adapters/browser/canvas/paint-image.d.ts +6 -0
- package/dist/types/adapters/browser/canvas/paint-page-widget.d.ts +5 -0
- package/dist/types/adapters/browser/canvas/paint-page.d.ts +20 -0
- package/dist/types/adapters/browser/canvas/paint-pixels.d.ts +11 -0
- package/dist/types/adapters/browser/canvas/paint-seal.d.ts +5 -0
- package/dist/types/adapters/browser/canvas/paint-table.d.ts +7 -0
- package/dist/types/adapters/browser/canvas/paint-widget-placeholder.d.ts +6 -0
- package/dist/types/adapters/browser/canvas/types.d.ts +52 -0
- package/dist/types/adapters/browser/fonts/NativeFontResources.d.ts +43 -0
- package/dist/types/adapters/browser/fonts/types.d.ts +35 -0
- package/dist/types/adapters/browser/images/CanvasImageResources.d.ts +52 -0
- package/dist/types/adapters/browser/images/layout-images.d.ts +6 -0
- package/dist/types/adapters/browser/images/load-browser-image.d.ts +4 -0
- package/dist/types/adapters/browser/images/types.d.ts +32 -0
- package/dist/types/adapters/browser/index.d.ts +74 -0
- package/dist/types/adapters/browser/input/CanvasOptionInput.d.ts +39 -0
- package/dist/types/adapters/browser/input/CanvasTextInput.d.ts +123 -0
- package/dist/types/adapters/browser/input/ChoiceFieldInput.d.ts +35 -0
- package/dist/types/adapters/browser/input/FieldInputValidation.d.ts +8 -0
- package/dist/types/adapters/browser/input/InlineFieldInput.d.ts +101 -0
- package/dist/types/adapters/browser/input/SignatureFieldInput.d.ts +57 -0
- package/dist/types/adapters/browser/input/attach-canvas-text-input.d.ts +13 -0
- package/dist/types/adapters/browser/input/business/BusinessFieldInput.d.ts +36 -0
- package/dist/types/adapters/browser/input/business/FieldDialog.d.ts +32 -0
- package/dist/types/adapters/browser/input/business/FieldPopover.d.ts +31 -0
- package/dist/types/adapters/browser/input/business/ReferenceFieldInput.d.ts +55 -0
- package/dist/types/adapters/browser/input/business/ResourceCamera.d.ts +19 -0
- package/dist/types/adapters/browser/input/business/ResourceFieldInput.d.ts +80 -0
- package/dist/types/adapters/browser/input/business/ResourceFieldPreview.d.ts +21 -0
- package/dist/types/adapters/browser/input/business/ResourceFileSizes.d.ts +7 -0
- package/dist/types/adapters/browser/input/business/SealFieldInput.d.ts +59 -0
- package/dist/types/adapters/browser/input/business/TemporalFieldInput.d.ts +30 -0
- package/dist/types/adapters/browser/input/business/dialog-renderer.d.ts +19 -0
- package/dist/types/adapters/browser/input/business/materials/CanvasMaterialTableActions.d.ts +40 -0
- package/dist/types/adapters/browser/input/business/materials/CanvasMaterialsPanel.d.ts +55 -0
- package/dist/types/adapters/browser/input/business/materials/attach-canvas-materials.d.ts +13 -0
- package/dist/types/adapters/browser/input/business/resource-file-icon.d.ts +1 -0
- package/dist/types/adapters/browser/input/business/tables/CanvasBusinessTableActions.d.ts +34 -0
- package/dist/types/adapters/browser/input/business/tables/CanvasBusinessTablePanel.d.ts +59 -0
- package/dist/types/adapters/browser/input/business/tables/CanvasQuickFillDialog.d.ts +69 -0
- package/dist/types/adapters/browser/input/business/tables/CanvasTableScanDialog.d.ts +89 -0
- package/dist/types/adapters/browser/input/business/tables/attach-canvas-business-table.d.ts +13 -0
- package/dist/types/adapters/browser/input/business/tables/fixed-quick-fill-grid.d.ts +19 -0
- package/dist/types/adapters/browser/input/business/tables/table-action-anchors.d.ts +20 -0
- package/dist/types/adapters/browser/input/business/tables/table-actions-renderer.d.ts +45 -0
- package/dist/types/adapters/browser/input/choice-geometry.d.ts +19 -0
- package/dist/types/adapters/browser/input/clipboard/html-style.d.ts +9 -0
- package/dist/types/adapters/browser/input/clipboard/html.d.ts +4 -0
- package/dist/types/adapters/browser/input/clipboard/images.d.ts +3 -0
- package/dist/types/adapters/browser/input/design/CanvasFieldDrag.d.ts +70 -0
- package/dist/types/adapters/browser/input/design/PalettePointerDrag.d.ts +57 -0
- package/dist/types/adapters/browser/input/design/attach-canvas-field-drag.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/catalog/CanvasFieldCatalogPanel.d.ts +95 -0
- package/dist/types/adapters/browser/input/design/catalog/attach-canvas-field-catalog.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/catalog/catalog-field-icon.d.ts +5 -0
- package/dist/types/adapters/browser/input/design/fields/CanvasFieldDesignPanel.d.ts +71 -0
- package/dist/types/adapters/browser/input/design/fields/ChoiceOptionsPanel.d.ts +35 -0
- package/dist/types/adapters/browser/input/design/fields/FieldAttachmentsPanel.d.ts +31 -0
- package/dist/types/adapters/browser/input/design/fields/attach-canvas-field-design.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/fields/controls.d.ts +21 -0
- package/dist/types/adapters/browser/input/design/fields/rules/FieldRulesPanel.d.ts +24 -0
- package/dist/types/adapters/browser/input/design/fields/rules/settings.d.ts +3 -0
- package/dist/types/adapters/browser/input/design/format/CanvasFormatPanel.d.ts +73 -0
- package/dist/types/adapters/browser/input/design/format/attach-canvas-format.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/format/controls.d.ts +22 -0
- package/dist/types/adapters/browser/input/design/objects/CanvasObjectHandles.d.ts +42 -0
- package/dist/types/adapters/browser/input/design/objects/attach-canvas-object-handles.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/objects/gesture-types.d.ts +52 -0
- package/dist/types/adapters/browser/input/design/objects/paint-object-handles.d.ts +6 -0
- package/dist/types/adapters/browser/input/design/objects/project-object-gesture.d.ts +4 -0
- package/dist/types/adapters/browser/input/design/objects/resize-geometry.d.ts +7 -0
- package/dist/types/adapters/browser/input/design/objects/types.d.ts +18 -0
- package/dist/types/adapters/browser/input/design/settings/StructuredSettingsPanel.d.ts +56 -0
- package/dist/types/adapters/browser/input/design/settings/builders.d.ts +16 -0
- package/dist/types/adapters/browser/input/design/settings/types.d.ts +57 -0
- package/dist/types/adapters/browser/input/design/tables/CanvasTableDesignPanel.d.ts +63 -0
- package/dist/types/adapters/browser/input/design/tables/CanvasTableEdges.d.ts +56 -0
- package/dist/types/adapters/browser/input/design/tables/attach-canvas-table-design.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/tables/regions/CanvasRegionDesignPanel.d.ts +84 -0
- package/dist/types/adapters/browser/input/design/tables/regions/CanvasTableRegionMarks.d.ts +29 -0
- package/dist/types/adapters/browser/input/design/tables/regions/attach-canvas-region-design.d.ts +13 -0
- package/dist/types/adapters/browser/input/design/tables/regions/metadata-form.d.ts +26 -0
- package/dist/types/adapters/browser/input/design/tables/regions/settings.d.ts +4 -0
- package/dist/types/adapters/browser/input/design/tables/table-context-menu.d.ts +3 -0
- package/dist/types/adapters/browser/input/design/types.d.ts +33 -0
- package/dist/types/adapters/browser/input/field-geometry.d.ts +50 -0
- package/dist/types/adapters/browser/input/geometry.d.ts +39 -0
- package/dist/types/adapters/browser/input/history/CanvasHistoryMarks.d.ts +41 -0
- package/dist/types/adapters/browser/input/history/types.d.ts +10 -0
- package/dist/types/adapters/browser/input/overlay-layer.d.ts +3 -0
- package/dist/types/adapters/browser/input/scrolling.d.ts +24 -0
- package/dist/types/adapters/browser/input/signature-panel.d.ts +23 -0
- package/dist/types/adapters/browser/input/text-overlay.d.ts +7 -0
- package/dist/types/adapters/browser/input/types.d.ts +89 -0
- package/dist/types/adapters/browser/input/validation/CanvasValidationMarks.d.ts +15 -0
- package/dist/types/adapters/browser/input/validation/CanvasValidationPanel.d.ts +116 -0
- package/dist/types/adapters/browser/input/validation/attach-canvas-validation-panel.d.ts +13 -0
- package/dist/types/adapters/browser/input/word-error-text.d.ts +6 -0
- package/dist/types/adapters/browser/print/print-pages.d.ts +12 -0
- package/dist/types/adapters/browser/print/record-page.d.ts +5 -0
- package/dist/types/adapters/browser/text/CanvasTextMeasurer.d.ts +27 -0
- package/dist/types/adapters/browser/text/apply-text-style.d.ts +5 -0
- package/dist/types/adapters/browser/text/types.d.ts +3 -0
- package/dist/types/adapters/browser/viewport.d.ts +7 -0
- package/dist/types/adapters/document/DocumentFontPreparation.d.ts +31 -0
- package/dist/types/adapters/document/WordCanvasHost.d.ts +131 -0
- package/dist/types/adapters/document/communication-values.d.ts +8 -0
- package/dist/types/adapters/document/field-options.d.ts +114 -0
- package/dist/types/adapters/document/types.d.ts +143 -0
- package/dist/types/adapters/platform/association-products.d.ts +12 -0
- package/dist/types/adapters/platform/barcode-rules.d.ts +24 -0
- package/dist/types/adapters/platform/business-formulas.d.ts +11 -0
- package/dist/types/adapters/platform/business-response.d.ts +2 -0
- package/dist/types/adapters/platform/device-reference-filter.d.ts +7 -0
- package/dist/types/adapters/platform/directory-references.d.ts +3 -0
- package/dist/types/adapters/platform/docx.d.ts +3 -0
- package/dist/types/adapters/platform/field-catalog/catalog.d.ts +12 -0
- package/dist/types/adapters/platform/field-catalog/field-business-rules.d.ts +28 -0
- package/dist/types/adapters/platform/field-catalog/field-definition.d.ts +14 -0
- package/dist/types/adapters/platform/field-catalog/field-options.d.ts +3 -0
- package/dist/types/adapters/platform/field-catalog/table-model-types.d.ts +5 -0
- package/dist/types/adapters/platform/field-defaults.d.ts +3 -0
- package/dist/types/adapters/platform/field-dialogs.d.ts +79 -0
- package/dist/types/adapters/platform/fill-ports.d.ts +23 -0
- package/dist/types/adapters/platform/fonts.d.ts +3 -0
- package/dist/types/adapters/platform/form-history-schema.d.ts +18 -0
- package/dist/types/adapters/platform/form-instance-actions.d.ts +51 -0
- package/dist/types/adapters/platform/form-instance-communication.d.ts +10 -0
- package/dist/types/adapters/platform/form-instance-data.d.ts +6 -0
- package/dist/types/adapters/platform/form-instance-history-view.d.ts +22 -0
- package/dist/types/adapters/platform/form-instance-history.d.ts +12 -0
- package/dist/types/adapters/platform/form-instance.d.ts +37 -0
- package/dist/types/adapters/platform/formula-functions.d.ts +90 -0
- package/dist/types/adapters/platform/formula-variables.d.ts +15 -0
- package/dist/types/adapters/platform/index.d.ts +2 -0
- package/dist/types/adapters/platform/lot-display-label.d.ts +4 -0
- package/dist/types/adapters/platform/material-instance.d.ts +24 -0
- package/dist/types/adapters/platform/material-services.d.ts +6 -0
- package/dist/types/adapters/platform/page-image.d.ts +8 -0
- package/dist/types/adapters/platform/product-release-lots.d.ts +3 -0
- package/dist/types/adapters/platform/readonly-records.d.ts +40 -0
- package/dist/types/adapters/platform/reference-columns.d.ts +21 -0
- package/dist/types/adapters/platform/reference-policies.d.ts +9 -0
- package/dist/types/adapters/platform/reference-read-scope.d.ts +26 -0
- package/dist/types/adapters/platform/reference-restrictions.d.ts +13 -0
- package/dist/types/adapters/platform/reference-source-policy.d.ts +12 -0
- package/dist/types/adapters/platform/reference-version-label.d.ts +4 -0
- package/dist/types/adapters/platform/rule-settings.d.ts +65 -0
- package/dist/types/adapters/platform/source-catalog.d.ts +39 -0
- package/dist/types/adapters/platform/source-executor.d.ts +3 -0
- package/dist/types/adapters/platform/source-ipaas.d.ts +14 -0
- package/dist/types/adapters/platform/special-field-values.d.ts +3 -0
- package/dist/types/adapters/platform/substitution-records.d.ts +11 -0
- package/dist/types/adapters/platform/table-references.d.ts +17 -0
- package/dist/types/adapters/platform/table-scan.d.ts +3 -0
- package/dist/types/adapters/platform/template-business-fields.d.ts +24 -0
- package/dist/types/adapters/platform/template-fields.d.ts +15 -0
- package/dist/types/adapters/platform/templates.d.ts +23 -0
- package/dist/types/adapters/platform/validation-model-names.d.ts +3 -0
- package/dist/types/adapters/platform/withdrawn-form-change.d.ts +15 -0
- package/dist/types/adapters/vue/BusinessTableActions.vue.d.ts +10 -0
- package/dist/types/adapters/vue/ChoiceFieldPanel.vue.d.ts +11 -0
- package/dist/types/adapters/vue/FieldSelectActions.vue.d.ts +31 -0
- package/dist/types/adapters/vue/GctWordPrintRenderer.vue.d.ts +33 -0
- package/dist/types/adapters/vue/GctWordTemplateComparison.vue.d.ts +6 -0
- package/dist/types/adapters/vue/GctWordTemplateDesigner.vue.d.ts +46 -0
- package/dist/types/adapters/vue/GctWordTemplatePreview.vue.d.ts +42 -0
- package/dist/types/adapters/vue/ReferenceFieldPanel.vue.d.ts +9 -0
- package/dist/types/adapters/vue/SignatureCardReader.vue.d.ts +8 -0
- package/dist/types/adapters/vue/SignatureFieldPanel.vue.d.ts +12 -0
- package/dist/types/adapters/vue/WordAttachmentList.vue.d.ts +10 -0
- package/dist/types/adapters/vue/WordDesigner.d.ts +99 -0
- package/dist/types/adapters/vue/WordDocumentLoading.vue.d.ts +8 -0
- package/dist/types/adapters/vue/WordPdfExportOptions.vue.d.ts +7 -0
- package/dist/types/adapters/vue/WordRenderer.d.ts +81 -0
- package/dist/types/adapters/vue/WordShortcutHelp.vue.d.ts +3 -0
- package/dist/types/adapters/vue/WordShortcutReference.vue.d.ts +3 -0
- package/dist/types/adapters/vue/WordTemplateImportStatus.vue.d.ts +6 -0
- package/dist/types/adapters/vue/business-table-actions.d.ts +2 -0
- package/dist/types/adapters/vue/choice-field-panel.d.ts +2 -0
- package/dist/types/adapters/vue/data-properties/WordCommunicationActions.vue.d.ts +32 -0
- package/dist/types/adapters/vue/data-properties/WordDataProperties.vue.d.ts +35 -0
- package/dist/types/adapters/vue/data-properties/WordObjectInitDialog.vue.d.ts +21 -0
- package/dist/types/adapters/vue/data-properties/WordObjectUserSelect.vue.d.ts +14 -0
- package/dist/types/adapters/vue/data-properties/WordOcrCamera.vue.d.ts +11 -0
- package/dist/types/adapters/vue/data-properties/WordOcrHistory.vue.d.ts +9 -0
- package/dist/types/adapters/vue/data-properties/WordRuntimeDataSources.vue.d.ts +8 -0
- package/dist/types/adapters/vue/data-properties/data-options.d.ts +8 -0
- package/dist/types/adapters/vue/data-properties/useWordFormCommunication.d.ts +32 -0
- package/dist/types/adapters/vue/data-properties/word-device-connections.d.ts +37 -0
- package/dist/types/adapters/vue/data-properties/word-object-ports.d.ts +5 -0
- package/dist/types/adapters/vue/data-properties/word-ocr-camera.d.ts +3 -0
- package/dist/types/adapters/vue/data-properties/word-source-ports.d.ts +4 -0
- package/dist/types/adapters/vue/field-dialog.d.ts +2 -0
- package/dist/types/adapters/vue/field-properties/FieldAttachmentList.vue.d.ts +17 -0
- package/dist/types/adapters/vue/field-properties/FieldAttributeValue.vue.d.ts +21 -0
- package/dist/types/adapters/vue/field-properties/FieldAutofill.vue.d.ts +14 -0
- package/dist/types/adapters/vue/field-properties/FieldAutofillDialog.vue.d.ts +21 -0
- package/dist/types/adapters/vue/field-properties/FieldBarcodeRules.vue.d.ts +13 -0
- package/dist/types/adapters/vue/field-properties/FieldBarcodeRulesDialog.vue.d.ts +17 -0
- package/dist/types/adapters/vue/field-properties/FieldChoiceOptionDialog.vue.d.ts +17 -0
- package/dist/types/adapters/vue/field-properties/FieldCommonRegex.vue.d.ts +16 -0
- package/dist/types/adapters/vue/field-properties/FieldDateSettings.vue.d.ts +9 -0
- package/dist/types/adapters/vue/field-properties/FieldDependencies.vue.d.ts +15 -0
- package/dist/types/adapters/vue/field-properties/FieldDependencyDialog.vue.d.ts +24 -0
- package/dist/types/adapters/vue/field-properties/FieldLabelHelp.vue.d.ts +25 -0
- package/dist/types/adapters/vue/field-properties/FieldOptionIcon.vue.d.ts +9 -0
- package/dist/types/adapters/vue/field-properties/FieldOptions.vue.d.ts +11 -0
- package/dist/types/adapters/vue/field-properties/FieldPropertyControl.vue.d.ts +14 -0
- package/dist/types/adapters/vue/field-properties/FieldRangeBound.vue.d.ts +18 -0
- package/dist/types/adapters/vue/field-properties/FieldRangeFormula.vue.d.ts +20 -0
- package/dist/types/adapters/vue/field-properties/FieldRangeSettings.vue.d.ts +12 -0
- package/dist/types/adapters/vue/field-properties/FieldRecordSelect.vue.d.ts +23 -0
- package/dist/types/adapters/vue/field-properties/FieldRegexEditor.vue.d.ts +16 -0
- package/dist/types/adapters/vue/field-properties/FieldRelationSettings.vue.d.ts +15 -0
- package/dist/types/adapters/vue/field-properties/FieldResourceSettings.vue.d.ts +12 -0
- package/dist/types/adapters/vue/field-properties/FieldSignatureDisplay.vue.d.ts +12 -0
- package/dist/types/adapters/vue/field-properties/FieldSignatureSettings.vue.d.ts +15 -0
- package/dist/types/adapters/vue/field-properties/FieldSpecialSettings.vue.d.ts +11 -0
- package/dist/types/adapters/vue/field-properties/FieldTemplateSelect.vue.d.ts +14 -0
- package/dist/types/adapters/vue/field-properties/FieldTextValidation.vue.d.ts +11 -0
- package/dist/types/adapters/vue/field-properties/WordFieldProperties.vue.d.ts +14 -0
- package/dist/types/adapters/vue/field-properties/field-autofill-presets.d.ts +14 -0
- package/dist/types/adapters/vue/field-properties/field-number-settings.d.ts +12 -0
- package/dist/types/adapters/vue/field-properties/field-panel-metadata.d.ts +15 -0
- package/dist/types/adapters/vue/field-properties/field-property-policy.d.ts +16 -0
- package/dist/types/adapters/vue/field-properties/field-rule-trees.d.ts +12 -0
- package/dist/types/adapters/vue/field-properties/field-targets.d.ts +20 -0
- package/dist/types/adapters/vue/field-type-label.d.ts +2 -0
- package/dist/types/adapters/vue/icons/paper.d.ts +23 -0
- package/dist/types/adapters/vue/icons/toolkit.d.ts +19 -0
- package/dist/types/adapters/vue/index.d.ts +26 -0
- package/dist/types/adapters/vue/open-template-comparison.d.ts +4 -0
- package/dist/types/adapters/vue/page-widget-properties/WidgetFieldDrop.vue.d.ts +20 -0
- package/dist/types/adapters/vue/page-widget-properties/WidgetImageUpload.vue.d.ts +16 -0
- package/dist/types/adapters/vue/page-widget-properties/WidgetLabelStyle.vue.d.ts +13 -0
- package/dist/types/adapters/vue/page-widget-properties/WidgetNumber.vue.d.ts +22 -0
- package/dist/types/adapters/vue/page-widget-properties/WidgetSize.vue.d.ts +21 -0
- package/dist/types/adapters/vue/page-widget-properties/WidgetTextArea.vue.d.ts +17 -0
- package/dist/types/adapters/vue/page-widget-properties/WordPageWidgetProperties.vue.d.ts +20 -0
- package/dist/types/adapters/vue/page-widget-properties/widget-options.d.ts +212 -0
- package/dist/types/adapters/vue/reference-field-options.d.ts +5 -0
- package/dist/types/adapters/vue/reference-field-panel.d.ts +2 -0
- package/dist/types/adapters/vue/region-properties/MaterialBomEntryDialog.vue.d.ts +16 -0
- package/dist/types/adapters/vue/region-properties/WordBusinessRegion.vue.d.ts +24 -0
- package/dist/types/adapters/vue/region-properties/WordMaterialTableSettings.vue.d.ts +17 -0
- package/dist/types/adapters/vue/region-properties/WordRegionConfirmDelete.vue.d.ts +9 -0
- package/dist/types/adapters/vue/region-properties/WordRegionGridInfo.vue.d.ts +13 -0
- package/dist/types/adapters/vue/region-properties/WordRepeatingTableSettings.vue.d.ts +24 -0
- package/dist/types/adapters/vue/renderWordWorkspace.d.ts +38 -0
- package/dist/types/adapters/vue/rule-properties/DecisionRuleGroup.vue.d.ts +21 -0
- package/dist/types/adapters/vue/rule-properties/InspectionRuleDialog.vue.d.ts +15 -0
- package/dist/types/adapters/vue/rule-properties/NotificationFieldPicker.vue.d.ts +13 -0
- package/dist/types/adapters/vue/rule-properties/NotificationRuleDialog.vue.d.ts +17 -0
- package/dist/types/adapters/vue/rule-properties/RuleFieldSelect.vue.d.ts +16 -0
- package/dist/types/adapters/vue/rule-properties/UnitConversionDialog.vue.d.ts +15 -0
- package/dist/types/adapters/vue/rule-properties/WordRuleProperties.vue.d.ts +18 -0
- package/dist/types/adapters/vue/rule-properties/inspection-prompt.d.ts +3 -0
- package/dist/types/adapters/vue/rule-properties/rule-draft.d.ts +9 -0
- package/dist/types/adapters/vue/signature-field-panel.d.ts +2 -0
- package/dist/types/adapters/vue/template-properties/SignatureRulesDialog.vue.d.ts +16 -0
- package/dist/types/adapters/vue/template-properties/WordFormSettings.vue.d.ts +12 -0
- package/dist/types/adapters/vue/temporal-field-panel.d.ts +2 -0
- package/dist/types/adapters/vue/types.d.ts +152 -0
- package/dist/types/adapters/vue/useGctTableAccess.d.ts +10 -0
- package/dist/types/adapters/vue/useGctWordInstance.d.ts +69 -0
- package/dist/types/adapters/vue/useWordWorkspace.d.ts +190 -0
- package/dist/types/adapters/vue/word-data-console.d.ts +27 -0
- package/dist/types/adapters/vue/word-designer-chrome.d.ts +16 -0
- package/dist/types/adapters/vue/word-designer-page.d.ts +10 -0
- package/dist/types/adapters/vue/word-designer-table-dialogs.d.ts +14 -0
- package/dist/types/adapters/vue/word-designer-table-menu.d.ts +23 -0
- package/dist/types/adapters/vue/word-instance-credentials.d.ts +3 -0
- package/dist/types/adapters/vue/word-readonly-browse.d.ts +16 -0
- package/dist/types/data/DataManager.d.ts +143 -0
- package/dist/types/data/index.d.ts +7 -0
- package/dist/types/data/paths/derived.d.ts +22 -0
- package/dist/types/data/paths/relations.d.ts +5 -0
- package/dist/types/data/post-change-pipeline.d.ts +30 -0
- package/dist/types/data/rows/active.d.ts +6 -0
- package/dist/types/data/services/DataChangeCoordinator.d.ts +60 -0
- package/dist/types/data/services/DataDefaults.d.ts +41 -0
- package/dist/types/data/services/DataDependencies.d.ts +40 -0
- package/dist/types/data/services/DataInitialization.d.ts +24 -0
- package/dist/types/data/services/DataMatrix.d.ts +45 -0
- package/dist/types/data/services/DataRows.d.ts +25 -0
- package/dist/types/data/services/DataRuntimeConfiguration.d.ts +21 -0
- package/dist/types/data/services/DataValues.d.ts +47 -0
- package/dist/types/data/services/DataWriteBatch.d.ts +14 -0
- package/dist/types/data/services/JsonDataPaths.d.ts +25 -0
- package/dist/types/data/services/context.d.ts +34 -0
- package/dist/types/data/services/create-data-services.d.ts +5 -0
- package/dist/types/data/services/lifetime.d.ts +26 -0
- package/dist/types/data/types/configuration.d.ts +21 -0
- package/dist/types/data/types/manager.d.ts +51 -0
- package/dist/types/data/types/rules.d.ts +42 -0
- package/dist/types/data/types/values.d.ts +46 -0
- package/dist/types/data/value-semantics/classify.d.ts +17 -0
- package/dist/types/data/value-semantics/collection.d.ts +17 -0
- package/dist/types/data/value-semantics/index.d.ts +7 -0
- package/dist/types/data/value-semantics/policy.d.ts +13 -0
- package/dist/types/data/value-semantics/scalars.d.ts +20 -0
- package/dist/types/data/value-semantics/types.d.ts +76 -0
- package/dist/types/data/value-semantics/validation.d.ts +16 -0
- package/dist/types/import/docx/content.d.ts +38 -0
- package/dist/types/import/docx/index.d.ts +4 -0
- package/dist/types/import/docx/math-image.d.ts +9 -0
- package/dist/types/import/docx/mathml.d.ts +3 -0
- package/dist/types/import/docx/numbering.d.ts +26 -0
- package/dist/types/import/docx/source.d.ts +40 -0
- package/dist/types/import/docx/styles.d.ts +33 -0
- package/dist/types/import/docx/tables.d.ts +7 -0
- package/dist/types/import/docx/types.d.ts +30 -0
- package/dist/types/layout/cache/BoundedMeasurementCache.d.ts +37 -0
- package/dist/types/layout/cache/ControlMeasurementCache.d.ts +33 -0
- package/dist/types/layout/cache/DocumentLayoutWorkspace.d.ts +47 -0
- package/dist/types/layout/cache/ParagraphMeasurementCache.d.ts +41 -0
- package/dist/types/layout/cache/TableMeasurementCache.d.ts +40 -0
- package/dist/types/layout/cache/TextMeasurementCache.d.ts +26 -0
- package/dist/types/layout/cache/data.d.ts +5 -0
- package/dist/types/layout/cache/environment.d.ts +25 -0
- package/dist/types/layout/cache/style-key.d.ts +8 -0
- package/dist/types/layout/cache/table-key.d.ts +9 -0
- package/dist/types/layout/coordinates.d.ts +10 -0
- package/dist/types/layout/engine/DocumentLayoutBuilder.d.ts +15 -0
- package/dist/types/layout/engine/atoms/code-widgets.d.ts +16 -0
- package/dist/types/layout/engine/atoms/control-decoration.d.ts +6 -0
- package/dist/types/layout/engine/atoms/control-flow.d.ts +8 -0
- package/dist/types/layout/engine/atoms/diagonal.d.ts +28 -0
- package/dist/types/layout/engine/atoms/field-control-window.d.ts +6 -0
- package/dist/types/layout/engine/atoms/field-control.d.ts +53 -0
- package/dist/types/layout/engine/atoms/fit-atomic.d.ts +23 -0
- package/dist/types/layout/engine/atoms/images.d.ts +10 -0
- package/dist/types/layout/engine/atoms/leading-image.d.ts +5 -0
- package/dist/types/layout/engine/atoms/page-widgets.d.ts +69 -0
- package/dist/types/layout/engine/atoms/seals.d.ts +7 -0
- package/dist/types/layout/engine/atoms/signatures.d.ts +7 -0
- package/dist/types/layout/engine/blocks/measure-blocks.d.ts +54 -0
- package/dist/types/layout/engine/blocks/place-blocks.d.ts +26 -0
- package/dist/types/layout/engine/context.d.ts +67 -0
- package/dist/types/layout/engine/measurement.d.ts +5 -0
- package/dist/types/layout/engine/pages/finalize-codes.d.ts +5 -0
- package/dist/types/layout/engine/pages/overlay-pages.d.ts +8 -0
- package/dist/types/layout/engine/pages/overlays.d.ts +5 -0
- package/dist/types/layout/engine/pages/page-regions.d.ts +29 -0
- package/dist/types/layout/engine/pagination/content-flow.d.ts +92 -0
- package/dist/types/layout/engine/pagination/content-page-break.d.ts +4 -0
- package/dist/types/layout/engine/pagination/line-flow.d.ts +85 -0
- package/dist/types/layout/engine/pagination/page.d.ts +14 -0
- package/dist/types/layout/engine/pagination/paragraph-pagination.d.ts +6 -0
- package/dist/types/layout/engine/pagination/place-line.d.ts +8 -0
- package/dist/types/layout/engine/pagination/placement-occurrence.d.ts +7 -0
- package/dist/types/layout/engine/pagination/placement-window.d.ts +17 -0
- package/dist/types/layout/engine/paragraph/justify-line.d.ts +6 -0
- package/dist/types/layout/engine/paragraph/paragraph-lines.d.ts +5 -0
- package/dist/types/layout/engine/paragraph/paragraph-sources.d.ts +72 -0
- package/dist/types/layout/engine/paragraph/prepare-paragraph.d.ts +29 -0
- package/dist/types/layout/engine/paragraph/text-vertical.d.ts +11 -0
- package/dist/types/layout/engine/paragraph/types.d.ts +223 -0
- package/dist/types/layout/engine/tables/cell-images.d.ts +4 -0
- package/dist/types/layout/engine/tables/fit-cell-content.d.ts +12 -0
- package/dist/types/layout/engine/tables/measure-table.d.ts +10 -0
- package/dist/types/layout/engine/tables/place-table-page.d.ts +6 -0
- package/dist/types/layout/engine/tables/place-table-window.d.ts +18 -0
- package/dist/types/layout/engine/tables/row-flow.d.ts +108 -0
- package/dist/types/layout/engine/tables/table-border-plan.d.ts +42 -0
- package/dist/types/layout/engine/tables/table-borders.d.ts +17 -0
- package/dist/types/layout/engine/tables/table-column-sizing.d.ts +12 -0
- package/dist/types/layout/engine/tables/table-flow-index.d.ts +49 -0
- package/dist/types/layout/engine/tables/table-flow.d.ts +91 -0
- package/dist/types/layout/engine/tables/table-headers.d.ts +6 -0
- package/dist/types/layout/engine/tables/table-pagination.d.ts +7 -0
- package/dist/types/layout/engine/tables/table-presentation-groups.d.ts +11 -0
- package/dist/types/layout/engine/tables/table-row-sizing.d.ts +31 -0
- package/dist/types/layout/engine/tables/table-types.d.ts +101 -0
- package/dist/types/layout/errors.d.ts +10 -0
- package/dist/types/layout/geometry/rectangles.d.ts +8 -0
- package/dist/types/layout/geometry/text.d.ts +16 -0
- package/dist/types/layout/guards.d.ts +57 -0
- package/dist/types/layout/image-source.d.ts +4 -0
- package/dist/types/layout/incremental/IncrementalPaginationWorkspace.d.ts +86 -0
- package/dist/types/layout/incremental/eligibility.d.ts +35 -0
- package/dist/types/layout/incremental/invalidation.d.ts +6 -0
- package/dist/types/layout/incremental/recorder.d.ts +34 -0
- package/dist/types/layout/incremental/replay.d.ts +6 -0
- package/dist/types/layout/incremental/table-pagination.d.ts +13 -0
- package/dist/types/layout/incremental/types.d.ts +127 -0
- package/dist/types/layout/index.d.ts +32 -0
- package/dist/types/layout/instances/table-grid.d.ts +9 -0
- package/dist/types/layout/ports/input.d.ts +87 -0
- package/dist/types/layout/ports/measurement.d.ts +37 -0
- package/dist/types/layout/ports/presentation.d.ts +131 -0
- package/dist/types/layout/query/LayoutQuery.d.ts +59 -0
- package/dist/types/layout/query/cache/QueryIndexWorkspace.d.ts +50 -0
- package/dist/types/layout/query/cache/immutable.d.ts +3 -0
- package/dist/types/layout/query/cache/types.d.ts +69 -0
- package/dist/types/layout/query/fragment-styles.d.ts +7 -0
- package/dist/types/layout/query/index-instances.d.ts +4 -0
- package/dist/types/layout/query/index-result.d.ts +36 -0
- package/dist/types/layout/query/validation.d.ts +26 -0
- package/dist/types/layout/session/LayoutSession.d.ts +80 -0
- package/dist/types/layout/session/errors.d.ts +22 -0
- package/dist/types/layout/session/registrations.d.ts +23 -0
- package/dist/types/layout/source.d.ts +13 -0
- package/dist/types/layout/styles/resolve-text-style.d.ts +8 -0
- package/dist/types/layout/synchronous.d.ts +3 -0
- package/dist/types/layout/types/cache.d.ts +24 -0
- package/dist/types/layout/types/endpoint.d.ts +16 -0
- package/dist/types/layout/types/fragments.d.ts +179 -0
- package/dist/types/layout/types/geometry.d.ts +37 -0
- package/dist/types/layout/types/identity.d.ts +66 -0
- package/dist/types/layout/types/presentation/codes.d.ts +64 -0
- package/dist/types/layout/types/presentation/controls.d.ts +202 -0
- package/dist/types/layout/types/presentation/images.d.ts +30 -0
- package/dist/types/layout/types/presentation/overlays.d.ts +74 -0
- package/dist/types/layout/types/presentation/seals.d.ts +24 -0
- package/dist/types/layout/types/presentation/signatures.d.ts +20 -0
- package/dist/types/layout/types/presentation/widgets.d.ts +74 -0
- package/dist/types/layout/types/query.d.ts +139 -0
- package/dist/types/layout/types/result.d.ts +80 -0
- package/dist/types/layout/types/session.d.ts +61 -0
- package/dist/types/layout/types/source.d.ts +88 -0
- package/dist/types/layout/types/text.d.ts +35 -0
- package/dist/types/layout/units.d.ts +15 -0
- package/dist/types/layout/versions.d.ts +9 -0
- package/dist/types/model/business/business-schema.d.ts +9 -0
- package/dist/types/model/business/business-types.d.ts +326 -0
- package/dist/types/model/business/communication-schema.d.ts +3 -0
- package/dist/types/model/business/data-source-schema.d.ts +11 -0
- package/dist/types/model/business/data-source-types.d.ts +134 -0
- package/dist/types/model/business/document-business-schema.d.ts +7 -0
- package/dist/types/model/business/document-business-types.d.ts +170 -0
- package/dist/types/model/business/document-signature-schema.d.ts +7 -0
- package/dist/types/model/business/exception-highlight.d.ts +4 -0
- package/dist/types/model/business/field-schema-common.d.ts +35 -0
- package/dist/types/model/business/initialization-schema.d.ts +7 -0
- package/dist/types/model/business/initialization-types.d.ts +167 -0
- package/dist/types/model/business/material-schema.d.ts +12 -0
- package/dist/types/model/business/material-types.d.ts +154 -0
- package/dist/types/model/business/number-minimum.d.ts +2 -0
- package/dist/types/model/business/page-widget-schema.d.ts +7 -0
- package/dist/types/model/business/page-widget-types.d.ts +144 -0
- package/dist/types/model/business/product-autofill.d.ts +16 -0
- package/dist/types/model/business/relation-schema.d.ts +7 -0
- package/dist/types/model/business/relation-types.d.ts +110 -0
- package/dist/types/model/business/table-field-defaults.d.ts +14 -0
- package/dist/types/model/business/table-variants.d.ts +21 -0
- package/dist/types/model/config/config-references.d.ts +30 -0
- package/dist/types/model/config/config-registry.d.ts +34 -0
- package/dist/types/model/config/config-types.d.ts +29 -0
- package/dist/types/model/config/config-uses.d.ts +22 -0
- package/dist/types/model/editor/ModelEditor.d.ts +209 -0
- package/dist/types/model/editor/NodeEditor.d.ts +80 -0
- package/dist/types/model/editor/NodeFactory.d.ts +65 -0
- package/dist/types/model/editor/RangeEditor.d.ts +97 -0
- package/dist/types/model/editor/TableEditor.d.ts +76 -0
- package/dist/types/model/editor/cell-paste.d.ts +5 -0
- package/dist/types/model/editor/change-set-types.d.ts +169 -0
- package/dist/types/model/editor/change-set-validation.d.ts +7 -0
- package/dist/types/model/editor/change-set.d.ts +11 -0
- package/dist/types/model/editor/content-fragment.d.ts +6 -0
- package/dist/types/model/editor/create-document.d.ts +20 -0
- package/dist/types/model/editor/cross-container-edit.d.ts +16 -0
- package/dist/types/model/editor/editing-context.d.ts +54 -0
- package/dist/types/model/editor/editor-data.d.ts +25 -0
- package/dist/types/model/editor/factory-types.d.ts +172 -0
- package/dist/types/model/editor/factory-validation.d.ts +18 -0
- package/dist/types/model/editor/format-update.d.ts +9 -0
- package/dist/types/model/editor/fragment-appearance.d.ts +4 -0
- package/dist/types/model/editor/fragment-data.d.ts +18 -0
- package/dist/types/model/editor/history-types.d.ts +8 -0
- package/dist/types/model/editor/model-editor-types.d.ts +59 -0
- package/dist/types/model/editor/node-edit-types.d.ts +146 -0
- package/dist/types/model/editor/operation-engine.d.ts +29 -0
- package/dist/types/model/editor/range-edit-types.d.ts +93 -0
- package/dist/types/model/editor/section-copy.d.ts +5 -0
- package/dist/types/model/editor/table-edit-types.d.ts +75 -0
- package/dist/types/model/editor/table-fragment.d.ts +6 -0
- package/dist/types/model/index.d.ts +42 -0
- package/dist/types/model/query/ModelQuery.d.ts +114 -0
- package/dist/types/model/query/compare-field-configurations.d.ts +47 -0
- package/dist/types/model/query/content-tree.d.ts +36 -0
- package/dist/types/model/query/derive-style.d.ts +6 -0
- package/dist/types/model/query/document-comparison/compare-document-content.d.ts +8 -0
- package/dist/types/model/query/document-comparison/matching.d.ts +7 -0
- package/dist/types/model/query/document-comparison/normalize.d.ts +4 -0
- package/dist/types/model/query/document-comparison/projection.d.ts +10 -0
- package/dist/types/model/query/document-comparison/types.d.ts +79 -0
- package/dist/types/model/query/entity-index.d.ts +55 -0
- package/dist/types/model/query/normalize-binding.d.ts +5 -0
- package/dist/types/model/query/query-types.d.ts +211 -0
- package/dist/types/model/query/reference-query.d.ts +17 -0
- package/dist/types/model/query/section-copy-roots.d.ts +4 -0
- package/dist/types/model/query/section-removal.d.ts +4 -0
- package/dist/types/model/query/table-geometry.d.ts +24 -0
- package/dist/types/model/query/table-query.d.ts +24 -0
- package/dist/types/model/query/template-save-validation.d.ts +13 -0
- package/dist/types/model/serialization/codec.d.ts +21 -0
- package/dist/types/model/serialization/fragment-types.d.ts +37 -0
- package/dist/types/model/serialization/fragment.d.ts +10 -0
- package/dist/types/model/types/content.d.ts +59 -0
- package/dist/types/model/types/document.d.ts +54 -0
- package/dist/types/model/types/fields.d.ts +145 -0
- package/dist/types/model/types/primitives.d.ts +61 -0
- package/dist/types/model/types/resources.d.ts +54 -0
- package/dist/types/model/types/sections.d.ts +91 -0
- package/dist/types/model/types/styles.d.ts +185 -0
- package/dist/types/model/types/tables.d.ts +110 -0
- package/dist/types/model/types/widgets.d.ts +49 -0
- package/dist/types/model/types.d.ts +19 -0
- package/dist/types/model/validation/json-data.d.ts +23 -0
- package/dist/types/model/validation/schema.d.ts +126 -0
- package/dist/types/model/validation/validation.d.ts +45 -0
- package/dist/types/output/pdf/encode-pdf.d.ts +9 -0
- package/dist/types/output/pdf/index.d.ts +4 -0
- package/dist/types/runtime/form/NativeBusinessFields.d.ts +149 -0
- package/dist/types/runtime/form/NativeDataServices.d.ts +76 -0
- package/dist/types/runtime/form/attach-session-data.d.ts +6 -0
- package/dist/types/runtime/form/business/attachments/NativeResources.d.ts +37 -0
- package/dist/types/runtime/form/business/attachments/index.d.ts +3 -0
- package/dist/types/runtime/form/business/attachments/types.d.ts +57 -0
- package/dist/types/runtime/form/business/attachments/values.d.ts +19 -0
- package/dist/types/runtime/form/business/authentication-value.d.ts +4 -0
- package/dist/types/runtime/form/business/browse/action-values.d.ts +9 -0
- package/dist/types/runtime/form/business/document-rules/inspection.d.ts +4 -0
- package/dist/types/runtime/form/business/inspection/NativeCheckFields.d.ts +34 -0
- package/dist/types/runtime/form/business/inspection/NativeInspectionInitialization.d.ts +66 -0
- package/dist/types/runtime/form/business/inspection/identity.d.ts +11 -0
- package/dist/types/runtime/form/business/inspection/index.d.ts +3 -0
- package/dist/types/runtime/form/business/inspection/types.d.ts +40 -0
- package/dist/types/runtime/form/business/materials/NativeMaterialInitialization.d.ts +42 -0
- package/dist/types/runtime/form/business/materials/NativeMaterialObjects.d.ts +36 -0
- package/dist/types/runtime/form/business/materials/NativeMaterialSelection.d.ts +48 -0
- package/dist/types/runtime/form/business/materials/NativeMaterials.d.ts +94 -0
- package/dist/types/runtime/form/business/materials/conversion/NativeMaterialConversions.d.ts +73 -0
- package/dist/types/runtime/form/business/materials/conversion/plan.d.ts +45 -0
- package/dist/types/runtime/form/business/materials/conversion/types.d.ts +39 -0
- package/dist/types/runtime/form/business/materials/entries.d.ts +7 -0
- package/dist/types/runtime/form/business/materials/groups.d.ts +5 -0
- package/dist/types/runtime/form/business/materials/index.d.ts +13 -0
- package/dist/types/runtime/form/business/materials/object-fields.d.ts +15 -0
- package/dist/types/runtime/form/business/materials/rows/NativeMaterialEditing.d.ts +54 -0
- package/dist/types/runtime/form/business/materials/rows/NativeMaterialRows.d.ts +54 -0
- package/dist/types/runtime/form/business/materials/rows/append-row.d.ts +6 -0
- package/dist/types/runtime/form/business/materials/rows/types.d.ts +36 -0
- package/dist/types/runtime/form/business/materials/scan/NativeMaterialScan.d.ts +29 -0
- package/dist/types/runtime/form/business/materials/scan/barcode.d.ts +19 -0
- package/dist/types/runtime/form/business/materials/scan/plan.d.ts +21 -0
- package/dist/types/runtime/form/business/materials/scan/types.d.ts +86 -0
- package/dist/types/runtime/form/business/materials/scan/write.d.ts +6 -0
- package/dist/types/runtime/form/business/materials/selection-policy.d.ts +12 -0
- package/dist/types/runtime/form/business/materials/table-access.d.ts +13 -0
- package/dist/types/runtime/form/business/materials/task-context.d.ts +26 -0
- package/dist/types/runtime/form/business/materials/types.d.ts +145 -0
- package/dist/types/runtime/form/business/materials/validation/NativeMaterialActions.d.ts +52 -0
- package/dist/types/runtime/form/business/materials/validation/NativeMaterialTableValidator.d.ts +42 -0
- package/dist/types/runtime/form/business/materials/validation/NativeMaterialValidator.d.ts +43 -0
- package/dist/types/runtime/form/business/materials/validation/group.d.ts +46 -0
- package/dist/types/runtime/form/business/materials/validation/lot.d.ts +10 -0
- package/dist/types/runtime/form/business/materials/validation/object-types.d.ts +66 -0
- package/dist/types/runtime/form/business/materials/validation/object.d.ts +24 -0
- package/dist/types/runtime/form/business/materials/validation/quantity.d.ts +18 -0
- package/dist/types/runtime/form/business/materials/validation/sequence.d.ts +9 -0
- package/dist/types/runtime/form/business/materials/validation/table-plan.d.ts +19 -0
- package/dist/types/runtime/form/business/materials/validation/table-types.d.ts +28 -0
- package/dist/types/runtime/form/business/materials/validation/types.d.ts +121 -0
- package/dist/types/runtime/form/business/objects/index.d.ts +2 -0
- package/dist/types/runtime/form/business/objects/submission.d.ts +5 -0
- package/dist/types/runtime/form/business/objects/targets.d.ts +6 -0
- package/dist/types/runtime/form/business/references/NativeReferenceScanner.d.ts +46 -0
- package/dist/types/runtime/form/business/references/NativeReferences.d.ts +124 -0
- package/dist/types/runtime/form/business/references/groups.d.ts +18 -0
- package/dist/types/runtime/form/business/references/id-changes.d.ts +3 -0
- package/dist/types/runtime/form/business/references/index.d.ts +5 -0
- package/dist/types/runtime/form/business/references/lot-values.d.ts +16 -0
- package/dist/types/runtime/form/business/references/read-scopes.d.ts +25 -0
- package/dist/types/runtime/form/business/references/records.d.ts +13 -0
- package/dist/types/runtime/form/business/references/scan-mapping.d.ts +9 -0
- package/dist/types/runtime/form/business/references/scan-types.d.ts +36 -0
- package/dist/types/runtime/form/business/references/types.d.ts +186 -0
- package/dist/types/runtime/form/business/references/validation.d.ts +19 -0
- package/dist/types/runtime/form/business/references/values.d.ts +19 -0
- package/dist/types/runtime/form/business/seals/NativeSeals.d.ts +47 -0
- package/dist/types/runtime/form/business/seals/index.d.ts +4 -0
- package/dist/types/runtime/form/business/seals/position-validators.d.ts +9 -0
- package/dist/types/runtime/form/business/seals/source.d.ts +5 -0
- package/dist/types/runtime/form/business/seals/types.d.ts +68 -0
- package/dist/types/runtime/form/business/seals/value-contract.d.ts +15 -0
- package/dist/types/runtime/form/business/seals/values.d.ts +10 -0
- package/dist/types/runtime/form/business/signatures/NativeSignatures.d.ts +51 -0
- package/dist/types/runtime/form/business/signatures/autofill.d.ts +9 -0
- package/dist/types/runtime/form/business/signatures/device-signature-lock.d.ts +10 -0
- package/dist/types/runtime/form/business/signatures/index.d.ts +4 -0
- package/dist/types/runtime/form/business/signatures/mutex.d.ts +16 -0
- package/dist/types/runtime/form/business/signatures/types.d.ts +59 -0
- package/dist/types/runtime/form/business/signatures/validation.d.ts +43 -0
- package/dist/types/runtime/form/business/signatures/values.d.ts +19 -0
- package/dist/types/runtime/form/business/tables/NativeBusinessTables.d.ts +34 -0
- package/dist/types/runtime/form/business/tables/NativeTableQuickFill.d.ts +28 -0
- package/dist/types/runtime/form/business/tables/enrichers.d.ts +4 -0
- package/dist/types/runtime/form/business/tables/fields/access.d.ts +6 -0
- package/dist/types/runtime/form/business/tables/fields/clear-policies.d.ts +16 -0
- package/dist/types/runtime/form/business/tables/fields/clear-updates.d.ts +5 -0
- package/dist/types/runtime/form/business/tables/fields/context.d.ts +35 -0
- package/dist/types/runtime/form/business/tables/fields/location-link.d.ts +15 -0
- package/dist/types/runtime/form/business/tables/fields/selection-types.d.ts +88 -0
- package/dist/types/runtime/form/business/tables/fields/selection.d.ts +22 -0
- package/dist/types/runtime/form/business/tables/index.d.ts +12 -0
- package/dist/types/runtime/form/business/tables/initialization/NativeTableInitialization.d.ts +39 -0
- package/dist/types/runtime/form/business/tables/initialization/context-assignments.d.ts +7 -0
- package/dist/types/runtime/form/business/tables/initialization/rows.d.ts +5 -0
- package/dist/types/runtime/form/business/tables/initialization/types.d.ts +64 -0
- package/dist/types/runtime/form/business/tables/inventory-records.d.ts +48 -0
- package/dist/types/runtime/form/business/tables/inventory-values.d.ts +3 -0
- package/dist/types/runtime/form/business/tables/quantities.d.ts +4 -0
- package/dist/types/runtime/form/business/tables/quick-fill-layout.d.ts +5 -0
- package/dist/types/runtime/form/business/tables/quick-fill-matrix.d.ts +27 -0
- package/dist/types/runtime/form/business/tables/quick-fill-types.d.ts +79 -0
- package/dist/types/runtime/form/business/tables/quick-fill-values.d.ts +4 -0
- package/dist/types/runtime/form/business/tables/row-fields.d.ts +17 -0
- package/dist/types/runtime/form/business/tables/scan/NativeTableScan.d.ts +24 -0
- package/dist/types/runtime/form/business/tables/scan/plan.d.ts +39 -0
- package/dist/types/runtime/form/business/tables/scan/types.d.ts +132 -0
- package/dist/types/runtime/form/business/tables/scan/values.d.ts +3 -0
- package/dist/types/runtime/form/business/tables/scan/variants.d.ts +5 -0
- package/dist/types/runtime/form/business/tables/submission-notices.d.ts +3 -0
- package/dist/types/runtime/form/business/tables/types.d.ts +103 -0
- package/dist/types/runtime/form/contracts/services.d.ts +51 -0
- package/dist/types/runtime/form/enrichers.d.ts +5 -0
- package/dist/types/runtime/form/fields/actions.d.ts +4 -0
- package/dist/types/runtime/form/fields/adapters/value-helpers.d.ts +8 -0
- package/dist/types/runtime/form/fields/adapters/values.d.ts +14 -0
- package/dist/types/runtime/form/fields/contracts/actions.d.ts +29 -0
- package/dist/types/runtime/form/fields/contracts/behavior.d.ts +97 -0
- package/dist/types/runtime/form/fields/contracts/declarations.d.ts +47 -0
- package/dist/types/runtime/form/fields/contracts/state.d.ts +49 -0
- package/dist/types/runtime/form/fields/core/NativeDataQuery.d.ts +135 -0
- package/dist/types/runtime/form/fields/core/NativeDataRuntime.d.ts +52 -0
- package/dist/types/runtime/form/fields/core/declaration-changes.d.ts +4 -0
- package/dist/types/runtime/form/fields/core/index.d.ts +7 -0
- package/dist/types/runtime/form/fields/core/participation/conditions.d.ts +9 -0
- package/dist/types/runtime/form/fields/core/participation/snapshot.d.ts +3 -0
- package/dist/types/runtime/form/fields/core/participation/targets.d.ts +4 -0
- package/dist/types/runtime/form/fields/core/participation/types.d.ts +61 -0
- package/dist/types/runtime/form/fields/core/paths.d.ts +33 -0
- package/dist/types/runtime/form/fields/core/query/model-policies.d.ts +19 -0
- package/dist/types/runtime/form/fields/core/rules/CommonFieldRules.d.ts +56 -0
- package/dist/types/runtime/form/fields/core/rules/companion-updates.d.ts +4 -0
- package/dist/types/runtime/form/fields/core/rules/enrichers.d.ts +5 -0
- package/dist/types/runtime/form/fields/core/rules/state.d.ts +9 -0
- package/dist/types/runtime/form/fields/core/rules/types.d.ts +34 -0
- package/dist/types/runtime/form/fields/core/rules/values.d.ts +11 -0
- package/dist/types/runtime/form/fields/core/runtime-paths.d.ts +5 -0
- package/dist/types/runtime/form/fields/core/table-slots.d.ts +26 -0
- package/dist/types/runtime/form/fields/core/tables/bounded-projection.d.ts +24 -0
- package/dist/types/runtime/form/fields/core/tables/matrix-projection.d.ts +46 -0
- package/dist/types/runtime/form/fields/core/tables/matrix-references.d.ts +4 -0
- package/dist/types/runtime/form/fields/core/types.d.ts +27 -0
- package/dist/types/runtime/form/fields/core/value-encoding.d.ts +7 -0
- package/dist/types/runtime/form/fields/declarations.d.ts +15 -0
- package/dist/types/runtime/form/fields/index.d.ts +4 -0
- package/dist/types/runtime/form/fields/semantics/numbers.d.ts +30 -0
- package/dist/types/runtime/form/fields/semantics/values.d.ts +14 -0
- package/dist/types/runtime/form/fills/NativeFieldFills.d.ts +68 -0
- package/dist/types/runtime/form/fills/index.d.ts +3 -0
- package/dist/types/runtime/form/fills/paths.d.ts +14 -0
- package/dist/types/runtime/form/fills/protection.d.ts +5 -0
- package/dist/types/runtime/form/fills/targets.d.ts +69 -0
- package/dist/types/runtime/form/fills/types.d.ts +44 -0
- package/dist/types/runtime/form/index.d.ts +20 -0
- package/dist/types/runtime/form/initialization/declarations.d.ts +11 -0
- package/dist/types/runtime/form/initialization/index.d.ts +4 -0
- package/dist/types/runtime/form/initialization/parameter-values.d.ts +4 -0
- package/dist/types/runtime/form/initialization/parameters/NativeParameterInitializer.d.ts +24 -0
- package/dist/types/runtime/form/initialization/parameters/index.d.ts +3 -0
- package/dist/types/runtime/form/initialization/parameters/targets.d.ts +7 -0
- package/dist/types/runtime/form/initialization/parameters/types.d.ts +93 -0
- package/dist/types/runtime/form/initialization/parameters/values.d.ts +2 -0
- package/dist/types/runtime/form/initialization/policy.d.ts +31 -0
- package/dist/types/runtime/form/initialization/queries/NativeDataInitializer.d.ts +37 -0
- package/dist/types/runtime/form/initialization/queries/index.d.ts +3 -0
- package/dist/types/runtime/form/initialization/queries/plan.d.ts +30 -0
- package/dist/types/runtime/form/initialization/queries/request.d.ts +22 -0
- package/dist/types/runtime/form/initialization/queries/run.d.ts +29 -0
- package/dist/types/runtime/form/initialization/queries/types.d.ts +162 -0
- package/dist/types/runtime/form/initialization/special-field-values.d.ts +18 -0
- package/dist/types/runtime/form/shared/barcodes.d.ts +4 -0
- package/dist/types/runtime/form/shared/capabilities.d.ts +18 -0
- package/dist/types/runtime/form/shared/identity.d.ts +2 -0
- package/dist/types/runtime/form/shared/requests.d.ts +4 -0
- package/dist/types/runtime/form/shared/row.d.ts +8 -0
- package/dist/types/runtime/form/shared/runtime-request.d.ts +6 -0
- package/dist/types/runtime/form/sources/NativeDataSources.d.ts +87 -0
- package/dist/types/runtime/form/sources/definitions.d.ts +9 -0
- package/dist/types/runtime/form/sources/errors.d.ts +6 -0
- package/dist/types/runtime/form/sources/index.d.ts +6 -0
- package/dist/types/runtime/form/sources/job.d.ts +116 -0
- package/dist/types/runtime/form/sources/parameters.d.ts +8 -0
- package/dist/types/runtime/form/sources/preview.d.ts +13 -0
- package/dist/types/runtime/form/sources/script.d.ts +32 -0
- package/dist/types/runtime/form/sources/types.d.ts +92 -0
- package/dist/types/runtime/form/sources/values.d.ts +13 -0
- package/dist/types/runtime/form/submission/NativeSubmissionCoordinator.d.ts +30 -0
- package/dist/types/runtime/form/submission/capture.d.ts +4 -0
- package/dist/types/runtime/form/submission/clean-data.d.ts +3 -0
- package/dist/types/runtime/form/submission/coordinator-types.d.ts +99 -0
- package/dist/types/runtime/form/submission/create-submission-data.d.ts +4 -0
- package/dist/types/runtime/form/submission/index.d.ts +5 -0
- package/dist/types/runtime/form/submission/matrix-records.d.ts +10 -0
- package/dist/types/runtime/form/submission/types.d.ts +60 -0
- package/dist/types/runtime/form/types.d.ts +46 -0
- package/dist/types/runtime/form/validation/NativeFieldValidation.d.ts +45 -0
- package/dist/types/runtime/form/validation/NativeValidator.d.ts +24 -0
- package/dist/types/runtime/form/validation/admission.d.ts +27 -0
- package/dist/types/runtime/form/validation/description.d.ts +5 -0
- package/dist/types/runtime/form/validation/empty.d.ts +2 -0
- package/dist/types/runtime/form/validation/index.d.ts +3 -0
- package/dist/types/runtime/form/validation/rules.d.ts +8 -0
- package/dist/types/runtime/form/validation/targets.d.ts +4 -0
- package/dist/types/runtime/form/validation/types.d.ts +104 -0
- package/dist/types/runtime/interaction/EditorController.d.ts +242 -0
- package/dist/types/runtime/interaction/attach-native-interaction.d.ts +13 -0
- package/dist/types/runtime/interaction/browse/EditorReadonlyActions.d.ts +34 -0
- package/dist/types/runtime/interaction/browse/media-preview.d.ts +4 -0
- package/dist/types/runtime/interaction/browse/types.d.ts +114 -0
- package/dist/types/runtime/interaction/business/EditorBusinessFields.d.ts +49 -0
- package/dist/types/runtime/interaction/business/materials/EditorMaterials.d.ts +36 -0
- package/dist/types/runtime/interaction/business/materials/types.d.ts +61 -0
- package/dist/types/runtime/interaction/business/state.d.ts +7 -0
- package/dist/types/runtime/interaction/business/tables/EditorBusinessTables.d.ts +55 -0
- package/dist/types/runtime/interaction/business/tables/types.d.ts +33 -0
- package/dist/types/runtime/interaction/business/types.d.ts +104 -0
- package/dist/types/runtime/interaction/clipboard/bindings.d.ts +8 -0
- package/dist/types/runtime/interaction/clipboard/external.d.ts +37 -0
- package/dist/types/runtime/interaction/clipboard/fragment.d.ts +19 -0
- package/dist/types/runtime/interaction/clipboard/table.d.ts +14 -0
- package/dist/types/runtime/interaction/clipboard/types.d.ts +27 -0
- package/dist/types/runtime/interaction/design/EditorDesign.d.ts +35 -0
- package/dist/types/runtime/interaction/design/catalog/EditorFieldCatalog.d.ts +57 -0
- package/dist/types/runtime/interaction/design/catalog/catalog-page.d.ts +5 -0
- package/dist/types/runtime/interaction/design/catalog/types.d.ts +91 -0
- package/dist/types/runtime/interaction/design/field-drop.d.ts +16 -0
- package/dist/types/runtime/interaction/design/fields/EditorFieldDesign.d.ts +54 -0
- package/dist/types/runtime/interaction/design/fields/adaptive-image-cell.d.ts +4 -0
- package/dist/types/runtime/interaction/design/fields/field-content.d.ts +6 -0
- package/dist/types/runtime/interaction/design/fields/field-defaults.d.ts +3 -0
- package/dist/types/runtime/interaction/design/fields/field-placement.d.ts +10 -0
- package/dist/types/runtime/interaction/design/fields/types.d.ts +92 -0
- package/dist/types/runtime/interaction/design/format/EditorFormat.d.ts +40 -0
- package/dist/types/runtime/interaction/design/format/input-format.d.ts +15 -0
- package/dist/types/runtime/interaction/design/format/property-format.d.ts +6 -0
- package/dist/types/runtime/interaction/design/format/summary.d.ts +6 -0
- package/dist/types/runtime/interaction/design/format/types.d.ts +73 -0
- package/dist/types/runtime/interaction/design/objects/EditorObjects.d.ts +944 -0
- package/dist/types/runtime/interaction/design/objects/geometry.d.ts +3 -0
- package/dist/types/runtime/interaction/design/objects/inline-relocation.d.ts +190 -0
- package/dist/types/runtime/interaction/design/objects/selection.d.ts +18 -0
- package/dist/types/runtime/interaction/design/objects/types.d.ts +80 -0
- package/dist/types/runtime/interaction/design/tables/EditorTableDesign.d.ts +78 -0
- package/dist/types/runtime/interaction/design/tables/pointer-selection.d.ts +14 -0
- package/dist/types/runtime/interaction/design/tables/regions/EditorTableRegions.d.ts +52 -0
- package/dist/types/runtime/interaction/design/tables/regions/definition.d.ts +8 -0
- package/dist/types/runtime/interaction/design/tables/regions/definitions.d.ts +27 -0
- package/dist/types/runtime/interaction/design/tables/regions/placement.d.ts +12 -0
- package/dist/types/runtime/interaction/design/tables/regions/types.d.ts +68 -0
- package/dist/types/runtime/interaction/design/tables/selection.d.ts +82 -0
- package/dist/types/runtime/interaction/design/tables/table-format.d.ts +24 -0
- package/dist/types/runtime/interaction/design/tables/types.d.ts +87 -0
- package/dist/types/runtime/interaction/design/types.d.ts +28 -0
- package/dist/types/runtime/interaction/design/widgets/EditorPageWidgets.d.ts +734 -0
- package/dist/types/runtime/interaction/design/widgets/types.d.ts +36 -0
- package/dist/types/runtime/interaction/editing-policy.d.ts +8 -0
- package/dist/types/runtime/interaction/editor-diagnostic.d.ts +10 -0
- package/dist/types/runtime/interaction/field-choice.d.ts +57 -0
- package/dist/types/runtime/interaction/field-commands.d.ts +11 -0
- package/dist/types/runtime/interaction/field-navigation.d.ts +5 -0
- package/dist/types/runtime/interaction/field-option-hit.d.ts +4 -0
- package/dist/types/runtime/interaction/field-signature.d.ts +41 -0
- package/dist/types/runtime/interaction/field-text.d.ts +34 -0
- package/dist/types/runtime/interaction/field-value-guard.d.ts +16 -0
- package/dist/types/runtime/interaction/index.d.ts +55 -0
- package/dist/types/runtime/interaction/selection-history.d.ts +16 -0
- package/dist/types/runtime/interaction/text/TextFlow.d.ts +133 -0
- package/dist/types/runtime/interaction/text/apply-text-edit.d.ts +7 -0
- package/dist/types/runtime/interaction/text/navigation.d.ts +17 -0
- package/dist/types/runtime/interaction/text/selection-state.d.ts +18 -0
- package/dist/types/runtime/interaction/text/types.d.ts +39 -0
- package/dist/types/runtime/interaction/types.d.ts +146 -0
- package/dist/types/runtime/interaction/validation/placements.d.ts +6 -0
- package/dist/types/runtime/interaction/validation/types.d.ts +28 -0
- package/dist/types/runtime/layout/attach-session-layout.d.ts +6 -0
- package/dist/types/runtime/layout/index.d.ts +3 -0
- package/dist/types/runtime/layout/types.d.ts +28 -0
- package/dist/types/runtime/presentation/NativeLayoutPresentation.d.ts +40 -0
- package/dist/types/runtime/presentation/async.d.ts +3 -0
- package/dist/types/runtime/presentation/attach-native-layout.d.ts +16 -0
- package/dist/types/runtime/presentation/fields/NativeFieldPresenter.d.ts +67 -0
- package/dist/types/runtime/presentation/fields/appearance.d.ts +20 -0
- package/dist/types/runtime/presentation/fields/attachment-icon.d.ts +2 -0
- package/dist/types/runtime/presentation/fields/signatures.d.ts +5 -0
- package/dist/types/runtime/presentation/fields/theme.d.ts +56 -0
- package/dist/types/runtime/presentation/index.d.ts +6 -0
- package/dist/types/runtime/presentation/seals/NativeSealPresenter.d.ts +32 -0
- package/dist/types/runtime/presentation/seals/geometry.d.ts +5 -0
- package/dist/types/runtime/presentation/seals/presentation.d.ts +5 -0
- package/dist/types/runtime/presentation/settle-data-layout.d.ts +11 -0
- package/dist/types/runtime/presentation/tables/AxisOccurrenceIndex.d.ts +29 -0
- package/dist/types/runtime/presentation/tables/NativeTableInstances.d.ts +43 -0
- package/dist/types/runtime/presentation/tables/TableGridProjector.d.ts +29 -0
- package/dist/types/runtime/presentation/tables/TableValueResolver.d.ts +40 -0
- package/dist/types/runtime/presentation/tables/material-cells.d.ts +4 -0
- package/dist/types/runtime/presentation/tables/row-occurrences.d.ts +25 -0
- package/dist/types/runtime/presentation/tables/table-axis.d.ts +5 -0
- package/dist/types/runtime/presentation/tables/types.d.ts +49 -0
- package/dist/types/runtime/presentation/types.d.ts +47 -0
- package/dist/types/runtime/presentation/widgets/NativeCodeEncoder.d.ts +21 -0
- package/dist/types/runtime/presentation/widgets/NativeCodeWidgets.d.ts +54 -0
- package/dist/types/runtime/presentation/widgets/NativePageWidgetPresenter.d.ts +86 -0
- package/dist/types/runtime/presentation/widgets/formula-input.d.ts +11 -0
- package/dist/types/runtime/presentation/widgets/time-difference.d.ts +8 -0
- package/dist/types/runtime/presentation/widgets/value.d.ts +15 -0
- package/dist/types/runtime/session/DocumentSession.d.ts +89 -0
- package/dist/types/runtime/session/ResourceScope.d.ts +12 -0
- package/dist/types/runtime/session/changes.d.ts +38 -0
- package/dist/types/runtime/session/handle.d.ts +12 -0
- package/dist/types/runtime/session/index.d.ts +8 -0
- package/dist/types/runtime/session/signals.d.ts +10 -0
- package/dist/types/runtime/session/tasks.d.ts +41 -0
- package/dist/types/runtime/session/types.d.ts +125 -0
- package/dist/types/runtime/session/versions.d.ts +10 -0
- package/dist/types/sdk/index.d.ts +9 -0
- package/dist/types/shared/async/abortable.d.ts +3 -0
- package/dist/types/shared/drawing.d.ts +76 -0
- package/dist/types/shared/form-config/communication/CommunicationIcon.vue.d.ts +24 -0
- package/dist/types/shared/form-config/communication/CommunicationPanel.vue.d.ts +16 -0
- package/dist/types/shared/form-config/communication/DeviceCommunicationDraft.vue.d.ts +16 -0
- package/dist/types/shared/form-config/communication/DeviceFieldMapping.vue.d.ts +17 -0
- package/dist/types/shared/form-config/communication/DeviceParameterCard.vue.d.ts +24 -0
- package/dist/types/shared/form-config/communication/DevicePickerDialog.vue.d.ts +11 -0
- package/dist/types/shared/form-config/communication/DeviceTemplateEditor.vue.d.ts +13 -0
- package/dist/types/shared/form-config/communication/OcrTemplateEditor.vue.d.ts +34 -0
- package/dist/types/shared/form-config/communication/templates.d.ts +10 -0
- package/dist/types/shared/form-config/communication/types.d.ts +81 -0
- package/dist/types/shared/form-config/data/context/BuiltinContextCard.vue.d.ts +7 -0
- package/dist/types/shared/form-config/data/context/options.d.ts +24 -0
- package/dist/types/shared/form-config/data/fills/FieldFillDialog.vue.d.ts +17 -0
- package/dist/types/shared/form-config/data/fills/FieldFills.vue.d.ts +32 -0
- package/dist/types/shared/form-config/data/fills/options.d.ts +39 -0
- package/dist/types/shared/form-config/data/objects/ObjectInitializationEditor.vue.d.ts +73 -0
- package/dist/types/shared/form-config/data/objects/ObjectInitializationList.vue.d.ts +30 -0
- package/dist/types/shared/form-config/data/objects/ObjectStockSettings.vue.d.ts +19 -0
- package/dist/types/shared/form-config/data/objects/types.d.ts +98 -0
- package/dist/types/shared/form-config/data/sources/analysis/index.d.ts +13 -0
- package/dist/types/shared/form-config/data/sources/components/DataSourceDrawer.vue.d.ts +19 -0
- package/dist/types/shared/form-config/data/sources/components/DataSourceList.vue.d.ts +32 -0
- package/dist/types/shared/form-config/data/sources/components/SourceConfigStep.vue.d.ts +13 -0
- package/dist/types/shared/form-config/data/sources/components/SourceFieldPicker.vue.d.ts +17 -0
- package/dist/types/shared/form-config/data/sources/components/SourceFieldTable.vue.d.ts +27 -0
- package/dist/types/shared/form-config/data/sources/components/SourceTypeTag.vue.d.ts +7 -0
- package/dist/types/shared/form-config/data/sources/options.d.ts +53 -0
- package/dist/types/shared/form-config/data/sources/ports.d.ts +35 -0
- package/dist/types/shared/form-config/data/sources/types.d.ts +125 -0
- package/dist/types/shared/form-config/data/sources/useDataSourceDraft.d.ts +97 -0
- package/dist/types/shared/form-config/data/sources/validation.d.ts +5 -0
- package/dist/types/shared/form-config/index.d.ts +20 -0
- package/dist/types/shared/platform-gct/communication.d.ts +67 -0
- package/dist/types/shared/platform-gct/data-sources.d.ts +24 -0
- package/dist/types/shared/platform-gct/fields/field-icons.d.ts +3 -0
- package/dist/types/shared/platform-gct/fields/field-types.d.ts +485 -0
- package/dist/types/shared/platform-gct/fields/form-models.d.ts +81 -0
- package/dist/types/shared/platform-gct/fields/index.d.ts +6 -0
- package/dist/types/shared/platform-gct/fields/options.d.ts +39 -0
- package/dist/types/shared/platform-gct/form-credentials.d.ts +35 -0
- package/dist/types/shared/platform-gct/form-instances.d.ts +68 -0
- package/dist/types/shared/platform-gct/notification.d.ts +15 -0
- package/dist/types/shared/platform-gct/record-values.d.ts +5 -0
- package/dist/types/shared/platform-gct/records.d.ts +49 -0
- package/dist/types/shared/platform-gct/templates.d.ts +70 -0
- package/dist/types/shared/platform-gct/vue/useGctDhrLicense.d.ts +26 -0
- package/dist/types/shared/table-borders.d.ts +8 -0
- package/dist/types/shared/text/tsv.d.ts +21 -0
- package/dist/types/shared/text/word-fonts.d.ts +4 -0
- package/dist/types/shared/ui/breadcrumb/src/breadcrumb-item.vue.d.ts +24 -0
- package/dist/types/shared/ui/breadcrumb/src/breadcrumb.vue.d.ts +8 -0
- package/dist/types/shared/ui/button/src/button.type.d.ts +9 -0
- package/dist/types/shared/ui/button/src/button.vue.d.ts +25 -0
- package/dist/types/shared/ui/calendar/src/calendar.vue.d.ts +32 -0
- package/dist/types/shared/ui/calendar/src/time.vue.d.ts +22 -0
- package/dist/types/shared/ui/calendar/src/utils/index.d.ts +32 -0
- package/dist/types/shared/ui/checkbox/src/checkbox-group.vue.d.ts +30 -0
- package/dist/types/shared/ui/checkbox/src/checkbox.vue.d.ts +28 -0
- package/dist/types/shared/ui/collapse/src/collapse.vue.d.ts +25 -0
- package/dist/types/shared/ui/color-picker/src/ColorPicker.vue.d.ts +37 -0
- package/dist/types/shared/ui/date-time-picker/src/DateTimePicker.vue.d.ts +36 -0
- package/dist/types/shared/ui/divider/src/divider.d.ts +7 -0
- package/dist/types/shared/ui/divider/src/divider.vue.d.ts +13 -0
- package/dist/types/shared/ui/dropdown/src/dropdown-basic-select.vue.d.ts +93 -0
- package/dist/types/shared/ui/dropdown/src/dropdown-group-select.vue.d.ts +29 -0
- package/dist/types/shared/ui/dropdown/src/dropdown.vue.d.ts +4 -0
- package/dist/types/shared/ui/dropdown/src/types/index.d.ts +38 -0
- package/dist/types/shared/ui/empty/src/empty.vue.d.ts +10 -0
- package/dist/types/shared/ui/form-item/src/form-item.vue.d.ts +36 -0
- package/dist/types/shared/ui/icon/src/icon.vue.d.ts +25 -0
- package/dist/types/shared/ui/icons/color.d.ts +4 -0
- package/dist/types/shared/ui/image-viewer/index.d.ts +17 -0
- package/dist/types/shared/ui/index.d.ts +31 -0
- package/dist/types/shared/ui/input/src/input-number.vue.d.ts +72 -0
- package/dist/types/shared/ui/input/src/input.vue.d.ts +71 -0
- package/dist/types/shared/ui/input/src/text-area.vue.d.ts +59 -0
- package/dist/types/shared/ui/input/src/types/index.d.ts +55 -0
- package/dist/types/shared/ui/layout/src/layout.vue.d.ts +21 -0
- package/dist/types/shared/ui/loading/src/loading.vue.d.ts +3 -0
- package/dist/types/shared/ui/message/src/Message.vue.d.ts +23 -0
- package/dist/types/shared/ui/message/src/message.d.ts +19 -0
- package/dist/types/shared/ui/modal/index.d.ts +4 -0
- package/dist/types/shared/ui/modal/src/ConfirmTip.vue.d.ts +6 -0
- package/dist/types/shared/ui/modal/src/DialogActionButton.vue.d.ts +30 -0
- package/dist/types/shared/ui/modal/src/DialogActionIcon.vue.d.ts +12 -0
- package/dist/types/shared/ui/modal/src/ModalRoot.vue.d.ts +25 -0
- package/dist/types/shared/ui/modal/src/index.d.ts +8 -0
- package/dist/types/shared/ui/modal/src/modal.type.d.ts +57 -0
- package/dist/types/shared/ui/radio/src/radio-group.vue.d.ts +31 -0
- package/dist/types/shared/ui/radio/src/radio.vue.d.ts +28 -0
- package/dist/types/shared/ui/scrollbar/src/bar.d.ts +28 -0
- package/dist/types/shared/ui/scrollbar/src/scrollbar.vue.d.ts +104 -0
- package/dist/types/shared/ui/scrollbar/src/types.d.ts +3 -0
- package/dist/types/shared/ui/scrollbar/src/util.d.ts +23 -0
- package/dist/types/shared/ui/segment-slider/src/segment-slider.vue.d.ts +44 -0
- package/dist/types/shared/ui/select/index.d.ts +3 -0
- package/dist/types/shared/ui/select/src/measure-select-columns.d.ts +2 -0
- package/dist/types/shared/ui/select/src/select-control.vue.d.ts +71 -0
- package/dist/types/shared/ui/select/src/select-option-label.vue.d.ts +20 -0
- package/dist/types/shared/ui/select/src/select-page-footer.vue.d.ts +17 -0
- package/dist/types/shared/ui/select/src/select-surface.vue.d.ts +26 -0
- package/dist/types/shared/ui/select/src/select.types.d.ts +96 -0
- package/dist/types/shared/ui/select/src/unified-select.vue.d.ts +68 -0
- package/dist/types/shared/ui/select/src/use-select-columns.d.ts +22 -0
- package/dist/types/shared/ui/select/src/use-select-pages.d.ts +30 -0
- package/dist/types/shared/ui/slider/src/slider.vue.d.ts +22 -0
- package/dist/types/shared/ui/switch/src/switch.vue.d.ts +18 -0
- package/dist/types/shared/ui/table/index.d.ts +2 -0
- package/dist/types/shared/ui/table/src/table.type.d.ts +24 -0
- package/dist/types/shared/ui/table/src/table.vue.d.ts +51 -0
- package/dist/types/shared/ui/table-select/index.d.ts +3 -0
- package/dist/types/shared/ui/table-select/src/table-select-pagination.vue.d.ts +19 -0
- package/dist/types/shared/ui/table-select/src/types.d.ts +30 -0
- package/dist/types/shared/ui/table-select/src/unified-table-select.vue.d.ts +64 -0
- package/dist/types/shared/ui/tooltip/src/tooltip.vue.d.ts +4 -0
- package/dist/types/shared/ui/tree/index.d.ts +2 -0
- package/dist/types/shared/ui/tree/src/tree-node.vue.d.ts +15 -0
- package/dist/types/shared/ui/tree/src/tree.vue.d.ts +19 -0
- package/dist/types/shared/ui/tree-select/index.d.ts +2 -0
- package/dist/types/shared/ui/tree-select/src/filter-tree-select-nodes.d.ts +5 -0
- package/dist/types/shared/ui/tree-select/src/types.d.ts +32 -0
- package/dist/types/shared/ui/tree-select/src/unified-tree-select.vue.d.ts +149 -0
- package/dist/types/shared/ui/utils/event-util.d.ts +4 -0
- package/dist/types/shared/ui/utils/search-match-text.vue.d.ts +7 -0
- package/dist/vue.js +44674 -0
- package/dist/vue.js.map +1 -0
- package/package.json +86 -93
- package/LICENSE +0 -9
- package/dist/assets/svgs/table/index.d.ts +0 -38
- package/dist/assets/svgs/toolkit/index.d.ts +0 -10
- package/dist/assets/theme/field-state.d.ts +0 -74
- package/dist/assets/theme/index.d.ts +0 -1
- package/dist/base/avatar/index.d.ts +0 -1
- package/dist/base/avatar/src/Avatar.vue.d.ts +0 -9
- package/dist/base/avatar/src/utils/useFile.d.ts +0 -3
- package/dist/base/breadcrumb/src/breadcrumb-item.vue.d.ts +0 -26
- package/dist/base/breadcrumb/src/breadcrumb.vue.d.ts +0 -7
- package/dist/base/button/src/button.type.d.ts +0 -9
- package/dist/base/button/src/button.vue.d.ts +0 -26
- package/dist/base/calendar/src/calendar.vue.d.ts +0 -24
- package/dist/base/calendar/src/time.vue.d.ts +0 -19
- package/dist/base/calendar/src/utils/index.d.ts +0 -25
- package/dist/base/checkbox/src/checkbox-group.vue.d.ts +0 -32
- package/dist/base/checkbox/src/checkbox.vue.d.ts +0 -30
- package/dist/base/collapse/src/collapse.vue.d.ts +0 -30
- package/dist/base/color-picker/src/ColorPicker.vue.d.ts +0 -88
- package/dist/base/date-time-picker/src/DateTimePicker.vue.d.ts +0 -27
- package/dist/base/divider/src/divider.d.ts +0 -7
- package/dist/base/divider/src/divider.vue.d.ts +0 -19
- package/dist/base/dropdown/src/dropdown-basic-select.vue.d.ts +0 -100
- package/dist/base/dropdown/src/dropdown-group-select.vue.d.ts +0 -45
- package/dist/base/dropdown/src/dropdown.vue.d.ts +0 -2
- package/dist/base/empty/src/empty.vue.d.ts +0 -9
- package/dist/base/form-item/src/form-item.vue.d.ts +0 -35
- package/dist/base/icon/src/icon.vue.d.ts +0 -12
- package/dist/base/image-upload/index.d.ts +0 -1
- package/dist/base/image-upload/src/image-upload.type.d.ts +0 -8
- package/dist/base/image-upload/src/image-upload.vue.d.ts +0 -16
- package/dist/base/index.d.ts +0 -31
- package/dist/base/input/src/input-number.vue.d.ts +0 -63
- package/dist/base/input/src/input.vue.d.ts +0 -76
- package/dist/base/input/src/text-area.vue.d.ts +0 -65
- package/dist/base/layout/src/layout.vue.d.ts +0 -23
- package/dist/base/loading/src/loading.vue.d.ts +0 -2
- package/dist/base/message/src/Message.vue.d.ts +0 -20
- package/dist/base/message/src/message.d.ts +0 -17
- package/dist/base/modal/index.d.ts +0 -2
- package/dist/base/modal/src/ConfirmTip.vue.d.ts +0 -5
- package/dist/base/modal/src/ModalRoot.vue.d.ts +0 -25
- package/dist/base/modal/src/index.d.ts +0 -7
- package/dist/base/modal/src/modal.type.d.ts +0 -47
- package/dist/base/radio/src/radio-group.vue.d.ts +0 -33
- package/dist/base/radio/src/radio.vue.d.ts +0 -28
- package/dist/base/rdo-tree-select/index.d.ts +0 -3
- package/dist/base/rdo-tree-select/src/display.d.ts +0 -12
- package/dist/base/rdo-tree-select/src/rdo-tree-select-more.vue.d.ts +0 -15
- package/dist/base/rdo-tree-select/src/rdo-tree-select-node.vue.d.ts +0 -17
- package/dist/base/rdo-tree-select/src/rdo-tree-select-panel.vue.d.ts +0 -25
- package/dist/base/rdo-tree-select/src/rdo-tree-select.vue.d.ts +0 -47
- package/dist/base/rdo-tree-select/src/types.d.ts +0 -23
- package/dist/base/rdo-tree-select/src/use-rdo-tree-options.d.ts +0 -59
- package/dist/base/scrollbar/src/bar.d.ts +0 -14
- package/dist/base/scrollbar/src/scrollbar.vue.d.ts +0 -92
- package/dist/base/scrollbar/src/util.d.ts +0 -8
- package/dist/base/segment-slider/src/segment-slider.vue.d.ts +0 -29
- package/dist/base/select/index.d.ts +0 -2
- package/dist/base/select/src/basic-select.vue.d.ts +0 -134
- package/dist/base/select/src/searchable-select.vue.d.ts +0 -55
- package/dist/base/slider/src/slider.vue.d.ts +0 -22
- package/dist/base/switch/src/switch.vue.d.ts +0 -17
- package/dist/base/table/index.d.ts +0 -1
- package/dist/base/table/src/table.type.d.ts +0 -19
- package/dist/base/table/src/table.vue.d.ts +0 -48
- package/dist/base/time-picker/index.d.ts +0 -1
- package/dist/base/time-picker/src/TimePicker.vue.d.ts +0 -29
- package/dist/base/tooltip/src/tooltip.vue.d.ts +0 -2
- package/dist/base/tree/index.d.ts +0 -1
- package/dist/base/tree/src/tree-node.vue.d.ts +0 -14
- package/dist/base/tree/src/tree.vue.d.ts +0 -18
- package/dist/base/tree-select/index.d.ts +0 -1
- package/dist/base/tree-select/src/tree-select.vue.d.ts +0 -45
- package/dist/base/utils/asset-helper-util.d.ts +0 -68
- package/dist/base/utils/dom-util.d.ts +0 -35
- package/dist/base/utils/event-util.d.ts +0 -3
- package/dist/base/utils/image-size-util.d.ts +0 -55
- package/dist/capabilities/base/BaseRegistry.d.ts +0 -36
- package/dist/capabilities/base/BaseService.d.ts +0 -19
- package/dist/capabilities/component-registry/index.d.ts +0 -3
- package/dist/capabilities/component-registry/registry.d.ts +0 -8
- package/dist/capabilities/component-registry/service.d.ts +0 -8
- package/dist/capabilities/component-registry/types.d.ts +0 -4
- package/dist/capabilities/field-manifest/index.d.ts +0 -3
- package/dist/capabilities/field-manifest/registry.d.ts +0 -7
- package/dist/capabilities/field-manifest/service.d.ts +0 -10
- package/dist/capabilities/field-manifest/types.d.ts +0 -31
- package/dist/capabilities/model-field-runtime/engine/FieldEngine.d.ts +0 -14
- package/dist/capabilities/model-field-runtime/index.d.ts +0 -7
- package/dist/capabilities/model-field-runtime/provider/FieldProviderBase.d.ts +0 -15
- package/dist/capabilities/model-field-runtime/provider/FieldProviderRuntime.d.ts +0 -24
- package/dist/capabilities/model-field-runtime/provider/ModelProviderBase.d.ts +0 -21
- package/dist/capabilities/model-field-runtime/registry/FieldRegistry.d.ts +0 -9
- package/dist/capabilities/model-field-runtime/registry/ModelRegistry.d.ts +0 -9
- package/dist/capabilities/model-field-runtime/runtime/FieldScope.d.ts +0 -21
- package/dist/capabilities/model-field-runtime/service/FieldService.d.ts +0 -21
- package/dist/capabilities/model-field-runtime/service/ModelService.d.ts +0 -12
- package/dist/capabilities/model-field-runtime/types/field.d.ts +0 -56
- package/dist/capabilities/model-field-runtime/types/instance.d.ts +0 -31
- package/dist/capabilities/model-field-runtime/types/model.d.ts +0 -17
- package/dist/capabilities/model-field-runtime/types/paper-widget.d.ts +0 -10
- package/dist/capabilities/panel/config/registry.d.ts +0 -7
- package/dist/capabilities/panel/config/service.d.ts +0 -6
- package/dist/capabilities/panel/config/types.d.ts +0 -10
- package/dist/capabilities/panel/router/registry.d.ts +0 -8
- package/dist/capabilities/panel/router/service.d.ts +0 -8
- package/dist/capabilities/panel/router/types.d.ts +0 -8
- package/dist/capabilities/panel/schema/registry.d.ts +0 -7
- package/dist/capabilities/panel/schema/service.d.ts +0 -6
- package/dist/capabilities/panel/schema/types.d.ts +0 -24
- package/dist/capabilities/paper-widget-manifest/index.d.ts +0 -3
- package/dist/capabilities/paper-widget-manifest/registry.d.ts +0 -7
- package/dist/capabilities/paper-widget-manifest/service.d.ts +0 -9
- package/dist/capabilities/paper-widget-manifest/types.d.ts +0 -31
- package/dist/capabilities/utils/index.d.ts +0 -1
- package/dist/core/command/CommandManager.d.ts +0 -21
- package/dist/core/command/InputComposition.d.ts +0 -22
- package/dist/core/command/base/CommandBase.d.ts +0 -217
- package/dist/core/command/base/FloatingFieldCommand.d.ts +0 -9
- package/dist/core/command/base/SetStyleBase.d.ts +0 -45
- package/dist/core/command/commandMapBuilder.d.ts +0 -7
- package/dist/core/command/commands/Backspace.d.ts +0 -60
- package/dist/core/command/commands/CommitValidateNumber.d.ts +0 -10
- package/dist/core/command/commands/Delete.d.ts +0 -57
- package/dist/core/command/commands/DeleteBoundedItem.d.ts +0 -12
- package/dist/core/command/commands/DeleteCol.d.ts +0 -12
- package/dist/core/command/commands/DeleteDataGroup2D.d.ts +0 -12
- package/dist/core/command/commands/DeleteRow.d.ts +0 -12
- package/dist/core/command/commands/DeleteSubTable.d.ts +0 -10
- package/dist/core/command/commands/DeleteTable.d.ts +0 -11
- package/dist/core/command/commands/DeleteTableHeader.d.ts +0 -12
- package/dist/core/command/commands/Enter.d.ts +0 -9
- package/dist/core/command/commands/InsertCol.d.ts +0 -17
- package/dist/core/command/commands/InsertField.d.ts +0 -69
- package/dist/core/command/commands/InsertFloatingField.d.ts +0 -9
- package/dist/core/command/commands/InsertFloatingOverlay.d.ts +0 -9
- package/dist/core/command/commands/InsertImage.d.ts +0 -24
- package/dist/core/command/commands/InsertPaperWidget.d.ts +0 -19
- package/dist/core/command/commands/InsertRow.d.ts +0 -17
- package/dist/core/command/commands/InsertTable.d.ts +0 -12
- package/dist/core/command/commands/InsertText.d.ts +0 -15
- package/dist/core/command/commands/MergeCells.d.ts +0 -18
- package/dist/core/command/commands/MoveFloatingField.d.ts +0 -10
- package/dist/core/command/commands/RemoveFloatingField.d.ts +0 -12
- package/dist/core/command/commands/ResizeCol.d.ts +0 -7
- package/dist/core/command/commands/ResizeImage.d.ts +0 -7
- package/dist/core/command/commands/ResizeOverlayLayout.d.ts +0 -7
- package/dist/core/command/commands/ResizeRow.d.ts +0 -7
- package/dist/core/command/commands/Set2DTable.d.ts +0 -7
- package/dist/core/command/commands/SetAlign.d.ts +0 -18
- package/dist/core/command/commands/SetBold.d.ts +0 -12
- package/dist/core/command/commands/SetBounded.d.ts +0 -7
- package/dist/core/command/commands/SetBoundedItem.d.ts +0 -23
- package/dist/core/command/commands/SetCheckTable.d.ts +0 -7
- package/dist/core/command/commands/SetColor.d.ts +0 -11
- package/dist/core/command/commands/SetDataGroup2D.d.ts +0 -17
- package/dist/core/command/commands/SetFont.d.ts +0 -12
- package/dist/core/command/commands/SetFontSize.d.ts +0 -11
- package/dist/core/command/commands/SetHeaderFooterConfig.d.ts +0 -11
- package/dist/core/command/commands/SetHighlight.d.ts +0 -11
- package/dist/core/command/commands/SetItalic.d.ts +0 -11
- package/dist/core/command/commands/SetMaterialConsumeTable.d.ts +0 -7
- package/dist/core/command/commands/SetOrient.d.ts +0 -10
- package/dist/core/command/commands/SetPadding.d.ts +0 -10
- package/dist/core/command/commands/SetRepeating.d.ts +0 -7
- package/dist/core/command/commands/SetStrike.d.ts +0 -11
- package/dist/core/command/commands/SetSubTableHeader.d.ts +0 -8
- package/dist/core/command/commands/SetTableBorder.d.ts +0 -14
- package/dist/core/command/commands/SetTableHeader.d.ts +0 -7
- package/dist/core/command/commands/SetUnderline.d.ts +0 -11
- package/dist/core/command/commands/SetWsecSize.d.ts +0 -10
- package/dist/core/command/commands/Snapshot.d.ts +0 -12
- package/dist/core/command/commands/UnmergeCells.d.ts +0 -22
- package/dist/core/command/types.d.ts +0 -291
- package/dist/core/constants/common.d.ts +0 -1
- package/dist/core/constants/component.d.ts +0 -27
- package/dist/core/constants/doc-mode.d.ts +0 -10
- package/dist/core/constants/index.d.ts +0 -5
- package/dist/core/constants/paper.d.ts +0 -37
- package/dist/core/constants/table.d.ts +0 -11
- package/dist/core/cursor/CursorController.d.ts +0 -71
- package/dist/core/cursor/CursorManager.d.ts +0 -46
- package/dist/core/cursor/composables/useCursorSelection.d.ts +0 -88
- package/dist/core/cursor/hit/HitHandlerRegistry.d.ts +0 -19
- package/dist/core/cursor/hit/InlineImageHitHandler.d.ts +0 -6
- package/dist/core/cursor/hit/OverlayLayoutHitHandler.d.ts +0 -9
- package/dist/core/cursor/hit/PageHitHandler.d.ts +0 -9
- package/dist/core/cursor/hit/ParagraphHitHandler.d.ts +0 -9
- package/dist/core/cursor/hit/TableCellHitHandler.d.ts +0 -9
- package/dist/core/cursor/hit/TextHitHandler.d.ts +0 -7
- package/dist/core/cursor/hit/index.d.ts +0 -2
- package/dist/core/cursor/hit/types.d.ts +0 -55
- package/dist/core/cursor/layout/baseMeta.d.ts +0 -15
- package/dist/core/cursor/layout/intervals.d.ts +0 -25
- package/dist/core/cursor/layout/textOffsets.d.ts +0 -13
- package/dist/core/cursor/logic/getCursorCoords.d.ts +0 -10
- package/dist/core/cursor/logic/getCursorTextRawList.d.ts +0 -2
- package/dist/core/cursor/logic/getSelectionRects.d.ts +0 -19
- package/dist/core/cursor/logic/index.d.ts +0 -22
- package/dist/core/cursor/logic/layoutNavigation.d.ts +0 -28
- package/dist/core/cursor/logic/resolveCursorState.d.ts +0 -24
- package/dist/core/cursor/logic/selectionAnalyzer.d.ts +0 -48
- package/dist/core/cursor/movement/MovementRegistry.d.ts +0 -20
- package/dist/core/cursor/movement/index.d.ts +0 -4
- package/dist/core/cursor/movement/types.d.ts +0 -11
- package/dist/core/cursor/render/cursor-overlay.vue.d.ts +0 -2
- package/dist/core/cursor/render/cursor-renderer.vue.d.ts +0 -18
- package/dist/core/cursor/render/hidden-input.vue.d.ts +0 -21
- package/dist/core/cursor/render/selection-renderer.vue.d.ts +0 -14
- package/dist/core/cursor/session/CursorDragSession.d.ts +0 -28
- package/dist/core/cursor/types/cursor.d.ts +0 -52
- package/dist/core/data/DataManager.d.ts +0 -407
- package/dist/core/data/enrichers/build-field-enrichers.d.ts +0 -16
- package/dist/core/data/enrichers/companion-enricher.d.ts +0 -26
- package/dist/core/data/enrichers/enrich-design-defaults.d.ts +0 -19
- package/dist/core/data/enrichers/enrich-utils.d.ts +0 -6
- package/dist/core/data/enrichers/hydrate-utils.d.ts +0 -6
- package/dist/core/data/enrichers/hyperlink-enricher.d.ts +0 -14
- package/dist/core/data/enrichers/id-enricher.d.ts +0 -9
- package/dist/core/data/enrichers/inspection-module-qty-enricher.d.ts +0 -19
- package/dist/core/data/enrichers/label-enricher.d.ts +0 -25
- package/dist/core/data/enrichers/label-resolve.d.ts +0 -40
- package/dist/core/data/enrichers/lot-parent-label-enricher.d.ts +0 -12
- package/dist/core/data/enrichers/of-inst-num-enricher.d.ts +0 -23
- package/dist/core/data/enrichers/operation-receive-qty-enricher.d.ts +0 -19
- package/dist/core/data/enrichers/received-qty-enricher.d.ts +0 -4
- package/dist/core/data/enrichers/static-label-enrichers.d.ts +0 -9
- package/dist/core/data/enrichers/udi-enricher.d.ts +0 -23
- package/dist/core/data/formula/business-functions.d.ts +0 -10
- package/dist/core/data/formula/calculate-formula.d.ts +0 -5
- package/dist/core/data/formula/formula-params-cache.d.ts +0 -15
- package/dist/core/data/index.d.ts +0 -11
- package/dist/core/data/initialization.d.ts +0 -26
- package/dist/core/data/paths/field-paths.d.ts +0 -20
- package/dist/core/data/paths/path-templates.d.ts +0 -2
- package/dist/core/data/paths/subtable-path.d.ts +0 -44
- package/dist/core/data/post-change-pipeline.d.ts +0 -37
- package/dist/core/data/submit/form-state.d.ts +0 -29
- package/dist/core/data/subtable/row.d.ts +0 -27
- package/dist/core/data/types/change.d.ts +0 -17
- package/dist/core/data/types/enricher.d.ts +0 -13
- package/dist/core/data/types/index.d.ts +0 -4
- package/dist/core/data/types/pipeline.d.ts +0 -23
- package/dist/core/data/types/runtime-config.d.ts +0 -23
- package/dist/core/data/updates/field-updates.d.ts +0 -32
- package/dist/core/event/DocumentEventBridge.d.ts +0 -58
- package/dist/core/event/EventBus.d.ts +0 -8
- package/dist/core/event/EventManager.d.ts +0 -37
- package/dist/core/event/Transaction.d.ts +0 -11
- package/dist/core/event/handlers/IMEHandler.d.ts +0 -23
- package/dist/core/event/handlers/InteractionHandler.d.ts +0 -18
- package/dist/core/event/handlers/KonvaHandler.d.ts +0 -21
- package/dist/core/event/handlers/TouchHandler.example.d.ts +0 -24
- package/dist/core/event/handlers/index.d.ts +0 -3
- package/dist/core/event/types.d.ts +0 -68
- package/dist/core/index.d.ts +0 -37
- package/dist/core/interaction/InteractionController.d.ts +0 -78
- package/dist/core/interaction/InteractionManager.d.ts +0 -23
- package/dist/core/interaction/InteractionPolicy.d.ts +0 -23
- package/dist/core/interaction/types.d.ts +0 -57
- package/dist/core/interaction/useInteraction.d.ts +0 -67
- package/dist/core/layout/LayoutContext.d.ts +0 -62
- package/dist/core/layout/LayoutManager.d.ts +0 -44
- package/dist/core/layout/LayoutMapper.d.ts +0 -96
- package/dist/core/layout/attach-field/AttachFieldContext.d.ts +0 -59
- package/dist/core/layout/attach-field/index.d.ts +0 -2
- package/dist/core/layout/attach-field/types.d.ts +0 -20
- package/dist/core/layout/handlers/FieldHandler.d.ts +0 -7
- package/dist/core/layout/handlers/InlineImageLayoutHandler.d.ts +0 -10
- package/dist/core/layout/handlers/PageWidgetHandler.d.ts +0 -5
- package/dist/core/layout/handlers/RunHandlerBase.d.ts +0 -13
- package/dist/core/layout/handlers/TextHandler.d.ts +0 -17
- package/dist/core/layout/handlers/fields/AttachFieldHandler.d.ts +0 -10
- package/dist/core/layout/handlers/fields/AttachmentHandler.d.ts +0 -12
- package/dist/core/layout/handlers/fields/FieldBaseHandler.d.ts +0 -103
- package/dist/core/layout/handlers/fields/FieldImageHandler.d.ts +0 -27
- package/dist/core/layout/handlers/fields/InputHandler.d.ts +0 -6
- package/dist/core/layout/handlers/fields/OptionHandler.d.ts +0 -18
- package/dist/core/layout/handlers/fields/SignatureHandler.d.ts +0 -25
- package/dist/core/layout/handlers/fields/index.d.ts +0 -7
- package/dist/core/layout/handlers/fields/signature-decoration-layout.d.ts +0 -14
- package/dist/core/layout/handlers/index.d.ts +0 -4
- package/dist/core/layout/handlers/pageWidgets/BarcodeHandler.d.ts +0 -11
- package/dist/core/layout/handlers/pageWidgets/DefaultHandler.d.ts +0 -4
- package/dist/core/layout/handlers/pageWidgets/DiagonalHandler.d.ts +0 -4
- package/dist/core/layout/handlers/pageWidgets/LineHandler.d.ts +0 -4
- package/dist/core/layout/handlers/pageWidgets/PageWidgetImageHandler.d.ts +0 -5
- package/dist/core/layout/handlers/pageWidgets/PaginationHandler.d.ts +0 -7
- package/dist/core/layout/handlers/pageWidgets/QrCodeHandler.d.ts +0 -4
- package/dist/core/layout/handlers/pageWidgets/SerialNumberHandler.d.ts +0 -4
- package/dist/core/layout/handlers/pageWidgets/TimeDiffHandler.d.ts +0 -17
- package/dist/core/layout/handlers/pageWidgets/WidgetBaseHandler.d.ts +0 -19
- package/dist/core/layout/handlers/pageWidgets/index.d.ts +0 -9
- package/dist/core/layout/image/adaptive-image-cell.d.ts +0 -47
- package/dist/core/layout/logic/LayoutBuilder.d.ts +0 -36
- package/dist/core/layout/logic/LayoutGeometry.d.ts +0 -16
- package/dist/core/layout/logic/ModelBuilder.d.ts +0 -2
- package/dist/core/layout/providers/TableInfoProvider.d.ts +0 -30
- package/dist/core/layout/providers/index.d.ts +0 -4
- package/dist/core/layout/shared/helpers.d.ts +0 -27
- package/dist/core/layout/shared/unit-converter.d.ts +0 -206
- package/dist/core/layout/table/link-sub-table-layout.d.ts +0 -27
- package/dist/core/layout/table/split-table.d.ts +0 -144
- package/dist/core/layout/table/table-expand.d.ts +0 -143
- package/dist/core/layout/types/index.d.ts +0 -147
- package/dist/core/model/DocModel.d.ts +0 -88
- package/dist/core/model/base/ModelGroup.d.ts +0 -116
- package/dist/core/model/base/ModelNode.d.ts +0 -70
- package/dist/core/model/base/RefManager.d.ts +0 -50
- package/dist/core/model/base/index.d.ts +0 -3
- package/dist/core/model/capability/index.d.ts +0 -11
- package/dist/core/model/document/Wbackground.d.ts +0 -22
- package/dist/core/model/document/Wbody.d.ts +0 -39
- package/dist/core/model/document/Wdocument.d.ts +0 -40
- package/dist/core/model/document/Wp.d.ts +0 -72
- package/dist/core/model/document/WpPr.d.ts +0 -113
- package/dist/core/model/document/WrField.d.ts +0 -8
- package/dist/core/model/document/WrImage.d.ts +0 -73
- package/dist/core/model/document/WrPageWidget.d.ts +0 -8
- package/dist/core/model/document/WrPr.d.ts +0 -117
- package/dist/core/model/document/WrText.d.ts +0 -139
- package/dist/core/model/document/WsecPr.d.ts +0 -193
- package/dist/core/model/document/Wtbl/Calculation.d.ts +0 -45
- package/dist/core/model/document/Wtbl/CellIterator.d.ts +0 -18
- package/dist/core/model/document/Wtbl/RegionManager.d.ts +0 -77
- package/dist/core/model/document/Wtbl/RowColumnOps.d.ts +0 -94
- package/dist/core/model/document/Wtbl/Serialization.d.ts +0 -57
- package/dist/core/model/document/Wtbl.d.ts +0 -134
- package/dist/core/model/document/WtblPr.d.ts +0 -73
- package/dist/core/model/document/Wtc.d.ts +0 -184
- package/dist/core/model/document/Wtr.d.ts +0 -47
- package/dist/core/model/document/WtrPr.d.ts +0 -67
- package/dist/core/model/document/index.d.ts +0 -16
- package/dist/core/model/document/resolvers/ParagraphStyleResolver.d.ts +0 -48
- package/dist/core/model/document/resolvers/TextStyleResolver.d.ts +0 -50
- package/dist/core/model/document/resolvers/index.d.ts +0 -2
- package/dist/core/model/document/utils/ensure-paragraphs-around-tables.d.ts +0 -18
- package/dist/core/model/document/wtcRegionRef.d.ts +0 -63
- package/dist/core/model/font-usage.d.ts +0 -22
- package/dist/core/model/footers/Wfooter.d.ts +0 -46
- package/dist/core/model/footers/Wfooters.d.ts +0 -42
- package/dist/core/model/headers/Wheader.d.ts +0 -46
- package/dist/core/model/headers/Wheaders.d.ts +0 -45
- package/dist/core/model/helpers.d.ts +0 -36
- package/dist/core/model/images/Wimages.d.ts +0 -79
- package/dist/core/model/images/index.d.ts +0 -2
- package/dist/core/model/index.d.ts +0 -20
- package/dist/core/model/logic/base/Region.d.ts +0 -31
- package/dist/core/model/logic/header/SubTableHeaderRegion.d.ts +0 -19
- package/dist/core/model/logic/header/TableHeaderRegion.d.ts +0 -16
- package/dist/core/model/logic/index.d.ts +0 -20
- package/dist/core/model/logic/subtable/bounded/BoundedItemRegion.d.ts +0 -15
- package/dist/core/model/logic/subtable/bounded/BoundedRegion.d.ts +0 -48
- package/dist/core/model/logic/subtable/link/CheckTableRegion.d.ts +0 -11
- package/dist/core/model/logic/subtable/link/DataGroup2DRegion.d.ts +0 -15
- package/dist/core/model/logic/subtable/link/LinkSubTableRegion.d.ts +0 -48
- package/dist/core/model/logic/subtable/link/_2DTableRegion.d.ts +0 -11
- package/dist/core/model/logic/subtable/repeating/MaterialConsumeTableRegion.d.ts +0 -44
- package/dist/core/model/logic/subtable/repeating/RepeatingRegion.d.ts +0 -101
- package/dist/core/model/logic/subtable/shared/dataGroupSlotCount.d.ts +0 -54
- package/dist/core/model/logic/subtable/shared/itemRegionOps.d.ts +0 -11
- package/dist/core/model/logic/subtable/shared/merged-table-range.d.ts +0 -4
- package/dist/core/model/logic/subtable/shared/regionValuePath.d.ts +0 -8
- package/dist/core/model/logic/types.d.ts +0 -11
- package/dist/core/model/overlays/Wlayout.d.ts +0 -74
- package/dist/core/model/overlays/Woverlay.d.ts +0 -41
- package/dist/core/model/overlays/Woverlays.d.ts +0 -45
- package/dist/core/model/settings/Wsettings.d.ts +0 -47
- package/dist/core/model/styles/WdocDefaults.d.ts +0 -23
- package/dist/core/model/styles/WparagraphProperties.d.ts +0 -42
- package/dist/core/model/styles/WrunProperties.d.ts +0 -43
- package/dist/core/model/styles/WstyleDefinition.d.ts +0 -38
- package/dist/core/model/styles/Wstyles.d.ts +0 -52
- package/dist/core/model/styles/index.d.ts +0 -5
- package/dist/core/model/templates/footer.template.d.ts +0 -75
- package/dist/core/model/templates/header.template.d.ts +0 -75
- package/dist/core/model/templates/image.template.d.ts +0 -259
- package/dist/core/model/templates/layout.template.d.ts +0 -66
- package/dist/core/model/templates/overlay.template.d.ts +0 -22
- package/dist/core/model/templates/paragraph.template.d.ts +0 -46
- package/dist/core/model/templates/table.template.d.ts +0 -66
- package/dist/core/model/templates/tableCell.template.d.ts +0 -44
- package/dist/core/model/templates/tableRow.template.d.ts +0 -13
- package/dist/core/model/templates/trPr.template.d.ts +0 -19
- package/dist/core/model/types/element.d.ts +0 -11
- package/dist/core/model/types/index.d.ts +0 -4
- package/dist/core/model/types/raw.d.ts +0 -20
- package/dist/core/model/types/region.d.ts +0 -12
- package/dist/core/model/types/style.d.ts +0 -57
- package/dist/core/model/types/table-border.d.ts +0 -18
- package/dist/core/runtime/DocumentRuntimeManager.d.ts +0 -38
- package/dist/core/table/border-selection.d.ts +0 -9
- package/dist/core/table/borders.d.ts +0 -42
- package/dist/core/view/Doc.d.ts +0 -160
- package/dist/core/view/Page.d.ts +0 -73
- package/dist/core/view/Paragraph.d.ts +0 -55
- package/dist/core/view/Section.d.ts +0 -74
- package/dist/core/view/Table.d.ts +0 -46
- package/dist/core/view/TableCell.d.ts +0 -60
- package/dist/core/view/TableRow.d.ts +0 -26
- package/dist/core/view/base/BandContainer.d.ts +0 -49
- package/dist/core/view/base/LayoutGroup.d.ts +0 -122
- package/dist/core/view/base/LayoutNode.d.ts +0 -77
- package/dist/core/view/base/OverlayContainer.d.ts +0 -31
- package/dist/core/view/base/OverlayLayout.d.ts +0 -19
- package/dist/core/view/base/index.d.ts +0 -4
- package/dist/core/view/context/DocPubApiContext.d.ts +0 -20
- package/dist/core/view/runs/ImageRun.d.ts +0 -60
- package/dist/core/view/runs/ImageWidget.d.ts +0 -40
- package/dist/core/view/runs/TextRun.d.ts +0 -140
- package/dist/core/view/runs/TextWidget.d.ts +0 -59
- package/dist/core/view/types/index.d.ts +0 -26
- package/dist/core/view/types/layout-node-by-component.d.ts +0 -38
- package/dist/core/view/utils/EventUtil.d.ts +0 -22
- package/dist/core/view/utils/TextUtil.d.ts +0 -122
- package/dist/core/widget/hyperlink.d.ts +0 -12
- package/dist/core/widget/index.d.ts +0 -5
- package/dist/core/widget/state.d.ts +0 -61
- package/dist/core/widget/types.d.ts +0 -190
- package/dist/domain/active/active-types.d.ts +0 -82
- package/dist/domain/constants/enum/device.d.ts +0 -26
- package/dist/domain/constants/enum/form.d.ts +0 -56
- package/dist/domain/constants/enum/image.d.ts +0 -15
- package/dist/domain/constants/enum/index.d.ts +0 -9
- package/dist/domain/constants/enum/lot.d.ts +0 -16
- package/dist/domain/constants/enum/product.d.ts +0 -9
- package/dist/domain/constants/enum/production-identification.d.ts +0 -19
- package/dist/domain/constants/enum/signature.d.ts +0 -44
- package/dist/domain/constants/enum/view.d.ts +0 -91
- package/dist/domain/constants/enum/widget.d.ts +0 -60
- package/dist/domain/constants/options.d.ts +0 -35
- package/dist/domain/device/device-query.d.ts +0 -10
- package/dist/domain/document-business/business/product-release/profile.d.ts +0 -2
- package/dist/domain/document-business/business/product-release/service.d.ts +0 -2
- package/dist/domain/document-business/index.d.ts +0 -2
- package/dist/domain/document-business/registry.d.ts +0 -2
- package/dist/domain/document-business/runtime/field-query-runtime.d.ts +0 -4
- package/dist/domain/document-business/types.d.ts +0 -24
- package/dist/domain/document-rule/index.d.ts +0 -3
- package/dist/domain/document-rule/runtime/decision-rule-evaluator.d.ts +0 -13
- package/dist/domain/document-rule/runtime/document-rule-runtime.d.ts +0 -19
- package/dist/domain/document-rule/types.d.ts +0 -50
- package/dist/domain/field/attach-field.d.ts +0 -15
- package/dist/domain/field/field-props-schema-type.d.ts +0 -94
- package/dist/domain/field/field-type.d.ts +0 -846
- package/dist/domain/field/form-value.d.ts +0 -104
- package/dist/domain/field/index.d.ts +0 -1
- package/dist/domain/field/lot-display-label.d.ts +0 -2
- package/dist/domain/field/option-spacing.d.ts +0 -8
- package/dist/domain/field/query-filter.d.ts +0 -15
- package/dist/domain/field/seal/seal-binding.d.ts +0 -19
- package/dist/domain/field/seal/seal-display.d.ts +0 -34
- package/dist/domain/field/seal/seal-value.d.ts +0 -39
- package/dist/domain/model/model-type.d.ts +0 -16
- package/dist/domain/object/date-object/index.d.ts +0 -4
- package/dist/domain/object/date-object/profile/field-keys.d.ts +0 -19
- package/dist/domain/object/date-object/profile/fields.d.ts +0 -2
- package/dist/domain/object/date-object/profile/index.d.ts +0 -3
- package/dist/domain/object/date-object/runtime/date-object-context.d.ts +0 -41
- package/dist/domain/object/date-object/runtime/date-object-runtime.d.ts +0 -41
- package/dist/domain/object/date-object/runtime/fetch-records.d.ts +0 -16
- package/dist/domain/object/date-object/runtime/object-handlers.d.ts +0 -6
- package/dist/domain/object/date-object/runtime/re-inspection-date.d.ts +0 -49
- package/dist/domain/object/date-object/runtime/row-change-handlers.d.ts +0 -6
- package/dist/domain/object/date-object/types.d.ts +0 -48
- package/dist/domain/paper-widget/paper-widget-props-schema-type.d.ts +0 -2
- package/dist/domain/table/business/check/check-table/actions/fetch-check-items.d.ts +0 -12
- package/dist/domain/table/business/check/check-table/actions/index.d.ts +0 -1
- package/dist/domain/table/business/check/check-table/front-config.d.ts +0 -21
- package/dist/domain/table/business/check/check-table/index.d.ts +0 -6
- package/dist/domain/table/business/check/check-table/profile/index.d.ts +0 -3
- package/dist/domain/table/business/check/check-table/runtime/check-table-dyn-value.d.ts +0 -20
- package/dist/domain/table/business/check/check-table/runtime/check-table-label-enricher.d.ts +0 -4
- package/dist/domain/table/business/check/check-table/runtime/expand-runtime-json.d.ts +0 -16
- package/dist/domain/table/business/check/check-table/runtime/index.d.ts +0 -5
- package/dist/domain/table/business/check/check-table/runtime/map-check-table-item-infos.d.ts +0 -9
- package/dist/domain/table/business/check/check-table/runtime/prepare-check-table-init.d.ts +0 -22
- package/dist/domain/table/business/check/check-table/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/check/check-table/types.d.ts +0 -34
- package/dist/domain/table/business/device/maintenance/index.d.ts +0 -1
- package/dist/domain/table/business/device/maintenance/profile/field-keys.d.ts +0 -9
- package/dist/domain/table/business/device/maintenance/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/device/maintenance/profile/index.d.ts +0 -3
- package/dist/domain/table/business/device/point-inspection/index.d.ts +0 -1
- package/dist/domain/table/business/device/point-inspection/profile/field-keys.d.ts +0 -9
- package/dist/domain/table/business/device/point-inspection/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/device/point-inspection/profile/index.d.ts +0 -3
- package/dist/domain/table/business/device/runtime/device-signature-lock-engine.d.ts +0 -13
- package/dist/domain/table/business/device/signature-lock.d.ts +0 -26
- package/dist/domain/table/business/material/material-balance/actions/fetch-material-consume-data.d.ts +0 -7
- package/dist/domain/table/business/material/material-balance/actions/index.d.ts +0 -3
- package/dist/domain/table/business/material/material-balance/actions/open-consume-modal.d.ts +0 -7
- package/dist/domain/table/business/material/material-balance/components/material-consume-modal.vue.d.ts +0 -6
- package/dist/domain/table/business/material/material-balance/index.d.ts +0 -2
- package/dist/domain/table/business/material/material-balance/profile/field-keys.d.ts +0 -25
- package/dist/domain/table/business/material/material-balance/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/material/material-balance/profile/index.d.ts +0 -4
- package/dist/domain/table/business/material/material-balance/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/material/material-balance/runtime/use-consume-modal-cleanup.d.ts +0 -3
- package/dist/domain/table/business/material/material-consume/index.d.ts +0 -2
- package/dist/domain/table/business/material/material-consume/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/material/material-consume/profile/index.d.ts +0 -4
- package/dist/domain/table/business/material/material-consume/profile/product-fields.d.ts +0 -6
- package/dist/domain/table/business/material/material-consume/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/material/material-consume/runtime/row-change-handlers.d.ts +0 -2
- package/dist/domain/table/business/material/material-requisition/index.d.ts +0 -2
- package/dist/domain/table/business/material/material-requisition/profile/field-keys.d.ts +0 -34
- package/dist/domain/table/business/material/material-requisition/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/material/material-requisition/profile/index.d.ts +0 -4
- package/dist/domain/table/business/material/material-requisition/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/material/material-requisition/runtime/row-change-handlers.d.ts +0 -5
- package/dist/domain/table/business/material/material-substitution/actions/scan.d.ts +0 -3
- package/dist/domain/table/business/material/material-substitution/index.d.ts +0 -3
- package/dist/domain/table/business/material/material-substitution/profile/field-keys.d.ts +0 -41
- package/dist/domain/table/business/material/material-substitution/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/material/material-substitution/profile/index.d.ts +0 -4
- package/dist/domain/table/business/material/material-substitution/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/material/material-substitution/runtime/row-change-handlers.d.ts +0 -6
- package/dist/domain/table/business/material/material-substitution/runtime/scan-fill.d.ts +0 -4
- package/dist/domain/table/business/material/types.d.ts +0 -201
- package/dist/domain/table/business/preprocess/pretreatment-list/actions/index.d.ts +0 -1
- package/dist/domain/table/business/preprocess/pretreatment-list/actions/scan.d.ts +0 -6
- package/dist/domain/table/business/preprocess/pretreatment-list/index.d.ts +0 -2
- package/dist/domain/table/business/preprocess/pretreatment-list/profile/field-keys.d.ts +0 -45
- package/dist/domain/table/business/preprocess/pretreatment-list/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/preprocess/pretreatment-list/profile/index.d.ts +0 -3
- package/dist/domain/table/business/preprocess/pretreatment-list/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/preprocess/pretreatment-list/runtime/row-change-handlers.d.ts +0 -25
- package/dist/domain/table/business/shared/production-container-hyperlink-enricher.d.ts +0 -7
- package/dist/domain/table/business/shared/production-identification-scan-api.d.ts +0 -17
- package/dist/domain/table/business/shared/scan-action.d.ts +0 -43
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/actions/index.d.ts +0 -1
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/actions/scan.d.ts +0 -6
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/index.d.ts +0 -2
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/profile/field-keys.d.ts +0 -26
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/profile/index.d.ts +0 -3
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/sterilize/entrust-steril-batch-list/runtime/row-change-handlers.d.ts +0 -5
- package/dist/domain/table/business/warehouse/device-part-consume/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/device-part-consume/profile/field-keys.d.ts +0 -35
- package/dist/domain/table/business/warehouse/device-part-consume/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/device-part-consume/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/device-part-consume/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/device-part-consume/runtime/row-change-handlers.d.ts +0 -3
- package/dist/domain/table/business/warehouse/part-stocktake/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/part-stocktake/profile/field-keys.d.ts +0 -38
- package/dist/domain/table/business/warehouse/part-stocktake/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/part-stocktake/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/part-stocktake/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/part-stocktake/runtime/row-change-handlers.d.ts +0 -6
- package/dist/domain/table/business/warehouse/shared/inventory-scan-api.d.ts +0 -19
- package/dist/domain/table/business/warehouse/shared/inventory-scan-columns.d.ts +0 -6
- package/dist/domain/table/business/warehouse/warehouse-allocate/actions/index.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-allocate/actions/scan.d.ts +0 -8
- package/dist/domain/table/business/warehouse/warehouse-allocate/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-allocate/profile/field-keys.d.ts +0 -46
- package/dist/domain/table/business/warehouse/warehouse-allocate/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-allocate/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-allocate/runtime/before-btn-click.d.ts +0 -5
- package/dist/domain/table/business/warehouse/warehouse-allocate/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-allocate/runtime/row-change-handlers.d.ts +0 -6
- package/dist/domain/table/business/warehouse/warehouse-in/actions/index.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-in/actions/scan.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-in/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-in/profile/field-keys.d.ts +0 -45
- package/dist/domain/table/business/warehouse/warehouse-in/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-in/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-in/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-in/runtime/row-change-handlers.d.ts +0 -12
- package/dist/domain/table/business/warehouse/warehouse-in-out/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-in-out/profile/field-keys.d.ts +0 -8
- package/dist/domain/table/business/warehouse/warehouse-in-out/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-in-out/profile/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-inbound/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-inbound/profile/field-keys.d.ts +0 -32
- package/dist/domain/table/business/warehouse/warehouse-inbound/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-inbound/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-inbound/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-inbound/runtime/row-change-handlers.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-inventory/actions/index.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-inventory/actions/scan.d.ts +0 -9
- package/dist/domain/table/business/warehouse/warehouse-inventory/index.d.ts +0 -4
- package/dist/domain/table/business/warehouse/warehouse-inventory/profile/api.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-inventory/profile/field-keys.d.ts +0 -54
- package/dist/domain/table/business/warehouse/warehouse-inventory/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-inventory/profile/index.d.ts +0 -4
- package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/row-change-handlers.d.ts +0 -6
- package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/stocktake-calc.d.ts +0 -23
- package/dist/domain/table/business/warehouse/warehouse-inventory/runtime/stocktake-dimension.d.ts +0 -10
- package/dist/domain/table/business/warehouse/warehouse-inventory/types.d.ts +0 -35
- package/dist/domain/table/business/warehouse/warehouse-out/actions/index.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-out/actions/scan.d.ts +0 -7
- package/dist/domain/table/business/warehouse/warehouse-out/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-out/profile/field-keys.d.ts +0 -44
- package/dist/domain/table/business/warehouse/warehouse-out/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-out/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-out/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-out/runtime/row-change-handlers.d.ts +0 -5
- package/dist/domain/table/business/warehouse/warehouse-outbound/index.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-outbound/profile/field-keys.d.ts +0 -34
- package/dist/domain/table/business/warehouse/warehouse-outbound/profile/fields.d.ts +0 -2
- package/dist/domain/table/business/warehouse/warehouse-outbound/profile/index.d.ts +0 -3
- package/dist/domain/table/business/warehouse/warehouse-outbound/runtime/register-handlers.d.ts +0 -1
- package/dist/domain/table/business/warehouse/warehouse-outbound/runtime/row-change-handlers.d.ts +0 -2
- package/dist/domain/table/data/dynamic-table/index.d.ts +0 -2
- package/dist/domain/table/data/dynamic-table/profile/index.d.ts +0 -3
- package/dist/domain/table/data/fixed-table/index.d.ts +0 -2
- package/dist/domain/table/data/fixed-table/profile/index.d.ts +0 -3
- package/dist/domain/table/data/two-d-table/index.d.ts +0 -2
- package/dist/domain/table/data/two-d-table/profile/index.d.ts +0 -3
- package/dist/domain/table/design/autofill-expander.d.ts +0 -22
- package/dist/domain/table/design/hooks/on-bounded-default-props.d.ts +0 -3
- package/dist/domain/table/design/hooks/on-field-attach.d.ts +0 -19
- package/dist/domain/table/design/hooks/on-repeating-default-props.d.ts +0 -3
- package/dist/domain/table/design/hooks/on-subtable-create.d.ts +0 -22
- package/dist/domain/table/design/label.d.ts +0 -2
- package/dist/domain/table/design/ribbon-options.d.ts +0 -17
- package/dist/domain/table/design/sub-model-matcher.d.ts +0 -21
- package/dist/domain/table/design/theme/region-item-theme.d.ts +0 -6
- package/dist/domain/table/design/theme/table-theme.d.ts +0 -12
- package/dist/domain/table/design/validate-nested-table-insert.d.ts +0 -3
- package/dist/domain/table/design/validate-nested-table-region.d.ts +0 -31
- package/dist/domain/table/design/validate-table-selection.d.ts +0 -36
- package/dist/domain/table/index.d.ts +0 -20
- package/dist/domain/table/registry.d.ts +0 -22
- package/dist/domain/table/runtime/api/biz-service-api.d.ts +0 -12
- package/dist/domain/table/runtime/engines/init-load-engine.d.ts +0 -18
- package/dist/domain/table/runtime/engines/linkage-engine.d.ts +0 -72
- package/dist/domain/table/runtime/engines/main-field-bind-engine.d.ts +0 -9
- package/dist/domain/table/runtime/engines/remote-sync-engine.d.ts +0 -37
- package/dist/domain/table/runtime/engines/row-runtime-engine.d.ts +0 -19
- package/dist/domain/table/runtime/engines/rule-engine.d.ts +0 -35
- package/dist/domain/table/runtime/option-fill-updates.d.ts +0 -6
- package/dist/domain/table/runtime/row-change-utils.d.ts +0 -25
- package/dist/domain/table/runtime/runtime-handlers.d.ts +0 -76
- package/dist/domain/table/runtime/table-runtime-context.d.ts +0 -58
- package/dist/domain/table/runtime/table-runtime-utils.d.ts +0 -30
- package/dist/domain/table/runtime/table-runtime.d.ts +0 -84
- package/dist/domain/table/types.d.ts +0 -539
- package/dist/index.d.ts +0 -5
- package/dist/index.es.js +0 -216349
- package/dist/runtime/_register_/composables/index.d.ts +0 -4
- package/dist/runtime/_register_/composables/panel/useActivePanel.d.ts +0 -18
- package/dist/runtime/_register_/composables/useModelData.d.ts +0 -13
- package/dist/runtime/_register_/composables/useModelLoader.d.ts +0 -10
- package/dist/runtime/_register_/composables/useModelState.d.ts +0 -9
- package/dist/runtime/_register_/context/DesignSuiteContext.d.ts +0 -37
- package/dist/runtime/_register_/context/InteractionContext.d.ts +0 -2
- package/dist/runtime/_register_/context/index.d.ts +0 -2
- package/dist/runtime/_register_/hooks/index.d.ts +0 -1
- package/dist/runtime/_register_/hooks/useRegisterSuite.d.ts +0 -6
- package/dist/runtime/_register_/index.d.ts +0 -4
- package/dist/runtime/_register_/runtime/SuiteRuntime.d.ts +0 -45
- package/dist/runtime/canvas/__common__/context-menu/index.type.d.ts +0 -9
- package/dist/runtime/canvas/__common__/context-menu/index.vue.d.ts +0 -8
- package/dist/runtime/canvas/__common__/context-menu/resolve-table-context.d.ts +0 -10
- package/dist/runtime/canvas/__common__/context-menu/resolve-table-menu-index.d.ts +0 -9
- package/dist/runtime/canvas/__common__/context-menu/table-menu.vue.d.ts +0 -7
- package/dist/runtime/canvas/__common__/widget-component.vue.d.ts +0 -9
- package/dist/runtime/canvas/__common__/widget-container/index.vue.d.ts +0 -13
- package/dist/runtime/canvas/__common__/widget-container/overlay-design.vue.d.ts +0 -33
- package/dist/runtime/canvas/__common__/widget-container/overlay-icon.vue.d.ts +0 -5
- package/dist/runtime/canvas/__common__/widget-container/overlay-layer.vue.d.ts +0 -42
- package/dist/runtime/canvas/__common__/widget-container/overlay-render.vue.d.ts +0 -102
- package/dist/runtime/canvas/constants/base-attrs.d.ts +0 -10
- package/dist/runtime/canvas/constants/index.d.ts +0 -1
- package/dist/runtime/canvas/doc-layout.vue.d.ts +0 -34
- package/dist/runtime/canvas/index.d.ts +0 -2
- package/dist/runtime/canvas/inline-image/inline-image.vue.d.ts +0 -7
- package/dist/runtime/canvas/inline-image/resize-box.vue.d.ts +0 -32
- package/dist/runtime/canvas/node/index.d.ts +0 -3
- package/dist/runtime/canvas/node/overlay-layout.vue.d.ts +0 -6
- package/dist/runtime/canvas/node/paragraph.vue.d.ts +0 -6
- package/dist/runtime/canvas/node/seal-overlay.vue.d.ts +0 -6
- package/dist/runtime/canvas/node/text-character.vue.d.ts +0 -9
- package/dist/runtime/canvas/overlay/page-overlay-group.vue.d.ts +0 -8
- package/dist/runtime/canvas/paper/header-footer-guides.vue.d.ts +0 -6
- package/dist/runtime/canvas/paper/inner-corner-mark.vue.d.ts +0 -6
- package/dist/runtime/canvas/paper/paper-group.vue.d.ts +0 -18
- package/dist/runtime/canvas/paper/paper-hit-rect.vue.d.ts +0 -7
- package/dist/runtime/canvas/paper/themes.d.ts +0 -37
- package/dist/runtime/canvas/print-capture.d.ts +0 -12
- package/dist/runtime/canvas/table/design/table-action-overlay/index.vue.d.ts +0 -20
- package/dist/runtime/canvas/table/design/table-cell-highlight.vue.d.ts +0 -14
- package/dist/runtime/canvas/table/design/table-guide-line.vue.d.ts +0 -11
- package/dist/runtime/canvas/table/design/table-structure-overlay/dynamic-label.vue.d.ts +0 -17
- package/dist/runtime/canvas/table/design/table-structure-overlay/index.vue.d.ts +0 -9
- package/dist/runtime/canvas/table/design/table-structure-overlay/outline-lines.vue.d.ts +0 -9
- package/dist/runtime/canvas/table/design/table-structure-overlay/placeholder-label.vue.d.ts +0 -10
- package/dist/runtime/canvas/table/render/label-parse-rule/index.d.ts +0 -2
- package/dist/runtime/canvas/table/render/label-parse-rule/type.d.ts +0 -62
- package/dist/runtime/canvas/table/render/label-parse-rule/useLabelParsingRules.d.ts +0 -39
- package/dist/runtime/canvas/table/render/material-consume/bom-validator.d.ts +0 -324
- package/dist/runtime/canvas/table/render/material-consume/context-key.d.ts +0 -6
- package/dist/runtime/canvas/table/render/material-consume/derived-qty.d.ts +0 -5
- package/dist/runtime/canvas/table/render/material-consume/index.d.ts +0 -5
- package/dist/runtime/canvas/table/render/material-consume/initial-product-autofill.d.ts +0 -6
- package/dist/runtime/canvas/table/render/material-consume/material-consume-group-merge.d.ts +0 -47
- package/dist/runtime/canvas/table/render/material-consume/material-consume-table-controller.d.ts +0 -361
- package/dist/runtime/canvas/table/render/material-consume/material-consume.util.d.ts +0 -15
- package/dist/runtime/canvas/table/render/material-consume/object-product-autofill.d.ts +0 -25
- package/dist/runtime/canvas/table/render/material-consume/product-autofill.d.ts +0 -7
- package/dist/runtime/canvas/table/render/material-consume/product-id-query.d.ts +0 -31
- package/dist/runtime/canvas/table/render/material-consume/product-source.d.ts +0 -4
- package/dist/runtime/canvas/table/render/material-consume/scan-fill.d.ts +0 -15
- package/dist/runtime/canvas/table/render/material-consume/scan-validator.d.ts +0 -192
- package/dist/runtime/canvas/table/render/material-consume/service.d.ts +0 -87
- package/dist/runtime/canvas/table/render/material-consume/tmpl-bom-controller.d.ts +0 -83
- package/dist/runtime/canvas/table/render/material-consume/transform.d.ts +0 -12
- package/dist/runtime/canvas/table/render/material-consume/uom-convert-runtime.d.ts +0 -51
- package/dist/runtime/canvas/table/render/table-structure-overlay/index.vue.d.ts +0 -9
- package/dist/runtime/canvas/table/render/table-structure-overlay/sub-table-action/bounded-table-action.vue.d.ts +0 -10
- package/dist/runtime/canvas/table/render/table-structure-overlay/sub-table-action/business-scan-menu.d.ts +0 -12
- package/dist/runtime/canvas/table/render/table-structure-overlay/sub-table-action/fixed-quick-fill-layout.d.ts +0 -30
- package/dist/runtime/canvas/table/render/table-structure-overlay/sub-table-action/index.d.ts +0 -3
- package/dist/runtime/canvas/table/render/table-structure-overlay/sub-table-action/quick-fill.util.d.ts +0 -32
- package/dist/runtime/canvas/table/render/table-structure-overlay/sub-table-action/repeating-table-action.vue.d.ts +0 -10
- package/dist/runtime/canvas/table/shared/resolve-cell-row-change-style.d.ts +0 -34
- package/dist/runtime/canvas/table/shared/table-background.vue.d.ts +0 -6
- package/dist/runtime/canvas/table/shared/table-cell.vue.d.ts +0 -6
- package/dist/runtime/canvas/table/shared/table-form-change-overlay.vue.d.ts +0 -6
- package/dist/runtime/canvas/table/shared/table-lines.vue.d.ts +0 -12
- package/dist/runtime/canvas/table/table-design.vue.d.ts +0 -12
- package/dist/runtime/canvas/table/table-presentation.d.ts +0 -16
- package/dist/runtime/canvas/table/table-render.vue.d.ts +0 -11
- package/dist/runtime/canvas/table/table.vue.d.ts +0 -6
- package/dist/runtime/canvas/table/utils/index.d.ts +0 -48
- package/dist/runtime/canvas/table/utils/paint-table-borders.d.ts +0 -4
- package/dist/runtime/canvas/table/utils/useTableSelection.d.ts +0 -70
- package/dist/runtime/canvas/types/index.d.ts +0 -4
- package/dist/runtime/designer/main/editable-canvas.vue.d.ts +0 -50
- package/dist/runtime/designer/panel/panel-breadcrumb-separator.vue.d.ts +0 -2
- package/dist/runtime/designer/panel/panel-nav.d.ts +0 -13
- package/dist/runtime/designer/panel/panel.vue.d.ts +0 -2
- package/dist/runtime/designer/ribbon/common/button-icon.vue.d.ts +0 -13
- package/dist/runtime/designer/ribbon/components/insert-table-form-modal.vue.d.ts +0 -17
- package/dist/runtime/designer/ribbon/components/marker-color-select.vue.d.ts +0 -77
- package/dist/runtime/designer/ribbon/components/set-table-header-form-modal.vue.d.ts +0 -18
- package/dist/runtime/designer/ribbon/components/sub-table-form-modal.vue.d.ts +0 -25
- package/dist/runtime/designer/ribbon/components/table-ribbon-group.vue.d.ts +0 -2
- package/dist/runtime/designer/ribbon/components/text-color-select.vue.d.ts +0 -93
- package/dist/runtime/designer/ribbon/constant/color.d.ts +0 -62
- package/dist/runtime/designer/ribbon/constant/font.d.ts +0 -40
- package/dist/runtime/designer/ribbon/constant/word.d.ts +0 -26
- package/dist/runtime/designer/ribbon/hooks/useDhrEdition.d.ts +0 -7
- package/dist/runtime/designer/ribbon/ribbon.vue.d.ts +0 -2
- package/dist/runtime/designer/ribbon/svg/bj-marker-svg.vue.d.ts +0 -7
- package/dist/runtime/designer/ribbon/svg/color-wheel-svg.vue.d.ts +0 -2
- package/dist/runtime/designer/ribbon/svg/font-color-svg.vue.d.ts +0 -7
- package/dist/runtime/designer/ribbon/svg/table/table-svg-icon.vue.d.ts +0 -11
- package/dist/runtime/designer/ribbon/svg/table-border-icon.vue.d.ts +0 -6
- package/dist/runtime/designer/ribbon/tabs/word-tab.vue.d.ts +0 -2
- package/dist/runtime/designer/toolkit/renderer/add-field-btn.vue.d.ts +0 -8
- package/dist/runtime/designer/toolkit/renderer/field-palette/field-palette.vue.d.ts +0 -15
- package/dist/runtime/designer/toolkit/renderer/field-palette/index.d.ts +0 -14
- package/dist/runtime/designer/toolkit/renderer/toolkit-content-fields.vue.d.ts +0 -4
- package/dist/runtime/designer/toolkit/renderer/toolkit-content-widgets.vue.d.ts +0 -2
- package/dist/runtime/designer/toolkit/svg/toolkit-svg-icon.vue.d.ts +0 -9
- package/dist/runtime/designer/toolkit/toolkit-item.vue.d.ts +0 -51
- package/dist/runtime/designer/toolkit/toolkit.vue.d.ts +0 -221
- package/dist/runtime/factories/createDesignWidgetFactory.d.ts +0 -21
- package/dist/runtime/factories/modules/useSpecificConfig.d.ts +0 -2
- package/dist/runtime/factories/useDependency.d.ts +0 -5
- package/dist/runtime/factories/useWidgetInitializer.d.ts +0 -13
- package/dist/runtime/factories/useWidgetRenderData.d.ts +0 -52
- package/dist/runtime/interface/change-diff.d.ts +0 -24
- package/dist/runtime/interface/computed.d.ts +0 -42
- package/dist/runtime/interface/context-defaults.d.ts +0 -9
- package/dist/runtime/interface/data.d.ts +0 -45
- package/dist/runtime/interface/fetchers.d.ts +0 -110
- package/dist/runtime/interface/form-change-row.d.ts +0 -78
- package/dist/runtime/interface/render.d.ts +0 -45
- package/dist/runtime/interface/sterilization-date.d.ts +0 -9
- package/dist/runtime/interface/validate-designer-default.d.ts +0 -5
- package/dist/runtime/renderer/dialogs/device-scan/device-scan-dialog.vue.d.ts +0 -199
- package/dist/runtime/renderer/dialogs/device-scan/submit-device-scan.d.ts +0 -29
- package/dist/runtime/renderer/dialogs/dialog-container.vue.d.ts +0 -21
- package/dist/runtime/renderer/dialogs/document-rule-prompt/document-rule-prompt.vue.d.ts +0 -5
- package/dist/runtime/renderer/dialogs/document-rule-prompt/open-document-rule-prompt.d.ts +0 -2
- package/dist/runtime/renderer/dialogs/e-sop-view/open-e-sop-view.d.ts +0 -3
- package/dist/runtime/renderer/dialogs/field-hyperlink/open-field-hyperlink.d.ts +0 -2
- package/dist/runtime/renderer/dialogs/seal/open-seal-flow.d.ts +0 -3
- package/dist/runtime/renderer/dialogs/seal/seal-api.d.ts +0 -17
- package/dist/runtime/renderer/dialogs/seal/seal-confirm-dialog.vue.d.ts +0 -7
- package/dist/runtime/renderer/dialogs/seal/seal-runtime.d.ts +0 -30
- package/dist/runtime/renderer/dialogs/seal/types.d.ts +0 -17
- package/dist/runtime/renderer/dialogs/seal/use-seal-confirm.d.ts +0 -27
- package/dist/runtime/renderer/dialogs/signature/authentication/signature-authentication.vue.d.ts +0 -27
- package/dist/runtime/renderer/dialogs/signature/authentication/types.d.ts +0 -30
- package/dist/runtime/renderer/dialogs/signature/authentication/useSignatureAuthentication.d.ts +0 -29
- package/dist/runtime/renderer/dialogs/signature/card-signer.vue.d.ts +0 -14
- package/dist/runtime/renderer/dialogs/signature/logic.d.ts +0 -27
- package/dist/runtime/renderer/dialogs/signature/security-config.d.ts +0 -6
- package/dist/runtime/renderer/dialogs/signature/signature-autofill-runtime.d.ts +0 -14
- package/dist/runtime/renderer/dialogs/signature/signature-dialog.vue.d.ts +0 -76
- package/dist/runtime/renderer/dialogs/signature/validate-signature-config.d.ts +0 -5
- package/dist/runtime/renderer/dialogs/upload-file/base-upload-file.vue.d.ts +0 -20
- package/dist/runtime/renderer/dialogs/upload-file/upload-file-dialog.vue.d.ts +0 -54
- package/dist/runtime/renderer/dialogs/upload-image/base-upload-image.vue.d.ts +0 -21
- package/dist/runtime/renderer/dialogs/upload-image/upload-image-dialog.vue.d.ts +0 -55
- package/dist/runtime/renderer/dropdowns/components/datetime-dropdown.vue.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/dropdown-container.vue.d.ts +0 -25
- package/dist/runtime/renderer/dropdowns/components/option-dropdown.vue.d.ts +0 -197
- package/dist/runtime/renderer/dropdowns/components/tables/columns/base/selection.d.ts +0 -14
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/biz.d.ts +0 -33
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/device.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/group.d.ts +0 -44
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/lot2sn.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/material-consume-history.d.ts +0 -17
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/mfg-order.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/part-inventory-ndo.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/part-ndo.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/product-ndo.d.ts +0 -23
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/rdo-ref.d.ts +0 -22
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/ref.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/business/route-operation.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/columns/columns.d.ts +0 -58
- package/dist/runtime/renderer/dropdowns/components/tables/component/base-vxe-table.vue.d.ts +0 -72
- package/dist/runtime/renderer/dropdowns/components/tables/component/device-type-select.vue.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/component/pagination-control.vue.d.ts +0 -14
- package/dist/runtime/renderer/dropdowns/components/tables/component/rdo-version-name-tag.vue.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tables/composables/useMaterialSubstitutionSource.d.ts +0 -7
- package/dist/runtime/renderer/dropdowns/components/tables/composables/useSearchEnter.d.ts +0 -18
- package/dist/runtime/renderer/dropdowns/components/tables/composables/useSelectTable.d.ts +0 -103
- package/dist/runtime/renderer/dropdowns/components/tables/composables/useTableDropdown.d.ts +0 -29
- package/dist/runtime/renderer/dropdowns/components/tables/rdo-table-dropdown.vue.d.ts +0 -313
- package/dist/runtime/renderer/dropdowns/components/tables/strategy/merge-select-source.d.ts +0 -10
- package/dist/runtime/renderer/dropdowns/components/tables/strategy/selectStrategy.d.ts +0 -70
- package/dist/runtime/renderer/dropdowns/components/tables/table-dropdown.vue.d.ts +0 -308
- package/dist/runtime/renderer/dropdowns/components/tables/table-option-dropdown.vue.d.ts +0 -338
- package/dist/runtime/renderer/dropdowns/components/tables/utils/assoc-filter.d.ts +0 -17
- package/dist/runtime/renderer/dropdowns/components/tables/utils/quick-search.d.ts +0 -32
- package/dist/runtime/renderer/dropdowns/components/time-dropdown.vue.d.ts +0 -11
- package/dist/runtime/renderer/dropdowns/components/tree/tree-dropdown.vue.d.ts +0 -196
- package/dist/runtime/renderer/dropdowns/components/tree/tree-node.vue.d.ts +0 -17
- package/dist/runtime/renderer/dropdowns/composables/useDropdownSearchFocus.d.ts +0 -9
- package/dist/runtime/renderer/dropdowns/composables/useDropdownViewportSize.d.ts +0 -7
- package/dist/runtime/renderer/dropdowns/factories/dropdown-factory.d.ts +0 -25
- package/dist/runtime/renderer/dropdowns/factories/index.d.ts +0 -2
- package/dist/runtime/renderer/field-preview/active-preview.d.ts +0 -7
- package/dist/runtime/renderer/field-preview/attachment-file-popover.vue.d.ts +0 -8
- package/dist/runtime/renderer/field-preview/field-preview-overlay.vue.d.ts +0 -34
- package/dist/runtime/renderer/field-preview/image-preview-popover.vue.d.ts +0 -7
- package/dist/runtime/renderer/field-preview/index.d.ts +0 -4
- package/dist/runtime/renderer/field-preview/types.d.ts +0 -5
- package/dist/runtime/renderer/main/preview-canvas.vue.d.ts +0 -54
- package/dist/runtime/renderer/validation/validation-comment-item.vue.d.ts +0 -14
- package/dist/runtime/renderer/validation/validation-comment-layer.vue.d.ts +0 -2
- package/dist/runtime/validation/admission.d.ts +0 -29
- package/dist/runtime/validation/createValidateFactory.d.ts +0 -14
- package/dist/runtime/validation/index.d.ts +0 -6
- package/dist/runtime/validation/layout.d.ts +0 -35
- package/dist/runtime/validation/merge.d.ts +0 -3
- package/dist/runtime/validation/state.d.ts +0 -41
- package/dist/runtime/validation/useFormValidator.d.ts +0 -25
- package/dist/sdk/doc-runtime/composables/useDocController.d.ts +0 -16
- package/dist/sdk/doc-runtime/composables/useDocLooperAutoSaveNotify.d.ts +0 -24
- package/dist/sdk/doc-runtime/composables/useDocOperations.d.ts +0 -74
- package/dist/sdk/doc-runtime/composables/useDocRuntimeProvider.d.ts +0 -19
- package/dist/sdk/doc-runtime/composables/useDocSuite.d.ts +0 -20
- package/dist/sdk/doc-runtime/composables/useDocumentRulePrompt.d.ts +0 -3
- package/dist/sdk/doc-runtime/composables/useValidationFullSync.d.ts +0 -15
- package/dist/sdk/doc-runtime/device-link/resolve-field-focus-context.d.ts +0 -15
- package/dist/sdk/doc-runtime/device-link/useDeviceFieldFocusBridge.d.ts +0 -7
- package/dist/sdk/doc-runtime/device-link/useFormTmplAndModelInit.d.ts +0 -15
- package/dist/sdk/doc-runtime/device-link/useFormTmplConfig.d.ts +0 -10
- package/dist/sdk/doc-runtime/factories/document-initializer.d.ts +0 -67
- package/dist/sdk/doc-runtime/factories/document-request-strategy.d.ts +0 -3
- package/dist/sdk/doc-runtime/factories/runtime-data-sources.d.ts +0 -39
- package/dist/sdk/doc-runtime/factories/runtime-json-builder.d.ts +0 -13
- package/dist/sdk/doc-runtime/factories/useDocumentFactory.d.ts +0 -109
- package/dist/sdk/doc-runtime/factories/value-change-data-sources.d.ts +0 -7
- package/dist/sdk/doc-runtime/queries/template-placed-fields.d.ts +0 -7
- package/dist/sdk/doc-runtime/useWord.d.ts +0 -22
- package/dist/sdk/doc-runtime/utils/sub-field-config.d.ts +0 -9
- package/dist/sdk/doc-runtime/utils/wait-for-data-settle.d.ts +0 -8
- package/dist/sdk/doc-runtime/validators/validate-designer.d.ts +0 -4
- package/dist/sdk/doc-runtime/validators/validate-doc-designer.d.ts +0 -4
- package/dist/sdk/engine/index.d.ts +0 -19
- package/dist/sdk/index.d.ts +0 -15
- package/dist/sdk/plugins/index.d.ts +0 -17
- package/dist/sdk/plugins/register-panel-schemas.d.ts +0 -9
- package/dist/sdk/setup.d.ts +0 -66
- package/dist/sdk/types/action-button.d.ts +0 -43
- package/dist/sdk/types/designer-validation.d.ts +0 -16
- package/dist/sdk/types/field-model-query.d.ts +0 -26
- package/dist/sdk/types/form-tmpl-config.types.d.ts +0 -123
- package/dist/sdk/types/index.d.ts +0 -308
- package/dist/sdk/types/placed-form-field.d.ts +0 -6
- package/dist/sdk/vue/index.d.ts +0 -13
- package/dist/sdk/vue/layouts/doc-design-layout.vue.d.ts +0 -7
- package/dist/sdk/vue/layouts/doc-render-layout.vue.d.ts +0 -69
- package/dist/suites/edhr/component/gct-seal-render.vue.d.ts +0 -7
- package/dist/suites/edhr/component/index.d.ts +0 -2
- package/dist/suites/edhr/component/resolve-field-render-colors.d.ts +0 -33
- package/dist/suites/edhr/component/resolve-marker-color.d.ts +0 -7
- package/dist/suites/edhr/component/use-marker-render-colors.d.ts +0 -7
- package/dist/suites/edhr/index.d.ts +0 -3
- package/dist/suites/edhr/manifest/field/_common_/basic.d.ts +0 -113
- package/dist/suites/edhr/manifest/field/basic/boolean-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/date-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/date-time-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/decimal-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/double-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/integer-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/long-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/long-text-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/text-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/basic/time-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/destructive-test-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/good-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/inspection-module-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/inspection-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/material-check-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/not-good-group-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/not-good-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/not-good-reason-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/of-inst-num-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/operation-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/operation-output-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/operation-receive-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/product-check-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/product-release-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/production-date-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/production-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/quantity-received-qty-manifest.d.ts +0 -3
- package/dist/suites/edhr/manifest/field/business/report-end-time-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/report-start-time-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/reporter-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/routing-operation-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/scrap-group-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/scrap-material-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/scrap-material-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/scrap-qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/scrap-reason-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/udi-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/business/work-hours-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/index.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/attachment-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/e-sop-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/e-sop-version-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/image-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/model-relation-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/option-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/option-multi-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/org-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/org-multi-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/ref-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/seal-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/signature-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/user-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/logic/user-multi-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/location-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/stocktake-status-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/target-warehouse-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/warehouse-manager-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/warehouse-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/warehouse-receipt-date-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/material/warehouse-receipt-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/date-object-manifest.d.ts +0 -3
- package/dist/suites/edhr/manifest/field/object-type/device-parameter-object-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/inspection-parameter-object-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/material-consume-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/object-type-manifest.d.ts +0 -3
- package/dist/suites/edhr/manifest/field/object-type/process-parameter-object-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/qty-consumed-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/qty-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/qty-required-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/re-inspection-date-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/object-type/validity-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/device-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/external-reference-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/inspection-container-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/material-container-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/material-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/mfg-order-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/order-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/product-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/production-container-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/record-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/related-lot-no-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/shopfloor-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/sterilization-container-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/sterilization-date-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/field/trace/trace-date-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/index.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/_common_/basic.d.ts +0 -10
- package/dist/suites/edhr/manifest/paper-widget/basic/barcode-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/diagonal-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/image-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/line-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/pagination-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/qrcode-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/serialnumber-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/basic/timediff-manifest.d.ts +0 -2
- package/dist/suites/edhr/manifest/paper-widget/index.d.ts +0 -2
- package/dist/suites/edhr/model-field-runtime/field-provider.d.ts +0 -21
- package/dist/suites/edhr/model-field-runtime/model-provider.d.ts +0 -10
- package/dist/suites/edhr/panel-config/field/file/upload.d.ts +0 -25
- package/dist/suites/edhr/panel-config/index.d.ts +0 -5
- package/dist/suites/edhr/panel-router/index.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/2d-table/2DSubTablePanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/2d-table/2d-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/_shared/BoundedSubTablePanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/_shared/RepeatingSubTablePanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/_shared/create-table-panel-schema.d.ts +0 -3
- package/dist/suites/edhr/panel-schema/_shared/data-group-2d-title.d.ts +0 -7
- package/dist/suites/edhr/panel-schema/check-table/CheckTablePanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/check-table/add-ds-btn.vue.d.ts +0 -14
- package/dist/suites/edhr/panel-schema/check-table/check-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/data-group/DataGroupPanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/data-group/data-group.basic.d.ts +0 -14
- package/dist/suites/edhr/panel-schema/data-group-2d/DataGroup2DPanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/data-group-2d/data-group-2d.basic.d.ts +0 -16
- package/dist/suites/edhr/panel-schema/data-init/DataInitPanel.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/data-init/add-button.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/data-init/common/add-builtin-field/add-builtin-field-modal.vue.d.ts +0 -10
- package/dist/suites/edhr/panel-schema/data-init/common/add-builtin-field/add-builtin-field-select.vue.d.ts +0 -10
- package/dist/suites/edhr/panel-schema/data-init/common/add-builtin-param/add-builtin-param-modal.vue.d.ts +0 -10
- package/dist/suites/edhr/panel-schema/data-init/common/add-builtin-param/add-builtin-param-select.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/data-init/common/add-field/add-field-modal.vue.d.ts +0 -25
- package/dist/suites/edhr/panel-schema/data-init/common/add-field/add-field-select.vue.d.ts +0 -19
- package/dist/suites/edhr/panel-schema/data-init/common/add-field/useField.d.ts +0 -22
- package/dist/suites/edhr/panel-schema/data-init/common/add-ipaas/ipaas-param-config.vue.d.ts +0 -10
- package/dist/suites/edhr/panel-schema/data-init/common/add-online-form-model/online-form-model-select.vue.d.ts +0 -12
- package/dist/suites/edhr/panel-schema/data-init/common/add-sql/add-sql-input.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/data-init/common/add-sql/add-sql-modal.vue.d.ts +0 -7
- package/dist/suites/edhr/panel-schema/data-init/common/data-source-field-map.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/data-init/common/data-source-model-link.vue.d.ts +0 -39
- package/dist/suites/edhr/panel-schema/data-init/common/data-source-title.vue.d.ts +0 -19
- package/dist/suites/edhr/panel-schema/data-init/common/param-field-link.vue.d.ts +0 -10
- package/dist/suites/edhr/panel-schema/data-init/common/param-key-select.vue.d.ts +0 -18
- package/dist/suites/edhr/panel-schema/data-init/data-init.basic.d.ts +0 -5
- package/dist/suites/edhr/panel-schema/data-init/material-consume-object/bom-validator.d.ts +0 -71
- package/dist/suites/edhr/panel-schema/data-init/material-consume-object/index.d.ts +0 -3
- package/dist/suites/edhr/panel-schema/data-init/material-consume-object/linkage.d.ts +0 -76
- package/dist/suites/edhr/panel-schema/data-init/material-consume-object/use-tmpl-bom.d.ts +0 -13
- package/dist/suites/edhr/panel-schema/data-init/object-init/object-init.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/data-init/utils/index.d.ts +0 -215
- package/dist/suites/edhr/panel-schema/data-init/utils/json-param-logic.d.ts +0 -53
- package/dist/suites/edhr/panel-schema/data-init/utils/json-schema.d.ts +0 -18
- package/dist/suites/edhr/panel-schema/data-init/utils/sql.d.ts +0 -4
- package/dist/suites/edhr/panel-schema/dynamic-table/dynamic-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/entrust-steril-batch-list-table/entrust-steril-batch-list-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/field/FieldPanel.vue.d.ts +0 -6
- package/dist/suites/edhr/panel-schema/field/field-attribute-value.vue.d.ts +0 -26
- package/dist/suites/edhr/panel-schema/field/field-panel-chevron.vue.d.ts +0 -5
- package/dist/suites/edhr/panel-schema/field/field-panel-text-icon.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/field/field.basic.d.ts +0 -14
- package/dist/suites/edhr/panel-schema/fixed-table/fixed-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/index.d.ts +0 -101
- package/dist/suites/edhr/panel-schema/material-balance-table/material-balance-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/material-consume-table/MaterialConsumeTablePanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/material-consume-table/bom-entry-editor.vue.d.ts +0 -14
- package/dist/suites/edhr/panel-schema/material-consume-table/bom-product-name.vue.d.ts +0 -7
- package/dist/suites/edhr/panel-schema/material-consume-table/material-consume-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/material-consume-table/parse-rule-add-btn.vue.d.ts +0 -13
- package/dist/suites/edhr/panel-schema/material-consume-table/parse-rule-editor.vue.d.ts +0 -13
- package/dist/suites/edhr/panel-schema/material-consume-table/use-product-translate.d.ts +0 -3
- package/dist/suites/edhr/panel-schema/material-requisition-table/material-requisition-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/material-substitution-table/material-substitution-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/paper/PaperPanel.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/paper/modules/keep-exception-config.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/paper/modules/page-size-config/index.d.ts +0 -12
- package/dist/suites/edhr/panel-schema/paper/modules/page-size-config/page-size-config.vue.d.ts +0 -6
- package/dist/suites/edhr/panel-schema/paper/modules/signature-config.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/paper/modules/table-setting-config.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/paper/paper.basic.d.ts +0 -5
- package/dist/suites/edhr/panel-schema/paper-header-footer/PaperHeaderFooterPanel.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/paper-header-footer/paper-header-footer.basic.d.ts +0 -5
- package/dist/suites/edhr/panel-schema/paper-widget/PaperWidgetPanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/paper-widget/paper-widget.basic.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/pretreatment-list-table/pretreatment-list-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/rule/RulePanel.vue.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/rule/components/add-rule-button.vue.d.ts +0 -13
- package/dist/suites/edhr/panel-schema/rule/components/decision-rule-condition.vue.d.ts +0 -19
- package/dist/suites/edhr/panel-schema/rule/components/decision-rule-group.vue.d.ts +0 -16
- package/dist/suites/edhr/panel-schema/rule/components/field-map-row.vue.d.ts +0 -35
- package/dist/suites/edhr/panel-schema/rule/components/rule-item-card.vue.d.ts +0 -12
- package/dist/suites/edhr/panel-schema/rule/components/rule-section.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/rule/constants/builtin-field-maps.d.ts +0 -10
- package/dist/suites/edhr/panel-schema/rule/message-config/message-rule-modal.vue.d.ts +0 -12
- package/dist/suites/edhr/panel-schema/rule/message-config/message-rule.d.ts +0 -22
- package/dist/suites/edhr/panel-schema/rule/message-config/message-time-picker.vue.d.ts +0 -18
- package/dist/suites/edhr/panel-schema/rule/message-config/with-word-message-rule-fields.d.ts +0 -5
- package/dist/suites/edhr/panel-schema/rule/modals/inspection-decision-modal.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/rule/modals/open-inspection-decision-modal.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/rule/modals/open-rule-modal.d.ts +0 -2
- package/dist/suites/edhr/panel-schema/rule/modals/unit-field-map-modal.vue.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/rule/rule.basic.d.ts +0 -5
- package/dist/suites/edhr/panel-schema/rule/types.d.ts +0 -52
- package/dist/suites/edhr/panel-schema/rule/use-rules-config.d.ts +0 -70
- package/dist/suites/edhr/panel-schema/rule/utils/decision-rule.d.ts +0 -34
- package/dist/suites/edhr/panel-schema/rule/utils/rule-field-map.d.ts +0 -31
- package/dist/suites/edhr/panel-schema/rule/utils/uom-convert-rule.d.ts +0 -28
- package/dist/suites/edhr/panel-schema/table-header/TableHeaderPanel.vue.d.ts +0 -8
- package/dist/suites/edhr/panel-schema/table-header/table-header.basic.d.ts +0 -11
- package/dist/suites/edhr/panel-schema/warehouse-allocate-table/warehouse-allocate-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/warehouse-in-out-table/warehouse-in-out-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/warehouse-in-table/warehouse-in-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/warehouse-inventory-table/warehouse-inventory-table.basic.d.ts +0 -1
- package/dist/suites/edhr/panel-schema/warehouse-out-table/warehouse-out-table.basic.d.ts +0 -1
- package/dist/suites/eqm/index.d.ts +0 -3
- package/dist/suites/eqm/panel-router/index.d.ts +0 -2
- package/dist/suites/eqm/panel-schema/device-part-consume-table/device-part-consume-table.basic.d.ts +0 -1
- package/dist/suites/eqm/panel-schema/index.d.ts +0 -7
- package/dist/suites/eqm/panel-schema/part-stocktake-table/part-stocktake-table.basic.d.ts +0 -1
- package/dist/suites/eqm/panel-schema/warehouse-inbound-table/warehouse-inbound-table.basic.d.ts +0 -1
- package/dist/suites/eqm/panel-schema/warehouse-outbound-table/warehouse-outbound-table.basic.d.ts +0 -1
- package/dist/suites/medpro/index.d.ts +0 -1
- package/dist/suites/shared/components/option-control-colors.d.ts +0 -14
- package/dist/suites/shared/hooks/panel-props-source.d.ts +0 -36
- package/dist/suites/shared/hooks/useAttachedFieldActivate.d.ts +0 -6
- package/dist/suites/shared/hooks/useFieldPanel.d.ts +0 -8
- package/dist/suites/shared/hooks/useFieldPanelMeta.d.ts +0 -11
- package/dist/suites/shared/hooks/usePanelProps.d.ts +0 -19
- package/dist/suites/shared/hooks/useSubTablePanelBase.d.ts +0 -14
- package/dist/suites/shared/icon/landscape-icon.vue.d.ts +0 -2
- package/dist/suites/shared/icon/portrait-icon.vue.d.ts +0 -2
- package/dist/suites/shared/index.d.ts +0 -1
- package/dist/suites/shared/panel/config/editor/FormNumberEditor.vue.d.ts +0 -11
- package/dist/suites/shared/panel/config/editor/assoc-filter-editor/utils.d.ts +0 -9
- package/dist/suites/shared/panel/config/editor/attach-fields-editor/resolve-attach-field.d.ts +0 -5
- package/dist/suites/shared/panel/config/editor/attach-fields-editor/types.d.ts +0 -13
- package/dist/suites/shared/panel/config/editor/date-format-editor/logic.d.ts +0 -37
- package/dist/suites/shared/panel/config/editor/display-fields-editor/display-fields-editor.vue.d.ts +0 -16
- package/dist/suites/shared/panel/config/editor/display-fields-editor/display-fields.util.d.ts +0 -19
- package/dist/suites/shared/panel/config/editor/display-fields-editor/index.d.ts +0 -3
- package/dist/suites/shared/panel/config/editor/enum-opt-editor/types.d.ts +0 -15
- package/dist/suites/shared/panel/config/editor/field-config-visibility.d.ts +0 -2
- package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/barcode-parsing-rules-group-editor.vue.d.ts +0 -28
- package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/barcode-parsing-rules-string-editor.vue.d.ts +0 -21
- package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/qrcode-parse-editor.vue.d.ts +0 -17
- package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/qrcode-parse-modal.vue.d.ts +0 -20
- package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/types.d.ts +0 -18
- package/dist/suites/shared/panel/config/editor/qrcode-parse-editor/utils.d.ts +0 -38
- package/dist/suites/shared/panel/config/editor/quick-search-editor/quick-search.util.d.ts +0 -13
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/autofill-runtime.d.ts +0 -19
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/field-tree-node.vue.d.ts +0 -21
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/field-tree-select.vue.d.ts +0 -30
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/field-tree-utils.d.ts +0 -22
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/from-field-tree-utils.d.ts +0 -5
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/to-field-tree-utils.d.ts +0 -19
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/types.d.ts +0 -24
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/utils.d.ts +0 -12
- package/dist/suites/shared/panel/config/editor/regex-editor/common-regex-api.d.ts +0 -11
- package/dist/suites/shared/panel/config/editor/regex-editor/types.d.ts +0 -8
- package/dist/suites/shared/panel/config/editor/single-field-editor/types.d.ts +0 -9
- package/dist/suites/shared/panel/modules/confirm-before-delete-config.vue.d.ts +0 -5
- package/dist/suites/shared/panel/modules/field-dependency-module/field-dependency-modal.vue.d.ts +0 -30
- package/dist/suites/shared/panel/modules/field-dependency-module/field-dependency-module.vue.d.ts +0 -9
- package/dist/suites/shared/panel/modules/field-dependency-module/types.d.ts +0 -19
- package/dist/suites/shared/panel/modules/field-formula-module/field-formula-module.vue.d.ts +0 -16
- package/dist/suites/shared/panel/modules/field-formula-module/formula-field-options.d.ts +0 -2
- package/dist/suites/shared/panel/modules/online-form-tmpl-module/online-form-tmpl-utils.d.ts +0 -3
- package/dist/suites/shared/panel/modules/orientation-module.vue.d.ts +0 -10
- package/dist/suites/shared/panel/modules/padding-setting-module.vue.d.ts +0 -14
- package/dist/suites/shared/panel/modules/quick-fill-config.vue.d.ts +0 -6
- package/dist/suites/shared/panel/modules/sub-table-basic-info.vue.d.ts +0 -31
- package/dist/suites/shared/panel/modules/sub-table-grid-info.vue.d.ts +0 -12
- package/dist/suites/shared/panel/modules/table-setting-module.vue.d.ts +0 -11
- package/dist/suites/shared/panel/types/formula.type.d.ts +0 -140
- package/dist/suites/shared/panel/utils/default-value-visibility.d.ts +0 -3
- package/dist/suites/shared/panel/utils/open-design-modal.d.ts +0 -7
- package/dist/suites/shared/suite-features.d.ts +0 -19
- package/dist/utils/adapters/ServiceUtil.d.ts +0 -76
- package/dist/utils/adapters/TriggerUtil.d.ts +0 -27
- package/dist/utils/adapters/api.d.ts +0 -7
- package/dist/utils/composables/useDragLine.d.ts +0 -18
- package/dist/utils/composables/useHighlightSearch.d.ts +0 -5
- package/dist/utils/composables/useHoverDelay.d.ts +0 -5
- package/dist/utils/composables/useLatestRequest.d.ts +0 -6
- package/dist/utils/composables/usePagesToPdf.d.ts +0 -19
- package/dist/utils/fonts/cjk-font-catalog.d.ts +0 -50
- package/dist/utils/fonts/ensure-document-fonts.d.ts +0 -12
- package/dist/utils/func/base-formula-functions.d.ts +0 -8
- package/dist/utils/func/calc-used-fields.d.ts +0 -32
- package/dist/utils/func/click.d.ts +0 -13
- package/dist/utils/func/core.d.ts +0 -150
- package/dist/utils/func/dragdrop.d.ts +0 -40
- package/dist/utils/func/field.d.ts +0 -13
- package/dist/utils/func/file.d.ts +0 -2
- package/dist/utils/func/number-util.d.ts +0 -9
- package/dist/utils/func/withRequestCache.d.ts +0 -95
- package/dist/utils/pdf/collect-page-draw-ops.d.ts +0 -5
- package/dist/utils/pdf/collect-seal-draw-ops.d.ts +0 -4
- package/dist/utils/pdf/collect-widget-draw-ops.d.ts +0 -12
- package/dist/utils/pdf/export-vector-pdf.d.ts +0 -11
- package/dist/utils/pdf/pdf-page-painter.d.ts +0 -3
- package/dist/utils/pdf/resolve-field-text-style.d.ts +0 -12
- package/dist/utils/pdf/resolve-paper-widget-value.d.ts +0 -4
- package/dist/utils/pdf/resolve-pdf-text-baseline.d.ts +0 -11
- package/dist/utils/pdf/types.d.ts +0 -80
- package/dist/utils/symbol/contextKey.d.ts +0 -11
- package/dist/word.css +0 -15814
- package/vite/index.d.ts +0 -17
- package/vite/index.mjs +0 -39
- /package/dist/{domain/table/business/check/check-table/profile → types/runtime/form/business/inspection}/field-keys.d.ts +0 -0
- /package/dist/{domain/field/material-lot-validation.d.ts → types/runtime/form/business/materials/validation/lot-kind.d.ts} +0 -0
- /package/dist/{core/data/submit/fields.d.ts → types/runtime/form/submission/excluded-fields.d.ts} +0 -0
- /package/dist/{base → types/shared/ui}/breadcrumb/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/button/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/calendar/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/calendar/src/constant/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/checkbox/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/collapse/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/color-picker/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/color-picker/src/constant/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/date-time-picker/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/divider/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/dropdown/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/empty/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/empty/src/empty.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/form-item/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/icon/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/input/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/layout/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/loading/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/message/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/radio/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/scrollbar/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/segment-slider/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/slider/index.d.ts +0 -0
- /package/dist/{domain/index.d.ts → types/shared/ui/stylesheet.d.ts} +0 -0
- /package/dist/{base → types/shared/ui}/switch/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/tooltip/index.d.ts +0 -0
- /package/dist/{base → types/shared/ui}/tree/src/tree.type.d.ts +0 -0
- /package/dist/{domain/object/date-object/runtime/register-handlers.d.ts → types/shared/ui/utils/popper-themes.d.ts} +0 -0
|
@@ -0,0 +1,4621 @@
|
|
|
1
|
+
import { c as contentParagraphs, i as contentAncestors, l as contentRoot, n as invertPositionMaps, o as contentCollections, r as mapTextPosition, s as contentLeaves, t as invertOperation } from "./change-set-DNOw1FXo.js";
|
|
2
|
+
import { $ as string, A as writeProperty, B as isObject, C as ModelEditError, D as equalData, E as copyInputData, F as boolean, G as oneOf, I as cellRangeRule, J as paragraphStyleProperties, K as optional, L as cellStyleRule, M as array, N as at, O as freezeData, P as attachmentConditionRule, Q as rowHeightRule, R as extensionName, T as copyData, U as number, V as nonempty, W as object, X as positive, Y as paragraphStyleRule, _ as documentBusinessSchemas, a as readFactoryOptions, c as DocumentValidationError, et as tagged, g as ConfigRegistry, h as validateFragment, i as checkFactoryValue, j as validateEditData, k as readPropertyValue, m as validateFieldConfigEdit, n as commonFieldWidgets, nt as textStyleRule, o as readFieldBinding, p as validateDocumentEdit, r as checkFactoryOptions, s as readRemovalOptions, t as NodeFactory, tt as textStyleProperties, u as readDocument, w as cloneJsonData, z as imageAssetRule } from "./NodeFactory-D9gVGSok.js";
|
|
3
|
+
import { uniq } from "es-toolkit/array";
|
|
4
|
+
import { isBoolean, isEmptyObject, isFunction, isNull, isString, isUndefined } from "es-toolkit/predicate";
|
|
5
|
+
import { sumBy } from "es-toolkit/math";
|
|
6
|
+
import isObjectValue from "es-toolkit/compat/isObject";
|
|
7
|
+
import isArray from "es-toolkit/compat/isArray";
|
|
8
|
+
import isInteger from "es-toolkit/compat/isInteger";
|
|
9
|
+
import includes from "es-toolkit/compat/includes";
|
|
10
|
+
import { noop } from "es-toolkit/function";
|
|
11
|
+
// src/runtime/form/fields/core/paths.ts
|
|
12
|
+
/** 只解释已由 model 校验的绑定,不从字段命名推断业务轴。 */
|
|
13
|
+
function parseValuePath(path = "") {
|
|
14
|
+
const pieces = path.replace(/^\$\./, "").split(".");
|
|
15
|
+
const head = pieces[0] ?? "";
|
|
16
|
+
const isLink = head.includes(":");
|
|
17
|
+
const axes = head.replace(/\[[^\]]*\]/g, "").split(":");
|
|
18
|
+
const parent = pieces.length > 1 || isLink ? axes[0] ?? "" : "";
|
|
19
|
+
const link = isLink ? axes[1] ?? "" : "";
|
|
20
|
+
return {
|
|
21
|
+
fieldKey: isLink && pieces.length === 1 ? "" : pieces.at(-1) ?? "",
|
|
22
|
+
parentFieldKey: parent,
|
|
23
|
+
parentFieldPath: parent ? `$.${parent}` : "",
|
|
24
|
+
linkFieldKey: link,
|
|
25
|
+
linkFieldPath: link ? `$.${link}` : "",
|
|
26
|
+
isSubTable: pieces.length > 1,
|
|
27
|
+
isLink
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** 仅替换本次给出的下标,不生成模型或业务行身份。 */
|
|
31
|
+
function replacePathIndexPlaceholders(input) {
|
|
32
|
+
return input.templatePath.replace(/\[(n|n_y|n_x)\]/g, (token, name) => {
|
|
33
|
+
const value = name === "n_x" ? input.x : name === "n_y" ? input.y : input.n;
|
|
34
|
+
return value === void 0 ? token : `[${value}]`;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// src/model/query/derive-style.ts
|
|
38
|
+
/**
|
|
39
|
+
* @file 样式声明合并:处理逐键继承和整体替换规则,供有效样式查询复用。
|
|
40
|
+
* 阅读定位:query/ · 查询、身份索引与派生关系。
|
|
41
|
+
*/
|
|
42
|
+
/** 合并明确样式声明;嵌套部分属性逐键继承,数组及带 kind 的语义对象整体覆盖。 */
|
|
43
|
+
function mergeStyle(...layers) {
|
|
44
|
+
const result = {};
|
|
45
|
+
for (const layer of layers) {
|
|
46
|
+
if (!layer) continue;
|
|
47
|
+
for (const [key, value] of Object.entries(layer)) {
|
|
48
|
+
const previous = result[key];
|
|
49
|
+
result[key] = isObject(value) && isObject(previous) && !("kind" in value) && !("kind" in previous) ? mergeStyle(previous, value) : cloneJsonData(value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
// src/model/serialization/fragment.ts
|
|
55
|
+
/**
|
|
56
|
+
* @file 片段读写边界:校验并隔离外部片段,保存可跨文档使用的同形 JSON。
|
|
57
|
+
* 阅读定位:serialization/ · 原生文档和片段的读写边界。
|
|
58
|
+
*/
|
|
59
|
+
/** 校验并隔离外部片段,不修复身份、不丢未知属性,不在每次输入时调用。 */
|
|
60
|
+
function readFragment(value, options = {}) {
|
|
61
|
+
const result = validateFragment(value, options);
|
|
62
|
+
if (!result.valid) throw new DocumentValidationError(result.issues);
|
|
63
|
+
return JSON.parse(JSON.stringify(result.fragment));
|
|
64
|
+
}
|
|
65
|
+
/** 保存独立原生片段,不包含会话历史、位置索引或当前填报值。 */
|
|
66
|
+
function serializeFragment(value, options = {}) {
|
|
67
|
+
const result = validateFragment(value, options);
|
|
68
|
+
if (!result.valid) throw new DocumentValidationError(result.issues);
|
|
69
|
+
return JSON.stringify(result.fragment);
|
|
70
|
+
}
|
|
71
|
+
// src/model/editor/change-set-validation.ts
|
|
72
|
+
/**
|
|
73
|
+
* @file ChangeSet 结构校验:检查操作形状与正反差量;当前文档、版本和旧值由重放过程核对。
|
|
74
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
75
|
+
*/
|
|
76
|
+
/** JSON 合法性由日志入口统一检查;此规则只作为任意 JSON 载荷的 schema 占位。 */
|
|
77
|
+
var jsonValue = noop;
|
|
78
|
+
/** 使用布尔判别值校验属性槽,避免字符串判别器误处理 present=false。 */
|
|
79
|
+
var propertyRule = (v, p, e) => {
|
|
80
|
+
if (v && isObjectValue(v) && !isFunction(v) && "present" in v && v.present === true) object({
|
|
81
|
+
present: oneOf(true),
|
|
82
|
+
value: jsonValue
|
|
83
|
+
})(v, p, e);
|
|
84
|
+
else object({ present: oneOf(false) })(v, p, e);
|
|
85
|
+
};
|
|
86
|
+
var operationRule = tagged("kind", {
|
|
87
|
+
text: object({
|
|
88
|
+
kind: oneOf("text"),
|
|
89
|
+
nodeId: nonempty,
|
|
90
|
+
offset: number(0, true),
|
|
91
|
+
remove: string,
|
|
92
|
+
insert: string
|
|
93
|
+
}),
|
|
94
|
+
splice: object({
|
|
95
|
+
kind: oneOf("splice"),
|
|
96
|
+
parentId: nonempty,
|
|
97
|
+
collection: oneOf("sections", "parts", "blocks", "overlays", "content", "rows", "cells", "columns", "merges", "regions", "attachments"),
|
|
98
|
+
index: number(0, true),
|
|
99
|
+
beforePresent: boolean,
|
|
100
|
+
afterPresent: boolean,
|
|
101
|
+
remove: array(jsonValue),
|
|
102
|
+
insert: array(jsonValue)
|
|
103
|
+
}),
|
|
104
|
+
set: object({
|
|
105
|
+
kind: oneOf("set"),
|
|
106
|
+
nodeId: nonempty,
|
|
107
|
+
key: nonempty,
|
|
108
|
+
before: propertyRule,
|
|
109
|
+
after: propertyRule
|
|
110
|
+
}),
|
|
111
|
+
dictionary: object({
|
|
112
|
+
kind: oneOf("dictionary"),
|
|
113
|
+
dictionary: oneOf("assets", "bindings", "styles.text", "styles.paragraph", "styles.table"),
|
|
114
|
+
key: nonempty,
|
|
115
|
+
before: propertyRule,
|
|
116
|
+
after: propertyRule
|
|
117
|
+
}),
|
|
118
|
+
business: object({
|
|
119
|
+
kind: oneOf("business"),
|
|
120
|
+
name: extensionName,
|
|
121
|
+
beforePresent: boolean,
|
|
122
|
+
afterPresent: boolean,
|
|
123
|
+
before: propertyRule,
|
|
124
|
+
after: propertyRule
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
var positionRule = tagged("kind", {
|
|
128
|
+
text: object({
|
|
129
|
+
kind: oneOf("text"),
|
|
130
|
+
nodeId: nonempty,
|
|
131
|
+
offset: number(0, true),
|
|
132
|
+
removedLength: number(0, true),
|
|
133
|
+
insertedLength: number(0, true)
|
|
134
|
+
}),
|
|
135
|
+
split: object({
|
|
136
|
+
kind: oneOf("split"),
|
|
137
|
+
sourceId: nonempty,
|
|
138
|
+
targetId: nonempty,
|
|
139
|
+
offset: number(0, true)
|
|
140
|
+
}),
|
|
141
|
+
merge: object({
|
|
142
|
+
kind: oneOf("merge"),
|
|
143
|
+
sourceId: nonempty,
|
|
144
|
+
targetId: nonempty,
|
|
145
|
+
offset: number(0, true)
|
|
146
|
+
}),
|
|
147
|
+
remove: object({
|
|
148
|
+
kind: oneOf("remove"),
|
|
149
|
+
nodeIds: array(nonempty)
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
var changeRule = object({
|
|
153
|
+
documentId: nonempty,
|
|
154
|
+
baseRevision: number(0, true),
|
|
155
|
+
revision: number(1, true),
|
|
156
|
+
source: oneOf("edit", "undo", "redo", "replay"),
|
|
157
|
+
label: string,
|
|
158
|
+
operations: array(operationRule, 1),
|
|
159
|
+
inverseOperations: array(operationRule, 1),
|
|
160
|
+
positionMaps: array(positionRule),
|
|
161
|
+
inversePositionMaps: array(positionRule),
|
|
162
|
+
affectedIds: array(nonempty)
|
|
163
|
+
});
|
|
164
|
+
/** 校验可信本地日志的结构和反向差量;文档 ID、当前版本及操作旧值在重放时再检查。 */
|
|
165
|
+
function validateChangeSet(value) {
|
|
166
|
+
const issues = validateEditData(value);
|
|
167
|
+
if (issues.length) return issues;
|
|
168
|
+
changeRule(value, "", issues);
|
|
169
|
+
if (issues.length) return issues;
|
|
170
|
+
const change = value;
|
|
171
|
+
change.operations.forEach((operation, i) => {
|
|
172
|
+
if (operation.kind === "text" ? operation.remove === operation.insert : operation.kind === "splice" ? operation.beforePresent === operation.afterPresent && equalData(operation.remove, operation.insert) : equalData(operation.before, operation.after) && (operation.kind !== "business" || operation.beforePresent === operation.afterPresent)) issues.push({
|
|
173
|
+
path: `/operations/${i}`,
|
|
174
|
+
code: "noop",
|
|
175
|
+
message: "ChangeSet must not contain no-op operations"
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
if (change.revision !== change.baseRevision + 1) issues.push({
|
|
179
|
+
path: "/revision",
|
|
180
|
+
code: "revision",
|
|
181
|
+
message: "Revision must increase by one"
|
|
182
|
+
});
|
|
183
|
+
if (!equalData(change.inverseOperations, [...change.operations].reverse().map(invertOperation))) issues.push({
|
|
184
|
+
path: "/inverseOperations",
|
|
185
|
+
code: "inverse",
|
|
186
|
+
message: "Inverse operations do not match forward operations"
|
|
187
|
+
});
|
|
188
|
+
if (!equalData(change.inversePositionMaps.filter((map) => map.kind !== "remove"), invertPositionMaps(change.positionMaps))) issues.push({
|
|
189
|
+
path: "/inversePositionMaps",
|
|
190
|
+
code: "inverse",
|
|
191
|
+
message: "Inverse position maps do not match forward maps"
|
|
192
|
+
});
|
|
193
|
+
return issues;
|
|
194
|
+
}
|
|
195
|
+
// src/model/query/section-copy-roots.ts
|
|
196
|
+
/** @file 章节复制的实际拥有根目录,不物化有效页部件或展开模板内容。 */
|
|
197
|
+
/** share 只复制章节,copy 对明确槽引用的部件去重;null 关闭和缺省槽不产生新来源。 */
|
|
198
|
+
function sectionCopyRoots(section, parts = "share") {
|
|
199
|
+
return Object.freeze([section.id, ...parts === "copy" ? uniq([...Object.values(section.headerSlots ?? {}), ...Object.values(section.footerSlots ?? {})].filter(isString)) : []]);
|
|
200
|
+
}
|
|
201
|
+
// src/model/editor/section-copy.ts
|
|
202
|
+
/** @file 章节及可选页部件的统一拥有克隆,跨拥有数组仍共用一次身份映射和原生事务。 */
|
|
203
|
+
/** 复制一节,parts=copy 时仅复制实际槽声明引用的部件,缺省/关闭与共享关系原样保留。 */
|
|
204
|
+
function copySectionDefinition(ctx, sectionId, index, options) {
|
|
205
|
+
const ids = /* @__PURE__ */ new Map(), roots = [];
|
|
206
|
+
return {
|
|
207
|
+
change: ctx.editor.transaction("node:copySection", () => {
|
|
208
|
+
const settings = readFactoryOptions(options, ["parts"]), entry = ctx.entry(sectionId), document = ctx.editor.document;
|
|
209
|
+
if (entry.role !== "section") throw new ModelEditError("node_type", "Expected section");
|
|
210
|
+
if (!isInteger(index) || index < 0 || index > document.sections.length) throw new ModelEditError("range", "Invalid section insertion index");
|
|
211
|
+
if (settings.parts !== void 0 && settings.parts !== "share" && settings.parts !== "copy") throw new ModelEditError("copy_options", "Expected share or copy parts");
|
|
212
|
+
const section = entry.node, parts = [];
|
|
213
|
+
for (const id of sectionCopyRoots(section, settings.parts).slice(1)) {
|
|
214
|
+
const part = ctx.entry(id);
|
|
215
|
+
if (part.role !== "header" && part.role !== "footer") throw new ModelEditError("node_type", "Expected header or footer");
|
|
216
|
+
parts.push(part.node);
|
|
217
|
+
}
|
|
218
|
+
/** 先分配完整拥有闭包,再分别克隆各数组;配置中的跨正文/浮层/部件引用同批重写。 */
|
|
219
|
+
const allocate = (id) => {
|
|
220
|
+
if (ids.has(id)) return;
|
|
221
|
+
ids.set(id, ctx.createId());
|
|
222
|
+
for (const child of ctx.entry(id).children) allocate(child);
|
|
223
|
+
};
|
|
224
|
+
allocate(sectionId);
|
|
225
|
+
for (const part of parts) allocate(part.id);
|
|
226
|
+
const sectionPoint = {
|
|
227
|
+
parentId: document.id,
|
|
228
|
+
collection: "sections",
|
|
229
|
+
index
|
|
230
|
+
}, copy = ctx.cloneOwned(sectionPoint, [section], ids);
|
|
231
|
+
if (parts.length) {
|
|
232
|
+
const partPoint = {
|
|
233
|
+
parentId: document.id,
|
|
234
|
+
collection: "parts",
|
|
235
|
+
index: document.parts.length
|
|
236
|
+
}, copiedParts = ctx.cloneOwned(partPoint, parts, ids);
|
|
237
|
+
ctx.editor.insertNodes(partPoint, copiedParts.nodes);
|
|
238
|
+
roots.push(...copiedParts.nodes.map((node) => node.id));
|
|
239
|
+
}
|
|
240
|
+
ctx.editor.insertNodes(sectionPoint, copy.nodes);
|
|
241
|
+
roots.unshift(copy.nodes[0].id);
|
|
242
|
+
}),
|
|
243
|
+
rootIds: Object.freeze(roots),
|
|
244
|
+
idMap: new Map(ids)
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// src/model/query/section-removal.ts
|
|
248
|
+
/** @file 章节删除的唯一拥有根计划,编辑器和交互预检共用候选部件边界。 */
|
|
249
|
+
/** 仅返回本节与可明确清理的候选部件,不扫描或清理无关孤立声明。 */
|
|
250
|
+
function sectionRemovalRoots(document, section, removeUnusedParts = false) {
|
|
251
|
+
const candidates = /* @__PURE__ */ new Set(), remaining = /* @__PURE__ */ new Set();
|
|
252
|
+
if (removeUnusedParts) {
|
|
253
|
+
for (const slots of [section.headerSlots, section.footerSlots]) for (const value of Object.values(slots ?? {})) if (isString(value)) candidates.add(value);
|
|
254
|
+
for (const other of document.sections) if (other.id !== section.id) {
|
|
255
|
+
for (const slots of [other.headerSlots, other.footerSlots]) for (const value of Object.values(slots ?? {})) if (isString(value)) remaining.add(value);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return Object.freeze([section.id, ...[...candidates].filter((id) => !remaining.has(id))]);
|
|
259
|
+
}
|
|
260
|
+
// src/model/editor/NodeEditor.ts
|
|
261
|
+
/**
|
|
262
|
+
* @file 其他节点编辑:管理图片、页面组件、换行、章节、共享页眉页脚、浮层及文档设置。
|
|
263
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
264
|
+
*/
|
|
265
|
+
/** 图片、页面组件、章节、页部件和浮层命令,不依赖画布组件或运行时业务记录。 */
|
|
266
|
+
var NodeEditor = class {
|
|
267
|
+
/** 复用当前编辑会话的能力,关闭时解除全部回调引用。 */
|
|
268
|
+
context;
|
|
269
|
+
/** 由 ModelEditor.nodes 按需创建,不建立另一份模型。 @internal */
|
|
270
|
+
constructor(context) {
|
|
271
|
+
this.context = context;
|
|
272
|
+
}
|
|
273
|
+
/** 在语义段落中插入图片,资产按值复用,文字拆分与资产登记一次提交。 */
|
|
274
|
+
insertImage(point, options) {
|
|
275
|
+
let assetId = "";
|
|
276
|
+
return {
|
|
277
|
+
...this.insertInline("node:insertImage", point, (ctx) => {
|
|
278
|
+
const copied = readFactoryOptions(options, [
|
|
279
|
+
"asset",
|
|
280
|
+
"assetId",
|
|
281
|
+
"alt",
|
|
282
|
+
"preferredSizePx",
|
|
283
|
+
"fit"
|
|
284
|
+
]);
|
|
285
|
+
if (Object.hasOwn(copied, "asset") === Object.hasOwn(copied, "assetId")) throw new ModelEditError("asset_input", "Provide asset or assetId");
|
|
286
|
+
assetId = this.resolveAsset("asset" in copied ? { asset: copied.asset } : { assetId: copied.assetId });
|
|
287
|
+
const { asset: _asset, assetId: _assetId, ...appearance } = copied;
|
|
288
|
+
return ctx.withFactory((factory) => factory.createImage({
|
|
289
|
+
...appearance,
|
|
290
|
+
assetId
|
|
291
|
+
}).node);
|
|
292
|
+
}),
|
|
293
|
+
assetId
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/** 插入内建页码或已注册扩展页面组件,当前页码/页数不在 model 中求值。 */
|
|
297
|
+
insertPageWidget(point, options) {
|
|
298
|
+
return this.insertInline("node:insertPageWidget", point, (ctx) => ctx.withFactory((factory) => factory.createPageWidget(options)));
|
|
299
|
+
}
|
|
300
|
+
/** 插入显式换行/分页符,不按视觉行创建文字对象。 */
|
|
301
|
+
insertBreak(point, breakType) {
|
|
302
|
+
return this.insertInline("node:insertBreak", point, (ctx) => ctx.withFactory((factory) => factory.createBreak(breakType)));
|
|
303
|
+
}
|
|
304
|
+
/** 修改当前图片资产引用,不就地改写其他图片共享的资源。 */
|
|
305
|
+
setImageAsset(imageId, input, options = {}) {
|
|
306
|
+
const ctx = this.requireContext();
|
|
307
|
+
return ctx.editor.transaction("node:setImageAsset", () => {
|
|
308
|
+
const node = this.entity(imageId, "image"), settings = readRemovalOptions(options), previous = node.assetId;
|
|
309
|
+
const assetId = this.resolveAsset(input);
|
|
310
|
+
ctx.editor.setProperty(imageId, "assetId", assetId);
|
|
311
|
+
if (settings.removeUnusedAssets !== false && previous !== assetId) ctx.cleanupDefinitions({ assets: /* @__PURE__ */ new Set([previous]) });
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/** 页面图片与普通图片共用资产去重,替换后只清理已经没有引用的资源。 */
|
|
315
|
+
setPageImageAsset(nodeId, input) {
|
|
316
|
+
return this.requireContext().editor.transaction("node:setPageImageAsset", () => {
|
|
317
|
+
const node = this.entity(nodeId, "pageWidget");
|
|
318
|
+
if (node.widget !== "image") throw new ModelEditError("node_type", "Expected page image");
|
|
319
|
+
const assetId = input === null ? null : this.resolveAsset(input);
|
|
320
|
+
this.setComponentConfig(nodeId, { widget: "image" }, {
|
|
321
|
+
...node.config,
|
|
322
|
+
assetId
|
|
323
|
+
}, { cleanupReferences: true });
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/** 修改图片明确外观,未知属性和非法尺寸导致整笔回滚。 */
|
|
327
|
+
updateImage(imageId, update) {
|
|
328
|
+
return this.patch("node:updateImage", imageId, "image", update, [
|
|
329
|
+
"alt",
|
|
330
|
+
"fit",
|
|
331
|
+
"preferredSizePx"
|
|
332
|
+
], [
|
|
333
|
+
"alt",
|
|
334
|
+
"fit",
|
|
335
|
+
"preferredSizePx"
|
|
336
|
+
]);
|
|
337
|
+
}
|
|
338
|
+
/** 用明确组件及版本前置条件替换配置;null 移除覆盖,必需配置由 schema 拒绝缺失。 */
|
|
339
|
+
setComponentConfig(nodeId, target, config, options) {
|
|
340
|
+
const ctx = this.requireContext();
|
|
341
|
+
return ctx.editor.transaction("node:setComponentConfig", () => {
|
|
342
|
+
const entry = ctx.entry(nodeId), expected = readFactoryOptions(target, ["widget", "configVersion"]);
|
|
343
|
+
if (entry.role !== "field" && entry.role !== "pageWidget") throw new ModelEditError("node_type", "Expected field/page widget");
|
|
344
|
+
const node = entry.node;
|
|
345
|
+
if (node.widget !== expected.widget || (node.configVersion ?? 1) !== (expected.configVersion ?? 1) || includes(expected.widget, ":") && isUndefined(expected.configVersion)) throw new ModelEditError("component_version", "Component or config version does not match");
|
|
346
|
+
const references = options?.cleanupReferences ? ctx.collectDefinitions([nodeId]) : void 0;
|
|
347
|
+
if (isNull(config)) ctx.editor.unsetProperty(nodeId, "config");
|
|
348
|
+
else ctx.editor.setProperty(nodeId, "config", config);
|
|
349
|
+
if (references) ctx.cleanupDefinitions(references);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/** 修改字段/页面组件实例静态能力;null 恢复注册定义,不计算运行时权限。 */
|
|
353
|
+
setPolicy(nodeId, policy) {
|
|
354
|
+
const ctx = this.requireContext();
|
|
355
|
+
return ctx.editor.transaction("node:setPolicy", () => {
|
|
356
|
+
const entry = ctx.entry(nodeId);
|
|
357
|
+
if (entry.role !== "field" && entry.role !== "pageWidget") throw new ModelEditError("node_type", "Expected field/page widget");
|
|
358
|
+
if (isNull(policy)) ctx.editor.unsetProperty(nodeId, "policy");
|
|
359
|
+
else ctx.editor.setProperty(nodeId, "policy", policy);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
/** 插入实际新章节,页面和内容使用同一协议,不生成空页或空部件。 */
|
|
363
|
+
insertSection(index, options) {
|
|
364
|
+
const ctx = this.requireContext();
|
|
365
|
+
let nodeId = "";
|
|
366
|
+
const change = ctx.editor.transaction("node:insertSection", () => {
|
|
367
|
+
const node = ctx.withFactory((factory) => factory.createSection(options));
|
|
368
|
+
nodeId = node.id;
|
|
369
|
+
ctx.editor.insertNodes({
|
|
370
|
+
parentId: ctx.editor.document.id,
|
|
371
|
+
collection: "sections",
|
|
372
|
+
index
|
|
373
|
+
}, [node]);
|
|
374
|
+
});
|
|
375
|
+
return {
|
|
376
|
+
nodeId,
|
|
377
|
+
change
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
/** 复制完整章节及可选页部件,统一重映射跨拥有数组的内部引用,不复制填写值。 */
|
|
381
|
+
copySection(sectionId, index, options = {}) {
|
|
382
|
+
return copySectionDefinition(this.requireContext(), sectionId, index, options);
|
|
383
|
+
}
|
|
384
|
+
/** 修改章节页面和槽位声明,保留 blocks/overlays 的唯一拥有数组。 */
|
|
385
|
+
updateSection(sectionId, update) {
|
|
386
|
+
return this.patch("node:updateSection", sectionId, "section", update, [
|
|
387
|
+
"page",
|
|
388
|
+
"headerSlots",
|
|
389
|
+
"footerSlots"
|
|
390
|
+
], ["headerSlots", "footerSlots"]);
|
|
391
|
+
}
|
|
392
|
+
/** 完整替换文档默认样式和显示设置,引用必须在同一事务结束时有效。 */
|
|
393
|
+
setDocumentSettings(settings) {
|
|
394
|
+
const ctx = this.requireContext();
|
|
395
|
+
return ctx.editor.transaction("node:setDocumentSettings", () => {
|
|
396
|
+
ctx.editor.setProperty(ctx.editor.document.id, "settings", settings);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/** 按移动前章节下标移动整节,身份和其拥有内容不重新分配。 */
|
|
400
|
+
moveSection(sectionId, index) {
|
|
401
|
+
const ctx = this.requireContext();
|
|
402
|
+
return ctx.editor.transaction("node:moveSection", () => {
|
|
403
|
+
this.entity(sectionId, "section");
|
|
404
|
+
ctx.editor.moveNodes({
|
|
405
|
+
...this.location(sectionId),
|
|
406
|
+
count: 1
|
|
407
|
+
}, {
|
|
408
|
+
parentId: ctx.editor.document.id,
|
|
409
|
+
collection: "sections",
|
|
410
|
+
index
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** 删除章节,禁止删除最后一节;可仅清理该节候选中不再共享的页部件。 */
|
|
415
|
+
removeSection(sectionId, options = {}) {
|
|
416
|
+
const ctx = this.requireContext();
|
|
417
|
+
return ctx.editor.transaction("node:removeSection", () => {
|
|
418
|
+
const section = this.entity(sectionId, "section");
|
|
419
|
+
const settings = readFactoryOptions(options, [
|
|
420
|
+
"removeUnusedBindings",
|
|
421
|
+
"removeUnusedAssets",
|
|
422
|
+
"removeUnusedParts"
|
|
423
|
+
]);
|
|
424
|
+
checkFactoryValue(settings, object({
|
|
425
|
+
removeUnusedBindings: optional(boolean),
|
|
426
|
+
removeUnusedAssets: optional(boolean),
|
|
427
|
+
removeUnusedParts: optional(boolean)
|
|
428
|
+
}));
|
|
429
|
+
if (ctx.editor.document.sections.length === 1) throw new ModelEditError("section_count", "Cannot remove the last section");
|
|
430
|
+
const roots = sectionRemovalRoots(ctx.editor.document, section, settings.removeUnusedParts);
|
|
431
|
+
this.deleteOwned(roots, settings);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
/** 新建共享页眉/页脚,调用方可在同一外层事务中将其关联到任意章节。 */
|
|
435
|
+
insertPart(kind, options = {}, index) {
|
|
436
|
+
const ctx = this.requireContext();
|
|
437
|
+
let nodeId = "";
|
|
438
|
+
const change = ctx.editor.transaction("node:insertPart", () => {
|
|
439
|
+
const node = ctx.withFactory((factory) => factory.createPart(kind, options));
|
|
440
|
+
nodeId = node.id;
|
|
441
|
+
ctx.editor.insertNodes({
|
|
442
|
+
parentId: ctx.editor.document.id,
|
|
443
|
+
collection: "parts",
|
|
444
|
+
index: isUndefined(index) ? ctx.editor.document.parts.length : index
|
|
445
|
+
}, [node]);
|
|
446
|
+
});
|
|
447
|
+
return {
|
|
448
|
+
nodeId,
|
|
449
|
+
change
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
/** 设置共享槽的引用或明确关闭值;undefined 不作为移除指令,恢复缺省请用 unsetPartSlot。 */
|
|
453
|
+
setPartSlot(sectionId, kind, slot, partId) {
|
|
454
|
+
return this.changePartSlot(sectionId, kind, slot, partId, false);
|
|
455
|
+
}
|
|
456
|
+
/** 移除单个槽覆盖,first/even 恢复 default 回退;最后一个覆盖移除时删掉整个槽对象。 */
|
|
457
|
+
unsetPartSlot(sectionId, kind, slot) {
|
|
458
|
+
return this.changePartSlot(sectionId, kind, slot, null, true);
|
|
459
|
+
}
|
|
460
|
+
/** 删除共享部件,默认拒绝仍有引用;显式 disable-slots 将相关槽置 null,避免意外回退。 */
|
|
461
|
+
removePart(partId, options = {}) {
|
|
462
|
+
const ctx = this.requireContext();
|
|
463
|
+
return ctx.editor.transaction("node:removePart", () => {
|
|
464
|
+
const entry = ctx.entry(partId);
|
|
465
|
+
if (entry.role !== "header" && entry.role !== "footer") throw new ModelEditError("node_type", "Expected header/footer");
|
|
466
|
+
const settings = readFactoryOptions(options, [
|
|
467
|
+
"references",
|
|
468
|
+
"removeUnusedBindings",
|
|
469
|
+
"removeUnusedAssets"
|
|
470
|
+
]);
|
|
471
|
+
checkFactoryValue(settings, object({
|
|
472
|
+
references: optional(oneOf("reject", "disable-slots")),
|
|
473
|
+
removeUnusedBindings: optional(boolean),
|
|
474
|
+
removeUnusedAssets: optional(boolean)
|
|
475
|
+
}));
|
|
476
|
+
for (const section of ctx.editor.document.sections) for (const key of ["headerSlots", "footerSlots"]) {
|
|
477
|
+
const slots = section[key];
|
|
478
|
+
if (!slots || !includes(Object.values(slots), partId)) continue;
|
|
479
|
+
if (settings.references !== "disable-slots") throw new ModelEditError("part_reference", "Part is still referenced");
|
|
480
|
+
const next = copyData(slots);
|
|
481
|
+
for (const slot of [
|
|
482
|
+
"default",
|
|
483
|
+
"first",
|
|
484
|
+
"even"
|
|
485
|
+
]) if (next[slot] === partId) next[slot] = null;
|
|
486
|
+
ctx.editor.setProperty(section.id, key, next);
|
|
487
|
+
}
|
|
488
|
+
this.deleteOwned([partId], settings);
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
/** 在指定章节拥有数组中插入浮层,不按实际页数复制其内容。 */
|
|
492
|
+
insertOverlay(sectionId, options, index) {
|
|
493
|
+
const ctx = this.requireContext();
|
|
494
|
+
let nodeId = "";
|
|
495
|
+
const change = ctx.editor.transaction("node:insertOverlay", () => {
|
|
496
|
+
const section = this.entity(sectionId, "section");
|
|
497
|
+
const node = ctx.withFactory((factory) => factory.createOverlay(options));
|
|
498
|
+
nodeId = node.id;
|
|
499
|
+
ctx.editor.insertNodes({
|
|
500
|
+
parentId: sectionId,
|
|
501
|
+
collection: "overlays",
|
|
502
|
+
index: isUndefined(index) ? section.overlays.length : index
|
|
503
|
+
}, [node]);
|
|
504
|
+
});
|
|
505
|
+
return {
|
|
506
|
+
nodeId,
|
|
507
|
+
change
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
/** 修改浮层锚点/尺寸/层级,内容继续通过通用块编辑维护。 */
|
|
511
|
+
updateOverlay(overlayId, update) {
|
|
512
|
+
return this.patch("node:updateOverlay", overlayId, "overlay", update, [
|
|
513
|
+
"anchor",
|
|
514
|
+
"preferredSizePx",
|
|
515
|
+
"zIndex"
|
|
516
|
+
], ["preferredSizePx", "zIndex"]);
|
|
517
|
+
}
|
|
518
|
+
/** 删除普通拥有节点并清理候选共享定义;网格/区域/附属容器须使用其专门命令维护结构约束。 */
|
|
519
|
+
removeNode(nodeId, options = {}) {
|
|
520
|
+
const ctx = this.requireContext();
|
|
521
|
+
return ctx.editor.transaction("node:removeNode", () => {
|
|
522
|
+
const entry = ctx.entry(nodeId), settings = readRemovalOptions(options);
|
|
523
|
+
if (entry.role === "section") {
|
|
524
|
+
this.removeSection(nodeId, settings);
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
if (entry.role === "header" || entry.role === "footer") {
|
|
528
|
+
this.removePart(nodeId, settings);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (!includes([
|
|
532
|
+
"paragraph",
|
|
533
|
+
"table",
|
|
534
|
+
"field",
|
|
535
|
+
"text",
|
|
536
|
+
"image",
|
|
537
|
+
"pageWidget",
|
|
538
|
+
"break",
|
|
539
|
+
"overlay"
|
|
540
|
+
], entry.role)) throw new ModelEditError("node_type", "Use the dedicated structural operation for this entity");
|
|
541
|
+
this.deleteOwned([nodeId], settings);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
/** 释放会话能力,已有返回事件或身份不受影响。 @internal */
|
|
545
|
+
dispose() {
|
|
546
|
+
this.context = void 0;
|
|
547
|
+
}
|
|
548
|
+
/** 插入行内节点的共用边界:先校验字素,创建实际内容,再在必要处拆分文字。 */
|
|
549
|
+
insertInline(label, point, create) {
|
|
550
|
+
const ctx = this.requireContext();
|
|
551
|
+
let nodeId = "";
|
|
552
|
+
const change = ctx.editor.transaction(label, () => {
|
|
553
|
+
const at = readFactoryOptions(point, [
|
|
554
|
+
"paragraphId",
|
|
555
|
+
"index",
|
|
556
|
+
"offset"
|
|
557
|
+
]), paragraph = this.entity(at.paragraphId, "paragraph");
|
|
558
|
+
let index = at.index;
|
|
559
|
+
if (!isInteger(index) || index < 0 || index > paragraph.content.length) throw new ModelEditError("range", "Invalid inline index");
|
|
560
|
+
let text;
|
|
561
|
+
if (!isUndefined(at.offset)) {
|
|
562
|
+
const node = paragraph.content[index];
|
|
563
|
+
if (!node || node.kind !== "text") throw new ModelEditError("node_type", "Offset requires a text node");
|
|
564
|
+
ctx.assertBoundary(node.text, at.offset);
|
|
565
|
+
text = node;
|
|
566
|
+
}
|
|
567
|
+
const node = create(ctx);
|
|
568
|
+
nodeId = node.id;
|
|
569
|
+
if (text && !isUndefined(at.offset) && at.offset > 0) {
|
|
570
|
+
if (at.offset !== text.text.length) ctx.editor.splitText(text.id, at.offset);
|
|
571
|
+
index++;
|
|
572
|
+
}
|
|
573
|
+
ctx.editor.insertNodes({
|
|
574
|
+
parentId: paragraph.id,
|
|
575
|
+
collection: "content",
|
|
576
|
+
index
|
|
577
|
+
}, [node]);
|
|
578
|
+
});
|
|
579
|
+
return {
|
|
580
|
+
nodeId,
|
|
581
|
+
change
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
/** 复用同值资产或登记新声明;坏 ID 工厂撞到字典键时拒绝,不覆盖或循环重试。 */
|
|
585
|
+
resolveAsset(input) {
|
|
586
|
+
const ctx = this.requireContext(), value = readFactoryOptions(input, ["asset", "assetId"]);
|
|
587
|
+
if (Object.hasOwn(value, "asset") === Object.hasOwn(value, "assetId")) throw new ModelEditError("asset_input", "Provide asset or assetId");
|
|
588
|
+
const assets = ctx.editor.document.assets;
|
|
589
|
+
if ("asset" in value) {
|
|
590
|
+
checkFactoryValue(value.asset, imageAssetRule, "/asset");
|
|
591
|
+
for (const [id, asset] of Object.entries(assets)) if (equalData(asset, value.asset)) return id;
|
|
592
|
+
const id = ctx.createId();
|
|
593
|
+
if (Object.hasOwn(assets, id)) throw new ModelEditError("id_factory", "Asset ID collision");
|
|
594
|
+
ctx.editor.setDictionary("assets", id, value.asset);
|
|
595
|
+
return id;
|
|
596
|
+
}
|
|
597
|
+
checkFactoryValue(value.assetId, nonempty, "/assetId");
|
|
598
|
+
if (!Object.hasOwn(assets, value.assetId)) throw new ModelEditError("asset_reference", "Missing image asset");
|
|
599
|
+
return value.assetId;
|
|
600
|
+
}
|
|
601
|
+
/** 明确设置或移除一个页部件槽,不重建共享部件,不把显式 null 当作缺省。 */
|
|
602
|
+
changePartSlot(sectionId, kind, slot, partId, unset) {
|
|
603
|
+
const ctx = this.requireContext();
|
|
604
|
+
return ctx.editor.transaction(unset ? "node:unsetPartSlot" : "node:setPartSlot", () => {
|
|
605
|
+
const section = this.entity(sectionId, "section");
|
|
606
|
+
checkFactoryValue(kind, oneOf("header", "footer"), "/kind");
|
|
607
|
+
checkFactoryValue(slot, oneOf("default", "first", "even"), "/slot");
|
|
608
|
+
if (!unset && !isNull(partId)) {
|
|
609
|
+
checkFactoryValue(partId, nonempty, "/partId");
|
|
610
|
+
this.entity(partId, kind);
|
|
611
|
+
}
|
|
612
|
+
const key = kind === "header" ? "headerSlots" : "footerSlots", slots = copyData(section[key] ?? {});
|
|
613
|
+
if (unset) delete slots[slot];
|
|
614
|
+
else slots[slot] = partId;
|
|
615
|
+
if (!isEmptyObject(slots)) ctx.editor.setProperty(sectionId, key, slots);
|
|
616
|
+
else ctx.editor.unsetProperty(sectionId, key);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
/** 浅层声明补丁的唯一写入流程,拒绝未知键及相同键的冲突操作。 */
|
|
620
|
+
patch(label, id, role, update, keys, optionalKeys) {
|
|
621
|
+
const ctx = this.requireContext();
|
|
622
|
+
return ctx.editor.transaction(label, () => {
|
|
623
|
+
this.entity(id, role);
|
|
624
|
+
const value = readFactoryOptions(update, ["set", "unset"]);
|
|
625
|
+
const set = isUndefined(value.set) ? {} : checkFactoryOptions(value.set, keys);
|
|
626
|
+
if (!isUndefined(value.unset)) checkFactoryValue(value.unset, array(oneOf(...optionalKeys)), "/unset");
|
|
627
|
+
for (const key of value.unset ?? []) {
|
|
628
|
+
if (Object.hasOwn(set, key)) throw new ModelEditError("node_patch", `Cannot set and unset ${key}`);
|
|
629
|
+
ctx.editor.unsetProperty(id, key);
|
|
630
|
+
}
|
|
631
|
+
for (const [key, property] of Object.entries(set)) ctx.editor.setProperty(id, key, property);
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
/** 删除多个互不包含的拥有根,候选绑定和资产只扫描/清理一次。 */
|
|
635
|
+
deleteOwned(ids, options) {
|
|
636
|
+
const ctx = this.requireContext(), definitions = ctx.collectDefinitions(ids), paragraphs = /* @__PURE__ */ new Set();
|
|
637
|
+
for (const id of ids) {
|
|
638
|
+
const entry = ctx.entry(id);
|
|
639
|
+
if (entry.parentId && ctx.entry(entry.parentId).role === "paragraph") paragraphs.add(entry.parentId);
|
|
640
|
+
ctx.editor.removeNodes({
|
|
641
|
+
...this.location(id),
|
|
642
|
+
count: 1
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
for (const id of paragraphs) ctx.editor.normalizeText(id);
|
|
646
|
+
ctx.cleanupDefinitions(definitions, options);
|
|
647
|
+
}
|
|
648
|
+
/** 根据当前拥有数组读取位置,移动后不会使用过期下标。 */
|
|
649
|
+
location(id) {
|
|
650
|
+
const ctx = this.requireContext(), entry = ctx.entry(id);
|
|
651
|
+
if (!entry.parentId || !entry.collection) throw new ModelEditError("root", "Cannot remove the document root");
|
|
652
|
+
const nodes = ctx.entry(entry.parentId).node[entry.collection];
|
|
653
|
+
return {
|
|
654
|
+
parentId: entry.parentId,
|
|
655
|
+
collection: entry.collection,
|
|
656
|
+
index: nodes.findIndex((node) => node.id === id)
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
/** 核对真实索引角色,返回权威对象只用于读取。 */
|
|
660
|
+
entity(id, role) {
|
|
661
|
+
const entry = this.requireContext().entry(id);
|
|
662
|
+
if (entry.role !== role) throw new ModelEditError("node_type", `Expected ${role}`);
|
|
663
|
+
return entry.node;
|
|
664
|
+
}
|
|
665
|
+
/** 所有入口验证会话可用,关闭后不保留文档或注册依赖。 */
|
|
666
|
+
requireContext() {
|
|
667
|
+
if (!this.context) throw new ModelEditError("disposed", "NodeEditor is disposed");
|
|
668
|
+
this.context.editor.revision;
|
|
669
|
+
return this.context;
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
// src/model/editor/operation-engine.ts
|
|
673
|
+
/**
|
|
674
|
+
* @file 局部操作执行器:检查操作前置值,修改当前数据并同步身份索引,返回受影响实体。
|
|
675
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
676
|
+
*/
|
|
677
|
+
var styled = ["textStyleId", "textStyle"];
|
|
678
|
+
var configurable = [
|
|
679
|
+
...styled,
|
|
680
|
+
"widget",
|
|
681
|
+
"configVersion",
|
|
682
|
+
"config",
|
|
683
|
+
"preferredSizePx",
|
|
684
|
+
"policy"
|
|
685
|
+
];
|
|
686
|
+
var allowed = {
|
|
687
|
+
document: ["settings", "business"],
|
|
688
|
+
section: [
|
|
689
|
+
"page",
|
|
690
|
+
"headerSlots",
|
|
691
|
+
"footerSlots"
|
|
692
|
+
],
|
|
693
|
+
header: [],
|
|
694
|
+
footer: [],
|
|
695
|
+
overlay: [
|
|
696
|
+
"anchor",
|
|
697
|
+
"preferredSizePx",
|
|
698
|
+
"zIndex"
|
|
699
|
+
],
|
|
700
|
+
paragraph: [
|
|
701
|
+
...styled,
|
|
702
|
+
"paragraphStyleId",
|
|
703
|
+
"paragraphStyle"
|
|
704
|
+
],
|
|
705
|
+
text: styled,
|
|
706
|
+
field: [...configurable, "bindingId"],
|
|
707
|
+
image: [
|
|
708
|
+
"assetId",
|
|
709
|
+
"alt",
|
|
710
|
+
"preferredSizePx",
|
|
711
|
+
"fit"
|
|
712
|
+
],
|
|
713
|
+
pageWidget: configurable,
|
|
714
|
+
break: ["breakType"],
|
|
715
|
+
table: ["tableStyleId", "style"],
|
|
716
|
+
column: ["widthPx"],
|
|
717
|
+
row: ["height"],
|
|
718
|
+
cell: ["style"],
|
|
719
|
+
attachment: ["when"],
|
|
720
|
+
merge: ["range"],
|
|
721
|
+
region: [
|
|
722
|
+
"type",
|
|
723
|
+
"name",
|
|
724
|
+
"range",
|
|
725
|
+
"binding",
|
|
726
|
+
"configVersion",
|
|
727
|
+
"config",
|
|
728
|
+
"variant",
|
|
729
|
+
"parentRegionId",
|
|
730
|
+
"targetRegionId"
|
|
731
|
+
]
|
|
732
|
+
};
|
|
733
|
+
/** 原子应用一个有前置值的局部操作;事务校验、日志和订阅由 ModelEditor 管理。 */
|
|
734
|
+
var OperationEngine = class {
|
|
735
|
+
document;
|
|
736
|
+
index;
|
|
737
|
+
/** 复用编辑器独占的文档和索引,不持有另一份模型。 */
|
|
738
|
+
constructor(document, index) {
|
|
739
|
+
this.document = document;
|
|
740
|
+
this.index = index;
|
|
741
|
+
}
|
|
742
|
+
/** 应用已预检操作;在修改前检查版本内容和新子树 ID,失败时不留下局部写入。 */
|
|
743
|
+
apply(operation) {
|
|
744
|
+
const effect = {
|
|
745
|
+
removedIds: /* @__PURE__ */ new Set(),
|
|
746
|
+
insertedIds: /* @__PURE__ */ new Set(),
|
|
747
|
+
affectedIds: []
|
|
748
|
+
};
|
|
749
|
+
if (operation.kind === "business") {
|
|
750
|
+
const business = this.document.business, configs = business.configs ?? {};
|
|
751
|
+
if (Object.hasOwn(business, "configs") !== operation.beforePresent) throw new ModelEditError("conflict", "Business config container presence changed");
|
|
752
|
+
this.expect(readPropertyValue(configs, operation.name), operation.before);
|
|
753
|
+
if (!operation.afterPresent) {
|
|
754
|
+
if (operation.after.present || Object.keys(configs).some((name) => name !== operation.name)) throw new ModelEditError("business_config", "Cannot remove a nonempty business config container");
|
|
755
|
+
delete business.configs;
|
|
756
|
+
} else {
|
|
757
|
+
writeProperty(configs, operation.name, operation.after);
|
|
758
|
+
if (!operation.beforePresent) Object.defineProperty(business, "configs", {
|
|
759
|
+
value: configs,
|
|
760
|
+
writable: true,
|
|
761
|
+
enumerable: true,
|
|
762
|
+
configurable: true
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
effect.affectedIds.push(this.document.id);
|
|
766
|
+
return effect;
|
|
767
|
+
}
|
|
768
|
+
if (operation.kind === "dictionary") {
|
|
769
|
+
if (!operation.key.trim()) throw new ModelEditError("dictionary", "Dictionary key must be nonempty");
|
|
770
|
+
const dictionary = this.dictionary(operation.dictionary);
|
|
771
|
+
this.expect(readPropertyValue(dictionary, operation.key), operation.before);
|
|
772
|
+
writeProperty(dictionary, operation.key, operation.after);
|
|
773
|
+
effect.affectedIds.push(this.document.id);
|
|
774
|
+
return effect;
|
|
775
|
+
}
|
|
776
|
+
const entry = this.index.require(operation.kind === "splice" ? operation.parentId : operation.nodeId);
|
|
777
|
+
effect.affectedIds.push(entry.node.id);
|
|
778
|
+
if (entry.parentId) effect.affectedIds.push(entry.parentId);
|
|
779
|
+
if (operation.kind === "text") {
|
|
780
|
+
if (entry.role !== "text") throw new ModelEditError("node_type", "Text operation needs a text node");
|
|
781
|
+
const node = entry.node;
|
|
782
|
+
if (operation.offset + operation.remove.length > node.text.length || node.text.slice(operation.offset, operation.offset + operation.remove.length) !== operation.remove) throw new ModelEditError("conflict", "Text operation no longer matches content");
|
|
783
|
+
node.text = node.text.slice(0, operation.offset) + operation.insert + node.text.slice(operation.offset + operation.remove.length);
|
|
784
|
+
} else if (operation.kind === "set") {
|
|
785
|
+
if (!includes(allowed[entry.role], operation.key)) throw new ModelEditError("property", `Cannot edit ${entry.role}.${operation.key}`);
|
|
786
|
+
this.expect(readPropertyValue(entry.node, operation.key), operation.before);
|
|
787
|
+
writeProperty(entry.node, operation.key, operation.after);
|
|
788
|
+
} else {
|
|
789
|
+
const list = this.index.list(operation.parentId, operation.collection);
|
|
790
|
+
if (Object.hasOwn(entry.node, operation.collection) !== operation.beforePresent) throw new ModelEditError("conflict", "Collection presence changed");
|
|
791
|
+
if ((!operation.beforePresent || !operation.afterPresent) && operation.collection !== "attachments") throw new ModelEditError("collection", "Only attachments may be absent");
|
|
792
|
+
if (operation.index + operation.remove.length > list.length) throw new ModelEditError("range", "Splice exceeds collection");
|
|
793
|
+
this.expect(list.slice(operation.index, operation.index + operation.remove.length), operation.remove);
|
|
794
|
+
if (!operation.afterPresent && list.length - operation.remove.length + operation.insert.length !== 0) throw new ModelEditError("collection", "Cannot remove a nonempty collection property");
|
|
795
|
+
const inserted = cloneJsonData(operation.insert);
|
|
796
|
+
effect.removedIds = this.index.descendants(list.slice(operation.index, operation.index + operation.remove.length).map((node) => node.id));
|
|
797
|
+
const planned = this.index.prepare(operation.parentId, operation.collection, inserted, effect.removedIds);
|
|
798
|
+
effect.insertedIds = new Set(planned.keys());
|
|
799
|
+
list.splice(operation.index, operation.remove.length, ...inserted);
|
|
800
|
+
if (!operation.afterPresent) delete entry.node[operation.collection];
|
|
801
|
+
else if (!operation.beforePresent) Object.defineProperty(entry.node, operation.collection, {
|
|
802
|
+
value: list,
|
|
803
|
+
writable: true,
|
|
804
|
+
enumerable: true,
|
|
805
|
+
configurable: true
|
|
806
|
+
});
|
|
807
|
+
this.index.replace(effect.removedIds, planned);
|
|
808
|
+
effect.affectedIds.push(...effect.removedIds, ...effect.insertedIds);
|
|
809
|
+
}
|
|
810
|
+
return effect;
|
|
811
|
+
}
|
|
812
|
+
/** 定位资源、绑定或某类样式字典;不允许任意路径访问文档对象。 */
|
|
813
|
+
dictionary(name) {
|
|
814
|
+
if (!includes([
|
|
815
|
+
"assets",
|
|
816
|
+
"bindings",
|
|
817
|
+
"styles.text",
|
|
818
|
+
"styles.paragraph",
|
|
819
|
+
"styles.table"
|
|
820
|
+
], name)) throw new ModelEditError("dictionary", `Unsupported dictionary: ${name}`);
|
|
821
|
+
if (name === "assets" || name === "bindings") return this.document[name];
|
|
822
|
+
const kind = name.slice(7);
|
|
823
|
+
return this.document.styles[kind];
|
|
824
|
+
}
|
|
825
|
+
/** 操作携带的旧值必须精确匹配当前数据,拒绝覆盖已经发生的其他编辑。 */
|
|
826
|
+
expect(actual, expected) {
|
|
827
|
+
if (!equalData(actual, expected)) throw new ModelEditError("conflict", "Operation precondition does not match current data");
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
// src/model/query/table-geometry.ts
|
|
831
|
+
/**
|
|
832
|
+
* @file 物理表格几何:将 CellId 解析为行列位置和闭合矩形,统一编辑与查询的范围判断。
|
|
833
|
+
* 阅读定位:query/ · 查询、身份索引与派生关系。
|
|
834
|
+
*/
|
|
835
|
+
/** 只有普通表及其分页表头使用独立列宽编辑。 */
|
|
836
|
+
function isOrdinaryTable(regions) {
|
|
837
|
+
return regions.every(({ type }) => type === "table-header" || type === "sub-table-header");
|
|
838
|
+
}
|
|
839
|
+
/** 为一次表格编辑建立局部位置表,不缓存或复制整份文档。 */
|
|
840
|
+
function indexTablePositions(table) {
|
|
841
|
+
const result = /* @__PURE__ */ new Map();
|
|
842
|
+
table.rows.forEach((row, r) => row.cells.forEach((cell, c) => result.set(cell.id, {
|
|
843
|
+
rowIndex: r,
|
|
844
|
+
columnIndex: c
|
|
845
|
+
})));
|
|
846
|
+
return result;
|
|
847
|
+
}
|
|
848
|
+
/** 查询与编辑共用 CellId 到物理矩形规则,跨表与倒置范围均拒绝。 */
|
|
849
|
+
function rectangleFromPositions(positions, range) {
|
|
850
|
+
const from = positions.get(range.fromCellId), to = positions.get(range.toCellId);
|
|
851
|
+
if (!from || !to) throw new ModelEditError("table_range", "Range endpoints must be cells of this table");
|
|
852
|
+
if (from.rowIndex > to.rowIndex || from.columnIndex > to.columnIndex) throw new ModelEditError("table_range", "Range must run from top-left to bottom-right");
|
|
853
|
+
return {
|
|
854
|
+
top: from.rowIndex,
|
|
855
|
+
left: from.columnIndex,
|
|
856
|
+
bottom: to.rowIndex,
|
|
857
|
+
right: to.columnIndex
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
/** 判断闭合物理矩形是否相交,合并和区域使用相同定义。 */
|
|
861
|
+
function intersectsRectangle(a, b) {
|
|
862
|
+
return a.top <= b.bottom && b.top <= a.bottom && a.left <= b.right && b.left <= a.right;
|
|
863
|
+
}
|
|
864
|
+
/** 判断闭合物理矩形是否完整包含另一个范围。 */
|
|
865
|
+
function containsRectangle(a, b) {
|
|
866
|
+
return a.top <= b.top && a.left <= b.left && a.bottom >= b.bottom && a.right >= b.right;
|
|
867
|
+
}
|
|
868
|
+
// src/model/editor/table-fragment.ts
|
|
869
|
+
/** @file 片段的物理表格裁切,保留完整合并和配置关系,不改源网格。 */
|
|
870
|
+
/** 区域结构带上完整父子、关联表头及相交合并;只扩展物理闭包,不读取业务值。 */
|
|
871
|
+
function regionFragmentRectangle(table, regionId) {
|
|
872
|
+
const positions = indexTablePositions(table), regions = table.regions.map((region) => ({
|
|
873
|
+
region,
|
|
874
|
+
area: rectangleFromPositions(positions, region.range)
|
|
875
|
+
})), source = regions.find((item) => item.region.id === regionId);
|
|
876
|
+
if (!source) throw new ModelEditError("fragment_region", "Region does not belong to table");
|
|
877
|
+
const rectangle = { ...source.area }, included = /* @__PURE__ */ new Set([regionId]), merges = table.merges.map((merge) => rectangleFromPositions(positions, merge.range));
|
|
878
|
+
/** 身份关系和几何一起达到闭包,后续扩展可能触达另一个完整区域。 */
|
|
879
|
+
const expand = (area) => {
|
|
880
|
+
if (containsRectangle(rectangle, area)) return false;
|
|
881
|
+
rectangle.top = Math.min(rectangle.top, area.top);
|
|
882
|
+
rectangle.left = Math.min(rectangle.left, area.left);
|
|
883
|
+
rectangle.bottom = Math.max(rectangle.bottom, area.bottom);
|
|
884
|
+
rectangle.right = Math.max(rectangle.right, area.right);
|
|
885
|
+
return true;
|
|
886
|
+
};
|
|
887
|
+
let changed = true;
|
|
888
|
+
while (changed) {
|
|
889
|
+
changed = false;
|
|
890
|
+
for (const { region, area } of regions) {
|
|
891
|
+
if (!included.has(region.id) && !intersectsRectangle(rectangle, area) && !included.has(region.parentRegionId ?? "") && !included.has(region.targetRegionId ?? "")) continue;
|
|
892
|
+
if (!included.has(region.id)) {
|
|
893
|
+
included.add(region.id);
|
|
894
|
+
changed = true;
|
|
895
|
+
}
|
|
896
|
+
for (const id of [region.parentRegionId, region.targetRegionId]) if (id && !included.has(id)) {
|
|
897
|
+
included.add(id);
|
|
898
|
+
changed = true;
|
|
899
|
+
}
|
|
900
|
+
if (expand(area)) changed = true;
|
|
901
|
+
}
|
|
902
|
+
for (const area of merges) if (intersectsRectangle(rectangle, area) && expand(area)) changed = true;
|
|
903
|
+
}
|
|
904
|
+
return rectangle;
|
|
905
|
+
}
|
|
906
|
+
/** 只扩展相交合并形成最小闭包,不把业务区域边界隐式裁断。 */
|
|
907
|
+
function tableFragmentRectangle(table, selected) {
|
|
908
|
+
const positions = indexTablePositions(table), rect = { ...selected };
|
|
909
|
+
let changed = true;
|
|
910
|
+
while (changed) {
|
|
911
|
+
changed = false;
|
|
912
|
+
for (const merge of table.merges) {
|
|
913
|
+
const area = rectangleFromPositions(positions, merge.range);
|
|
914
|
+
if (!intersectsRectangle(rect, area) || containsRectangle(rect, area)) continue;
|
|
915
|
+
rect.top = Math.min(rect.top, area.top);
|
|
916
|
+
rect.left = Math.min(rect.left, area.left);
|
|
917
|
+
rect.bottom = Math.max(rect.bottom, area.bottom);
|
|
918
|
+
rect.right = Math.max(rect.right, area.right);
|
|
919
|
+
changed = true;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
return rect;
|
|
923
|
+
}
|
|
924
|
+
/** 裁切物理声明;omit 仅省略外层区域,格内嵌套表仍保留自己的声明,合并闭包不变。 */
|
|
925
|
+
function sliceTableFragment(table, rectangle, contents, regions = "preserve") {
|
|
926
|
+
const rect = tableFragmentRectangle(table, rectangle), positions = indexTablePositions(table), { rows: _rows, columns: _columns, merges: _merges, regions: _regions, ...appearance } = table;
|
|
927
|
+
const result = {
|
|
928
|
+
...copyData(appearance),
|
|
929
|
+
columns: copyData(table.columns.slice(rect.left, rect.right + 1)),
|
|
930
|
+
rows: table.rows.slice(rect.top, rect.bottom + 1).map((row) => ({
|
|
931
|
+
id: row.id,
|
|
932
|
+
kind: "row",
|
|
933
|
+
...row.height ? { height: copyData(row.height) } : {},
|
|
934
|
+
cells: row.cells.slice(rect.left, rect.right + 1).map((cell) => ({
|
|
935
|
+
...copyData({
|
|
936
|
+
id: cell.id,
|
|
937
|
+
kind: cell.kind,
|
|
938
|
+
...cell.style ? { style: cell.style } : {}
|
|
939
|
+
}),
|
|
940
|
+
blocks: contents ? copyData(contents.get(cell.id) ?? []) : copyData(cell.blocks)
|
|
941
|
+
}))
|
|
942
|
+
})),
|
|
943
|
+
merges: table.merges.filter((merge) => containsRectangle(rect, rectangleFromPositions(positions, merge.range))).map((merge) => copyData(merge)),
|
|
944
|
+
regions: []
|
|
945
|
+
};
|
|
946
|
+
if (regions === "omit") return result;
|
|
947
|
+
for (const region of table.regions) {
|
|
948
|
+
const area = rectangleFromPositions(positions, region.range);
|
|
949
|
+
if (!intersectsRectangle(rect, area)) continue;
|
|
950
|
+
if (!containsRectangle(rect, area) && region.type !== "table-header" && region.type !== "sub-table-header") throw new ModelEditError("fragment_region", "Cannot cut through a business region");
|
|
951
|
+
const top = Math.max(rect.top, area.top), left = Math.max(rect.left, area.left), bottom = Math.min(rect.bottom, area.bottom), right = Math.min(rect.right, area.right);
|
|
952
|
+
result.regions.push({
|
|
953
|
+
...copyData(region),
|
|
954
|
+
range: {
|
|
955
|
+
fromCellId: table.rows[top].cells[left].id,
|
|
956
|
+
toCellId: table.rows[bottom].cells[right].id
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
return result;
|
|
961
|
+
}
|
|
962
|
+
// src/model/editor/content-fragment.ts
|
|
963
|
+
/** @file 内容根范围的片段读取,跨章节/格保留所选结构,空集合不物化 model。 */
|
|
964
|
+
/** 校验空容器和段落端点,拒绝伪造非空 blocks 间隙。 */
|
|
965
|
+
function boundary(ctx, value, locate) {
|
|
966
|
+
const input = checkFactoryOptions(value, [
|
|
967
|
+
"kind",
|
|
968
|
+
"parentId",
|
|
969
|
+
"paragraphId",
|
|
970
|
+
"index",
|
|
971
|
+
"offset"
|
|
972
|
+
]);
|
|
973
|
+
if ("kind" in input) {
|
|
974
|
+
const gap = checkFactoryOptions(input, ["kind", "parentId"]);
|
|
975
|
+
const owner = ctx.entry(gap.parentId).node;
|
|
976
|
+
if (gap.kind !== "emptyBlocks" || !("blocks" in owner) || owner.blocks.length) throw new ModelEditError("range", "Expected an empty blocks owner");
|
|
977
|
+
return { id: owner.id };
|
|
978
|
+
}
|
|
979
|
+
const at = locate(input);
|
|
980
|
+
return {
|
|
981
|
+
id: at.paragraph.id,
|
|
982
|
+
point: at
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
/** 对源段落只复制所选行内范围,完整字素校验由统一段内位置读取器负责。 */
|
|
986
|
+
function paragraphSlice(paragraph, from, to) {
|
|
987
|
+
const { content, ...declaration } = paragraph, result = {
|
|
988
|
+
...copyData(declaration),
|
|
989
|
+
content: []
|
|
990
|
+
};
|
|
991
|
+
for (let i = from?.index ?? 0; i < content.length; i++) {
|
|
992
|
+
if (to && (i > to.index || i === to.index && !to.offset)) break;
|
|
993
|
+
const node = copyData(content[i]);
|
|
994
|
+
if (node.kind === "text") node.text = node.text.slice(i === from?.index ? from.offset : 0, i === to?.index ? to.offset : node.text.length);
|
|
995
|
+
result.content.push(node);
|
|
996
|
+
}
|
|
997
|
+
return result;
|
|
998
|
+
}
|
|
999
|
+
/** 按拥有树裁切同编辑根,章节设置不作为剪贴内容;表格保留裁切网格和合并闭包。 */
|
|
1000
|
+
function extractContentBlocks(ctx, range, locate) {
|
|
1001
|
+
const value = readFactoryOptions(range, ["from", "to"]);
|
|
1002
|
+
let a = boundary(ctx, value.from, locate), b = boundary(ctx, value.to, locate);
|
|
1003
|
+
if (a.point && b.point && ctx.entry(a.id).parentId === ctx.entry(b.id).parentId) {
|
|
1004
|
+
const parentId = ctx.entry(a.id).parentId, owner = ctx.entry(parentId).node;
|
|
1005
|
+
if (!("blocks" in owner)) throw new ModelEditError("content_flow", "Expected blocks owner");
|
|
1006
|
+
let from = owner.blocks.findIndex((block) => block.id === a.id), to = owner.blocks.findIndex((block) => block.id === b.id);
|
|
1007
|
+
if (from < 0 || to < 0) throw new ModelEditError("content_flow", "Paragraph is outside blocks");
|
|
1008
|
+
if (from > to || from === to && (a.point.index > b.point.index || a.point.index === b.point.index && a.point.offset > b.point.offset)) {
|
|
1009
|
+
[a, b] = [b, a];
|
|
1010
|
+
[from, to] = [to, from];
|
|
1011
|
+
}
|
|
1012
|
+
if (a.id === b.id && a.point.index === b.point.index && a.point.offset === b.point.offset) return [];
|
|
1013
|
+
return owner.blocks.slice(from, to + 1).map((block) => block.kind === "paragraph" ? paragraphSlice(block, block.id === a.id ? a.point : void 0, block.id === b.id ? b.point : void 0) : copyData(block));
|
|
1014
|
+
}
|
|
1015
|
+
const root = contentRoot(a.id, ctx.entry);
|
|
1016
|
+
if (root.id !== contentRoot(b.id, ctx.entry).id) throw new ModelEditError("content_flow", "Fragment endpoints must share an editing root");
|
|
1017
|
+
const order = /* @__PURE__ */ new Map();
|
|
1018
|
+
let index = 0;
|
|
1019
|
+
for (const leaf of contentLeaves(root)) order.set(leaf.kind === "paragraph" ? leaf.id : leaf.ownerId, index++);
|
|
1020
|
+
const ai = order.get(a.id), bi = order.get(b.id);
|
|
1021
|
+
if (ai === void 0 || bi === void 0) throw new ModelEditError("content_flow", "Fragment endpoints are outside content");
|
|
1022
|
+
if (ai > bi || ai === bi && a.point && b.point && (a.point.index > b.point.index || a.point.index === b.point.index && a.point.offset > b.point.offset)) [a, b] = [b, a];
|
|
1023
|
+
if (a.id === b.id && (!a.point || !b.point || a.point.index === b.point.index && a.point.offset === b.point.offset)) return [];
|
|
1024
|
+
const start = order.get(a.id), end = order.get(b.id);
|
|
1025
|
+
/** 段落读取与空容器判断不越入字段的附属根。 */
|
|
1026
|
+
const included = (id) => {
|
|
1027
|
+
const at = order.get(id);
|
|
1028
|
+
return at !== void 0 && at >= start && at <= end;
|
|
1029
|
+
};
|
|
1030
|
+
/** 完整中间表原样复制,部分表保留被选内容及最小物理形状。 */
|
|
1031
|
+
const visit = (block) => {
|
|
1032
|
+
if (block.kind === "paragraph") return included(block.id) ? paragraphSlice(block, block.id === a.id ? a.point : void 0, block.id === b.id ? b.point : void 0) : void 0;
|
|
1033
|
+
const contents = /* @__PURE__ */ new Map();
|
|
1034
|
+
let top = Infinity, left = Infinity, bottom = -1, right = -1;
|
|
1035
|
+
for (let r = 0; r < block.rows.length; r++) for (let c = 0; c < block.columns.length; c++) {
|
|
1036
|
+
const cell = block.rows[r].cells[c], blocks = cell.blocks.map(visit).filter((node) => !!node);
|
|
1037
|
+
if (blocks.length || !cell.blocks.length && included(cell.id)) {
|
|
1038
|
+
contents.set(cell.id, blocks);
|
|
1039
|
+
top = Math.min(top, r);
|
|
1040
|
+
left = Math.min(left, c);
|
|
1041
|
+
bottom = Math.max(bottom, r);
|
|
1042
|
+
right = Math.max(right, c);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
if (bottom < 0) return void 0;
|
|
1046
|
+
return sliceTableFragment(block, {
|
|
1047
|
+
top,
|
|
1048
|
+
left,
|
|
1049
|
+
bottom,
|
|
1050
|
+
right
|
|
1051
|
+
}, contents);
|
|
1052
|
+
};
|
|
1053
|
+
return contentCollections(root).flatMap((blocks) => blocks.map((block) => visit(block)).filter((block) => !!block));
|
|
1054
|
+
}
|
|
1055
|
+
// src/model/editor/cross-container-edit.ts
|
|
1056
|
+
/** @file 跨章节/格的范围替换策略:保护端点容器,整块删除中间内容,仍复用唯一事务和历史。 */
|
|
1057
|
+
/** 完整覆盖的中间块整体移除;章节、端点表/格和未选中的尾部保持原归属。 */
|
|
1058
|
+
function replaceAcrossContainers(ctx, ranges, first, last, text, options, format) {
|
|
1059
|
+
const root = contentRoot(first.paragraph.id, ctx.entry), other = contentRoot(last.paragraph.id, ctx.entry), settings = readRemovalOptions(options);
|
|
1060
|
+
if (root.id !== other.id) throw new ModelEditError("content_flow", "Range endpoints must share the same editing root");
|
|
1061
|
+
let from = first, to = last, firstIndex = -1, lastIndex = -1, index = 0;
|
|
1062
|
+
for (const paragraph of contentParagraphs(root)) {
|
|
1063
|
+
if (paragraph.id === first.paragraph.id) firstIndex = index;
|
|
1064
|
+
if (paragraph.id === last.paragraph.id) lastIndex = index;
|
|
1065
|
+
index++;
|
|
1066
|
+
}
|
|
1067
|
+
if (firstIndex < 0 || lastIndex < 0) throw new ModelEditError("content_flow", "Range endpoints are outside the content tree");
|
|
1068
|
+
if (firstIndex > lastIndex) [from, to] = [to, from];
|
|
1069
|
+
const protectedIds = /* @__PURE__ */ new Set([...contentAncestors(from.paragraph.id, ctx.entry), ...contentAncestors(to.paragraph.id, ctx.entry)]), removed = [];
|
|
1070
|
+
let inside = false;
|
|
1071
|
+
/** 只进入端点的祖先表,完整覆盖的中间表作为一个块删除。 */
|
|
1072
|
+
const visit = (blocks) => {
|
|
1073
|
+
for (const block of blocks) if (block.id === from.paragraph.id) inside = true;
|
|
1074
|
+
else if (block.id === to.paragraph.id) inside = false;
|
|
1075
|
+
else if (protectedIds.has(block.id) && block.kind === "table") for (const row of block.rows) for (const cell of row.cells) visit(cell.blocks);
|
|
1076
|
+
else if (inside) removed.push(block.id);
|
|
1077
|
+
};
|
|
1078
|
+
for (const blocks of contentCollections(root)) visit(blocks);
|
|
1079
|
+
const definitions = ctx.collectDefinitions(removed), fromPoint = {
|
|
1080
|
+
paragraphId: from.paragraph.id,
|
|
1081
|
+
index: from.index,
|
|
1082
|
+
...from.offset ? { offset: from.offset } : {}
|
|
1083
|
+
}, toPoint = {
|
|
1084
|
+
paragraphId: to.paragraph.id,
|
|
1085
|
+
index: to.index,
|
|
1086
|
+
...to.offset ? { offset: to.offset } : {}
|
|
1087
|
+
};
|
|
1088
|
+
ranges.deleteContents({
|
|
1089
|
+
from: {
|
|
1090
|
+
paragraphId: to.paragraph.id,
|
|
1091
|
+
index: 0
|
|
1092
|
+
},
|
|
1093
|
+
to: toPoint
|
|
1094
|
+
}, settings);
|
|
1095
|
+
const replacement = {
|
|
1096
|
+
from: fromPoint,
|
|
1097
|
+
to: {
|
|
1098
|
+
paragraphId: from.paragraph.id,
|
|
1099
|
+
index: from.paragraph.content.length
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
const result = format ? ranges.replaceStyledText(replacement, text, format) : ranges.replaceText(replacement, text, settings);
|
|
1103
|
+
for (const id of removed.reverse()) {
|
|
1104
|
+
const entry = ctx.entry(id), owner = entry.parentId && ctx.entry(entry.parentId).node;
|
|
1105
|
+
if (!owner || !("blocks" in owner)) throw new ModelEditError("content_flow", "Selected block owner changed");
|
|
1106
|
+
const at = owner.blocks.findIndex((block) => block.id === id);
|
|
1107
|
+
ctx.editor.removeNodes({
|
|
1108
|
+
parentId: owner.id,
|
|
1109
|
+
collection: "blocks",
|
|
1110
|
+
index: at,
|
|
1111
|
+
count: 1
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
ctx.cleanupDefinitions(definitions, settings);
|
|
1115
|
+
return result.point;
|
|
1116
|
+
}
|
|
1117
|
+
// src/model/editor/format-update.ts
|
|
1118
|
+
/** @file 格式补丁的纯读取与明确声明合并,供范围写入和临时输入态共用。 */
|
|
1119
|
+
/** 先校验并隔离格式补丁和共享引用,空光标也不需要创建临时节点来验证。 */
|
|
1120
|
+
function readTextFormatUpdate(document, update) {
|
|
1121
|
+
const patch = readFactoryOptions(update, [
|
|
1122
|
+
"set",
|
|
1123
|
+
"unset",
|
|
1124
|
+
"textStyleId"
|
|
1125
|
+
]);
|
|
1126
|
+
if (patch.set !== void 0) checkFactoryValue(patch.set, textStyleRule, "/set");
|
|
1127
|
+
if (patch.unset !== void 0) checkFactoryValue(patch.unset, array(oneOf(...Object.keys(textStyleProperties))), "/unset");
|
|
1128
|
+
if (patch.textStyleId !== void 0 && patch.textStyleId !== null) {
|
|
1129
|
+
checkFactoryValue(patch.textStyleId, nonempty, "/textStyleId");
|
|
1130
|
+
if (!Object.hasOwn(document.styles.text, patch.textStyleId)) throw new ModelEditError("style_reference", `Missing text style: ${patch.textStyleId}`);
|
|
1131
|
+
}
|
|
1132
|
+
for (const key of patch.unset ?? []) if (patch.set && Object.hasOwn(patch.set, key)) throw new ModelEditError("style_patch", `Cannot set and unset ${key}`);
|
|
1133
|
+
return patch;
|
|
1134
|
+
}
|
|
1135
|
+
/** 覆盖直接声明、移除时恢复继承;计算样式不会被写入模型。 */
|
|
1136
|
+
function patchTextDeclaration(current, patch) {
|
|
1137
|
+
const next = { ...current }, style = {
|
|
1138
|
+
...current.textStyle,
|
|
1139
|
+
...patch.set
|
|
1140
|
+
};
|
|
1141
|
+
for (const key of patch.unset ?? []) delete style[key];
|
|
1142
|
+
if (Object.keys(style).length) next.textStyle = style;
|
|
1143
|
+
else delete next.textStyle;
|
|
1144
|
+
if (patch.textStyleId === null) delete next.textStyleId;
|
|
1145
|
+
else if (patch.textStyleId !== void 0) next.textStyleId = patch.textStyleId;
|
|
1146
|
+
return next;
|
|
1147
|
+
}
|
|
1148
|
+
/** 即使目标为空也校验段落补丁与样式引用,非法输入不能被空集合静默忽略。 */
|
|
1149
|
+
function readParagraphFormatUpdate(document, update) {
|
|
1150
|
+
const patch = readFactoryOptions(update, [
|
|
1151
|
+
"set",
|
|
1152
|
+
"unset",
|
|
1153
|
+
"paragraphStyleId"
|
|
1154
|
+
]);
|
|
1155
|
+
if (patch.set !== void 0) checkFactoryValue(patch.set, paragraphStyleRule, "/set");
|
|
1156
|
+
if (patch.unset !== void 0) checkFactoryValue(patch.unset, array(oneOf(...Object.keys(paragraphStyleProperties))), "/unset");
|
|
1157
|
+
if (patch.paragraphStyleId !== void 0 && patch.paragraphStyleId !== null) {
|
|
1158
|
+
checkFactoryValue(patch.paragraphStyleId, nonempty, "/paragraphStyleId");
|
|
1159
|
+
if (!Object.hasOwn(document.styles.paragraph, patch.paragraphStyleId)) throw new ModelEditError("style_reference", `Missing paragraph style: ${patch.paragraphStyleId}`);
|
|
1160
|
+
}
|
|
1161
|
+
for (const key of patch.unset ?? []) if (patch.set && Object.hasOwn(patch.set, key)) throw new ModelEditError("style_patch", `Cannot set and unset ${key}`);
|
|
1162
|
+
return patch;
|
|
1163
|
+
}
|
|
1164
|
+
// src/model/config/config-uses.ts
|
|
1165
|
+
/**
|
|
1166
|
+
* @file 配置使用位置枚举:列出实体实际拥有的注册配置,避免把任意嵌套 JSON 误当成配置。
|
|
1167
|
+
* 阅读定位:config/ · 配置注册与显式核心引用。
|
|
1168
|
+
*/
|
|
1169
|
+
/** 枚举协议明确拥有的配置,不递归扫描任意 JSON,也不复制第二份文档。 */
|
|
1170
|
+
function entityConfigUses(node) {
|
|
1171
|
+
if ("kind" in node && (node.kind === "field" || node.kind === "pageWidget")) return node.config ? [{
|
|
1172
|
+
scope: node.kind,
|
|
1173
|
+
name: node.widget,
|
|
1174
|
+
version: node.configVersion ?? 1,
|
|
1175
|
+
path: "/config",
|
|
1176
|
+
value: node.config
|
|
1177
|
+
}] : [];
|
|
1178
|
+
if ("kind" in node && node.kind === "document") return Object.entries(node.business.configs ?? {}).flatMap(([name, config]) => config ? [{
|
|
1179
|
+
scope: "business",
|
|
1180
|
+
name,
|
|
1181
|
+
version: config.version,
|
|
1182
|
+
path: `${at("/business/configs", name)}/value`,
|
|
1183
|
+
value: config.value
|
|
1184
|
+
}] : []);
|
|
1185
|
+
if ("type" in node && "range" in node) {
|
|
1186
|
+
const result = [];
|
|
1187
|
+
if (node.config) result.push({
|
|
1188
|
+
scope: "region",
|
|
1189
|
+
name: node.type,
|
|
1190
|
+
version: node.configVersion ?? 1,
|
|
1191
|
+
path: "/config",
|
|
1192
|
+
value: node.config
|
|
1193
|
+
});
|
|
1194
|
+
if (node.variant) result.push({
|
|
1195
|
+
scope: "variant",
|
|
1196
|
+
name: node.variant.name,
|
|
1197
|
+
version: node.variant.version,
|
|
1198
|
+
path: "/variant/config",
|
|
1199
|
+
value: node.variant.config
|
|
1200
|
+
});
|
|
1201
|
+
return result;
|
|
1202
|
+
}
|
|
1203
|
+
return [];
|
|
1204
|
+
}
|
|
1205
|
+
// src/model/editor/fragment-data.ts
|
|
1206
|
+
/**
|
|
1207
|
+
* @file 片段依赖处理:收集实际使用的共享定义和样式继承闭包,导入时解决字典冲突并重写引用。
|
|
1208
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
1209
|
+
*/
|
|
1210
|
+
/** 只遍历协议的拥有数组,不展开绑定、样式或业务配置中的普通对象。 */
|
|
1211
|
+
function visitFragmentNodes(blocks, action) {
|
|
1212
|
+
/** 每个拥有实体访问一次,支持表格与多层附属内容。 */
|
|
1213
|
+
const visit = (node) => {
|
|
1214
|
+
action(node);
|
|
1215
|
+
const data = node;
|
|
1216
|
+
for (const key of [
|
|
1217
|
+
"content",
|
|
1218
|
+
"blocks",
|
|
1219
|
+
"rows",
|
|
1220
|
+
"cells",
|
|
1221
|
+
"columns",
|
|
1222
|
+
"merges",
|
|
1223
|
+
"regions",
|
|
1224
|
+
"attachments"
|
|
1225
|
+
]) if (isArray(data[key])) data[key].forEach(visit);
|
|
1226
|
+
};
|
|
1227
|
+
blocks.forEach(visit);
|
|
1228
|
+
}
|
|
1229
|
+
/** 收集片段实际引用的定义与样式继承闭包,不附带文档的无关缓存或字典。 */
|
|
1230
|
+
function collectFragmentDefinitions(blocks, source, registry) {
|
|
1231
|
+
const result = {
|
|
1232
|
+
styles: {
|
|
1233
|
+
text: Object.create(null),
|
|
1234
|
+
paragraph: Object.create(null),
|
|
1235
|
+
table: Object.create(null)
|
|
1236
|
+
},
|
|
1237
|
+
assets: Object.create(null),
|
|
1238
|
+
bindings: Object.create(null)
|
|
1239
|
+
};
|
|
1240
|
+
/** 在同类别中复制一个共享样式及其继承和文字样式依赖。 */
|
|
1241
|
+
const style = (kind, id) => {
|
|
1242
|
+
if (Object.hasOwn(result.styles[kind], id)) return;
|
|
1243
|
+
if (!Object.hasOwn(source.styles[kind], id)) throw new ModelEditError("fragment_reference", `Missing ${kind} style: ${id}`);
|
|
1244
|
+
const value = copyData(source.styles[kind][id]);
|
|
1245
|
+
Object.defineProperty(result.styles[kind], id, {
|
|
1246
|
+
value,
|
|
1247
|
+
enumerable: true,
|
|
1248
|
+
writable: true,
|
|
1249
|
+
configurable: true
|
|
1250
|
+
});
|
|
1251
|
+
if (!isUndefined(value.basedOn)) style(kind, value.basedOn);
|
|
1252
|
+
if ("textStyleId" in value && isString(value.textStyleId)) style("text", value.textStyleId);
|
|
1253
|
+
};
|
|
1254
|
+
visitFragmentNodes(blocks, (node) => {
|
|
1255
|
+
for (const use of entityConfigUses(node)) for (const reference of registry.getReferences(use.scope, use.name, use.version, use.value)) {
|
|
1256
|
+
const target = reference.target;
|
|
1257
|
+
if (target.kind === "style") style(target.styleKind, target.id);
|
|
1258
|
+
else if (target.kind === "binding" || target.kind === "asset") {
|
|
1259
|
+
const key = target.kind === "binding" ? "bindings" : "assets";
|
|
1260
|
+
if (!Object.hasOwn(source[key], target.id)) throw new ModelEditError("fragment_reference", `Missing ${key}: ${target.id}`);
|
|
1261
|
+
Object.defineProperty(result[key], target.id, {
|
|
1262
|
+
value: copyData(source[key][target.id]),
|
|
1263
|
+
enumerable: true,
|
|
1264
|
+
writable: true,
|
|
1265
|
+
configurable: true
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
if ("textStyleId" in node && !isUndefined(node.textStyleId)) style("text", node.textStyleId);
|
|
1270
|
+
if ("kind" in node && node.kind === "paragraph" && !isUndefined(node.paragraphStyleId)) style("paragraph", node.paragraphStyleId);
|
|
1271
|
+
if ("kind" in node && node.kind === "table" && !isUndefined(node.tableStyleId)) style("table", node.tableStyleId);
|
|
1272
|
+
if ("kind" in node && node.kind === "image") {
|
|
1273
|
+
if (!Object.hasOwn(source.assets, node.assetId)) throw new ModelEditError("fragment_reference", "Missing asset");
|
|
1274
|
+
result.assets[node.assetId] = copyData(source.assets[node.assetId]);
|
|
1275
|
+
}
|
|
1276
|
+
if ("kind" in node && node.kind === "field") {
|
|
1277
|
+
if (!Object.hasOwn(source.bindings, node.bindingId)) throw new ModelEditError("fragment_reference", "Missing binding");
|
|
1278
|
+
result.bindings[node.bindingId] = copyData(source.bindings[node.bindingId]);
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
return result;
|
|
1282
|
+
}
|
|
1283
|
+
/** 将所需定义导入当前事务:等价项复用,键冲突生成新身份并重写核心引用,不覆盖目标定义。 */
|
|
1284
|
+
function importFragmentDefinitions(ctx, fragment) {
|
|
1285
|
+
const registry = ctx.validation.registry;
|
|
1286
|
+
const source = collectFragmentDefinitions(fragment.blocks, fragment, registry);
|
|
1287
|
+
const target = ctx.editor.document;
|
|
1288
|
+
/** 导入单个共享定义,返回目标字典身份;同名但不同声明不会覆盖。 */
|
|
1289
|
+
const put = (name, preferredId, value) => {
|
|
1290
|
+
const dictionary = name === "assets" || name === "bindings" ? target[name] : target.styles[name.slice(7)];
|
|
1291
|
+
for (const [id, existing] of Object.entries(dictionary)) if (equalData(existing, value)) return id;
|
|
1292
|
+
const id = Object.hasOwn(dictionary, preferredId) ? ctx.createId() : preferredId;
|
|
1293
|
+
if (Object.hasOwn(dictionary, id)) throw new ModelEditError("id_factory", "Shared definition ID collision");
|
|
1294
|
+
ctx.editor.setDictionary(name, id, value);
|
|
1295
|
+
return id;
|
|
1296
|
+
};
|
|
1297
|
+
const assets = /* @__PURE__ */ new Map(), bindings = /* @__PURE__ */ new Map();
|
|
1298
|
+
for (const [id, value] of Object.entries(source.assets)) assets.set(id, put("assets", id, value));
|
|
1299
|
+
for (const [id, value] of Object.entries(source.bindings)) bindings.set(id, put("bindings", id, value));
|
|
1300
|
+
const styles = {
|
|
1301
|
+
text: /* @__PURE__ */ new Map(),
|
|
1302
|
+
paragraph: /* @__PURE__ */ new Map(),
|
|
1303
|
+
table: /* @__PURE__ */ new Map()
|
|
1304
|
+
};
|
|
1305
|
+
/** 按依赖顺序导入样式,先重写 basedOn/文字样式再判断与目标是否等价。 */
|
|
1306
|
+
const style = (kind, id) => {
|
|
1307
|
+
const cached = styles[kind].get(id);
|
|
1308
|
+
if (!isUndefined(cached)) return cached;
|
|
1309
|
+
const value = copyData(source.styles[kind][id]);
|
|
1310
|
+
if (!isUndefined(value.basedOn)) value.basedOn = style(kind, value.basedOn);
|
|
1311
|
+
if ("textStyleId" in value && isString(value.textStyleId)) value.textStyleId = style("text", value.textStyleId);
|
|
1312
|
+
const imported = put(`styles.${kind}`, id, value);
|
|
1313
|
+
styles[kind].set(id, imported);
|
|
1314
|
+
return imported;
|
|
1315
|
+
};
|
|
1316
|
+
for (const kind of [
|
|
1317
|
+
"text",
|
|
1318
|
+
"paragraph",
|
|
1319
|
+
"table"
|
|
1320
|
+
]) for (const id of Object.keys(source.styles[kind])) style(kind, id);
|
|
1321
|
+
visitFragmentNodes(fragment.blocks, (node) => {
|
|
1322
|
+
if ("textStyleId" in node && !isUndefined(node.textStyleId)) node.textStyleId = styles.text.get(node.textStyleId);
|
|
1323
|
+
if ("kind" in node && node.kind === "paragraph" && !isUndefined(node.paragraphStyleId)) node.paragraphStyleId = styles.paragraph.get(node.paragraphStyleId);
|
|
1324
|
+
if ("kind" in node && node.kind === "table" && !isUndefined(node.tableStyleId)) node.tableStyleId = styles.table.get(node.tableStyleId);
|
|
1325
|
+
if ("kind" in node && node.kind === "image") node.assetId = assets.get(node.assetId);
|
|
1326
|
+
if ("kind" in node && node.kind === "field") node.bindingId = bindings.get(node.bindingId);
|
|
1327
|
+
for (const use of entityConfigUses(node)) {
|
|
1328
|
+
const config = registry.remapConfig(use.scope, use.name, use.version, use.value, {
|
|
1329
|
+
asset: assets,
|
|
1330
|
+
binding: bindings,
|
|
1331
|
+
textStyle: styles.text,
|
|
1332
|
+
paragraphStyle: styles.paragraph,
|
|
1333
|
+
tableStyle: styles.table
|
|
1334
|
+
});
|
|
1335
|
+
if (use.path === "/config" && "config" in node) node.config = config;
|
|
1336
|
+
else if ("variant" in node && node.variant) node.variant.config = config;
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
// src/model/editor/fragment-appearance.ts
|
|
1341
|
+
/** @file 剪贴时保存来源外观上下文,按共享声明去重,不把有效属性展开到每个字符对象。 */
|
|
1342
|
+
/** 来源没有声明的绘制开关明确关闭,避免粘贴后吸收目标段落的装饰和字体。 */
|
|
1343
|
+
function isolatedText(style) {
|
|
1344
|
+
const family = style.fontFamily;
|
|
1345
|
+
return {
|
|
1346
|
+
...style,
|
|
1347
|
+
fontFamily: {
|
|
1348
|
+
latin: family?.latin ?? family?.eastAsia ?? "sans-serif",
|
|
1349
|
+
latinSupplemental: family?.latinSupplemental ?? family?.latin ?? family?.eastAsia ?? "sans-serif",
|
|
1350
|
+
eastAsia: family?.eastAsia ?? family?.latin ?? "sans-serif",
|
|
1351
|
+
complexScript: family?.complexScript ?? family?.latin ?? family?.eastAsia ?? "sans-serif"
|
|
1352
|
+
},
|
|
1353
|
+
fontSizePt: style.fontSizePt ?? 12,
|
|
1354
|
+
complexScriptFontSizePt: style.complexScriptFontSizePt ?? style.fontSizePt ?? 12,
|
|
1355
|
+
bold: style.bold ?? false,
|
|
1356
|
+
italic: style.italic ?? false,
|
|
1357
|
+
strike: style.strike ?? false,
|
|
1358
|
+
doubleStrike: style.doubleStrike ?? false,
|
|
1359
|
+
underline: style.underline ?? "none",
|
|
1360
|
+
textCase: style.textCase ?? "normal",
|
|
1361
|
+
smallCaps: style.smallCaps ?? false,
|
|
1362
|
+
verticalAlign: style.verticalAlign ?? "baseline",
|
|
1363
|
+
color: style.color ?? "#000000",
|
|
1364
|
+
highlightColor: style.highlightColor ?? style.shading?.fill ?? "transparent",
|
|
1365
|
+
letterSpacingPx: style.letterSpacingPx ?? 0
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
/** 段落的来源排版快照只作为一个共享样式,不修改源文档及其默认定义。 */
|
|
1369
|
+
function isolatedParagraph(style) {
|
|
1370
|
+
return {
|
|
1371
|
+
...style,
|
|
1372
|
+
alignment: style.alignment ?? "left",
|
|
1373
|
+
indentPx: {
|
|
1374
|
+
left: 0,
|
|
1375
|
+
right: 0,
|
|
1376
|
+
firstLine: 0,
|
|
1377
|
+
hanging: 0,
|
|
1378
|
+
...style.indentPx
|
|
1379
|
+
},
|
|
1380
|
+
spaceBeforePx: style.spaceBeforePx ?? 0,
|
|
1381
|
+
spaceAfterPx: style.spaceAfterPx ?? 0,
|
|
1382
|
+
spaceBeforeAuto: style.spaceBeforeAuto ?? false,
|
|
1383
|
+
spaceAfterAuto: style.spaceAfterAuto ?? false,
|
|
1384
|
+
lineHeight: style.lineHeight ?? {
|
|
1385
|
+
kind: "multiple",
|
|
1386
|
+
value: 1.2
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
/** 为剪贴载荷加独立外观样式;命名只在片段字典内分配,不消耗 model ID 或保存全局副本。 */
|
|
1391
|
+
function preserveFragmentAppearance(fragment, query) {
|
|
1392
|
+
const cache = {
|
|
1393
|
+
text: /* @__PURE__ */ new Map(),
|
|
1394
|
+
paragraph: /* @__PURE__ */ new Map()
|
|
1395
|
+
};
|
|
1396
|
+
let next = 0;
|
|
1397
|
+
/** 相同外观在本载荷中共享一个定义,粘贴继续由正式字典导入逻辑处理冲突。 */
|
|
1398
|
+
function put(kind, properties) {
|
|
1399
|
+
const key = JSON.stringify(properties), found = cache[kind].get(key);
|
|
1400
|
+
if (found) return found;
|
|
1401
|
+
let id;
|
|
1402
|
+
do
|
|
1403
|
+
id = `clipboard:${kind}:${next++}`;
|
|
1404
|
+
while (Object.hasOwn(fragment.styles[kind], id));
|
|
1405
|
+
Object.defineProperty(fragment.styles[kind], id, {
|
|
1406
|
+
enumerable: true,
|
|
1407
|
+
configurable: true,
|
|
1408
|
+
writable: true,
|
|
1409
|
+
value: { properties: copyData(properties) }
|
|
1410
|
+
});
|
|
1411
|
+
cache[kind].set(key, id);
|
|
1412
|
+
return id;
|
|
1413
|
+
}
|
|
1414
|
+
visitFragmentNodes(fragment.blocks, (node) => {
|
|
1415
|
+
if (!("kind" in node)) return;
|
|
1416
|
+
if (node.kind === "paragraph") {
|
|
1417
|
+
node.paragraphStyleId = put("paragraph", isolatedParagraph(query.resolveParagraphStyle(node.id)));
|
|
1418
|
+
node.textStyleId = put("text", isolatedText(query.resolveTextStyle(node.id)));
|
|
1419
|
+
} else if (node.kind === "text" || node.kind === "field" || node.kind === "pageWidget") node.textStyleId = put("text", isolatedText(query.resolveTextStyle(node.id)));
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
// src/model/editor/RangeEditor.ts
|
|
1423
|
+
/**
|
|
1424
|
+
* @file 内容范围编辑:跨文字、字段和段落删除或替换,设置选区格式,并导出或粘贴原生片段。
|
|
1425
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
1426
|
+
*/
|
|
1427
|
+
/** 跨节点/段落编辑与独立片段复制粘贴,所有操作复用已有事务、差量和字素规则。 */
|
|
1428
|
+
var RangeEditor = class {
|
|
1429
|
+
/** 唯一会话能力,关闭时释放。 */
|
|
1430
|
+
context;
|
|
1431
|
+
/** 由 ModelEditor.ranges 注入,不单独持有内容、选区或历史。 @internal */
|
|
1432
|
+
constructor(context) {
|
|
1433
|
+
this.context = context;
|
|
1434
|
+
}
|
|
1435
|
+
/** 删除有序或反向范围;同流合并段落,跨章节/单元格保留端点容器,默认清理候选绑定。 */
|
|
1436
|
+
deleteContents(range, options = {}) {
|
|
1437
|
+
return this.replace(range, "", options, "range:deleteContents");
|
|
1438
|
+
}
|
|
1439
|
+
/** 用完整字符串替换同编辑根的范围;跨容器不合并网格或章节,单片段仍沿用原文字快速路径。 */
|
|
1440
|
+
replaceText(range, text, options = {}) {
|
|
1441
|
+
return this.replace(range, text, options, "range:replaceText");
|
|
1442
|
+
}
|
|
1443
|
+
/** 输入态格式只作用于本次新文字,保留两侧原声明,不创建占位字或独立历史。 */
|
|
1444
|
+
replaceStyledText(range, text, format) {
|
|
1445
|
+
return this.replace(range, text, {}, "range:replaceStyledText", format);
|
|
1446
|
+
}
|
|
1447
|
+
/** 替换选区后插入语义段落边界,继承左段声明并返回新段落起点;整体只占一个历史项。 */
|
|
1448
|
+
insertParagraphBreak(range) {
|
|
1449
|
+
const ctx = this.requireContext();
|
|
1450
|
+
let point;
|
|
1451
|
+
const change = ctx.editor.transaction("range:insertParagraphBreak", () => {
|
|
1452
|
+
const deleted = this.deleteContents(range);
|
|
1453
|
+
const at = this.locatePoint(deleted.point), flow = this.flow(at.paragraph.id);
|
|
1454
|
+
ctx.editor.splitParagraph(at.paragraph.id, {
|
|
1455
|
+
index: at.index,
|
|
1456
|
+
...at.offset > 0 ? { offset: at.offset } : {}
|
|
1457
|
+
});
|
|
1458
|
+
point = {
|
|
1459
|
+
paragraphId: flow.blocks[flow.index + 1].id,
|
|
1460
|
+
index: 0
|
|
1461
|
+
};
|
|
1462
|
+
});
|
|
1463
|
+
return {
|
|
1464
|
+
point,
|
|
1465
|
+
change
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
/** 在文字选区插入普通表,保留两侧段落并把光标放入第一格;所有修改共用一条历史。 */
|
|
1469
|
+
insertTable(range, options) {
|
|
1470
|
+
const ctx = this.requireContext();
|
|
1471
|
+
let point;
|
|
1472
|
+
const change = ctx.editor.transaction("range:insertTable", () => {
|
|
1473
|
+
const deleted = this.deleteContents(range);
|
|
1474
|
+
const at = this.locatePoint(deleted.point);
|
|
1475
|
+
const flow = this.flow(at.paragraph.id);
|
|
1476
|
+
ctx.editor.splitParagraph(at.paragraph.id, {
|
|
1477
|
+
index: at.index,
|
|
1478
|
+
...at.offset > 0 ? { offset: at.offset } : {}
|
|
1479
|
+
});
|
|
1480
|
+
const inserted = ctx.editor.insertTable({
|
|
1481
|
+
parentId: flow.parentId,
|
|
1482
|
+
collection: "blocks",
|
|
1483
|
+
index: flow.index + 1
|
|
1484
|
+
}, options);
|
|
1485
|
+
const firstCell = ctx.entry(inserted.nodeId).node.rows[0].cells[0];
|
|
1486
|
+
point = {
|
|
1487
|
+
paragraphId: ctx.editor.insertParagraph({
|
|
1488
|
+
parentId: firstCell.id,
|
|
1489
|
+
collection: "blocks",
|
|
1490
|
+
index: 0
|
|
1491
|
+
}).nodeId,
|
|
1492
|
+
index: 0
|
|
1493
|
+
};
|
|
1494
|
+
});
|
|
1495
|
+
return {
|
|
1496
|
+
point,
|
|
1497
|
+
change
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
/** 只修改选中的文字/字段/页面组件,部分文字按边界拆分;折叠范围不写入输入态格式。 */
|
|
1501
|
+
formatText(range, update) {
|
|
1502
|
+
const ctx = this.requireContext();
|
|
1503
|
+
return ctx.editor.transaction("range:formatText", () => {
|
|
1504
|
+
const selected = this.locateFormatting(range), patch = readTextFormatUpdate(ctx.editor.document, update);
|
|
1505
|
+
const targets = this.formatTargets(selected), paragraphs = /* @__PURE__ */ new Set();
|
|
1506
|
+
for (const target of targets) {
|
|
1507
|
+
const next = this.patchedStyle(target.node.textStyle, patch.set, patch.unset);
|
|
1508
|
+
const styleChanged = !equalData(target.node.textStyle ?? {}, next ?? {});
|
|
1509
|
+
const referenceChanged = !isUndefined(patch.textStyleId) && (target.node.textStyleId ?? null) !== patch.textStyleId;
|
|
1510
|
+
if (!styleChanged && !referenceChanged) continue;
|
|
1511
|
+
let node = target.node;
|
|
1512
|
+
if (node.kind === "text") {
|
|
1513
|
+
if (target.to < node.text.length) ctx.editor.splitText(node.id, target.to);
|
|
1514
|
+
if (target.from > 0) {
|
|
1515
|
+
ctx.editor.splitText(node.id, target.from);
|
|
1516
|
+
const paragraph = this.paragraph(target.paragraphId);
|
|
1517
|
+
node = paragraph.content[paragraph.content.findIndex((item) => item.id === node.id) + 1];
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
if (styleChanged) {
|
|
1521
|
+
if (isUndefined(next)) ctx.editor.unsetProperty(node.id, "textStyle");
|
|
1522
|
+
else ctx.editor.setTextStyle(node.id, next);
|
|
1523
|
+
}
|
|
1524
|
+
if (referenceChanged) {
|
|
1525
|
+
if (isNull(patch.textStyleId)) ctx.editor.unsetProperty(node.id, "textStyleId");
|
|
1526
|
+
else ctx.editor.setProperty(node.id, "textStyleId", patch.textStyleId);
|
|
1527
|
+
}
|
|
1528
|
+
paragraphs.add(target.paragraphId);
|
|
1529
|
+
}
|
|
1530
|
+
for (const id of paragraphs) ctx.editor.normalizeText(id);
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
/** 修改选区触达的段落;跨表块会触达其中的段落,选区末端恰为下一段开头时不修改下一段。 */
|
|
1534
|
+
formatParagraphs(range, update) {
|
|
1535
|
+
const ctx = this.requireContext();
|
|
1536
|
+
return ctx.editor.transaction("range:formatParagraphs", () => {
|
|
1537
|
+
const selected = this.locateFormatting(range), patch = readParagraphFormatUpdate(ctx.editor.document, update);
|
|
1538
|
+
const paragraphs = selected.paragraphs;
|
|
1539
|
+
for (const paragraph of paragraphs) {
|
|
1540
|
+
const next = this.patchedStyle(paragraph.paragraphStyle, patch.set, patch.unset);
|
|
1541
|
+
if (!equalData(paragraph.paragraphStyle ?? {}, next ?? {})) {
|
|
1542
|
+
if (isUndefined(next)) ctx.editor.unsetProperty(paragraph.id, "paragraphStyle");
|
|
1543
|
+
else ctx.editor.setParagraphStyle(paragraph.id, next);
|
|
1544
|
+
}
|
|
1545
|
+
if (!isUndefined(patch.paragraphStyleId)) {
|
|
1546
|
+
if (isNull(patch.paragraphStyleId)) ctx.editor.unsetProperty(paragraph.id, "paragraphStyleId");
|
|
1547
|
+
else ctx.editor.setProperty(paragraph.id, "paragraphStyleId", patch.paragraphStyleId);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
/** 显式导出只读原生剪贴片段,只复制选中块和依赖闭包,不生成新身份或改变历史。 */
|
|
1553
|
+
getFragment(range, options = {}) {
|
|
1554
|
+
this.requireContext().assertCommitted();
|
|
1555
|
+
const fragment = this.contentFragment(range);
|
|
1556
|
+
this.copyAppearance(fragment, options);
|
|
1557
|
+
freezeData(fragment);
|
|
1558
|
+
return fragment;
|
|
1559
|
+
}
|
|
1560
|
+
/** 按本会话注册表校验并隔离外部片段,不写模板、历史或创建模型身份。 */
|
|
1561
|
+
prepareFragment(value) {
|
|
1562
|
+
const fragment = readFragment(value, this.requireContext().validation);
|
|
1563
|
+
freezeData(fragment);
|
|
1564
|
+
return fragment;
|
|
1565
|
+
}
|
|
1566
|
+
/** 导出所选物理矩形,自动形成合并闭包,源格和配置不写回或重新分配身份。 */
|
|
1567
|
+
getTableFragment(tableId, range, options = {}) {
|
|
1568
|
+
const ctx = this.requireContext();
|
|
1569
|
+
ctx.assertCommitted();
|
|
1570
|
+
const entry = ctx.entry(tableId);
|
|
1571
|
+
if (entry.role !== "table") throw new ModelEditError("node_type", "Expected table");
|
|
1572
|
+
const settings = readFactoryOptions(options, ["preserveAppearance", "regions"]);
|
|
1573
|
+
if (settings.regions !== void 0 && settings.regions !== "preserve" && settings.regions !== "omit") throw new ModelEditError("fragment_options", "Expected preserve or omit regions");
|
|
1574
|
+
const table = entry.node, rectangle = rectangleFromPositions(indexTablePositions(table), readFactoryOptions(range, ["fromCellId", "toCellId"]));
|
|
1575
|
+
const fragment = this.fragment([sliceTableFragment(table, rectangle, void 0, settings.regions)]);
|
|
1576
|
+
this.copyAppearance(fragment, settings.preserveAppearance === void 0 ? {} : { preserveAppearance: settings.preserveAppearance });
|
|
1577
|
+
freezeData(fragment);
|
|
1578
|
+
return fragment;
|
|
1579
|
+
}
|
|
1580
|
+
/** 导出完整区域及其父子、关联表头和合并闭包,外部实体引用不完整时整份拒绝。 */
|
|
1581
|
+
getRegionFragment(regionId, options = {}) {
|
|
1582
|
+
const ctx = this.requireContext();
|
|
1583
|
+
ctx.assertCommitted();
|
|
1584
|
+
const entry = ctx.entry(regionId);
|
|
1585
|
+
if (entry.role !== "region" || !entry.parentId) throw new ModelEditError("node_type", "Expected region");
|
|
1586
|
+
const table = ctx.entry(entry.parentId).node, fragment = this.fragment([sliceTableFragment(table, regionFragmentRectangle(table, regionId))]);
|
|
1587
|
+
this.copyAppearance(fragment, options);
|
|
1588
|
+
const checked = validateFragment(fragment, ctx.validation);
|
|
1589
|
+
if (!checked.valid) throw new DocumentValidationError(checked.issues);
|
|
1590
|
+
freezeData(fragment);
|
|
1591
|
+
return fragment;
|
|
1592
|
+
}
|
|
1593
|
+
/** 完整块插入复用字典导入与拥有克隆,失败回滚共享定义和内容,不创建占位文字。 */
|
|
1594
|
+
insertBlocksFragment(point, value) {
|
|
1595
|
+
const ctx = this.requireContext();
|
|
1596
|
+
let rootIds = [], idMap = /* @__PURE__ */ new Map();
|
|
1597
|
+
return {
|
|
1598
|
+
change: ctx.editor.transaction("range:insertBlocksFragment", () => {
|
|
1599
|
+
const destination = readFactoryOptions(point, ["parentId", "index"]), owner = ctx.entry(destination.parentId).node;
|
|
1600
|
+
if (!("blocks" in owner) || !isInteger(destination.index) || destination.index < 0 || destination.index > owner.blocks.length) throw new ModelEditError("insertion", "Expected a current blocks insertion point");
|
|
1601
|
+
const fragment = readFragment(value, ctx.validation);
|
|
1602
|
+
if (!fragment.blocks.length) return;
|
|
1603
|
+
importFragmentDefinitions(ctx, fragment);
|
|
1604
|
+
const at = {
|
|
1605
|
+
...destination,
|
|
1606
|
+
collection: "blocks"
|
|
1607
|
+
}, cloned = ctx.cloneOwned(at, fragment.blocks);
|
|
1608
|
+
ctx.editor.insertNodes(at, cloned.nodes);
|
|
1609
|
+
rootIds = cloned.nodes.map((node) => node.id);
|
|
1610
|
+
idMap = cloned.idMap;
|
|
1611
|
+
}),
|
|
1612
|
+
rootIds,
|
|
1613
|
+
idMap
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
/** 剪贴外观是显式导出选项,普通 getFragment 不改变既有声明复制语义。 */
|
|
1617
|
+
copyAppearance(fragment, options) {
|
|
1618
|
+
const settings = readFactoryOptions(options, ["preserveAppearance"]);
|
|
1619
|
+
if (settings.preserveAppearance !== void 0 && typeof settings.preserveAppearance !== "boolean") throw new ModelEditError("fragment_options", "Expected preserveAppearance boolean");
|
|
1620
|
+
if (settings.preserveAppearance) {
|
|
1621
|
+
const ctx = this.requireContext();
|
|
1622
|
+
preserveFragmentAppearance(fragment, ctx.editor.query);
|
|
1623
|
+
Object.assign(fragment, collectFragmentDefinitions(fragment.blocks, fragment, ctx.validation.registry));
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
/** 在同一或另一份原生文档插入合法片段:导入依赖、重建拥有身份、重写内部引用并一次提交。 */
|
|
1627
|
+
insertFragment(point, value) {
|
|
1628
|
+
const ctx = this.requireContext();
|
|
1629
|
+
let result;
|
|
1630
|
+
const change = ctx.editor.transaction("range:insertFragment", () => {
|
|
1631
|
+
result = this.paste(this.locatePoint(point), readFragment(value, ctx.validation));
|
|
1632
|
+
});
|
|
1633
|
+
return {
|
|
1634
|
+
...result,
|
|
1635
|
+
change
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
/** 用片段替换范围,删除与粘贴共用一笔事务;任一非法引用或插件复制失败都整体回滚。 */
|
|
1639
|
+
replaceWithFragment(range, value, options = {}) {
|
|
1640
|
+
const ctx = this.requireContext();
|
|
1641
|
+
let result;
|
|
1642
|
+
const change = ctx.editor.transaction("range:replaceWithFragment", () => {
|
|
1643
|
+
const valueRange = readFactoryOptions(range, ["from", "to"]), first = this.locatePoint(valueRange.from), last = this.locatePoint(valueRange.to);
|
|
1644
|
+
if (this.flow(first.paragraph.id).parentId !== this.flow(last.paragraph.id).parentId) {
|
|
1645
|
+
const fragment = readFragment(value, ctx.validation), point = this.deleteContents(range, options).point;
|
|
1646
|
+
result = this.paste(this.locatePoint(point), fragment);
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
const selected = this.locate(range), settings = readRemovalOptions(options);
|
|
1650
|
+
const units = this.logicalOffset(selected.from), fragment = readFragment(value, ctx.validation);
|
|
1651
|
+
const definitions = this.deleteSelected(selected);
|
|
1652
|
+
result = this.paste(this.locatePoint(this.pointAt(selected.from.paragraph, units, false)), fragment);
|
|
1653
|
+
ctx.cleanupDefinitions(definitions, settings);
|
|
1654
|
+
if (!selected.collapsed) {
|
|
1655
|
+
const last = this.paragraph(result.point.paragraphId), endUnits = this.logicalOffset(this.locatePoint(result.point));
|
|
1656
|
+
ctx.editor.normalizeText(selected.from.paragraph.id);
|
|
1657
|
+
if (last.id !== selected.from.paragraph.id) ctx.editor.normalizeText(last.id);
|
|
1658
|
+
result.point = this.pointAt(last, endUnits, true);
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
return {
|
|
1662
|
+
...result,
|
|
1663
|
+
change
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
/** 直接复制当前范围到目标位置,支持同一段落内复制,读取来源在写入前完成且只记一笔历史。 */
|
|
1667
|
+
copyContents(range, point) {
|
|
1668
|
+
const ctx = this.requireContext();
|
|
1669
|
+
let result;
|
|
1670
|
+
const change = ctx.editor.transaction("range:copyContents", () => {
|
|
1671
|
+
const destination = this.locatePoint(point), fragment = this.contentFragment(range);
|
|
1672
|
+
result = this.paste(destination, fragment);
|
|
1673
|
+
});
|
|
1674
|
+
return {
|
|
1675
|
+
...result,
|
|
1676
|
+
change
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
/** 内容读取保留同 blocks 快速路径,跨容器才裁切拥有树;可供同步事务内复制复用。 */
|
|
1680
|
+
contentFragment(range) {
|
|
1681
|
+
const ctx = this.requireContext();
|
|
1682
|
+
return this.fragment(extractContentBlocks(ctx, range, (point) => this.locatePoint(point)));
|
|
1683
|
+
}
|
|
1684
|
+
/** 关闭时释放会话能力,不保留剪贴内容或选区。 @internal */
|
|
1685
|
+
dispose() {
|
|
1686
|
+
this.context = void 0;
|
|
1687
|
+
}
|
|
1688
|
+
/** 字符串替换共用实现,单文字节点不进行结构拆合、全文校验或新身份分配。 */
|
|
1689
|
+
replace(range, text, options, label, format) {
|
|
1690
|
+
const ctx = this.requireContext();
|
|
1691
|
+
let point;
|
|
1692
|
+
const change = ctx.editor.transaction(label, () => {
|
|
1693
|
+
if (!isString(text)) throw new ModelEditError("text", "Expected replacement string");
|
|
1694
|
+
const patch = format === void 0 ? void 0 : readTextFormatUpdate(ctx.editor.document, format), value = readFactoryOptions(range, ["from", "to"]), start = this.locatePoint(value.from), end = this.locatePoint(value.to);
|
|
1695
|
+
if (this.flow(start.paragraph.id).parentId !== this.flow(end.paragraph.id).parentId) {
|
|
1696
|
+
point = replaceAcrossContainers(ctx, this, start, end, text, options, patch);
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
const selected = this.locate(range), settings = readRemovalOptions(options), from = selected.from, to = selected.to;
|
|
1700
|
+
const units = this.logicalOffset(from), node = from.paragraph.content[from.index], original = this.appearanceAt(from), appearance = patch ? patchTextDeclaration(original, patch) : original;
|
|
1701
|
+
if (from.paragraph.id === to.paragraph.id && node?.kind === "text" && (from.index === to.index || to.index === from.index + 1 && to.offset === 0) && (!patch || equalData(appearance, this.textAppearance(node)))) {
|
|
1702
|
+
ctx.editor.replaceText(node.id, from.offset, from.index === to.index ? to.offset : node.text.length, text);
|
|
1703
|
+
point = this.pointAt(from.paragraph, units + text.length, true);
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
if (selected.collapsed && !text) {
|
|
1707
|
+
point = this.pointAt(from.paragraph, units, true);
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
const definitions = this.deleteSelected(selected);
|
|
1711
|
+
const at = this.locatePoint(this.pointAt(from.paragraph, units, false));
|
|
1712
|
+
this.insertString(at, text, appearance);
|
|
1713
|
+
ctx.editor.normalizeText(from.paragraph.id);
|
|
1714
|
+
ctx.cleanupDefinitions(definitions, settings);
|
|
1715
|
+
point = this.pointAt(from.paragraph, units + text.length, true);
|
|
1716
|
+
});
|
|
1717
|
+
return {
|
|
1718
|
+
point,
|
|
1719
|
+
change
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
/** 删除选区并保留端点外内容;先保持结构边界,留给替换/粘贴完成后再合并文字。 */
|
|
1723
|
+
deleteSelected(selected) {
|
|
1724
|
+
if (selected.collapsed) return {};
|
|
1725
|
+
const ctx = this.requireContext(), from = selected.from, to = selected.to;
|
|
1726
|
+
if (from.paragraph.id === to.paragraph.id && from.index === to.index) {
|
|
1727
|
+
const node = from.paragraph.content[from.index];
|
|
1728
|
+
if (from.offset === 0) ctx.editor.deleteText(node.id, 0, to.offset);
|
|
1729
|
+
else {
|
|
1730
|
+
if (to.offset < node.text.length) ctx.editor.splitText(node.id, to.offset);
|
|
1731
|
+
ctx.editor.deleteText(node.id, from.offset, node.text.length);
|
|
1732
|
+
}
|
|
1733
|
+
return {};
|
|
1734
|
+
}
|
|
1735
|
+
const fromStart = from.index + (from.offset > 0 ? 1 : 0);
|
|
1736
|
+
const same = from.paragraph.id === to.paragraph.id;
|
|
1737
|
+
const roots = same ? from.paragraph.content.slice(fromStart, to.index).map((node) => node.id) : [
|
|
1738
|
+
...from.paragraph.content.slice(fromStart).map((node) => node.id),
|
|
1739
|
+
...to.paragraph.content.slice(0, to.index).map((node) => node.id),
|
|
1740
|
+
...selected.blocks.slice(selected.fromBlock + 1, selected.toBlock).map((node) => node.id)
|
|
1741
|
+
];
|
|
1742
|
+
const definitions = ctx.collectDefinitions(roots);
|
|
1743
|
+
if (from.offset > 0) {
|
|
1744
|
+
const node = from.paragraph.content[from.index];
|
|
1745
|
+
ctx.editor.deleteText(node.id, from.offset, node.text.length);
|
|
1746
|
+
}
|
|
1747
|
+
if (to.offset > 0) {
|
|
1748
|
+
const node = to.paragraph.content[to.index];
|
|
1749
|
+
ctx.editor.deleteText(node.id, 0, to.offset);
|
|
1750
|
+
}
|
|
1751
|
+
if (same) ctx.editor.removeNodes({
|
|
1752
|
+
parentId: from.paragraph.id,
|
|
1753
|
+
collection: "content",
|
|
1754
|
+
index: fromStart,
|
|
1755
|
+
count: to.index - fromStart
|
|
1756
|
+
});
|
|
1757
|
+
else {
|
|
1758
|
+
ctx.editor.removeNodes({
|
|
1759
|
+
parentId: from.paragraph.id,
|
|
1760
|
+
collection: "content",
|
|
1761
|
+
index: fromStart,
|
|
1762
|
+
count: from.paragraph.content.length - fromStart
|
|
1763
|
+
});
|
|
1764
|
+
ctx.editor.removeNodes({
|
|
1765
|
+
parentId: to.paragraph.id,
|
|
1766
|
+
collection: "content",
|
|
1767
|
+
index: 0,
|
|
1768
|
+
count: to.index
|
|
1769
|
+
});
|
|
1770
|
+
ctx.editor.moveNodes({
|
|
1771
|
+
parentId: to.paragraph.id,
|
|
1772
|
+
collection: "content",
|
|
1773
|
+
index: 0,
|
|
1774
|
+
count: to.paragraph.content.length
|
|
1775
|
+
}, {
|
|
1776
|
+
parentId: from.paragraph.id,
|
|
1777
|
+
collection: "content",
|
|
1778
|
+
index: from.paragraph.content.length
|
|
1779
|
+
});
|
|
1780
|
+
ctx.editor.removeNodes({
|
|
1781
|
+
parentId: selected.parentId,
|
|
1782
|
+
collection: "blocks",
|
|
1783
|
+
index: selected.fromBlock + 1,
|
|
1784
|
+
count: selected.toBlock - selected.fromBlock
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
return definitions;
|
|
1788
|
+
}
|
|
1789
|
+
/** 根据模型位置插入字符串,优先复用相同明确样式的相邻文字,不按字符创建对象。 */
|
|
1790
|
+
insertString(at, text, appearance) {
|
|
1791
|
+
if (!text) return;
|
|
1792
|
+
const ctx = this.requireContext(), content = at.paragraph.content;
|
|
1793
|
+
if (at.offset > 0) {
|
|
1794
|
+
const node = content[at.index];
|
|
1795
|
+
if (equalData(this.textAppearance(node), appearance)) ctx.editor.insertText(node.id, at.offset, text);
|
|
1796
|
+
else {
|
|
1797
|
+
ctx.editor.splitText(node.id, at.offset);
|
|
1798
|
+
this.insertString({
|
|
1799
|
+
paragraph: at.paragraph,
|
|
1800
|
+
index: at.index + 1,
|
|
1801
|
+
offset: 0
|
|
1802
|
+
}, text, appearance);
|
|
1803
|
+
}
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1806
|
+
const previous = content[at.index - 1], next = content[at.index];
|
|
1807
|
+
if (previous?.kind === "text" && equalData(this.textAppearance(previous), appearance)) ctx.editor.insertText(previous.id, previous.text.length, text);
|
|
1808
|
+
else if (next?.kind === "text" && equalData(this.textAppearance(next), appearance)) ctx.editor.insertText(next.id, 0, text);
|
|
1809
|
+
else {
|
|
1810
|
+
const node = ctx.withFactory((factory) => factory.createText(text, appearance));
|
|
1811
|
+
ctx.editor.insertNodes({
|
|
1812
|
+
parentId: at.paragraph.id,
|
|
1813
|
+
collection: "content",
|
|
1814
|
+
index: at.index
|
|
1815
|
+
}, [node]);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
/** 只收集实际所选内容的依赖,复用原生片段校验,不建立假文档。 */
|
|
1819
|
+
fragment(blocks) {
|
|
1820
|
+
const ctx = this.requireContext(), source = ctx.editor.document;
|
|
1821
|
+
return readFragment({
|
|
1822
|
+
format: "gct.fragment",
|
|
1823
|
+
schemaVersion: 1,
|
|
1824
|
+
sourceDocumentId: source.id,
|
|
1825
|
+
blocks,
|
|
1826
|
+
...collectFragmentDefinitions(blocks, source, ctx.validation.registry)
|
|
1827
|
+
}, ctx.validation);
|
|
1828
|
+
}
|
|
1829
|
+
/** 插入已隔离且有效的片段,首段折入目标段落,其他块保留自身段落声明。 */
|
|
1830
|
+
paste(at, fragment) {
|
|
1831
|
+
const ctx = this.requireContext(), paragraph = at.paragraph, blocks = fragment.blocks;
|
|
1832
|
+
if (!blocks.length) return {
|
|
1833
|
+
point: this.pointAt(paragraph, this.logicalOffset(at), true),
|
|
1834
|
+
rootIds: [],
|
|
1835
|
+
idMap: /* @__PURE__ */ new Map()
|
|
1836
|
+
};
|
|
1837
|
+
const first = blocks[0], fold = first.kind === "paragraph";
|
|
1838
|
+
if (blocks.length === 1 && fold && first.content.length === 0) return {
|
|
1839
|
+
point: this.pointAt(paragraph, this.logicalOffset(at), true),
|
|
1840
|
+
rootIds: Object.freeze([paragraph.id]),
|
|
1841
|
+
idMap: /* @__PURE__ */ new Map([[first.id, paragraph.id]])
|
|
1842
|
+
};
|
|
1843
|
+
const emptyTarget = fold && paragraph.content.every((node) => node.kind === "text" && !node.text);
|
|
1844
|
+
if (fold && !emptyTarget) for (const key of [
|
|
1845
|
+
"textStyleId",
|
|
1846
|
+
"textStyle",
|
|
1847
|
+
"paragraphStyleId",
|
|
1848
|
+
"paragraphStyle"
|
|
1849
|
+
]) delete first[key];
|
|
1850
|
+
importFragmentDefinitions(ctx, fragment);
|
|
1851
|
+
if (emptyTarget) {
|
|
1852
|
+
for (const key of [
|
|
1853
|
+
"textStyleId",
|
|
1854
|
+
"textStyle",
|
|
1855
|
+
"paragraphStyleId",
|
|
1856
|
+
"paragraphStyle"
|
|
1857
|
+
]) if (Object.hasOwn(first, key)) ctx.editor.setProperty(paragraph.id, key, first[key]);
|
|
1858
|
+
}
|
|
1859
|
+
const units = this.logicalOffset(at), flow = this.flow(paragraph.id);
|
|
1860
|
+
const reuse = fold ? /* @__PURE__ */ new Map([[first.id, paragraph.id]]) : /* @__PURE__ */ new Map();
|
|
1861
|
+
if (blocks.length === 1 && fold) {
|
|
1862
|
+
const cloned = ctx.cloneOwned({
|
|
1863
|
+
parentId: paragraph.id,
|
|
1864
|
+
collection: "content",
|
|
1865
|
+
index: at.index
|
|
1866
|
+
}, first.content, reuse);
|
|
1867
|
+
const index = this.splitAt(at);
|
|
1868
|
+
const size = this.inlineUnits(first.content);
|
|
1869
|
+
ctx.editor.insertNodes({
|
|
1870
|
+
parentId: paragraph.id,
|
|
1871
|
+
collection: "content",
|
|
1872
|
+
index
|
|
1873
|
+
}, cloned.nodes);
|
|
1874
|
+
if (cloned.nodes.length) ctx.editor.normalizeText(paragraph.id);
|
|
1875
|
+
const point = this.pointAt(paragraph, units + size, true);
|
|
1876
|
+
return {
|
|
1877
|
+
point,
|
|
1878
|
+
appearance: this.appearanceBefore(this.locatePoint(point)),
|
|
1879
|
+
rootIds: Object.freeze([paragraph.id]),
|
|
1880
|
+
idMap: this.resolvedMap(cloned.idMap)
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
const cloned = ctx.cloneOwned({
|
|
1884
|
+
parentId: flow.parentId,
|
|
1885
|
+
collection: "blocks",
|
|
1886
|
+
index: flow.index + 1
|
|
1887
|
+
}, blocks, reuse);
|
|
1888
|
+
const copied = cloned.nodes, following = fold ? copied.slice(1) : copied;
|
|
1889
|
+
const index = this.splitAt(at), roots = [paragraph.id, ...following.map((block) => block.id)];
|
|
1890
|
+
ctx.editor.insertNodes({
|
|
1891
|
+
parentId: flow.parentId,
|
|
1892
|
+
collection: "blocks",
|
|
1893
|
+
index: flow.index + 1
|
|
1894
|
+
}, following);
|
|
1895
|
+
let last = following.at(-1);
|
|
1896
|
+
if (!last || last.kind !== "paragraph") {
|
|
1897
|
+
const { id: _id, kind: _kind, content: _content, ...declaration } = paragraph;
|
|
1898
|
+
last = ctx.withFactory((factory) => factory.createParagraph(declaration));
|
|
1899
|
+
ctx.editor.insertNodes({
|
|
1900
|
+
parentId: flow.parentId,
|
|
1901
|
+
collection: "blocks",
|
|
1902
|
+
index: flow.index + 1 + following.length
|
|
1903
|
+
}, [last]);
|
|
1904
|
+
roots.push(last.id);
|
|
1905
|
+
}
|
|
1906
|
+
const end = this.paragraph(last.id), endUnits = this.inlineUnits(end.content);
|
|
1907
|
+
ctx.editor.moveNodes({
|
|
1908
|
+
parentId: paragraph.id,
|
|
1909
|
+
collection: "content",
|
|
1910
|
+
index,
|
|
1911
|
+
count: paragraph.content.length - index
|
|
1912
|
+
}, {
|
|
1913
|
+
parentId: end.id,
|
|
1914
|
+
collection: "content",
|
|
1915
|
+
index: end.content.length
|
|
1916
|
+
});
|
|
1917
|
+
if (fold) ctx.editor.insertNodes({
|
|
1918
|
+
parentId: paragraph.id,
|
|
1919
|
+
collection: "content",
|
|
1920
|
+
index: paragraph.content.length
|
|
1921
|
+
}, copied[0].content);
|
|
1922
|
+
ctx.editor.normalizeText(paragraph.id);
|
|
1923
|
+
ctx.editor.normalizeText(end.id);
|
|
1924
|
+
if (!fold && !paragraph.content.length) {
|
|
1925
|
+
ctx.editor.removeNodes({
|
|
1926
|
+
parentId: flow.parentId,
|
|
1927
|
+
collection: "blocks",
|
|
1928
|
+
index: flow.index,
|
|
1929
|
+
count: 1
|
|
1930
|
+
});
|
|
1931
|
+
roots.shift();
|
|
1932
|
+
}
|
|
1933
|
+
const point = this.pointAt(end, endUnits, true);
|
|
1934
|
+
return {
|
|
1935
|
+
point,
|
|
1936
|
+
appearance: this.appearanceBefore(this.locatePoint(point)),
|
|
1937
|
+
rootIds: Object.freeze(roots),
|
|
1938
|
+
idMap: this.resolvedMap(cloned.idMap)
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
/** 粘贴末端沿用左侧实际插入内容;空末段使用其段落文字声明,避免吸收未选右尾格式。 */
|
|
1942
|
+
appearanceBefore(point) {
|
|
1943
|
+
const node = point.paragraph.content[point.index - (point.offset ? 0 : 1)];
|
|
1944
|
+
return this.textAppearance(node && (node.kind === "text" || node.kind === "field" || node.kind === "pageWidget") ? node : point.paragraph);
|
|
1945
|
+
}
|
|
1946
|
+
/** 将归一化后合并掉的文字身份指向真实幸存节点,精确偏移仍由 ChangeSet.positionMaps 表达。 */
|
|
1947
|
+
resolvedMap(ids) {
|
|
1948
|
+
const ctx = this.requireContext(), result = new Map(ids);
|
|
1949
|
+
for (const [source, id] of result) {
|
|
1950
|
+
if (ctx.hasEntity(id)) continue;
|
|
1951
|
+
const mapped = ctx.mapPosition({
|
|
1952
|
+
nodeId: id,
|
|
1953
|
+
offset: 0,
|
|
1954
|
+
affinity: "after"
|
|
1955
|
+
});
|
|
1956
|
+
if (!mapped || !ctx.hasEntity(mapped.nodeId)) throw new ModelEditError("copy_mapping", "Copied identity has no surviving target");
|
|
1957
|
+
result.set(source, mapped.nodeId);
|
|
1958
|
+
}
|
|
1959
|
+
return result;
|
|
1960
|
+
}
|
|
1961
|
+
/** 仅在文字内部插入结构时拆分一次,左右片段都实际进入文档;边界插入不制造临时段落。 */
|
|
1962
|
+
splitAt(point) {
|
|
1963
|
+
if (!point.offset) return point.index;
|
|
1964
|
+
const node = point.paragraph.content[point.index];
|
|
1965
|
+
this.requireContext().editor.splitText(node.id, point.offset);
|
|
1966
|
+
return point.index + 1;
|
|
1967
|
+
}
|
|
1968
|
+
/** 收集被选中的文字/字段/页面组件,整块表格递归访问格内段落,不越入字段的附属内容流。 */
|
|
1969
|
+
formatTargets(selected) {
|
|
1970
|
+
if (selected.collapsed) return [];
|
|
1971
|
+
const result = [];
|
|
1972
|
+
for (const paragraph of selected.paragraphs) {
|
|
1973
|
+
const from = paragraph.id === selected.from.paragraph.id ? selected.from : void 0;
|
|
1974
|
+
const to = paragraph.id === selected.to.paragraph.id ? selected.to : void 0;
|
|
1975
|
+
for (let i = from?.index ?? 0; i < paragraph.content.length; i++) {
|
|
1976
|
+
if (to && (i > to.index || i === to.index && to.offset === 0)) break;
|
|
1977
|
+
const node = paragraph.content[i];
|
|
1978
|
+
if (node.kind !== "text" && node.kind !== "field" && node.kind !== "pageWidget") continue;
|
|
1979
|
+
const start = i === from?.index ? from.offset : 0;
|
|
1980
|
+
const end = node.kind === "text" ? i === to?.index ? to.offset : node.text.length : 0;
|
|
1981
|
+
if (node.kind === "text" && start === end) continue;
|
|
1982
|
+
result.push({
|
|
1983
|
+
node,
|
|
1984
|
+
paragraphId: paragraph.id,
|
|
1985
|
+
from: start,
|
|
1986
|
+
to: end
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
return result;
|
|
1991
|
+
}
|
|
1992
|
+
/** 段落格式覆盖整段;末端恰在下一段开头时只表示选择前一段的段落分隔。 */
|
|
1993
|
+
selectedParagraphs(selected) {
|
|
1994
|
+
const result = [];
|
|
1995
|
+
/** 整表被范围覆盖时遍历其物理内容,保留从格的独立样式。 */
|
|
1996
|
+
const visit = (block) => {
|
|
1997
|
+
if (block.kind === "paragraph") result.push(block);
|
|
1998
|
+
else for (const row of block.rows) for (const cell of row.cells) cell.blocks.forEach(visit);
|
|
1999
|
+
};
|
|
2000
|
+
for (let i = selected.fromBlock; i <= selected.toBlock; i++) {
|
|
2001
|
+
if (i === selected.toBlock && i !== selected.fromBlock && selected.to.index === 0 && selected.to.offset === 0) continue;
|
|
2002
|
+
visit(selected.blocks[i]);
|
|
2003
|
+
}
|
|
2004
|
+
return result;
|
|
2005
|
+
}
|
|
2006
|
+
/** 格式命令沿拥有树读取同编辑根段落,保留同 blocks 快速路径并拒绝跨附属根。 */
|
|
2007
|
+
locateFormatting(range) {
|
|
2008
|
+
const value = readFactoryOptions(range, ["from", "to"]), first = this.locatePoint(value.from), last = this.locatePoint(value.to);
|
|
2009
|
+
if (this.flow(first.paragraph.id).parentId === this.flow(last.paragraph.id).parentId) {
|
|
2010
|
+
const selected = this.locate(range);
|
|
2011
|
+
return {
|
|
2012
|
+
...selected,
|
|
2013
|
+
paragraphs: this.selectedParagraphs(selected)
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
const ctx = this.requireContext(), root = contentRoot(first.paragraph.id, ctx.entry);
|
|
2017
|
+
if (root.id !== contentRoot(last.paragraph.id, ctx.entry).id) throw new ModelEditError("content_flow", "Range endpoints must share the same editing root");
|
|
2018
|
+
const paragraphs = [];
|
|
2019
|
+
let from, to;
|
|
2020
|
+
for (const paragraph of contentParagraphs(root)) {
|
|
2021
|
+
if (paragraph.id === first.paragraph.id || paragraph.id === last.paragraph.id) {
|
|
2022
|
+
const at = paragraph.id === first.paragraph.id ? first : last;
|
|
2023
|
+
if (!from) from = at;
|
|
2024
|
+
else to = at;
|
|
2025
|
+
}
|
|
2026
|
+
if (from && (!to || to.index !== 0 || to.offset !== 0)) paragraphs.push(paragraph);
|
|
2027
|
+
if (to) break;
|
|
2028
|
+
}
|
|
2029
|
+
if (!from || !to) throw new ModelEditError("content_flow", "Range is outside the content tree");
|
|
2030
|
+
return {
|
|
2031
|
+
from,
|
|
2032
|
+
to,
|
|
2033
|
+
collapsed: false,
|
|
2034
|
+
paragraphs
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
/** 浅层合并直接声明,unset 必须是实际可选样式键,同键 set/unset 拒绝。 */
|
|
2038
|
+
patchedStyle(current, set, unset) {
|
|
2039
|
+
const next = {
|
|
2040
|
+
...current,
|
|
2041
|
+
...set
|
|
2042
|
+
};
|
|
2043
|
+
for (const key of unset ?? []) {
|
|
2044
|
+
if (set && Object.hasOwn(set, key)) throw new ModelEditError("style_patch", `Cannot set and unset ${String(key)}`);
|
|
2045
|
+
delete next[key];
|
|
2046
|
+
}
|
|
2047
|
+
return !isEmptyObject(next) ? next : void 0;
|
|
2048
|
+
}
|
|
2049
|
+
/** 将有方向的端点归一,并拒绝跨页部件、单元格或附属内容流的含糊范围。 */
|
|
2050
|
+
locate(range) {
|
|
2051
|
+
const value = readFactoryOptions(range, ["from", "to"]);
|
|
2052
|
+
let from = this.locatePoint(value.from), to = this.locatePoint(value.to);
|
|
2053
|
+
let a = this.flow(from.paragraph.id), b = this.flow(to.paragraph.id);
|
|
2054
|
+
if (a.parentId !== b.parentId) throw new ModelEditError("content_flow", "Range endpoints must share the same blocks owner");
|
|
2055
|
+
if (a.index > b.index || a.index === b.index && (from.index > to.index || from.index === to.index && from.offset > to.offset)) {
|
|
2056
|
+
[from, to] = [to, from];
|
|
2057
|
+
[a, b] = [b, a];
|
|
2058
|
+
}
|
|
2059
|
+
return {
|
|
2060
|
+
from,
|
|
2061
|
+
to,
|
|
2062
|
+
parentId: a.parentId,
|
|
2063
|
+
blocks: a.blocks,
|
|
2064
|
+
fromBlock: a.index,
|
|
2065
|
+
toBlock: b.index,
|
|
2066
|
+
collapsed: a.index === b.index && from.index === to.index && from.offset === to.offset
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
/** 验证行内下标和完整字素位置,offset 只适用于真实文字节点。 */
|
|
2070
|
+
locatePoint(point) {
|
|
2071
|
+
const value = readFactoryOptions(point, [
|
|
2072
|
+
"paragraphId",
|
|
2073
|
+
"index",
|
|
2074
|
+
"offset"
|
|
2075
|
+
]), paragraph = this.paragraph(value.paragraphId);
|
|
2076
|
+
let index = value.index, offset = value.offset ?? 0;
|
|
2077
|
+
if (!isInteger(index) || index < 0 || index > paragraph.content.length) throw new ModelEditError("range", "Invalid inline index");
|
|
2078
|
+
if (!isUndefined(value.offset)) {
|
|
2079
|
+
const node = paragraph.content[index];
|
|
2080
|
+
if (!node || node.kind !== "text") throw new ModelEditError("node_type", "Offset requires a text node");
|
|
2081
|
+
this.requireContext().assertBoundary(node.text, offset);
|
|
2082
|
+
if (offset > 0 && offset === node.text.length) {
|
|
2083
|
+
index++;
|
|
2084
|
+
offset = 0;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
return {
|
|
2088
|
+
paragraph,
|
|
2089
|
+
index,
|
|
2090
|
+
offset
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
/** 按当前拥有数组定位段落,不使用分页行或已经失效的旧下标。 */
|
|
2094
|
+
flow(paragraphId) {
|
|
2095
|
+
const ctx = this.requireContext(), entry = ctx.entry(paragraphId);
|
|
2096
|
+
if (entry.role !== "paragraph" || entry.collection !== "blocks" || !entry.parentId) throw new ModelEditError("content_flow", "Expected paragraph in a blocks collection");
|
|
2097
|
+
const blocks = ctx.entry(entry.parentId).node.blocks;
|
|
2098
|
+
return {
|
|
2099
|
+
parentId: entry.parentId,
|
|
2100
|
+
blocks,
|
|
2101
|
+
index: blocks.findIndex((block) => block.id === paragraphId)
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
/** 对范围位置计算段内逻辑长度,普通文字用 UTF-16,字段/图片/显式换行各占一个原子单位。 */
|
|
2105
|
+
logicalOffset(point) {
|
|
2106
|
+
return this.inlineUnits(point.paragraph.content.slice(0, point.index)) + point.offset;
|
|
2107
|
+
}
|
|
2108
|
+
/** 字段展示文字不当作可编辑字符,不读取当前填报值。 */
|
|
2109
|
+
inlineUnits(nodes) {
|
|
2110
|
+
return sumBy(nodes, (node) => node.kind === "text" ? node.text.length : 1);
|
|
2111
|
+
}
|
|
2112
|
+
/** 编辑完成后按当前片段重新定位,必要时吸附到新形成字素的末尾。 */
|
|
2113
|
+
pointAt(paragraph, units, snap) {
|
|
2114
|
+
for (let i = 0; i < paragraph.content.length; i++) {
|
|
2115
|
+
const node = paragraph.content[i];
|
|
2116
|
+
if (units === 0) return {
|
|
2117
|
+
paragraphId: paragraph.id,
|
|
2118
|
+
index: i
|
|
2119
|
+
};
|
|
2120
|
+
const length = node.kind === "text" ? node.text.length : 1;
|
|
2121
|
+
if (node.kind === "text" && units < length) {
|
|
2122
|
+
const offset = snap ? this.requireContext().snapBoundary(node.text, units, "after") : units;
|
|
2123
|
+
return offset === length ? {
|
|
2124
|
+
paragraphId: paragraph.id,
|
|
2125
|
+
index: i + 1
|
|
2126
|
+
} : {
|
|
2127
|
+
paragraphId: paragraph.id,
|
|
2128
|
+
index: i,
|
|
2129
|
+
offset
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
units -= length;
|
|
2133
|
+
}
|
|
2134
|
+
if (units !== 0) throw new ModelEditError("range", "Logical offset exceeds paragraph content");
|
|
2135
|
+
return {
|
|
2136
|
+
paragraphId: paragraph.id,
|
|
2137
|
+
index: paragraph.content.length
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2140
|
+
/** 替换文字优先使用端点文字的明确格式,字段边界不借用字段配置或计算样式。 */
|
|
2141
|
+
appearanceAt(point) {
|
|
2142
|
+
const node = point.paragraph.content[point.index], previous = point.paragraph.content[point.index - 1];
|
|
2143
|
+
return this.textAppearance(node?.kind === "text" ? node : previous?.kind === "text" ? previous : {});
|
|
2144
|
+
}
|
|
2145
|
+
/** 只提取文字样式引用与直接覆盖,用于比较和创建,缺省保持缺省。 */
|
|
2146
|
+
textAppearance(node) {
|
|
2147
|
+
return copyData({
|
|
2148
|
+
...isUndefined(node.textStyleId) ? {} : { textStyleId: node.textStyleId },
|
|
2149
|
+
...isUndefined(node.textStyle) ? {} : { textStyle: node.textStyle }
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
/** 按类型取得真实段落,不返回空占位对象。 */
|
|
2153
|
+
paragraph(id) {
|
|
2154
|
+
const entry = this.requireContext().entry(id);
|
|
2155
|
+
if (entry.role !== "paragraph") throw new ModelEditError("node_type", "Expected paragraph");
|
|
2156
|
+
return entry.node;
|
|
2157
|
+
}
|
|
2158
|
+
/** 所有入口验证会话可用,销毁后释放对编辑器和注册表的引用。 */
|
|
2159
|
+
requireContext() {
|
|
2160
|
+
if (!this.context) throw new ModelEditError("disposed", "RangeEditor is disposed");
|
|
2161
|
+
this.context.editor.revision;
|
|
2162
|
+
return this.context;
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
// src/model/editor/cell-paste.ts
|
|
2166
|
+
/** @file 原生单元格内容替换,身份重建和跨格引用重写复用唯一 ModelEditor。 */
|
|
2167
|
+
/** 完整目标矩形按源尺寸平铺,单值填充保留现有合并;不复制表级业务区域或几何。 */
|
|
2168
|
+
function replaceTableCellContents(ctx, tableId, range, value, options) {
|
|
2169
|
+
const settings = readFactoryOptions(options, ["preserveDestinationFormatting"]);
|
|
2170
|
+
if (settings.preserveDestinationFormatting !== void 0 && typeof settings.preserveDestinationFormatting !== "boolean") throw new ModelEditError("paste_options", "Expected formatting boolean");
|
|
2171
|
+
const targetEntry = ctx.entry(tableId);
|
|
2172
|
+
if (targetEntry.role !== "table") throw new ModelEditError("node_type", "Expected table");
|
|
2173
|
+
const table = targetEntry.node, fragment = readFragment(value, ctx.validation), source = fragment.blocks[0];
|
|
2174
|
+
if (fragment.blocks.length !== 1 || source?.kind !== "table") throw new ModelEditError("fragment_table", "Expected one table fragment");
|
|
2175
|
+
const positions = indexTablePositions(table), rect = rectangleFromPositions(positions, range), rows = rect.bottom - rect.top + 1, columns = rect.right - rect.left + 1;
|
|
2176
|
+
if (rows % source.rows.length || columns % source.columns.length) throw new ModelEditError("paste_shape", "Selected rectangle must contain complete source tiles");
|
|
2177
|
+
const sourcePositions = indexTablePositions(source);
|
|
2178
|
+
for (let top = rect.top; top <= rect.bottom; top += source.rows.length) for (let left = rect.left; left <= rect.right; left += source.columns.length) for (const merge of source.merges) {
|
|
2179
|
+
const original = rectangleFromPositions(sourcePositions, merge.range), area = {
|
|
2180
|
+
top: top + original.top,
|
|
2181
|
+
bottom: top + original.bottom,
|
|
2182
|
+
left: left + original.left,
|
|
2183
|
+
right: left + original.right
|
|
2184
|
+
};
|
|
2185
|
+
for (const region of table.regions) {
|
|
2186
|
+
const boundary = rectangleFromPositions(positions, region.range);
|
|
2187
|
+
if (intersectsRectangle(boundary, area) && !containsRectangle(boundary, area)) throw new ModelEditError("paste_region_merge", "Pasted merge crosses a region boundary");
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
const fill = source.rows.length === 1 && source.columns.length === 1 && !source.merges.length, covered = /* @__PURE__ */ new Set();
|
|
2191
|
+
for (const merge of table.merges) {
|
|
2192
|
+
const area = rectangleFromPositions(positions, merge.range);
|
|
2193
|
+
if (!intersectsRectangle(rect, area)) continue;
|
|
2194
|
+
if (!containsRectangle(rect, area)) throw new ModelEditError("paste_merge", "Paste cannot cut through an existing merge");
|
|
2195
|
+
if (fill) {
|
|
2196
|
+
for (let r = area.top; r <= area.bottom; r++) for (let c = area.left; c <= area.right; c++) if (r !== area.top || c !== area.left) covered.add(table.rows[r].cells[c].id);
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
const roots = [];
|
|
2200
|
+
for (let r = rect.top; r <= rect.bottom; r++) for (let c = rect.left; c <= rect.right; c++) {
|
|
2201
|
+
const cell = table.rows[r].cells[c];
|
|
2202
|
+
if (!covered.has(cell.id)) roots.push(...cell.blocks.map((block) => block.id));
|
|
2203
|
+
}
|
|
2204
|
+
const definitions = ctx.collectDefinitions(roots);
|
|
2205
|
+
delete source.tableStyleId;
|
|
2206
|
+
delete source.style;
|
|
2207
|
+
source.regions = [];
|
|
2208
|
+
importFragmentDefinitions(ctx, fragment);
|
|
2209
|
+
if (!fill) ctx.editor.tables.unmergeCells(tableId, range);
|
|
2210
|
+
for (let top = rect.top; top <= rect.bottom; top += source.rows.length) for (let left = rect.left; left <= rect.right; left += source.columns.length) {
|
|
2211
|
+
if (fill && covered.has(table.rows[top].cells[left].id)) continue;
|
|
2212
|
+
const aliases = /* @__PURE__ */ new Map([[source.id, table.id]]);
|
|
2213
|
+
source.columns.forEach((column, c) => aliases.set(column.id, table.columns[left + c].id));
|
|
2214
|
+
source.rows.forEach((row, r) => {
|
|
2215
|
+
aliases.set(row.id, table.rows[top + r].id);
|
|
2216
|
+
row.cells.forEach((cell, c) => aliases.set(cell.id, table.rows[top + r].cells[left + c].id));
|
|
2217
|
+
});
|
|
2218
|
+
const cloned = ctx.cloneOwned({
|
|
2219
|
+
parentId: table.id,
|
|
2220
|
+
collection: "rows",
|
|
2221
|
+
index: top
|
|
2222
|
+
}, source.rows, aliases).nodes;
|
|
2223
|
+
for (let r = 0; r < source.rows.length; r++) for (let c = 0; c < source.columns.length; c++) {
|
|
2224
|
+
const destination = table.rows[top + r].cells[left + c];
|
|
2225
|
+
if (covered.has(destination.id)) continue;
|
|
2226
|
+
const cell = cloned[r].cells[c];
|
|
2227
|
+
if (settings.preserveDestinationFormatting) {
|
|
2228
|
+
const first = destination.blocks[0], base = first?.kind === "paragraph" ? first : void 0, inline = base?.content.find((node) => node.kind === "text" || node.kind === "field" || node.kind === "pageWidget");
|
|
2229
|
+
for (const block of cell.blocks) if (block.kind === "paragraph") {
|
|
2230
|
+
for (const key of [
|
|
2231
|
+
"textStyle",
|
|
2232
|
+
"textStyleId",
|
|
2233
|
+
"paragraphStyle",
|
|
2234
|
+
"paragraphStyleId"
|
|
2235
|
+
]) {
|
|
2236
|
+
delete block[key];
|
|
2237
|
+
if (base?.[key] !== void 0) Object.assign(block, { [key]: copyData(base[key]) });
|
|
2238
|
+
}
|
|
2239
|
+
for (const node of block.content) if (node.kind === "text" || node.kind === "field" || node.kind === "pageWidget") {
|
|
2240
|
+
delete node.textStyle;
|
|
2241
|
+
delete node.textStyleId;
|
|
2242
|
+
if (inline && "textStyle" in inline && inline.textStyle) node.textStyle = copyData(inline.textStyle);
|
|
2243
|
+
if (inline && "textStyleId" in inline && inline.textStyleId) node.textStyleId = inline.textStyleId;
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
ctx.editor.removeNodes({
|
|
2248
|
+
parentId: destination.id,
|
|
2249
|
+
collection: "blocks",
|
|
2250
|
+
index: 0,
|
|
2251
|
+
count: destination.blocks.length
|
|
2252
|
+
});
|
|
2253
|
+
if (cell.blocks.length) ctx.editor.insertNodes({
|
|
2254
|
+
parentId: destination.id,
|
|
2255
|
+
collection: "blocks",
|
|
2256
|
+
index: 0
|
|
2257
|
+
}, cell.blocks);
|
|
2258
|
+
if (!settings.preserveDestinationFormatting) {
|
|
2259
|
+
if (cell.style) ctx.editor.tables.setCellStyle(destination.id, cell.style);
|
|
2260
|
+
else ctx.editor.unsetProperty(destination.id, "style");
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
if (!fill) for (const merge of source.merges) {
|
|
2264
|
+
const area = rectangleFromPositions(sourcePositions, merge.range);
|
|
2265
|
+
ctx.editor.tables.mergeCells(table.id, {
|
|
2266
|
+
fromCellId: table.rows[top + area.top].cells[left + area.left].id,
|
|
2267
|
+
toCellId: table.rows[top + area.bottom].cells[left + area.right].id
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
ctx.cleanupDefinitions(definitions);
|
|
2272
|
+
}
|
|
2273
|
+
// src/model/editor/TableEditor.ts
|
|
2274
|
+
/**
|
|
2275
|
+
* @file 表格编辑:增删行列、合并拆分、修改尺寸样式与业务区域,并在同一事务维护关联范围。
|
|
2276
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
2277
|
+
*/
|
|
2278
|
+
/** 表格高层操作,所有网格、引用和内容维护共用编辑器的原子事务。 */
|
|
2279
|
+
var TableEditor = class {
|
|
2280
|
+
/** 唯一会话能力,关闭时释放,不持有表格副本。 */
|
|
2281
|
+
context;
|
|
2282
|
+
/** 一次粘贴完整物理矩形,原生字段/图片和内部引用重新分配身份,绑定按值复用。 */
|
|
2283
|
+
replaceCells(tableId, range, fragment, options = {}) {
|
|
2284
|
+
const ctx = this.requireContext();
|
|
2285
|
+
return ctx.editor.transaction("table:replaceCells", () => {
|
|
2286
|
+
replaceTableCellContents(ctx, tableId, range, fragment, options);
|
|
2287
|
+
});
|
|
2288
|
+
}
|
|
2289
|
+
/** 由 ModelEditor.tables 注入现有能力,不建立另一套索引或历史。 @internal */
|
|
2290
|
+
constructor(context) {
|
|
2291
|
+
this.context = context;
|
|
2292
|
+
}
|
|
2293
|
+
/** 插入空物理行;内部插入自然扩展 CellId 端点内的合并/区域,边界外插入不猜测业务归属。 */
|
|
2294
|
+
insertRows(tableId, index, count = 1, options = {}) {
|
|
2295
|
+
const ctx = this.requireContext(), entityIds = [];
|
|
2296
|
+
const change = ctx.editor.transaction("table:insertRows", () => {
|
|
2297
|
+
const table = this.table(tableId), settings = readFactoryOptions(options, [
|
|
2298
|
+
"height",
|
|
2299
|
+
"cellStyle",
|
|
2300
|
+
"inheritNeighborBorders"
|
|
2301
|
+
]);
|
|
2302
|
+
checkFactoryValue(settings, object({
|
|
2303
|
+
height: optional(rowHeightRule),
|
|
2304
|
+
cellStyle: optional(cellStyleRule),
|
|
2305
|
+
inheritNeighborBorders: optional(boolean)
|
|
2306
|
+
}));
|
|
2307
|
+
this.checkSlice(index, 0, table.rows.length);
|
|
2308
|
+
this.checkCount(count);
|
|
2309
|
+
const neighbor = table.rows[index - 1] ?? table.rows[index];
|
|
2310
|
+
const rows = ctx.withFactory((factory) => Array.from({ length: count }, () => {
|
|
2311
|
+
const row = factory.createRow({
|
|
2312
|
+
columnCount: table.columns.length,
|
|
2313
|
+
height: settings.height,
|
|
2314
|
+
cellStyle: settings.cellStyle
|
|
2315
|
+
});
|
|
2316
|
+
if (settings.inheritNeighborBorders && settings.cellStyle?.borders === void 0) for (const [column, cell] of row.cells.entries()) {
|
|
2317
|
+
const borders = neighbor?.cells[column]?.style?.borders;
|
|
2318
|
+
if (borders) cell.style = {
|
|
2319
|
+
...cell.style,
|
|
2320
|
+
borders: copyData(borders)
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
return row;
|
|
2324
|
+
}));
|
|
2325
|
+
entityIds.push(...rows.map((row) => row.id));
|
|
2326
|
+
ctx.editor.insertNodes({
|
|
2327
|
+
parentId: tableId,
|
|
2328
|
+
collection: "rows",
|
|
2329
|
+
index
|
|
2330
|
+
}, rows);
|
|
2331
|
+
});
|
|
2332
|
+
return {
|
|
2333
|
+
entityIds: Object.freeze(entityIds),
|
|
2334
|
+
change
|
|
2335
|
+
};
|
|
2336
|
+
}
|
|
2337
|
+
/** 插入唯一列声明和各行的新空格,全部写入一次提交。 */
|
|
2338
|
+
insertColumns(tableId, index, count = 1, options = {}) {
|
|
2339
|
+
const ctx = this.requireContext(), entityIds = [];
|
|
2340
|
+
const change = ctx.editor.transaction("table:insertColumns", () => {
|
|
2341
|
+
const table = this.table(tableId), settings = readFactoryOptions(options, [
|
|
2342
|
+
"widthPx",
|
|
2343
|
+
"cellStyle",
|
|
2344
|
+
"inheritNeighborBorders"
|
|
2345
|
+
]);
|
|
2346
|
+
checkFactoryValue(settings, object({
|
|
2347
|
+
widthPx: optional(positive),
|
|
2348
|
+
cellStyle: optional(cellStyleRule),
|
|
2349
|
+
inheritNeighborBorders: optional(boolean)
|
|
2350
|
+
}));
|
|
2351
|
+
this.checkSlice(index, 0, table.columns.length);
|
|
2352
|
+
this.checkCount(count);
|
|
2353
|
+
ctx.withFactory((factory) => {
|
|
2354
|
+
const columns = Array.from({ length: count }, () => factory.createColumn(isUndefined(settings.widthPx) ? {} : { widthPx: settings.widthPx }));
|
|
2355
|
+
entityIds.push(...columns.map((column) => column.id));
|
|
2356
|
+
ctx.editor.insertNodes({
|
|
2357
|
+
parentId: tableId,
|
|
2358
|
+
collection: "columns",
|
|
2359
|
+
index
|
|
2360
|
+
}, columns);
|
|
2361
|
+
for (const row of table.rows) {
|
|
2362
|
+
const neighbor = row.cells[index - 1] ?? row.cells[index];
|
|
2363
|
+
const borders = settings.inheritNeighborBorders ? neighbor?.style?.borders : void 0;
|
|
2364
|
+
const style = borders && settings.cellStyle?.borders === void 0 ? {
|
|
2365
|
+
...settings.cellStyle,
|
|
2366
|
+
borders
|
|
2367
|
+
} : settings.cellStyle;
|
|
2368
|
+
const cells = Array.from({ length: count }, () => factory.createCell({ style }));
|
|
2369
|
+
ctx.editor.insertNodes({
|
|
2370
|
+
parentId: row.id,
|
|
2371
|
+
collection: "cells",
|
|
2372
|
+
index
|
|
2373
|
+
}, cells);
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2376
|
+
});
|
|
2377
|
+
return {
|
|
2378
|
+
entityIds: Object.freeze(entityIds),
|
|
2379
|
+
change
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
/** 删除连续行并收缩合并/区域;默认保留幸存合并的主格内容,禁止删除最后一行。 */
|
|
2383
|
+
removeRows(tableId, index, count = 1, options = {}) {
|
|
2384
|
+
return this.removeAxis(tableId, "row", index, count, options);
|
|
2385
|
+
}
|
|
2386
|
+
/** 删除连续列及所有行中对应的物理格,范围与绑定和网格共用一笔历史。 */
|
|
2387
|
+
removeColumns(tableId, index, count = 1, options = {}) {
|
|
2388
|
+
return this.removeAxis(tableId, "column", index, count, options);
|
|
2389
|
+
}
|
|
2390
|
+
/** 合并完整矩形;已有合并必须被完整包含,所有物理格内容保留,原样再次合并为空操作。 */
|
|
2391
|
+
mergeCells(tableId, range) {
|
|
2392
|
+
const ctx = this.requireContext();
|
|
2393
|
+
let nodeId = "";
|
|
2394
|
+
const change = ctx.editor.transaction("table:mergeCells", () => {
|
|
2395
|
+
const table = this.table(tableId), positions = indexTablePositions(table);
|
|
2396
|
+
const target = rectangleFromPositions(positions, this.readRange(range));
|
|
2397
|
+
if (target.top === target.bottom && target.left === target.right) throw new ModelEditError("table_merge", "Merge must contain more than one cell");
|
|
2398
|
+
const contained = /* @__PURE__ */ new Set();
|
|
2399
|
+
for (const merge of table.merges) {
|
|
2400
|
+
const rect = rectangleFromPositions(positions, merge.range);
|
|
2401
|
+
if (!intersectsRectangle(target, rect)) continue;
|
|
2402
|
+
if (!containsRectangle(target, rect)) throw new ModelEditError("table_merge", "Selection cuts through a merge");
|
|
2403
|
+
if (containsRectangle(rect, target)) {
|
|
2404
|
+
nodeId = merge.id;
|
|
2405
|
+
return;
|
|
2406
|
+
}
|
|
2407
|
+
contained.add(merge.id);
|
|
2408
|
+
}
|
|
2409
|
+
const node = ctx.withFactory((factory) => factory.createMerge(range));
|
|
2410
|
+
nodeId = node.id;
|
|
2411
|
+
this.removeDeclarations(table, "merges", contained);
|
|
2412
|
+
ctx.editor.insertNodes({
|
|
2413
|
+
parentId: tableId,
|
|
2414
|
+
collection: "merges",
|
|
2415
|
+
index: table.merges.length
|
|
2416
|
+
}, [node]);
|
|
2417
|
+
});
|
|
2418
|
+
return {
|
|
2419
|
+
nodeId,
|
|
2420
|
+
change
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
/** 拆开选区内完整合并,只删声明,不移动或删除格内内容;部分切入合并时拒绝。 */
|
|
2424
|
+
unmergeCells(tableId, range) {
|
|
2425
|
+
return this.requireContext().editor.transaction("table:unmergeCells", () => {
|
|
2426
|
+
const table = this.table(tableId), positions = indexTablePositions(table);
|
|
2427
|
+
const target = rectangleFromPositions(positions, this.readRange(range)), removed = /* @__PURE__ */ new Set();
|
|
2428
|
+
for (const merge of table.merges) {
|
|
2429
|
+
const rect = rectangleFromPositions(positions, merge.range);
|
|
2430
|
+
if (!intersectsRectangle(target, rect)) continue;
|
|
2431
|
+
if (!containsRectangle(target, rect)) throw new ModelEditError("table_merge", "Selection cuts through a merge");
|
|
2432
|
+
removed.add(merge.id);
|
|
2433
|
+
}
|
|
2434
|
+
this.removeDeclarations(table, "merges", removed);
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
/** 根据任意主格或从格拆开所属合并,普通格为空操作。 */
|
|
2438
|
+
unmergeCell(cellId) {
|
|
2439
|
+
const ctx = this.requireContext();
|
|
2440
|
+
return ctx.editor.transaction("table:unmergeCell", () => {
|
|
2441
|
+
const cell = this.entity(cellId, "cell");
|
|
2442
|
+
const row = ctx.entry(ctx.entry(cell.id).parentId).node;
|
|
2443
|
+
const table = this.table(ctx.entry(row.id).parentId), positions = indexTablePositions(table);
|
|
2444
|
+
const point = rectangleFromPositions(positions, {
|
|
2445
|
+
fromCellId: cellId,
|
|
2446
|
+
toCellId: cellId
|
|
2447
|
+
});
|
|
2448
|
+
const merge = table.merges.find((item) => containsRectangle(rectangleFromPositions(positions, item.range), point));
|
|
2449
|
+
if (merge) this.removeDeclarations(table, "merges", /* @__PURE__ */ new Set([merge.id]));
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
/** 修改唯一列宽;null 删除覆盖恢复缺省,零宽或非法数值由协议校验拒绝。 */
|
|
2453
|
+
setColumnWidth(columnId, widthPx) {
|
|
2454
|
+
return this.setOptional(columnId, "column", "widthPx", widthPx);
|
|
2455
|
+
}
|
|
2456
|
+
/** 修改物理行高度;auto 是明确模式,null 表示移除声明。 */
|
|
2457
|
+
setRowHeight(rowId, height) {
|
|
2458
|
+
return this.setOptional(rowId, "row", "height", height);
|
|
2459
|
+
}
|
|
2460
|
+
/** 完整替换表格直接样式,null 恢复共享样式继承,不把有效样式展开回节点。 */
|
|
2461
|
+
setTableStyle(tableId, style) {
|
|
2462
|
+
return this.setOptional(tableId, "table", "style", style);
|
|
2463
|
+
}
|
|
2464
|
+
/** 完整替换单格直接样式,null 移除覆盖,保留显式零边框与透明颜色。 */
|
|
2465
|
+
setCellStyle(cellId, style) {
|
|
2466
|
+
return this.setOptional(cellId, "cell", "style", style);
|
|
2467
|
+
}
|
|
2468
|
+
/** 批量设置物理范围的直接格样式,包含从格;每格载荷独立,整次修改可一次撤销。 */
|
|
2469
|
+
setCellStyles(tableId, range, style) {
|
|
2470
|
+
return this.requireContext().editor.transaction("table:setCellStyles", () => {
|
|
2471
|
+
const table = this.table(tableId), rect = rectangleFromPositions(indexTablePositions(table), this.readRange(range));
|
|
2472
|
+
for (let r = rect.top; r <= rect.bottom; r++) for (let c = rect.left; c <= rect.right; c++) this.setCellStyle(table.rows[r].cells[c].id, style);
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
/** 新建业务区域并登记稳定身份,范围/父子/表头及变体由同一提交统一核对。 */
|
|
2476
|
+
addRegion(tableId, options, index) {
|
|
2477
|
+
const ctx = this.requireContext();
|
|
2478
|
+
let nodeId = "";
|
|
2479
|
+
const change = ctx.editor.transaction("table:addRegion", () => {
|
|
2480
|
+
const table = this.table(tableId), at = isUndefined(index) ? table.regions.length : index;
|
|
2481
|
+
this.checkSlice(at, 0, table.regions.length);
|
|
2482
|
+
const node = ctx.withFactory((factory) => factory.createRegion(options));
|
|
2483
|
+
nodeId = node.id;
|
|
2484
|
+
ctx.editor.insertNodes({
|
|
2485
|
+
parentId: tableId,
|
|
2486
|
+
collection: "regions",
|
|
2487
|
+
index: at
|
|
2488
|
+
}, [node]);
|
|
2489
|
+
});
|
|
2490
|
+
return {
|
|
2491
|
+
nodeId,
|
|
2492
|
+
change
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
/** 写入物耗表的类型化业务配置,仍由统一事务校验、隔离输入并记录完整历史。 */
|
|
2496
|
+
setMaterialConfig(regionId, config) {
|
|
2497
|
+
if (this.entity(regionId, "region").type !== "material-consume-table") throw new ModelEditError("material_region", "Expected material consume region");
|
|
2498
|
+
return this.updateRegion(regionId, { set: { variant: {
|
|
2499
|
+
name: "edhr:material-consume",
|
|
2500
|
+
version: 1,
|
|
2501
|
+
config
|
|
2502
|
+
} } });
|
|
2503
|
+
}
|
|
2504
|
+
/** 浅层更新区域声明,不猜测业务配置内部字符串;非法关系使整笔事务回滚。 */
|
|
2505
|
+
updateRegion(regionId, update) {
|
|
2506
|
+
const ctx = this.requireContext();
|
|
2507
|
+
return ctx.editor.transaction("table:updateRegion", () => {
|
|
2508
|
+
this.entity(regionId, "region");
|
|
2509
|
+
const patch = readFactoryOptions(update, ["set", "unset"]);
|
|
2510
|
+
const keys = [
|
|
2511
|
+
"type",
|
|
2512
|
+
"name",
|
|
2513
|
+
"range",
|
|
2514
|
+
"binding",
|
|
2515
|
+
"configVersion",
|
|
2516
|
+
"config",
|
|
2517
|
+
"variant",
|
|
2518
|
+
"parentRegionId",
|
|
2519
|
+
"targetRegionId"
|
|
2520
|
+
];
|
|
2521
|
+
const set = isUndefined(patch.set) ? {} : checkFactoryOptions(patch.set, keys);
|
|
2522
|
+
if (!isUndefined(patch.unset)) checkFactoryValue(patch.unset, array(oneOf(...keys.filter((key) => key !== "type" && key !== "range"))), "/unset");
|
|
2523
|
+
for (const key of patch.unset ?? []) {
|
|
2524
|
+
if (Object.hasOwn(set, key)) throw new ModelEditError("region_patch", `Cannot set and unset ${key}`);
|
|
2525
|
+
ctx.editor.unsetProperty(regionId, key);
|
|
2526
|
+
}
|
|
2527
|
+
for (const [key, value] of Object.entries(set)) ctx.editor.setProperty(regionId, key, value);
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
/** 删除区域声明;默认拒绝依赖,remove 明确级联移除其子项和子表头,格内容保持不变。 */
|
|
2531
|
+
removeRegion(regionId, options = {}) {
|
|
2532
|
+
const ctx = this.requireContext();
|
|
2533
|
+
return ctx.editor.transaction("table:removeRegion", () => {
|
|
2534
|
+
this.entity(regionId, "region");
|
|
2535
|
+
const settings = readFactoryOptions(options, [
|
|
2536
|
+
"dependents",
|
|
2537
|
+
"removeUnusedBindings",
|
|
2538
|
+
"removeUnusedAssets"
|
|
2539
|
+
]);
|
|
2540
|
+
checkFactoryValue(settings, object({
|
|
2541
|
+
dependents: optional(oneOf("reject", "remove")),
|
|
2542
|
+
removeUnusedBindings: optional(boolean),
|
|
2543
|
+
removeUnusedAssets: optional(boolean)
|
|
2544
|
+
}));
|
|
2545
|
+
const table = this.table(ctx.entry(regionId).parentId), removed = this.regionClosure(table, /* @__PURE__ */ new Set([regionId]));
|
|
2546
|
+
if (removed.size > 1 && settings.dependents !== "remove") throw new ModelEditError("region_dependents", "Region still has dependent declarations");
|
|
2547
|
+
const definitions = ctx.collectDefinitions([...removed]);
|
|
2548
|
+
this.removeDeclarations(table, "regions", removed);
|
|
2549
|
+
ctx.cleanupDefinitions(definitions, settings);
|
|
2550
|
+
});
|
|
2551
|
+
}
|
|
2552
|
+
/** 编辑器关闭时释放门面及回调,已有返回的身份/事件不受影响。 @internal */
|
|
2553
|
+
dispose() {
|
|
2554
|
+
this.context = void 0;
|
|
2555
|
+
}
|
|
2556
|
+
/** 删除行列的完整规划先完成,再维护主格内容、范围、网格及候选共享定义。 */
|
|
2557
|
+
removeAxis(tableId, axis, index, count, options) {
|
|
2558
|
+
const ctx = this.requireContext();
|
|
2559
|
+
return ctx.editor.transaction(`table:remove${axis === "row" ? "Rows" : "Columns"}`, () => {
|
|
2560
|
+
const table = this.table(tableId), settings = readFactoryOptions(options, [
|
|
2561
|
+
"regionPolicy",
|
|
2562
|
+
"mergedContent",
|
|
2563
|
+
"removeUnusedBindings",
|
|
2564
|
+
"removeUnusedAssets"
|
|
2565
|
+
]);
|
|
2566
|
+
checkFactoryValue(settings, object({
|
|
2567
|
+
regionPolicy: optional(oneOf("reject", "remove")),
|
|
2568
|
+
mergedContent: optional(oneOf("preserve", "delete")),
|
|
2569
|
+
removeUnusedBindings: optional(boolean),
|
|
2570
|
+
removeUnusedAssets: optional(boolean)
|
|
2571
|
+
}));
|
|
2572
|
+
const length = axis === "row" ? table.rows.length : table.columns.length;
|
|
2573
|
+
this.checkSlice(index, count, length);
|
|
2574
|
+
if (!count) return;
|
|
2575
|
+
if (count === length) throw new ModelEditError("table_size", "Cannot remove the last physical row/column");
|
|
2576
|
+
const positions = indexTablePositions(table);
|
|
2577
|
+
const merges = table.merges.map((item) => this.planRemoval(table, positions, item, axis, index, count));
|
|
2578
|
+
const regions = table.regions.map((item) => this.planRemoval(table, positions, item, axis, index, count));
|
|
2579
|
+
const removedRegions = this.regionClosure(table, new Set(regions.filter((plan) => isNull(plan.range)).map((plan) => plan.declaration.id)));
|
|
2580
|
+
if (removedRegions.size && settings.regionPolicy !== "remove") throw new ModelEditError("table_region", "Removing these cells removes a region; choose regionPolicy=remove");
|
|
2581
|
+
const roots = axis === "row" ? table.rows.slice(index, index + count).map((row) => row.id) : table.rows.flatMap((row) => row.cells.slice(index, index + count).map((cell) => cell.id));
|
|
2582
|
+
const definitions = ctx.collectDefinitions([...roots, ...removedRegions]);
|
|
2583
|
+
if (settings.mergedContent !== "delete") for (const plan of merges) {
|
|
2584
|
+
if (!plan.survivingMasterId) continue;
|
|
2585
|
+
const source = this.entity(plan.declaration.range.fromCellId, "cell");
|
|
2586
|
+
ctx.editor.moveNodes({
|
|
2587
|
+
parentId: source.id,
|
|
2588
|
+
collection: "blocks",
|
|
2589
|
+
index: 0,
|
|
2590
|
+
count: source.blocks.length
|
|
2591
|
+
}, {
|
|
2592
|
+
parentId: plan.survivingMasterId,
|
|
2593
|
+
collection: "blocks",
|
|
2594
|
+
index: 0
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
for (const plan of merges) if (!isNull(plan.range)) ctx.editor.setProperty(plan.declaration.id, "range", plan.range);
|
|
2598
|
+
for (const plan of regions) if (!isNull(plan.range) && !removedRegions.has(plan.declaration.id)) ctx.editor.setProperty(plan.declaration.id, "range", plan.range);
|
|
2599
|
+
this.removeDeclarations(table, "merges", new Set(merges.filter((plan) => isNull(plan.range)).map((plan) => plan.declaration.id)));
|
|
2600
|
+
this.removeDeclarations(table, "regions", removedRegions);
|
|
2601
|
+
if (axis === "row") ctx.editor.removeNodes({
|
|
2602
|
+
parentId: tableId,
|
|
2603
|
+
collection: "rows",
|
|
2604
|
+
index,
|
|
2605
|
+
count
|
|
2606
|
+
});
|
|
2607
|
+
else {
|
|
2608
|
+
ctx.editor.removeNodes({
|
|
2609
|
+
parentId: tableId,
|
|
2610
|
+
collection: "columns",
|
|
2611
|
+
index,
|
|
2612
|
+
count
|
|
2613
|
+
});
|
|
2614
|
+
for (const row of table.rows) ctx.editor.removeNodes({
|
|
2615
|
+
parentId: row.id,
|
|
2616
|
+
collection: "cells",
|
|
2617
|
+
index,
|
|
2618
|
+
count
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
ctx.cleanupDefinitions(definitions, settings);
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
/** 将原范围限制到幸存物理格,端点引用幸存身份,不重新生成合并/区域 ID。 */
|
|
2625
|
+
planRemoval(table, positions, declaration, axis, index, count) {
|
|
2626
|
+
const rect = rectangleFromPositions(positions, declaration.range);
|
|
2627
|
+
const rows = this.survivingIndexes(rect.top, rect.bottom, axis === "row" ? index : -1, axis === "row" ? count : 0);
|
|
2628
|
+
const columns = this.survivingIndexes(rect.left, rect.right, axis === "column" ? index : -1, axis === "column" ? count : 0);
|
|
2629
|
+
if (!rows.length || !columns.length) return {
|
|
2630
|
+
declaration,
|
|
2631
|
+
range: null
|
|
2632
|
+
};
|
|
2633
|
+
const fromCellId = table.rows[rows[0]].cells[columns[0]].id;
|
|
2634
|
+
const range = {
|
|
2635
|
+
fromCellId,
|
|
2636
|
+
toCellId: table.rows[rows.at(-1)].cells[columns.at(-1)].id
|
|
2637
|
+
};
|
|
2638
|
+
const isMerge = !("type" in declaration);
|
|
2639
|
+
return {
|
|
2640
|
+
declaration,
|
|
2641
|
+
range: isMerge && rows.length * columns.length === 1 ? null : range,
|
|
2642
|
+
...isMerge && declaration.range.fromCellId !== fromCellId ? { survivingMasterId: fromCellId } : {}
|
|
2643
|
+
};
|
|
2644
|
+
}
|
|
2645
|
+
/** 保留范围内未被轴删除覆盖的原下标,便于使用原网格解析幸存 CellId。 */
|
|
2646
|
+
survivingIndexes(from, to, index, count) {
|
|
2647
|
+
const result = [];
|
|
2648
|
+
for (let i = from; i <= to; i++) if (i < index || i >= index + count) result.push(i);
|
|
2649
|
+
return result;
|
|
2650
|
+
}
|
|
2651
|
+
/** 收集被删区域的父子/目标依赖闭包,不将普通字符串当成实体引用。 */
|
|
2652
|
+
regionClosure(table, roots) {
|
|
2653
|
+
const removed = new Set(roots), pending = [...roots], dependents = /* @__PURE__ */ new Map();
|
|
2654
|
+
for (const region of table.regions) for (const id of [region.parentRegionId, region.targetRegionId]) if (!isUndefined(id)) {
|
|
2655
|
+
const list = dependents.get(id) ?? [];
|
|
2656
|
+
list.push(region.id);
|
|
2657
|
+
dependents.set(id, list);
|
|
2658
|
+
}
|
|
2659
|
+
while (pending.length) for (const id of dependents.get(pending.pop()) ?? []) if (!removed.has(id)) {
|
|
2660
|
+
removed.add(id);
|
|
2661
|
+
pending.push(id);
|
|
2662
|
+
}
|
|
2663
|
+
return removed;
|
|
2664
|
+
}
|
|
2665
|
+
/** 倒序移除声明,保持其余顺序与身份,撤销时精确恢复原数组位置。 */
|
|
2666
|
+
removeDeclarations(table, collection, ids) {
|
|
2667
|
+
const editor = this.requireContext().editor;
|
|
2668
|
+
for (let i = table[collection].length - 1; i >= 0; i--) if (ids.has(table[collection][i].id)) editor.removeNodes({
|
|
2669
|
+
parentId: table.id,
|
|
2670
|
+
collection,
|
|
2671
|
+
index: i,
|
|
2672
|
+
count: 1
|
|
2673
|
+
});
|
|
2674
|
+
}
|
|
2675
|
+
/** 可选声明都走统一差量写入,明确 null 只作为 API 的移除指令,不进入文档。 */
|
|
2676
|
+
setOptional(id, role, key, value) {
|
|
2677
|
+
const ctx = this.requireContext();
|
|
2678
|
+
return ctx.editor.transaction(`table:set:${key}`, () => {
|
|
2679
|
+
if (ctx.entry(id).role !== role) throw new ModelEditError("node_type", `Expected ${role}`);
|
|
2680
|
+
if (isNull(value)) ctx.editor.unsetProperty(id, key);
|
|
2681
|
+
else ctx.editor.setProperty(id, key, value);
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
/** 读取真实表格,不复制内容或保存成员级当前表格。 */
|
|
2685
|
+
table(id) {
|
|
2686
|
+
return this.entity(id, "table");
|
|
2687
|
+
}
|
|
2688
|
+
/** 核对实体角色,只读使用索引中的权威对象,所有修改仍经编辑器。 */
|
|
2689
|
+
entity(id, role) {
|
|
2690
|
+
const entry = this.requireContext().entry(id);
|
|
2691
|
+
if (entry.role !== role) throw new ModelEditError("node_type", `Expected ${role}`);
|
|
2692
|
+
return entry.node;
|
|
2693
|
+
}
|
|
2694
|
+
/** 检查非负计数,零次操作不创建身份、历史或事件。 */
|
|
2695
|
+
checkCount(count) {
|
|
2696
|
+
if (!isInteger(count) || count < 0) throw new ModelEditError("range", "Count must be a nonnegative integer");
|
|
2697
|
+
}
|
|
2698
|
+
/** 在规划前隔离并检查完整范围,空操作也不静默接受未知参数。 */
|
|
2699
|
+
readRange(range) {
|
|
2700
|
+
const copied = copyData(range);
|
|
2701
|
+
checkFactoryValue(copied, cellRangeRule, "/range");
|
|
2702
|
+
return copied;
|
|
2703
|
+
}
|
|
2704
|
+
/** 检查物理轴上的插入/删除区间,不钳制或猜测非法位置。 */
|
|
2705
|
+
checkSlice(index, count, length) {
|
|
2706
|
+
this.checkCount(count);
|
|
2707
|
+
if (!isInteger(index) || index < 0 || index + count > length) throw new ModelEditError("range", "Table slice is outside the physical axis");
|
|
2708
|
+
}
|
|
2709
|
+
/** 验证会话仍存在,关闭后不保留编辑器、注册表或文档闭包。 */
|
|
2710
|
+
requireContext() {
|
|
2711
|
+
if (!this.context) throw new ModelEditError("disposed", "TableEditor is disposed");
|
|
2712
|
+
this.context.editor.revision;
|
|
2713
|
+
return this.context;
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
// src/model/query/entity-index.ts
|
|
2717
|
+
/**
|
|
2718
|
+
* @file 会话身份索引:按稳定 ID 定位原文档实体与拥有关系,随结构编辑更新,不保存第二份文档。
|
|
2719
|
+
* 阅读定位:query/ · 查询、身份索引与派生关系。
|
|
2720
|
+
*/
|
|
2721
|
+
var collections = {
|
|
2722
|
+
document: {
|
|
2723
|
+
sections: "section",
|
|
2724
|
+
parts: "part"
|
|
2725
|
+
},
|
|
2726
|
+
section: {
|
|
2727
|
+
blocks: "block",
|
|
2728
|
+
overlays: "overlay"
|
|
2729
|
+
},
|
|
2730
|
+
header: { blocks: "block" },
|
|
2731
|
+
footer: { blocks: "block" },
|
|
2732
|
+
overlay: { blocks: "block" },
|
|
2733
|
+
paragraph: { content: "inline" },
|
|
2734
|
+
table: {
|
|
2735
|
+
columns: "column",
|
|
2736
|
+
rows: "row",
|
|
2737
|
+
merges: "merge",
|
|
2738
|
+
regions: "region"
|
|
2739
|
+
},
|
|
2740
|
+
row: { cells: "cell" },
|
|
2741
|
+
cell: { blocks: "block" },
|
|
2742
|
+
field: { attachments: "attachment" },
|
|
2743
|
+
attachment: { blocks: "block" }
|
|
2744
|
+
};
|
|
2745
|
+
/** 只索引实体身份与拥有关系,不记录分页结果;每个编辑器独立持有,关闭时释放。 */
|
|
2746
|
+
var EntityIndex = class {
|
|
2747
|
+
entries = /* @__PURE__ */ new Map();
|
|
2748
|
+
/** 一次遍历已校验文档建立索引;普通文字编辑不再遍历文档。 */
|
|
2749
|
+
constructor(document) {
|
|
2750
|
+
this.add(this.scan([document], "document"));
|
|
2751
|
+
}
|
|
2752
|
+
/** 按稳定 ID 查找当前实体位置,缺失返回 undefined。 */
|
|
2753
|
+
get(id) {
|
|
2754
|
+
return this.entries.get(id);
|
|
2755
|
+
}
|
|
2756
|
+
/** 读取必需实体;已删除/错误 ID 在改动发生前抛错。 */
|
|
2757
|
+
require(id) {
|
|
2758
|
+
const entry = this.get(id);
|
|
2759
|
+
if (!entry) throw new ModelEditError("missing_node", `Missing entity: ${id}`);
|
|
2760
|
+
return entry;
|
|
2761
|
+
}
|
|
2762
|
+
/** 取得实体拥有集合的固定结构顺序,数组内顺序始终从当前文档读取。 */
|
|
2763
|
+
childCollections(id) {
|
|
2764
|
+
return Object.keys(collections[this.require(id).role] ?? {});
|
|
2765
|
+
}
|
|
2766
|
+
/** 取得实体允许编辑的子数组,阻止通过任意属性名绕过结构约束。 */
|
|
2767
|
+
list(parentId, collection) {
|
|
2768
|
+
const parent = this.require(parentId);
|
|
2769
|
+
if (!collections[parent.role]?.[collection]) throw new ModelEditError("collection", `${parent.role} has no collection ${collection}`);
|
|
2770
|
+
const value = parent.node[collection];
|
|
2771
|
+
if (isUndefined(value) && collection === "attachments") return [];
|
|
2772
|
+
if (!isArray(value)) throw new ModelEditError("collection", `Invalid collection ${collection}`);
|
|
2773
|
+
return value;
|
|
2774
|
+
}
|
|
2775
|
+
/** 按当前拥有关系取得真实 JSON Pointer,仅沿祖先定位,不在节点保存易失效路径。 */
|
|
2776
|
+
path(id) {
|
|
2777
|
+
const segments = [];
|
|
2778
|
+
let entry = this.require(id);
|
|
2779
|
+
while (!isUndefined(entry.parentId)) {
|
|
2780
|
+
const position = this.list(entry.parentId, entry.collection).findIndex((node) => node.id === entry.node.id);
|
|
2781
|
+
if (position < 0) throw new ModelEditError("index", "Entity is missing from its owning collection");
|
|
2782
|
+
segments.unshift(entry.collection, String(position));
|
|
2783
|
+
entry = this.require(entry.parentId);
|
|
2784
|
+
}
|
|
2785
|
+
return segments.length ? `/${segments.join("/")}` : "";
|
|
2786
|
+
}
|
|
2787
|
+
/** 批量定位实际拥有路径,每个相关数组只扫描一次;临时缓存不跨提交保留。 */
|
|
2788
|
+
paths(ids) {
|
|
2789
|
+
const paths = /* @__PURE__ */ new Map(), positions = /* @__PURE__ */ new Map();
|
|
2790
|
+
/** 共享祖先路径及数组位置,避免批量粘贴时为每个兄弟重新扫描整个拥有数组。 */
|
|
2791
|
+
const resolve = (id) => {
|
|
2792
|
+
const cached = paths.get(id);
|
|
2793
|
+
if (!isUndefined(cached)) return cached;
|
|
2794
|
+
const entry = this.require(id);
|
|
2795
|
+
let path = "";
|
|
2796
|
+
if (!isUndefined(entry.parentId)) {
|
|
2797
|
+
const parent = resolve(entry.parentId), list = this.list(entry.parentId, entry.collection);
|
|
2798
|
+
let indices = positions.get(list);
|
|
2799
|
+
if (!indices) {
|
|
2800
|
+
indices = new Map(list.map((node, i) => [node.id, i]));
|
|
2801
|
+
positions.set(list, indices);
|
|
2802
|
+
}
|
|
2803
|
+
const position = indices.get(id);
|
|
2804
|
+
if (isUndefined(position)) throw new ModelEditError("index", "Entity is missing from its owning collection");
|
|
2805
|
+
path = `${parent}/${entry.collection}/${position}`;
|
|
2806
|
+
}
|
|
2807
|
+
paths.set(id, path);
|
|
2808
|
+
return path;
|
|
2809
|
+
};
|
|
2810
|
+
for (const id of ids) resolve(id);
|
|
2811
|
+
return paths;
|
|
2812
|
+
}
|
|
2813
|
+
/** 收集将要移除的全部实体 ID,包含附属内容、表格内部合并/区域等身份。 */
|
|
2814
|
+
descendants(ids) {
|
|
2815
|
+
const result = /* @__PURE__ */ new Set();
|
|
2816
|
+
/** 沿索引的拥有边递归,不查询业务引用,以免把共享资源当成子节点删除。 */
|
|
2817
|
+
const visit = (id) => {
|
|
2818
|
+
result.add(id);
|
|
2819
|
+
this.require(id).children.forEach(visit);
|
|
2820
|
+
};
|
|
2821
|
+
ids.forEach(visit);
|
|
2822
|
+
return result;
|
|
2823
|
+
}
|
|
2824
|
+
/** 预检新子树及 ID 冲突;返回暂存索引,调用方完成数组修改后再安装。 */
|
|
2825
|
+
prepare(parentId, collection, nodes, removed) {
|
|
2826
|
+
const planned = this.inspect(parentId, collection, nodes);
|
|
2827
|
+
for (const id of planned.keys()) if (this.entries.has(id) && !removed.has(id)) throw new ModelEditError("duplicate_id", `Duplicate entity: ${id}`);
|
|
2828
|
+
return planned;
|
|
2829
|
+
}
|
|
2830
|
+
/** 检查待复制片段的拥有结构及内部重复身份,不安装索引,也不拒绝尚待重映射的来源 ID。 */
|
|
2831
|
+
inspect(parentId, collection, nodes) {
|
|
2832
|
+
const role = collections[this.require(parentId).role]?.[collection];
|
|
2833
|
+
if (!role) throw new ModelEditError("collection", `Unsupported collection: ${collection}`);
|
|
2834
|
+
return this.scan(nodes, role, parentId, collection);
|
|
2835
|
+
}
|
|
2836
|
+
/** 移除旧索引并安装预检成功的新索引,只访问本次增删的子树。 */
|
|
2837
|
+
replace(removed, planned) {
|
|
2838
|
+
for (const id of removed) {
|
|
2839
|
+
const entry = this.require(id);
|
|
2840
|
+
if (entry.parentId) this.entries.get(entry.parentId)?.children.delete(id);
|
|
2841
|
+
this.entries.delete(id);
|
|
2842
|
+
}
|
|
2843
|
+
this.add(planned);
|
|
2844
|
+
}
|
|
2845
|
+
/** 清空所有实体引用,供编辑会话关闭后释放文档树。 */
|
|
2846
|
+
clear() {
|
|
2847
|
+
this.entries.clear();
|
|
2848
|
+
}
|
|
2849
|
+
/** 将预检索引安装到当前会话,补齐拥有者的直接子节点集合。 */
|
|
2850
|
+
add(planned) {
|
|
2851
|
+
for (const [id, entry] of planned) this.entries.set(id, entry);
|
|
2852
|
+
for (const [id, entry] of planned) if (entry.parentId) this.require(entry.parentId).children.add(id);
|
|
2853
|
+
}
|
|
2854
|
+
/** 扫描单个待插入片段的结构,不依赖节点上的 parent/root,也不复制数据。 */
|
|
2855
|
+
scan(nodes, expected, parentId, collection) {
|
|
2856
|
+
const result = /* @__PURE__ */ new Map();
|
|
2857
|
+
/** 先检查索引所需的最小结构;全部属性和跨引用在事务提交时统一校验。 */
|
|
2858
|
+
const visit = (node, wanted, owner, key) => {
|
|
2859
|
+
if (!isObjectValue(node) || isFunction(node) || !isString(node.id) || !node.id.trim()) throw new ModelEditError("entity", "Entity needs a nonempty ID");
|
|
2860
|
+
const role = "kind" in node ? node.kind : wanted;
|
|
2861
|
+
if (wanted === "block" && role !== "paragraph" && role !== "table") throw new ModelEditError("entity", "Expected paragraph/table");
|
|
2862
|
+
if (wanted === "inline" && !includes([
|
|
2863
|
+
"text",
|
|
2864
|
+
"field",
|
|
2865
|
+
"image",
|
|
2866
|
+
"pageWidget",
|
|
2867
|
+
"break"
|
|
2868
|
+
], role)) throw new ModelEditError("entity", "Expected inline content");
|
|
2869
|
+
if (wanted === "part" && role !== "header" && role !== "footer") throw new ModelEditError("entity", "Expected header/footer");
|
|
2870
|
+
if (!includes([
|
|
2871
|
+
"block",
|
|
2872
|
+
"inline",
|
|
2873
|
+
"part"
|
|
2874
|
+
], wanted) && role !== wanted) throw new ModelEditError("entity", `Expected ${wanted}`);
|
|
2875
|
+
if (result.has(node.id)) throw new ModelEditError("duplicate_id", `Duplicate entity: ${node.id}`);
|
|
2876
|
+
result.set(node.id, {
|
|
2877
|
+
node,
|
|
2878
|
+
role,
|
|
2879
|
+
parentId: owner,
|
|
2880
|
+
collection: key,
|
|
2881
|
+
children: /* @__PURE__ */ new Set()
|
|
2882
|
+
});
|
|
2883
|
+
for (const [childKey, childRole] of Object.entries(collections[role] ?? {})) {
|
|
2884
|
+
const children = node[childKey];
|
|
2885
|
+
if (isUndefined(children) && childKey === "attachments") continue;
|
|
2886
|
+
if (!isArray(children)) throw new ModelEditError("entity", `Missing array: ${childKey}`);
|
|
2887
|
+
children.forEach((child) => visit(child, childRole, node.id, childKey));
|
|
2888
|
+
}
|
|
2889
|
+
};
|
|
2890
|
+
nodes.forEach((node) => visit(node, expected, parentId, collection));
|
|
2891
|
+
return result;
|
|
2892
|
+
}
|
|
2893
|
+
};
|
|
2894
|
+
// src/model/query/reference-query.ts
|
|
2895
|
+
/**
|
|
2896
|
+
* @file 拥有树遍历与引用反查:区分真正的子节点、核心身份引用和普通业务字符串。
|
|
2897
|
+
* 阅读定位:query/ · 查询、身份索引与派生关系。
|
|
2898
|
+
*/
|
|
2899
|
+
/** 沿当前拥有数组读取顺序,不使用可能因移动而改变插入顺序的 children Set。 */
|
|
2900
|
+
function orderedChildren(index, id) {
|
|
2901
|
+
return index.childCollections(id).flatMap((key) => index.list(id, key).map((node) => index.require(node.id)));
|
|
2902
|
+
}
|
|
2903
|
+
/** 顺序遍历拥有树,不展开页部件、样式、资产和业务绑定等引用。 */
|
|
2904
|
+
function walkEntities(index, rootId) {
|
|
2905
|
+
const entries = [];
|
|
2906
|
+
/** 将当前节点与其拥有子树按结构顺序加入结果。 */
|
|
2907
|
+
const visit = (entry) => {
|
|
2908
|
+
entries.push(entry);
|
|
2909
|
+
for (const child of orderedChildren(index, entry.node.id)) visit(child);
|
|
2910
|
+
};
|
|
2911
|
+
visit(index.require(rootId));
|
|
2912
|
+
return entries;
|
|
2913
|
+
}
|
|
2914
|
+
/** 按目标反查或读取明确实体的声明引用;不把拥有边或业务字符串误作引用。 */
|
|
2915
|
+
function findReferences(document, index, target, registry, sourceId) {
|
|
2916
|
+
const result = [];
|
|
2917
|
+
/** 全部读取仅对明确实体开放;原反查空目标仍不返回引用,不扩大旧调用语义。 */
|
|
2918
|
+
const add = (source, path, candidate) => {
|
|
2919
|
+
if (target === void 0 && sourceId !== void 0 || equalData(target, candidate)) result.push({
|
|
2920
|
+
source,
|
|
2921
|
+
path,
|
|
2922
|
+
target: { ...candidate }
|
|
2923
|
+
});
|
|
2924
|
+
};
|
|
2925
|
+
if (sourceId === void 0) {
|
|
2926
|
+
add({ kind: "settings" }, "/defaultTextStyleId", {
|
|
2927
|
+
kind: "style",
|
|
2928
|
+
styleKind: "text",
|
|
2929
|
+
id: document.settings.defaultTextStyleId
|
|
2930
|
+
});
|
|
2931
|
+
add({ kind: "settings" }, "/defaultParagraphStyleId", {
|
|
2932
|
+
kind: "style",
|
|
2933
|
+
styleKind: "paragraph",
|
|
2934
|
+
id: document.settings.defaultParagraphStyleId
|
|
2935
|
+
});
|
|
2936
|
+
for (const styleKind of [
|
|
2937
|
+
"text",
|
|
2938
|
+
"paragraph",
|
|
2939
|
+
"table"
|
|
2940
|
+
]) for (const [id, style] of Object.entries(document.styles[styleKind])) {
|
|
2941
|
+
const source = {
|
|
2942
|
+
kind: "style",
|
|
2943
|
+
styleKind,
|
|
2944
|
+
id
|
|
2945
|
+
};
|
|
2946
|
+
if (!isUndefined(style.basedOn)) add(source, "/basedOn", {
|
|
2947
|
+
kind: "style",
|
|
2948
|
+
styleKind,
|
|
2949
|
+
id: style.basedOn
|
|
2950
|
+
});
|
|
2951
|
+
if ("textStyleId" in style && isString(style.textStyleId)) add(source, "/textStyleId", {
|
|
2952
|
+
kind: "style",
|
|
2953
|
+
styleKind: "text",
|
|
2954
|
+
id: style.textStyleId
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
for (const entry of sourceId === void 0 ? walkEntities(index, document.id) : [index.require(sourceId)]) {
|
|
2959
|
+
const node = entry.node, source = {
|
|
2960
|
+
kind: "entity",
|
|
2961
|
+
id: node.id
|
|
2962
|
+
};
|
|
2963
|
+
for (const use of entityConfigUses(node)) for (const reference of registry.getReferences(use.scope, use.name, use.version, use.value)) add(source, `${use.path}${reference.path}`, reference.target);
|
|
2964
|
+
if ("textStyleId" in node && !isUndefined(node.textStyleId)) add(source, "/textStyleId", {
|
|
2965
|
+
kind: "style",
|
|
2966
|
+
styleKind: "text",
|
|
2967
|
+
id: node.textStyleId
|
|
2968
|
+
});
|
|
2969
|
+
if (entry.role === "paragraph" && !isUndefined(node.paragraphStyleId)) add(source, "/paragraphStyleId", {
|
|
2970
|
+
kind: "style",
|
|
2971
|
+
styleKind: "paragraph",
|
|
2972
|
+
id: node.paragraphStyleId
|
|
2973
|
+
});
|
|
2974
|
+
if (entry.role === "table" && !isUndefined(node.tableStyleId)) add(source, "/tableStyleId", {
|
|
2975
|
+
kind: "style",
|
|
2976
|
+
styleKind: "table",
|
|
2977
|
+
id: node.tableStyleId
|
|
2978
|
+
});
|
|
2979
|
+
if ("kind" in node && node.kind === "image") add(source, "/assetId", {
|
|
2980
|
+
kind: "asset",
|
|
2981
|
+
id: node.assetId
|
|
2982
|
+
});
|
|
2983
|
+
if ("kind" in node && node.kind === "field") {
|
|
2984
|
+
add(source, "/bindingId", {
|
|
2985
|
+
kind: "binding",
|
|
2986
|
+
id: node.bindingId
|
|
2987
|
+
});
|
|
2988
|
+
if (node.widget === "choice") node.config.defaultOptionIds?.forEach((id, i) => add(source, `/config/defaultOptionIds/${i}`, {
|
|
2989
|
+
kind: "option",
|
|
2990
|
+
fieldId: node.id,
|
|
2991
|
+
id
|
|
2992
|
+
}));
|
|
2993
|
+
}
|
|
2994
|
+
if ("kind" in node && node.kind === "attachment" && node.when.kind === "option") add(source, "/when/optionId", {
|
|
2995
|
+
kind: "option",
|
|
2996
|
+
fieldId: entry.parentId,
|
|
2997
|
+
id: node.when.optionId
|
|
2998
|
+
});
|
|
2999
|
+
if ("kind" in node && node.kind === "section") for (const key of ["headerSlots", "footerSlots"]) for (const slot of [
|
|
3000
|
+
"default",
|
|
3001
|
+
"first",
|
|
3002
|
+
"even"
|
|
3003
|
+
]) {
|
|
3004
|
+
const id = node[key]?.[slot];
|
|
3005
|
+
if (isString(id)) add(source, `/${key}/${slot}`, {
|
|
3006
|
+
kind: "entity",
|
|
3007
|
+
id
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
if (entry.role === "merge" || entry.role === "region") {
|
|
3011
|
+
const range = node.range;
|
|
3012
|
+
add(source, "/range/fromCellId", {
|
|
3013
|
+
kind: "entity",
|
|
3014
|
+
id: range.fromCellId
|
|
3015
|
+
});
|
|
3016
|
+
add(source, "/range/toCellId", {
|
|
3017
|
+
kind: "entity",
|
|
3018
|
+
id: range.toCellId
|
|
3019
|
+
});
|
|
3020
|
+
}
|
|
3021
|
+
if (entry.role === "region") for (const key of ["parentRegionId", "targetRegionId"]) {
|
|
3022
|
+
const id = node[key];
|
|
3023
|
+
if (!isUndefined(id)) add(source, `/${key}`, {
|
|
3024
|
+
kind: "entity",
|
|
3025
|
+
id
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
return freezeData(result);
|
|
3030
|
+
}
|
|
3031
|
+
/** 只反查核心字段的 bindingId,覆盖正文、共享部件、浮层和所有附属内容。 */
|
|
3032
|
+
function bindingUsers(index, rootId, bindingId) {
|
|
3033
|
+
return walkEntities(index, rootId).flatMap((entry) => entry.role === "field" && entry.node.bindingId === bindingId ? [entry.node] : []);
|
|
3034
|
+
}
|
|
3035
|
+
// src/model/query/table-query.ts
|
|
3036
|
+
/**
|
|
3037
|
+
* @file 单表关系派生与缓存:按需建立物理网格、合并主从格和业务区域关系,按变更失效。
|
|
3038
|
+
* 阅读定位:query/ · 查询、身份索引与派生关系。
|
|
3039
|
+
*/
|
|
3040
|
+
/** 会话内的单表关系缓存;结构和范围关系提交时清理,文字及样式/配置编辑不重新构建。 */
|
|
3041
|
+
var TableRelations = class {
|
|
3042
|
+
/** 只为查询过的表格建立索引。 */
|
|
3043
|
+
tables = /* @__PURE__ */ new Map();
|
|
3044
|
+
/** 返回完整物理网格,包含从格;同一有效缓存周期复用只读结果。 */
|
|
3045
|
+
grid(table) {
|
|
3046
|
+
return this.get(table).grid;
|
|
3047
|
+
}
|
|
3048
|
+
/** 按本表 CellId 读取位置,跨表或非物理格身份明确拒绝。 */
|
|
3049
|
+
cell(table, cellId) {
|
|
3050
|
+
const cell = this.get(table).cells.get(cellId);
|
|
3051
|
+
if (!cell) throw new ModelEditError("table_cell", `Cell is not in table: ${cellId}`);
|
|
3052
|
+
return cell;
|
|
3053
|
+
}
|
|
3054
|
+
/** 按本表 RegionId 读取范围和反向关系。 */
|
|
3055
|
+
region(table, regionId) {
|
|
3056
|
+
const region = this.get(table).regions.get(regionId);
|
|
3057
|
+
if (!region) throw new ModelEditError("table_region", `Region is not in table: ${regionId}`);
|
|
3058
|
+
return region;
|
|
3059
|
+
}
|
|
3060
|
+
/** 将本表 CellId 端点转成闭合矩形,不纠正跨表或倒置端点。 */
|
|
3061
|
+
rectangle(table, range) {
|
|
3062
|
+
return freezeData(rectangleFromPositions(this.get(table).cells, range));
|
|
3063
|
+
}
|
|
3064
|
+
/** 丢弃全部派生关系,释放已删除表的身份;不触碰文档。 */
|
|
3065
|
+
clear() {
|
|
3066
|
+
this.tables.clear();
|
|
3067
|
+
}
|
|
3068
|
+
/** 首次查询单表时建立网格、合并与区域反查,后续按身份命中。 */
|
|
3069
|
+
get(table) {
|
|
3070
|
+
const cached = this.tables.get(table.id);
|
|
3071
|
+
if (cached) return cached;
|
|
3072
|
+
const cells = /* @__PURE__ */ new Map();
|
|
3073
|
+
const rows = table.rows.map((row, r) => row.cells.map((cell, c) => {
|
|
3074
|
+
const info = {
|
|
3075
|
+
cellId: cell.id,
|
|
3076
|
+
tableId: table.id,
|
|
3077
|
+
rowId: row.id,
|
|
3078
|
+
columnId: table.columns[c].id,
|
|
3079
|
+
rowIndex: r,
|
|
3080
|
+
columnIndex: c,
|
|
3081
|
+
regionIds: []
|
|
3082
|
+
};
|
|
3083
|
+
cells.set(cell.id, info);
|
|
3084
|
+
return info;
|
|
3085
|
+
}));
|
|
3086
|
+
for (const merge of table.merges) {
|
|
3087
|
+
const rect = rectangleFromPositions(cells, merge.range);
|
|
3088
|
+
for (let r = rect.top; r <= rect.bottom; r++) for (let c = rect.left; c <= rect.right; c++) rows[r][c].merge = {
|
|
3089
|
+
mergeId: merge.id,
|
|
3090
|
+
masterCellId: merge.range.fromCellId,
|
|
3091
|
+
isMaster: r === rect.top && c === rect.left,
|
|
3092
|
+
rowSpan: rect.bottom - rect.top + 1,
|
|
3093
|
+
columnSpan: rect.right - rect.left + 1
|
|
3094
|
+
};
|
|
3095
|
+
}
|
|
3096
|
+
const regions = /* @__PURE__ */ new Map();
|
|
3097
|
+
const children = /* @__PURE__ */ new Map(), headers = /* @__PURE__ */ new Map();
|
|
3098
|
+
for (const region of table.regions) for (const [id, map] of [[region.parentRegionId, children], [region.targetRegionId, headers]]) if (!isUndefined(id)) {
|
|
3099
|
+
const list = map.get(id) ?? [];
|
|
3100
|
+
list.push(region.id);
|
|
3101
|
+
map.set(id, list);
|
|
3102
|
+
}
|
|
3103
|
+
for (const region of table.regions) {
|
|
3104
|
+
const rect = rectangleFromPositions(cells, region.range);
|
|
3105
|
+
for (let r = rect.top; r <= rect.bottom; r++) for (let c = rect.left; c <= rect.right; c++) rows[r][c].regionIds.push(region.id);
|
|
3106
|
+
regions.set(region.id, freezeData({
|
|
3107
|
+
regionId: region.id,
|
|
3108
|
+
tableId: table.id,
|
|
3109
|
+
rectangle: rect,
|
|
3110
|
+
...isUndefined(region.parentRegionId) ? {} : { parentRegionId: region.parentRegionId },
|
|
3111
|
+
...isUndefined(region.targetRegionId) ? {} : { targetRegionId: region.targetRegionId },
|
|
3112
|
+
childRegionIds: children.get(region.id) ?? [],
|
|
3113
|
+
headerRegionIds: headers.get(region.id) ?? []
|
|
3114
|
+
}));
|
|
3115
|
+
}
|
|
3116
|
+
const result = {
|
|
3117
|
+
grid: freezeData({
|
|
3118
|
+
tableId: table.id,
|
|
3119
|
+
rowCount: rows.length,
|
|
3120
|
+
columnCount: table.columns.length,
|
|
3121
|
+
cells: rows
|
|
3122
|
+
}),
|
|
3123
|
+
cells,
|
|
3124
|
+
regions
|
|
3125
|
+
};
|
|
3126
|
+
this.tables.set(table.id, result);
|
|
3127
|
+
return result;
|
|
3128
|
+
}
|
|
3129
|
+
};
|
|
3130
|
+
// src/model/business/exception-highlight.ts
|
|
3131
|
+
/** 从字段覆盖和文档设置读取实际开关,保留显式 false。 */
|
|
3132
|
+
function resolveKeepExceptionHighlight(fieldValue, validation) {
|
|
3133
|
+
return typeof fieldValue === "boolean" ? fieldValue : validation?.keepExceptionHighlight ?? true;
|
|
3134
|
+
}
|
|
3135
|
+
// src/model/query/ModelQuery.ts
|
|
3136
|
+
/**
|
|
3137
|
+
* @file 统一查询入口:读取实体与引用,解析有效样式、静态字段规则、表格关系及页眉页脚选择。
|
|
3138
|
+
* 阅读定位:query/ · 查询、身份索引与派生关系。
|
|
3139
|
+
*/
|
|
3140
|
+
/** 同一份已提交文档的统一读取门面;只能通过 ModelEditor.query 取得会话实例。 */
|
|
3141
|
+
var ModelQuery = class {
|
|
3142
|
+
/** 当前会话访问器,销毁时释放闭包,不保存文档快照。 */
|
|
3143
|
+
source;
|
|
3144
|
+
/** 与校验和编辑共用的版本化定义。 */
|
|
3145
|
+
registry;
|
|
3146
|
+
/** 按需建立的表格关系,不保存内容或当前字段值。 */
|
|
3147
|
+
tables = new TableRelations();
|
|
3148
|
+
/** 由编辑器注入访问器;访问器拒绝未提交事务,避免缓存中间无效状态。 @internal */
|
|
3149
|
+
constructor(source, registry) {
|
|
3150
|
+
this.source = source;
|
|
3151
|
+
this.registry = registry;
|
|
3152
|
+
}
|
|
3153
|
+
/** 借用当前已提交的只读文档根,避免为根身份遍历全树;不创建快照或转移所有权。 */
|
|
3154
|
+
getRoot() {
|
|
3155
|
+
return this.read().document;
|
|
3156
|
+
}
|
|
3157
|
+
/** 只查共用身份索引,不遍历文档或复制节点。 */
|
|
3158
|
+
getEntity(id, role) {
|
|
3159
|
+
const entry = this.read().index.get(id);
|
|
3160
|
+
return entry && (isUndefined(role) || entry.role === role) ? entry.node : void 0;
|
|
3161
|
+
}
|
|
3162
|
+
/** 返回当前结构位置;兄弟增删和移动后重新读取数组下标。 */
|
|
3163
|
+
getLocation(id) {
|
|
3164
|
+
const { index } = this.read(), entry = index.get(id);
|
|
3165
|
+
if (!entry) return void 0;
|
|
3166
|
+
return freezeData({
|
|
3167
|
+
id,
|
|
3168
|
+
role: entry.role,
|
|
3169
|
+
...isUndefined(entry.parentId) ? {} : { parentId: entry.parentId },
|
|
3170
|
+
...isUndefined(entry.collection) ? {} : {
|
|
3171
|
+
collection: entry.collection,
|
|
3172
|
+
index: index.list(entry.parentId, entry.collection).findIndex((node) => node.id === id)
|
|
3173
|
+
}
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
/** 读取直接拥有的子实体,固定集合顺序加当前数组顺序;不展开业务引用。 */
|
|
3177
|
+
getChildren(parentId, collection) {
|
|
3178
|
+
const { index } = this.read();
|
|
3179
|
+
return Object.freeze(isUndefined(collection) ? orderedChildren(index, parentId).map((entry) => entry.node) : [...index.list(parentId, collection)]);
|
|
3180
|
+
}
|
|
3181
|
+
/** 读取协议明确拥有的集合名,与编辑器共用规则;不按对象属性猜测父子关系。 */
|
|
3182
|
+
getChildCollections(id) {
|
|
3183
|
+
return Object.freeze(this.read().index.childCollections(id));
|
|
3184
|
+
}
|
|
3185
|
+
/** 从最近拥有者到根文档返回祖先,传入身份必须存在。 */
|
|
3186
|
+
getAncestors(id) {
|
|
3187
|
+
return Object.freeze(this.ancestors(this.read(), id).map((entry) => entry.node));
|
|
3188
|
+
}
|
|
3189
|
+
/** 按当前结构顺序查询子树,默认不含根;只遍历拥有边,不重复展开共享页部件。 */
|
|
3190
|
+
findEntities(filter = {}) {
|
|
3191
|
+
const source = this.read(), options = readFactoryOptions(filter, [
|
|
3192
|
+
"rootId",
|
|
3193
|
+
"roles",
|
|
3194
|
+
"includeRoot"
|
|
3195
|
+
]);
|
|
3196
|
+
if (!isUndefined(options.roles) && !isArray(options.roles)) throw new ModelEditError("query_filter", "roles must be an array");
|
|
3197
|
+
if (!isUndefined(options.includeRoot) && !isBoolean(options.includeRoot)) throw new ModelEditError("query_filter", "includeRoot must be boolean");
|
|
3198
|
+
const all = walkEntities(source.index, options.rootId ?? source.document.id);
|
|
3199
|
+
return Object.freeze(all.filter((entry, i) => (i > 0 || options.includeRoot === true) && (isUndefined(options.roles) || includes(options.roles, entry.role))).map((entry) => entry.node));
|
|
3200
|
+
}
|
|
3201
|
+
/** 读取最近段落、单元格、表格等结构上下文,不把引用关系当成拥有关系。 */
|
|
3202
|
+
getContext(id) {
|
|
3203
|
+
const source = this.read(), entries = [source.index.require(id), ...this.ancestors(source, id)];
|
|
3204
|
+
const context = {
|
|
3205
|
+
id,
|
|
3206
|
+
attachmentIds: []
|
|
3207
|
+
};
|
|
3208
|
+
for (const entry of entries) {
|
|
3209
|
+
const key = entry.role === "paragraph" ? "paragraphId" : entry.role === "cell" ? "cellId" : entry.role === "table" ? "tableId" : entry.role === "section" ? "sectionId" : entry.role === "overlay" ? "overlayId" : entry.role === "header" || entry.role === "footer" ? "partId" : void 0;
|
|
3210
|
+
if (key && isUndefined(context[key])) context[key] = entry.node.id;
|
|
3211
|
+
if (entry.role === "attachment") context.attachmentIds.push(entry.node.id);
|
|
3212
|
+
}
|
|
3213
|
+
return freezeData(context);
|
|
3214
|
+
}
|
|
3215
|
+
/** 取得字段的绑定声明,不解析路径中的动态下标,也不读取业务记录。 */
|
|
3216
|
+
getFieldBinding(fieldId) {
|
|
3217
|
+
const source = this.read(), field = this.requireRole(source, fieldId, "field");
|
|
3218
|
+
return Object.freeze({
|
|
3219
|
+
bindingId: field.bindingId,
|
|
3220
|
+
binding: source.document.bindings[field.bindingId]
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
/** 按 bindingId 反查全部核心字段,覆盖正文、共享部件、浮层与附属内容。 */
|
|
3224
|
+
getBindingUsers(bindingId) {
|
|
3225
|
+
const source = this.read();
|
|
3226
|
+
return Object.freeze(bindingUsers(source.index, source.document.id, bindingId));
|
|
3227
|
+
}
|
|
3228
|
+
/** 反查核心协议和 schema 声明的引用;拥有关系用 getChildren,公式字符串不猜测。 */
|
|
3229
|
+
getReferences(target) {
|
|
3230
|
+
const source = this.read();
|
|
3231
|
+
return findReferences(source.document, source.index, target, this.registry);
|
|
3232
|
+
}
|
|
3233
|
+
/** 读取单个实体的全部明确引用,供版本对照按类别解释身份;不扫描其他实体或猜测业务字符串。 */
|
|
3234
|
+
getEntityReferences(id) {
|
|
3235
|
+
const source = this.read();
|
|
3236
|
+
return findReferences(source.document, source.index, void 0, this.registry, id);
|
|
3237
|
+
}
|
|
3238
|
+
/** 解析空块集合插入段落时的默认段落声明,不创建临时 model 节点。 */
|
|
3239
|
+
resolveDefaultParagraphStyle() {
|
|
3240
|
+
const { document } = this.read();
|
|
3241
|
+
return freezeData(mergeStyle(...this.styleChain(document, "paragraph", document.settings.defaultParagraphStyleId).map((style) => style.properties)));
|
|
3242
|
+
}
|
|
3243
|
+
/** 解析空块集合插入文字时的默认声明,包含默认段落引用的文字样式。 */
|
|
3244
|
+
resolveDefaultTextStyle(declaration) {
|
|
3245
|
+
const { document } = this.read();
|
|
3246
|
+
const layers = this.styleChain(document, "text", document.settings.defaultTextStyleId).map((style) => style.properties);
|
|
3247
|
+
for (const style of this.styleChain(document, "paragraph", document.settings.defaultParagraphStyleId)) if (style.textStyleId !== void 0) layers.push(...this.styleChain(document, "text", style.textStyleId).map((item) => item.properties));
|
|
3248
|
+
if (declaration?.textStyleId) layers.push(...this.styleChain(document, "text", declaration.textStyleId).map((style) => style.properties));
|
|
3249
|
+
if (declaration?.textStyle) layers.push(declaration.textStyle);
|
|
3250
|
+
return freezeData(mergeStyle(...layers));
|
|
3251
|
+
}
|
|
3252
|
+
/** 解析段落有效声明:文档默认、段落样式继承链、直接覆盖依次生效。 */
|
|
3253
|
+
resolveParagraphStyle(paragraphId) {
|
|
3254
|
+
const source = this.read(), paragraph = this.requireRole(source, paragraphId, "paragraph");
|
|
3255
|
+
return freezeData(mergeStyle(...this.paragraphStyles(source.document, paragraph).map((style) => style.properties), paragraph.paragraphStyle));
|
|
3256
|
+
}
|
|
3257
|
+
/** 解析有效文字样式;可选声明替换叶子覆盖,供输入态查询,不创建临时节点或写回计算值。 */
|
|
3258
|
+
resolveTextStyle(nodeId, declaration) {
|
|
3259
|
+
const source = this.read(), entry = source.index.require(nodeId);
|
|
3260
|
+
if (!includes([
|
|
3261
|
+
"paragraph",
|
|
3262
|
+
"text",
|
|
3263
|
+
"field",
|
|
3264
|
+
"pageWidget"
|
|
3265
|
+
], entry.role)) throw new ModelEditError("node_type", "Entity does not have text style");
|
|
3266
|
+
const paragraph = entry.role === "paragraph" ? entry.node : this.ancestors(source, nodeId).find((item) => item.role === "paragraph")?.node;
|
|
3267
|
+
const layers = this.styleChain(source.document, "text", source.document.settings.defaultTextStyleId).map((style) => style.properties);
|
|
3268
|
+
for (const style of this.paragraphStyles(source.document, paragraph)) if (!isUndefined(style.textStyleId)) layers.push(...this.styleChain(source.document, "text", style.textStyleId).map((item) => item.properties));
|
|
3269
|
+
for (const node of entry.role === "paragraph" ? [paragraph, ...declaration ? [declaration] : []] : [paragraph, declaration ?? entry.node]) {
|
|
3270
|
+
if (!isUndefined(node.textStyleId)) layers.push(...this.styleChain(source.document, "text", node.textStyleId).map((style) => style.properties));
|
|
3271
|
+
if (!isUndefined(node.textStyle)) layers.push(node.textStyle);
|
|
3272
|
+
}
|
|
3273
|
+
return freezeData(mergeStyle(...layers));
|
|
3274
|
+
}
|
|
3275
|
+
/** 解析表格样式继承链及直接覆盖,不计算列宽或排版。 */
|
|
3276
|
+
resolveTableStyle(tableId) {
|
|
3277
|
+
const source = this.read(), table = this.requireRole(source, tableId, "table");
|
|
3278
|
+
return freezeData(this.tableStyle(source.document, table));
|
|
3279
|
+
}
|
|
3280
|
+
/** 解析物理格的表级默认与格覆盖;内部边框按物理位置投影,不裁决合并显示和共享边冲突。 */
|
|
3281
|
+
resolveCellStyle(cellId) {
|
|
3282
|
+
const source = this.read(), cell = this.requireRole(source, cellId, "cell");
|
|
3283
|
+
const table = this.cellTable(source, cellId), info = this.tables.cell(table, cellId);
|
|
3284
|
+
const style = this.tableStyle(source.document, table), inherited = {};
|
|
3285
|
+
if (!isUndefined(style.cellPaddingPx)) inherited.paddingPx = style.cellPaddingPx;
|
|
3286
|
+
if (!isUndefined(style.backgroundColor)) inherited.backgroundColor = style.backgroundColor;
|
|
3287
|
+
if (style.borders) {
|
|
3288
|
+
inherited.borders = {};
|
|
3289
|
+
const keys = {
|
|
3290
|
+
top: info.rowIndex === 0 ? "top" : "insideH",
|
|
3291
|
+
bottom: info.rowIndex === table.rows.length - 1 ? "bottom" : "insideH",
|
|
3292
|
+
left: info.columnIndex === 0 ? "left" : "insideV",
|
|
3293
|
+
right: info.columnIndex === table.columns.length - 1 ? "right" : "insideV"
|
|
3294
|
+
};
|
|
3295
|
+
for (const side of [
|
|
3296
|
+
"top",
|
|
3297
|
+
"bottom",
|
|
3298
|
+
"left",
|
|
3299
|
+
"right"
|
|
3300
|
+
]) {
|
|
3301
|
+
const border = style.borders[keys[side]];
|
|
3302
|
+
if (!isUndefined(border)) inherited.borders[side] = border;
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
return freezeData(mergeStyle(inherited, cell.style));
|
|
3306
|
+
}
|
|
3307
|
+
/** 单个页码或线条可以由纸张锚点独立定位;其他浮层保持通用容器布局。 */
|
|
3308
|
+
getFloatingPageWidget(overlayId) {
|
|
3309
|
+
const overlay = this.getEntity(overlayId, "overlay");
|
|
3310
|
+
if (!overlay || overlay.blocks.length !== 1) return;
|
|
3311
|
+
const block = overlay.blocks[0];
|
|
3312
|
+
if (block?.kind !== "paragraph" || block.content.length !== 1) return;
|
|
3313
|
+
const node = block.content[0];
|
|
3314
|
+
return node?.kind === "pageWidget" && (node.widget === "pagination" || node.widget === "line") ? node : void 0;
|
|
3315
|
+
}
|
|
3316
|
+
/** 解析字段或页面组件的版本化静态配置,未声明默认值不擅自补业务属性。 */
|
|
3317
|
+
resolveConfig(nodeId) {
|
|
3318
|
+
const entry = this.read().index.require(nodeId);
|
|
3319
|
+
if (entry.role !== "field" && entry.role !== "pageWidget") throw new ModelEditError("node_type", "Expected field/page widget");
|
|
3320
|
+
const node = entry.node;
|
|
3321
|
+
return this.registry.resolveConfig(entry.role, node.widget, node.configVersion ?? 1, node.config ?? {});
|
|
3322
|
+
}
|
|
3323
|
+
/** 按明确组件类型读取常用字段配置,类型与运行时均核对。 */
|
|
3324
|
+
resolveFieldConfig(fieldId, widget) {
|
|
3325
|
+
const source = this.read(), node = this.requireRole(source, fieldId, "field");
|
|
3326
|
+
if (node.widget !== widget) throw new ModelEditError("field_widget", "Field widget does not match query");
|
|
3327
|
+
return this.registry.resolveConfig("field", node.widget, node.configVersion ?? 1, node.config ?? {});
|
|
3328
|
+
}
|
|
3329
|
+
/** 返回独立冻结的配置快照,不调用业务接口、执行判定或维护第二份持久化结构。 */
|
|
3330
|
+
resolveBusinessConfig(name, version) {
|
|
3331
|
+
const { document } = this.read(), builtin = documentBusinessSchemas.find((schema) => schema.name === name);
|
|
3332
|
+
if (isUndefined(version) && !builtin) throw new ModelEditError("business_version", "Extension business query needs an explicit version");
|
|
3333
|
+
const expected = version ?? builtin.version, stored = document.business.configs?.[name];
|
|
3334
|
+
if (stored && stored.version !== expected) throw new ModelEditError("business_version", "Stored business config version differs from query");
|
|
3335
|
+
return this.registry.resolveConfig("business", name, expected, stored?.value ?? {});
|
|
3336
|
+
}
|
|
3337
|
+
/** 查询物耗区域唯一业务变体,不读取接口 BOM 记录、实例数量或运行时缓存。 */
|
|
3338
|
+
resolveMaterialConfig(regionId) {
|
|
3339
|
+
const source = this.read(), region = this.requireRole(source, regionId, "region");
|
|
3340
|
+
if (region.type !== "material-consume-table" || region.variant?.name !== "edhr:material-consume") throw new ModelEditError("material_region", "Expected registered material consume variant");
|
|
3341
|
+
return this.registry.resolveConfig("variant", region.variant.name, region.variant.version, region.variant.config);
|
|
3342
|
+
}
|
|
3343
|
+
/** 按组件名取得内建页面组件配置,类型和运行时均核对,不计算页码或业务值。 */
|
|
3344
|
+
resolvePageWidgetConfig(nodeId, widget) {
|
|
3345
|
+
const source = this.read();
|
|
3346
|
+
if (this.requireRole(source, nodeId, "pageWidget").widget !== widget) throw new ModelEditError("page_widget", "Page widget does not match query");
|
|
3347
|
+
return this.resolveConfig(nodeId);
|
|
3348
|
+
}
|
|
3349
|
+
/** 读取常用字段的静态布尔规则;不执行 dependencies、公式或外部权限。 */
|
|
3350
|
+
resolveFieldRules(fieldId) {
|
|
3351
|
+
const source = this.read(), node = this.requireRole(source, fieldId, "field");
|
|
3352
|
+
if (!includes(commonFieldWidgets, node.widget)) throw new ModelEditError("field_widget", "Expected common field");
|
|
3353
|
+
const config = this.resolveConfig(fieldId);
|
|
3354
|
+
return freezeData({
|
|
3355
|
+
required: config.required ?? false,
|
|
3356
|
+
readonly: config.readonly ?? false,
|
|
3357
|
+
disabled: config.disabled ?? false,
|
|
3358
|
+
keepExceptionHighlight: resolveKeepExceptionHighlight(config.keepExceptionHighlight, source.document.business.validation)
|
|
3359
|
+
});
|
|
3360
|
+
}
|
|
3361
|
+
/** 解析注册默认能力与实例覆盖,未声明能力保持缺省,不把它当作最终操作权限。 */
|
|
3362
|
+
resolvePolicy(nodeId) {
|
|
3363
|
+
const entry = this.read().index.require(nodeId);
|
|
3364
|
+
if (entry.role !== "field" && entry.role !== "pageWidget") throw new ModelEditError("node_type", "Expected field/page widget");
|
|
3365
|
+
const node = entry.node;
|
|
3366
|
+
return this.registry.resolvePolicy(entry.role, node.widget, node.configVersion ?? 1, node.policy ?? {});
|
|
3367
|
+
}
|
|
3368
|
+
/** 按需取得单表物理网格及合并、区域反查,同一有效周期复用派生结果。 */
|
|
3369
|
+
getTableGrid(tableId) {
|
|
3370
|
+
return this.tables.grid(this.requireRole(this.read(), tableId, "table"));
|
|
3371
|
+
}
|
|
3372
|
+
/** 普通表及其分页表头使用物理网格,业务表使用各自的区域语义。 */
|
|
3373
|
+
isOrdinaryTable(tableId) {
|
|
3374
|
+
const table = this.getEntity(tableId, "table");
|
|
3375
|
+
return !!table && isOrdinaryTable(table.regions);
|
|
3376
|
+
}
|
|
3377
|
+
/** 按单元格身份取得最近所属表中的物理位置和反向关系。 */
|
|
3378
|
+
getCellInfo(cellId) {
|
|
3379
|
+
const source = this.read();
|
|
3380
|
+
this.requireRole(source, cellId, "cell");
|
|
3381
|
+
return this.tables.cell(this.cellTable(source, cellId), cellId);
|
|
3382
|
+
}
|
|
3383
|
+
/** 读取本表业务区域的物理范围和声明父子、表头反向关系。 */
|
|
3384
|
+
getRegionInfo(regionId) {
|
|
3385
|
+
const source = this.read();
|
|
3386
|
+
this.requireRole(source, regionId, "region");
|
|
3387
|
+
const tableId = source.index.require(regionId).parentId;
|
|
3388
|
+
return this.tables.region(this.requireRole(source, tableId, "table"), regionId);
|
|
3389
|
+
}
|
|
3390
|
+
/** 解析指定表的物理 CellId 范围,拒绝跨表和倒置范围。 */
|
|
3391
|
+
getTableRange(tableId, range) {
|
|
3392
|
+
return this.tables.rectangle(this.requireRole(this.read(), tableId, "table"), range);
|
|
3393
|
+
}
|
|
3394
|
+
/** 根据明确页序选择页眉/页脚:首页优先,再看文档偶数页,缺省回退 default,null 关闭。 */
|
|
3395
|
+
selectPart(sectionId, kind, page) {
|
|
3396
|
+
const source = this.read(), section = this.requireRole(source, sectionId, "section");
|
|
3397
|
+
if (kind !== "header" && kind !== "footer") throw new ModelEditError("part_kind", "Expected header/footer");
|
|
3398
|
+
const context = readFactoryOptions(page, ["sectionPageNumber", "documentPageNumber"]);
|
|
3399
|
+
for (const value of [context.sectionPageNumber, context.documentPageNumber]) if (!isInteger(value) || value < 1) throw new ModelEditError("page_number", "Page numbers must be positive integers");
|
|
3400
|
+
const slot = context.sectionPageNumber === 1 && section.page.differentFirstPage === true ? "first" : source.document.settings.evenOddHeaders === true && context.documentPageNumber % 2 === 0 ? "even" : "default";
|
|
3401
|
+
const slots = kind === "header" ? section.headerSlots : section.footerSlots;
|
|
3402
|
+
const sourceSlot = !isUndefined(slots?.[slot]) ? slot : !isUndefined(slots?.default) ? "default" : null;
|
|
3403
|
+
return freezeData({
|
|
3404
|
+
slot,
|
|
3405
|
+
sourceSlot,
|
|
3406
|
+
partId: isNull(sourceSlot) ? null : slots[sourceSlot]
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3409
|
+
/** 结构或范围/区域关系提交在通知前使网格缓存失效;纯文字、样式和字段配置不影响关系。 @internal */
|
|
3410
|
+
invalidate(operations) {
|
|
3411
|
+
if (operations.some((operation) => operation.kind === "splice" || operation.kind === "set" && includes([
|
|
3412
|
+
"range",
|
|
3413
|
+
"parentRegionId",
|
|
3414
|
+
"targetRegionId"
|
|
3415
|
+
], operation.key))) this.tables.clear();
|
|
3416
|
+
}
|
|
3417
|
+
/** 由编辑器关闭时释放关系索引、注册定义及会话访问器,重复关闭安全。 @internal */
|
|
3418
|
+
dispose() {
|
|
3419
|
+
this.tables.clear();
|
|
3420
|
+
this.source = void 0;
|
|
3421
|
+
this.registry = void 0;
|
|
3422
|
+
}
|
|
3423
|
+
/** 所有公开读取都验证会话可用且已提交,拒绝缓存事务中的临时状态。 */
|
|
3424
|
+
read() {
|
|
3425
|
+
if (!this.source || !this.registry) throw new ModelEditError("disposed", "ModelQuery is disposed");
|
|
3426
|
+
return this.source();
|
|
3427
|
+
}
|
|
3428
|
+
/** 取得并核对必需实体类型,缺失或错类时不返回伪造默认节点。 */
|
|
3429
|
+
requireRole(source, id, role) {
|
|
3430
|
+
const entry = source.index.require(id);
|
|
3431
|
+
if (entry.role !== role) throw new ModelEditError("node_type", `Expected ${role}`);
|
|
3432
|
+
return entry.node;
|
|
3433
|
+
}
|
|
3434
|
+
/** 从最近拥有者沿唯一 parentId 链读取,不跨越业务引用。 */
|
|
3435
|
+
ancestors(source, id) {
|
|
3436
|
+
const entries = [];
|
|
3437
|
+
let owner = source.index.require(id).parentId;
|
|
3438
|
+
while (!isUndefined(owner)) {
|
|
3439
|
+
const entry = source.index.require(owner);
|
|
3440
|
+
entries.push(entry);
|
|
3441
|
+
owner = entry.parentId;
|
|
3442
|
+
}
|
|
3443
|
+
return entries;
|
|
3444
|
+
}
|
|
3445
|
+
/** 已校验物理格的拥有链固定为 cell→row→table,不遍历整表定位。 */
|
|
3446
|
+
cellTable(source, cellId) {
|
|
3447
|
+
const rowId = source.index.require(cellId).parentId;
|
|
3448
|
+
const tableId = source.index.require(rowId).parentId;
|
|
3449
|
+
return this.requireRole(source, tableId, "table");
|
|
3450
|
+
}
|
|
3451
|
+
/** 从基类到叶子取同类别样式,缺失和环明确报错,不回退到同名其他类别。 */
|
|
3452
|
+
styleChain(document, kind, id) {
|
|
3453
|
+
const chain = [], seen = /* @__PURE__ */ new Set();
|
|
3454
|
+
let current = id;
|
|
3455
|
+
while (!isUndefined(current)) {
|
|
3456
|
+
if (seen.has(current)) throw new ModelEditError("style_cycle", "Style inheritance cycle");
|
|
3457
|
+
seen.add(current);
|
|
3458
|
+
const style = Object.hasOwn(document.styles[kind], current) ? document.styles[kind][current] : void 0;
|
|
3459
|
+
if (!style) throw new ModelEditError("style_reference", `Missing ${kind} style: ${current}`);
|
|
3460
|
+
chain.unshift(style);
|
|
3461
|
+
current = style.basedOn;
|
|
3462
|
+
}
|
|
3463
|
+
return chain;
|
|
3464
|
+
}
|
|
3465
|
+
/** 默认段落声明先应用,再应用该段的样式链,不把有效结果保存回段落。 */
|
|
3466
|
+
paragraphStyles(document, paragraph) {
|
|
3467
|
+
const defaults = this.styleChain(document, "paragraph", document.settings.defaultParagraphStyleId);
|
|
3468
|
+
return isUndefined(paragraph.paragraphStyleId) || paragraph.paragraphStyleId === document.settings.defaultParagraphStyleId ? defaults : [...defaults, ...this.styleChain(document, "paragraph", paragraph.paragraphStyleId)];
|
|
3469
|
+
}
|
|
3470
|
+
/** 表格无隐式文档默认样式,仅解析其显式样式引用及覆盖。 */
|
|
3471
|
+
tableStyle(document, table) {
|
|
3472
|
+
return mergeStyle(...isUndefined(table.tableStyleId) ? [] : this.styleChain(document, "table", table.tableStyleId).map((style) => style.properties), table.style);
|
|
3473
|
+
}
|
|
3474
|
+
};
|
|
3475
|
+
// src/model/editor/ModelEditor.ts
|
|
3476
|
+
/**
|
|
3477
|
+
* @file 唯一编辑会话:管理文字和字段操作、原子事务、ChangeSet、撤销重做、索引及订阅生命周期。
|
|
3478
|
+
* 阅读定位:editor/ · 创建、编辑、事务、差量与历史。
|
|
3479
|
+
*/
|
|
3480
|
+
/** 唯一文档数据的编辑门面;索引、版本、历史和订阅均属于此会话,不进入模板。 */
|
|
3481
|
+
var ModelEditor = class {
|
|
3482
|
+
current;
|
|
3483
|
+
engine;
|
|
3484
|
+
/** 统一查询门面按需创建,复用本会话文档与身份索引。 */
|
|
3485
|
+
queries;
|
|
3486
|
+
/** 表格命令按需创建,复用相同事务、索引与历史。 */
|
|
3487
|
+
tableEdits;
|
|
3488
|
+
/** 内容范围命令按需创建,选区和剪贴片段不常驻文档会话。 */
|
|
3489
|
+
rangeEdits;
|
|
3490
|
+
/** 其他节点及共享部件命令按需创建,不为节点增加运行时包装。 */
|
|
3491
|
+
nodeEdits;
|
|
3492
|
+
pending;
|
|
3493
|
+
version = 0;
|
|
3494
|
+
notifying = false;
|
|
3495
|
+
registry;
|
|
3496
|
+
validationOptions;
|
|
3497
|
+
createId;
|
|
3498
|
+
historyLimit;
|
|
3499
|
+
reportSubscriberError;
|
|
3500
|
+
issuedIds = /* @__PURE__ */ new Set();
|
|
3501
|
+
undoStack = [];
|
|
3502
|
+
redoStack = [];
|
|
3503
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
3504
|
+
segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
3505
|
+
/** 打开时校验并隔离调用者的数据,只在此建立一次全量身份索引。 */
|
|
3506
|
+
constructor(document, options) {
|
|
3507
|
+
if (!isInteger(options.historyLimit ?? 100) || (options.historyLimit ?? 100) < 0) throw new ModelEditError("history_limit", "historyLimit must be a nonnegative integer");
|
|
3508
|
+
if (!isFunction(options.createId)) throw new ModelEditError("id_factory", "createId is required");
|
|
3509
|
+
this.registry = options.registry ?? new ConfigRegistry();
|
|
3510
|
+
this.validationOptions = {
|
|
3511
|
+
registry: this.registry,
|
|
3512
|
+
maxDepth: options.maxDepth
|
|
3513
|
+
};
|
|
3514
|
+
this.current = readDocument(document, this.validationOptions);
|
|
3515
|
+
const index = new EntityIndex(this.current);
|
|
3516
|
+
this.engine = new OperationEngine(this.current, index);
|
|
3517
|
+
index.descendants([this.current.id]).forEach((id) => this.issuedIds.add(id));
|
|
3518
|
+
this.createId = options.createId;
|
|
3519
|
+
this.historyLimit = options.historyLimit ?? 100;
|
|
3520
|
+
this.reportSubscriberError = options.onSubscriberError ?? ((error) => console.error("Native model subscriber failed", error));
|
|
3521
|
+
}
|
|
3522
|
+
/** 返回只读实时视图;修改必须经过本编辑器,需独立可变副本时调用 snapshot。 */
|
|
3523
|
+
get document() {
|
|
3524
|
+
return this.requireDocument();
|
|
3525
|
+
}
|
|
3526
|
+
/** 当前会话已提交版本;失败事务和空操作不会增加,撤销/重做也只递增。 */
|
|
3527
|
+
get revision() {
|
|
3528
|
+
this.requireDocument();
|
|
3529
|
+
return this.version;
|
|
3530
|
+
}
|
|
3531
|
+
/** 当前已提交文档的统一查询与派生入口;不建立另一份模型或身份索引。 */
|
|
3532
|
+
get query() {
|
|
3533
|
+
this.assertCommitted();
|
|
3534
|
+
return this.queries ??= new ModelQuery(() => {
|
|
3535
|
+
this.assertCommitted();
|
|
3536
|
+
return {
|
|
3537
|
+
document: this.requireDocument(),
|
|
3538
|
+
index: this.requireEngine().index
|
|
3539
|
+
};
|
|
3540
|
+
}, this.registry);
|
|
3541
|
+
}
|
|
3542
|
+
/** 物理网格、合并及区域的高层编辑入口,支持加入外层同步事务。 */
|
|
3543
|
+
get tables() {
|
|
3544
|
+
this.requireDocument();
|
|
3545
|
+
return this.tableEdits ??= new TableEditor(this.editingContext());
|
|
3546
|
+
}
|
|
3547
|
+
/** 跨节点/段落的内容、格式和片段编辑入口,不使用页码或画布坐标。 */
|
|
3548
|
+
get ranges() {
|
|
3549
|
+
this.requireDocument();
|
|
3550
|
+
return this.rangeEdits ??= new RangeEditor(this.editingContext());
|
|
3551
|
+
}
|
|
3552
|
+
/** 图片、组件、章节、页部件和浮层的高层编辑入口。 */
|
|
3553
|
+
get nodes() {
|
|
3554
|
+
this.requireDocument();
|
|
3555
|
+
return this.nodeEdits ??= new NodeEditor(this.editingContext());
|
|
3556
|
+
}
|
|
3557
|
+
/** 当前是否存在可撤销事务;每次显式 transaction 对应一个历史项。 */
|
|
3558
|
+
get canUndo() {
|
|
3559
|
+
this.requireDocument();
|
|
3560
|
+
return this.undoStack.length > 0;
|
|
3561
|
+
}
|
|
3562
|
+
/** 当前是否存在可重做事务;新的有效编辑会清空重做分支。 */
|
|
3563
|
+
get canRedo() {
|
|
3564
|
+
this.requireDocument();
|
|
3565
|
+
return this.redoStack.length > 0;
|
|
3566
|
+
}
|
|
3567
|
+
/** 只读取原生栈中实际保留的事务身份;不导出操作或文档快照,提交通知中可读。 */
|
|
3568
|
+
getHistoryState() {
|
|
3569
|
+
this.assertCommitted();
|
|
3570
|
+
return Object.freeze({
|
|
3571
|
+
undo: Object.freeze(this.undoStack.map((entry) => entry.revision)),
|
|
3572
|
+
redo: Object.freeze(this.redoStack.map((entry) => entry.revision))
|
|
3573
|
+
});
|
|
3574
|
+
}
|
|
3575
|
+
/** 从已提交文档导出独立副本;输入及提交已完成校验,此处只隔离数据。 */
|
|
3576
|
+
snapshot() {
|
|
3577
|
+
this.assertCommitted();
|
|
3578
|
+
return cloneJsonData(this.requireDocument());
|
|
3579
|
+
}
|
|
3580
|
+
/** 使用原生 JSON 协议保存当前文档,不导出 revision、索引、历史或订阅器。 */
|
|
3581
|
+
serialize(space) {
|
|
3582
|
+
this.assertCommitted();
|
|
3583
|
+
return JSON.stringify(this.requireDocument(), null, space);
|
|
3584
|
+
}
|
|
3585
|
+
/** 完整替换一份业务声明,不执行规则,不改写其他命名空间或复制文档树到运行时。 */
|
|
3586
|
+
setBusinessConfig(name, value, version) {
|
|
3587
|
+
return this.run("setBusinessConfig", () => {
|
|
3588
|
+
checkFactoryValue(name, extensionName, "/name");
|
|
3589
|
+
const builtin = documentBusinessSchemas.find((schema) => schema.name === name);
|
|
3590
|
+
if (isUndefined(version) && !builtin) throw new ModelEditError("business_version", "Extension business config needs an explicit version");
|
|
3591
|
+
const resolvedVersion = version ?? builtin.version;
|
|
3592
|
+
checkFactoryValue(resolvedVersion, number(1, true), "/version");
|
|
3593
|
+
const business = this.requireDocument().business;
|
|
3594
|
+
this.record({
|
|
3595
|
+
kind: "business",
|
|
3596
|
+
name,
|
|
3597
|
+
beforePresent: Object.hasOwn(business, "configs"),
|
|
3598
|
+
afterPresent: true,
|
|
3599
|
+
before: readPropertyValue(business.configs ?? {}, name),
|
|
3600
|
+
after: {
|
|
3601
|
+
present: true,
|
|
3602
|
+
value: {
|
|
3603
|
+
version: resolvedVersion,
|
|
3604
|
+
value: copyInputData(value)
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
});
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
/** 删除一个业务配置,最后一项删除后移除可选 configs,撤销恢复原始属性存在性。 */
|
|
3611
|
+
removeBusinessConfig(name) {
|
|
3612
|
+
return this.run("removeBusinessConfig", () => {
|
|
3613
|
+
checkFactoryValue(name, extensionName, "/name");
|
|
3614
|
+
const configs = this.requireDocument().business.configs;
|
|
3615
|
+
if (!configs || !Object.hasOwn(configs, name)) return;
|
|
3616
|
+
this.record({
|
|
3617
|
+
kind: "business",
|
|
3618
|
+
name,
|
|
3619
|
+
beforePresent: true,
|
|
3620
|
+
afterPresent: Object.keys(configs).length > 1,
|
|
3621
|
+
before: readPropertyValue(configs, name),
|
|
3622
|
+
after: { present: false }
|
|
3623
|
+
});
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
/** 订阅完整提交事件,返回幂等取消函数;事件载荷已冻结,订阅异常不回滚提交。 */
|
|
3627
|
+
subscribe(listener) {
|
|
3628
|
+
this.requireDocument();
|
|
3629
|
+
this.subscribers.add(listener);
|
|
3630
|
+
return () => {
|
|
3631
|
+
this.subscribers.delete(listener);
|
|
3632
|
+
};
|
|
3633
|
+
}
|
|
3634
|
+
/** 同步原子批处理:允许中间引用暂不完整,结束时统一校验;任一编辑失败则全部回滚。 */
|
|
3635
|
+
transaction(label, action) {
|
|
3636
|
+
return this.run(label, () => {
|
|
3637
|
+
const result = action(this);
|
|
3638
|
+
if (!isUndefined(result)) throw new ModelEditError("async_transaction", "Transaction callback must be synchronous and return undefined");
|
|
3639
|
+
});
|
|
3640
|
+
}
|
|
3641
|
+
/** 在一个文字片段中插入内容,保持原 ID;offset 是字素边界上的 UTF-16 偏移。 */
|
|
3642
|
+
insertText(nodeId, offset, text) {
|
|
3643
|
+
return this.replaceText(nodeId, offset, offset, text);
|
|
3644
|
+
}
|
|
3645
|
+
/** 删除 [start,end) 范围;禁止拆开代理对、组合字符或 emoji 的字素。 */
|
|
3646
|
+
deleteText(nodeId, start, end) {
|
|
3647
|
+
return this.replaceText(nodeId, start, end, "");
|
|
3648
|
+
}
|
|
3649
|
+
/** 替换局部文字,差量大小只与被替换/插入内容有关;纯文字事务不校验/复制整树。 */
|
|
3650
|
+
replaceText(nodeId, start, end, text) {
|
|
3651
|
+
return this.run("replaceText", () => {
|
|
3652
|
+
const node = this.text(nodeId);
|
|
3653
|
+
if (!isString(text)) throw new ModelEditError("text", "Expected inserted string");
|
|
3654
|
+
this.boundary(node.text, start);
|
|
3655
|
+
this.boundary(node.text, end);
|
|
3656
|
+
if (end < start) throw new ModelEditError("range", "Text range is reversed");
|
|
3657
|
+
if (node.text.slice(start, end) === text) return;
|
|
3658
|
+
this.record({
|
|
3659
|
+
kind: "text",
|
|
3660
|
+
nodeId,
|
|
3661
|
+
offset: start,
|
|
3662
|
+
remove: node.text.slice(start, end),
|
|
3663
|
+
insert: text
|
|
3664
|
+
});
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3667
|
+
/** 拆成相邻文字片段:左段保留 ID,右段分配新 ID;首尾拆分视为空操作。 */
|
|
3668
|
+
splitText(nodeId, offset) {
|
|
3669
|
+
return this.run("splitText", () => {
|
|
3670
|
+
this.splitTextAt(nodeId, offset);
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
/** 合并同段落内相邻且显式样式一致的文字;保留左 ID,并提供右位置到左位置的映射。 */
|
|
3674
|
+
mergeText(leftId, rightId) {
|
|
3675
|
+
return this.run("mergeText", () => {
|
|
3676
|
+
this.mergeTextPair(leftId, rightId);
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
/** 显式规范化一个段落,逐对合并相邻同样式文字,不跨字段/图片/段落或单元格。 */
|
|
3680
|
+
normalizeText(paragraphId) {
|
|
3681
|
+
return this.run("normalizeText", () => {
|
|
3682
|
+
const paragraph = this.paragraph(paragraphId);
|
|
3683
|
+
for (let i = 0; i + 1 < paragraph.content.length;) {
|
|
3684
|
+
const left = paragraph.content[i], right = paragraph.content[i + 1];
|
|
3685
|
+
if (left.kind === "text" && right.kind === "text" && this.sameFormatting(left, right, ["textStyleId", "textStyle"])) this.mergeTextPair(left.id, right.id);
|
|
3686
|
+
else i++;
|
|
3687
|
+
}
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
/** 在行内节点边界或文字内部拆段,继承段落声明;移动的内容身份不变。 */
|
|
3691
|
+
splitParagraph(paragraphId, point) {
|
|
3692
|
+
return this.run("splitParagraph", () => {
|
|
3693
|
+
const paragraph = this.paragraph(paragraphId), location = this.location(paragraphId);
|
|
3694
|
+
this.range(point.index, 0, paragraph.content.length);
|
|
3695
|
+
let index = point.index;
|
|
3696
|
+
if (!isUndefined(point.offset)) {
|
|
3697
|
+
const inline = paragraph.content[index];
|
|
3698
|
+
if (!inline || inline.kind !== "text") throw new ModelEditError("node_type", "Paragraph offset requires a text node");
|
|
3699
|
+
this.boundary(inline.text, point.offset);
|
|
3700
|
+
if (point.offset === inline.text.length) index++;
|
|
3701
|
+
else if (point.offset > 0) {
|
|
3702
|
+
this.splitTextAt(inline.id, point.offset);
|
|
3703
|
+
index++;
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
const tail = copyData(paragraph.content.slice(index));
|
|
3707
|
+
const next = {
|
|
3708
|
+
id: this.allocateId(),
|
|
3709
|
+
kind: "paragraph",
|
|
3710
|
+
content: tail
|
|
3711
|
+
};
|
|
3712
|
+
for (const key of [
|
|
3713
|
+
"paragraphStyleId",
|
|
3714
|
+
"paragraphStyle",
|
|
3715
|
+
"textStyleId",
|
|
3716
|
+
"textStyle"
|
|
3717
|
+
]) if (Object.hasOwn(paragraph, key)) Object.defineProperty(next, key, {
|
|
3718
|
+
value: copyData(paragraph[key]),
|
|
3719
|
+
writable: true,
|
|
3720
|
+
enumerable: true,
|
|
3721
|
+
configurable: true
|
|
3722
|
+
});
|
|
3723
|
+
this.splice({
|
|
3724
|
+
parentId: paragraphId,
|
|
3725
|
+
collection: "content",
|
|
3726
|
+
index
|
|
3727
|
+
}, tail.length, []);
|
|
3728
|
+
this.splice({
|
|
3729
|
+
...location,
|
|
3730
|
+
index: location.index + 1
|
|
3731
|
+
}, 0, [next]);
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
/** 合并相邻且段落声明一致的段落;不同声明需调用方先明确样式,避免改变继承语义。 */
|
|
3735
|
+
joinParagraphs(leftId, rightId) {
|
|
3736
|
+
return this.run("joinParagraphs", () => {
|
|
3737
|
+
const left = this.paragraph(leftId), right = this.paragraph(rightId);
|
|
3738
|
+
const a = this.location(leftId), b = this.location(rightId);
|
|
3739
|
+
if (a.parentId !== b.parentId || a.collection !== b.collection || a.index + 1 !== b.index) throw new ModelEditError("adjacency", "Paragraphs must be adjacent siblings");
|
|
3740
|
+
if (!this.sameFormatting(left, right, [
|
|
3741
|
+
"paragraphStyleId",
|
|
3742
|
+
"paragraphStyle",
|
|
3743
|
+
"textStyleId",
|
|
3744
|
+
"textStyle"
|
|
3745
|
+
])) throw new ModelEditError("style", "Paragraph declarations differ");
|
|
3746
|
+
const content = copyData(right.content);
|
|
3747
|
+
this.splice({
|
|
3748
|
+
parentId: rightId,
|
|
3749
|
+
collection: "content",
|
|
3750
|
+
index: 0
|
|
3751
|
+
}, right.content.length, []);
|
|
3752
|
+
this.splice({
|
|
3753
|
+
parentId: leftId,
|
|
3754
|
+
collection: "content",
|
|
3755
|
+
index: left.content.length
|
|
3756
|
+
}, 0, content);
|
|
3757
|
+
this.splice(b, 1, []);
|
|
3758
|
+
this.normalizeText(leftId);
|
|
3759
|
+
});
|
|
3760
|
+
}
|
|
3761
|
+
/** 插入调用方创建的新实体;载荷会隔离,重复 ID 或提交后无效的结构会被拒绝。 */
|
|
3762
|
+
insertNodes(point, nodes) {
|
|
3763
|
+
return this.run("insertNodes", () => {
|
|
3764
|
+
this.splice(point, 0, copyInputData([...nodes]));
|
|
3765
|
+
});
|
|
3766
|
+
}
|
|
3767
|
+
/** 创建并插入段落,复用本会话 ID 工厂;作为一个事务提交,不要求调用方拼节点对象。 */
|
|
3768
|
+
insertParagraph(point, options = {}) {
|
|
3769
|
+
let nodeId = "";
|
|
3770
|
+
const change = this.run("insertParagraph", () => {
|
|
3771
|
+
const node = this.withFactory((factory) => factory.createParagraph(options));
|
|
3772
|
+
nodeId = node.id;
|
|
3773
|
+
this.insertNodes(point, [node]);
|
|
3774
|
+
});
|
|
3775
|
+
return {
|
|
3776
|
+
nodeId,
|
|
3777
|
+
change
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
/** 创建并插入普通表的物理网格,不执行行列扩缩或业务区域的自动修复。 */
|
|
3781
|
+
insertTable(point, options) {
|
|
3782
|
+
let nodeId = "";
|
|
3783
|
+
const change = this.run("insertTable", () => {
|
|
3784
|
+
const node = this.withFactory((factory) => factory.createTable(options));
|
|
3785
|
+
nodeId = node.id;
|
|
3786
|
+
this.insertNodes(point, [node]);
|
|
3787
|
+
});
|
|
3788
|
+
return {
|
|
3789
|
+
nodeId,
|
|
3790
|
+
change
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
/** 在节点边界或文字内部插入常用/注册扩展字段,自动处理绑定,拆分与插入共用一个撤销项。 */
|
|
3794
|
+
insertField(paragraphId, point, options) {
|
|
3795
|
+
let nodeId = "", bindingId = "";
|
|
3796
|
+
let insertedIndex = 0;
|
|
3797
|
+
const change = this.run("insertField", () => {
|
|
3798
|
+
const paragraph = this.paragraph(paragraphId);
|
|
3799
|
+
const at = readFactoryOptions(point, ["index", "offset"]);
|
|
3800
|
+
this.range(at.index, 0, paragraph.content.length);
|
|
3801
|
+
const copied = copyInputData(options);
|
|
3802
|
+
if (!isObject(copied)) throw new ModelEditError("factory_options", "Expected field options");
|
|
3803
|
+
if (Object.hasOwn(copied, "binding") === Object.hasOwn(copied, "bindingId")) throw new ModelEditError("binding_input", "Provide binding or bindingId");
|
|
3804
|
+
bindingId = this.resolveFieldBinding("binding" in copied ? { binding: copied.binding } : { bindingId: copied.bindingId });
|
|
3805
|
+
const { binding: _binding, bindingId: _bindingId, ...declaration } = copied;
|
|
3806
|
+
const created = this.withFactory((factory) => factory.createField({
|
|
3807
|
+
...declaration,
|
|
3808
|
+
bindingId
|
|
3809
|
+
}));
|
|
3810
|
+
let index = at.index;
|
|
3811
|
+
if (!isUndefined(at.offset)) {
|
|
3812
|
+
const inline = paragraph.content[index];
|
|
3813
|
+
if (!inline || inline.kind !== "text") throw new ModelEditError("node_type", "Offset requires a text node");
|
|
3814
|
+
this.boundary(inline.text, at.offset);
|
|
3815
|
+
if (at.offset === inline.text.length) index++;
|
|
3816
|
+
else if (at.offset > 0) {
|
|
3817
|
+
this.splitTextAt(inline.id, at.offset);
|
|
3818
|
+
index++;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
nodeId = created.node.id;
|
|
3822
|
+
this.insertNodes({
|
|
3823
|
+
parentId: paragraphId,
|
|
3824
|
+
collection: "content",
|
|
3825
|
+
index
|
|
3826
|
+
}, [created.node]);
|
|
3827
|
+
insertedIndex = index;
|
|
3828
|
+
});
|
|
3829
|
+
return {
|
|
3830
|
+
nodeId,
|
|
3831
|
+
bindingId,
|
|
3832
|
+
change,
|
|
3833
|
+
point: {
|
|
3834
|
+
paragraphId,
|
|
3835
|
+
index: insertedIndex + 1
|
|
3836
|
+
}
|
|
3837
|
+
};
|
|
3838
|
+
}
|
|
3839
|
+
/** 浅层修改常用字段配置;嵌套对象完整替换,unset 恢复缺省,不改其他实例的配置。 */
|
|
3840
|
+
updateFieldConfig(fieldId, update) {
|
|
3841
|
+
return this.run("updateFieldConfig", () => {
|
|
3842
|
+
const node = this.commonField(fieldId);
|
|
3843
|
+
const patch = readFactoryOptions(update, [
|
|
3844
|
+
"widget",
|
|
3845
|
+
"set",
|
|
3846
|
+
"unset"
|
|
3847
|
+
]);
|
|
3848
|
+
if (patch.widget !== node.widget) throw new ModelEditError("field_widget", "Field widget does not match update");
|
|
3849
|
+
if (!isUndefined(patch.set) && !isObject(patch.set)) throw new ModelEditError("field_config", "set must be an object");
|
|
3850
|
+
if (!isUndefined(patch.unset)) checkFactoryValue(patch.unset, array(nonempty), "/unset");
|
|
3851
|
+
for (const key of patch.unset ?? []) if (Object.hasOwn(patch.set ?? {}, key)) throw new ModelEditError("field_config", `Cannot set and unset ${key}`);
|
|
3852
|
+
const next = {
|
|
3853
|
+
...node.config,
|
|
3854
|
+
...patch.set
|
|
3855
|
+
};
|
|
3856
|
+
for (const key of patch.unset ?? []) delete next[key];
|
|
3857
|
+
if (equalData(node.config ?? {}, next)) return;
|
|
3858
|
+
if (isEmptyObject(next) && node.widget !== "choice") this.unsetProperty(fieldId, "config");
|
|
3859
|
+
else this.setProperty(fieldId, "config", next);
|
|
3860
|
+
});
|
|
3861
|
+
}
|
|
3862
|
+
/** 修改当前字段的绑定引用;新声明复用等价绑定,不就地改写其他字段共享的绑定。 */
|
|
3863
|
+
setFieldBinding(fieldId, binding, options = {}) {
|
|
3864
|
+
return this.run("setFieldBinding", () => {
|
|
3865
|
+
const node = this.field(fieldId), settings = readRemovalOptions(options), previous = node.bindingId;
|
|
3866
|
+
const bindingId = this.resolveFieldBinding(binding);
|
|
3867
|
+
this.setProperty(fieldId, "bindingId", bindingId);
|
|
3868
|
+
if (previous !== bindingId) this.cleanupDefinitions({ bindings: /* @__PURE__ */ new Set([previous]) }, settings);
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
/** 追加选项时仅分配一次局部 ID,保留已有选项、默认项及附属内容,统一进入原生历史。 */
|
|
3872
|
+
appendChoiceOption(fieldId, options) {
|
|
3873
|
+
let optionId = "";
|
|
3874
|
+
const change = this.run("appendChoiceOption", () => {
|
|
3875
|
+
const node = this.field(fieldId);
|
|
3876
|
+
if (node.widget !== "choice") throw new ModelEditError("field_widget", "Expected choice field");
|
|
3877
|
+
const created = this.withFactory((factory) => factory.createChoiceOption(options));
|
|
3878
|
+
optionId = created.id;
|
|
3879
|
+
this.setChoiceOptions(fieldId, [...node.config.options, created]);
|
|
3880
|
+
});
|
|
3881
|
+
return {
|
|
3882
|
+
optionId,
|
|
3883
|
+
change
|
|
3884
|
+
};
|
|
3885
|
+
}
|
|
3886
|
+
/** 替换枚举选项及默认项;失效附属条件默认拒绝,remove 策略才同步移除关联内容。 */
|
|
3887
|
+
setChoiceOptions(fieldId, options, update = {}) {
|
|
3888
|
+
return this.run("setChoiceOptions", () => {
|
|
3889
|
+
const node = this.field(fieldId);
|
|
3890
|
+
if (node.widget !== "choice") throw new ModelEditError("field_widget", "Expected choice field");
|
|
3891
|
+
const settings = readFactoryOptions(update, ["defaultOptionIds", "orphanPolicy"]);
|
|
3892
|
+
checkFactoryValue(settings, object({
|
|
3893
|
+
defaultOptionIds: optional(array(nonempty)),
|
|
3894
|
+
orphanPolicy: optional(oneOf("reject", "remove"))
|
|
3895
|
+
}));
|
|
3896
|
+
const copied = copyInputData(options);
|
|
3897
|
+
if (!isArray(copied)) throw new ModelEditError("field_options", "Expected options array");
|
|
3898
|
+
const errors = [];
|
|
3899
|
+
this.registry.validate("field", "choice", node.configVersion ?? 1, {
|
|
3900
|
+
...node.config,
|
|
3901
|
+
options: copied,
|
|
3902
|
+
defaultOptionIds: []
|
|
3903
|
+
}, "/config", errors);
|
|
3904
|
+
if (errors.length) throw new DocumentValidationError(errors);
|
|
3905
|
+
const ids = new Set(copied.map((option) => option.id)), config = {
|
|
3906
|
+
...node.config,
|
|
3907
|
+
options: [...copied]
|
|
3908
|
+
};
|
|
3909
|
+
if (!isUndefined(settings.defaultOptionIds)) config.defaultOptionIds = [...settings.defaultOptionIds];
|
|
3910
|
+
else if (settings.orphanPolicy === "remove" && config.defaultOptionIds) config.defaultOptionIds = config.defaultOptionIds.filter((id) => ids.has(id));
|
|
3911
|
+
const removed = node.attachments?.filter((item) => item.when.kind === "option" && !ids.has(item.when.optionId)) ?? [];
|
|
3912
|
+
if (removed.length && settings.orphanPolicy !== "remove") throw new ModelEditError("field_attachment", "Options still have attached content");
|
|
3913
|
+
const definitions = this.collectDefinitions(removed.map((item) => item.id));
|
|
3914
|
+
for (const attachment of removed) this.removeAttachmentNode(fieldId, attachment.id);
|
|
3915
|
+
this.setProperty(fieldId, "config", config);
|
|
3916
|
+
this.cleanupDefinitions(definitions);
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3919
|
+
/** 确保指定条件有独立内容根;已有根复用原身份,新根保持空块,真实输入时再创建段落。 */
|
|
3920
|
+
ensureFieldAttachment(fieldId, when) {
|
|
3921
|
+
let nodeId = "";
|
|
3922
|
+
const change = this.run("ensureFieldAttachment", () => {
|
|
3923
|
+
nodeId = this.ensureAttachmentNode(fieldId, when).id;
|
|
3924
|
+
});
|
|
3925
|
+
return {
|
|
3926
|
+
nodeId,
|
|
3927
|
+
change
|
|
3928
|
+
};
|
|
3929
|
+
}
|
|
3930
|
+
/** 给真假值或选项追加附属字段,自动建立必要容器和段落,绑定与结构只提交一次。 */
|
|
3931
|
+
insertAttachedField(fieldId, when, options) {
|
|
3932
|
+
let nodeId = "", bindingId = "";
|
|
3933
|
+
let point = {
|
|
3934
|
+
paragraphId: "",
|
|
3935
|
+
index: 0
|
|
3936
|
+
};
|
|
3937
|
+
const change = this.run("insertAttachedField", () => {
|
|
3938
|
+
const attachment = this.ensureAttachmentNode(fieldId, when, true);
|
|
3939
|
+
let paragraph = attachment.blocks.at(-1);
|
|
3940
|
+
if (!paragraph || paragraph.kind !== "paragraph") {
|
|
3941
|
+
const result = this.insertParagraph({
|
|
3942
|
+
parentId: attachment.id,
|
|
3943
|
+
collection: "blocks",
|
|
3944
|
+
index: attachment.blocks.length
|
|
3945
|
+
});
|
|
3946
|
+
paragraph = this.paragraph(result.nodeId);
|
|
3947
|
+
}
|
|
3948
|
+
const inserted = this.insertField(paragraph.id, { index: paragraph.content.length }, options);
|
|
3949
|
+
nodeId = inserted.nodeId;
|
|
3950
|
+
bindingId = inserted.bindingId;
|
|
3951
|
+
point = inserted.point;
|
|
3952
|
+
});
|
|
3953
|
+
return {
|
|
3954
|
+
nodeId,
|
|
3955
|
+
bindingId,
|
|
3956
|
+
change,
|
|
3957
|
+
point
|
|
3958
|
+
};
|
|
3959
|
+
}
|
|
3960
|
+
/** 删除指定条件的整个附属内容,并按明确选项清理本次涉及的无引用绑定和资产。 */
|
|
3961
|
+
removeFieldAttachment(fieldId, when, options = {}) {
|
|
3962
|
+
return this.run("removeFieldAttachment", () => {
|
|
3963
|
+
const node = this.field(fieldId), condition = this.checkAttachmentCondition(node, when), settings = readRemovalOptions(options);
|
|
3964
|
+
const attachment = node.attachments?.find((item) => equalData(item.when, condition));
|
|
3965
|
+
if (!attachment) return;
|
|
3966
|
+
const definitions = this.collectDefinitions([attachment.id]);
|
|
3967
|
+
this.removeAttachmentNode(fieldId, attachment.id);
|
|
3968
|
+
this.cleanupDefinitions(definitions, settings);
|
|
3969
|
+
});
|
|
3970
|
+
}
|
|
3971
|
+
/** 删除字段及其附属内容,默认清理候选无引用绑定和资产,并局部合并相邻同样式文字。 */
|
|
3972
|
+
removeField(fieldId, options = {}) {
|
|
3973
|
+
return this.run("removeField", () => {
|
|
3974
|
+
this.field(fieldId);
|
|
3975
|
+
const settings = readRemovalOptions(options), definitions = this.collectDefinitions([fieldId]), location = this.location(fieldId);
|
|
3976
|
+
this.removeNodes({
|
|
3977
|
+
...location,
|
|
3978
|
+
count: 1
|
|
3979
|
+
});
|
|
3980
|
+
this.normalizeText(location.parentId);
|
|
3981
|
+
this.cleanupDefinitions(definitions, settings);
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
/** 删除连续拥有节点;引用同步调整应放在同一 transaction,悬挂引用会导致回滚。 */
|
|
3985
|
+
removeNodes(range) {
|
|
3986
|
+
return this.run("removeNodes", () => {
|
|
3987
|
+
this.splice(range, range.count, []);
|
|
3988
|
+
});
|
|
3989
|
+
}
|
|
3990
|
+
/** 移动连续片段,保留全部身份;目标 index 按移动前数组解释,不能移入自身子树。 */
|
|
3991
|
+
moveNodes(source, target) {
|
|
3992
|
+
return this.run("moveNodes", () => {
|
|
3993
|
+
const index = this.requireEngine().index;
|
|
3994
|
+
const list = index.list(source.parentId, source.collection);
|
|
3995
|
+
this.range(source.index, source.count, list.length);
|
|
3996
|
+
this.range(target.index, 0, index.list(target.parentId, target.collection).length);
|
|
3997
|
+
if (!source.count) return;
|
|
3998
|
+
const nodes = copyData(list.slice(source.index, source.index + source.count));
|
|
3999
|
+
if (index.descendants(nodes.map((node) => node.id)).has(target.parentId)) throw new ModelEditError("ownership_cycle", "Cannot move content into itself");
|
|
4000
|
+
let destination = target.index;
|
|
4001
|
+
if (source.parentId === target.parentId && source.collection === target.collection) {
|
|
4002
|
+
if (destination >= source.index && destination <= source.index + source.count) return;
|
|
4003
|
+
if (destination > source.index) destination -= source.count;
|
|
4004
|
+
}
|
|
4005
|
+
this.splice(source, source.count, []);
|
|
4006
|
+
this.splice({
|
|
4007
|
+
...target,
|
|
4008
|
+
index: destination
|
|
4009
|
+
}, 0, nodes);
|
|
4010
|
+
});
|
|
4011
|
+
}
|
|
4012
|
+
/** 复制连续片段,重建拥有实体 ID 并重写内部引用;绑定/资源/共享样式保持共享。 */
|
|
4013
|
+
copyNodes(source, target) {
|
|
4014
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
4015
|
+
const rootIds = [];
|
|
4016
|
+
return {
|
|
4017
|
+
change: this.run("copyNodes", () => {
|
|
4018
|
+
const list = this.requireEngine().index.list(source.parentId, source.collection);
|
|
4019
|
+
this.range(source.index, source.count, list.length);
|
|
4020
|
+
const cloned = this.cloneOwned(target, list.slice(source.index, source.index + source.count));
|
|
4021
|
+
const copies = cloned.nodes;
|
|
4022
|
+
cloned.idMap.forEach((id, oldId) => idMap.set(oldId, id));
|
|
4023
|
+
rootIds.push(...copies.map((node) => node.id));
|
|
4024
|
+
this.splice(target, 0, copies);
|
|
4025
|
+
}),
|
|
4026
|
+
rootIds: Object.freeze(rootIds),
|
|
4027
|
+
idMap: new Map(idMap)
|
|
4028
|
+
};
|
|
4029
|
+
}
|
|
4030
|
+
/** 设置一项允许的声明属性;显式 false/0/空字符串保留,undefined 必须改用 unsetProperty。 */
|
|
4031
|
+
setProperty(nodeId, key, value) {
|
|
4032
|
+
return this.run("setProperty", () => {
|
|
4033
|
+
const before = readPropertyValue(this.requireEngine().index.require(nodeId).node, key);
|
|
4034
|
+
const after = {
|
|
4035
|
+
present: true,
|
|
4036
|
+
value: copyInputData(value)
|
|
4037
|
+
};
|
|
4038
|
+
if (!equalData(before, after)) this.record({
|
|
4039
|
+
kind: "set",
|
|
4040
|
+
nodeId,
|
|
4041
|
+
key,
|
|
4042
|
+
before,
|
|
4043
|
+
after
|
|
4044
|
+
});
|
|
4045
|
+
});
|
|
4046
|
+
}
|
|
4047
|
+
/** 删除一个覆盖属性以恢复继承;缺省属性本身为空操作。 */
|
|
4048
|
+
unsetProperty(nodeId, key) {
|
|
4049
|
+
return this.run("unsetProperty", () => {
|
|
4050
|
+
const before = readPropertyValue(this.requireEngine().index.require(nodeId).node, key);
|
|
4051
|
+
if (before.present) this.record({
|
|
4052
|
+
kind: "set",
|
|
4053
|
+
nodeId,
|
|
4054
|
+
key,
|
|
4055
|
+
before,
|
|
4056
|
+
after: { present: false }
|
|
4057
|
+
});
|
|
4058
|
+
});
|
|
4059
|
+
}
|
|
4060
|
+
/** 完整替换文字直接样式对象;不展开继承值或改共享定义,保留旧键需调用方先合并声明。 */
|
|
4061
|
+
setTextStyle(nodeId, style) {
|
|
4062
|
+
return this.setProperty(nodeId, "textStyle", style);
|
|
4063
|
+
}
|
|
4064
|
+
/** 完整替换段落直接样式对象;其他实体类型拒绝,恢复继承使用 unsetProperty。 */
|
|
4065
|
+
setParagraphStyle(nodeId, style) {
|
|
4066
|
+
return this.setProperty(nodeId, "paragraphStyle", style);
|
|
4067
|
+
}
|
|
4068
|
+
/** 按单项维护样式/资源/绑定;新增绑定和插入其字段可放在同一原子事务中。 */
|
|
4069
|
+
setDictionary(name, key, value) {
|
|
4070
|
+
return this.run("setDictionary", () => {
|
|
4071
|
+
const before = readPropertyValue(this.requireEngine().dictionary(name), key);
|
|
4072
|
+
const after = {
|
|
4073
|
+
present: true,
|
|
4074
|
+
value: copyInputData(value)
|
|
4075
|
+
};
|
|
4076
|
+
if (!equalData(before, after)) this.record({
|
|
4077
|
+
kind: "dictionary",
|
|
4078
|
+
dictionary: name,
|
|
4079
|
+
key,
|
|
4080
|
+
before,
|
|
4081
|
+
after
|
|
4082
|
+
});
|
|
4083
|
+
});
|
|
4084
|
+
}
|
|
4085
|
+
/** 移除一项共享定义;仍被引用时须同步改引用,否则整个事务回滚。 */
|
|
4086
|
+
unsetDictionary(name, key) {
|
|
4087
|
+
return this.run("unsetDictionary", () => {
|
|
4088
|
+
const before = readPropertyValue(this.requireEngine().dictionary(name), key);
|
|
4089
|
+
if (before.present) this.record({
|
|
4090
|
+
kind: "dictionary",
|
|
4091
|
+
dictionary: name,
|
|
4092
|
+
key,
|
|
4093
|
+
before,
|
|
4094
|
+
after: { present: false }
|
|
4095
|
+
});
|
|
4096
|
+
});
|
|
4097
|
+
}
|
|
4098
|
+
/** 撤销最近完整事务;使用反向差量,版本继续递增,节点 ID 不重新生成。 */
|
|
4099
|
+
undo() {
|
|
4100
|
+
this.assertIdle();
|
|
4101
|
+
const item = this.undoStack.at(-1);
|
|
4102
|
+
if (!item) return null;
|
|
4103
|
+
return this.run(`undo:${item.label}`, () => {
|
|
4104
|
+
item.inverseOperations.forEach((operation) => this.record(operation, []));
|
|
4105
|
+
this.pending.maps = copyData(item.inversePositionMaps);
|
|
4106
|
+
}, "undo");
|
|
4107
|
+
}
|
|
4108
|
+
/** 重做最近撤销的事务;复用原操作中分配的 ID 和全部前置条件。 */
|
|
4109
|
+
redo() {
|
|
4110
|
+
this.assertIdle();
|
|
4111
|
+
const item = this.redoStack.at(-1);
|
|
4112
|
+
if (!item) return null;
|
|
4113
|
+
return this.run(`redo:${item.label}`, () => {
|
|
4114
|
+
item.operations.forEach((operation) => this.record(operation, []));
|
|
4115
|
+
this.pending.maps = copyData(item.positionMaps);
|
|
4116
|
+
}, "redo");
|
|
4117
|
+
}
|
|
4118
|
+
/** 重放相同文档/相同版本的本地 ChangeSet;不做并发重基,旧值或版本冲突时拒绝提交。 */
|
|
4119
|
+
applyChangeSet(change) {
|
|
4120
|
+
this.assertIdle();
|
|
4121
|
+
const issues = validateChangeSet(change);
|
|
4122
|
+
if (issues.length) throw new ModelEditError("change_set", `${issues[0].path}: ${issues[0].message}`);
|
|
4123
|
+
if (change.documentId !== this.requireDocument().id || change.baseRevision !== this.version) throw new ModelEditError("revision", "ChangeSet document or base revision differs");
|
|
4124
|
+
return this.run(change.label, () => {
|
|
4125
|
+
change.operations.forEach((operation) => this.record(operation, []));
|
|
4126
|
+
this.pending.maps = copyData(change.positionMaps);
|
|
4127
|
+
}, "replay");
|
|
4128
|
+
}
|
|
4129
|
+
/** 清空撤销与重做载荷,不改文档或版本;不会影响已交给调用方的 ChangeSet。 */
|
|
4130
|
+
clearHistory() {
|
|
4131
|
+
this.assertIdle();
|
|
4132
|
+
this.undoStack.length = 0;
|
|
4133
|
+
this.redoStack.length = 0;
|
|
4134
|
+
}
|
|
4135
|
+
/** 关闭会话并释放文档、索引、历史及订阅引用;关闭后不能继续操作,重复关闭安全。 */
|
|
4136
|
+
dispose() {
|
|
4137
|
+
if (!this.current) return;
|
|
4138
|
+
this.assertIdle();
|
|
4139
|
+
this.queries?.dispose();
|
|
4140
|
+
this.queries = void 0;
|
|
4141
|
+
this.tableEdits?.dispose();
|
|
4142
|
+
this.tableEdits = void 0;
|
|
4143
|
+
this.rangeEdits?.dispose();
|
|
4144
|
+
this.rangeEdits = void 0;
|
|
4145
|
+
this.nodeEdits?.dispose();
|
|
4146
|
+
this.nodeEdits = void 0;
|
|
4147
|
+
this.engine?.index.clear();
|
|
4148
|
+
this.engine = void 0;
|
|
4149
|
+
this.current = void 0;
|
|
4150
|
+
this.undoStack.length = 0;
|
|
4151
|
+
this.redoStack.length = 0;
|
|
4152
|
+
this.subscribers.clear();
|
|
4153
|
+
this.issuedIds.clear();
|
|
4154
|
+
this.registry = void 0;
|
|
4155
|
+
this.validationOptions = {};
|
|
4156
|
+
this.createId = void 0;
|
|
4157
|
+
this.reportSubscriberError = void 0;
|
|
4158
|
+
}
|
|
4159
|
+
/** 加入当前事务或创建顶层事务;失败标记不可被回调捕获后忽略,防止部分提交。 */
|
|
4160
|
+
run(label, action, source = "edit") {
|
|
4161
|
+
this.requireDocument();
|
|
4162
|
+
if (this.notifying) throw new ModelEditError("reentrant_edit", "Subscribers cannot synchronously edit the document");
|
|
4163
|
+
if (this.pending) {
|
|
4164
|
+
if (this.pending.failed) throw new ModelEditError("failed_transaction", "Transaction already failed");
|
|
4165
|
+
try {
|
|
4166
|
+
action();
|
|
4167
|
+
} catch (error) {
|
|
4168
|
+
this.pending.failed = true;
|
|
4169
|
+
this.pending.error = error;
|
|
4170
|
+
throw error;
|
|
4171
|
+
}
|
|
4172
|
+
return null;
|
|
4173
|
+
}
|
|
4174
|
+
const pending = {
|
|
4175
|
+
operations: [],
|
|
4176
|
+
maps: [],
|
|
4177
|
+
affected: /* @__PURE__ */ new Set(),
|
|
4178
|
+
removed: /* @__PURE__ */ new Set(),
|
|
4179
|
+
inserted: /* @__PURE__ */ new Set(),
|
|
4180
|
+
failed: false
|
|
4181
|
+
};
|
|
4182
|
+
this.pending = pending;
|
|
4183
|
+
try {
|
|
4184
|
+
action();
|
|
4185
|
+
if (pending.failed) throw pending.error;
|
|
4186
|
+
if (!pending.operations.length) {
|
|
4187
|
+
this.pending = void 0;
|
|
4188
|
+
return null;
|
|
4189
|
+
}
|
|
4190
|
+
this.validatePending(pending.operations);
|
|
4191
|
+
} catch (error) {
|
|
4192
|
+
try {
|
|
4193
|
+
for (const operation of [...pending.operations].reverse()) this.requireEngine().apply(invertOperation(operation));
|
|
4194
|
+
} catch (rollbackError) {
|
|
4195
|
+
this.pending = void 0;
|
|
4196
|
+
this.dispose();
|
|
4197
|
+
throw new AggregateError([error, rollbackError], "Rollback failed; editor disposed", { cause: rollbackError });
|
|
4198
|
+
}
|
|
4199
|
+
this.pending = void 0;
|
|
4200
|
+
throw error;
|
|
4201
|
+
}
|
|
4202
|
+
const deleted = [...pending.removed].filter((id) => !this.requireEngine().index.get(id));
|
|
4203
|
+
const created = [...pending.inserted].filter((id) => !pending.removed.has(id) && this.requireEngine().index.get(id));
|
|
4204
|
+
if (deleted.length) pending.maps.push({
|
|
4205
|
+
kind: "remove",
|
|
4206
|
+
nodeIds: deleted
|
|
4207
|
+
});
|
|
4208
|
+
const inverseMaps = invertPositionMaps(pending.maps);
|
|
4209
|
+
if (created.length) inverseMaps.push({
|
|
4210
|
+
kind: "remove",
|
|
4211
|
+
nodeIds: created
|
|
4212
|
+
});
|
|
4213
|
+
const change = {
|
|
4214
|
+
documentId: this.requireDocument().id,
|
|
4215
|
+
baseRevision: this.version,
|
|
4216
|
+
revision: ++this.version,
|
|
4217
|
+
label,
|
|
4218
|
+
source,
|
|
4219
|
+
operations: pending.operations,
|
|
4220
|
+
inverseOperations: [...pending.operations].reverse().map(invertOperation),
|
|
4221
|
+
positionMaps: pending.maps,
|
|
4222
|
+
inversePositionMaps: inverseMaps,
|
|
4223
|
+
affectedIds: [...pending.affected]
|
|
4224
|
+
};
|
|
4225
|
+
const frozen = freezeData(change);
|
|
4226
|
+
this.pending = void 0;
|
|
4227
|
+
this.queries?.invalidate(frozen.operations);
|
|
4228
|
+
if (source === "undo") this.redoStack.push(this.undoStack.pop());
|
|
4229
|
+
else if (source === "redo") this.undoStack.push(this.redoStack.pop());
|
|
4230
|
+
else {
|
|
4231
|
+
this.redoStack.length = 0;
|
|
4232
|
+
if (this.historyLimit) {
|
|
4233
|
+
this.undoStack.push(frozen);
|
|
4234
|
+
if (this.undoStack.length > this.historyLimit) this.undoStack.shift();
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4237
|
+
this.publish(frozen);
|
|
4238
|
+
return frozen;
|
|
4239
|
+
}
|
|
4240
|
+
/** 纯文字和字段配置沿用局部路径;其他事务检查最终改值的 JSON 边界及完整结构、引用。 */
|
|
4241
|
+
validatePending(operations) {
|
|
4242
|
+
const index = this.requireEngine().index, document = this.requireDocument(), fields = /* @__PURE__ */ new Set();
|
|
4243
|
+
for (const operation of operations) {
|
|
4244
|
+
if (operation.kind === "text") continue;
|
|
4245
|
+
if (operation.kind === "set" && operation.key === "config" && index.get(operation.nodeId)?.role === "field") fields.add(operation.nodeId);
|
|
4246
|
+
else {
|
|
4247
|
+
const result = validateDocumentEdit(document, operations, this.requireEngine(), this.validationOptions);
|
|
4248
|
+
if (!result.valid) throw new DocumentValidationError(result.issues);
|
|
4249
|
+
return;
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
for (const id of fields) {
|
|
4253
|
+
const errors = validateFieldConfigEdit(index.require(id).node, index.path(id), document, this.registry, (target) => !isUndefined(index.get(target)), this.validationOptions.maxDepth);
|
|
4254
|
+
if (errors.length) throw new DocumentValidationError(errors);
|
|
4255
|
+
}
|
|
4256
|
+
}
|
|
4257
|
+
/** 载荷已通过输入或文档边界;内部操作在此只复制为独立日志,回放协议由入口统一校验。 */
|
|
4258
|
+
record(value, maps) {
|
|
4259
|
+
const operation = cloneJsonData(value);
|
|
4260
|
+
if (operation.kind === "text" && operation.remove === operation.insert) return;
|
|
4261
|
+
if ((operation.kind === "set" || operation.kind === "dictionary" || operation.kind === "business") && equalData(operation.before, operation.after) && (operation.kind !== "business" || operation.beforePresent === operation.afterPresent)) return;
|
|
4262
|
+
const effect = this.requireEngine().apply(operation);
|
|
4263
|
+
const pending = this.pending;
|
|
4264
|
+
pending.operations.push(operation);
|
|
4265
|
+
effect.affectedIds.forEach((id) => pending.affected.add(id));
|
|
4266
|
+
effect.removedIds.forEach((id) => pending.removed.add(id));
|
|
4267
|
+
effect.insertedIds.forEach((id) => {
|
|
4268
|
+
pending.inserted.add(id);
|
|
4269
|
+
this.issuedIds.add(id);
|
|
4270
|
+
});
|
|
4271
|
+
if (maps) pending.maps.push(...maps);
|
|
4272
|
+
else if (operation.kind === "text") pending.maps.push({
|
|
4273
|
+
kind: "text",
|
|
4274
|
+
nodeId: operation.nodeId,
|
|
4275
|
+
offset: operation.offset,
|
|
4276
|
+
removedLength: operation.remove.length,
|
|
4277
|
+
insertedLength: operation.insert.length
|
|
4278
|
+
});
|
|
4279
|
+
}
|
|
4280
|
+
/** 构造可逆 splice;record 立即预检并隔离旧值与新节点,不在此重复复制载荷。 */
|
|
4281
|
+
splice(point, count, nodes) {
|
|
4282
|
+
const index = this.requireEngine().index, list = index.list(point.parentId, point.collection);
|
|
4283
|
+
this.range(point.index, count, list.length);
|
|
4284
|
+
if (!count && !nodes.length) return;
|
|
4285
|
+
const present = Object.hasOwn(index.require(point.parentId).node, point.collection);
|
|
4286
|
+
this.record({
|
|
4287
|
+
kind: "splice",
|
|
4288
|
+
parentId: point.parentId,
|
|
4289
|
+
collection: point.collection,
|
|
4290
|
+
index: point.index,
|
|
4291
|
+
beforePresent: present,
|
|
4292
|
+
afterPresent: true,
|
|
4293
|
+
remove: list.slice(point.index, point.index + count),
|
|
4294
|
+
insert: nodes
|
|
4295
|
+
});
|
|
4296
|
+
}
|
|
4297
|
+
/** 实施段内文字拆分,并替换普通删除映射,保证旧右半段位置能定位到新节点。 */
|
|
4298
|
+
splitTextAt(nodeId, offset) {
|
|
4299
|
+
const node = this.text(nodeId);
|
|
4300
|
+
this.boundary(node.text, offset);
|
|
4301
|
+
if (!offset || offset === node.text.length) return;
|
|
4302
|
+
const point = this.location(nodeId), tail = node.text.slice(offset);
|
|
4303
|
+
const right = {
|
|
4304
|
+
...copyData(node),
|
|
4305
|
+
id: this.allocateId(),
|
|
4306
|
+
text: tail
|
|
4307
|
+
};
|
|
4308
|
+
this.record({
|
|
4309
|
+
kind: "text",
|
|
4310
|
+
nodeId,
|
|
4311
|
+
offset,
|
|
4312
|
+
remove: tail,
|
|
4313
|
+
insert: ""
|
|
4314
|
+
}, []);
|
|
4315
|
+
this.splice({
|
|
4316
|
+
...point,
|
|
4317
|
+
index: point.index + 1
|
|
4318
|
+
}, 0, [right]);
|
|
4319
|
+
this.pending.maps.push({
|
|
4320
|
+
kind: "split",
|
|
4321
|
+
sourceId: nodeId,
|
|
4322
|
+
targetId: right.id,
|
|
4323
|
+
offset
|
|
4324
|
+
});
|
|
4325
|
+
}
|
|
4326
|
+
/** 实施相邻文字合并;只比较显式声明,不把有效样式缓存写回节点。 */
|
|
4327
|
+
mergeTextPair(leftId, rightId) {
|
|
4328
|
+
const left = this.text(leftId), right = this.text(rightId), a = this.location(leftId), b = this.location(rightId);
|
|
4329
|
+
if (a.parentId !== b.parentId || a.collection !== "content" || b.collection !== "content" || a.index + 1 !== b.index) throw new ModelEditError("adjacency", "Text nodes must be adjacent in one paragraph");
|
|
4330
|
+
if (!this.sameFormatting(left, right, ["textStyleId", "textStyle"])) throw new ModelEditError("style", "Text declarations differ");
|
|
4331
|
+
const offset = left.text.length;
|
|
4332
|
+
this.rewriteDeclaredEntityReferences(/* @__PURE__ */ new Map([[rightId, leftId]]));
|
|
4333
|
+
this.record({
|
|
4334
|
+
kind: "text",
|
|
4335
|
+
nodeId: leftId,
|
|
4336
|
+
offset,
|
|
4337
|
+
remove: "",
|
|
4338
|
+
insert: right.text
|
|
4339
|
+
}, []);
|
|
4340
|
+
this.splice(b, 1, []);
|
|
4341
|
+
this.pending.maps.push({
|
|
4342
|
+
kind: "merge",
|
|
4343
|
+
sourceId: rightId,
|
|
4344
|
+
targetId: leftId,
|
|
4345
|
+
offset
|
|
4346
|
+
});
|
|
4347
|
+
}
|
|
4348
|
+
/** 只重写模型明确定义的内部引用;业务 ID、路径、资源及绑定不会被字符串替换。 */
|
|
4349
|
+
remapCopy(entry, ids) {
|
|
4350
|
+
const node = entry.node;
|
|
4351
|
+
if (entry.role === "merge" || entry.role === "region") {
|
|
4352
|
+
const ranged = node;
|
|
4353
|
+
ranged.range.fromCellId = ids.get(ranged.range.fromCellId) ?? ranged.range.fromCellId;
|
|
4354
|
+
ranged.range.toCellId = ids.get(ranged.range.toCellId) ?? ranged.range.toCellId;
|
|
4355
|
+
if (entry.role === "region") {
|
|
4356
|
+
if (ranged.parentRegionId) ranged.parentRegionId = ids.get(ranged.parentRegionId) ?? ranged.parentRegionId;
|
|
4357
|
+
if (ranged.targetRegionId) ranged.targetRegionId = ids.get(ranged.targetRegionId) ?? ranged.targetRegionId;
|
|
4358
|
+
if (ranged.config) ranged.config = this.registry.remapConfig("region", ranged.type, ranged.configVersion ?? 1, ranged.config, { entity: ids });
|
|
4359
|
+
if (ranged.variant) ranged.variant.config = this.registry.remapConfig("variant", ranged.variant.name, ranged.variant.version, ranged.variant.config, { entity: ids });
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
if ("kind" in node && (node.kind === "field" || node.kind === "pageWidget") && node.config) node.config = this.registry.remapConfig(node.kind === "field" ? "field" : "pageWidget", node.widget, node.configVersion ?? 1, node.config, { entity: ids });
|
|
4363
|
+
if ("kind" in node && node.kind === "section") {
|
|
4364
|
+
for (const slots of [node.headerSlots, node.footerSlots]) if (slots) {
|
|
4365
|
+
for (const slot of [
|
|
4366
|
+
"default",
|
|
4367
|
+
"first",
|
|
4368
|
+
"even"
|
|
4369
|
+
]) if (slots[slot]) slots[slot] = ids.get(slots[slot]) ?? slots[slot];
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
/** 为一次创建使用临时工厂,身份仍由编辑会话分配,结束即释放辅助集合和闭包。 */
|
|
4374
|
+
withFactory(action) {
|
|
4375
|
+
const factory = new NodeFactory({
|
|
4376
|
+
createId: () => this.allocateId(),
|
|
4377
|
+
registry: this.registry
|
|
4378
|
+
});
|
|
4379
|
+
try {
|
|
4380
|
+
return action(factory);
|
|
4381
|
+
} finally {
|
|
4382
|
+
factory.dispose();
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
/** 为固定数量的编辑子模块提供现有会话能力,不增加模型或索引副本。 */
|
|
4386
|
+
editingContext() {
|
|
4387
|
+
return {
|
|
4388
|
+
editor: this,
|
|
4389
|
+
entry: (id) => this.requireEngine().index.require(id),
|
|
4390
|
+
hasEntity: (id) => !isUndefined(this.requireEngine().index.get(id)),
|
|
4391
|
+
withFactory: (action) => this.withFactory(action),
|
|
4392
|
+
collectDefinitions: (ids) => this.collectDefinitions(ids),
|
|
4393
|
+
cleanupDefinitions: (candidates, options) => this.cleanupDefinitions(candidates, options),
|
|
4394
|
+
cloneOwned: (point, nodes, reuse) => this.cloneOwned(point, nodes, reuse),
|
|
4395
|
+
createId: () => this.allocateId(),
|
|
4396
|
+
validation: this.validationOptions,
|
|
4397
|
+
assertBoundary: (text, offset) => this.boundary(text, offset),
|
|
4398
|
+
snapBoundary: (text, offset, affinity) => this.snapBoundary(text, offset, affinity),
|
|
4399
|
+
assertCommitted: () => this.assertCommitted(),
|
|
4400
|
+
mapPosition: (position) => mapTextPosition(position, this.pending?.maps ?? [])
|
|
4401
|
+
};
|
|
4402
|
+
}
|
|
4403
|
+
/** 在局部片段中统一分配拥有身份并重写内部引用,供完整节点复制和范围粘贴共用。 */
|
|
4404
|
+
cloneOwned(point, nodes, reuse = /* @__PURE__ */ new Map()) {
|
|
4405
|
+
const copies = copyData([...nodes]), entries = this.requireEngine().index.inspect(point.parentId, point.collection, copies);
|
|
4406
|
+
const idMap = new Map(reuse);
|
|
4407
|
+
entries.forEach((_entry, id) => {
|
|
4408
|
+
if (!idMap.has(id)) idMap.set(id, this.allocateId());
|
|
4409
|
+
});
|
|
4410
|
+
entries.forEach((entry) => {
|
|
4411
|
+
entry.node.id = idMap.get(entry.node.id);
|
|
4412
|
+
this.remapCopy(entry, idMap);
|
|
4413
|
+
});
|
|
4414
|
+
return {
|
|
4415
|
+
nodes: copies,
|
|
4416
|
+
idMap
|
|
4417
|
+
};
|
|
4418
|
+
}
|
|
4419
|
+
/** 读取真实字段实体,不把页面组件或普通文字误作字段。 */
|
|
4420
|
+
field(id) {
|
|
4421
|
+
const entry = this.requireEngine().index.require(id);
|
|
4422
|
+
if (entry.role !== "field") throw new ModelEditError("node_type", "Expected field");
|
|
4423
|
+
return entry.node;
|
|
4424
|
+
}
|
|
4425
|
+
/** 配置补丁只服务于已定义的常用字段,扩展字段仍经过注册表与通用操作处理。 */
|
|
4426
|
+
commonField(id) {
|
|
4427
|
+
const node = this.field(id);
|
|
4428
|
+
if (!includes(commonFieldWidgets, node.widget)) throw new ModelEditError("field_widget", "Expected common field widget");
|
|
4429
|
+
return node;
|
|
4430
|
+
}
|
|
4431
|
+
/** 为字段或页面组件取得统一绑定;在调用方事务内与引用同时提交。 */
|
|
4432
|
+
ensureBinding(input) {
|
|
4433
|
+
let id;
|
|
4434
|
+
this.run("ensureBinding", () => {
|
|
4435
|
+
id = this.resolveFieldBinding(input);
|
|
4436
|
+
});
|
|
4437
|
+
return id;
|
|
4438
|
+
}
|
|
4439
|
+
/** 校验并复用同一绑定声明,新增字典项只通过事务原语写入。 */
|
|
4440
|
+
resolveFieldBinding(input) {
|
|
4441
|
+
const binding = readFieldBinding(input), dictionary = this.requireDocument().bindings;
|
|
4442
|
+
if (!("binding" in binding)) {
|
|
4443
|
+
if (!Object.hasOwn(dictionary, binding.bindingId)) throw new ModelEditError("binding_reference", "Missing binding");
|
|
4444
|
+
return binding.bindingId;
|
|
4445
|
+
}
|
|
4446
|
+
for (const [id, value] of Object.entries(dictionary)) if (equalData(value, binding.binding)) return id;
|
|
4447
|
+
const id = this.allocateId();
|
|
4448
|
+
if (Object.hasOwn(dictionary, id)) throw new ModelEditError("id_factory", "createId collides with an existing binding");
|
|
4449
|
+
this.setDictionary("bindings", id, binding.binding);
|
|
4450
|
+
return id;
|
|
4451
|
+
}
|
|
4452
|
+
/** 在移除前一次遍历收集绑定及资产,包含附属内容、嵌套表及 schema 声明的引用。 */
|
|
4453
|
+
collectDefinitions(ids) {
|
|
4454
|
+
const index = this.requireEngine().index, bindings = /* @__PURE__ */ new Set(), assets = /* @__PURE__ */ new Set();
|
|
4455
|
+
for (const id of index.descendants(ids)) {
|
|
4456
|
+
const entry = index.require(id);
|
|
4457
|
+
if (entry.role === "field") bindings.add(entry.node.bindingId);
|
|
4458
|
+
if (entry.role === "image") assets.add(entry.node.assetId);
|
|
4459
|
+
for (const use of entityConfigUses(entry.node)) for (const reference of this.registry.getReferences(use.scope, use.name, use.version, use.value)) if (reference.target.kind === "binding") bindings.add(reference.target.id);
|
|
4460
|
+
else if (reference.target.kind === "asset") assets.add(reference.target.id);
|
|
4461
|
+
}
|
|
4462
|
+
return {
|
|
4463
|
+
bindings,
|
|
4464
|
+
assets
|
|
4465
|
+
};
|
|
4466
|
+
}
|
|
4467
|
+
/** 文字归一合并时同步改写所有显式实体引用,配置变化与文字变更共享撤销事务。 */
|
|
4468
|
+
rewriteDeclaredEntityReferences(aliases) {
|
|
4469
|
+
if (!this.registry.hasEntityReferences()) return;
|
|
4470
|
+
const index = this.requireEngine().index;
|
|
4471
|
+
for (const id of index.descendants([this.requireDocument().id])) {
|
|
4472
|
+
const node = index.require(id).node;
|
|
4473
|
+
for (const use of entityConfigUses(node)) {
|
|
4474
|
+
if (!this.registry.getReferences(use.scope, use.name, use.version, use.value).some((reference) => reference.target.kind === "entity" && aliases.has(reference.target.id))) continue;
|
|
4475
|
+
const value = this.registry.remapConfig(use.scope, use.name, use.version, use.value, { entity: aliases });
|
|
4476
|
+
if (use.path === "/config") this.setProperty(id, "config", value);
|
|
4477
|
+
else if (use.path === "/variant/config" && "variant" in node) this.setProperty(id, "variant", {
|
|
4478
|
+
...node.variant,
|
|
4479
|
+
config: value
|
|
4480
|
+
});
|
|
4481
|
+
else if ("kind" in node && node.kind === "document") this.setBusinessConfig(use.name, value, use.version);
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
/** 结构操作结束后统一清理候选定义;共享引用、显式保留和无关孤立项均不被误删。 */
|
|
4486
|
+
cleanupDefinitions(candidates, options = {}) {
|
|
4487
|
+
const bindings = options.removeUnusedBindings === false ? void 0 : candidates.bindings, assets = options.removeUnusedAssets === false ? void 0 : candidates.assets;
|
|
4488
|
+
if (!bindings?.size && !assets?.size) return;
|
|
4489
|
+
const document = this.requireDocument(), used = this.collectDefinitions([document.id]);
|
|
4490
|
+
for (const [dictionary, candidates, references] of [[
|
|
4491
|
+
"bindings",
|
|
4492
|
+
bindings,
|
|
4493
|
+
used.bindings
|
|
4494
|
+
], [
|
|
4495
|
+
"assets",
|
|
4496
|
+
assets,
|
|
4497
|
+
used.assets
|
|
4498
|
+
]]) for (const id of candidates ?? []) if (!references?.has(id) && Object.hasOwn(document[dictionary], id)) this.unsetDictionary(dictionary, id);
|
|
4499
|
+
}
|
|
4500
|
+
/** 条件必须属于当前 checkbox 或 choice,禁止挂到不存在的选项上。 */
|
|
4501
|
+
checkAttachmentCondition(node, when) {
|
|
4502
|
+
const condition = copyData(when);
|
|
4503
|
+
checkFactoryValue(condition, attachmentConditionRule, "/when");
|
|
4504
|
+
if (condition.kind === "boolean" ? node.widget !== "checkbox" : node.widget !== "choice" || !node.config.options.some((option) => option.id === condition.optionId)) throw new ModelEditError("field_attachment", "Condition does not belong to this field");
|
|
4505
|
+
return condition;
|
|
4506
|
+
}
|
|
4507
|
+
/** 条件校验、原生工厂与容器插入共用一个入口,旧附属字段创建保留其段落及 ID 分配顺序。 */
|
|
4508
|
+
ensureAttachmentNode(fieldId, when, paragraph = false) {
|
|
4509
|
+
const node = this.field(fieldId), condition = this.checkAttachmentCondition(node, when), existing = node.attachments?.find((item) => equalData(item.when, condition));
|
|
4510
|
+
if (existing) return existing;
|
|
4511
|
+
const created = this.withFactory((factory) => factory.createAttachment(condition, paragraph ? [factory.createParagraph()] : []));
|
|
4512
|
+
this.insertNodes({
|
|
4513
|
+
parentId: fieldId,
|
|
4514
|
+
collection: "attachments",
|
|
4515
|
+
index: node.attachments?.length ?? 0
|
|
4516
|
+
}, [created]);
|
|
4517
|
+
return this.requireEngine().index.require(created.id).node;
|
|
4518
|
+
}
|
|
4519
|
+
/** 移除附属容器,最后一个移除后恢复 attachments 缺省,而非残留空数组。 */
|
|
4520
|
+
removeAttachmentNode(fieldId, attachmentId) {
|
|
4521
|
+
const attachments = this.field(fieldId).attachments ?? [], index = attachments.findIndex((item) => item.id === attachmentId);
|
|
4522
|
+
if (index < 0) throw new ModelEditError("field_attachment", "Missing attachment");
|
|
4523
|
+
this.record({
|
|
4524
|
+
kind: "splice",
|
|
4525
|
+
parentId: fieldId,
|
|
4526
|
+
collection: "attachments",
|
|
4527
|
+
index,
|
|
4528
|
+
beforePresent: true,
|
|
4529
|
+
afterPresent: attachments.length > 1,
|
|
4530
|
+
remove: copyData([attachments[index]]),
|
|
4531
|
+
insert: []
|
|
4532
|
+
});
|
|
4533
|
+
}
|
|
4534
|
+
/** 比较选定声明属性,保留缺省与显式 false/0/none 的差别,忽略对象键顺序。 */
|
|
4535
|
+
sameFormatting(a, b, keys) {
|
|
4536
|
+
return keys.every((key) => equalData(readPropertyValue(a, key), readPropertyValue(b, key)));
|
|
4537
|
+
}
|
|
4538
|
+
/** 分配从未在本会话使用过的 ID;失败即报错,避免坏工厂导致无限重试。 */
|
|
4539
|
+
allocateId() {
|
|
4540
|
+
const id = this.createId();
|
|
4541
|
+
if (!isString(id) || !id.trim() || this.issuedIds.has(id)) throw new ModelEditError("id_factory", "createId must return a fresh nonempty ID");
|
|
4542
|
+
this.issuedIds.add(id);
|
|
4543
|
+
return id;
|
|
4544
|
+
}
|
|
4545
|
+
/** 验证数组区间,所有索引/count 必须为有限非负整数。 */
|
|
4546
|
+
range(index, count, length) {
|
|
4547
|
+
if (!isInteger(index) || !isInteger(count) || index < 0 || count < 0 || index + count > length) throw new ModelEditError("range", "Invalid collection range");
|
|
4548
|
+
}
|
|
4549
|
+
/** 校验 UTF-16 偏移是否落在完整字素边界,防止切开组合音标和复合 emoji。 */
|
|
4550
|
+
boundary(text, offset) {
|
|
4551
|
+
this.range(offset, 0, text.length);
|
|
4552
|
+
if (offset !== text.length && this.segmenter.segment(text).containing(offset)?.index !== offset) throw new ModelEditError("grapheme_boundary", "Offset splits a grapheme");
|
|
4553
|
+
}
|
|
4554
|
+
/** 文字拼接形成组合字素时按明确亲和方向吸附,不让范围编辑返回半个 emoji 或组合音标。 */
|
|
4555
|
+
snapBoundary(text, offset, affinity) {
|
|
4556
|
+
this.range(offset, 0, text.length);
|
|
4557
|
+
if (offset === text.length) return offset;
|
|
4558
|
+
const segment = this.segmenter.segment(text).containing(offset);
|
|
4559
|
+
return segment.index === offset || affinity === "before" ? segment.index : segment.index + segment.segment.length;
|
|
4560
|
+
}
|
|
4561
|
+
/** 读取文字实体并校验类型,防止把字段的展示文本当作普通文字直接编辑。 */
|
|
4562
|
+
text(id) {
|
|
4563
|
+
const entry = this.requireEngine().index.require(id);
|
|
4564
|
+
if (entry.role !== "text") throw new ModelEditError("node_type", "Expected text node");
|
|
4565
|
+
return entry.node;
|
|
4566
|
+
}
|
|
4567
|
+
/** 读取段落实体并校验类型。 */
|
|
4568
|
+
paragraph(id) {
|
|
4569
|
+
const entry = this.requireEngine().index.require(id);
|
|
4570
|
+
if (entry.role !== "paragraph") throw new ModelEditError("node_type", "Expected paragraph");
|
|
4571
|
+
return entry.node;
|
|
4572
|
+
}
|
|
4573
|
+
/** 从拥有索引定位实体在当前数组中的位置,不把可漂移序号存进节点。 */
|
|
4574
|
+
location(id) {
|
|
4575
|
+
const entry = this.requireEngine().index.require(id);
|
|
4576
|
+
if (!entry.parentId || !entry.collection) throw new ModelEditError("ownership", "Document root has no parent collection");
|
|
4577
|
+
return {
|
|
4578
|
+
parentId: entry.parentId,
|
|
4579
|
+
collection: entry.collection,
|
|
4580
|
+
index: this.requireEngine().index.list(entry.parentId, entry.collection).findIndex((node) => node.id === id)
|
|
4581
|
+
};
|
|
4582
|
+
}
|
|
4583
|
+
/** 确保文档已打开,关闭后不再保留可操作引用。 */
|
|
4584
|
+
requireDocument() {
|
|
4585
|
+
if (!this.current) throw new ModelEditError("disposed", "ModelEditor is disposed");
|
|
4586
|
+
return this.current;
|
|
4587
|
+
}
|
|
4588
|
+
/** 取得当前会话操作引擎;与文档共同创建、共同释放。 */
|
|
4589
|
+
requireEngine() {
|
|
4590
|
+
this.requireDocument();
|
|
4591
|
+
return this.engine;
|
|
4592
|
+
}
|
|
4593
|
+
/** 禁止在事务或同步订阅通知中执行历史/关闭操作,避免重入改变历史栈。 */
|
|
4594
|
+
assertIdle() {
|
|
4595
|
+
this.requireDocument();
|
|
4596
|
+
if (this.pending || this.notifying) throw new ModelEditError("busy", "Operation requires an idle editor");
|
|
4597
|
+
}
|
|
4598
|
+
/** 导出及统一查询只读取已提交状态;提交通知期间允许读取,事务中间状态禁止读取。 */
|
|
4599
|
+
assertCommitted() {
|
|
4600
|
+
this.requireDocument();
|
|
4601
|
+
if (this.pending) throw new ModelEditError("busy", "Cannot export an uncommitted transaction");
|
|
4602
|
+
}
|
|
4603
|
+
/** 按提交时的订阅快照发送一次事件,隔离订阅器及其错误处理器的异常。 */
|
|
4604
|
+
publish(change) {
|
|
4605
|
+
this.notifying = true;
|
|
4606
|
+
try {
|
|
4607
|
+
for (const listener of [...this.subscribers]) try {
|
|
4608
|
+
listener(change);
|
|
4609
|
+
} catch (error) {
|
|
4610
|
+
try {
|
|
4611
|
+
this.reportSubscriberError?.(error);
|
|
4612
|
+
} catch {}
|
|
4613
|
+
}
|
|
4614
|
+
} finally {
|
|
4615
|
+
this.notifying = false;
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
};
|
|
4619
|
+
export { readTextFormatUpdate as a, intersectsRectangle as c, validateChangeSet as d, readFragment as f, replacePathIndexPlaceholders as g, parseValuePath as h, readParagraphFormatUpdate as i, isOrdinaryTable as l, mergeStyle as m, resolveKeepExceptionHighlight as n, containsRectangle as o, serializeFragment as p, patchTextDeclaration as r, indexTablePositions as s, ModelEditor as t, rectangleFromPositions as u };
|
|
4620
|
+
|
|
4621
|
+
//# sourceMappingURL=ModelEditor-GzaLnnX8.js.map
|