@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,162 @@
|
|
|
1
|
+
import { BodyItem } from './body-item';
|
|
2
|
+
import { BodyItemCollection } from './body-item-collection';
|
|
3
|
+
import { Paragraph } from './paragraph';
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* Factory that creates a detached instance for typed `add()` / `insert()` with
|
|
7
|
+
* no customer-supplied item (paragraph / table / block CC shells).
|
|
8
|
+
*/
|
|
9
|
+
export declare type TypedItemFactory<T extends BodyItem> = () => T;
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
export declare type TypedCollectionFilter<T extends BodyItem> = (item: BodyItem) => item is T;
|
|
14
|
+
/**
|
|
15
|
+
* Filtered view over {@link BodyItemCollection} for one body-item kind.
|
|
16
|
+
*
|
|
17
|
+
* Insert index is among items of this type only; the item is placed at the
|
|
18
|
+
* corresponding position in the full body order.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare class TypedBodyItemCollection<T extends BodyItem> implements Iterable<T> {
|
|
23
|
+
private readonly items;
|
|
24
|
+
private readonly typeFilter;
|
|
25
|
+
private readonly factory;
|
|
26
|
+
private cachedLength;
|
|
27
|
+
/** @private */
|
|
28
|
+
constructor(items: BodyItemCollection, typeFilter: TypedCollectionFilter<T>, factory?: TypedItemFactory<T>);
|
|
29
|
+
/** Number of items of this type in the body. */
|
|
30
|
+
readonly count: number;
|
|
31
|
+
/**
|
|
32
|
+
* Alias of {@link count} for array-like consumers (`toHaveLength`, `.length`).
|
|
33
|
+
*/
|
|
34
|
+
readonly length: number;
|
|
35
|
+
/**
|
|
36
|
+
* Append a new item of this type (uses the registered factory when no
|
|
37
|
+
* `item` is passed), or append the given instance.
|
|
38
|
+
*/
|
|
39
|
+
add(item?: T): T;
|
|
40
|
+
/**
|
|
41
|
+
* Insert at a typed index (`0…count` inclusive).
|
|
42
|
+
*
|
|
43
|
+
* @throws RangeError when `index` is outside `0…count`.
|
|
44
|
+
* @throws TypeError when no factory is registered and `item` is omitted.
|
|
45
|
+
*/
|
|
46
|
+
insert(index: number, item?: T): T;
|
|
47
|
+
/**
|
|
48
|
+
* Remove by instance identity.
|
|
49
|
+
*/
|
|
50
|
+
remove(item: T): void;
|
|
51
|
+
/**
|
|
52
|
+
* Remove at a typed index.
|
|
53
|
+
*/
|
|
54
|
+
removeAt(index: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Typed index of `item`, or `-1`.
|
|
57
|
+
*/
|
|
58
|
+
indexOf(item: T): number;
|
|
59
|
+
/**
|
|
60
|
+
* Snapshot of items of this type in document order.
|
|
61
|
+
*/
|
|
62
|
+
toArray(): T[];
|
|
63
|
+
/**
|
|
64
|
+
* Invoke `fn` for each item of this type.
|
|
65
|
+
*/
|
|
66
|
+
forEach(fn: (item: T, index: number) => void): void;
|
|
67
|
+
/**
|
|
68
|
+
* True when at least one item of this type satisfies `predicate`.
|
|
69
|
+
*/
|
|
70
|
+
some(predicate: (item: T, index: number) => boolean): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Items of this type that satisfy `predicate`.
|
|
73
|
+
*/
|
|
74
|
+
filter(predicate: (item: T, index: number) => boolean): T[];
|
|
75
|
+
/**
|
|
76
|
+
* First item of this type that satisfies `predicate`, or `undefined`.
|
|
77
|
+
*/
|
|
78
|
+
find(predicate: (item: T, index: number) => boolean): T | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Map items of this type with `fn`.
|
|
81
|
+
*/
|
|
82
|
+
map<U>(fn: (item: T, index: number) => U): U[];
|
|
83
|
+
[Symbol.iterator](): Iterator<T>;
|
|
84
|
+
/**
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
syncFromHost(): void;
|
|
88
|
+
/**
|
|
89
|
+
* @private
|
|
90
|
+
* Replace the factory used by parameterless add/insert.
|
|
91
|
+
*/
|
|
92
|
+
setFactory(factory: TypedItemFactory<T> | undefined): void;
|
|
93
|
+
private list;
|
|
94
|
+
private bodyIndexForTypedInsert;
|
|
95
|
+
private rebuildIndexProperties;
|
|
96
|
+
}
|
|
97
|
+
export interface TypedBodyItemCollection<T extends BodyItem> {
|
|
98
|
+
readonly [index: number]: T;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Paragraphs in a section body (filtered view).
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export declare class ParagraphCollection extends TypedBodyItemCollection<Paragraph> {
|
|
106
|
+
/** @private */
|
|
107
|
+
constructor(items: BodyItemCollection, factory?: TypedItemFactory<Paragraph>);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Tables in a section body (filtered view).
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
export declare class TableCollection extends TypedBodyItemCollection<BodyItem> {
|
|
115
|
+
/** @private */
|
|
116
|
+
constructor(items: BodyItemCollection, isTable: TypedCollectionFilter<BodyItem>, factory?: TypedItemFactory<BodyItem>);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Block content controls in a section body (filtered view).
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export declare class BlockContentControlCollection extends TypedBodyItemCollection<BodyItem> {
|
|
124
|
+
/** @private */
|
|
125
|
+
constructor(items: BodyItemCollection, isBlockCc: TypedCollectionFilter<BodyItem>, factory?: TypedItemFactory<BodyItem>);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @private
|
|
129
|
+
* Registration hooks so features can supply table / CC factories and filters
|
|
130
|
+
* without core value-importing feature modules.
|
|
131
|
+
*/
|
|
132
|
+
export declare type TypedCollectionHooks = {
|
|
133
|
+
isTable?(item: BodyItem): boolean;
|
|
134
|
+
createTable?(): BodyItem;
|
|
135
|
+
isBlockContentControl?(item: BodyItem): boolean;
|
|
136
|
+
createBlockContentControl?(): BodyItem;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
export declare function registerTypedCollectionHooks(hooks: TypedCollectionHooks): void;
|
|
142
|
+
/**
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
export declare function resetTypedCollectionHooksForTests(): void;
|
|
146
|
+
/**
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
export declare function currentTypedCollectionHooks(): TypedCollectionHooks;
|
|
150
|
+
/**
|
|
151
|
+
* @private
|
|
152
|
+
* Live filter/factory over {@link currentTypedCollectionHooks} so long-lived
|
|
153
|
+
* section collections do not permanently capture a pre-registration snapshot
|
|
154
|
+
* (hooks object is replaced on each {@link registerTypedCollectionHooks} call).
|
|
155
|
+
*/
|
|
156
|
+
export declare function createTableCollection(items: BodyItemCollection): TableCollection;
|
|
157
|
+
/**
|
|
158
|
+
* @private
|
|
159
|
+
* Live filter/factory over {@link currentTypedCollectionHooks} (see
|
|
160
|
+
* {@link createTableCollection}).
|
|
161
|
+
*/
|
|
162
|
+
export declare function createBlockContentControlCollection(items: BodyItemCollection): BlockContentControlCollection;
|
|
@@ -0,0 +1,371 @@
|
|
|
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
|
+
import { DetachedObjectError } from '../../core/errors/docx-error';
|
|
26
|
+
import { Paragraph } from './paragraph';
|
|
27
|
+
/**
|
|
28
|
+
* Filtered view over {@link BodyItemCollection} for one body-item kind.
|
|
29
|
+
*
|
|
30
|
+
* Insert index is among items of this type only; the item is placed at the
|
|
31
|
+
* corresponding position in the full body order.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
var TypedBodyItemCollection = /** @class */ (function () {
|
|
36
|
+
/** @private */
|
|
37
|
+
function TypedBodyItemCollection(items, typeFilter, factory) {
|
|
38
|
+
this.cachedLength = 0;
|
|
39
|
+
this.items = items;
|
|
40
|
+
this.typeFilter = typeFilter;
|
|
41
|
+
this.factory = factory;
|
|
42
|
+
this.rebuildIndexProperties();
|
|
43
|
+
}
|
|
44
|
+
Object.defineProperty(TypedBodyItemCollection.prototype, "count", {
|
|
45
|
+
/** Number of items of this type in the body. */
|
|
46
|
+
get: function () {
|
|
47
|
+
return this.list().length;
|
|
48
|
+
},
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(TypedBodyItemCollection.prototype, "length", {
|
|
53
|
+
/**
|
|
54
|
+
* Alias of {@link count} for array-like consumers (`toHaveLength`, `.length`).
|
|
55
|
+
*/
|
|
56
|
+
get: function () {
|
|
57
|
+
return this.count;
|
|
58
|
+
},
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Append a new item of this type (uses the registered factory when no
|
|
64
|
+
* `item` is passed), or append the given instance.
|
|
65
|
+
*/
|
|
66
|
+
TypedBodyItemCollection.prototype.add = function (item) {
|
|
67
|
+
return this.insert(this.count, item);
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Insert at a typed index (`0…count` inclusive).
|
|
71
|
+
*
|
|
72
|
+
* @throws RangeError when `index` is outside `0…count`.
|
|
73
|
+
* @throws TypeError when no factory is registered and `item` is omitted.
|
|
74
|
+
*/
|
|
75
|
+
TypedBodyItemCollection.prototype.insert = function (index, item) {
|
|
76
|
+
var typed = this.list();
|
|
77
|
+
if (index < 0 || index > typed.length) {
|
|
78
|
+
throw new RangeError("Index " + String(index) + " is out of range");
|
|
79
|
+
}
|
|
80
|
+
var value;
|
|
81
|
+
if (item !== undefined) {
|
|
82
|
+
value = item;
|
|
83
|
+
}
|
|
84
|
+
else if (this.factory !== undefined) {
|
|
85
|
+
value = this.factory();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
throw new TypeError('No item provided and no factory is registered for this collection');
|
|
89
|
+
}
|
|
90
|
+
if (!this.typeFilter(value)) {
|
|
91
|
+
throw new TypeError('Item type does not match this collection');
|
|
92
|
+
}
|
|
93
|
+
var bodyIndex = this.bodyIndexForTypedInsert(index, typed);
|
|
94
|
+
this.items.insert(bodyIndex, value);
|
|
95
|
+
this.rebuildIndexProperties();
|
|
96
|
+
return value;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Remove by instance identity.
|
|
100
|
+
*/
|
|
101
|
+
TypedBodyItemCollection.prototype.remove = function (item) {
|
|
102
|
+
if (this.items.indexOf(item) === -1 || !this.typeFilter(item)) {
|
|
103
|
+
throw new DetachedObjectError('Item is not in this collection');
|
|
104
|
+
}
|
|
105
|
+
this.items.remove(item);
|
|
106
|
+
this.rebuildIndexProperties();
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Remove at a typed index.
|
|
110
|
+
*/
|
|
111
|
+
TypedBodyItemCollection.prototype.removeAt = function (index) {
|
|
112
|
+
var typed = this.list();
|
|
113
|
+
if (index < 0 || index >= typed.length) {
|
|
114
|
+
throw new RangeError("Index " + String(index) + " is out of range");
|
|
115
|
+
}
|
|
116
|
+
this.items.remove(typed[index]);
|
|
117
|
+
this.rebuildIndexProperties();
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Typed index of `item`, or `-1`.
|
|
121
|
+
*/
|
|
122
|
+
TypedBodyItemCollection.prototype.indexOf = function (item) {
|
|
123
|
+
var typed = this.list();
|
|
124
|
+
for (var i = 0; i < typed.length; i += 1) {
|
|
125
|
+
if (typed[i] === item) {
|
|
126
|
+
return i;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return -1;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Snapshot of items of this type in document order.
|
|
133
|
+
*/
|
|
134
|
+
TypedBodyItemCollection.prototype.toArray = function () {
|
|
135
|
+
return this.list();
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Invoke `fn` for each item of this type.
|
|
139
|
+
*/
|
|
140
|
+
TypedBodyItemCollection.prototype.forEach = function (fn) {
|
|
141
|
+
var items = this.list();
|
|
142
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
143
|
+
fn(items[i], i);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* True when at least one item of this type satisfies `predicate`.
|
|
148
|
+
*/
|
|
149
|
+
TypedBodyItemCollection.prototype.some = function (predicate) {
|
|
150
|
+
var items = this.list();
|
|
151
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
152
|
+
if (predicate(items[i], i)) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Items of this type that satisfy `predicate`.
|
|
160
|
+
*/
|
|
161
|
+
TypedBodyItemCollection.prototype.filter = function (predicate) {
|
|
162
|
+
var items = this.list();
|
|
163
|
+
var out = [];
|
|
164
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
165
|
+
var item = items[i];
|
|
166
|
+
if (predicate(item, i)) {
|
|
167
|
+
out.push(item);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return out;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* First item of this type that satisfies `predicate`, or `undefined`.
|
|
174
|
+
*/
|
|
175
|
+
TypedBodyItemCollection.prototype.find = function (predicate) {
|
|
176
|
+
var items = this.list();
|
|
177
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
178
|
+
var item = items[i];
|
|
179
|
+
if (predicate(item, i)) {
|
|
180
|
+
return item;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Map items of this type with `fn`.
|
|
187
|
+
*/
|
|
188
|
+
TypedBodyItemCollection.prototype.map = function (fn) {
|
|
189
|
+
var items = this.list();
|
|
190
|
+
var out = [];
|
|
191
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
192
|
+
out.push(fn(items[i], i));
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
};
|
|
196
|
+
TypedBodyItemCollection.prototype[Symbol.iterator] = function () {
|
|
197
|
+
var items = this.list();
|
|
198
|
+
var i = 0;
|
|
199
|
+
return {
|
|
200
|
+
next: function () {
|
|
201
|
+
if (i >= items.length) {
|
|
202
|
+
return { done: true, value: undefined };
|
|
203
|
+
}
|
|
204
|
+
var value = items[i];
|
|
205
|
+
i += 1;
|
|
206
|
+
return { done: false, value: value };
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
TypedBodyItemCollection.prototype.syncFromHost = function () {
|
|
214
|
+
this.rebuildIndexProperties();
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* @private
|
|
218
|
+
* Replace the factory used by parameterless add/insert.
|
|
219
|
+
*/
|
|
220
|
+
TypedBodyItemCollection.prototype.setFactory = function (factory) {
|
|
221
|
+
this.factory = factory;
|
|
222
|
+
};
|
|
223
|
+
TypedBodyItemCollection.prototype.list = function () {
|
|
224
|
+
var out = [];
|
|
225
|
+
var length = this.items.count;
|
|
226
|
+
for (var i = 0; i < length; i += 1) {
|
|
227
|
+
var item = this.items[i];
|
|
228
|
+
if (item !== undefined && this.typeFilter(item)) {
|
|
229
|
+
out.push(item);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return out;
|
|
233
|
+
};
|
|
234
|
+
TypedBodyItemCollection.prototype.bodyIndexForTypedInsert = function (typedIndex, typed) {
|
|
235
|
+
if (typedIndex === typed.length) {
|
|
236
|
+
// Typed append is document-order: place at the end of the body,
|
|
237
|
+
// not after the last item of this type (which would skip later
|
|
238
|
+
// tables / SDTs and break mixed-body authoring order).
|
|
239
|
+
return this.items.count;
|
|
240
|
+
}
|
|
241
|
+
var target = typed[typedIndex];
|
|
242
|
+
var at = this.items.indexOf(target);
|
|
243
|
+
if (at === -1) {
|
|
244
|
+
throw new DetachedObjectError('Typed collection index is inconsistent');
|
|
245
|
+
}
|
|
246
|
+
return at;
|
|
247
|
+
};
|
|
248
|
+
TypedBodyItemCollection.prototype.rebuildIndexProperties = function () {
|
|
249
|
+
var items = this.list();
|
|
250
|
+
var nextLen = items.length;
|
|
251
|
+
var prevLen = this.cachedLength;
|
|
252
|
+
var limit = prevLen > nextLen ? prevLen : nextLen;
|
|
253
|
+
for (var i = 0; i < limit; i += 1) {
|
|
254
|
+
var key = String(i);
|
|
255
|
+
if (i < nextLen) {
|
|
256
|
+
Object.defineProperty(this, key, {
|
|
257
|
+
value: items[i],
|
|
258
|
+
writable: false,
|
|
259
|
+
enumerable: true,
|
|
260
|
+
configurable: true,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
delete this[key];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
this.cachedLength = nextLen;
|
|
268
|
+
};
|
|
269
|
+
return TypedBodyItemCollection;
|
|
270
|
+
}());
|
|
271
|
+
export { TypedBodyItemCollection };
|
|
272
|
+
/**
|
|
273
|
+
* Paragraphs in a section body (filtered view).
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
var ParagraphCollection = /** @class */ (function (_super) {
|
|
278
|
+
__extends(ParagraphCollection, _super);
|
|
279
|
+
/** @private */
|
|
280
|
+
function ParagraphCollection(items, factory) {
|
|
281
|
+
return _super.call(this, items, function (item) { return item instanceof Paragraph; }, factory) || this;
|
|
282
|
+
}
|
|
283
|
+
return ParagraphCollection;
|
|
284
|
+
}(TypedBodyItemCollection));
|
|
285
|
+
export { ParagraphCollection };
|
|
286
|
+
/**
|
|
287
|
+
* Tables in a section body (filtered view).
|
|
288
|
+
*
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
var TableCollection = /** @class */ (function (_super) {
|
|
292
|
+
__extends(TableCollection, _super);
|
|
293
|
+
/** @private */
|
|
294
|
+
function TableCollection(items, isTable, factory) {
|
|
295
|
+
return _super.call(this, items, isTable, factory) || this;
|
|
296
|
+
}
|
|
297
|
+
return TableCollection;
|
|
298
|
+
}(TypedBodyItemCollection));
|
|
299
|
+
export { TableCollection };
|
|
300
|
+
/**
|
|
301
|
+
* Block content controls in a section body (filtered view).
|
|
302
|
+
*
|
|
303
|
+
* @public
|
|
304
|
+
*/
|
|
305
|
+
var BlockContentControlCollection = /** @class */ (function (_super) {
|
|
306
|
+
__extends(BlockContentControlCollection, _super);
|
|
307
|
+
/** @private */
|
|
308
|
+
function BlockContentControlCollection(items, isBlockCc, factory) {
|
|
309
|
+
return _super.call(this, items, isBlockCc, factory) || this;
|
|
310
|
+
}
|
|
311
|
+
return BlockContentControlCollection;
|
|
312
|
+
}(TypedBodyItemCollection));
|
|
313
|
+
export { BlockContentControlCollection };
|
|
314
|
+
var typedHooks = {};
|
|
315
|
+
/**
|
|
316
|
+
* @private
|
|
317
|
+
*/
|
|
318
|
+
export function registerTypedCollectionHooks(hooks) {
|
|
319
|
+
typedHooks = __assign({}, typedHooks, hooks);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* @private
|
|
323
|
+
*/
|
|
324
|
+
export function resetTypedCollectionHooksForTests() {
|
|
325
|
+
typedHooks = {};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @private
|
|
329
|
+
*/
|
|
330
|
+
export function currentTypedCollectionHooks() {
|
|
331
|
+
return typedHooks;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @private
|
|
335
|
+
* Live filter/factory over {@link currentTypedCollectionHooks} so long-lived
|
|
336
|
+
* section collections do not permanently capture a pre-registration snapshot
|
|
337
|
+
* (hooks object is replaced on each {@link registerTypedCollectionHooks} call).
|
|
338
|
+
*/
|
|
339
|
+
export function createTableCollection(items) {
|
|
340
|
+
var filter = function (item) {
|
|
341
|
+
var isTable = currentTypedCollectionHooks().isTable;
|
|
342
|
+
return isTable !== undefined ? isTable(item) : false;
|
|
343
|
+
};
|
|
344
|
+
var factory = function () {
|
|
345
|
+
var create = currentTypedCollectionHooks().createTable;
|
|
346
|
+
if (create === undefined) {
|
|
347
|
+
throw new TypeError('No item provided and no factory is registered for this collection');
|
|
348
|
+
}
|
|
349
|
+
return create();
|
|
350
|
+
};
|
|
351
|
+
return new TableCollection(items, filter, factory);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* @private
|
|
355
|
+
* Live filter/factory over {@link currentTypedCollectionHooks} (see
|
|
356
|
+
* {@link createTableCollection}).
|
|
357
|
+
*/
|
|
358
|
+
export function createBlockContentControlCollection(items) {
|
|
359
|
+
var filter = function (item) {
|
|
360
|
+
var isBlockCc = currentTypedCollectionHooks().isBlockContentControl;
|
|
361
|
+
return isBlockCc !== undefined ? isBlockCc(item) : false;
|
|
362
|
+
};
|
|
363
|
+
var factory = function () {
|
|
364
|
+
var create = currentTypedCollectionHooks().createBlockContentControl;
|
|
365
|
+
if (create === undefined) {
|
|
366
|
+
throw new TypeError('No item provided and no factory is registered for this collection');
|
|
367
|
+
}
|
|
368
|
+
return create();
|
|
369
|
+
};
|
|
370
|
+
return new BlockContentControlCollection(items, filter, factory);
|
|
371
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Underline styles for character format (`w:u` / ST_Underline).
|
|
3
|
+
*
|
|
4
|
+
* Numeric values match the DocIO / requirement surface. Value 8 is reserved
|
|
5
|
+
* and intentionally unused.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare enum UnderlineStyle {
|
|
10
|
+
None = 0,
|
|
11
|
+
Single = 1,
|
|
12
|
+
Words = 2,
|
|
13
|
+
Double = 3,
|
|
14
|
+
Dotted = 4,
|
|
15
|
+
Thick = 6,
|
|
16
|
+
Dash = 7,
|
|
17
|
+
DotDash = 9,
|
|
18
|
+
DotDotDash = 10,
|
|
19
|
+
Wavy = 11,
|
|
20
|
+
DottedHeavy = 20,
|
|
21
|
+
DashHeavy = 23,
|
|
22
|
+
DotDashHeavy = 25,
|
|
23
|
+
DotDotDashHeavy = 26,
|
|
24
|
+
WavyHeavy = 27,
|
|
25
|
+
DashLong = 39,
|
|
26
|
+
DashLongHeavy = 55,
|
|
27
|
+
WavyDouble = 43
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Map ST_Underline wire string to {@link UnderlineStyle}.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
export declare function underlineStyleFromWire(raw: string | undefined): UnderlineStyle;
|
|
34
|
+
/**
|
|
35
|
+
* Map {@link UnderlineStyle} to the preferred ST_Underline wire string.
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
export declare function underlineStyleToWire(style: UnderlineStyle): string;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Underline styles for character format (`w:u` / ST_Underline).
|
|
3
|
+
*
|
|
4
|
+
* Numeric values match the DocIO / requirement surface. Value 8 is reserved
|
|
5
|
+
* and intentionally unused.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export var UnderlineStyle;
|
|
10
|
+
(function (UnderlineStyle) {
|
|
11
|
+
UnderlineStyle[UnderlineStyle["None"] = 0] = "None";
|
|
12
|
+
UnderlineStyle[UnderlineStyle["Single"] = 1] = "Single";
|
|
13
|
+
UnderlineStyle[UnderlineStyle["Words"] = 2] = "Words";
|
|
14
|
+
UnderlineStyle[UnderlineStyle["Double"] = 3] = "Double";
|
|
15
|
+
UnderlineStyle[UnderlineStyle["Dotted"] = 4] = "Dotted";
|
|
16
|
+
UnderlineStyle[UnderlineStyle["Thick"] = 6] = "Thick";
|
|
17
|
+
UnderlineStyle[UnderlineStyle["Dash"] = 7] = "Dash";
|
|
18
|
+
UnderlineStyle[UnderlineStyle["DotDash"] = 9] = "DotDash";
|
|
19
|
+
UnderlineStyle[UnderlineStyle["DotDotDash"] = 10] = "DotDotDash";
|
|
20
|
+
UnderlineStyle[UnderlineStyle["Wavy"] = 11] = "Wavy";
|
|
21
|
+
UnderlineStyle[UnderlineStyle["DottedHeavy"] = 20] = "DottedHeavy";
|
|
22
|
+
UnderlineStyle[UnderlineStyle["DashHeavy"] = 23] = "DashHeavy";
|
|
23
|
+
UnderlineStyle[UnderlineStyle["DotDashHeavy"] = 25] = "DotDashHeavy";
|
|
24
|
+
UnderlineStyle[UnderlineStyle["DotDotDashHeavy"] = 26] = "DotDotDashHeavy";
|
|
25
|
+
UnderlineStyle[UnderlineStyle["WavyHeavy"] = 27] = "WavyHeavy";
|
|
26
|
+
UnderlineStyle[UnderlineStyle["DashLong"] = 39] = "DashLong";
|
|
27
|
+
UnderlineStyle[UnderlineStyle["DashLongHeavy"] = 55] = "DashLongHeavy";
|
|
28
|
+
UnderlineStyle[UnderlineStyle["WavyDouble"] = 43] = "WavyDouble";
|
|
29
|
+
})(UnderlineStyle || (UnderlineStyle = {}));
|
|
30
|
+
/**
|
|
31
|
+
* Map ST_Underline wire string to {@link UnderlineStyle}.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
export function underlineStyleFromWire(raw) {
|
|
35
|
+
if (raw === undefined || raw === '' || raw === 'none') {
|
|
36
|
+
return UnderlineStyle.None;
|
|
37
|
+
}
|
|
38
|
+
switch (raw) {
|
|
39
|
+
case 'single':
|
|
40
|
+
return UnderlineStyle.Single;
|
|
41
|
+
case 'words':
|
|
42
|
+
return UnderlineStyle.Words;
|
|
43
|
+
case 'double':
|
|
44
|
+
return UnderlineStyle.Double;
|
|
45
|
+
case 'thick':
|
|
46
|
+
return UnderlineStyle.Thick;
|
|
47
|
+
case 'dotted':
|
|
48
|
+
return UnderlineStyle.Dotted;
|
|
49
|
+
case 'dottedHeavy':
|
|
50
|
+
return UnderlineStyle.DottedHeavy;
|
|
51
|
+
case 'dash':
|
|
52
|
+
return UnderlineStyle.Dash;
|
|
53
|
+
case 'dashed':
|
|
54
|
+
case 'dashedHeavy':
|
|
55
|
+
return UnderlineStyle.DashHeavy;
|
|
56
|
+
case 'dashLong':
|
|
57
|
+
return UnderlineStyle.DashLong;
|
|
58
|
+
case 'dashLongHeavy':
|
|
59
|
+
return UnderlineStyle.DashLongHeavy;
|
|
60
|
+
case 'dotDash':
|
|
61
|
+
return UnderlineStyle.DotDash;
|
|
62
|
+
case 'dashDotHeavy':
|
|
63
|
+
case 'dotDashHeavy':
|
|
64
|
+
return UnderlineStyle.DotDashHeavy;
|
|
65
|
+
case 'dotDotDash':
|
|
66
|
+
return UnderlineStyle.DotDotDash;
|
|
67
|
+
case 'dashDotDotHeavy':
|
|
68
|
+
case 'dotDotDashHeavy':
|
|
69
|
+
return UnderlineStyle.DotDotDashHeavy;
|
|
70
|
+
case 'wave':
|
|
71
|
+
case 'wavy':
|
|
72
|
+
return UnderlineStyle.Wavy;
|
|
73
|
+
case 'wavyHeavy':
|
|
74
|
+
return UnderlineStyle.WavyHeavy;
|
|
75
|
+
case 'wavyDouble':
|
|
76
|
+
return UnderlineStyle.WavyDouble;
|
|
77
|
+
default:
|
|
78
|
+
return UnderlineStyle.Single;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Map {@link UnderlineStyle} to the preferred ST_Underline wire string.
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
export function underlineStyleToWire(style) {
|
|
86
|
+
switch (style) {
|
|
87
|
+
case UnderlineStyle.None:
|
|
88
|
+
return 'none';
|
|
89
|
+
case UnderlineStyle.Single:
|
|
90
|
+
return 'single';
|
|
91
|
+
case UnderlineStyle.Words:
|
|
92
|
+
return 'words';
|
|
93
|
+
case UnderlineStyle.Double:
|
|
94
|
+
return 'double';
|
|
95
|
+
case UnderlineStyle.Dotted:
|
|
96
|
+
return 'dotted';
|
|
97
|
+
case UnderlineStyle.Thick:
|
|
98
|
+
return 'thick';
|
|
99
|
+
case UnderlineStyle.Dash:
|
|
100
|
+
return 'dash';
|
|
101
|
+
case UnderlineStyle.DotDash:
|
|
102
|
+
return 'dotDash';
|
|
103
|
+
case UnderlineStyle.DotDotDash:
|
|
104
|
+
return 'dotDotDash';
|
|
105
|
+
case UnderlineStyle.Wavy:
|
|
106
|
+
return 'wave';
|
|
107
|
+
case UnderlineStyle.DottedHeavy:
|
|
108
|
+
return 'dottedHeavy';
|
|
109
|
+
case UnderlineStyle.DashHeavy:
|
|
110
|
+
return 'dashedHeavy';
|
|
111
|
+
case UnderlineStyle.DotDashHeavy:
|
|
112
|
+
return 'dotDashHeavy';
|
|
113
|
+
case UnderlineStyle.DotDotDashHeavy:
|
|
114
|
+
return 'dashDotDotHeavy';
|
|
115
|
+
case UnderlineStyle.WavyHeavy:
|
|
116
|
+
return 'wavyHeavy';
|
|
117
|
+
case UnderlineStyle.DashLong:
|
|
118
|
+
return 'dashLong';
|
|
119
|
+
case UnderlineStyle.DashLongHeavy:
|
|
120
|
+
return 'dashLongHeavy';
|
|
121
|
+
case UnderlineStyle.WavyDouble:
|
|
122
|
+
return 'wavyDouble';
|
|
123
|
+
default:
|
|
124
|
+
return 'single';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy units barrel (package-private). Public APIs use plain point numbers.
|
|
3
|
+
* or `./length`. Multi-unit constructors are package-private.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
export { Emus, HalfPoints, pointToEmus, pointToHalfPoints, pointToTwips, twipsToPoint, emuToPoint, halfPointsToPoint, addPoints, scalePoint, lengthToEmus, lengthToHalfPoints, halfPoints, emus, LengthUnits, // package-private aliases
|
|
8
|
+
Length, Pt, Inches, Cm, Mm, Px, Twips, Emu, add, scale, inchesToPoint, cmToPoint, mmToPoint, pxToPoint } from './length';
|