@syncfusion/ej2-docx 0.0.0-stage → 35.1.40
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/.gitleaksignore +35 -0
- package/README.md +68 -2
- package/core.js +4 -0
- package/dist/ej2-docx.umd.min.js +11 -0
- package/dist/ej2-docx.umd.min.js.map +1 -0
- package/dist/es6/ej2-docx.es2015.js +66697 -0
- package/dist/es6/ej2-docx.es2015.js.map +1 -0
- package/dist/es6/ej2-docx.es5.js +77568 -0
- package/dist/es6/ej2-docx.es5.js.map +1 -0
- package/dist/global/ej2-docx.min.js +11 -0
- package/dist/global/ej2-docx.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/features.js +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +30 -3
- package/src/all.d.ts +50 -0
- package/src/all.js +147 -0
- package/src/core/compat/base64.d.ts +13 -0
- package/src/core/compat/base64.js +90 -0
- package/src/core/compat/object-compat.d.ts +30 -0
- package/src/core/compat/object-compat.js +40 -0
- package/src/core/compat/sha256.d.ts +9 -0
- package/src/core/compat/sha256.js +98 -0
- package/src/core/errors/docx-error.d.ts +89 -0
- package/src/core/errors/docx-error.js +138 -0
- package/src/core/errors/error-codes.d.ts +8 -0
- package/src/core/errors/error-codes.js +0 -0
- package/src/core/errors/index.d.ts +10 -0
- package/src/core/errors/index.js +9 -0
- package/src/core/index.d.ts +12 -0
- package/src/core/index.js +12 -0
- package/src/core/mc/alternate-content.d.ts +7 -0
- package/src/core/mc/alternate-content.js +67 -0
- package/src/core/mc/attributes.d.ts +24 -0
- package/src/core/mc/attributes.js +82 -0
- package/src/core/mc/index.d.ts +7 -0
- package/src/core/mc/index.js +5 -0
- package/src/core/mc/inspect.d.ts +16 -0
- package/src/core/mc/inspect.js +148 -0
- package/src/core/mc/namespaces.d.ts +4 -0
- package/src/core/mc/namespaces.js +4 -0
- package/src/core/mc/scope.d.ts +6 -0
- package/src/core/mc/scope.js +47 -0
- package/src/core/opc/content-types.d.ts +34 -0
- package/src/core/opc/content-types.js +162 -0
- package/src/core/opc/index.d.ts +8 -0
- package/src/core/opc/index.js +4 -0
- package/src/core/opc/package.d.ts +49 -0
- package/src/core/opc/package.js +324 -0
- package/src/core/opc/part-name.d.ts +47 -0
- package/src/core/opc/part-name.js +205 -0
- package/src/core/opc/relationships.d.ts +46 -0
- package/src/core/opc/relationships.js +212 -0
- package/src/core/preservation/index.d.ts +2 -0
- package/src/core/preservation/index.js +1 -0
- package/src/core/preservation/opaque-body.d.ts +16 -0
- package/src/core/preservation/opaque-body.js +69 -0
- package/src/core/registry/block-handlers.d.ts +30 -0
- package/src/core/registry/block-handlers.js +36 -0
- package/src/core/registry/create-defaults.d.ts +39 -0
- package/src/core/registry/create-defaults.js +42 -0
- package/src/core/registry/feature-registry.d.ts +20 -0
- package/src/core/registry/feature-registry.js +29 -0
- package/src/core/registry/index.d.ts +9 -0
- package/src/core/registry/index.js +8 -0
- package/src/core/registry/inline-handlers.d.ts +20 -0
- package/src/core/registry/inline-handlers.js +30 -0
- package/src/core/registry/materialize-handlers.d.ts +35 -0
- package/src/core/registry/materialize-handlers.js +75 -0
- package/src/core/registry/multi-part-handlers.d.ts +37 -0
- package/src/core/registry/multi-part-handlers.js +206 -0
- package/src/core/registry/package-part-handlers.d.ts +28 -0
- package/src/core/registry/package-part-handlers.js +190 -0
- package/src/core/registry/part-handlers.d.ts +24 -0
- package/src/core/registry/part-handlers.js +172 -0
- package/src/core/registry/run-leaf-handlers.d.ts +26 -0
- package/src/core/registry/run-leaf-handlers.js +72 -0
- package/src/core/security/limits.d.ts +40 -0
- package/src/core/security/limits.js +26 -0
- package/src/core/xml/index.d.ts +7 -0
- package/src/core/xml/index.js +3 -0
- package/src/core/xml/model.d.ts +66 -0
- package/src/core/xml/model.js +17 -0
- package/src/core/xml/parse.d.ts +12 -0
- package/src/core/xml/parse.js +382 -0
- package/src/core/xml/serialize.d.ts +6 -0
- package/src/core/xml/serialize.js +93 -0
- package/src/core/zip/crc32.d.ts +2 -0
- package/src/core/zip/crc32.js +25 -0
- package/src/core/zip/deflate.d.ts +6 -0
- package/src/core/zip/deflate.js +6 -0
- package/src/core/zip/index.d.ts +10 -0
- package/src/core/zip/index.js +4 -0
- package/src/core/zip/inflate-raw.d.ts +17 -0
- package/src/core/zip/inflate-raw.js +450 -0
- package/src/core/zip/names.d.ts +6 -0
- package/src/core/zip/names.js +52 -0
- package/src/core/zip/read.d.ts +8 -0
- package/src/core/zip/read.js +262 -0
- package/src/core/zip/write.d.ts +7 -0
- package/src/core/zip/write.js +189 -0
- package/src/core/zip/zip-entry.d.ts +4 -0
- package/src/core/zip/zip-entry.js +0 -0
- package/src/features/bibliography/index.d.ts +100 -0
- package/src/features/bibliography/index.js +290 -0
- package/src/features/bookmarks/index.d.ts +331 -0
- package/src/features/bookmarks/index.js +1009 -0
- package/src/features/comments/comment-extensions.d.ts +157 -0
- package/src/features/comments/comment-extensions.js +356 -0
- package/src/features/comments/index.d.ts +579 -0
- package/src/features/comments/index.js +1727 -0
- package/src/features/content-controls/index.d.ts +821 -0
- package/src/features/content-controls/index.js +2857 -0
- package/src/features/custom-xml/index.d.ts +236 -0
- package/src/features/custom-xml/index.js +661 -0
- package/src/features/document/alignment.d.ts +23 -0
- package/src/features/document/alignment.js +36 -0
- package/src/features/document/alt-chunk.d.ts +103 -0
- package/src/features/document/alt-chunk.js +221 -0
- package/src/features/document/assert-never.d.ts +1 -0
- package/src/features/document/assert-never.js +4 -0
- package/src/features/document/augmentations.d.ts +578 -0
- package/src/features/document/augmentations.js +0 -0
- package/src/features/document/body-always-on.d.ts +36 -0
- package/src/features/document/body-always-on.js +66 -0
- package/src/features/document/body-blocks.d.ts +7 -0
- package/src/features/document/body-blocks.js +78 -0
- package/src/features/document/body-item-adapters.d.ts +62 -0
- package/src/features/document/body-item-adapters.js +97 -0
- package/src/features/document/body-item-collection.d.ts +151 -0
- package/src/features/document/body-item-collection.js +440 -0
- package/src/features/document/body-item.d.ts +35 -0
- package/src/features/document/body-item.js +8 -0
- package/src/features/document/body.d.ts +150 -0
- package/src/features/document/body.js +263 -0
- package/src/features/document/character-format.d.ts +413 -0
- package/src/features/document/character-format.js +2054 -0
- package/src/features/document/color.d.ts +178 -0
- package/src/features/document/color.js +495 -0
- package/src/features/document/document.d.ts +410 -0
- package/src/features/document/document.js +1049 -0
- package/src/features/document/element-type.d.ts +68 -0
- package/src/features/document/element-type.js +133 -0
- package/src/features/document/entity-type.d.ts +92 -0
- package/src/features/document/entity-type.js +93 -0
- package/src/features/document/feature-block.d.ts +16 -0
- package/src/features/document/feature-block.js +0 -0
- package/src/features/document/feature-inline.d.ts +13 -0
- package/src/features/document/feature-inline.js +0 -0
- package/src/features/document/feature-multi-package-part.d.ts +19 -0
- package/src/features/document/feature-multi-package-part.js +8 -0
- package/src/features/document/feature-package-level-part.d.ts +18 -0
- package/src/features/document/feature-package-level-part.js +8 -0
- package/src/features/document/feature-package-part.d.ts +14 -0
- package/src/features/document/feature-package-part.js +0 -0
- package/src/features/document/feature-run-leaf.d.ts +9 -0
- package/src/features/document/feature-run-leaf.js +0 -0
- package/src/features/document/headers-footers.d.ts +206 -0
- package/src/features/document/headers-footers.js +384 -0
- package/src/features/document/index.d.ts +41 -0
- package/src/features/document/index.js +34 -0
- package/src/features/document/length.d.ts +152 -0
- package/src/features/document/length.js +245 -0
- package/src/features/document/load-options.d.ts +14 -0
- package/src/features/document/load-options.js +0 -0
- package/src/features/document/locale-ids.d.ts +227 -0
- package/src/features/document/locale-ids.js +485 -0
- package/src/features/document/on-off.d.ts +9 -0
- package/src/features/document/on-off.js +27 -0
- package/src/features/document/page-setup.d.ts +339 -0
- package/src/features/document/page-setup.js +244 -0
- package/src/features/document/paragraph-format.d.ts +880 -0
- package/src/features/document/paragraph-format.js +2807 -0
- package/src/features/document/paragraph-item-collection.d.ts +162 -0
- package/src/features/document/paragraph-item-collection.js +363 -0
- package/src/features/document/paragraph-item.d.ts +83 -0
- package/src/features/document/paragraph-item.js +103 -0
- package/src/features/document/paragraph.d.ts +435 -0
- package/src/features/document/paragraph.js +888 -0
- package/src/features/document/run.d.ts +1 -0
- package/src/features/document/run.js +768 -0
- package/src/features/document/section-partition-flatten.d.ts +124 -0
- package/src/features/document/section-partition-flatten.js +217 -0
- package/src/features/document/section-properties-model.d.ts +13 -0
- package/src/features/document/section-properties-model.js +0 -0
- package/src/features/document/section.d.ts +93 -0
- package/src/features/document/section.js +178 -0
- package/src/features/document/sections.d.ts +103 -0
- package/src/features/document/sections.js +217 -0
- package/src/features/document/sub-super-script.d.ts +23 -0
- package/src/features/document/sub-super-script.js +43 -0
- package/src/features/document/text-range.d.ts +445 -0
- package/src/features/document/text-range.js +1156 -0
- package/src/features/document/typed-body-collections.d.ts +162 -0
- package/src/features/document/typed-body-collections.js +371 -0
- package/src/features/document/underline-style.d.ts +38 -0
- package/src/features/document/underline-style.js +126 -0
- package/src/features/document/units.d.ts +8 -0
- package/src/features/document/units.js +7 -0
- package/src/features/document/wml.d.ts +16 -0
- package/src/features/document/wml.js +67 -0
- package/src/features/drawing/authoring.d.ts +27 -0
- package/src/features/drawing/authoring.js +271 -0
- package/src/features/drawing/body-pr.d.ts +271 -0
- package/src/features/drawing/body-pr.js +663 -0
- package/src/features/drawing/drawing-shape.d.ts +1192 -0
- package/src/features/drawing/drawing-shape.js +3239 -0
- package/src/features/drawing/encode-builders.d.ts +176 -0
- package/src/features/drawing/encode-builders.js +390 -0
- package/src/features/drawing/fill-format.d.ts +52 -0
- package/src/features/drawing/fill-format.js +124 -0
- package/src/features/drawing/host-codec.d.ts +632 -0
- package/src/features/drawing/host-codec.js +2595 -0
- package/src/features/drawing/index.d.ts +13 -0
- package/src/features/drawing/index.js +33 -0
- package/src/features/drawing/line-format.d.ts +76 -0
- package/src/features/drawing/line-format.js +343 -0
- package/src/features/drawing/parse-register.d.ts +50 -0
- package/src/features/drawing/parse-register.js +257 -0
- package/src/features/drawing/residual-utils.d.ts +47 -0
- package/src/features/drawing/residual-utils.js +290 -0
- package/src/features/drawing/shape-types.d.ts +433 -0
- package/src/features/drawing/shape-types.js +437 -0
- package/src/features/drawing/sp-pr.d.ts +396 -0
- package/src/features/drawing/sp-pr.js +610 -0
- package/src/features/drawing/text-frame.d.ts +90 -0
- package/src/features/drawing/text-frame.js +152 -0
- package/src/features/drawing/types.d.ts +352 -0
- package/src/features/drawing/types.js +60 -0
- package/src/features/drawing/wrap-format.d.ts +62 -0
- package/src/features/drawing/wrap-format.js +114 -0
- package/src/features/editable-ranges/index.d.ts +494 -0
- package/src/features/editable-ranges/index.js +1348 -0
- package/src/features/fields/index.d.ts +428 -0
- package/src/features/fields/index.js +2148 -0
- package/src/features/fields/paragraph-field.d.ts +187 -0
- package/src/features/fields/paragraph-field.js +692 -0
- package/src/features/font-table/font-substitution-table.d.ts +75 -0
- package/src/features/font-table/font-substitution-table.js +257 -0
- package/src/features/font-table/font-table-entry.d.ts +255 -0
- package/src/features/font-table/font-table-entry.js +823 -0
- package/src/features/font-table/font-table.d.ts +128 -0
- package/src/features/font-table/font-table.js +313 -0
- package/src/features/font-table/index.d.ts +27 -0
- package/src/features/font-table/index.js +48 -0
- package/src/features/glossary/index.d.ts +97 -0
- package/src/features/glossary/index.js +286 -0
- package/src/features/headers-footers/index.d.ts +506 -0
- package/src/features/headers-footers/index.js +1666 -0
- package/src/features/hyperlinks/index.d.ts +230 -0
- package/src/features/hyperlinks/index.js +685 -0
- package/src/features/images/caption-authoring-api.d.ts +33 -0
- package/src/features/images/caption-authoring-api.js +33 -0
- package/src/features/images/caption-enums.d.ts +52 -0
- package/src/features/images/caption-enums.js +141 -0
- package/src/features/images/caption-host.d.ts +10 -0
- package/src/features/images/caption-host.js +21 -0
- package/src/features/images/captions.d.ts +13 -0
- package/src/features/images/captions.js +142 -0
- package/src/features/images/host-codec.d.ts +103 -0
- package/src/features/images/host-codec.js +720 -0
- package/src/features/images/image-sniff.d.ts +21 -0
- package/src/features/images/image-sniff.js +71 -0
- package/src/features/images/index.d.ts +506 -0
- package/src/features/images/index.js +1429 -0
- package/src/features/images/layout-types.d.ts +232 -0
- package/src/features/images/layout-types.js +294 -0
- package/src/features/images/public-entry.d.ts +9 -0
- package/src/features/images/public-entry.js +9 -0
- package/src/features/index.d.ts +35 -0
- package/src/features/index.js +36 -0
- package/src/features/mail-merge/index.d.ts +113 -0
- package/src/features/mail-merge/index.js +315 -0
- package/src/features/notes/index.d.ts +573 -0
- package/src/features/notes/index.js +1725 -0
- package/src/features/numbering/abstract-numbering.d.ts +90 -0
- package/src/features/numbering/abstract-numbering.js +292 -0
- package/src/features/numbering/index.d.ts +182 -0
- package/src/features/numbering/index.js +668 -0
- package/src/features/numbering/list-format.d.ts +158 -0
- package/src/features/numbering/list-format.js +590 -0
- package/src/features/numbering/list-string.d.ts +7 -0
- package/src/features/numbering/list-string.js +423 -0
- package/src/features/numbering/list-style.d.ts +204 -0
- package/src/features/numbering/list-style.js +1084 -0
- package/src/features/numbering/numbering-instance.d.ts +101 -0
- package/src/features/numbering/numbering-instance.js +329 -0
- package/src/features/numbering/numbering-level.d.ts +118 -0
- package/src/features/numbering/numbering-level.js +501 -0
- package/src/features/numbering/picture-bullet.d.ts +34 -0
- package/src/features/numbering/picture-bullet.js +88 -0
- package/src/features/ole-object/catalog.d.ts +300 -0
- package/src/features/ole-object/catalog.js +908 -0
- package/src/features/ole-object/index.d.ts +526 -0
- package/src/features/ole-object/index.js +1421 -0
- package/src/features/ole-object/relationship.d.ts +27 -0
- package/src/features/ole-object/relationship.js +27 -0
- package/src/features/ole-object/typed-dom.d.ts +186 -0
- package/src/features/ole-object/typed-dom.js +595 -0
- package/src/features/properties/index.d.ts +205 -0
- package/src/features/properties/index.js +549 -0
- package/src/features/revisions/index.d.ts +204 -0
- package/src/features/revisions/index.js +695 -0
- package/src/features/sections/column-collection.d.ts +119 -0
- package/src/features/sections/column-collection.js +478 -0
- package/src/features/sections/column.d.ts +15 -0
- package/src/features/sections/column.js +37 -0
- package/src/features/sections/index.d.ts +91 -0
- package/src/features/sections/index.js +1096 -0
- package/src/features/sections/margins.d.ts +40 -0
- package/src/features/sections/margins.js +105 -0
- package/src/features/sections/page-number-style.d.ts +21 -0
- package/src/features/sections/page-number-style.js +62 -0
- package/src/features/sections/page-orientation.d.ts +10 -0
- package/src/features/sections/page-orientation.js +10 -0
- package/src/features/sections/page-setup.d.ts +435 -0
- package/src/features/sections/page-setup.js +1479 -0
- package/src/features/sections/page-size.d.ts +59 -0
- package/src/features/sections/page-size.js +68 -0
- package/src/features/sections/section-break-code.d.ts +27 -0
- package/src/features/sections/section-break-code.js +60 -0
- package/src/features/sections/section-document-association.d.ts +18 -0
- package/src/features/sections/section-document-association.js +31 -0
- package/src/features/sections/section-validation.d.ts +43 -0
- package/src/features/sections/section-validation.js +97 -0
- package/src/features/settings/attached-template.d.ts +35 -0
- package/src/features/settings/attached-template.js +98 -0
- package/src/features/settings/compat-settings.d.ts +216 -0
- package/src/features/settings/compat-settings.js +508 -0
- package/src/features/settings/document-background.d.ts +59 -0
- package/src/features/settings/document-background.js +131 -0
- package/src/features/settings/document-protection.d.ts +65 -0
- package/src/features/settings/document-protection.js +157 -0
- package/src/features/settings/document-settings-facades.d.ts +108 -0
- package/src/features/settings/document-settings-facades.js +312 -0
- package/src/features/settings/document-settings-values.d.ts +43 -0
- package/src/features/settings/document-settings-values.js +60 -0
- package/src/features/settings/footnote-properties.d.ts +211 -0
- package/src/features/settings/footnote-properties.js +591 -0
- package/src/features/settings/index.d.ts +356 -0
- package/src/features/settings/index.js +829 -0
- package/src/features/settings/settings-children.d.ts +151 -0
- package/src/features/settings/settings-children.js +505 -0
- package/src/features/settings/web-settings.d.ts +88 -0
- package/src/features/settings/web-settings.js +227 -0
- package/src/features/settings/zoom.d.ts +79 -0
- package/src/features/settings/zoom.js +147 -0
- package/src/features/styles/builtin-catalog.d.ts +159 -0
- package/src/features/styles/builtin-catalog.js +963 -0
- package/src/features/styles/builtin-resolver.d.ts +49 -0
- package/src/features/styles/builtin-resolver.js +165 -0
- package/src/features/styles/default-styles.d.ts +37 -0
- package/src/features/styles/default-styles.js +186 -0
- package/src/features/styles/default-theme.d.ts +13 -0
- package/src/features/styles/default-theme.js +13 -0
- package/src/features/styles/doc-defaults.d.ts +58 -0
- package/src/features/styles/doc-defaults.js +178 -0
- package/src/features/styles/formatting-resolver.d.ts +27 -0
- package/src/features/styles/formatting-resolver.js +72 -0
- package/src/features/styles/index.d.ts +256 -0
- package/src/features/styles/index.js +1325 -0
- package/src/features/styles/latent-styles.d.ts +68 -0
- package/src/features/styles/latent-styles.js +305 -0
- package/src/features/styles/paragraph-properties.d.ts +71 -0
- package/src/features/styles/paragraph-properties.js +237 -0
- package/src/features/styles/run-properties.d.ts +93 -0
- package/src/features/styles/run-properties.js +516 -0
- package/src/features/styles/style-base.d.ts +402 -0
- package/src/features/styles/style-base.js +1026 -0
- package/src/features/styles/style-collection.d.ts +264 -0
- package/src/features/styles/style-collection.js +714 -0
- package/src/features/styles/style-format-bridge.d.ts +64 -0
- package/src/features/styles/style-format-bridge.js +100 -0
- package/src/features/styles/style.d.ts +84 -0
- package/src/features/styles/style.js +375 -0
- package/src/features/styles/styles-with-effects.d.ts +71 -0
- package/src/features/styles/styles-with-effects.js +180 -0
- package/src/features/styles/table-style.d.ts +272 -0
- package/src/features/styles/table-style.js +1226 -0
- package/src/features/styles/theme.d.ts +126 -0
- package/src/features/styles/theme.js +377 -0
- package/src/features/tables/border-style-map.d.ts +24 -0
- package/src/features/tables/border-style-map.js +81 -0
- package/src/features/tables/borders.d.ts +126 -0
- package/src/features/tables/borders.js +527 -0
- package/src/features/tables/collections.d.ts +113 -0
- package/src/features/tables/collections.js +261 -0
- package/src/features/tables/format.d.ts +208 -0
- package/src/features/tables/format.js +716 -0
- package/src/features/tables/index.d.ts +597 -0
- package/src/features/tables/index.js +2386 -0
- package/src/features/tables/paddings.d.ts +41 -0
- package/src/features/tables/paddings.js +97 -0
- package/src/features/tables/tbl-pr-positioning.d.ts +27 -0
- package/src/features/tables/tbl-pr-positioning.js +178 -0
- package/src/features/tables/tbl-pr.d.ts +528 -0
- package/src/features/tables/tbl-pr.js +1208 -0
- package/src/features/tables/tc-pr.d.ts +168 -0
- package/src/features/tables/tc-pr.js +553 -0
- package/src/features/tables/tr-pr.d.ts +60 -0
- package/src/features/tables/tr-pr.js +215 -0
- package/src/features/watermark/detect.d.ts +76 -0
- package/src/features/watermark/detect.js +219 -0
- package/src/features/watermark/index.d.ts +28 -0
- package/src/features/watermark/index.js +91 -0
- package/src/features/watermark/logical-store.d.ts +29 -0
- package/src/features/watermark/logical-store.js +31 -0
- package/src/features/watermark/model.d.ts +285 -0
- package/src/features/watermark/model.js +597 -0
- package/src/features/watermark/parse.d.ts +84 -0
- package/src/features/watermark/parse.js +815 -0
- package/src/features/watermark/serialize.d.ts +98 -0
- package/src/features/watermark/serialize.js +1517 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
|
@@ -0,0 +1,1226 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __assign = (this && this.__assign) || function () {
|
|
15
|
+
__assign = Object.assign || function(t) {
|
|
16
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
+
s = arguments[i];
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
return __assign.apply(this, arguments);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Table style live model (`w:style/@w:type="table"`).
|
|
27
|
+
*
|
|
28
|
+
* Owns character/paragraph format facades, base table/row/cell property bags,
|
|
29
|
+
* and conditional formatting styles (`w:tblStylePr`). Mutations rewrite the
|
|
30
|
+
* DocxStyle shell and notify the styles host.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
import { CharacterFormat, parseCharacterFormat, buildRPrChildrenFromSnapshot, } from '../document/character-format';
|
|
35
|
+
import { colorFromWire, colorToHexWire } from '../document/color';
|
|
36
|
+
import { ParagraphFormat, parseParagraphFormat, buildPPrChildrenFromSnapshot, } from '../document/paragraph-format';
|
|
37
|
+
import { elementChildren, isWml, wmlAttr, wmlElement, wValAttribute } from '../document/wml';
|
|
38
|
+
import { readTableBorders, writeTableBorders, readTableCellMargins, writeTableCellMargins, readTableShading, writeTableShading, readTablePreferredWidth, writeTablePreferredWidth, readTableAlignment, writeTableAlignment, readTableLayout, writeTableLayout, readTableCellSpacing, writeTableCellSpacing, readTableIndent, writeTableIndent, readTableRowBandSize, writeTableRowBandSize, readTableColumnBandSize, writeTableColumnBandSize, } from '../tables/tbl-pr';
|
|
39
|
+
import { readRowHeight, writeRowHeight, readRowCantSplit, writeRowCantSplit, readRowIsHeader, writeRowIsHeader, } from '../tables/tr-pr';
|
|
40
|
+
import { readCellBorders, writeCellBorders, readCellShading, writeCellShading, readCellMargins, writeCellMargins, readCellVerticalAlignment, writeCellVerticalAlignment, readCellTextDirection, writeCellTextDirection, readCellPreferredWidth, writeCellPreferredWidth, readHorizontalMerge, writeHorizontalMerge, readVerticalMerge, writeVerticalMerge, } from '../tables/tc-pr';
|
|
41
|
+
import { Borders } from '../tables/borders';
|
|
42
|
+
import { Paddings } from '../tables/paddings';
|
|
43
|
+
import { DocxStyle, parseDocxStyle } from './style';
|
|
44
|
+
import { Style } from './style-base';
|
|
45
|
+
/** Conditional formatting type tokens (`w:tblStylePr/@w:type`). */
|
|
46
|
+
export var ConditionalFormattingType = {
|
|
47
|
+
WholeTable: 'wholeTable',
|
|
48
|
+
FirstRow: 'firstRow',
|
|
49
|
+
LastRow: 'lastRow',
|
|
50
|
+
FirstColumn: 'firstColumn',
|
|
51
|
+
LastColumn: 'lastColumn',
|
|
52
|
+
OddColumnBand: 'band1Vert',
|
|
53
|
+
EvenColumnBand: 'band2Vert',
|
|
54
|
+
OddRowBand: 'band1Horz',
|
|
55
|
+
EvenRowBand: 'band2Horz',
|
|
56
|
+
TopLeftCell: 'nwCell',
|
|
57
|
+
TopRightCell: 'neCell',
|
|
58
|
+
BottomLeftCell: 'swCell',
|
|
59
|
+
BottomRightCell: 'seCell',
|
|
60
|
+
};
|
|
61
|
+
var CONDITIONAL_TYPE_SET = {
|
|
62
|
+
wholeTable: true,
|
|
63
|
+
firstRow: true,
|
|
64
|
+
lastRow: true,
|
|
65
|
+
firstColumn: true,
|
|
66
|
+
lastColumn: true,
|
|
67
|
+
band1Vert: true,
|
|
68
|
+
band2Vert: true,
|
|
69
|
+
band1Horz: true,
|
|
70
|
+
band2Horz: true,
|
|
71
|
+
nwCell: true,
|
|
72
|
+
neCell: true,
|
|
73
|
+
swCell: true,
|
|
74
|
+
seCell: true,
|
|
75
|
+
};
|
|
76
|
+
function isConditionalType(value) {
|
|
77
|
+
return CONDITIONAL_TYPE_SET[value] === true;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* OOXML `w:style` (table) property-group order after metadata:
|
|
81
|
+
* pPr → rPr → tblPr → trPr → tcPr → tblStylePr*.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
var TABLE_STYLE_PROP_RANK = {
|
|
85
|
+
pPr: 0,
|
|
86
|
+
rPr: 1,
|
|
87
|
+
tblPr: 2,
|
|
88
|
+
trPr: 3,
|
|
89
|
+
tcPr: 4,
|
|
90
|
+
tblStylePr: 5,
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* OOXML `w:tblStylePr` child order: pPr → rPr → tblPr → trPr → tcPr.
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
var TBL_STYLE_PR_CHILD_RANK = {
|
|
97
|
+
pPr: 0,
|
|
98
|
+
rPr: 1,
|
|
99
|
+
tblPr: 2,
|
|
100
|
+
trPr: 3,
|
|
101
|
+
tcPr: 4,
|
|
102
|
+
};
|
|
103
|
+
function stylePropRank(localName) {
|
|
104
|
+
var rank = TABLE_STYLE_PROP_RANK[localName];
|
|
105
|
+
return rank !== undefined ? rank : undefined;
|
|
106
|
+
}
|
|
107
|
+
function tblStylePrChildRank(localName) {
|
|
108
|
+
var rank = TBL_STYLE_PR_CHILD_RANK[localName];
|
|
109
|
+
return rank !== undefined ? rank : undefined;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Stable-sort modeled property groups; preserve relative order of other nodes.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
function orderByRank(children, rankOf) {
|
|
116
|
+
var preamble = [];
|
|
117
|
+
var ranked = [];
|
|
118
|
+
var unknown = [];
|
|
119
|
+
for (var i = 0; i < children.length; i += 1) {
|
|
120
|
+
var child = children[i];
|
|
121
|
+
var rank = rankOf(child.localName);
|
|
122
|
+
if (rank === undefined) {
|
|
123
|
+
// Keep unknowns that appear before the first ranked group with preamble;
|
|
124
|
+
// unknowns after ranked groups stay after (ECMA extras / rsid-like).
|
|
125
|
+
if (ranked.length === 0) {
|
|
126
|
+
preamble.push(child);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
unknown.push({ el: child, index: i });
|
|
130
|
+
}
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
ranked.push({ rank: rank, el: child, index: i });
|
|
134
|
+
}
|
|
135
|
+
ranked.sort(function (a, b) {
|
|
136
|
+
if (a.rank !== b.rank) {
|
|
137
|
+
return a.rank - b.rank;
|
|
138
|
+
}
|
|
139
|
+
return a.index - b.index;
|
|
140
|
+
});
|
|
141
|
+
var out = preamble.slice();
|
|
142
|
+
for (var i = 0; i < ranked.length; i += 1) {
|
|
143
|
+
out.push(ranked[i].el);
|
|
144
|
+
}
|
|
145
|
+
// Append trailing unknowns in original order (after property groups).
|
|
146
|
+
unknown.sort(function (a, b) { return a.index - b.index; });
|
|
147
|
+
for (var i = 0; i < unknown.length; i += 1) {
|
|
148
|
+
out.push(unknown[i].el);
|
|
149
|
+
}
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Order children of one `w:tblStylePr` (omit empties is caller's job).
|
|
154
|
+
* @private
|
|
155
|
+
*/
|
|
156
|
+
function orderTblStylePrChildren(children) {
|
|
157
|
+
return orderByRank(children, tblStylePrChildRank);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Rebuild `w:tblStylePr` with schema-ordered children.
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
function orderTblStylePrElement(el) {
|
|
164
|
+
var kids = elementChildren(el);
|
|
165
|
+
if (kids.length <= 1) {
|
|
166
|
+
// Zero or one child — already ordered.
|
|
167
|
+
if (kids.length === 1) {
|
|
168
|
+
return el;
|
|
169
|
+
}
|
|
170
|
+
return el;
|
|
171
|
+
}
|
|
172
|
+
var ordered = orderTblStylePrChildren(kids);
|
|
173
|
+
var changed = false;
|
|
174
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
175
|
+
if (kids[i] !== ordered[i]) {
|
|
176
|
+
changed = true;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (!changed) {
|
|
181
|
+
return el;
|
|
182
|
+
}
|
|
183
|
+
return wmlElement('tblStylePr', {
|
|
184
|
+
attributes: el.attributes,
|
|
185
|
+
namespaceDeclarations: el.namespaceDeclarations,
|
|
186
|
+
children: ordered,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Order `w:style` children for table styles and nested `w:tblStylePr` bodies.
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
function orderTableStyleElement(el) {
|
|
194
|
+
var kids = elementChildren(el);
|
|
195
|
+
var withOrderedConditionals = [];
|
|
196
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
197
|
+
var child = kids[i];
|
|
198
|
+
if (isWml(child, 'tblStylePr')) {
|
|
199
|
+
withOrderedConditionals.push(orderTblStylePrElement(child));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
withOrderedConditionals.push(child);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var ordered = orderByRank(withOrderedConditionals, stylePropRank);
|
|
206
|
+
var changed = ordered.length !== kids.length;
|
|
207
|
+
if (!changed) {
|
|
208
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
209
|
+
if (kids[i] !== ordered[i]) {
|
|
210
|
+
changed = true;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (!changed) {
|
|
216
|
+
return el;
|
|
217
|
+
}
|
|
218
|
+
return wmlElement('style', {
|
|
219
|
+
attributes: el.attributes,
|
|
220
|
+
namespaceDeclarations: el.namespaceDeclarations,
|
|
221
|
+
children: ordered,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function attrLocal(el, localName) {
|
|
225
|
+
for (var i = 0; i < el.attributes.length; i += 1) {
|
|
226
|
+
var a = el.attributes[i];
|
|
227
|
+
if (a.localName === localName) {
|
|
228
|
+
return a.value;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Base table properties on a table style (`w:tblPr` under `w:style`).
|
|
235
|
+
*
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
var TableStyleTableProperties = /** @class */ (function () {
|
|
239
|
+
/** @private */
|
|
240
|
+
function TableStyleTableProperties(owner) {
|
|
241
|
+
this.owner = owner;
|
|
242
|
+
}
|
|
243
|
+
TableStyleTableProperties.prototype.readTblPr = function () {
|
|
244
|
+
return this.owner.readBaseChild('tblPr');
|
|
245
|
+
};
|
|
246
|
+
TableStyleTableProperties.prototype.writeTblPr = function (next) {
|
|
247
|
+
this.owner.writeBaseChild('tblPr', next);
|
|
248
|
+
};
|
|
249
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "borders", {
|
|
250
|
+
get: function () {
|
|
251
|
+
if (this.bordersInstance === undefined) {
|
|
252
|
+
var self_1 = this;
|
|
253
|
+
var host = {
|
|
254
|
+
readEdge: function (key) {
|
|
255
|
+
var pr = self_1.readTblPr();
|
|
256
|
+
if (pr === undefined) {
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
259
|
+
var bag = readTableBorders(pr);
|
|
260
|
+
return bag !== undefined ? bag[key] : undefined;
|
|
261
|
+
},
|
|
262
|
+
writeEdge: function (key, edge) {
|
|
263
|
+
var pr = self_1.readTblPr() !== undefined ? self_1.readTblPr() : wmlElement('tblPr');
|
|
264
|
+
var current = readTableBorders(pr) !== undefined ? __assign({}, readTableBorders(pr)) : {};
|
|
265
|
+
if (edge === undefined) {
|
|
266
|
+
delete current[key];
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
current[key] = edge;
|
|
270
|
+
}
|
|
271
|
+
var keys = Object.keys(current);
|
|
272
|
+
var nextBag = keys.length > 0 ? current : undefined;
|
|
273
|
+
self_1.writeTblPr(writeTableBorders(pr, nextBag));
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
this.bordersInstance = new Borders(host);
|
|
277
|
+
}
|
|
278
|
+
return this.bordersInstance;
|
|
279
|
+
},
|
|
280
|
+
enumerable: true,
|
|
281
|
+
configurable: true
|
|
282
|
+
});
|
|
283
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "cellSpacing", {
|
|
284
|
+
get: function () {
|
|
285
|
+
var pr = this.readTblPr();
|
|
286
|
+
return pr !== undefined ? readTableCellSpacing(pr) : undefined;
|
|
287
|
+
},
|
|
288
|
+
set: function (value) {
|
|
289
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
290
|
+
this.writeTblPr(writeTableCellSpacing(pr, value));
|
|
291
|
+
},
|
|
292
|
+
enumerable: true,
|
|
293
|
+
configurable: true
|
|
294
|
+
});
|
|
295
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "leftIndent", {
|
|
296
|
+
get: function () {
|
|
297
|
+
var pr = this.readTblPr();
|
|
298
|
+
return pr !== undefined ? readTableIndent(pr) : undefined;
|
|
299
|
+
},
|
|
300
|
+
set: function (value) {
|
|
301
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
302
|
+
this.writeTblPr(writeTableIndent(pr, value));
|
|
303
|
+
},
|
|
304
|
+
enumerable: true,
|
|
305
|
+
configurable: true
|
|
306
|
+
});
|
|
307
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "paddings", {
|
|
308
|
+
get: function () {
|
|
309
|
+
if (this.paddingsInstance === undefined) {
|
|
310
|
+
var self_2 = this;
|
|
311
|
+
var host = {
|
|
312
|
+
read: function () {
|
|
313
|
+
var pr = self_2.readTblPr();
|
|
314
|
+
return pr !== undefined ? readTableCellMargins(pr) : undefined;
|
|
315
|
+
},
|
|
316
|
+
write: function (value) {
|
|
317
|
+
var pr = self_2.readTblPr() !== undefined ? self_2.readTblPr() : wmlElement('tblPr');
|
|
318
|
+
self_2.writeTblPr(writeTableCellMargins(pr, value));
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
this.paddingsInstance = new Paddings(host);
|
|
322
|
+
}
|
|
323
|
+
return this.paddingsInstance;
|
|
324
|
+
},
|
|
325
|
+
enumerable: true,
|
|
326
|
+
configurable: true
|
|
327
|
+
});
|
|
328
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "preferredWidth", {
|
|
329
|
+
/** @private */
|
|
330
|
+
get: function () {
|
|
331
|
+
var pr = this.readTblPr();
|
|
332
|
+
return pr !== undefined ? readTablePreferredWidth(pr) : undefined;
|
|
333
|
+
},
|
|
334
|
+
set: function (value) {
|
|
335
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
336
|
+
this.writeTblPr(writeTablePreferredWidth(pr, value));
|
|
337
|
+
},
|
|
338
|
+
enumerable: true,
|
|
339
|
+
configurable: true
|
|
340
|
+
});
|
|
341
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "alignment", {
|
|
342
|
+
/** @private */
|
|
343
|
+
get: function () {
|
|
344
|
+
var pr = this.readTblPr();
|
|
345
|
+
return pr !== undefined ? readTableAlignment(pr) : undefined;
|
|
346
|
+
},
|
|
347
|
+
set: function (value) {
|
|
348
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
349
|
+
this.writeTblPr(writeTableAlignment(pr, value));
|
|
350
|
+
},
|
|
351
|
+
enumerable: true,
|
|
352
|
+
configurable: true
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "layout", {
|
|
355
|
+
/** @private */
|
|
356
|
+
get: function () {
|
|
357
|
+
var pr = this.readTblPr();
|
|
358
|
+
return pr !== undefined ? readTableLayout(pr) : undefined;
|
|
359
|
+
},
|
|
360
|
+
set: function (value) {
|
|
361
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
362
|
+
this.writeTblPr(writeTableLayout(pr, value));
|
|
363
|
+
},
|
|
364
|
+
enumerable: true,
|
|
365
|
+
configurable: true
|
|
366
|
+
});
|
|
367
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "shading", {
|
|
368
|
+
/** @private */
|
|
369
|
+
get: function () {
|
|
370
|
+
var pr = this.readTblPr();
|
|
371
|
+
return pr !== undefined ? readTableShading(pr) : undefined;
|
|
372
|
+
},
|
|
373
|
+
set: function (value) {
|
|
374
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
375
|
+
this.writeTblPr(writeTableShading(pr, value));
|
|
376
|
+
},
|
|
377
|
+
enumerable: true,
|
|
378
|
+
configurable: true
|
|
379
|
+
});
|
|
380
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "rowStripe", {
|
|
381
|
+
/**
|
|
382
|
+
* Rows per horizontal band on the table style (`w:tblStyleRowBandSize/@w:val`).
|
|
383
|
+
* Styles.xml only; does not write document-body tblPr. Absent → `undefined`.
|
|
384
|
+
* Non-finite values throw `RangeError`.
|
|
385
|
+
*
|
|
386
|
+
* @public
|
|
387
|
+
*/
|
|
388
|
+
get: function () {
|
|
389
|
+
var pr = this.readTblPr();
|
|
390
|
+
return pr !== undefined ? readTableRowBandSize(pr) : undefined;
|
|
391
|
+
},
|
|
392
|
+
set: function (value) {
|
|
393
|
+
if (value !== undefined && !isFinite(value)) {
|
|
394
|
+
throw new RangeError('TableStyle rowStripe must be a finite number or undefined, got ' + String(value));
|
|
395
|
+
}
|
|
396
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
397
|
+
this.writeTblPr(writeTableRowBandSize(pr, value !== undefined ? Math.trunc(value) : undefined));
|
|
398
|
+
},
|
|
399
|
+
enumerable: true,
|
|
400
|
+
configurable: true
|
|
401
|
+
});
|
|
402
|
+
Object.defineProperty(TableStyleTableProperties.prototype, "columnStripe", {
|
|
403
|
+
/**
|
|
404
|
+
* Columns per vertical band on the table style (`w:tblStyleColBandSize/@w:val`).
|
|
405
|
+
* Styles.xml only; does not write document-body tblPr. Absent → `undefined`.
|
|
406
|
+
* Non-finite values throw `RangeError`.
|
|
407
|
+
*
|
|
408
|
+
* @public
|
|
409
|
+
*/
|
|
410
|
+
get: function () {
|
|
411
|
+
var pr = this.readTblPr();
|
|
412
|
+
return pr !== undefined ? readTableColumnBandSize(pr) : undefined;
|
|
413
|
+
},
|
|
414
|
+
set: function (value) {
|
|
415
|
+
if (value !== undefined && !isFinite(value)) {
|
|
416
|
+
throw new RangeError('TableStyle columnStripe must be a finite number or undefined, got ' + String(value));
|
|
417
|
+
}
|
|
418
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
419
|
+
this.writeTblPr(writeTableColumnBandSize(pr, value !== undefined ? Math.trunc(value) : undefined));
|
|
420
|
+
},
|
|
421
|
+
enumerable: true,
|
|
422
|
+
configurable: true
|
|
423
|
+
});
|
|
424
|
+
return TableStyleTableProperties;
|
|
425
|
+
}());
|
|
426
|
+
export { TableStyleTableProperties };
|
|
427
|
+
/**
|
|
428
|
+
* Row properties on a table style (`w:trPr`).
|
|
429
|
+
*
|
|
430
|
+
* @public
|
|
431
|
+
*/
|
|
432
|
+
var TableStyleRowProperties = /** @class */ (function () {
|
|
433
|
+
/** @private */
|
|
434
|
+
function TableStyleRowProperties(owner, isConditional) {
|
|
435
|
+
if (isConditional === void 0) { isConditional = false; }
|
|
436
|
+
this.owner = owner;
|
|
437
|
+
this.isConditional = isConditional;
|
|
438
|
+
}
|
|
439
|
+
TableStyleRowProperties.prototype.readTrPr = function () {
|
|
440
|
+
if (this.isConditional) {
|
|
441
|
+
return this.owner.readChild('trPr');
|
|
442
|
+
}
|
|
443
|
+
return this.owner.readBaseChild('trPr');
|
|
444
|
+
};
|
|
445
|
+
TableStyleRowProperties.prototype.writeTrPr = function (next) {
|
|
446
|
+
if (this.isConditional) {
|
|
447
|
+
this.owner.writeChild('trPr', next);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
this.owner.writeBaseChild('trPr', next);
|
|
451
|
+
};
|
|
452
|
+
Object.defineProperty(TableStyleRowProperties.prototype, "height", {
|
|
453
|
+
get: function () {
|
|
454
|
+
var pr = this.readTrPr();
|
|
455
|
+
var h = readRowHeight(pr);
|
|
456
|
+
return h !== undefined ? h.value : undefined;
|
|
457
|
+
},
|
|
458
|
+
set: function (value) {
|
|
459
|
+
var pr = this.readTrPr();
|
|
460
|
+
if (value === undefined) {
|
|
461
|
+
this.writeTrPr(writeRowHeight(pr, undefined));
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
var current = readRowHeight(pr);
|
|
465
|
+
var rule = current !== undefined && current.rule !== undefined ? current.rule : 'atLeast';
|
|
466
|
+
this.writeTrPr(writeRowHeight(pr, { value: value, rule: rule }));
|
|
467
|
+
},
|
|
468
|
+
enumerable: true,
|
|
469
|
+
configurable: true
|
|
470
|
+
});
|
|
471
|
+
Object.defineProperty(TableStyleRowProperties.prototype, "allowBreakAcrossPages", {
|
|
472
|
+
get: function () {
|
|
473
|
+
var pr = this.readTrPr();
|
|
474
|
+
var cant = readRowCantSplit(pr);
|
|
475
|
+
if (cant === undefined) {
|
|
476
|
+
return true;
|
|
477
|
+
}
|
|
478
|
+
return !cant;
|
|
479
|
+
},
|
|
480
|
+
set: function (value) {
|
|
481
|
+
var pr = this.readTrPr();
|
|
482
|
+
this.writeTrPr(writeRowCantSplit(pr, value ? undefined : true));
|
|
483
|
+
},
|
|
484
|
+
enumerable: true,
|
|
485
|
+
configurable: true
|
|
486
|
+
});
|
|
487
|
+
Object.defineProperty(TableStyleRowProperties.prototype, "isHeader", {
|
|
488
|
+
get: function () {
|
|
489
|
+
var pr = this.readTrPr();
|
|
490
|
+
var v = readRowIsHeader(pr);
|
|
491
|
+
return v === true;
|
|
492
|
+
},
|
|
493
|
+
set: function (value) {
|
|
494
|
+
var pr = this.readTrPr();
|
|
495
|
+
this.writeTrPr(writeRowIsHeader(pr, value ? true : undefined));
|
|
496
|
+
},
|
|
497
|
+
enumerable: true,
|
|
498
|
+
configurable: true
|
|
499
|
+
});
|
|
500
|
+
return TableStyleRowProperties;
|
|
501
|
+
}());
|
|
502
|
+
export { TableStyleRowProperties };
|
|
503
|
+
/**
|
|
504
|
+
* Cell properties on a table style (`w:tcPr`).
|
|
505
|
+
*
|
|
506
|
+
* @public
|
|
507
|
+
*/
|
|
508
|
+
var TableStyleCellProperties = /** @class */ (function () {
|
|
509
|
+
/** @private */
|
|
510
|
+
function TableStyleCellProperties(owner, isConditional) {
|
|
511
|
+
if (isConditional === void 0) { isConditional = false; }
|
|
512
|
+
this.owner = owner;
|
|
513
|
+
this.isConditional = isConditional;
|
|
514
|
+
}
|
|
515
|
+
TableStyleCellProperties.prototype.readTcPr = function () {
|
|
516
|
+
if (this.isConditional) {
|
|
517
|
+
return this.owner.readChild('tcPr');
|
|
518
|
+
}
|
|
519
|
+
return this.owner.readBaseChild('tcPr');
|
|
520
|
+
};
|
|
521
|
+
TableStyleCellProperties.prototype.writeTcPr = function (next) {
|
|
522
|
+
if (this.isConditional) {
|
|
523
|
+
this.owner.writeChild('tcPr', next);
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
this.owner.writeBaseChild('tcPr', next);
|
|
527
|
+
};
|
|
528
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "borders", {
|
|
529
|
+
get: function () {
|
|
530
|
+
if (this.bordersInstance === undefined) {
|
|
531
|
+
var self_3 = this;
|
|
532
|
+
var host = {
|
|
533
|
+
readEdge: function (key) {
|
|
534
|
+
var pr = self_3.readTcPr();
|
|
535
|
+
if (pr === undefined) {
|
|
536
|
+
return undefined;
|
|
537
|
+
}
|
|
538
|
+
var bag = readCellBorders(pr);
|
|
539
|
+
return bag !== undefined ? bag[key] : undefined;
|
|
540
|
+
},
|
|
541
|
+
writeEdge: function (key, edge) {
|
|
542
|
+
var pr = self_3.readTcPr() !== undefined ? self_3.readTcPr() : wmlElement('tcPr');
|
|
543
|
+
var current = readCellBorders(pr) !== undefined ? __assign({}, readCellBorders(pr)) : {};
|
|
544
|
+
if (edge === undefined) {
|
|
545
|
+
delete current[key];
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
current[key] = edge;
|
|
549
|
+
}
|
|
550
|
+
var keys = Object.keys(current);
|
|
551
|
+
var nextBag = keys.length > 0 ? current : undefined;
|
|
552
|
+
self_3.writeTcPr(writeCellBorders(pr, nextBag));
|
|
553
|
+
},
|
|
554
|
+
};
|
|
555
|
+
this.bordersInstance = new Borders(host);
|
|
556
|
+
}
|
|
557
|
+
return this.bordersInstance;
|
|
558
|
+
},
|
|
559
|
+
enumerable: true,
|
|
560
|
+
configurable: true
|
|
561
|
+
});
|
|
562
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "paddings", {
|
|
563
|
+
get: function () {
|
|
564
|
+
if (this.paddingsInstance === undefined) {
|
|
565
|
+
var self_4 = this;
|
|
566
|
+
var host = {
|
|
567
|
+
read: function () {
|
|
568
|
+
var pr = self_4.readTcPr();
|
|
569
|
+
return pr !== undefined ? readCellMargins(pr) : undefined;
|
|
570
|
+
},
|
|
571
|
+
write: function (value) {
|
|
572
|
+
var pr = self_4.readTcPr() !== undefined ? self_4.readTcPr() : wmlElement('tcPr');
|
|
573
|
+
self_4.writeTcPr(writeCellMargins(pr, value));
|
|
574
|
+
},
|
|
575
|
+
};
|
|
576
|
+
this.paddingsInstance = new Paddings(host);
|
|
577
|
+
}
|
|
578
|
+
return this.paddingsInstance;
|
|
579
|
+
},
|
|
580
|
+
enumerable: true,
|
|
581
|
+
configurable: true
|
|
582
|
+
});
|
|
583
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "backgroundColor", {
|
|
584
|
+
get: function () {
|
|
585
|
+
var pr = this.readTcPr();
|
|
586
|
+
var shd = pr !== undefined ? readCellShading(pr) : undefined;
|
|
587
|
+
if (shd === undefined || shd.fill === undefined) {
|
|
588
|
+
return undefined;
|
|
589
|
+
}
|
|
590
|
+
return colorFromWire(shd.fill);
|
|
591
|
+
},
|
|
592
|
+
set: function (value) {
|
|
593
|
+
var pr = this.readTcPr() !== undefined ? this.readTcPr() : wmlElement('tcPr');
|
|
594
|
+
var current = readCellShading(pr);
|
|
595
|
+
if (value === undefined) {
|
|
596
|
+
if (current === undefined) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
var next_1 = __assign({}, current);
|
|
600
|
+
delete next_1.fill;
|
|
601
|
+
var empty = next_1.fill === undefined && next_1.color === undefined && next_1.pattern === undefined;
|
|
602
|
+
this.writeTcPr(writeCellShading(pr, empty ? undefined : next_1));
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
var fill = colorToHexWire(value);
|
|
606
|
+
if (fill.length === 0) {
|
|
607
|
+
// Transparent → clear fill like character textBackgroundColor path.
|
|
608
|
+
if (current === undefined) {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
var next_2 = __assign({}, current);
|
|
612
|
+
delete next_2.fill;
|
|
613
|
+
var empty = next_2.fill === undefined && next_2.color === undefined && next_2.pattern === undefined;
|
|
614
|
+
this.writeTcPr(writeCellShading(pr, empty ? undefined : next_2));
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
// DocIO direct-format bag: clear + auto + fill (same shape as CellFormat.backColor).
|
|
618
|
+
var pattern = current !== undefined &&
|
|
619
|
+
current.pattern !== undefined &&
|
|
620
|
+
current.pattern.length > 0
|
|
621
|
+
? current.pattern
|
|
622
|
+
: 'clear';
|
|
623
|
+
var shdColor = current !== undefined && current.color !== undefined && current.color.length > 0
|
|
624
|
+
? current.color
|
|
625
|
+
: 'auto';
|
|
626
|
+
var next = {
|
|
627
|
+
fill: fill,
|
|
628
|
+
color: shdColor,
|
|
629
|
+
pattern: pattern,
|
|
630
|
+
};
|
|
631
|
+
this.writeTcPr(writeCellShading(pr, next));
|
|
632
|
+
},
|
|
633
|
+
enumerable: true,
|
|
634
|
+
configurable: true
|
|
635
|
+
});
|
|
636
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "verticalAlignment", {
|
|
637
|
+
get: function () {
|
|
638
|
+
var pr = this.readTcPr();
|
|
639
|
+
return pr !== undefined ? readCellVerticalAlignment(pr) : undefined;
|
|
640
|
+
},
|
|
641
|
+
set: function (value) {
|
|
642
|
+
var pr = this.readTcPr() !== undefined ? this.readTcPr() : wmlElement('tcPr');
|
|
643
|
+
this.writeTcPr(writeCellVerticalAlignment(pr, value));
|
|
644
|
+
},
|
|
645
|
+
enumerable: true,
|
|
646
|
+
configurable: true
|
|
647
|
+
});
|
|
648
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "textDirection", {
|
|
649
|
+
get: function () {
|
|
650
|
+
var pr = this.readTcPr();
|
|
651
|
+
return pr !== undefined ? readCellTextDirection(pr) : undefined;
|
|
652
|
+
},
|
|
653
|
+
set: function (value) {
|
|
654
|
+
var pr = this.readTcPr() !== undefined ? this.readTcPr() : wmlElement('tcPr');
|
|
655
|
+
this.writeTcPr(writeCellTextDirection(pr, value));
|
|
656
|
+
},
|
|
657
|
+
enumerable: true,
|
|
658
|
+
configurable: true
|
|
659
|
+
});
|
|
660
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "preferredWidth", {
|
|
661
|
+
/** @private */
|
|
662
|
+
get: function () {
|
|
663
|
+
var pr = this.readTcPr();
|
|
664
|
+
return pr !== undefined ? readCellPreferredWidth(pr) : undefined;
|
|
665
|
+
},
|
|
666
|
+
set: function (value) {
|
|
667
|
+
var pr = this.readTcPr() !== undefined ? this.readTcPr() : wmlElement('tcPr');
|
|
668
|
+
this.writeTcPr(writeCellPreferredWidth(pr, value));
|
|
669
|
+
},
|
|
670
|
+
enumerable: true,
|
|
671
|
+
configurable: true
|
|
672
|
+
});
|
|
673
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "horizontalMerge", {
|
|
674
|
+
/** @private style-level only; does not mutate body grid merges. */
|
|
675
|
+
get: function () {
|
|
676
|
+
var pr = this.readTcPr();
|
|
677
|
+
return pr !== undefined ? readHorizontalMerge(pr) : undefined;
|
|
678
|
+
},
|
|
679
|
+
set: function (value) {
|
|
680
|
+
var pr = this.readTcPr() !== undefined ? this.readTcPr() : wmlElement('tcPr');
|
|
681
|
+
this.writeTcPr(writeHorizontalMerge(pr, value));
|
|
682
|
+
},
|
|
683
|
+
enumerable: true,
|
|
684
|
+
configurable: true
|
|
685
|
+
});
|
|
686
|
+
Object.defineProperty(TableStyleCellProperties.prototype, "verticalMerge", {
|
|
687
|
+
/** @private */
|
|
688
|
+
get: function () {
|
|
689
|
+
var pr = this.readTcPr();
|
|
690
|
+
return pr !== undefined ? readVerticalMerge(pr) : undefined;
|
|
691
|
+
},
|
|
692
|
+
set: function (value) {
|
|
693
|
+
var pr = this.readTcPr() !== undefined ? this.readTcPr() : wmlElement('tcPr');
|
|
694
|
+
this.writeTcPr(writeVerticalMerge(pr, value));
|
|
695
|
+
},
|
|
696
|
+
enumerable: true,
|
|
697
|
+
configurable: true
|
|
698
|
+
});
|
|
699
|
+
return TableStyleCellProperties;
|
|
700
|
+
}());
|
|
701
|
+
export { TableStyleCellProperties };
|
|
702
|
+
/**
|
|
703
|
+
* One conditional formatting block (`w:tblStylePr`).
|
|
704
|
+
*
|
|
705
|
+
* @public
|
|
706
|
+
*/
|
|
707
|
+
var ConditionalFormattingStyle = /** @class */ (function () {
|
|
708
|
+
/** @private */
|
|
709
|
+
function ConditionalFormattingStyle(parent, type, element) {
|
|
710
|
+
this.parent = parent;
|
|
711
|
+
this.typeValue = type;
|
|
712
|
+
this.element = element;
|
|
713
|
+
}
|
|
714
|
+
Object.defineProperty(ConditionalFormattingStyle.prototype, "conditionalFormattingType", {
|
|
715
|
+
get: function () {
|
|
716
|
+
return this.typeValue;
|
|
717
|
+
},
|
|
718
|
+
enumerable: true,
|
|
719
|
+
configurable: true
|
|
720
|
+
});
|
|
721
|
+
Object.defineProperty(ConditionalFormattingStyle.prototype, "characterFormat", {
|
|
722
|
+
get: function () {
|
|
723
|
+
if (this.characterFormatInstance === undefined) {
|
|
724
|
+
this.characterFormatInstance = new CharacterFormat(this);
|
|
725
|
+
var rPr = this.readChild('rPr');
|
|
726
|
+
if (rPr !== undefined) {
|
|
727
|
+
this.characterFormatInstance.hydrate(parseCharacterFormat(rPr));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return this.characterFormatInstance;
|
|
731
|
+
},
|
|
732
|
+
enumerable: true,
|
|
733
|
+
configurable: true
|
|
734
|
+
});
|
|
735
|
+
Object.defineProperty(ConditionalFormattingStyle.prototype, "paragraphFormat", {
|
|
736
|
+
get: function () {
|
|
737
|
+
if (this.paragraphFormatInstance === undefined) {
|
|
738
|
+
this.paragraphFormatInstance = new ParagraphFormat(this);
|
|
739
|
+
var pPr = this.readChild('pPr');
|
|
740
|
+
if (pPr !== undefined) {
|
|
741
|
+
this.paragraphFormatInstance.hydrate(parseParagraphFormat(pPr));
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return this.paragraphFormatInstance;
|
|
745
|
+
},
|
|
746
|
+
enumerable: true,
|
|
747
|
+
configurable: true
|
|
748
|
+
});
|
|
749
|
+
Object.defineProperty(ConditionalFormattingStyle.prototype, "rowProperties", {
|
|
750
|
+
get: function () {
|
|
751
|
+
if (this.rowPropertiesInstance === undefined) {
|
|
752
|
+
this.rowPropertiesInstance = new TableStyleRowProperties(this, true);
|
|
753
|
+
}
|
|
754
|
+
return this.rowPropertiesInstance;
|
|
755
|
+
},
|
|
756
|
+
enumerable: true,
|
|
757
|
+
configurable: true
|
|
758
|
+
});
|
|
759
|
+
Object.defineProperty(ConditionalFormattingStyle.prototype, "cellProperties", {
|
|
760
|
+
get: function () {
|
|
761
|
+
if (this.cellPropertiesInstance === undefined) {
|
|
762
|
+
this.cellPropertiesInstance = new TableStyleCellProperties(this, true);
|
|
763
|
+
}
|
|
764
|
+
return this.cellPropertiesInstance;
|
|
765
|
+
},
|
|
766
|
+
enumerable: true,
|
|
767
|
+
configurable: true
|
|
768
|
+
});
|
|
769
|
+
Object.defineProperty(ConditionalFormattingStyle.prototype, "tableProperties", {
|
|
770
|
+
/** Conditional table properties (`w:tblPr` inside tblStylePr). */
|
|
771
|
+
get: function () {
|
|
772
|
+
if (this.tablePropertiesInstance === undefined) {
|
|
773
|
+
this.tablePropertiesInstance = new TableStyleTablePropertiesBridge(this);
|
|
774
|
+
}
|
|
775
|
+
return this.tablePropertiesInstance;
|
|
776
|
+
},
|
|
777
|
+
enumerable: true,
|
|
778
|
+
configurable: true
|
|
779
|
+
});
|
|
780
|
+
/** @private */
|
|
781
|
+
ConditionalFormattingStyle.prototype.notifyCharacterFormatMutation = function () {
|
|
782
|
+
this.syncFormatsToElement();
|
|
783
|
+
this.parent.replaceConditionalElement(this.typeValue, this.element);
|
|
784
|
+
};
|
|
785
|
+
/** @private */
|
|
786
|
+
ConditionalFormattingStyle.prototype.notifyParagraphFormatMutation = function () {
|
|
787
|
+
this.syncFormatsToElement();
|
|
788
|
+
this.parent.replaceConditionalElement(this.typeValue, this.element);
|
|
789
|
+
};
|
|
790
|
+
/** @private */
|
|
791
|
+
ConditionalFormattingStyle.prototype.notifyStructureMutation = function () {
|
|
792
|
+
this.parent.replaceConditionalElement(this.typeValue, this.element);
|
|
793
|
+
};
|
|
794
|
+
ConditionalFormattingStyle.prototype.syncFormatsToElement = function () {
|
|
795
|
+
// Apply format bags without nested notifyStructureMutation mid-sync.
|
|
796
|
+
if (this.characterFormatInstance !== undefined) {
|
|
797
|
+
var kids = buildRPrChildrenFromSnapshot(this.characterFormatInstance.snapshot());
|
|
798
|
+
this.writeChildInternal('rPr', kids.length > 0 ? wmlElement('rPr', { children: kids }) : undefined, false);
|
|
799
|
+
}
|
|
800
|
+
if (this.paragraphFormatInstance !== undefined) {
|
|
801
|
+
var kids = buildPPrChildrenFromSnapshot(this.paragraphFormatInstance.snapshot());
|
|
802
|
+
this.writeChildInternal('pPr', kids.length > 0 ? wmlElement('pPr', { children: kids }) : undefined, false);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
/** @private */
|
|
806
|
+
ConditionalFormattingStyle.prototype.readChild = function (localName) {
|
|
807
|
+
var kids = elementChildren(this.element);
|
|
808
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
809
|
+
if (isWml(kids[i], localName)) {
|
|
810
|
+
return kids[i];
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return undefined;
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Replace/remove a property child and keep OOXML child order.
|
|
817
|
+
* @private
|
|
818
|
+
*/
|
|
819
|
+
ConditionalFormattingStyle.prototype.writeChild = function (localName, next) {
|
|
820
|
+
this.writeChildInternal(localName, next, true);
|
|
821
|
+
};
|
|
822
|
+
ConditionalFormattingStyle.prototype.writeChildInternal = function (localName, next, notifyParent) {
|
|
823
|
+
var kids = elementChildren(this.element);
|
|
824
|
+
var out = [];
|
|
825
|
+
var replaced = false;
|
|
826
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
827
|
+
var child = kids[i];
|
|
828
|
+
if (isWml(child, localName)) {
|
|
829
|
+
if (!replaced && next !== undefined) {
|
|
830
|
+
out.push(next);
|
|
831
|
+
}
|
|
832
|
+
replaced = true;
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
out.push(child);
|
|
836
|
+
}
|
|
837
|
+
if (!replaced && next !== undefined) {
|
|
838
|
+
out.push(next);
|
|
839
|
+
}
|
|
840
|
+
var ordered = orderTblStylePrChildren(out);
|
|
841
|
+
this.element = wmlElement('tblStylePr', {
|
|
842
|
+
attributes: this.element.attributes,
|
|
843
|
+
namespaceDeclarations: this.element.namespaceDeclarations,
|
|
844
|
+
children: ordered,
|
|
845
|
+
});
|
|
846
|
+
if (notifyParent) {
|
|
847
|
+
this.notifyStructureMutation();
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
/** @private */
|
|
851
|
+
ConditionalFormattingStyle.prototype.toElement = function () {
|
|
852
|
+
this.syncFormatsToElement();
|
|
853
|
+
// Ensure order even if only opaque trPr/tcPr mutated without CF/PF.
|
|
854
|
+
this.element = orderTblStylePrElement(this.element);
|
|
855
|
+
return this.element;
|
|
856
|
+
};
|
|
857
|
+
return ConditionalFormattingStyle;
|
|
858
|
+
}());
|
|
859
|
+
export { ConditionalFormattingStyle };
|
|
860
|
+
/**
|
|
861
|
+
* Minimal table-props bridge for conditional blocks (borders/shading subset).
|
|
862
|
+
*
|
|
863
|
+
* @public
|
|
864
|
+
*/
|
|
865
|
+
var TableStyleTablePropertiesBridge = /** @class */ (function () {
|
|
866
|
+
/** @private */
|
|
867
|
+
function TableStyleTablePropertiesBridge(owner) {
|
|
868
|
+
this.owner = owner;
|
|
869
|
+
}
|
|
870
|
+
TableStyleTablePropertiesBridge.prototype.readTblPr = function () {
|
|
871
|
+
return this.owner.readChild('tblPr');
|
|
872
|
+
};
|
|
873
|
+
TableStyleTablePropertiesBridge.prototype.writeTblPr = function (next) {
|
|
874
|
+
this.owner.writeChild('tblPr', next);
|
|
875
|
+
};
|
|
876
|
+
Object.defineProperty(TableStyleTablePropertiesBridge.prototype, "borders", {
|
|
877
|
+
get: function () {
|
|
878
|
+
if (this.bordersInstance === undefined) {
|
|
879
|
+
var self_5 = this;
|
|
880
|
+
var host = {
|
|
881
|
+
readEdge: function (key) {
|
|
882
|
+
var pr = self_5.readTblPr();
|
|
883
|
+
if (pr === undefined) {
|
|
884
|
+
return undefined;
|
|
885
|
+
}
|
|
886
|
+
var bag = readTableBorders(pr);
|
|
887
|
+
return bag !== undefined ? bag[key] : undefined;
|
|
888
|
+
},
|
|
889
|
+
writeEdge: function (key, edge) {
|
|
890
|
+
var pr = self_5.readTblPr() !== undefined ? self_5.readTblPr() : wmlElement('tblPr');
|
|
891
|
+
var current = readTableBorders(pr) !== undefined ? __assign({}, readTableBorders(pr)) : {};
|
|
892
|
+
if (edge === undefined) {
|
|
893
|
+
delete current[key];
|
|
894
|
+
}
|
|
895
|
+
else {
|
|
896
|
+
current[key] = edge;
|
|
897
|
+
}
|
|
898
|
+
var keys = Object.keys(current);
|
|
899
|
+
self_5.writeTblPr(writeTableBorders(pr, keys.length > 0 ? current : undefined));
|
|
900
|
+
},
|
|
901
|
+
};
|
|
902
|
+
this.bordersInstance = new Borders(host);
|
|
903
|
+
}
|
|
904
|
+
return this.bordersInstance;
|
|
905
|
+
},
|
|
906
|
+
enumerable: true,
|
|
907
|
+
configurable: true
|
|
908
|
+
});
|
|
909
|
+
Object.defineProperty(TableStyleTablePropertiesBridge.prototype, "shading", {
|
|
910
|
+
get: function () {
|
|
911
|
+
var pr = this.readTblPr();
|
|
912
|
+
return pr !== undefined ? readTableShading(pr) : undefined;
|
|
913
|
+
},
|
|
914
|
+
set: function (value) {
|
|
915
|
+
var pr = this.readTblPr() !== undefined ? this.readTblPr() : wmlElement('tblPr');
|
|
916
|
+
this.writeTblPr(writeTableShading(pr, value));
|
|
917
|
+
},
|
|
918
|
+
enumerable: true,
|
|
919
|
+
configurable: true
|
|
920
|
+
});
|
|
921
|
+
return TableStyleTablePropertiesBridge;
|
|
922
|
+
}());
|
|
923
|
+
export { TableStyleTablePropertiesBridge };
|
|
924
|
+
/**
|
|
925
|
+
* Collection of conditional formatting styles on a TableStyle.
|
|
926
|
+
*
|
|
927
|
+
* @public
|
|
928
|
+
*/
|
|
929
|
+
var ConditionalFormattingStyleCollection = /** @class */ (function () {
|
|
930
|
+
/** @private */
|
|
931
|
+
function ConditionalFormattingStyleCollection(owner) {
|
|
932
|
+
this.owner = owner;
|
|
933
|
+
}
|
|
934
|
+
Object.defineProperty(ConditionalFormattingStyleCollection.prototype, "count", {
|
|
935
|
+
get: function () {
|
|
936
|
+
return this.owner.listConditional().length;
|
|
937
|
+
},
|
|
938
|
+
enumerable: true,
|
|
939
|
+
configurable: true
|
|
940
|
+
});
|
|
941
|
+
ConditionalFormattingStyleCollection.prototype.item = function (index) {
|
|
942
|
+
var list = this.owner.listConditional();
|
|
943
|
+
if (index < 0 || index >= list.length) {
|
|
944
|
+
throw new RangeError('Conditional formatting index out of range');
|
|
945
|
+
}
|
|
946
|
+
return list[index];
|
|
947
|
+
};
|
|
948
|
+
ConditionalFormattingStyleCollection.prototype.findByType = function (type) {
|
|
949
|
+
var list = this.owner.listConditional();
|
|
950
|
+
for (var i = 0; i < list.length; i += 1) {
|
|
951
|
+
if (list[i].conditionalFormattingType === type) {
|
|
952
|
+
return list[i];
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
return undefined;
|
|
956
|
+
};
|
|
957
|
+
ConditionalFormattingStyleCollection.prototype.add = function (type) {
|
|
958
|
+
var existing = this.findByType(type);
|
|
959
|
+
if (existing !== undefined) {
|
|
960
|
+
return existing;
|
|
961
|
+
}
|
|
962
|
+
var el = wmlElement('tblStylePr', {
|
|
963
|
+
attributes: [wmlAttr('type', type)],
|
|
964
|
+
children: [],
|
|
965
|
+
});
|
|
966
|
+
return this.owner.addConditionalElement(type, el);
|
|
967
|
+
};
|
|
968
|
+
ConditionalFormattingStyleCollection.prototype.clear = function () {
|
|
969
|
+
this.owner.clearConditionals();
|
|
970
|
+
};
|
|
971
|
+
return ConditionalFormattingStyleCollection;
|
|
972
|
+
}());
|
|
973
|
+
export { ConditionalFormattingStyleCollection };
|
|
974
|
+
/**
|
|
975
|
+
* Live table style (`w:style` type=table).
|
|
976
|
+
*
|
|
977
|
+
* @public
|
|
978
|
+
*/
|
|
979
|
+
var TableStyle = /** @class */ (function (_super) {
|
|
980
|
+
__extends(TableStyle, _super);
|
|
981
|
+
/** @private */
|
|
982
|
+
function TableStyle(shell, host) {
|
|
983
|
+
var _this = _super.call(this, shell.styleId, 'table', shell.default, shell.customStyle) || this;
|
|
984
|
+
_this.host = host;
|
|
985
|
+
_this.paragraphFormatValue = new ParagraphFormat(_this);
|
|
986
|
+
_this.hydrateFromDocxStyle(shell);
|
|
987
|
+
return _this;
|
|
988
|
+
}
|
|
989
|
+
/** @private */
|
|
990
|
+
TableStyle.prototype.bindHost = function (host) {
|
|
991
|
+
this.host = host;
|
|
992
|
+
};
|
|
993
|
+
Object.defineProperty(TableStyle.prototype, "paragraphFormat", {
|
|
994
|
+
/**
|
|
995
|
+
* Style-level paragraph formatting (`w:pPr`). Stable facade identity.
|
|
996
|
+
*
|
|
997
|
+
* @public
|
|
998
|
+
*/
|
|
999
|
+
get: function () {
|
|
1000
|
+
return this.paragraphFormatValue;
|
|
1001
|
+
},
|
|
1002
|
+
enumerable: true,
|
|
1003
|
+
configurable: true
|
|
1004
|
+
});
|
|
1005
|
+
Object.defineProperty(TableStyle.prototype, "tableProperties", {
|
|
1006
|
+
get: function () {
|
|
1007
|
+
if (this.tablePropertiesInstance === undefined) {
|
|
1008
|
+
this.tablePropertiesInstance = new TableStyleTableProperties(this);
|
|
1009
|
+
}
|
|
1010
|
+
return this.tablePropertiesInstance;
|
|
1011
|
+
},
|
|
1012
|
+
enumerable: true,
|
|
1013
|
+
configurable: true
|
|
1014
|
+
});
|
|
1015
|
+
Object.defineProperty(TableStyle.prototype, "rowProperties", {
|
|
1016
|
+
get: function () {
|
|
1017
|
+
if (this.rowPropertiesInstance === undefined) {
|
|
1018
|
+
this.rowPropertiesInstance = new TableStyleRowProperties(this, false);
|
|
1019
|
+
}
|
|
1020
|
+
return this.rowPropertiesInstance;
|
|
1021
|
+
},
|
|
1022
|
+
enumerable: true,
|
|
1023
|
+
configurable: true
|
|
1024
|
+
});
|
|
1025
|
+
Object.defineProperty(TableStyle.prototype, "cellProperties", {
|
|
1026
|
+
get: function () {
|
|
1027
|
+
if (this.cellPropertiesInstance === undefined) {
|
|
1028
|
+
this.cellPropertiesInstance = new TableStyleCellProperties(this, false);
|
|
1029
|
+
}
|
|
1030
|
+
return this.cellPropertiesInstance;
|
|
1031
|
+
},
|
|
1032
|
+
enumerable: true,
|
|
1033
|
+
configurable: true
|
|
1034
|
+
});
|
|
1035
|
+
Object.defineProperty(TableStyle.prototype, "conditionalFormattingStyles", {
|
|
1036
|
+
/**
|
|
1037
|
+
* Conditional table formatting styles (`w:tblStylePr`).
|
|
1038
|
+
*
|
|
1039
|
+
* @public
|
|
1040
|
+
*/
|
|
1041
|
+
get: function () {
|
|
1042
|
+
if (this.conditionalCollection === undefined) {
|
|
1043
|
+
this.conditionalCollection = new ConditionalFormattingStyleCollection(this);
|
|
1044
|
+
}
|
|
1045
|
+
return this.conditionalCollection;
|
|
1046
|
+
},
|
|
1047
|
+
enumerable: true,
|
|
1048
|
+
configurable: true
|
|
1049
|
+
});
|
|
1050
|
+
/**
|
|
1051
|
+
* @private
|
|
1052
|
+
*/
|
|
1053
|
+
TableStyle.prototype.hydrateParagraphFormat = function (snapshot) {
|
|
1054
|
+
// Called from Style.hydrateFromDocxStyle (suppressDirty already true).
|
|
1055
|
+
this.paragraphFormatValue.hydrate(snapshot);
|
|
1056
|
+
};
|
|
1057
|
+
/**
|
|
1058
|
+
* @private
|
|
1059
|
+
*/
|
|
1060
|
+
TableStyle.prototype.serializeParagraphProperties = function (out) {
|
|
1061
|
+
var children = this.paragraphFormatValue.buildPPrChildren();
|
|
1062
|
+
if (children.length > 0) {
|
|
1063
|
+
out.push(wmlElement('pPr', { children: children }));
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
/**
|
|
1067
|
+
* Table styles require schema order: meta → pPr → rPr → tblPr → trPr → tcPr → tblStylePr*.
|
|
1068
|
+
* Base {@link Style.serialize} emits opaque children before pPr/rPr; reorder here.
|
|
1069
|
+
*
|
|
1070
|
+
* @private
|
|
1071
|
+
*/
|
|
1072
|
+
TableStyle.prototype.serialize = function () {
|
|
1073
|
+
var raw = _super.prototype.serialize.call(this);
|
|
1074
|
+
return orderTableStyleElement(raw);
|
|
1075
|
+
};
|
|
1076
|
+
/** @private */
|
|
1077
|
+
TableStyle.prototype.notifyCharacterFormatMutation = function () {
|
|
1078
|
+
// Base Style facade is source of truth; serialize emits w:rPr.
|
|
1079
|
+
_super.prototype.notifyCharacterFormatMutation.call(this);
|
|
1080
|
+
this.notifyHost();
|
|
1081
|
+
};
|
|
1082
|
+
/** @private */
|
|
1083
|
+
TableStyle.prototype.notifyParagraphFormatMutation = function () {
|
|
1084
|
+
this.ensureAttached();
|
|
1085
|
+
this.markDirty();
|
|
1086
|
+
this.notifyHost();
|
|
1087
|
+
};
|
|
1088
|
+
TableStyle.prototype.notifyHost = function () {
|
|
1089
|
+
if (this.host !== undefined) {
|
|
1090
|
+
this.host.notifyTableStyleMutation();
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
/**
|
|
1094
|
+
* @private
|
|
1095
|
+
* Read a base property child from the style shell (pPr/rPr/tblPr/trPr/tcPr).
|
|
1096
|
+
*/
|
|
1097
|
+
TableStyle.prototype.readBaseChild = function (localName) {
|
|
1098
|
+
var serialized = this.toDocxStyle().serialize();
|
|
1099
|
+
var kids = elementChildren(serialized);
|
|
1100
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
1101
|
+
if (isWml(kids[i], localName)) {
|
|
1102
|
+
return kids[i];
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
return undefined;
|
|
1106
|
+
};
|
|
1107
|
+
/**
|
|
1108
|
+
* @private
|
|
1109
|
+
* Replace a base property child and rewrite the DocxStyle shell.
|
|
1110
|
+
*/
|
|
1111
|
+
TableStyle.prototype.writeBaseChild = function (localName, next) {
|
|
1112
|
+
var shell = this.toDocxStyle();
|
|
1113
|
+
var root = shell.serialize();
|
|
1114
|
+
var kids = elementChildren(root);
|
|
1115
|
+
var out = [];
|
|
1116
|
+
var replaced = false;
|
|
1117
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
1118
|
+
var child = kids[i];
|
|
1119
|
+
if (isWml(child, localName) && localName !== 'tblStylePr') {
|
|
1120
|
+
if (!replaced && next !== undefined) {
|
|
1121
|
+
out.push(next);
|
|
1122
|
+
}
|
|
1123
|
+
replaced = true;
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
out.push(child);
|
|
1127
|
+
}
|
|
1128
|
+
if (!replaced && next !== undefined) {
|
|
1129
|
+
out.push(next);
|
|
1130
|
+
}
|
|
1131
|
+
this.replaceShellFromChildren(shell, root, out);
|
|
1132
|
+
this.conditionalCache = undefined;
|
|
1133
|
+
this.notifyHost();
|
|
1134
|
+
};
|
|
1135
|
+
TableStyle.prototype.replaceShellFromChildren = function (shell, root, children) {
|
|
1136
|
+
// Always persist schema-ordered children so hydrate opaque order is stable.
|
|
1137
|
+
var orderedRoot = orderTableStyleElement(wmlElement('style', {
|
|
1138
|
+
attributes: root.attributes,
|
|
1139
|
+
namespaceDeclarations: root.namespaceDeclarations,
|
|
1140
|
+
children: children,
|
|
1141
|
+
}));
|
|
1142
|
+
var orderedKids = elementChildren(orderedRoot);
|
|
1143
|
+
var parsed = parseDocxStyle(orderedRoot);
|
|
1144
|
+
if (parsed !== undefined) {
|
|
1145
|
+
this.replaceShell(parsed);
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
void shell;
|
|
1149
|
+
this.replaceShell(new DocxStyle(this.styleId, 'table', undefined, undefined, orderedKids.slice()));
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
/** @private */
|
|
1153
|
+
TableStyle.prototype.listConditional = function () {
|
|
1154
|
+
if (this.conditionalCache !== undefined) {
|
|
1155
|
+
return this.conditionalCache;
|
|
1156
|
+
}
|
|
1157
|
+
var root = this.toDocxStyle().serialize();
|
|
1158
|
+
var kids = elementChildren(root);
|
|
1159
|
+
var list = [];
|
|
1160
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
1161
|
+
var child = kids[i];
|
|
1162
|
+
if (!isWml(child, 'tblStylePr')) {
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
var typeRaw = wValAttribute(child) !== undefined ? wValAttribute(child) : attrLocal(child, 'type');
|
|
1166
|
+
if (typeRaw === undefined || !isConditionalType(typeRaw)) {
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
list.push(new ConditionalFormattingStyle(this, typeRaw, child));
|
|
1170
|
+
}
|
|
1171
|
+
this.conditionalCache = list;
|
|
1172
|
+
return list;
|
|
1173
|
+
};
|
|
1174
|
+
/** @private */
|
|
1175
|
+
TableStyle.prototype.addConditionalElement = function (type, el) {
|
|
1176
|
+
var orderedEl = orderTblStylePrElement(el);
|
|
1177
|
+
var shell = this.toDocxStyle();
|
|
1178
|
+
var root = shell.serialize();
|
|
1179
|
+
var kids = elementChildren(root).slice();
|
|
1180
|
+
kids.push(orderedEl);
|
|
1181
|
+
this.replaceShellFromChildren(shell, root, kids);
|
|
1182
|
+
this.conditionalCache = undefined;
|
|
1183
|
+
this.notifyHost();
|
|
1184
|
+
return new ConditionalFormattingStyle(this, type, orderedEl);
|
|
1185
|
+
};
|
|
1186
|
+
/** @private */
|
|
1187
|
+
TableStyle.prototype.replaceConditionalElement = function (type, el) {
|
|
1188
|
+
var orderedEl = orderTblStylePrElement(el);
|
|
1189
|
+
var shell = this.toDocxStyle();
|
|
1190
|
+
var root = shell.serialize();
|
|
1191
|
+
var kids = elementChildren(root);
|
|
1192
|
+
var out = [];
|
|
1193
|
+
var replaced = false;
|
|
1194
|
+
for (var i = 0; i < kids.length; i += 1) {
|
|
1195
|
+
var child = kids[i];
|
|
1196
|
+
if (isWml(child, 'tblStylePr')) {
|
|
1197
|
+
var typeRaw = wValAttribute(child) !== undefined ? wValAttribute(child) : attrLocal(child, 'type');
|
|
1198
|
+
if (typeRaw === type) {
|
|
1199
|
+
if (!replaced) {
|
|
1200
|
+
out.push(orderedEl);
|
|
1201
|
+
replaced = true;
|
|
1202
|
+
}
|
|
1203
|
+
continue;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
out.push(child);
|
|
1207
|
+
}
|
|
1208
|
+
if (!replaced) {
|
|
1209
|
+
out.push(orderedEl);
|
|
1210
|
+
}
|
|
1211
|
+
this.replaceShellFromChildren(shell, root, out);
|
|
1212
|
+
this.conditionalCache = undefined;
|
|
1213
|
+
this.notifyHost();
|
|
1214
|
+
};
|
|
1215
|
+
/** @private */
|
|
1216
|
+
TableStyle.prototype.clearConditionals = function () {
|
|
1217
|
+
var shell = this.toDocxStyle();
|
|
1218
|
+
var root = shell.serialize();
|
|
1219
|
+
var kids = elementChildren(root).filter(function (c) { return !isWml(c, 'tblStylePr'); });
|
|
1220
|
+
this.replaceShellFromChildren(shell, root, kids);
|
|
1221
|
+
this.conditionalCache = undefined;
|
|
1222
|
+
this.notifyHost();
|
|
1223
|
+
};
|
|
1224
|
+
return TableStyle;
|
|
1225
|
+
}(Style));
|
|
1226
|
+
export { TableStyle };
|