@heartlandone/vega 2.73.0 → 2.74.0-RTE-table-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/align-left-4a76df69.js +22 -0
- package/dist/cjs/{app-globals-cc162173.js → app-globals-be2e868e.js} +18 -17
- package/dist/cjs/{code-block-823cd481.js → code-block-22ee2550.js} +35 -4
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-e2e0c6f3.js → component-value-history-controller-slimmer.abstract-3486cbc0.js} +26 -5
- package/dist/cjs/{dto-renderer-manager-bd2bd447.js → content-state-0be6fda3.js} +33 -60
- package/dist/cjs/{design-token-11656685.js → design-token-505997df.js} +1 -1
- package/dist/cjs/dto-renderer-manager-ae5fcbba.js +58 -0
- package/dist/cjs/{element-appender-slimmer-12f40b8b.js → element-appender-slimmer-26420c09.js} +6 -6
- package/dist/cjs/{form-field-controller-slimmer-6e3e14fd.js → form-field-controller-slimmer-56c551ea.js} +2 -2
- package/dist/cjs/{image-annotation-action-7408a4b3.js → image-annotation-action-462fd073.js} +3 -3
- package/dist/cjs/index-58ea899e.js +4 -0
- package/dist/cjs/{index-638a0f0d.js → index-fc538f17.js} +1 -1
- package/dist/cjs/index.cjs.js +43 -38
- package/dist/cjs/{language-extension-716015a5.js → language-extension-414149c2.js} +8 -8
- package/dist/cjs/loader.cjs.js +13 -8
- package/dist/cjs/{public-rules-2950f1fc.js → public-rules-2d18cf41.js} +4 -4
- package/dist/cjs/{range-c3c48132.js → range-439a0c0c.js} +1 -1
- package/dist/cjs/{responsive-format-facade-96c5f598.js → responsive-format-facade-0ececeb3.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-4aab05a3.js → rich-text-editor-required-rule-5a4f3626.js} +2 -2
- package/dist/cjs/{string-input-formatter-slimmer-338bbd73.js → string-input-formatter-slimmer-a8f4a9b1.js} +2 -2
- package/dist/cjs/{style-formatter-9c42d41b.js → style-formatter-142500c0.js} +1 -1
- package/dist/cjs/styles.constants-3aff0b56.js +1306 -0
- package/dist/cjs/{sub-state-notify-slimmer-1efa69c4.js → sub-state-notify-slimmer-011866d9.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-6afa62f5.js → sub-state-observer-slimmer-23d43f1e.js} +1 -1
- package/dist/cjs/table-extension-2a20da57.js +6018 -0
- package/dist/cjs/vega-accordion.cjs.entry.js +10 -6
- package/dist/cjs/vega-app-header-button.cjs.entry.js +10 -6
- package/dist/cjs/vega-box.cjs.entry.js +11 -7
- package/dist/cjs/vega-button-circle.cjs.entry.js +10 -6
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +9 -5
- package/dist/cjs/vega-calendar_4.cjs.entry.js +3 -3
- package/dist/cjs/vega-card.cjs.entry.js +10 -6
- package/dist/cjs/vega-carousel.cjs.entry.js +9 -5
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +10 -6
- package/dist/cjs/vega-code-block.cjs.entry.js +4 -4
- package/dist/cjs/vega-color-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +15 -11
- package/dist/cjs/vega-dialog_2.cjs.entry.js +17 -13
- package/dist/cjs/vega-divider.cjs.entry.js +10 -6
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +24 -11
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +10 -6
- package/dist/cjs/vega-flex.cjs.entry.js +11 -7
- package/dist/cjs/vega-font.cjs.entry.js +10 -6
- package/dist/cjs/vega-form.cjs.entry.js +4 -4
- package/dist/cjs/vega-grid.cjs.entry.js +10 -6
- package/dist/cjs/vega-icon.cjs.entry.js +10 -6
- package/dist/cjs/vega-image-uploader.cjs.entry.js +12 -8
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-passcode.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +10 -6
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +181 -50
- package/dist/cjs/vega-input.cjs.entry.js +5 -5
- package/dist/cjs/{vega-internal-event-id-f2465f1b.js → vega-internal-event-id-73334b4b.js} +4 -0
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +17 -13
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +11 -7
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination.cjs.entry.js +9 -5
- package/dist/cjs/vega-popover_2.cjs.entry.js +11 -7
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +11 -7
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +10 -9
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +70 -54
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +1313 -0
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +12 -8
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +15 -11
- package/dist/cjs/vega-signature-capture.cjs.entry.js +12 -8
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_11.cjs.entry.js +16 -13
- package/dist/cjs/vega-textarea.cjs.entry.js +3 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +12 -8
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +3 -3
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +10 -6
- package/dist/cjs/vega.cjs.js +13 -8
- package/dist/collection/collection-manifest.json +10 -0
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-list-renderer.js +6 -3
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +31 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-item-controller.js +89 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-source-controller.js +4 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-value-controller.js +4 -0
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +33 -13
- package/dist/collection/components/vega-input-select/vega-input-select.js +27 -7
- package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/plain-text-annotation.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +24 -2
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +18 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +18 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-children-remove-interceptor.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-content-delete-interceptor.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-row-insert-interceptor.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-block-strategy.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-column-strategy.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-row-strategy.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-block-strategy.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-column-strategy.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-row-strategy.js +117 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/select-table-column-strategy.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/table-column-strategy.abstract.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-row-strategy.js +133 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-table-column-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-cell-properties-strategy.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-properties-strategy.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/delete-table-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/delete-table-column-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/delete-table-row-action.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/insert-table-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/insert-table-column-action.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/insert-table-row-action.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/select-table-column-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-annotations-action.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-caption-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-cell-annotations-action.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-head-cell-annotations-action.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/toggle-header-row-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/toggle-header-table-column-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/update-table-properties-action.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.js +97 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-cell-annotation-handler.js +82 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-head-cell-annotation-handler.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.js +91 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.js +121 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-head-cell-annotation.js +40 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/constants/styles.constants.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-block.js +119 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-body-block.js +56 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.js +66 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-block.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.js +53 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-row-block.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/caption-to-caption-block-strategy.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/table-to-table-block-strategy.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tbody-to-table-body-block-strategy.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/td-to-table-cell-block-strategy.js +71 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/thead-to-table-head-block-strategy.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tr-to-table-row-block-strategy.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-body-renderer.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-caption-renderer.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-cell-renderer.js +74 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-dynamic-popover-renderer.js +254 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-head-cell-renderer.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-head-renderer.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-renderer.js +149 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-row-renderer.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-setting-popover-renderer.js +148 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/caption-operation.js +78 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-cancel-event-handler.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-change-event-handler.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-save-event-handler.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties.js +131 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/column-operation.js +109 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/row-operation.js +132 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/setting-event-handler.abstract.js +44 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-cancel-event-handler.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-change-event-handler.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-save-event-handler.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +152 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-icon.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-selection.js +371 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-toolbar-button-renderer.js +234 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/utils/utils.js +102 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-bottom.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-middle.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-top.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-center-horizontal.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-left.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-right.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/controllers/vega-rich-text-table-properties-color-controller.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-cell-properties-form-field-renderer.js +106 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-basic-form-field-renderer.abstract.js +259 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-field-renderer.js +58 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-renderer.js +93 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/vega-rich-text-table-properties.css +148 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/vega-rich-text-table-properties.js +241 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/controllers/selection-widget-keyboard-controller.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/renderers/selection-widget-renderer.js +83 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/vega-rich-text-table-selection-widget.css +41 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/vega-rich-text-table-selection-widget.js +80 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/assets/icon.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/caption-button-slimmer.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/cell-properties-button-slimmer.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/column-button-slimmer.js +86 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/row-button-slimmer.js +101 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-properties-button-slimmer.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-setting-button-slimmer.abstract.js +75 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/vega-rich-text-table-setting-renderer.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/vega-rich-text-table-setting.css +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/vega-rich-text-table-setting.js +215 -0
- package/dist/collection/components/vega-rich-text-editor/public-api.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/extension-controller.js +21 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +23 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +6 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +257 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/annotation-handler-registration.test.js +164 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-annotation-handler.test.js +293 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-cell-annotation-handler.test.js +295 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-head-cell-annotation-handler.test.js +415 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/caption-operation.test.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-annotation.test.js +89 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-caption-annotations.test.js +79 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-cell-annotation.test.js +128 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-dto.test.js +517 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-element-to-dto-strategies.test.js +1450 -0
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-test-utils.js +172 -0
- package/dist/collection/components/vega-rich-text-editor/test/spec-utils.js +5 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +4 -0
- package/dist/collection/global/scripts/before-vega-load.js +2 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +2 -0
- package/dist/collection/utils/spec-utils.js +4 -3
- package/dist/esm/align-left-7f959adf.js +17 -0
- package/dist/esm/{app-globals-949d2e18.js → app-globals-8b873b6f.js} +7 -6
- package/dist/esm/{child-nodes-event-prevent-slimmer-e6f98de5.js → child-nodes-event-prevent-slimmer-a6afdb1e.js} +1 -1
- package/dist/esm/{code-block-666674d7.js → code-block-76b29be1.js} +37 -6
- package/dist/esm/{component-value-history-controller-slimmer.abstract-171dda08.js → component-value-history-controller-slimmer.abstract-e1b0e163.js} +27 -6
- package/dist/esm/{dto-renderer-manager-49ae5d56.js → content-state-03f1d302.js} +32 -61
- package/dist/esm/{design-token-9b510e59.js → design-token-8fedb532.js} +1 -1
- package/dist/esm/{dom-node-subject-observer-factory-1aaa1159.js → dom-node-subject-observer-factory-e998eba4.js} +1 -1
- package/dist/esm/dto-renderer-manager-12bc9121.js +56 -0
- package/dist/esm/{element-appender-slimmer-b9890dcb.js → element-appender-slimmer-7b9326e2.js} +4 -4
- package/dist/esm/{event-emit-slimmer-2d791d0e.js → event-emit-slimmer-bbf6668c.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-257928c1.js → form-field-controller-slimmer-a0cff4d3.js} +3 -3
- package/dist/esm/{image-annotation-action-b3eea6a2.js → image-annotation-action-47cdc068.js} +3 -3
- package/dist/esm/index-090d31ca.js +4 -0
- package/dist/esm/{index-0d487fae.js → index-da7e5fe5.js} +2 -2
- package/dist/esm/index.js +17 -13
- package/dist/esm/{internal-vega-event-manager-fdee2a0a.js → internal-vega-event-manager-e799c54a.js} +1 -1
- package/dist/esm/{language-extension-b3f836d4.js → language-extension-de6e6caf.js} +2 -2
- package/dist/esm/loader.js +15 -10
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{public-rules-b164e40e.js → public-rules-c48cc5c9.js} +5 -5
- package/dist/esm/{range-9cc1422b.js → range-af6150a8.js} +1 -1
- package/dist/esm/{responsive-format-facade-94897ae8.js → responsive-format-facade-16da4623.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-2131f21c.js → rich-text-editor-required-rule-7255832e.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-3a42d9b8.js → string-input-formatter-slimmer-82f85b0b.js} +3 -3
- package/dist/esm/{style-formatter-bb5aec96.js → style-formatter-6ca58f6b.js} +1 -1
- package/dist/esm/styles.constants-0dd6f7fa.js +1277 -0
- package/dist/esm/{sub-state-notify-slimmer-71b9bbd5.js → sub-state-notify-slimmer-4060c333.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-41a1b380.js → sub-state-observer-slimmer-bfa5e63e.js} +2 -2
- package/dist/esm/table-extension-c83b7a56.js +5998 -0
- package/dist/esm/vega-accordion.entry.js +13 -9
- package/dist/esm/vega-app-header-button.entry.js +14 -10
- package/dist/esm/vega-banner.entry.js +3 -3
- package/dist/esm/vega-box.entry.js +13 -9
- package/dist/esm/vega-breadcrumb.entry.js +4 -4
- package/dist/esm/vega-button-circle.entry.js +14 -10
- package/dist/esm/vega-button-group_2.entry.js +7 -7
- package/dist/esm/vega-button-link.entry.js +4 -4
- package/dist/esm/vega-button.entry.js +13 -9
- package/dist/esm/vega-calendar_4.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +12 -8
- package/dist/esm/vega-carousel.entry.js +12 -8
- package/dist/esm/vega-checkbox_2.entry.js +7 -7
- package/dist/esm/vega-chip.entry.js +14 -10
- package/dist/esm/vega-code-block.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +6 -6
- package/dist/esm/vega-combo-box.entry.js +7 -7
- package/dist/esm/vega-date-picker_2.entry.js +19 -15
- package/dist/esm/vega-dialog_2.entry.js +14 -10
- package/dist/esm/vega-divider.entry.js +12 -8
- package/dist/esm/vega-dropdown_5.entry.js +28 -15
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +6 -6
- package/dist/esm/vega-flag-icon.entry.js +12 -8
- package/dist/esm/vega-flex.entry.js +13 -9
- package/dist/esm/vega-font.entry.js +12 -8
- package/dist/esm/vega-form.entry.js +8 -8
- package/dist/esm/vega-grid.entry.js +12 -8
- package/dist/esm/vega-icon.entry.js +12 -8
- package/dist/esm/vega-image-uploader.entry.js +15 -11
- package/dist/esm/vega-input-credit-card.entry.js +7 -7
- package/dist/esm/vega-input-numeric.entry.js +8 -8
- package/dist/esm/vega-input-passcode.entry.js +7 -7
- package/dist/esm/vega-input-phone-number.entry.js +14 -10
- package/dist/esm/vega-input-range.entry.js +7 -7
- package/dist/esm/vega-input-select.entry.js +185 -54
- package/dist/esm/vega-input.entry.js +8 -8
- package/dist/esm/{vega-internal-event-id-4a06d705.js → vega-internal-event-id-3edc9b4e.js} +3 -1
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +16 -12
- package/dist/esm/vega-loader-wrapper_2.entry.js +11 -7
- package/dist/esm/vega-page-notification_2.entry.js +1 -1
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +13 -9
- package/dist/esm/vega-popover_2.entry.js +14 -10
- package/dist/esm/vega-progress-tracker_2.entry.js +14 -10
- package/dist/esm/vega-radio_2.entry.js +7 -7
- package/dist/esm/vega-rich-text-content.entry.js +8 -7
- package/dist/esm/vega-rich-text-editor_4.entry.js +53 -37
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +1307 -0
- package/dist/esm/vega-segment-control.entry.js +3 -3
- package/dist/esm/vega-selection-chip_2.entry.js +16 -12
- package/dist/esm/vega-selection-tile_2.entry.js +8 -8
- package/dist/esm/vega-sidenav_3.entry.js +14 -10
- package/dist/esm/vega-signature-capture.entry.js +15 -11
- package/dist/esm/vega-stepper.entry.js +7 -7
- package/dist/esm/vega-tab-group_2.entry.js +4 -4
- package/dist/esm/vega-table_11.entry.js +14 -11
- package/dist/esm/vega-textarea.entry.js +7 -7
- package/dist/esm/vega-time-picker_2.entry.js +16 -12
- package/dist/esm/vega-toggle-switch.entry.js +6 -6
- package/dist/esm/vega-tooltip_2.entry.js +12 -8
- package/dist/esm/vega.js +15 -10
- package/dist/sri/vega-sri-manifest.json +696 -296
- package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-list-renderer.d.ts +1 -0
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +8 -1
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-item-controller.d.ts +29 -0
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-source-controller.d.ts +1 -0
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-value-controller.d.ts +1 -0
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.d.ts +1 -1
- package/dist/types/components/vega-input-select/types.d.ts +5 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +12 -4
- package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +2 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +10 -6
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +8 -1
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +15 -2
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-children-remove-interceptor.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-content-delete-interceptor.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-row-insert-interceptor.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-block-strategy.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-column-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-row-strategy.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-column-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-row-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/select-table-column-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/table-column-strategy.abstract.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-row-strategy.d.ts +41 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-table-column-strategy.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-cell-properties-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-properties-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/delete-table-block-action.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/delete-table-column-action.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/delete-table-row-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/insert-table-block-action.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/insert-table-column-action.d.ts +23 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/insert-table-row-action.d.ts +23 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/select-table-column-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-annotations-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-caption-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-cell-annotations-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-head-cell-annotations-action.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/toggle-header-row-action.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/toggle-header-table-column-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/update-table-properties-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-cell-annotation-handler.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-head-cell-annotation-handler.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.d.ts +64 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.d.ts +67 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-head-cell-annotation.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/constants/styles.constants.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-block.d.ts +79 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-body-block.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.d.ts +41 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-block.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.d.ts +34 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-row-block.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/caption-to-caption-block-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/table-to-table-block-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tbody-to-table-body-block-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/td-to-table-cell-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/thead-to-table-head-block-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tr-to-table-row-block-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-body-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-caption-renderer.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-cell-renderer.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-dynamic-popover-renderer.d.ts +88 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-head-cell-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-head-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-renderer.d.ts +61 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-row-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-setting-popover-renderer.d.ts +66 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/caption-operation.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-cancel-event-handler.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-change-event-handler.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-save-event-handler.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties.d.ts +62 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/column-operation.d.ts +55 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/row-operation.d.ts +61 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/setting-event-handler.abstract.d.ts +47 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-cancel-event-handler.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-change-event-handler.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-save-event-handler.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-extension.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-icon.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-selection.d.ts +149 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-toolbar-button-renderer.d.ts +86 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/utils/utils.d.ts +53 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-bottom.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-middle.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-top.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-center-horizontal.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-left.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-right.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/controllers/vega-rich-text-table-properties-color-controller.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-cell-properties-form-field-renderer.d.ts +49 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-basic-form-field-renderer.abstract.d.ts +99 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-field-renderer.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-renderer.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/vega-rich-text-table-properties.d.ts +57 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/controllers/selection-widget-keyboard-controller.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/renderers/selection-widget-renderer.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/vega-rich-text-table-selection-widget.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/assets/icon.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/caption-button-slimmer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/cell-properties-button-slimmer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/column-button-slimmer.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/row-button-slimmer.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-properties-button-slimmer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-setting-button-slimmer.abstract.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/vega-rich-text-table-setting-renderer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/vega-rich-text-table-setting.d.ts +55 -0
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +39 -2
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/extension-controller.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +19 -6
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/annotation-handler-registration.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-annotation-handler.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-cell-annotation-handler.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-head-cell-annotation-handler.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/caption-operation.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-annotation.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-caption-annotations.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-cell-annotation.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-dto.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-element-to-dto-strategies.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-test-utils.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/test/spec-utils.d.ts +4 -0
- package/dist/types/components.d.ts +155 -6
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +2 -0
- package/dist/types/types/components.type.d.ts +5 -0
- package/dist/types/utils/spec-utils.d.ts +2 -3
- package/dist/vega/app-globals-955a2b3b.js +427 -0
- package/dist/vega/child-nodes-event-prevent-slimmer-a604a6dd.js +156 -0
- package/dist/vega/design-token-56b26205.js +402 -0
- package/dist/vega/element-appender-slimmer-8355fb28.js +1508 -0
- package/dist/vega/event-emit-slimmer-7a14f5e9.js +265 -0
- package/dist/vega/index.esm.js +57 -1
- package/dist/vega/internal-vega-event-manager-8c62c88e.js +458 -0
- package/dist/vega/p-068ee55e.entry.js +1 -0
- package/dist/vega/p-088f4613.entry.js +1 -0
- package/dist/vega/{p-3162a7fd.entry.js → p-08b4d097.entry.js} +1 -1
- package/dist/vega/p-0e4cecbd.entry.js +1 -0
- package/dist/vega/p-10ffb765.js +1 -0
- package/dist/vega/{p-ead1da57.entry.js → p-12a97dad.entry.js} +1 -1
- package/dist/vega/p-151b1deb.js +1 -0
- package/dist/vega/{p-30e7544c.js → p-16af7681.js} +1 -1
- package/dist/vega/p-1b44db34.js +1 -0
- package/dist/vega/p-1bda4016.entry.js +1 -0
- package/dist/vega/{p-6e84e451.entry.js → p-1f4a814e.entry.js} +1 -1
- package/dist/vega/{p-2ae5ad30.entry.js → p-206245d2.entry.js} +1 -1
- package/dist/vega/p-213be5e9.entry.js +1 -0
- package/dist/vega/{p-7a8c4cf8.entry.js → p-216f3436.entry.js} +1 -1
- package/dist/vega/p-224a4f3f.entry.js +1 -0
- package/dist/vega/p-22c76be7.entry.js +1 -0
- package/dist/vega/p-22da15d7.entry.js +1 -0
- package/dist/vega/{p-2409a475.entry.js → p-24766b9d.entry.js} +1 -1
- package/dist/vega/p-29a9c8f5.entry.js +1 -0
- package/dist/vega/p-34a994a1.entry.js +1 -0
- package/dist/vega/p-39d56e3d.js +1 -0
- package/dist/vega/{p-c7194674.entry.js → p-3bc7e162.entry.js} +1 -1
- package/dist/vega/p-40660c09.js +1 -0
- package/dist/vega/p-50a506ea.entry.js +1 -0
- package/dist/vega/{p-f2c8c363.js → p-5367eaab.js} +1 -1
- package/dist/vega/p-550ce71a.entry.js +1 -0
- package/dist/vega/p-5d2704c1.entry.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-61ae4e9c.entry.js +1 -0
- package/dist/vega/{p-2971b17a.js → p-63246470.js} +1 -1
- package/dist/vega/p-6665d083.entry.js +1 -0
- package/dist/vega/p-69af3422.entry.js +1 -0
- package/dist/vega/p-6d9731c1.entry.js +1 -0
- package/dist/vega/p-6f08e3e1.entry.js +1 -0
- package/dist/vega/p-7172332a.entry.js +1 -0
- package/dist/vega/{p-9d8e2939.entry.js → p-73688c4e.entry.js} +1 -1
- package/dist/vega/p-73689ec0.entry.js +1 -0
- package/dist/vega/{p-9fb71d8c.entry.js → p-780cbfb0.entry.js} +1 -1
- package/dist/vega/p-79e8236a.entry.js +1 -0
- package/dist/vega/{p-8fba7f9a.js → p-7ca9f6f1.js} +1 -1
- package/dist/vega/{p-f6cd7a08.entry.js → p-813b2915.entry.js} +1 -1
- package/dist/vega/{p-e88f2dc3.js → p-8162980c.js} +1 -1
- package/dist/vega/p-82ec9721.entry.js +1 -0
- package/dist/vega/{p-7f9acdf7.entry.js → p-86caa739.entry.js} +1 -1
- package/dist/vega/p-8a4d8139.entry.js +1 -0
- package/dist/vega/{p-be0b67b8.entry.js → p-8ac453cb.entry.js} +1 -1
- package/dist/vega/p-98b78c75.entry.js +1 -0
- package/dist/vega/{p-76e6c13a.js → p-99e3dcab.js} +1 -1
- package/dist/vega/{p-44bc9ea9.entry.js → p-9aac9879.entry.js} +1 -1
- package/dist/vega/p-a007b493.entry.js +1 -0
- package/dist/vega/p-a439e59b.entry.js +1 -0
- package/dist/vega/p-a4d0ab07.js +1 -0
- package/dist/vega/{p-f38a4be2.entry.js → p-a6e03df4.entry.js} +1 -1
- package/dist/vega/{p-4957f07a.entry.js → p-a924c1e2.entry.js} +1 -1
- package/dist/vega/p-ab0e013c.entry.js +1 -0
- package/dist/vega/p-abf871cd.entry.js +1 -0
- package/dist/vega/{p-9dfe2bbc.js → p-ac4bd1f8.js} +1 -1
- package/dist/vega/{p-3566ad76.js → p-b91c2c9d.js} +1 -1
- package/dist/vega/{p-184d8443.js → p-c00adad9.js} +1 -1
- package/dist/vega/{p-697eb0e1.js → p-c335088c.js} +1 -1
- package/dist/vega/{p-623c3911.entry.js → p-c3d388b5.entry.js} +1 -1
- package/dist/vega/p-c674b07c.js +1 -0
- package/dist/vega/p-c6d98c60.entry.js +1 -0
- package/dist/vega/p-c78fe943.js +1 -0
- package/dist/vega/{p-7f86b3c8.js → p-c8ad47c9.js} +1 -1
- package/dist/vega/{p-96797fee.entry.js → p-c9541fc2.entry.js} +1 -1
- package/dist/vega/{p-a58bdbad.entry.js → p-d07d04e0.entry.js} +1 -1
- package/dist/vega/p-d1349401.entry.js +1 -0
- package/dist/vega/{p-c0036e71.js → p-d2033624.js} +1 -1
- package/dist/vega/{p-74a77cad.js → p-d466baf7.js} +1 -1
- package/dist/vega/p-d4719c14.entry.js +1 -0
- package/dist/vega/{p-82dbff54.entry.js → p-d4e35d2e.entry.js} +1 -1
- package/dist/vega/p-d55365b9.entry.js +1 -0
- package/dist/vega/p-db482ee1.js +1 -0
- package/dist/vega/p-dc2813eb.entry.js +1 -0
- package/dist/vega/{p-676eaf3f.entry.js → p-dd5d917b.entry.js} +1 -1
- package/dist/vega/{p-5be29f14.js → p-ddf81373.js} +1 -1
- package/dist/vega/p-e0cefd90.entry.js +1 -0
- package/dist/vega/p-e13c163c.entry.js +1 -0
- package/dist/vega/{p-a5d4d168.entry.js → p-e788598a.entry.js} +1 -1
- package/dist/vega/{p-6b9d2996.entry.js → p-e797bf8d.entry.js} +1 -1
- package/dist/vega/p-f4b46f6b.entry.js +1 -0
- package/dist/vega/p-f519cdc3.entry.js +1 -0
- package/dist/vega/{p-9b673fd4.entry.js → p-f6eab527.entry.js} +1 -1
- package/dist/vega/{p-c7f292dd.entry.js → p-fa34ace2.entry.js} +1 -1
- package/dist/vega/p-fbfb4c70.entry.js +1 -0
- package/dist/vega/p-fcabf0dc.js +1 -0
- package/dist/vega/{p-8bd496b4.js → p-ff57c872.js} +1 -1
- package/dist/vega/p-ff921d10.js +1 -0
- package/dist/vega/p-ff9a0e6e.js +1 -0
- package/dist/vega/public-api-8dd022fa.js +6043 -0
- package/dist/vega/public-api-baaf7593.js +4 -0
- package/dist/vega/responsive-format-facade-98596535.js +913 -0
- package/dist/vega/style-formatter-0ae102e9.js +32 -0
- package/dist/vega/vega-accordion.entry.js +291 -0
- package/dist/vega/vega-app-header-button.entry.js +452 -0
- package/dist/vega/vega-banner.entry.js +351 -0
- package/dist/vega/vega-box.entry.js +353 -0
- package/dist/vega/vega-breadcrumb.entry.js +249 -0
- package/dist/vega/vega-button-circle.entry.js +245 -0
- package/dist/vega/vega-button-group.entry.js +203 -0
- package/dist/vega/vega-button-link.entry.js +226 -0
- package/dist/vega/vega-button.entry.js +259 -0
- package/dist/vega/vega-calendar.entry.js +3884 -0
- package/dist/vega/vega-card.entry.js +226 -0
- package/dist/vega/vega-carousel.entry.js +540 -0
- package/dist/vega/vega-checkbox-group.entry.js +266 -0
- package/dist/vega/vega-checkbox.entry.js +335 -0
- package/dist/vega/vega-chip.entry.js +321 -0
- package/dist/vega/vega-code-block.entry.js +4372 -0
- package/dist/vega/vega-color-picker.entry.js +258 -0
- package/dist/vega/vega-combo-box.entry.js +748 -0
- package/dist/vega/vega-date-picker-calendar.entry.js +1381 -0
- package/dist/vega/vega-date-picker.entry.js +1646 -0
- package/dist/vega/vega-dialog.entry.js +158 -0
- package/dist/vega/vega-divider.entry.js +179 -0
- package/dist/vega/vega-dropdown-content-box.entry.js +57 -0
- package/dist/vega/vega-dropdown-item.entry.js +352 -0
- package/dist/vega/vega-dropdown.entry.js +2136 -0
- package/dist/vega/vega-field-label.entry.js +182 -0
- package/dist/vega/vega-file-uploader.entry.js +751 -0
- package/dist/vega/vega-flag-icon.entry.js +216 -0
- package/dist/vega/vega-flex.entry.js +224 -0
- package/dist/vega/vega-font.entry.js +327 -0
- package/dist/vega/vega-form.entry.js +1008 -0
- package/dist/vega/vega-grid.entry.js +129 -0
- package/dist/vega/vega-icon.entry.js +256 -0
- package/dist/vega/vega-image-uploader.entry.js +977 -0
- package/dist/vega/vega-input-credit-card.entry.js +549 -0
- package/dist/vega/vega-input-numeric.entry.js +471 -0
- package/dist/vega/vega-input-passcode.entry.js +728 -0
- package/dist/vega/vega-input-phone-number.entry.js +9143 -0
- package/dist/vega/vega-input-range.entry.js +693 -0
- package/dist/vega/vega-input-select.entry.js +1268 -0
- package/dist/vega/vega-input.entry.js +1735 -0
- package/dist/vega/vega-item-toggle.entry.js +190 -0
- package/dist/vega/vega-left-nav-group.entry.js +433 -0
- package/dist/vega/vega-left-nav-link.entry.js +317 -0
- package/dist/vega/vega-left-nav-section.entry.js +97 -0
- package/dist/vega/vega-left-nav.entry.js +654 -0
- package/dist/vega/vega-loading-indicator.entry.js +209 -0
- package/dist/vega/vega-modal.entry.js +1287 -0
- package/dist/vega/vega-nav-card.entry.js +163 -0
- package/dist/vega/vega-pagination-page-selector-mobile.entry.js +214 -0
- package/dist/vega/vega-pagination.entry.js +629 -0
- package/dist/vega/vega-popover-content-box.entry.js +101 -0
- package/dist/vega/vega-popover.entry.js +362 -0
- package/dist/vega/vega-progress-tracker.entry.js +757 -0
- package/dist/vega/vega-radio-group.entry.js +496 -0
- package/dist/vega/vega-radio.entry.js +272 -0
- package/dist/vega/vega-rich-text-editor-toolbar-button.entry.js +169 -0
- package/dist/vega/vega-rich-text-editor.entry.js +4107 -0
- package/dist/vega/vega-rich-text-image-editor.entry.js +216 -0
- package/dist/vega/vega-rich-text-link-editor.entry.js +238 -0
- package/dist/vega/vega-rich-text-table-properties.entry.js +641 -0
- package/dist/vega/vega-rich-text-table-setting.entry.js +525 -0
- package/dist/vega/vega-segment-control.entry.js +350 -0
- package/dist/vega/vega-selection-chip-group.entry.js +447 -0
- package/dist/vega/vega-selection-chip.entry.js +443 -0
- package/dist/vega/vega-selection-tile-group.entry.js +438 -0
- package/dist/vega/vega-selection-tile.entry.js +409 -0
- package/dist/vega/vega-sidenav-link.entry.js +160 -0
- package/dist/vega/vega-sidenav.entry.js +766 -0
- package/dist/vega/vega-signature-capture.entry.js +589 -0
- package/dist/vega/vega-stepper.entry.js +292 -0
- package/dist/vega/vega-tab-group-panel.entry.js +79 -0
- package/dist/vega/vega-tab-group.entry.js +1281 -0
- package/dist/vega/vega-table-body.entry.js +48 -0
- package/dist/vega/vega-table-cell.entry.js +243 -0
- package/dist/vega/vega-table-foot-cell.entry.js +169 -0
- package/dist/vega/vega-table-foot-row.entry.js +219 -0
- package/dist/vega/vega-table-foot.entry.js +136 -0
- package/dist/vega/vega-table-head-cell.entry.js +339 -0
- package/dist/vega/vega-table-head-row.entry.js +416 -0
- package/dist/vega/vega-table-head.entry.js +113 -0
- package/dist/vega/vega-table-row.entry.js +666 -0
- package/dist/vega/vega-table.entry.js +3707 -0
- package/dist/vega/vega-textarea.entry.js +329 -0
- package/dist/vega/vega-time-picker.entry.js +2039 -0
- package/dist/vega/vega-toggle-switch.entry.js +194 -0
- package/dist/vega/vega-tooltip.entry.js +339 -0
- package/dist/vega/vega.esm.js +172 -1
- package/package.json +1 -1
- package/style/vega-icons.css +17266 -0
- package/dist/cjs/function-extension-78ec27e0.js +0 -2927
- package/dist/esm/function-extension-8b06c6f8.js +0 -2908
- package/dist/vega/p-03e16a05.entry.js +0 -1
- package/dist/vega/p-0ad59141.entry.js +0 -1
- package/dist/vega/p-0ba0f83d.entry.js +0 -1
- package/dist/vega/p-114c6df8.entry.js +0 -1
- package/dist/vega/p-1e019406.js +0 -1
- package/dist/vega/p-1faef917.entry.js +0 -1
- package/dist/vega/p-21cba83b.entry.js +0 -1
- package/dist/vega/p-21e7808a.entry.js +0 -1
- package/dist/vega/p-2b20a215.entry.js +0 -1
- package/dist/vega/p-2bc4f7d9.entry.js +0 -1
- package/dist/vega/p-2e0deef6.js +0 -1
- package/dist/vega/p-2f592078.entry.js +0 -1
- package/dist/vega/p-38ed3d59.entry.js +0 -1
- package/dist/vega/p-3938880f.entry.js +0 -1
- package/dist/vega/p-398220f5.entry.js +0 -1
- package/dist/vega/p-40561fa0.entry.js +0 -1
- package/dist/vega/p-42a283b5.entry.js +0 -1
- package/dist/vega/p-524ffc12.entry.js +0 -1
- package/dist/vega/p-59fa3f68.js +0 -1
- package/dist/vega/p-5b71c85e.js +0 -1
- package/dist/vega/p-5f09868d.entry.js +0 -1
- package/dist/vega/p-6e701542.entry.js +0 -1
- package/dist/vega/p-70b2906a.entry.js +0 -1
- package/dist/vega/p-721b2981.entry.js +0 -1
- package/dist/vega/p-75d91ee9.entry.js +0 -1
- package/dist/vega/p-79a544d6.js +0 -1
- package/dist/vega/p-7b337fd4.entry.js +0 -1
- package/dist/vega/p-7be3aefc.entry.js +0 -1
- package/dist/vega/p-94cf46ca.entry.js +0 -1
- package/dist/vega/p-a125cfec.entry.js +0 -1
- package/dist/vega/p-a3c4fa30.entry.js +0 -1
- package/dist/vega/p-aab0deab.js +0 -1
- package/dist/vega/p-adc615a4.entry.js +0 -1
- package/dist/vega/p-b007d0d5.entry.js +0 -1
- package/dist/vega/p-b406a846.entry.js +0 -1
- package/dist/vega/p-bd60c72e.entry.js +0 -1
- package/dist/vega/p-bf61d136.js +0 -1
- package/dist/vega/p-c2ac6b47.entry.js +0 -1
- package/dist/vega/p-c4700277.entry.js +0 -1
- package/dist/vega/p-ce2ffff7.js +0 -1
- package/dist/vega/p-d01fe83d.entry.js +0 -1
- package/dist/vega/p-db62b038.entry.js +0 -1
- package/dist/vega/p-dd72ad9e.js +0 -1
- package/dist/vega/p-e39aa2ea.entry.js +0 -1
- package/dist/vega/p-f3831dc9.entry.js +0 -1
- package/dist/vega/p-f427d88c.entry.js +0 -1
|
@@ -1,2908 +0,0 @@
|
|
|
1
|
-
import { I as InjectVegaTelemetrySlimmer, c as createPublicAPIRuntimeMetricsSlimmer, g as generateUUID } from './create-public-api-runtime-metrics-slimmer-bedf3a1e.js';
|
|
2
|
-
import { a as arrayToClassString, g as getDeviceType, D as DeviceType } from './ui-bb99c0c2.js';
|
|
3
|
-
import { L as LogUtility, I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
4
|
-
import { c as createDynamicSlimmer } from './dynamic-slimmer-90b8af32.js';
|
|
5
|
-
import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-8744cb44.js';
|
|
6
|
-
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-de88a117.js';
|
|
7
|
-
import { i as internalVegaEventManager } from './internal-vega-event-manager-fdee2a0a.js';
|
|
8
|
-
import { c as convertToNumber } from './number-4398f2e1.js';
|
|
9
|
-
import { R as RTEDTORendererManager, a as RTEDTOActionStrategyManager, E as ElementToDTOClassStrategyManager, U as UpdateCursorPositionAction, b as ElementToDTOStrategy, h as htmlElementToAnnotationGenerator, c as RTEListItemBlock, V as VegaRTEContent, B as BlockToRTEBlockStrategyAbstract, I as InsertNewParagraphAction, d as RTEImageBlock } from './dto-renderer-manager-49ae5d56.js';
|
|
10
|
-
import { s as stateEntityRenderingRegistry, A as ActionHandleStrategyRegistry, a as ActionHandlerInterceptorRegistry, R as RTEDTOClassManager, M as ModifyContentAction, b as RTETextNode, c as ModifyContentActionType, d as ActionHandleStrategy, C as CustomAttributeAnnotation, e as RTETextBlock, f as RTEBlock, g as RTEAnnotationStyle, I as InsertChildrenAfterAction, h as AppendChildrenAction, i as RTENode, j as InsertChildrenBeforeAction, k as InternalAnnotationTypeEnum } from './code-block-666674d7.js';
|
|
11
|
-
import { i as isNonNullable } from './type-guard-b48aec98.js';
|
|
12
|
-
import './translation-96e5debd.js';
|
|
13
|
-
import { a as VegaInternalIconManager } from './internal-icon-manager-f0486245.js';
|
|
14
|
-
import { c as cleanObject } from './object-66c37948.js';
|
|
15
|
-
import { V as VegaRTEBaseRenderer } from './base-renderer-101f6d04.js';
|
|
16
|
-
import { D as DomNodeSubjectObserverFactory, V as VegaDropdownClick, a as VegaClick } from './dom-node-subject-observer-factory-1aaa1159.js';
|
|
17
|
-
|
|
18
|
-
const VegaLoaderRuntimeMetricsPayloadDefinition = [
|
|
19
|
-
{
|
|
20
|
-
payloadKey: 'IS_LOAD_METHOD_CALLED',
|
|
21
|
-
payloadDescription: 'Indicate if the method load of public API VegaLoaderController is called',
|
|
22
|
-
/**
|
|
23
|
-
* Indicate whether the method is collected when the method been called .
|
|
24
|
-
*
|
|
25
|
-
* @param {string} scope - The class name of public api
|
|
26
|
-
* @param {string} methodName - The method name called by the public api
|
|
27
|
-
* @returns {boolean} A boolean value
|
|
28
|
-
*/
|
|
29
|
-
canAccept: (scope, methodName) => scope === 'VegaLoaderController' && methodName === 'load',
|
|
30
|
-
/**
|
|
31
|
-
* The function checks if the method name is load.
|
|
32
|
-
*
|
|
33
|
-
* @returns {boolean} A boolean value
|
|
34
|
-
*/
|
|
35
|
-
payloadValue: () => {
|
|
36
|
-
return true;
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
payloadKey: 'IS_CLOSE_METHOD_CALLED',
|
|
41
|
-
payloadDescription: 'Indicate if the method close of public API VegaLoaderController is called',
|
|
42
|
-
/**
|
|
43
|
-
* Indicate whether the method is collected when the method been called .
|
|
44
|
-
*
|
|
45
|
-
* @param {string} scope - The class name of public api
|
|
46
|
-
* @param {string} methodName - The method name called by the public api
|
|
47
|
-
* @returns {boolean} A boolean value
|
|
48
|
-
*/
|
|
49
|
-
canAccept: (scope, methodName) => scope === 'VegaLoaderController' && methodName === 'close',
|
|
50
|
-
/**
|
|
51
|
-
* The function checks if the method name is close.
|
|
52
|
-
*
|
|
53
|
-
* @returns {boolean} A boolean value
|
|
54
|
-
*/
|
|
55
|
-
payloadValue: () => {
|
|
56
|
-
return true;
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
62
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
63
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
64
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
65
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Vega loader controller to control the loading indicator
|
|
69
|
-
*/
|
|
70
|
-
class VegaLoaderController {
|
|
71
|
-
constructor() {
|
|
72
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaLoaderController, ['load', 'close'], VegaLoaderRuntimeMetricsPayloadDefinition);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Create a loading indicator and append it to the container
|
|
76
|
-
*
|
|
77
|
-
* @param {VegaLoaderIndicatorOptions} options - VegaLoaderOptions = {} options of the method
|
|
78
|
-
* @returns {Nullable<string>} The uuid of the loader.
|
|
79
|
-
* @vegaVersion 1.16.0
|
|
80
|
-
*/
|
|
81
|
-
load(options = {}) {
|
|
82
|
-
let containerSelector = options.containerSelector || 'body';
|
|
83
|
-
let containerElement = document.querySelector(containerSelector);
|
|
84
|
-
if (containerElement &&
|
|
85
|
-
VegaLoaderController.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY.includes(containerElement.tagName)) {
|
|
86
|
-
containerSelector = 'body';
|
|
87
|
-
containerElement = document.querySelector('body');
|
|
88
|
-
}
|
|
89
|
-
if (!containerElement) {
|
|
90
|
-
LogUtility.error('Container is not found by selector: ', containerSelector);
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
const loadingIndicator = this.createLoadingIndicator(options.indicatorOptions);
|
|
94
|
-
const loader = this.createLoader(containerSelector);
|
|
95
|
-
loader.append(loadingIndicator);
|
|
96
|
-
return this.appendLoader(loader, containerElement);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Close the loader by id
|
|
100
|
-
*
|
|
101
|
-
* @param {string} id - The id of the loader.
|
|
102
|
-
* @vegaVersion 1.16.0
|
|
103
|
-
*/
|
|
104
|
-
close(id) {
|
|
105
|
-
const loader = this.findLoader(id);
|
|
106
|
-
if (loader) {
|
|
107
|
-
if (loader.dataset.container) {
|
|
108
|
-
const container = document.querySelector(loader.dataset.container);
|
|
109
|
-
if (container) {
|
|
110
|
-
if (container.dataset['vegaLoaderOriginPosition']) {
|
|
111
|
-
container.style.position = container.dataset['vegaLoaderOriginPosition'];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
loader.remove();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Find loader by id, if the id include '>>>' it will find inside shadowRoot
|
|
120
|
-
*
|
|
121
|
-
* @param {string} id - The id of the loader.
|
|
122
|
-
* @returns {Nullable<HTMLElement>} The loader found by id.
|
|
123
|
-
*/
|
|
124
|
-
findLoader(id) {
|
|
125
|
-
var _a, _b;
|
|
126
|
-
let loader;
|
|
127
|
-
if (id.includes('>>>')) {
|
|
128
|
-
const [containerSelector, loaderSelector] = id.split('>>>');
|
|
129
|
-
loader = (_b = (_a = document.querySelector(containerSelector)) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById(loaderSelector);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
loader = document.getElementById(id);
|
|
133
|
-
}
|
|
134
|
-
return loader;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Create a loader for loading indicator
|
|
138
|
-
*
|
|
139
|
-
* @param {string} containerSelector The container which you want to append
|
|
140
|
-
* @returns {HTMLElement} a wrapper for loader
|
|
141
|
-
*/
|
|
142
|
-
createLoader(containerSelector) {
|
|
143
|
-
const loader = document.createElement('vega-loader-wrapper');
|
|
144
|
-
loader.className = arrayToClassString([
|
|
145
|
-
containerSelector === 'body' ? 'fixed-wrapper' : 'absolute-wrapper',
|
|
146
|
-
]);
|
|
147
|
-
loader.dataset['container'] = containerSelector;
|
|
148
|
-
loader.id = `vega-loader-${generateUUID()}`;
|
|
149
|
-
return loader;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Create a loading indicator
|
|
153
|
-
*
|
|
154
|
-
* @param {VegaLoaderIndicatorOptions} indicatorOptions the props of vega loading indicator
|
|
155
|
-
* @returns {HTMLVegaLoadingIndicatorElement} vega-loading-indicator component template
|
|
156
|
-
*/
|
|
157
|
-
createLoadingIndicator(indicatorOptions = {}) {
|
|
158
|
-
const loadingIndicator = document.createElement('vega-loading-indicator');
|
|
159
|
-
Object.assign(loadingIndicator, indicatorOptions);
|
|
160
|
-
return loadingIndicator;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Append the loader to the container
|
|
164
|
-
*
|
|
165
|
-
* @param {HTMLElement} loader A loader with loading indicator
|
|
166
|
-
* @param {string} containerElement The container which you want to append the loader to
|
|
167
|
-
* @returns {string} The uuid of the loader.
|
|
168
|
-
*/
|
|
169
|
-
appendLoader(loader, containerElement) {
|
|
170
|
-
containerElement.dataset['vegaLoaderOriginPosition'] = containerElement.style.position;
|
|
171
|
-
containerElement.style.position = 'relative';
|
|
172
|
-
if (containerElement.shadowRoot) {
|
|
173
|
-
containerElement.shadowRoot.append(loader);
|
|
174
|
-
return `${loader.dataset['container']}>>>${loader.id}`;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
containerElement.append(loader);
|
|
178
|
-
return loader.id;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
VegaLoaderController.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY = ['VEGA-MODAL'];
|
|
183
|
-
__decorate$6([
|
|
184
|
-
InjectVegaTelemetrySlimmer()
|
|
185
|
-
], VegaLoaderController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
186
|
-
const VegaLoader = new VegaLoaderController();
|
|
187
|
-
|
|
188
|
-
const BASE_BASIC_Z_INDEX = 10000;
|
|
189
|
-
const TOP_BASIC_Z_INDEX = 11000;
|
|
190
|
-
/**
|
|
191
|
-
* Base level is for custom element such as modal, tooltip, dropdown, sidenav and header.
|
|
192
|
-
* the z-index of current showing element is highly than already show.
|
|
193
|
-
* Top level is for element that always display to top, such as notification.
|
|
194
|
-
*/
|
|
195
|
-
class InternalVegaZIndexManager {
|
|
196
|
-
constructor() {
|
|
197
|
-
this.baseBasicZIndex = BASE_BASIC_Z_INDEX;
|
|
198
|
-
this.topBasicZIndex = TOP_BASIC_Z_INDEX;
|
|
199
|
-
this.levelEntry = {
|
|
200
|
-
base: {
|
|
201
|
-
zIndex: this.baseBasicZIndex,
|
|
202
|
-
elements: [],
|
|
203
|
-
},
|
|
204
|
-
top: {
|
|
205
|
-
zIndex: this.topBasicZIndex,
|
|
206
|
-
elements: [],
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* "If the element is not already the current element, then increment the z-index and set the element
|
|
212
|
-
* to the current element."
|
|
213
|
-
*
|
|
214
|
-
* The function is a little more complicated than that, but not much. The function takes an element and
|
|
215
|
-
* a level. The level is optional and defaults to 'base'. The level is used to keep track of the
|
|
216
|
-
* z-index for each level. The function uses a private variable, levelStatus, to keep track of the
|
|
217
|
-
* current element and z-index for each level
|
|
218
|
-
*
|
|
219
|
-
* @param {HTMLElement} element - The element to set the z-index of.
|
|
220
|
-
* @param {ZIndexLevelType} [level=base] - The level of the element.
|
|
221
|
-
* @returns {void}
|
|
222
|
-
*/
|
|
223
|
-
setZIndex(element, level = 'base') {
|
|
224
|
-
if (element === null)
|
|
225
|
-
return;
|
|
226
|
-
this.removeZIndex(element, level);
|
|
227
|
-
const zIndexEntry = this.levelEntry[level];
|
|
228
|
-
if (element && zIndexEntry) {
|
|
229
|
-
if (level === 'base' && this.isBaseLevelOver()) {
|
|
230
|
-
LogUtility.warn(`The max 'z-index' of base level is '11000', but the current 'z-index' is over, Please optimize the use of 'z-index', otherwise there will be some performance overhead.`);
|
|
231
|
-
this.increaseTopEntry();
|
|
232
|
-
}
|
|
233
|
-
zIndexEntry.elements.push(element);
|
|
234
|
-
zIndexEntry.zIndex += 1;
|
|
235
|
-
element.style.zIndex = zIndexEntry.zIndex.toString();
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* It removes the element from the level's array of elements, and then decrements the z-index of all
|
|
240
|
-
* elements after the removed element
|
|
241
|
-
*
|
|
242
|
-
* @param {HTMLElement} element - HTMLElement - The element to move
|
|
243
|
-
* @param {ZIndexLevelType} [level=base] - Level = 'base'
|
|
244
|
-
* @returns {void}
|
|
245
|
-
*/
|
|
246
|
-
removeZIndex(element, level = 'base') {
|
|
247
|
-
if (element === null)
|
|
248
|
-
return;
|
|
249
|
-
const zIndexEntry = this.levelEntry[level];
|
|
250
|
-
if (element && zIndexEntry) {
|
|
251
|
-
let startAt = -1;
|
|
252
|
-
zIndexEntry.elements.forEach((e, index) => {
|
|
253
|
-
if (e === element)
|
|
254
|
-
startAt = index;
|
|
255
|
-
if (startAt >= 0 && index > startAt) {
|
|
256
|
-
e.style.zIndex = `${convertToNumber(e.style.zIndex) - 1}`;
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
if (startAt >= 0) {
|
|
260
|
-
element.style.removeProperty('z-index');
|
|
261
|
-
zIndexEntry.elements.splice(startAt, 1);
|
|
262
|
-
zIndexEntry.zIndex -= 1;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* The function "overrideZIndexBasicValues" updates the base and top basic z-index values based on the
|
|
268
|
-
* input provided.
|
|
269
|
-
*
|
|
270
|
-
* @param {ZIndexBasicValues} input - The input parameter is of type ZIndexBasicValues, which is an
|
|
271
|
-
* object with two properties: base and top. Both properties are optional and can be either a number or
|
|
272
|
-
* undefined.
|
|
273
|
-
*/
|
|
274
|
-
overrideZIndexBasicValues(input) {
|
|
275
|
-
const basicValues = this.formatZIndexBasicValues(input);
|
|
276
|
-
if (this.validBasicValues(basicValues)) {
|
|
277
|
-
this.updateBasicValues(basicValues);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* The function `formatZIndexBasicValues` takes an input object and returns a new object with additional
|
|
282
|
-
* properties `base` and `top` added to it.
|
|
283
|
-
*
|
|
284
|
-
* @param {ZIndexBasicValues} input - The input parameter is of type ZIndexBasicValues. It is an object
|
|
285
|
-
* that contains properties for base and top.
|
|
286
|
-
* @returns {ZIndexBasicValues} - an object that combines the properties of the input object `input` with the properties
|
|
287
|
-
* `base` and `top`. The values of `base` and `top` are taken from the `this.baseBasicZIndex` and
|
|
288
|
-
* `this.topBasicZIndex` variables respectively.
|
|
289
|
-
*/
|
|
290
|
-
formatZIndexBasicValues(input) {
|
|
291
|
-
return Object.assign({
|
|
292
|
-
base: this.baseBasicZIndex,
|
|
293
|
-
top: this.topBasicZIndex,
|
|
294
|
-
}, input);
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* The function checks if the input values for base and top levels of a z-index are valid.
|
|
298
|
-
*
|
|
299
|
-
* @param {ZIndexBasicValues} input - The input parameter is an object of type ZIndexBasicValues. It
|
|
300
|
-
* has two properties: base and top. Both properties should be of type number.
|
|
301
|
-
* @returns {boolean} a boolean value.
|
|
302
|
-
*/
|
|
303
|
-
validBasicValues(input) {
|
|
304
|
-
if (typeof input.base !== 'number' || typeof input.top !== 'number') {
|
|
305
|
-
LogUtility.error('Change z-index basic value failed, both base level and top level should be of type number!');
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
else if (input.base >= input.top) {
|
|
309
|
-
LogUtility.error('Change z-index basic value failed, the base level should be smaller than the top level!');
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* The function updates the z-index values of elements based on the input values.
|
|
316
|
-
*
|
|
317
|
-
* @param {ZIndexBasicValues} input - The input parameter is an object of type ZIndexBasicValues. It
|
|
318
|
-
* has two properties: base and top, both of which are optional and can be of type number.
|
|
319
|
-
*/
|
|
320
|
-
updateBasicValues(input) {
|
|
321
|
-
// update basic z-index value
|
|
322
|
-
this.baseBasicZIndex = input.base;
|
|
323
|
-
this.topBasicZIndex = input.top;
|
|
324
|
-
// update base level entry
|
|
325
|
-
const baseLevel = this.levelEntry.base;
|
|
326
|
-
baseLevel.elements.forEach((element, index) => {
|
|
327
|
-
element.style.zIndex = `${this.baseBasicZIndex + index + 1}`;
|
|
328
|
-
});
|
|
329
|
-
baseLevel.zIndex = this.baseBasicZIndex + baseLevel.elements.length;
|
|
330
|
-
// update top level entry
|
|
331
|
-
const topLevel = this.levelEntry.top;
|
|
332
|
-
topLevel.elements.forEach((element, index) => {
|
|
333
|
-
element.style.zIndex = `${this.topBasicZIndex + index + 1}`;
|
|
334
|
-
});
|
|
335
|
-
topLevel.zIndex = this.topBasicZIndex + topLevel.elements.length;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* It increases the z-index of all the elements in the top entry by 1
|
|
339
|
-
*
|
|
340
|
-
* @returns {void}
|
|
341
|
-
*/
|
|
342
|
-
increaseTopEntry() {
|
|
343
|
-
const topEntry = this.levelEntry['top'];
|
|
344
|
-
topEntry.elements.forEach((element) => {
|
|
345
|
-
element.style.zIndex = `${convertToNumber(element.style.zIndex) + 1}`;
|
|
346
|
-
});
|
|
347
|
-
topEntry.zIndex += 1;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* If the z-index of the level is over 1000 greater than the basic z-index of the level, then return
|
|
351
|
-
* true.
|
|
352
|
-
*
|
|
353
|
-
* @returns {boolean} - The zIndexEntry.zIndex - this.getBasicZIndexByLevel(level) >= 1000 is being returned.
|
|
354
|
-
*/
|
|
355
|
-
isBaseLevelOver() {
|
|
356
|
-
const baseEntry = this.levelEntry['base'];
|
|
357
|
-
return baseEntry.zIndex >= this.topBasicZIndex;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
const InternalVegaZIndexManager$1 = new InternalVegaZIndexManager();
|
|
361
|
-
|
|
362
|
-
const VegaNotifyRuntimeMetricsPayloadDefinition = [
|
|
363
|
-
{
|
|
364
|
-
payloadKey: 'IS_OPEN_METHOD_CALLED',
|
|
365
|
-
payloadDescription: 'Indicate if the method open of public API VegaNotifyController is called',
|
|
366
|
-
/**
|
|
367
|
-
* Indicate whether the method is collected when the method been called .
|
|
368
|
-
*
|
|
369
|
-
* @param {string} scope - The class name of public api
|
|
370
|
-
* @param {string} methodName - The method name called by the public api
|
|
371
|
-
* @returns {boolean} A boolean value
|
|
372
|
-
*/
|
|
373
|
-
canAccept: (scope, methodName) => scope === 'VegaNotifyController' && methodName === 'open',
|
|
374
|
-
/**
|
|
375
|
-
* The function checks if the method name is open.
|
|
376
|
-
*
|
|
377
|
-
* @returns {boolean} A boolean value
|
|
378
|
-
*/
|
|
379
|
-
payloadValue: () => {
|
|
380
|
-
return true;
|
|
381
|
-
},
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
payloadKey: 'IS_CLOSE_METHOD_CALLED',
|
|
385
|
-
payloadDescription: 'Indicate if the method close of public API VegaNotifyController is called',
|
|
386
|
-
/**
|
|
387
|
-
* Indicate whether the method is collected when the method been called .
|
|
388
|
-
*
|
|
389
|
-
* @param {string} scope - The class name of public api
|
|
390
|
-
* @param {string} methodName - The method name called by the public api
|
|
391
|
-
* @returns {boolean} A boolean value
|
|
392
|
-
*/
|
|
393
|
-
canAccept: (scope, methodName) => scope === 'VegaNotifyController' && methodName === 'close',
|
|
394
|
-
/**
|
|
395
|
-
* The function checks if the method name is close.
|
|
396
|
-
*
|
|
397
|
-
* @returns {boolean} A boolean value
|
|
398
|
-
*/
|
|
399
|
-
payloadValue: () => {
|
|
400
|
-
return true;
|
|
401
|
-
},
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
payloadKey: 'IS_CLOSEALL_METHOD_CALLED',
|
|
405
|
-
payloadDescription: 'Indicate if the method closeAll of public API VegaNotifyController is called',
|
|
406
|
-
/**
|
|
407
|
-
* Indicate whether the method is collected when the method been called .
|
|
408
|
-
*
|
|
409
|
-
* @param {string} scope - The class name of public api
|
|
410
|
-
* @param {string} methodName - The method name called by the public api
|
|
411
|
-
* @returns {boolean} A boolean value
|
|
412
|
-
*/
|
|
413
|
-
canAccept: (scope, methodName) => scope === 'VegaNotifyController' && methodName === 'closeAll',
|
|
414
|
-
/**
|
|
415
|
-
* The function checks if the method name is closeAll.
|
|
416
|
-
*
|
|
417
|
-
* @returns {boolean} A boolean value
|
|
418
|
-
*/
|
|
419
|
-
payloadValue: () => {
|
|
420
|
-
return true;
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
];
|
|
424
|
-
|
|
425
|
-
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
426
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
427
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
428
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
429
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
430
|
-
};
|
|
431
|
-
/**
|
|
432
|
-
* The page notification controller
|
|
433
|
-
*/
|
|
434
|
-
class VegaNotifyController {
|
|
435
|
-
constructor() {
|
|
436
|
-
this.resizeObserverSlimmer = createDynamicSlimmer(VegaNotifyController, PageResizeObserverSlimmer, [], [{ mapFrom: 'connectResizeObserver', mapTo: 'connectResizeObserver' }], [
|
|
437
|
-
{
|
|
438
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
439
|
-
callback: (entries) => {
|
|
440
|
-
var _a;
|
|
441
|
-
const currentVisible = entries[0].contentRect.height > 0;
|
|
442
|
-
if (!currentVisible && ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains('hydrated'))) {
|
|
443
|
-
InternalVegaZIndexManager$1.removeZIndex(this.container, 'top');
|
|
444
|
-
this.container.remove();
|
|
445
|
-
this.container = null;
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
449
|
-
target: () => this.container,
|
|
450
|
-
},
|
|
451
|
-
]);
|
|
452
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaNotifyController, ['open', 'close', 'closeAll'], VegaNotifyRuntimeMetricsPayloadDefinition);
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* It creates a new notification element, adds it to the container, and returns the notification's ID
|
|
456
|
-
*
|
|
457
|
-
* @param {VegaNotifyOption} options - VegaNotifyProps
|
|
458
|
-
* @returns {Promise<string>} The ID of the notification.
|
|
459
|
-
* @vegaVersion 1.17.0
|
|
460
|
-
*/
|
|
461
|
-
async open(options) {
|
|
462
|
-
const pageNotification = this.createPageNotification(options);
|
|
463
|
-
this.getContainer().append(pageNotification);
|
|
464
|
-
return pageNotification.id;
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* It closes all notifications
|
|
468
|
-
*
|
|
469
|
-
* @vegaVersion 1.17.0
|
|
470
|
-
*/
|
|
471
|
-
async closeAll() {
|
|
472
|
-
this.container &&
|
|
473
|
-
Array.from(this.container.children).forEach((item) => {
|
|
474
|
-
void item.close();
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* It closes the notification with the given id
|
|
479
|
-
*
|
|
480
|
-
* @param {string} id - The id of the notification to close.
|
|
481
|
-
* @vegaVersion 1.17.0
|
|
482
|
-
*/
|
|
483
|
-
async close(id) {
|
|
484
|
-
// eslint-disable-next-line no-restricted-globals
|
|
485
|
-
await document.getElementById(id).close();
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* The function "connectResizeObserver" is used to connect a resize observer.
|
|
489
|
-
*
|
|
490
|
-
* @vegaVersion 1.17.0
|
|
491
|
-
*/
|
|
492
|
-
connectResizeObserver() {
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* It creates a new page notification element, sets its properties, and returns it
|
|
496
|
-
*
|
|
497
|
-
* @param {VegaNotifyOption} props - VegaNotifyProps - the properties of the notification
|
|
498
|
-
* @returns {HTMLVegaPageNotificationElement} A function that takes in a props object and returns a pageNotification element.
|
|
499
|
-
*/
|
|
500
|
-
createPageNotification(props) {
|
|
501
|
-
const pageNotification =
|
|
502
|
-
// eslint-disable-next-line no-restricted-globals
|
|
503
|
-
document.createElement('vega-page-notification');
|
|
504
|
-
Object.keys(props).forEach((propName) => {
|
|
505
|
-
props[propName] !== undefined && (pageNotification[propName] = props[propName]);
|
|
506
|
-
});
|
|
507
|
-
pageNotification.style.marginBottom = getDeviceType() === DeviceType.MOBILE ? '12px' : '16px';
|
|
508
|
-
pageNotification.id = `vega-page-notification-${generateUUID()}`;
|
|
509
|
-
return pageNotification;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* It creates a div element, sets its z-index to be on top of everything else, adds a class to it, and
|
|
513
|
-
* then adds it to the body of the page
|
|
514
|
-
*
|
|
515
|
-
* @returns {HTMLVegaPageNotificationListElement} The container is being returned.
|
|
516
|
-
*/
|
|
517
|
-
getContainer() {
|
|
518
|
-
if (this.container) {
|
|
519
|
-
return this.container;
|
|
520
|
-
}
|
|
521
|
-
// eslint-disable-next-line no-restricted-globals
|
|
522
|
-
this.container = document.createElement('vega-page-notification-list');
|
|
523
|
-
InternalVegaZIndexManager$1.setZIndex(this.container, 'top');
|
|
524
|
-
if (getDeviceType() === DeviceType.MOBILE) {
|
|
525
|
-
this.container.classList.add('vega-page-notification-list-bottom');
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
this.container.classList.add('vega-page-notification-list-topRight');
|
|
529
|
-
}
|
|
530
|
-
// eslint-disable-next-line no-restricted-globals
|
|
531
|
-
document.body.append(this.container);
|
|
532
|
-
this.connectResizeObserver();
|
|
533
|
-
return this.container;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
__decorate$5([
|
|
537
|
-
InjectVegaSlimmer()
|
|
538
|
-
], VegaNotifyController.prototype, "resizeObserverSlimmer", void 0);
|
|
539
|
-
__decorate$5([
|
|
540
|
-
InjectVegaTelemetrySlimmer()
|
|
541
|
-
], VegaNotifyController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
542
|
-
const VegaNotify = new VegaNotifyController();
|
|
543
|
-
|
|
544
|
-
const ThemeManagerRuntimeMetricsPayloadDefinition = [
|
|
545
|
-
{
|
|
546
|
-
payloadKey: 'IS_OVERRIDECOLORS_METHOD_CALLED',
|
|
547
|
-
payloadDescription: 'Indicate if the method overrideColors of public API ThemeManager is called',
|
|
548
|
-
/**
|
|
549
|
-
* Indicate whether the method is collected when the method been called .
|
|
550
|
-
*
|
|
551
|
-
* @param {string} scope - The class name of public api
|
|
552
|
-
* @param {string} methodName - The method name called by the public api
|
|
553
|
-
* @returns {boolean} A boolean value
|
|
554
|
-
*/
|
|
555
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'overrideColors',
|
|
556
|
-
/**
|
|
557
|
-
* The function checks if the method is be called.
|
|
558
|
-
*
|
|
559
|
-
* @returns {boolean} A boolean value
|
|
560
|
-
*/
|
|
561
|
-
payloadValue: () => {
|
|
562
|
-
return true;
|
|
563
|
-
},
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
payloadKey: 'IS_RESET_METHOD_CALLED',
|
|
567
|
-
payloadDescription: 'Indicate if the method reset of public API ThemeManager is called',
|
|
568
|
-
/**
|
|
569
|
-
* Indicate whether the method is collected when the method been called .
|
|
570
|
-
*
|
|
571
|
-
* @param {string} scope - The class name of public api
|
|
572
|
-
* @param {string} methodName - The method name called by the public api
|
|
573
|
-
* @returns {boolean} A boolean value
|
|
574
|
-
*/
|
|
575
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'reset',
|
|
576
|
-
/**
|
|
577
|
-
* The function checks if the method is be called.
|
|
578
|
-
*
|
|
579
|
-
* @returns {boolean} A boolean value
|
|
580
|
-
*/
|
|
581
|
-
payloadValue: () => {
|
|
582
|
-
return true;
|
|
583
|
-
},
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
payloadKey: 'IS_TOGGLEDARKMODE_METHOD_CALLED',
|
|
587
|
-
payloadDescription: 'Indicate if the method toggleDarkMode of public API ThemeManager is called',
|
|
588
|
-
/**
|
|
589
|
-
* Indicate whether the method is collected when the method been called .
|
|
590
|
-
*
|
|
591
|
-
* @param {string} scope - The class name of public api
|
|
592
|
-
* @param {string} methodName - The method name called by the public api
|
|
593
|
-
* @returns {boolean} A boolean value
|
|
594
|
-
*/
|
|
595
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'toggleDarkMode',
|
|
596
|
-
/**
|
|
597
|
-
* The function checks if the method is be called.
|
|
598
|
-
*
|
|
599
|
-
* @returns {boolean} A boolean value
|
|
600
|
-
*/
|
|
601
|
-
payloadValue: () => {
|
|
602
|
-
return true;
|
|
603
|
-
},
|
|
604
|
-
},
|
|
605
|
-
{
|
|
606
|
-
payloadKey: 'IS_ISDARKMODE_METHOD_CALLED',
|
|
607
|
-
payloadDescription: 'Indicate if the method isDarkMode of public API ThemeManager is called',
|
|
608
|
-
/**
|
|
609
|
-
* Indicate whether the method is collected when the method been called .
|
|
610
|
-
*
|
|
611
|
-
* @param {string} scope - The class name of public api
|
|
612
|
-
* @param {string} methodName - The method name called by the public api
|
|
613
|
-
* @returns {boolean} A boolean value
|
|
614
|
-
*/
|
|
615
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'isDarkMode',
|
|
616
|
-
/**
|
|
617
|
-
* The function checks if the method is be called.
|
|
618
|
-
*
|
|
619
|
-
* @returns {boolean} A boolean value
|
|
620
|
-
*/
|
|
621
|
-
payloadValue: () => {
|
|
622
|
-
return true;
|
|
623
|
-
},
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
payloadKey: 'IS_APPLY_BRANDING_METHOD_CALLED',
|
|
627
|
-
payloadDescription: 'Indicate if the method applyBranding of public API ThemeManager is called',
|
|
628
|
-
/**
|
|
629
|
-
* Indicate whether the method is collected when the method been called .
|
|
630
|
-
*
|
|
631
|
-
* @param {string} scope - The class name of public api
|
|
632
|
-
* @param {string} methodName - The method name called by the public api
|
|
633
|
-
* @returns {boolean} A boolean value
|
|
634
|
-
*/
|
|
635
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'applyBranding',
|
|
636
|
-
/**
|
|
637
|
-
* The function checks if the method is be called.
|
|
638
|
-
*
|
|
639
|
-
* @returns {boolean} A boolean value
|
|
640
|
-
*/
|
|
641
|
-
payloadValue: () => {
|
|
642
|
-
return true;
|
|
643
|
-
},
|
|
644
|
-
},
|
|
645
|
-
];
|
|
646
|
-
|
|
647
|
-
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
648
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
649
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
650
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
651
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
652
|
-
};
|
|
653
|
-
/**
|
|
654
|
-
* Vega components theme manager
|
|
655
|
-
*/
|
|
656
|
-
class ThemeManager {
|
|
657
|
-
constructor() {
|
|
658
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(ThemeManager, ['overrideColors', 'reset', 'toggleDarkMode', 'isDarkMode', 'applyBranding'], ThemeManagerRuntimeMetricsPayloadDefinition);
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* It takes the colors you passed in, parses them into the correct format, and then applies them to the theme
|
|
662
|
-
*
|
|
663
|
-
* @param {VegaThemeOverrideColors} overrideColors - OverrideColors - This is the object that you pass to the function.
|
|
664
|
-
* @vegaVersion 1.20.0
|
|
665
|
-
*/
|
|
666
|
-
async overrideColors(overrideColors) {
|
|
667
|
-
void VegaInternalThemeManager.overrideColors(overrideColors);
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* It removes all the custom override theme styles from the DOM
|
|
671
|
-
*
|
|
672
|
-
* @vegaVersion 1.20.0
|
|
673
|
-
*/
|
|
674
|
-
async reset() {
|
|
675
|
-
void VegaInternalThemeManager.reset();
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* This function toggles the dark mode of a webpage by adding or removing a 'dark' class to the HTML element.
|
|
679
|
-
*
|
|
680
|
-
* @param {boolean | undefined} darkMode - A boolean or undefined value that determines whether to enable or disable dark mode.
|
|
681
|
-
* If it is true, dark mode is enabled.
|
|
682
|
-
* If it is false, dark mode is disabled.
|
|
683
|
-
* @vegaVersion 1.32.0
|
|
684
|
-
*/
|
|
685
|
-
toggleDarkMode(darkMode) {
|
|
686
|
-
VegaInternalThemeManager.toggleDarkMode(darkMode);
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* The function checks if the HTML element has a class of "dark" and returns a boolean value accordingly.
|
|
690
|
-
*
|
|
691
|
-
* @returns {boolean} A boolean value indicating whether the HTML element has a class of "dark", which is
|
|
692
|
-
* typically used to indicate that the website is in dark mode.
|
|
693
|
-
* @vegaVersion 1.32.0
|
|
694
|
-
*/
|
|
695
|
-
isDarkMode() {
|
|
696
|
-
return VegaInternalThemeManager.isDarkMode();
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* This function switches the Vega theme to a brand theme based on the provided options.
|
|
700
|
-
*
|
|
701
|
-
* @param {BrandOptions} options - The options includes 'gp', 'genius' and 'heartland' options
|
|
702
|
-
* @vegaVersion 2.47.0
|
|
703
|
-
*/
|
|
704
|
-
applyBranding(options) {
|
|
705
|
-
VegaInternalThemeManager.applyBranding(options);
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
__decorate$4([
|
|
709
|
-
InjectVegaTelemetrySlimmer()
|
|
710
|
-
], ThemeManager.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
711
|
-
const VegaThemeManager = new ThemeManager();
|
|
712
|
-
|
|
713
|
-
const VegaDialogRuntimeMetricsPayloadDefinition = [
|
|
714
|
-
{
|
|
715
|
-
payloadKey: 'IS_OPEN_METHOD_CALLED',
|
|
716
|
-
payloadDescription: 'Indicate if the method open of public API VegaDialogController is called',
|
|
717
|
-
/**
|
|
718
|
-
* Indicate whether the method is collected when the method been called .
|
|
719
|
-
*
|
|
720
|
-
* @param {string} scope - The class name of public api
|
|
721
|
-
* @param {string} methodName - The method name called by the public api
|
|
722
|
-
* @returns {boolean} A boolean value
|
|
723
|
-
*/
|
|
724
|
-
canAccept: (scope, methodName) => scope === 'VegaDialogController' && methodName === 'open',
|
|
725
|
-
/**
|
|
726
|
-
* The function checks if the method name is open.
|
|
727
|
-
*
|
|
728
|
-
* @returns {boolean} A boolean value
|
|
729
|
-
*/
|
|
730
|
-
payloadValue: () => {
|
|
731
|
-
return true;
|
|
732
|
-
},
|
|
733
|
-
},
|
|
734
|
-
];
|
|
735
|
-
|
|
736
|
-
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
737
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
738
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
739
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
740
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
741
|
-
};
|
|
742
|
-
var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
743
|
-
var t = {};
|
|
744
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
745
|
-
t[p] = s[p];
|
|
746
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
747
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
748
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
749
|
-
t[p[i]] = s[p[i]];
|
|
750
|
-
}
|
|
751
|
-
return t;
|
|
752
|
-
};
|
|
753
|
-
/**
|
|
754
|
-
* The dialog controller
|
|
755
|
-
*/
|
|
756
|
-
class VegaDialogController {
|
|
757
|
-
constructor() {
|
|
758
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaDialogController, ['open'], VegaDialogRuntimeMetricsPayloadDefinition);
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
*
|
|
762
|
-
* It creates a new `vega-dialog` element, sets its properties, appends it to the DOM, and opens it
|
|
763
|
-
*
|
|
764
|
-
* @param {VegaDialogOption} options - VegaDialogOption
|
|
765
|
-
* @returns {HTMLVegaDialogElement} The dialog reference.
|
|
766
|
-
* @vegaVersion 1.24.0
|
|
767
|
-
*/
|
|
768
|
-
open(options) {
|
|
769
|
-
// eslint-disable-next-line no-restricted-globals
|
|
770
|
-
const dialog = document.createElement('vega-dialog');
|
|
771
|
-
const { isVerticallyCenter, isVerticallyCentered, showCloseButton, size, title, handleClose } = options, dialogProps = __rest$1(options, ["isVerticallyCenter", "isVerticallyCentered", "showCloseButton", "size", "title", "handleClose"]);
|
|
772
|
-
dialog.id = `vega-dialog-${generateUUID()}`;
|
|
773
|
-
dialog.dialogTitle = title;
|
|
774
|
-
dialog.modalProps = { isVerticallyCenter, isVerticallyCentered, showCloseButton, size, handleClose };
|
|
775
|
-
Object.keys(dialogProps).forEach((propName) => {
|
|
776
|
-
if (dialogProps[propName] !== undefined) {
|
|
777
|
-
dialog[propName] = dialogProps[propName];
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
// eslint-disable-next-line no-restricted-globals
|
|
781
|
-
document.body.append(dialog);
|
|
782
|
-
return dialog;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
__decorate$3([
|
|
786
|
-
InjectVegaTelemetrySlimmer()
|
|
787
|
-
], VegaDialogController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
788
|
-
const VegaDialog = new VegaDialogController();
|
|
789
|
-
|
|
790
|
-
/* istanbul ignore next */
|
|
791
|
-
const VegaEventManagerRuntimeMetricsPayloadDefinition = [
|
|
792
|
-
{
|
|
793
|
-
payloadKey: 'IS_SETSEMANTICS_METHOD_CALLED',
|
|
794
|
-
payloadDescription: 'Indicate if the method setSemantics of public API VegaEventManager is called',
|
|
795
|
-
/**
|
|
796
|
-
* Indicate whether the method is collected when the method been called .
|
|
797
|
-
*
|
|
798
|
-
* @param {string} scope - The class name of public api
|
|
799
|
-
* @param {string} methodName - The method name called by the public api
|
|
800
|
-
* @returns {boolean} A boolean value
|
|
801
|
-
*/
|
|
802
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
803
|
-
/**
|
|
804
|
-
* The function checks if the method is been called.
|
|
805
|
-
*
|
|
806
|
-
* @returns {boolean} A boolean value
|
|
807
|
-
*/
|
|
808
|
-
payloadValue: () => {
|
|
809
|
-
return true;
|
|
810
|
-
},
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
payloadKey: 'IS_GETSEMANTICS_METHOD_CALLED',
|
|
814
|
-
payloadDescription: 'Indicate if the method getSemantics of public API VegaEventManager is called',
|
|
815
|
-
/**
|
|
816
|
-
* Indicate whether the method is collected when the method been called .
|
|
817
|
-
*
|
|
818
|
-
* @param {string} scope - The class name of public api
|
|
819
|
-
* @param {string} methodName - The method name called by the public api
|
|
820
|
-
* @returns {boolean} A boolean value
|
|
821
|
-
*/
|
|
822
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'getSemantics',
|
|
823
|
-
/**
|
|
824
|
-
* The function checks if the method is been called.
|
|
825
|
-
*
|
|
826
|
-
* @returns {boolean} A boolean value
|
|
827
|
-
*/
|
|
828
|
-
payloadValue: () => {
|
|
829
|
-
return true;
|
|
830
|
-
},
|
|
831
|
-
},
|
|
832
|
-
{
|
|
833
|
-
payloadKey: 'IS_GETENABLEDEVENTIDSBYCOMPONENT_METHOD_CALLED',
|
|
834
|
-
payloadDescription: 'Indicate if the method getEnabledEventIdsByComponent of public API VegaEventManager is called',
|
|
835
|
-
/**
|
|
836
|
-
* Indicate whether the method is collected when the method been called .
|
|
837
|
-
*
|
|
838
|
-
* @param {string} scope - The class name of public api
|
|
839
|
-
* @param {string} methodName - The method name called by the public api
|
|
840
|
-
* @returns {boolean} A boolean value
|
|
841
|
-
*/
|
|
842
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'getEnabledEventIdsByComponent',
|
|
843
|
-
/**
|
|
844
|
-
* The function checks if the method is been called.
|
|
845
|
-
*
|
|
846
|
-
* @returns {boolean} A boolean value
|
|
847
|
-
*/
|
|
848
|
-
payloadValue: () => {
|
|
849
|
-
return true;
|
|
850
|
-
},
|
|
851
|
-
},
|
|
852
|
-
{
|
|
853
|
-
payloadKey: 'globalEventIsNative',
|
|
854
|
-
payloadDescription: 'Indicate if the vega components will emit events without the vega prefix',
|
|
855
|
-
/**
|
|
856
|
-
* Indicate whether the method is collected when the method been called .
|
|
857
|
-
*
|
|
858
|
-
* @param {string} scope - The class name of public api
|
|
859
|
-
* @param {string} methodName - The method name called by the public api
|
|
860
|
-
* @returns {boolean} A boolean value
|
|
861
|
-
*/
|
|
862
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
863
|
-
/**
|
|
864
|
-
* The function checks if the method is been called.
|
|
865
|
-
*
|
|
866
|
-
* @param {unknown[]} args - The args parameter is an object
|
|
867
|
-
* @returns {boolean} A boolean value
|
|
868
|
-
*/
|
|
869
|
-
payloadValue: (args) => {
|
|
870
|
-
const config = args;
|
|
871
|
-
return !!(config.global && config.global.namespace === 'native');
|
|
872
|
-
},
|
|
873
|
-
},
|
|
874
|
-
{
|
|
875
|
-
payloadKey: 'eventOfSpecificComponentsIsNative',
|
|
876
|
-
payloadDescription: 'Indicate if the vega components will emit events with the vega prefix, but special components will emit events without vega prefix',
|
|
877
|
-
/**
|
|
878
|
-
* Indicate whether the method is collected when the method been called .
|
|
879
|
-
*
|
|
880
|
-
* @param {string} scope - The class name of public api
|
|
881
|
-
* @param {string} methodName - The method name called by the public api
|
|
882
|
-
* @returns {boolean} A boolean value
|
|
883
|
-
*/
|
|
884
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
885
|
-
/**
|
|
886
|
-
* The function checks if the method is been called.
|
|
887
|
-
*
|
|
888
|
-
* @param {unknown[]} args - The args parameter is an object
|
|
889
|
-
* @returns {boolean} A boolean value
|
|
890
|
-
*/
|
|
891
|
-
payloadValue: (args) => {
|
|
892
|
-
const config = args;
|
|
893
|
-
if (config.components) {
|
|
894
|
-
const specialComponents = Object.keys(config.components);
|
|
895
|
-
return !!(specialComponents.length > 0 &&
|
|
896
|
-
config.components[specialComponents[0]].namespace === 'native');
|
|
897
|
-
}
|
|
898
|
-
return false;
|
|
899
|
-
},
|
|
900
|
-
},
|
|
901
|
-
{
|
|
902
|
-
payloadKey: 'eventOfSpecificComponentsIsVega',
|
|
903
|
-
payloadDescription: 'Indicate if the vega components will emit events without the vega prefix, but special components will emit events with vega prefix',
|
|
904
|
-
/**
|
|
905
|
-
* Indicate whether the method is collected when the method been called .
|
|
906
|
-
*
|
|
907
|
-
* @param {string} scope - The class name of public api
|
|
908
|
-
* @param {string} methodName - The method name called by the public api
|
|
909
|
-
* @returns {boolean} A boolean value
|
|
910
|
-
*/
|
|
911
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
912
|
-
/**
|
|
913
|
-
* The function checks if the method is been called.
|
|
914
|
-
*
|
|
915
|
-
* @param {unknown[]} args - The args parameter is an object
|
|
916
|
-
* @returns {boolean} A boolean value
|
|
917
|
-
*/
|
|
918
|
-
payloadValue: (args) => {
|
|
919
|
-
const config = args;
|
|
920
|
-
if (config.global && config.components) {
|
|
921
|
-
const specialComponents = Object.keys(config.components);
|
|
922
|
-
return !!(config.global.namespace === 'native' &&
|
|
923
|
-
specialComponents.length > 0 &&
|
|
924
|
-
config.components[specialComponents[0]].namespace === 'vega');
|
|
925
|
-
}
|
|
926
|
-
return false;
|
|
927
|
-
},
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
payloadKey: 'globalJqueryDelegatedEventIsTrue',
|
|
931
|
-
payloadDescription: 'Indicate if the use jQuery with event delegation',
|
|
932
|
-
/**
|
|
933
|
-
* Indicate whether the method is collected when the method been called .
|
|
934
|
-
*
|
|
935
|
-
* @param {string} scope - The class name of public api
|
|
936
|
-
* @param {string} methodName - The method name called by the public api
|
|
937
|
-
* @returns {boolean} A boolean value
|
|
938
|
-
*/
|
|
939
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
940
|
-
/**
|
|
941
|
-
* The function checks if the method is been called.
|
|
942
|
-
*
|
|
943
|
-
* @param {unknown[]} args - The args parameter is an object
|
|
944
|
-
* @returns {boolean} A boolean value
|
|
945
|
-
*/
|
|
946
|
-
payloadValue: (args) => {
|
|
947
|
-
const config = args;
|
|
948
|
-
return !!(config.global && config.global.jqueryDelegatedEvent === true);
|
|
949
|
-
},
|
|
950
|
-
},
|
|
951
|
-
{
|
|
952
|
-
payloadKey: 'jqueryDelegatedEventIsCustomStrategy',
|
|
953
|
-
payloadDescription: 'Indicate if the use jQuery with event delegation',
|
|
954
|
-
/**
|
|
955
|
-
* Indicate whether the method is collected when the method been called .
|
|
956
|
-
*
|
|
957
|
-
* @param {string} scope - The class name of public api
|
|
958
|
-
* @param {string} methodName - The method name called by the public api
|
|
959
|
-
* @returns {boolean} A boolean value
|
|
960
|
-
*/
|
|
961
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
962
|
-
/**
|
|
963
|
-
* The function checks if the method is been called.
|
|
964
|
-
*
|
|
965
|
-
* @param {unknown[]} args - The args parameter is an object
|
|
966
|
-
* @returns {boolean} A boolean value
|
|
967
|
-
*/
|
|
968
|
-
payloadValue: (args) => {
|
|
969
|
-
const config = args;
|
|
970
|
-
return !!(config.global &&
|
|
971
|
-
Array.isArray(config.global.jqueryDelegatedEvent) &&
|
|
972
|
-
config.global.jqueryDelegatedEvent.length > 0);
|
|
973
|
-
},
|
|
974
|
-
},
|
|
975
|
-
{
|
|
976
|
-
payloadKey: 'jqueryDelegatedEventOfSpecialComponentsIsTrue',
|
|
977
|
-
payloadDescription: 'Indicate if the use jQuery with event delegation',
|
|
978
|
-
/**
|
|
979
|
-
* Indicate whether the method is collected when the method been called .
|
|
980
|
-
*
|
|
981
|
-
* @param {string} scope - The class name of public api
|
|
982
|
-
* @param {string} methodName - The method name called by the public api
|
|
983
|
-
* @returns {boolean} A boolean value
|
|
984
|
-
*/
|
|
985
|
-
canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
|
|
986
|
-
/**
|
|
987
|
-
* The function checks if the method is been called.
|
|
988
|
-
*
|
|
989
|
-
* @param {unknown[]} args - The args parameter is an object
|
|
990
|
-
* @returns {boolean} A boolean value
|
|
991
|
-
*/
|
|
992
|
-
payloadValue: (args) => {
|
|
993
|
-
const config = args;
|
|
994
|
-
if (config.components) {
|
|
995
|
-
const specialComponents = Object.keys(config.components);
|
|
996
|
-
return !!(specialComponents.length > 0 &&
|
|
997
|
-
config.components[specialComponents[0]].jqueryDelegatedEvent === true);
|
|
998
|
-
}
|
|
999
|
-
return false;
|
|
1000
|
-
},
|
|
1001
|
-
},
|
|
1002
|
-
];
|
|
1003
|
-
|
|
1004
|
-
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1005
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1006
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1007
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1008
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1009
|
-
};
|
|
1010
|
-
/**
|
|
1011
|
-
* The VegaEventManager class provides methods for setting and retrieving event semantics configuration,
|
|
1012
|
-
* as well as getting the corresponding native event name for a given event.
|
|
1013
|
-
*/
|
|
1014
|
-
class VegaEventManager {
|
|
1015
|
-
constructor() {
|
|
1016
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaEventManager, ['setSemantics', 'getSemantics', 'getEnabledEventIdsByComponent'], VegaEventManagerRuntimeMetricsPayloadDefinition);
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* The function sets the semantics configuration for event management.
|
|
1020
|
-
*
|
|
1021
|
-
* @param {EventSemanticsConfig} config - The config parameter is an object that contains the
|
|
1022
|
-
* configuration settings for the event semantics. It may include properties such as the event type,
|
|
1023
|
-
* event source, event target, event data, and any other relevant information for setting up the
|
|
1024
|
-
* semantics of the event.
|
|
1025
|
-
* @vegaVersion 2.0.0
|
|
1026
|
-
*/
|
|
1027
|
-
setSemantics(config) {
|
|
1028
|
-
internalVegaEventManager.setSemantics(config);
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* The function "getSemantics" returns the event semantics of an HTML element.
|
|
1032
|
-
*
|
|
1033
|
-
* @param {HTMLElement} host - The host parameter is an HTMLElement, which represents an HTML element
|
|
1034
|
-
* in the DOM (Document Object Model). It can be any valid HTML element such as a div, span, button,
|
|
1035
|
-
* etc.
|
|
1036
|
-
* @returns {EventSemantics} an object of type EventSemantics.
|
|
1037
|
-
* @vegaVersion 2.0.0
|
|
1038
|
-
*/
|
|
1039
|
-
getSemantics(host) {
|
|
1040
|
-
return internalVegaEventManager.getSemantics(host);
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* The function "getEnabledEventIdsByComponent" returns the all eventIds in component.
|
|
1044
|
-
*
|
|
1045
|
-
* @param {VegaComponentName} componentName - The component name,
|
|
1046
|
-
* etc.
|
|
1047
|
-
* @returns {Nullable<VegaEventID[]>} All eventIds.
|
|
1048
|
-
* @vegaVersion 2.0.0
|
|
1049
|
-
*/
|
|
1050
|
-
getEnabledEventIdsByComponent(componentName) {
|
|
1051
|
-
return internalVegaEventManager.getEnabledEventIdsByComponent(componentName);
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
__decorate$2([
|
|
1055
|
-
InjectVegaTelemetrySlimmer()
|
|
1056
|
-
], VegaEventManager.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1057
|
-
const VegaEventManager$1 = new VegaEventManager();
|
|
1058
|
-
|
|
1059
|
-
const ZIndexManagerRuntimeMetricsPayloadDefinition = [
|
|
1060
|
-
{
|
|
1061
|
-
payloadKey: 'IS_OVERRIDEZINDEXBASICVALUES_METHOD_CALLED',
|
|
1062
|
-
payloadDescription: 'Indicate if the method overrideZIndexBasicValues of public API ZIndexManager is called',
|
|
1063
|
-
/**
|
|
1064
|
-
* Indicate whether the method is collected when the method been called .
|
|
1065
|
-
*
|
|
1066
|
-
* @param {string} scope - The class name of public api
|
|
1067
|
-
* @param {string} methodName - The method name called by the public api
|
|
1068
|
-
* @returns {boolean} A boolean value
|
|
1069
|
-
*/
|
|
1070
|
-
canAccept: (scope, methodName) => scope === 'VegaZIndexManager' && methodName === 'overrideZIndexBasicValues',
|
|
1071
|
-
/**
|
|
1072
|
-
* The function checks if the method name is load.
|
|
1073
|
-
*
|
|
1074
|
-
* @returns {boolean} A boolean value
|
|
1075
|
-
*/
|
|
1076
|
-
payloadValue: () => {
|
|
1077
|
-
return true;
|
|
1078
|
-
},
|
|
1079
|
-
},
|
|
1080
|
-
{
|
|
1081
|
-
payloadKey: 'zIndexBasicValuesGreatThanTenThousand',
|
|
1082
|
-
payloadDescription: 'Indicate if the basic z-index value is great than ten thousand',
|
|
1083
|
-
/**
|
|
1084
|
-
* Indicate whether the method is collected when the method been called .
|
|
1085
|
-
*
|
|
1086
|
-
* @param {string} scope - The class name of public api
|
|
1087
|
-
* @param {string} methodName - The method name called by the public api
|
|
1088
|
-
* @returns {boolean} A boolean value
|
|
1089
|
-
*/
|
|
1090
|
-
canAccept: (scope, methodName) => scope === 'VegaZIndexManager' && methodName === 'overrideZIndexBasicValues',
|
|
1091
|
-
/**
|
|
1092
|
-
* The function checks if the method name is load.
|
|
1093
|
-
*
|
|
1094
|
-
* @param {unknown[]} args - The parameter of slimmer method
|
|
1095
|
-
* @returns {boolean} A boolean value
|
|
1096
|
-
*/
|
|
1097
|
-
payloadValue: (args) => {
|
|
1098
|
-
return args['base'] > 10000;
|
|
1099
|
-
},
|
|
1100
|
-
},
|
|
1101
|
-
];
|
|
1102
|
-
|
|
1103
|
-
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1104
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1105
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1106
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1107
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1108
|
-
};
|
|
1109
|
-
/**
|
|
1110
|
-
* The VegaZIndexManager class calls a method in the ZIndexManager class to
|
|
1111
|
-
* change z-index values based on the input.
|
|
1112
|
-
*/
|
|
1113
|
-
class VegaZIndexManager {
|
|
1114
|
-
constructor() {
|
|
1115
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaZIndexManager, ['overrideZIndexBasicValues'], ZIndexManagerRuntimeMetricsPayloadDefinition);
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* The function "overrideZIndexBasicValues" calls a method in the "ZIndexManager" class to change the
|
|
1119
|
-
* z-index values based on the input.
|
|
1120
|
-
*
|
|
1121
|
-
* @param {ZIndexBasicValues} input - The input parameter is of type ZIndexBasicValues.
|
|
1122
|
-
* @vegaVersion 2.3.0
|
|
1123
|
-
*/
|
|
1124
|
-
overrideZIndexBasicValues(input) {
|
|
1125
|
-
InternalVegaZIndexManager$1.overrideZIndexBasicValues(input);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
__decorate$1([
|
|
1129
|
-
InjectVegaTelemetrySlimmer()
|
|
1130
|
-
], VegaZIndexManager.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1131
|
-
const VegaZIndexManager$1 = new VegaZIndexManager();
|
|
1132
|
-
|
|
1133
|
-
const VegaSkeletonRuntimeMetricsPayloadDefinition = [
|
|
1134
|
-
{
|
|
1135
|
-
payloadKey: 'IS_LOAD_METHOD_CALLED',
|
|
1136
|
-
payloadDescription: 'Indicate if the method load of public API VegaSkeletonLoaderController is called',
|
|
1137
|
-
/**
|
|
1138
|
-
* Indicate whether the method is collected when the method been called .
|
|
1139
|
-
*
|
|
1140
|
-
* @param {string} scope - The class name of public api
|
|
1141
|
-
* @param {string} methodName - The method name called by the public api
|
|
1142
|
-
* @returns {boolean} A boolean value
|
|
1143
|
-
*/
|
|
1144
|
-
canAccept: (scope, methodName) => scope === 'VegaSkeletonLoaderController' && methodName === 'load',
|
|
1145
|
-
/**
|
|
1146
|
-
* The function checks if the method name is load.
|
|
1147
|
-
*
|
|
1148
|
-
* @returns {boolean} A boolean value
|
|
1149
|
-
*/
|
|
1150
|
-
payloadValue: () => {
|
|
1151
|
-
return true;
|
|
1152
|
-
},
|
|
1153
|
-
},
|
|
1154
|
-
{
|
|
1155
|
-
payloadKey: 'IS_UNLOAD_METHOD_CALLED',
|
|
1156
|
-
payloadDescription: 'Indicate if the method unLoad of public API VegaSkeletonLoaderController is called',
|
|
1157
|
-
/**
|
|
1158
|
-
* Indicate whether the method is collected when the method been called .
|
|
1159
|
-
*
|
|
1160
|
-
* @param {string} scope - The class name of public api
|
|
1161
|
-
* @param {string} methodName - The method name called by the public api
|
|
1162
|
-
* @returns {boolean} A boolean value
|
|
1163
|
-
*/
|
|
1164
|
-
canAccept: (scope, methodName) => scope === 'VegaSkeletonLoaderController' && methodName === 'unLoad',
|
|
1165
|
-
/**
|
|
1166
|
-
* The function checks if the method name is unLoad.
|
|
1167
|
-
*
|
|
1168
|
-
* @returns {boolean} A boolean value
|
|
1169
|
-
*/
|
|
1170
|
-
payloadValue: () => {
|
|
1171
|
-
return true;
|
|
1172
|
-
},
|
|
1173
|
-
},
|
|
1174
|
-
{
|
|
1175
|
-
payloadKey: 'IS_UNLOADALL_METHOD_CALLED',
|
|
1176
|
-
payloadDescription: 'Indicate if the method unLoadAll of public API VegaSkeletonLoaderController is called',
|
|
1177
|
-
/**
|
|
1178
|
-
* Indicate whether the method is collected when the method been called .
|
|
1179
|
-
*
|
|
1180
|
-
* @param {string} scope - The class name of public api
|
|
1181
|
-
* @param {string} methodName - The method name called by the public api
|
|
1182
|
-
* @returns {boolean} A boolean value
|
|
1183
|
-
*/
|
|
1184
|
-
canAccept: (scope, methodName) => scope === 'VegaSkeletonLoaderController' && methodName === 'unLoadAll',
|
|
1185
|
-
/**
|
|
1186
|
-
* The function checks if the method name is unLoadAll.
|
|
1187
|
-
*
|
|
1188
|
-
* @returns {boolean} A boolean value
|
|
1189
|
-
*/
|
|
1190
|
-
payloadValue: () => {
|
|
1191
|
-
return true;
|
|
1192
|
-
},
|
|
1193
|
-
},
|
|
1194
|
-
];
|
|
1195
|
-
|
|
1196
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1197
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1198
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1199
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1200
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1201
|
-
};
|
|
1202
|
-
/**
|
|
1203
|
-
* Vega Skeleton Loader Controller to show skeletons in the target elements
|
|
1204
|
-
*/
|
|
1205
|
-
class VegaSkeletonLoaderController {
|
|
1206
|
-
constructor() {
|
|
1207
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaSkeletonLoaderController, ['load', 'unLoad', 'unLoadAll'], VegaSkeletonRuntimeMetricsPayloadDefinition);
|
|
1208
|
-
this.loaderMap = new Map();
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Load the skeletons in the target elements
|
|
1212
|
-
*
|
|
1213
|
-
* @param { VegaSkeletonLoaderConfig } config - Configuration for the loading function
|
|
1214
|
-
* @param {string} config.target - Target elements to show the skeletons.
|
|
1215
|
-
* @param {VegaSkeletonLoaderConfig.type} [config.type = 'text'] - Type of the skeleton.
|
|
1216
|
-
* @param {VegaSkeletonLoaderConfig.width} config.width - Width of the skeleton.
|
|
1217
|
-
* @param {VegaSkeletonLoaderConfig.height} config.height - Height of the skeleton.
|
|
1218
|
-
* @param {VegaSkeletonLoaderConfig.items} config.items - Configuration for multiple skeleton items.
|
|
1219
|
-
* @param {VegaSkeletonLoaderConfig.layout} config.layout - Layout of the skeleton items.
|
|
1220
|
-
* @returns { string } - Key of the loaded skeleton items.
|
|
1221
|
-
* @vegaVersion 2.16.0
|
|
1222
|
-
*/
|
|
1223
|
-
load({ target, type = 'text', width, height, items, layout }) {
|
|
1224
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1225
|
-
const targets = Array.from(document.body.querySelectorAll(target));
|
|
1226
|
-
const key = `vega-skeleton-loader-${generateUUID()}`;
|
|
1227
|
-
const loaderItems = [];
|
|
1228
|
-
targets.forEach((target) => {
|
|
1229
|
-
const skeletonsLoaders = !items
|
|
1230
|
-
? [this.createSkeleton({ type, width, height })]
|
|
1231
|
-
: items.map(this.createSkeleton);
|
|
1232
|
-
const itemsWithKey = (layout ? [this.wrapLayout(skeletonsLoaders, layout)] : skeletonsLoaders).map((item) => {
|
|
1233
|
-
item.dataset[VegaSkeletonLoaderController.LOADER_DATA_SET_KEY] = key;
|
|
1234
|
-
return item;
|
|
1235
|
-
});
|
|
1236
|
-
loaderItems.push(...itemsWithKey);
|
|
1237
|
-
target.append(...itemsWithKey);
|
|
1238
|
-
});
|
|
1239
|
-
this.loaderMap.set(key, loaderItems);
|
|
1240
|
-
return key;
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Remove the skeletons from the dom.
|
|
1244
|
-
*
|
|
1245
|
-
* @param {string} key - The key returned from {@link VegaSkeletonLoaderController.load}.
|
|
1246
|
-
* @vegaVersion 2.16.0
|
|
1247
|
-
*/
|
|
1248
|
-
unLoad(key) {
|
|
1249
|
-
if (this.loaderMap.has(key)) {
|
|
1250
|
-
this.loaderMap.get(key).forEach((item) => item.remove());
|
|
1251
|
-
this.loaderMap.delete(key);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
/**
|
|
1255
|
-
* Remove all the skeletons from the dom.
|
|
1256
|
-
*
|
|
1257
|
-
* @vegaVersion 2.16.0
|
|
1258
|
-
*/
|
|
1259
|
-
unLoadAll() {
|
|
1260
|
-
for (const items of this.loaderMap.values()) {
|
|
1261
|
-
items.forEach((item) => item.remove());
|
|
1262
|
-
}
|
|
1263
|
-
this.loaderMap.clear();
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
* Create a skeleton item. The skeleton animated always be true
|
|
1267
|
-
*
|
|
1268
|
-
* @param {VegaSkeletonLoaderItem} config - Configuration for the skeleton item.
|
|
1269
|
-
* @returns {HTMLVegaSkeletonElement} - Skeleton item.
|
|
1270
|
-
*/
|
|
1271
|
-
createSkeleton(config) {
|
|
1272
|
-
const { type, width, height } = config;
|
|
1273
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1274
|
-
const skeleton = document.createElement('vega-skeleton');
|
|
1275
|
-
Object.assign(skeleton, { animated: true, type, width, height });
|
|
1276
|
-
return skeleton;
|
|
1277
|
-
}
|
|
1278
|
-
/**
|
|
1279
|
-
* Wrap the flex layout for the skeletons.
|
|
1280
|
-
*
|
|
1281
|
-
* @param {HTMLElement[]} skeletons - Skeleton elements of the loader.
|
|
1282
|
-
* @param {VegaSkeletonLoaderLayout} layout - Flex properties for the layout.
|
|
1283
|
-
* @returns {HTMLVegaFlexElement} - Container wrapping the skeletons in the specified flex layout.
|
|
1284
|
-
*/
|
|
1285
|
-
wrapLayout(skeletons, layout) {
|
|
1286
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1287
|
-
const skeletonContainer = document.createElement('vega-flex');
|
|
1288
|
-
Object.assign(skeletonContainer, Object.assign({ className: 'vega-skeleton-loader-template-container' }, layout.props));
|
|
1289
|
-
Object.assign(skeletonContainer.style, layout.style);
|
|
1290
|
-
skeletonContainer.append(...skeletons);
|
|
1291
|
-
return skeletonContainer;
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
VegaSkeletonLoaderController.LOADER_DATA_SET_KEY = 'vegaSkeletonLoaderKey';
|
|
1295
|
-
__decorate([
|
|
1296
|
-
InjectVegaTelemetrySlimmer()
|
|
1297
|
-
], VegaSkeletonLoaderController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1298
|
-
const VegaSkeletonLoader = new VegaSkeletonLoaderController();
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
* Base renderer for Vega Rich Text Editor.
|
|
1302
|
-
*/
|
|
1303
|
-
class VegaRTEExtensionRenderer extends VegaRTEBaseRenderer {
|
|
1304
|
-
/**
|
|
1305
|
-
* Returns the styles to be injected into the RTE scope.
|
|
1306
|
-
* Override this method to provide custom styles for the custom blocks or nodes.
|
|
1307
|
-
*
|
|
1308
|
-
* @returns {string} - The styles as a string.
|
|
1309
|
-
*/
|
|
1310
|
-
injectRTEScopeStyles() {
|
|
1311
|
-
return '';
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Renders the given data as a DOM element.
|
|
1315
|
-
*
|
|
1316
|
-
* @param {RTEBlock | RTENode} renderData - The data to render, which can be a block or a node.
|
|
1317
|
-
* @param {RTERenderContext} rteContext - The rte editor context.
|
|
1318
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1319
|
-
* @returns {VegaRTERenderResult} - The rendered DOM element.
|
|
1320
|
-
*/
|
|
1321
|
-
render(renderData, rteContext, createElement) {
|
|
1322
|
-
const element = this.doRender(createElement, renderData, rteContext);
|
|
1323
|
-
this.fallbackRegisterRef(element, renderData);
|
|
1324
|
-
this.appendChildren(element, renderData, rteContext, createElement);
|
|
1325
|
-
return element;
|
|
1326
|
-
}
|
|
1327
|
-
/**
|
|
1328
|
-
* Register the reference of the element in the rendering registry.
|
|
1329
|
-
*
|
|
1330
|
-
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1331
|
-
* @returns {VegaRTEUseRef} - The function to register the element.
|
|
1332
|
-
*/
|
|
1333
|
-
useRef(renderData) {
|
|
1334
|
-
renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] = true;
|
|
1335
|
-
return function (element) {
|
|
1336
|
-
if (element) {
|
|
1337
|
-
stateEntityRenderingRegistry.register(element, renderData);
|
|
1338
|
-
}
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
|
-
/**
|
|
1342
|
-
* Get a registered renderer by its key.
|
|
1343
|
-
*
|
|
1344
|
-
* @param {string} key - The key of the renderer.
|
|
1345
|
-
* @returns {Nullable<BaseRenderer>} - The registered renderer or null if not found.
|
|
1346
|
-
*/
|
|
1347
|
-
getDTORenderer(key) {
|
|
1348
|
-
return RTEDTORendererManager.getRTERenderer(key);
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
* Auto render the block children if the block element is not exist
|
|
1352
|
-
*
|
|
1353
|
-
* @param {VegaRTERenderResult} parentElement - The parent element to append children to.
|
|
1354
|
-
* @param {RTEBlock | RTENode} renderData - The data to render children for.
|
|
1355
|
-
* @param {RTERenderContext} rteContext - The render context.
|
|
1356
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1357
|
-
*/
|
|
1358
|
-
appendChildren(parentElement, renderData, rteContext, createElement) {
|
|
1359
|
-
if (Array.isArray(renderData['children']) &&
|
|
1360
|
-
renderData['children'].length &&
|
|
1361
|
-
!parentElement['$children$']) {
|
|
1362
|
-
parentElement['$children$'] = renderData['children']
|
|
1363
|
-
.map((child) => {
|
|
1364
|
-
return this.renderChildren(child, rteContext, createElement);
|
|
1365
|
-
})
|
|
1366
|
-
.filter(isNonNullable);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Render the children node.
|
|
1371
|
-
*
|
|
1372
|
-
* @param {RTENode | RTEBlock} renderData - The node to render children for.
|
|
1373
|
-
* @param {RTERenderContext} rteContext - The render context.
|
|
1374
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1375
|
-
* @returns {Nullable<VegaRTERenderResult>} - The rendered DOM element.
|
|
1376
|
-
*/
|
|
1377
|
-
renderChildren(renderData, rteContext, createElement) {
|
|
1378
|
-
const renderer = this.getDTORenderer(renderData.type);
|
|
1379
|
-
if (renderer) {
|
|
1380
|
-
return renderer.render(renderData, rteContext, createElement);
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
/**
|
|
1384
|
-
* Fallback register reference for the element.
|
|
1385
|
-
*
|
|
1386
|
-
* @param {VegaRTERenderResult} element - The rendered DOM element.
|
|
1387
|
-
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1388
|
-
*/
|
|
1389
|
-
fallbackRegisterRef(element, renderData) {
|
|
1390
|
-
if (!renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] &&
|
|
1391
|
-
element['$attrs$'] &&
|
|
1392
|
-
!element['$attrs$']['ref']) {
|
|
1393
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1394
|
-
element['$attrs$']['ref'] = this.useRef(renderData);
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
VegaRTEExtensionRenderer.REGISTER_REF_FLAG = '__registeredRef__';
|
|
1399
|
-
|
|
1400
|
-
/**
|
|
1401
|
-
* Abstract class for Vega Rich Text Editor extensions.
|
|
1402
|
-
*/
|
|
1403
|
-
class VegaRTEExtension {
|
|
1404
|
-
constructor() {
|
|
1405
|
-
/**
|
|
1406
|
-
* The context of the RTE extension, which may include references to the host editor and other relevant information.
|
|
1407
|
-
*/
|
|
1408
|
-
this.extensionContext = null;
|
|
1409
|
-
this.hasCustomStylesRenderers = new Set();
|
|
1410
|
-
}
|
|
1411
|
-
/**
|
|
1412
|
-
* Registers an action handle strategy for a specific node or block class.
|
|
1413
|
-
*
|
|
1414
|
-
* @param {string} nodeOrBlockClassName - The name of the node or block class.
|
|
1415
|
-
* @param {string} actionType - The type of the action.
|
|
1416
|
-
* @param {ActionHandleStrategy<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The strategy to register.
|
|
1417
|
-
*/
|
|
1418
|
-
static registerActionHandleStrategy(nodeOrBlockClassName, actionType, strategy) {
|
|
1419
|
-
ActionHandleStrategyRegistry.register(actionType, nodeOrBlockClassName, strategy);
|
|
1420
|
-
}
|
|
1421
|
-
/**
|
|
1422
|
-
* Registers an action handler interceptor for a specific node or block class.
|
|
1423
|
-
*
|
|
1424
|
-
* @param {string} nodeOrBlockClassName - The name of the node or block class.
|
|
1425
|
-
* @param {string} actionType - The type of the action.
|
|
1426
|
-
* @param {ActionHandlerInterceptor<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The interceptor to register.
|
|
1427
|
-
*/
|
|
1428
|
-
static registerActionHandlerInterceptor(nodeOrBlockClassName, actionType, strategy) {
|
|
1429
|
-
ActionHandlerInterceptorRegistry.register(actionType, nodeOrBlockClassName, strategy);
|
|
1430
|
-
}
|
|
1431
|
-
/**
|
|
1432
|
-
* Initializes the RTE extension with the provided context.
|
|
1433
|
-
*
|
|
1434
|
-
* @param {RTEExtensionContext} context - The context of the RTE extension.
|
|
1435
|
-
*/
|
|
1436
|
-
initialExtension(context) {
|
|
1437
|
-
this.extensionContext = context;
|
|
1438
|
-
}
|
|
1439
|
-
/**
|
|
1440
|
-
* Collect custom styles for the extension renderers.
|
|
1441
|
-
* If custom nodes have special styles, override this method to provide the styles.
|
|
1442
|
-
*
|
|
1443
|
-
* @returns {string} - The custom styles as a string.
|
|
1444
|
-
*/
|
|
1445
|
-
collectExtensionRendererStyles() {
|
|
1446
|
-
let styles = '';
|
|
1447
|
-
if (this.hasCustomStylesRenderers.size > 0) {
|
|
1448
|
-
this.hasCustomStylesRenderers.forEach((renderer) => {
|
|
1449
|
-
styles += `${renderer.injectRTEScopeStyles()}\n`;
|
|
1450
|
-
});
|
|
1451
|
-
}
|
|
1452
|
-
return styles;
|
|
1453
|
-
}
|
|
1454
|
-
/**
|
|
1455
|
-
* Register a node type with the extension.
|
|
1456
|
-
*
|
|
1457
|
-
* @param {string} type - The type of the node or block. The type should be a string that uniquely identifies the node or block.
|
|
1458
|
-
* @param {ClassType<RTEBlock | RTENode>} DTOClass - The DTO class to register.
|
|
1459
|
-
*/
|
|
1460
|
-
registerNode(type, DTOClass) {
|
|
1461
|
-
RTEDTOClassManager.registerRTEDTOClass(type, DTOClass);
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* Register a renderer for a node type with the extension.
|
|
1465
|
-
*
|
|
1466
|
-
* @param {string} type - The type of the node or block. The type should be a string that uniquely identifies the node or block.
|
|
1467
|
-
* @param {BaseRenderer} renderer - The renderer to register.
|
|
1468
|
-
*/
|
|
1469
|
-
registerRenderer(type, renderer) {
|
|
1470
|
-
RTEDTORendererManager.registerRTEDTORenderer(type, renderer);
|
|
1471
|
-
if (renderer instanceof VegaRTEExtensionRenderer && renderer.injectRTEScopeStyles()) {
|
|
1472
|
-
this.hasCustomStylesRenderers.add(renderer);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* Register a toolbar button renderer for the extension.
|
|
1477
|
-
*
|
|
1478
|
-
* @param {string} type - The type of the toolbar button.
|
|
1479
|
-
* @param {VegaRTEToolbarButtonRenderer} renderer - The renderer to register.
|
|
1480
|
-
*/
|
|
1481
|
-
registerToolbarButtonRenderer(type, renderer) {
|
|
1482
|
-
RTEDTORendererManager.registerRTEToolbarButtonRenderer(type, renderer);
|
|
1483
|
-
}
|
|
1484
|
-
/**
|
|
1485
|
-
* This is a helper method that utilizes RTEUtils to register common strategies.
|
|
1486
|
-
* Call the method with the class name of the block to make it support basic strategies like:
|
|
1487
|
-
* - Delete children
|
|
1488
|
-
* - Append the children
|
|
1489
|
-
* - Delete the block children content
|
|
1490
|
-
*
|
|
1491
|
-
* @param {string} blockClassName - The class name of the block to register strategies for.
|
|
1492
|
-
*/
|
|
1493
|
-
registerBlockBasicStrategies(blockClassName) {
|
|
1494
|
-
RTEDTOActionStrategyManager.registerBlockBasicStrategies(blockClassName);
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* Unregister a strategy for a specific action type and block class if not need.
|
|
1498
|
-
*
|
|
1499
|
-
* @param {string} actionType - The special action type or the action class name.
|
|
1500
|
-
* @param {string} blockClassName - The class name of the block to unregister the strategy for.
|
|
1501
|
-
*/
|
|
1502
|
-
unRegisterStrategy(actionType, blockClassName) {
|
|
1503
|
-
ActionHandleStrategyRegistry.unregister(actionType, blockClassName);
|
|
1504
|
-
}
|
|
1505
|
-
/**
|
|
1506
|
-
* Unregister a strategy for a specific action type and block class if not need.
|
|
1507
|
-
*
|
|
1508
|
-
* @param {string} actionType - The special action type or the action class name.
|
|
1509
|
-
* @param {string} blockClassName - The class name of the block to unregister the strategy for.
|
|
1510
|
-
* @param {ActionHandlerInterceptor<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The interceptor to unregister.
|
|
1511
|
-
*/
|
|
1512
|
-
unRegisterInterceptor(actionType, blockClassName, strategy) {
|
|
1513
|
-
ActionHandlerInterceptorRegistry.unregister(actionType, blockClassName, strategy);
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* Register an element to block DTO class strategy.
|
|
1517
|
-
*
|
|
1518
|
-
* @param {ElementToDTOStrategy} strategy - The strategy to register.
|
|
1519
|
-
*/
|
|
1520
|
-
registerElementToBlockDTOClassStrategy(strategy) {
|
|
1521
|
-
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(strategy);
|
|
1522
|
-
}
|
|
1523
|
-
/**
|
|
1524
|
-
* Register an element to node DTO class strategy.
|
|
1525
|
-
*
|
|
1526
|
-
* @param {ElementToDTOStrategy} strategy - The strategy to register.
|
|
1527
|
-
*/
|
|
1528
|
-
registerElementToNodeDTOClassStrategy(strategy) {
|
|
1529
|
-
ElementToDTOClassStrategyManager.registerElementToNodeStrategy(strategy);
|
|
1530
|
-
}
|
|
1531
|
-
/**
|
|
1532
|
-
* Get the registered element to node DTO class strategies.
|
|
1533
|
-
*
|
|
1534
|
-
* @returns {ElementToDTOStrategy[]} - The registered element to node DTO class strategies.
|
|
1535
|
-
*/
|
|
1536
|
-
getElementToNodeDTOClassStrategies() {
|
|
1537
|
-
return ElementToDTOClassStrategyManager.getElementToNodeStrategies();
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
/**
|
|
1542
|
-
* Base class for rendering extension toolbar button in the rich text editor.
|
|
1543
|
-
* The renderer provides common functionalities for rendering toolbar buttons, including:
|
|
1544
|
-
* - Rendering a button with an icon, label, and optional arrow icon.
|
|
1545
|
-
* - Rendering a dropdown with a list of items.
|
|
1546
|
-
* - Rendering dropdown items.
|
|
1547
|
-
* - Rendering template for dropdown list.
|
|
1548
|
-
* - Determining if the button should be disabled based on the editor context.
|
|
1549
|
-
* - Handling button and dropdown click events.
|
|
1550
|
-
* Override the methods to customize the rendering and behavior of the button.
|
|
1551
|
-
*/
|
|
1552
|
-
class VegaRTEToolbarButtonRenderer {
|
|
1553
|
-
/**
|
|
1554
|
-
* Checks if the button should be hidden.
|
|
1555
|
-
*
|
|
1556
|
-
* @param {VegaRTEToolbarRenderContext} editorContext The render context for the editor.
|
|
1557
|
-
* @returns {boolean} True if the button is hidden, false otherwise.
|
|
1558
|
-
*/
|
|
1559
|
-
isHidden(editorContext) {
|
|
1560
|
-
return editorContext.sourceEditMode;
|
|
1561
|
-
}
|
|
1562
|
-
/**
|
|
1563
|
-
* Renders a dropdown component with the specified properties and children.
|
|
1564
|
-
*
|
|
1565
|
-
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1566
|
-
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1567
|
-
* @param {RTEToolbarDropdownProps} dropdownProps - The properties for the dropdown.
|
|
1568
|
-
* @param {VegaRTERenderResult[]} children - The children elements for the dropdown.
|
|
1569
|
-
* @returns {VegaRTERenderResult} - The render result for the dropdown.
|
|
1570
|
-
*/
|
|
1571
|
-
renderDropdown(h, editorContext, dropdownProps, children) {
|
|
1572
|
-
return h('vega-dropdown', Object.assign({ trigger: 'click', searchable: false, maxWidth: '200', itemDisplayRule: 'ellipsis',
|
|
1573
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1574
|
-
ref: (el) => {
|
|
1575
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(el, VegaDropdownClick, (input) => this.handleDropdownClick(input.detail, editorContext));
|
|
1576
|
-
} }, dropdownProps), children);
|
|
1577
|
-
}
|
|
1578
|
-
/**
|
|
1579
|
-
* Renders the dropdown list template.
|
|
1580
|
-
*
|
|
1581
|
-
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1582
|
-
* @param {(RTEDropdownListItem | RTEDropdownListGroup)[]} itemList - The list of dropdown items.
|
|
1583
|
-
* @returns {VegaRTERenderResult} - The render result for the dropdown list.
|
|
1584
|
-
*/
|
|
1585
|
-
renderDropdownListTemplate(h, itemList) {
|
|
1586
|
-
return h('div', {
|
|
1587
|
-
slot: 'items',
|
|
1588
|
-
onMouseDown: this.preventDefault,
|
|
1589
|
-
}, itemList.map((item) => {
|
|
1590
|
-
return 'children' in item
|
|
1591
|
-
? this.renderDropdownGroup(h, item)
|
|
1592
|
-
: this.renderDropdownItem(h, item);
|
|
1593
|
-
}));
|
|
1594
|
-
}
|
|
1595
|
-
/**
|
|
1596
|
-
* Renders a dropdown item for the toolbar button.
|
|
1597
|
-
*
|
|
1598
|
-
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1599
|
-
* @param {RTEDropdownListItem} item - The dropdown item.
|
|
1600
|
-
* @returns {VegaRTERenderResult} - The render result for the dropdown item.
|
|
1601
|
-
*/
|
|
1602
|
-
renderDropdownItem(h, item) {
|
|
1603
|
-
return h('vega-dropdown-item', {
|
|
1604
|
-
key: item.key,
|
|
1605
|
-
itemKey: item.key,
|
|
1606
|
-
label: item.label,
|
|
1607
|
-
prefixIcon: item.icon,
|
|
1608
|
-
});
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* Renders a dropdown item for the toolbar button.
|
|
1612
|
-
*
|
|
1613
|
-
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1614
|
-
* @param {RTEDropdownListGroup} item - The dropdown group.
|
|
1615
|
-
* @returns {VegaRTERenderResult} - The render result for the dropdown item.
|
|
1616
|
-
*/
|
|
1617
|
-
renderDropdownGroup(h, item) {
|
|
1618
|
-
return h('vega-dropdown-group', {
|
|
1619
|
-
key: item.key,
|
|
1620
|
-
label: item.label,
|
|
1621
|
-
divide: false,
|
|
1622
|
-
}, item.children.map((child) => {
|
|
1623
|
-
return 'children' in child
|
|
1624
|
-
? this.renderDropdownGroup(h, child)
|
|
1625
|
-
: this.renderDropdownItem(h, child);
|
|
1626
|
-
}));
|
|
1627
|
-
}
|
|
1628
|
-
/**
|
|
1629
|
-
* Renders a common toolbar button with optional icon, label, and arrow icon.
|
|
1630
|
-
*
|
|
1631
|
-
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1632
|
-
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1633
|
-
* @param {RTEToolbarButtonProps} buttonProps - The properties for the button.
|
|
1634
|
-
* @returns {VegaRTERenderResult} - The render result for the button.
|
|
1635
|
-
*/
|
|
1636
|
-
renderButton(h, editorContext, buttonProps) {
|
|
1637
|
-
const { icon, label, showArrowIcon } = buttonProps;
|
|
1638
|
-
const isDisabled = this.isDisabled(editorContext);
|
|
1639
|
-
return h('vega-rich-text-editor-toolbar-button', {
|
|
1640
|
-
disabled: isDisabled,
|
|
1641
|
-
icon: icon,
|
|
1642
|
-
hidden: this.isHidden(editorContext),
|
|
1643
|
-
selected: this.isSelected(editorContext),
|
|
1644
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1645
|
-
ref: (el) => {
|
|
1646
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(el, VegaClick, () => this.handleButtonClick(editorContext));
|
|
1647
|
-
},
|
|
1648
|
-
onMouseDown: this.preventDefault,
|
|
1649
|
-
}, [
|
|
1650
|
-
this.renderButtonLabel(h, editorContext, label),
|
|
1651
|
-
showArrowIcon
|
|
1652
|
-
? h('vega-icon', {
|
|
1653
|
-
size: 'size-8',
|
|
1654
|
-
color: isDisabled ? 'text-disabled' : 'text-secondary',
|
|
1655
|
-
style: { marginLeft: '8px' },
|
|
1656
|
-
icon: VegaInternalIconManager.getIconKey('chevron-down'),
|
|
1657
|
-
})
|
|
1658
|
-
: null,
|
|
1659
|
-
].filter(isNonNullable));
|
|
1660
|
-
}
|
|
1661
|
-
/**
|
|
1662
|
-
* Renders the button label.
|
|
1663
|
-
*
|
|
1664
|
-
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1665
|
-
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1666
|
-
* @param {Nullable<string>} label - The button label if exist.
|
|
1667
|
-
* @returns {Nullable<VegaRTERenderResult>} - The render result for the button.
|
|
1668
|
-
*/
|
|
1669
|
-
renderButtonLabel(h, editorContext, label) {
|
|
1670
|
-
if (label) {
|
|
1671
|
-
const isDisabled = this.isDisabled(editorContext);
|
|
1672
|
-
return h('vega-font', {
|
|
1673
|
-
variant: 'font-field-label-sm',
|
|
1674
|
-
color: isDisabled ? 'text-disabled' : 'text-primary',
|
|
1675
|
-
}, label);
|
|
1676
|
-
}
|
|
1677
|
-
return null;
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* Determines if the button should be disabled based on the editor context.
|
|
1681
|
-
*
|
|
1682
|
-
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1683
|
-
* @returns {boolean} - True if the button should be disabled, false otherwise.
|
|
1684
|
-
*/
|
|
1685
|
-
isDisabled(editorContext) {
|
|
1686
|
-
return editorContext.host.disabled;
|
|
1687
|
-
}
|
|
1688
|
-
/**
|
|
1689
|
-
* Checks if the button should be selected.
|
|
1690
|
-
*
|
|
1691
|
-
* @param {VegaRTEToolbarRenderContext} _editorContext The render context for the editor.
|
|
1692
|
-
* @returns {boolean} True if the button is selected, false otherwise.
|
|
1693
|
-
*/
|
|
1694
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1695
|
-
isSelected(_editorContext) {
|
|
1696
|
-
return false;
|
|
1697
|
-
}
|
|
1698
|
-
/**
|
|
1699
|
-
* Prevents the default action of the click event. This is to avoid losing focus from the editor when the button is clicked.
|
|
1700
|
-
*
|
|
1701
|
-
* @param {MouseEvent} e The mouse event to prevent default action for.
|
|
1702
|
-
*/
|
|
1703
|
-
preventDefault(e) {
|
|
1704
|
-
e.preventDefault();
|
|
1705
|
-
}
|
|
1706
|
-
/**
|
|
1707
|
-
* Recursively searches for a dropdown list item by its key.
|
|
1708
|
-
*
|
|
1709
|
-
* @param {(RTEDropdownListItem | RTEDropdownListGroup)[]} itemList The list of dropdown items or groups to search through.
|
|
1710
|
-
* @param {string} key The key of the item to find.
|
|
1711
|
-
* @returns {Nullable<RTEDropdownListItem>} The dropdown list item if found, otherwise null.
|
|
1712
|
-
*/
|
|
1713
|
-
getListItemByKey(itemList, key) {
|
|
1714
|
-
for (const item of itemList) {
|
|
1715
|
-
if ('children' in item) {
|
|
1716
|
-
const foundItem = this.getListItemByKey(item.children, key);
|
|
1717
|
-
if (foundItem) {
|
|
1718
|
-
return foundItem;
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
else if (item.key === key) {
|
|
1722
|
-
return item;
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
return null;
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
/**
|
|
1730
|
-
* Action to insert a token node at a specified range in the Rich Text Editor.
|
|
1731
|
-
*
|
|
1732
|
-
* @example block.apply(new InsertTokenNodeAction(rteRange, tokenNode));
|
|
1733
|
-
*/
|
|
1734
|
-
class InsertTokenNodeAction extends ModifyContentAction {
|
|
1735
|
-
constructor(rteRange, token) {
|
|
1736
|
-
super();
|
|
1737
|
-
this.type = 'INSERT_TOKEN_NODE';
|
|
1738
|
-
this.rteRange = null;
|
|
1739
|
-
this.actionHandleResult = false;
|
|
1740
|
-
this.rteRange = rteRange;
|
|
1741
|
-
this.token = token;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
/**
|
|
1746
|
-
* Renderer for the token toolbar button in the Vega Rich Text Editor.
|
|
1747
|
-
*/
|
|
1748
|
-
class RTETokenToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
1749
|
-
constructor(tokenList) {
|
|
1750
|
-
super();
|
|
1751
|
-
this.tokenList = [];
|
|
1752
|
-
this.extensionContext = null;
|
|
1753
|
-
this.tokenList = tokenList;
|
|
1754
|
-
}
|
|
1755
|
-
/**
|
|
1756
|
-
* Sets the RTE extension context.
|
|
1757
|
-
*
|
|
1758
|
-
* @param {RTEExtensionContext} context - The context of the RTE extension.
|
|
1759
|
-
*/
|
|
1760
|
-
injectExtensionContext(context) {
|
|
1761
|
-
this.extensionContext = context;
|
|
1762
|
-
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Renders the token toolbar button.
|
|
1765
|
-
*
|
|
1766
|
-
* @param {VegaRTECreateElementFunction} createElement Function to create elements in the rich text editor.
|
|
1767
|
-
* @param {VegaRTEToolbarRenderContext} editorContext The render context for the editor.
|
|
1768
|
-
* @returns {VegaRTERenderResult} Token toolbar button.
|
|
1769
|
-
*/
|
|
1770
|
-
render(createElement, editorContext) {
|
|
1771
|
-
return this.renderDropdown(createElement, editorContext, {}, [
|
|
1772
|
-
this.renderButton(createElement, editorContext, { label: 'Tokens', showArrowIcon: true }),
|
|
1773
|
-
this.renderDropdownListTemplate(createElement, this.tokenList),
|
|
1774
|
-
]);
|
|
1775
|
-
}
|
|
1776
|
-
/**
|
|
1777
|
-
* Checks if the token toolbar button is disabled.
|
|
1778
|
-
*
|
|
1779
|
-
* @returns {boolean} True if the button is disabled, false otherwise.
|
|
1780
|
-
*/
|
|
1781
|
-
isDisabled() {
|
|
1782
|
-
if (this.extensionContext) {
|
|
1783
|
-
const { host, getSelectedNodes } = this.extensionContext;
|
|
1784
|
-
const [startNode] = getSelectedNodes();
|
|
1785
|
-
return startNode
|
|
1786
|
-
? host.disabled ||
|
|
1787
|
-
!ActionHandleStrategyRegistry.canHandle('INSERT_TOKEN_NODE', startNode.parent)
|
|
1788
|
-
: host.disabled;
|
|
1789
|
-
}
|
|
1790
|
-
return false;
|
|
1791
|
-
}
|
|
1792
|
-
/* istanbul ignore next */
|
|
1793
|
-
/**
|
|
1794
|
-
* Handles the button click event. No need this method for token button.
|
|
1795
|
-
*
|
|
1796
|
-
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1797
|
-
*/
|
|
1798
|
-
handleButtonClick(editorContext) {
|
|
1799
|
-
}
|
|
1800
|
-
/**
|
|
1801
|
-
* Handles the token item click event from the dropdown.
|
|
1802
|
-
*
|
|
1803
|
-
* @param {string} itemKey - The key of the clicked token item.
|
|
1804
|
-
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1805
|
-
*/
|
|
1806
|
-
handleDropdownClick(itemKey, editorContext) {
|
|
1807
|
-
const token = this.getListItemByKey(this.tokenList, itemKey);
|
|
1808
|
-
const { rteRange } = editorContext;
|
|
1809
|
-
const { startNode } = rteRange;
|
|
1810
|
-
if (startNode && startNode.parent) {
|
|
1811
|
-
const action = new InsertTokenNodeAction(rteRange, token);
|
|
1812
|
-
startNode.parent.apply(action);
|
|
1813
|
-
if (action.actionHandleResult) {
|
|
1814
|
-
this.flushEditorUI();
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
/**
|
|
1819
|
-
* Refreshes the editor UI.
|
|
1820
|
-
*/
|
|
1821
|
-
flushEditorUI() {
|
|
1822
|
-
if (this.extensionContext) {
|
|
1823
|
-
const { host, flushValue } = this.extensionContext;
|
|
1824
|
-
flushValue(host.value);
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
/**
|
|
1830
|
-
* Token node for the Vega Rich Text Editor.
|
|
1831
|
-
*/
|
|
1832
|
-
class RTETokenNode extends RTETextNode {
|
|
1833
|
-
constructor(id, token, text, parentBlock, annotations) {
|
|
1834
|
-
super(id, text, parentBlock, annotations);
|
|
1835
|
-
this.type = 'token';
|
|
1836
|
-
this.token = token;
|
|
1837
|
-
this.text = text;
|
|
1838
|
-
}
|
|
1839
|
-
/**
|
|
1840
|
-
* @inheritDoc
|
|
1841
|
-
*/
|
|
1842
|
-
static from(value, parent) {
|
|
1843
|
-
const node = new RTETokenNode(value.id, value.token, value.text, parent);
|
|
1844
|
-
if (value.annotations) {
|
|
1845
|
-
node.annotationMap = this.generateTextAnnotationMap(value.annotations);
|
|
1846
|
-
}
|
|
1847
|
-
return node;
|
|
1848
|
-
}
|
|
1849
|
-
/**
|
|
1850
|
-
* Converts the token node to a JSON representation.
|
|
1851
|
-
*
|
|
1852
|
-
* @returns {VegaRTETokenNode} - The JSON representation of the token node.
|
|
1853
|
-
*/
|
|
1854
|
-
toJSON() {
|
|
1855
|
-
const json = super.toJSON();
|
|
1856
|
-
return Object.assign({ id: this.id, type: this.type, text: this.text, token: this.token }, (json.annotations ? { annotations: json.annotations } : {}));
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
* Determines if the token node is content editable.
|
|
1860
|
-
*
|
|
1861
|
-
* @returns {boolean} - Always returns false for token nodes.
|
|
1862
|
-
*/
|
|
1863
|
-
isContentEditable() {
|
|
1864
|
-
return false;
|
|
1865
|
-
}
|
|
1866
|
-
/**
|
|
1867
|
-
* Clones the token node.
|
|
1868
|
-
*
|
|
1869
|
-
* @param {RTETextBlock} parent - The parent block for the cloned node.
|
|
1870
|
-
* @returns {RTETokenNode} - The cloned token node.
|
|
1871
|
-
*/
|
|
1872
|
-
clone(parent) {
|
|
1873
|
-
return new RTETokenNode(this.id, this.token, this.text, parent, this.annotationMap);
|
|
1874
|
-
}
|
|
1875
|
-
/**
|
|
1876
|
-
* Converts the token node to an HTML representation.
|
|
1877
|
-
*
|
|
1878
|
-
* @returns {string} - The HTML representation of the token node.
|
|
1879
|
-
*/
|
|
1880
|
-
toHtml() {
|
|
1881
|
-
return `<span class="token" contenteditable="false" template-token-key="${this.token}" token-key="${this.token}"${super.generateAttributeString()}>${this.text}</span>`;
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
/**
|
|
1886
|
-
* Token node renderer for the rich text editor.
|
|
1887
|
-
*/
|
|
1888
|
-
class RTETokenNodeRenderer extends VegaRTEExtensionRenderer {
|
|
1889
|
-
constructor() {
|
|
1890
|
-
super(...arguments);
|
|
1891
|
-
this.extensionContext = null;
|
|
1892
|
-
}
|
|
1893
|
-
/**
|
|
1894
|
-
* Renders the token node as a DOM element.
|
|
1895
|
-
*
|
|
1896
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1897
|
-
* @param {RTETokenNode} node - The token node to render.
|
|
1898
|
-
* @param {RTERenderContext} editorContent - The editor content context.
|
|
1899
|
-
* @returns {VegaRTERenderResult} - The rendered DOM element.
|
|
1900
|
-
*/
|
|
1901
|
-
doRender(createElement, node, editorContent) {
|
|
1902
|
-
const { id, token } = node;
|
|
1903
|
-
return createElement('span', Object.assign(Object.assign({ 'key': id, 'template-token-key': token, 'token-key': token, 'contenteditable': 'false', 'style': node.getStyles(), 'class': `token ${node.getClasses()}` }, this.additionalAttributes(node)), { 'ref': this.useRef(node),
|
|
1904
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1905
|
-
'onClick': (event) => {
|
|
1906
|
-
event.preventDefault();
|
|
1907
|
-
if (editorContent && editorContent.editable !== false) {
|
|
1908
|
-
this.handleTokenElementClick(event, node);
|
|
1909
|
-
}
|
|
1910
|
-
} }), node.text);
|
|
1911
|
-
}
|
|
1912
|
-
/**
|
|
1913
|
-
* Sets the RTE extension context.
|
|
1914
|
-
*
|
|
1915
|
-
* @param {RTEExtensionContext} context - The context of the RTE extension.
|
|
1916
|
-
*/
|
|
1917
|
-
injectExtensionContext(context) {
|
|
1918
|
-
this.extensionContext = context;
|
|
1919
|
-
}
|
|
1920
|
-
/**
|
|
1921
|
-
* Override to inject RTE scope styles for the token node.
|
|
1922
|
-
*
|
|
1923
|
-
* @returns {string} The CSS styles for the token node.
|
|
1924
|
-
*/
|
|
1925
|
-
injectRTEScopeStyles() {
|
|
1926
|
-
return `span[token-key]{padding: 0 2px; margin: 0 1px; background-color: rgba(var(--v-bg-status-info, 205,209,211))}`;
|
|
1927
|
-
}
|
|
1928
|
-
/**
|
|
1929
|
-
* Handle the click event on the token element.
|
|
1930
|
-
*
|
|
1931
|
-
* @param {MouseEvent} event - The click event.
|
|
1932
|
-
* @param {RTETokenNode} node - The token node that was clicked.
|
|
1933
|
-
*/
|
|
1934
|
-
handleTokenElementClick(event, node) {
|
|
1935
|
-
event.preventDefault();
|
|
1936
|
-
if (this.extensionContext) {
|
|
1937
|
-
this.extensionContext.host.value.apply(new UpdateCursorPositionAction(node, undefined, true));
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
/**
|
|
1941
|
-
* Additional attributes for the token node.
|
|
1942
|
-
*
|
|
1943
|
-
* @param {RTETokenNode} node - The token node.
|
|
1944
|
-
* @returns {Record<string, string>} Additional attributes
|
|
1945
|
-
*/
|
|
1946
|
-
additionalAttributes(node) {
|
|
1947
|
-
const annotation = node.getCustomAttributesAnnotation();
|
|
1948
|
-
let result = { wrapped: 'true' };
|
|
1949
|
-
if (annotation) {
|
|
1950
|
-
result = Object.assign(Object.assign({}, result), annotation.render());
|
|
1951
|
-
}
|
|
1952
|
-
return result;
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
* Insert a new children to the nearest position of the parent container
|
|
1958
|
-
*
|
|
1959
|
-
* @example parent.apply(new InsertNodeToNearestRoot(rteRange, nodeToBeInserted))
|
|
1960
|
-
*/
|
|
1961
|
-
class InsertNodeToNearestRootAction extends ModifyContentAction {
|
|
1962
|
-
constructor(rteRange, nodeToBeInserted) {
|
|
1963
|
-
super();
|
|
1964
|
-
this.type = ModifyContentActionType.INSERT_NODE_TO_NEAREST_ROOT;
|
|
1965
|
-
this.rteRange = rteRange;
|
|
1966
|
-
this.nodeToBeInserted = nodeToBeInserted;
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
/**
|
|
1971
|
-
* Strategy to handle the insertion of a token node into the nearest root block.
|
|
1972
|
-
*/
|
|
1973
|
-
class InsertTokenNodeStrategy extends ActionHandleStrategy {
|
|
1974
|
-
/**
|
|
1975
|
-
* @inheritDoc
|
|
1976
|
-
*/
|
|
1977
|
-
handleAction(action, block) {
|
|
1978
|
-
const { rteRange, token } = action;
|
|
1979
|
-
if (rteRange && rteRange.startNode) {
|
|
1980
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1981
|
-
const { key, label, customAttrs = { wrapped: 'true' } } = token;
|
|
1982
|
-
const tokenNode = new RTETokenNode(generateUUID(), key, label, block);
|
|
1983
|
-
tokenNode.annotationMap.set('CUSTOM_ATTRIBUTE', new CustomAttributeAnnotation(customAttrs));
|
|
1984
|
-
block.apply(new InsertNodeToNearestRootAction(rteRange, tokenNode));
|
|
1985
|
-
action.actionHandleResult = true;
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
1991
|
-
var t = {};
|
|
1992
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1993
|
-
t[p] = s[p];
|
|
1994
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1995
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1996
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1997
|
-
t[p[i]] = s[p[i]];
|
|
1998
|
-
}
|
|
1999
|
-
return t;
|
|
2000
|
-
};
|
|
2001
|
-
/**
|
|
2002
|
-
* Strategy to convert <span class="token" token-key="...">...</span> to a token node
|
|
2003
|
-
*/
|
|
2004
|
-
class SpanToTokenNodeStrategy extends ElementToDTOStrategy {
|
|
2005
|
-
/**
|
|
2006
|
-
* @inheritDoc
|
|
2007
|
-
*/
|
|
2008
|
-
canHandle(elementsArray, currentIndex) {
|
|
2009
|
-
const element = elementsArray[currentIndex];
|
|
2010
|
-
if (element.nodeName === 'SPAN' &&
|
|
2011
|
-
element.classList.contains('token') &&
|
|
2012
|
-
element.hasAttribute('token-key')) {
|
|
2013
|
-
return 1;
|
|
2014
|
-
}
|
|
2015
|
-
return 0;
|
|
2016
|
-
}
|
|
2017
|
-
/**
|
|
2018
|
-
* @inheritDoc
|
|
2019
|
-
*/
|
|
2020
|
-
handle(elementsArray) {
|
|
2021
|
-
const element = elementsArray[0];
|
|
2022
|
-
const tokenKey = element.getAttribute('token-key');
|
|
2023
|
-
const text = element.textContent;
|
|
2024
|
-
const annotations = htmlElementToAnnotationGenerator.generate(RTETextNode, element);
|
|
2025
|
-
// Exclude customAttribute and customClass from annotations
|
|
2026
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2027
|
-
const { customAttribute, customClass } = annotations, restAnnotations = __rest(annotations, ["customAttribute", "customClass"]);
|
|
2028
|
-
return {
|
|
2029
|
-
id: generateUUID(),
|
|
2030
|
-
type: 'token',
|
|
2031
|
-
token: tokenKey,
|
|
2032
|
-
text,
|
|
2033
|
-
annotations: Object.assign(Object.assign({}, restAnnotations), { customAttribute: this.createCustomAttrs(customAttribute) }),
|
|
2034
|
-
};
|
|
2035
|
-
}
|
|
2036
|
-
/**
|
|
2037
|
-
* @inheritDoc
|
|
2038
|
-
*/
|
|
2039
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2040
|
-
appendChildBlocks() { }
|
|
2041
|
-
/**
|
|
2042
|
-
* @inheritDoc
|
|
2043
|
-
*/
|
|
2044
|
-
shouldProceedToElementChildren() {
|
|
2045
|
-
return false;
|
|
2046
|
-
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Creates custom attributes record from the given custom attribute object, clean some fixed attributes.
|
|
2049
|
-
*
|
|
2050
|
-
* @param {Record<string, string>} customAttribute - The custom attribute object
|
|
2051
|
-
* @returns {Record<string, string>} The processed custom attributes
|
|
2052
|
-
*/
|
|
2053
|
-
createCustomAttrs(customAttribute) {
|
|
2054
|
-
const result = Object.assign(Object.assign({}, customAttribute), { 'contenteditable': null, 'template-token-key': null, 'token-key': null, 'wrapped': customAttribute.wrapped === 'false' ? 'false' : 'true' });
|
|
2055
|
-
return cleanObject(result);
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
const spanToTokenNodeStrategy = new SpanToTokenNodeStrategy();
|
|
2060
|
-
/**
|
|
2061
|
-
* Vega Rich Text Editor Token Extension
|
|
2062
|
-
*/
|
|
2063
|
-
class VegaRTETokenExtension extends VegaRTEExtension {
|
|
2064
|
-
constructor(tokenList = []) {
|
|
2065
|
-
super();
|
|
2066
|
-
this.tokenRenderer = new RTETokenNodeRenderer();
|
|
2067
|
-
this.registerNode('token', RTETokenNode);
|
|
2068
|
-
this.registerRenderer('token', this.tokenRenderer);
|
|
2069
|
-
this.tokenToolbarButtonRenderer = new RTETokenToolbarButtonRenderer(tokenList);
|
|
2070
|
-
this.registerToolbarButtonRenderer('token', this.tokenToolbarButtonRenderer);
|
|
2071
|
-
this.registerElementToNodeDTOClassStrategy(spanToTokenNodeStrategy);
|
|
2072
|
-
}
|
|
2073
|
-
/**
|
|
2074
|
-
* @inheritDoc
|
|
2075
|
-
*/
|
|
2076
|
-
initialExtension(context) {
|
|
2077
|
-
super.initialExtension(context);
|
|
2078
|
-
this.tokenRenderer.injectExtensionContext(context);
|
|
2079
|
-
if (this.tokenToolbarButtonRenderer) {
|
|
2080
|
-
this.tokenToolbarButtonRenderer.injectExtensionContext(context);
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
|
-
(() => {
|
|
2085
|
-
const insertTokenNodeStrategy = new InsertTokenNodeStrategy();
|
|
2086
|
-
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
2087
|
-
VegaRTEExtension.registerActionHandleStrategy(RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
2088
|
-
})();
|
|
2089
|
-
|
|
2090
|
-
const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
2091
|
-
/**
|
|
2092
|
-
* Action to insert a function block into the rich text editor.
|
|
2093
|
-
*
|
|
2094
|
-
* @example focusedBlock.apply(new InsertFunctionBlockAction('IF'))
|
|
2095
|
-
* @example host.value.apply(new InsertFunctionBlockAction('IF'))
|
|
2096
|
-
*/
|
|
2097
|
-
class InsertFunctionBlockAction extends ModifyContentAction {
|
|
2098
|
-
constructor(functionType) {
|
|
2099
|
-
super();
|
|
2100
|
-
this.type = INSERT_FUNCTION_BLOCK;
|
|
2101
|
-
this.functionType = functionType;
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
/**
|
|
2106
|
-
* RTE Function Block
|
|
2107
|
-
*/
|
|
2108
|
-
class RTEFunctionBlock extends RTEBlock {
|
|
2109
|
-
constructor(id) {
|
|
2110
|
-
super(id);
|
|
2111
|
-
this.type = 'function-block';
|
|
2112
|
-
this.children = [];
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
* Creates an RTEFunctionBlock from a VegaFunctionBlock.
|
|
2116
|
-
*
|
|
2117
|
-
* @param {VegaFunctionBlock} block - The custom block to convert.
|
|
2118
|
-
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
2119
|
-
* @returns {RTEFunctionBlock} The resulting RTEFunctionBlock.
|
|
2120
|
-
*/
|
|
2121
|
-
static from(block, options) {
|
|
2122
|
-
const functionBlock = new RTEFunctionBlock(block.id);
|
|
2123
|
-
const defaultAnnotation = { customClass: ['statement'] };
|
|
2124
|
-
let { annotations } = block;
|
|
2125
|
-
annotations = annotations
|
|
2126
|
-
? Object.assign(Object.assign({}, annotations), defaultAnnotation) : defaultAnnotation;
|
|
2127
|
-
super.convertAnnotationsToMap(functionBlock.annotationMap, annotations);
|
|
2128
|
-
functionBlock.children = this.generateBlockChildren(block.children, options, functionBlock);
|
|
2129
|
-
return functionBlock;
|
|
2130
|
-
}
|
|
2131
|
-
/**
|
|
2132
|
-
* Converts the RTEFunctionBlock and its children to an HTML string.
|
|
2133
|
-
*
|
|
2134
|
-
* @returns {string} The HTML string representation of the function block.
|
|
2135
|
-
*/
|
|
2136
|
-
toHtml() {
|
|
2137
|
-
const childrenHtml = this.children
|
|
2138
|
-
.map((child) => {
|
|
2139
|
-
if (child instanceof RTETextBlock) {
|
|
2140
|
-
const attrStr = this.getFunctionContentStyle(child);
|
|
2141
|
-
return `<div class="statementelement"${attrStr}>${child.getChildrenHtml()}</div>`;
|
|
2142
|
-
}
|
|
2143
|
-
else {
|
|
2144
|
-
return child.toHtml();
|
|
2145
|
-
}
|
|
2146
|
-
})
|
|
2147
|
-
.join('');
|
|
2148
|
-
return `<div class="statement">${childrenHtml}</div>`;
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* @inheritDoc
|
|
2152
|
-
*/
|
|
2153
|
-
clone(parent) {
|
|
2154
|
-
const clonedBlock = new RTEFunctionBlock(generateUUID());
|
|
2155
|
-
clonedBlock.parent = parent;
|
|
2156
|
-
clonedBlock.children = this.children.map((child) => {
|
|
2157
|
-
const clonedChild = child.clone(clonedBlock);
|
|
2158
|
-
return clonedChild;
|
|
2159
|
-
});
|
|
2160
|
-
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
2161
|
-
return clonedBlock;
|
|
2162
|
-
}
|
|
2163
|
-
/**
|
|
2164
|
-
* @inheritDoc
|
|
2165
|
-
*/
|
|
2166
|
-
getLastNode() {
|
|
2167
|
-
return this.children[this.children.length - 1].getLastNode();
|
|
2168
|
-
}
|
|
2169
|
-
/**
|
|
2170
|
-
* @inheritDoc
|
|
2171
|
-
*/
|
|
2172
|
-
isNotEmpty() {
|
|
2173
|
-
return this.children.length > 0;
|
|
2174
|
-
}
|
|
2175
|
-
/**
|
|
2176
|
-
* @inheritDoc
|
|
2177
|
-
*/
|
|
2178
|
-
toJSON() {
|
|
2179
|
-
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, children: this.children.map((child) => child.toJSON()) });
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Get the style string for function content block, excluding default paragraph styles.
|
|
2183
|
-
*
|
|
2184
|
-
* @param {RTETextBlock} block - The text block to extract styles from
|
|
2185
|
-
* @returns {string} - The style attribute string
|
|
2186
|
-
*/
|
|
2187
|
-
getFunctionContentStyle(block) {
|
|
2188
|
-
const blockAnnotationStyle = new RTEAnnotationStyle(block);
|
|
2189
|
-
let styles = blockAnnotationStyle.toCssText({ standalone: true });
|
|
2190
|
-
const textStyleAnnotation = block.getAnnotationByType('TEXT_STYLE');
|
|
2191
|
-
if (textStyleAnnotation && textStyleAnnotation.textStyle === 'paragraph') {
|
|
2192
|
-
const defaultParagraphStyles = blockAnnotationStyle.toCssText(undefined, undefined, textStyleAnnotation.renderStyle({ standalone: true }));
|
|
2193
|
-
styles = styles.replace(defaultParagraphStyles, '').trim();
|
|
2194
|
-
}
|
|
2195
|
-
return styles ? ` style="${styles}"` : '';
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
/**
|
|
2200
|
-
* Strategy to handle the insertion of a function block into the rich text editor.
|
|
2201
|
-
*/
|
|
2202
|
-
class InsertFunctionBlockStrategy extends ActionHandleStrategy {
|
|
2203
|
-
/**
|
|
2204
|
-
* @inheritDoc
|
|
2205
|
-
*/
|
|
2206
|
-
handleAction(action, target) {
|
|
2207
|
-
const { functionType } = action;
|
|
2208
|
-
const functionBlock = this.getFunctionBlock(functionType);
|
|
2209
|
-
const emptyParagraph = this.createNewParagraph('');
|
|
2210
|
-
const referenceBlock = this.getReferenceBlock(target);
|
|
2211
|
-
if (referenceBlock) {
|
|
2212
|
-
referenceBlock.parent.apply(new InsertChildrenAfterAction(referenceBlock, functionBlock, emptyParagraph));
|
|
2213
|
-
}
|
|
2214
|
-
else {
|
|
2215
|
-
target.apply(new AppendChildrenAction([functionBlock, emptyParagraph]));
|
|
2216
|
-
}
|
|
2217
|
-
if (emptyParagraph) {
|
|
2218
|
-
action.nextFocusNode = emptyParagraph.children[0];
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
/**
|
|
2222
|
-
* Get a function block based on the specified type.
|
|
2223
|
-
*
|
|
2224
|
-
* @param {string} type - The type of function block to create.
|
|
2225
|
-
* @returns {RTEFunctionBlock} The function block instance.
|
|
2226
|
-
*/
|
|
2227
|
-
getFunctionBlock(type) {
|
|
2228
|
-
const id = generateUUID();
|
|
2229
|
-
return RTEFunctionBlock.from({
|
|
2230
|
-
id: id,
|
|
2231
|
-
type: 'function-block',
|
|
2232
|
-
children: [
|
|
2233
|
-
{
|
|
2234
|
-
id: `${id}-1`,
|
|
2235
|
-
type: 'logic-control-block',
|
|
2236
|
-
statementText: type.toUpperCase(),
|
|
2237
|
-
},
|
|
2238
|
-
{
|
|
2239
|
-
id: `${id}-2`,
|
|
2240
|
-
annotations: {
|
|
2241
|
-
customClass: ['statementelement'],
|
|
2242
|
-
},
|
|
2243
|
-
type: 'paragraph',
|
|
2244
|
-
nodes: [
|
|
2245
|
-
{
|
|
2246
|
-
id: `${id}-2-1`,
|
|
2247
|
-
type: 'text',
|
|
2248
|
-
text: ' ',
|
|
2249
|
-
},
|
|
2250
|
-
],
|
|
2251
|
-
},
|
|
2252
|
-
{
|
|
2253
|
-
id: `${id}-3`,
|
|
2254
|
-
type: 'logic-control-block',
|
|
2255
|
-
statementText: 'SHOW',
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
id: `${id}-4`,
|
|
2259
|
-
annotations: {
|
|
2260
|
-
customClass: ['statementelement'],
|
|
2261
|
-
},
|
|
2262
|
-
type: 'paragraph',
|
|
2263
|
-
nodes: [
|
|
2264
|
-
{
|
|
2265
|
-
id: `${id}-4-1`,
|
|
2266
|
-
type: 'text',
|
|
2267
|
-
text: ' ',
|
|
2268
|
-
},
|
|
2269
|
-
],
|
|
2270
|
-
},
|
|
2271
|
-
],
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
/**
|
|
2275
|
-
* We need to get the correct block if the current target is a function block element to avoid nesting function blocks.
|
|
2276
|
-
*
|
|
2277
|
-
* @param {RTEBlock | VegaRTEContent} currentTarget - The current target block or content.
|
|
2278
|
-
* @returns {Nullable<RTEBlock>} The reference block.
|
|
2279
|
-
*/
|
|
2280
|
-
getReferenceBlock(currentTarget) {
|
|
2281
|
-
if (!(currentTarget instanceof VegaRTEContent)) {
|
|
2282
|
-
const parentBlock = currentTarget.parent;
|
|
2283
|
-
if (parentBlock instanceof RTEFunctionBlock) {
|
|
2284
|
-
return parentBlock;
|
|
2285
|
-
}
|
|
2286
|
-
else {
|
|
2287
|
-
return currentTarget;
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
|
|
2293
|
-
/**
|
|
2294
|
-
* Class representing a logic control node in the rich text editor.
|
|
2295
|
-
*/
|
|
2296
|
-
class RTELogicControlNode extends RTENode {
|
|
2297
|
-
constructor(id, text, parent) {
|
|
2298
|
-
super(id);
|
|
2299
|
-
this.type = 'logic-control-node';
|
|
2300
|
-
this.text = '';
|
|
2301
|
-
this.text = text;
|
|
2302
|
-
this.parent = parent;
|
|
2303
|
-
}
|
|
2304
|
-
/**
|
|
2305
|
-
* Clone the current node instance.
|
|
2306
|
-
*
|
|
2307
|
-
* @returns {RTELogicControlNode} - A new instance of RTELogicControlNode.
|
|
2308
|
-
*/
|
|
2309
|
-
clone() {
|
|
2310
|
-
return new RTELogicControlNode(this.id, this.text, this.parent);
|
|
2311
|
-
}
|
|
2312
|
-
/**
|
|
2313
|
-
* Convert the node to its HTML representation.
|
|
2314
|
-
*
|
|
2315
|
-
* @returns {string} - The HTML string of the logic control node.
|
|
2316
|
-
*/
|
|
2317
|
-
toHtml() {
|
|
2318
|
-
return this.text;
|
|
2319
|
-
}
|
|
2320
|
-
/**
|
|
2321
|
-
* Convert the node to a JSON representation.
|
|
2322
|
-
*
|
|
2323
|
-
* @returns {unknown} - The JSON object of the statement syntax node.
|
|
2324
|
-
*/
|
|
2325
|
-
toJSON() {
|
|
2326
|
-
return {
|
|
2327
|
-
id: this.id,
|
|
2328
|
-
type: this.type,
|
|
2329
|
-
text: this.text,
|
|
2330
|
-
};
|
|
2331
|
-
}
|
|
2332
|
-
/**
|
|
2333
|
-
* Get the end offset of the node's range.
|
|
2334
|
-
*
|
|
2335
|
-
* @returns {number} - The end offset of the node's range.
|
|
2336
|
-
*/
|
|
2337
|
-
getRangeEndOffset() {
|
|
2338
|
-
return 1;
|
|
2339
|
-
}
|
|
2340
|
-
/**
|
|
2341
|
-
* Get the container element for the node's range.
|
|
2342
|
-
*
|
|
2343
|
-
* @returns {Nullable<Node>} - The container node for the range.
|
|
2344
|
-
*/
|
|
2345
|
-
getRangeContainer() {
|
|
2346
|
-
const element = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
2347
|
-
if (element) {
|
|
2348
|
-
return element.parentElement;
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
/**
|
|
2352
|
-
* Get the content editable state of the node.
|
|
2353
|
-
*
|
|
2354
|
-
* @returns {boolean} - The content editable state of the node.
|
|
2355
|
-
*/
|
|
2356
|
-
isContentEditable() {
|
|
2357
|
-
return false;
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
/**
|
|
2362
|
-
* Class representing a logic control block in the rich text editor.
|
|
2363
|
-
*/
|
|
2364
|
-
class RTELogicControlBlock extends RTEBlock {
|
|
2365
|
-
constructor(id, statementText, parent) {
|
|
2366
|
-
super(id);
|
|
2367
|
-
this.type = 'logic-control-block';
|
|
2368
|
-
this.children = [];
|
|
2369
|
-
this.statementText = '';
|
|
2370
|
-
this.statementText = statementText;
|
|
2371
|
-
this.children = [new RTELogicControlNode(`${id}-node-1`, statementText, this)];
|
|
2372
|
-
if (parent) {
|
|
2373
|
-
this.parent = parent;
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
/**
|
|
2377
|
-
* Create a logic control block from a JSON representation.
|
|
2378
|
-
*
|
|
2379
|
-
* @param {VegaRTELogicControlBlock} json - The JSON object representing the logic control block.
|
|
2380
|
-
* @returns {RTELogicControlBlock} - The created logic control block.
|
|
2381
|
-
*/
|
|
2382
|
-
static from(json) {
|
|
2383
|
-
const block = new RTELogicControlBlock(json.id, json.statementText);
|
|
2384
|
-
return block;
|
|
2385
|
-
}
|
|
2386
|
-
/**
|
|
2387
|
-
* Check the block is not empty.
|
|
2388
|
-
*
|
|
2389
|
-
* @returns {boolean} - Always true for logic control block.
|
|
2390
|
-
*/
|
|
2391
|
-
isNotEmpty() {
|
|
2392
|
-
return true;
|
|
2393
|
-
}
|
|
2394
|
-
/**
|
|
2395
|
-
* Get the last node of the block.
|
|
2396
|
-
*
|
|
2397
|
-
* @returns {RTELogicControlNode} - The last node in the block.
|
|
2398
|
-
*/
|
|
2399
|
-
getLastNode() {
|
|
2400
|
-
return this.children[this.children.length - 1];
|
|
2401
|
-
}
|
|
2402
|
-
/**
|
|
2403
|
-
* Convert the block to its HTML representation.
|
|
2404
|
-
*
|
|
2405
|
-
* @returns {string} - The HTML string of the logic control block.
|
|
2406
|
-
*/
|
|
2407
|
-
toHtml() {
|
|
2408
|
-
return `<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`;
|
|
2409
|
-
}
|
|
2410
|
-
/**
|
|
2411
|
-
* Clone the current block instance.
|
|
2412
|
-
*
|
|
2413
|
-
* @param { RTEFunctionBlock } parent - The parent function block for the cloned instance.
|
|
2414
|
-
* @returns {RTELogicControlBlock} - A new instance of RTEStatementSyntaxBlock.
|
|
2415
|
-
*/
|
|
2416
|
-
clone(parent) {
|
|
2417
|
-
return new RTELogicControlBlock(this.id, this.statementText, parent);
|
|
2418
|
-
}
|
|
2419
|
-
/**
|
|
2420
|
-
* Get the JSON representation of the block.
|
|
2421
|
-
*
|
|
2422
|
-
* @returns {VegaRTELogicControlBlock} - The JSON object of the logic control block.
|
|
2423
|
-
*/
|
|
2424
|
-
toJSON() {
|
|
2425
|
-
return {
|
|
2426
|
-
id: this.id,
|
|
2427
|
-
type: this.type,
|
|
2428
|
-
statementText: this.statementText,
|
|
2429
|
-
};
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
/**
|
|
2434
|
-
* Function toolbar button renderer class.
|
|
2435
|
-
*/
|
|
2436
|
-
class FunctionToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
2437
|
-
/**
|
|
2438
|
-
* Injects the extension context
|
|
2439
|
-
*
|
|
2440
|
-
* @param {RTEExtensionContext} context - extension context
|
|
2441
|
-
*/
|
|
2442
|
-
injectExtensionContext(context) {
|
|
2443
|
-
this.extensionContext = context;
|
|
2444
|
-
}
|
|
2445
|
-
/**
|
|
2446
|
-
* @inheritDoc
|
|
2447
|
-
*/
|
|
2448
|
-
render(h, editorContext) {
|
|
2449
|
-
return this.renderDropdown(h, editorContext, {}, [
|
|
2450
|
-
this.renderButton(h, editorContext, {
|
|
2451
|
-
label: 'Functions',
|
|
2452
|
-
showArrowIcon: true,
|
|
2453
|
-
}),
|
|
2454
|
-
this.renderDropdownListTemplate(h, FunctionToolbarButtonRenderer.FUNCTION_LIST),
|
|
2455
|
-
]);
|
|
2456
|
-
}
|
|
2457
|
-
/**
|
|
2458
|
-
* Overrides the isDisabled method to determine if the button should be disabled.
|
|
2459
|
-
*
|
|
2460
|
-
* @returns {boolean} - true if the button should be disabled, false otherwise.
|
|
2461
|
-
*/
|
|
2462
|
-
isDisabled() {
|
|
2463
|
-
if (this.extensionContext) {
|
|
2464
|
-
const { host, getSelectedNodes } = this.extensionContext;
|
|
2465
|
-
const focusNode = getSelectedNodes()[0];
|
|
2466
|
-
let enableInsert = true;
|
|
2467
|
-
if (focusNode) {
|
|
2468
|
-
enableInsert = ActionHandleStrategyRegistry.canHandle(INSERT_FUNCTION_BLOCK, focusNode.parent);
|
|
2469
|
-
}
|
|
2470
|
-
return host.disabled || !enableInsert;
|
|
2471
|
-
}
|
|
2472
|
-
return false;
|
|
2473
|
-
}
|
|
2474
|
-
/* istanbul ignore next */
|
|
2475
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
2476
|
-
handleButtonClick() {
|
|
2477
|
-
throw new Error('Method not implemented.');
|
|
2478
|
-
}
|
|
2479
|
-
/**
|
|
2480
|
-
* Handles dropdown click event
|
|
2481
|
-
*
|
|
2482
|
-
* @param {RTEExtensionFunctionType} itemKey - key of the clicked item
|
|
2483
|
-
*/
|
|
2484
|
-
handleDropdownClick(itemKey) {
|
|
2485
|
-
const { host, getSelectedNodes } = this.extensionContext;
|
|
2486
|
-
const focusNode = getSelectedNodes()[0];
|
|
2487
|
-
const action = new InsertFunctionBlockAction(itemKey);
|
|
2488
|
-
if (!focusNode) {
|
|
2489
|
-
host.value.apply(action);
|
|
2490
|
-
}
|
|
2491
|
-
else if (focusNode.parent) {
|
|
2492
|
-
focusNode.parent.apply(action);
|
|
2493
|
-
}
|
|
2494
|
-
if (action.nextFocusNode) {
|
|
2495
|
-
host.value.apply(new UpdateCursorPositionAction(action.nextFocusNode, 1));
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
}
|
|
2499
|
-
FunctionToolbarButtonRenderer.FUNCTION_LIST = [
|
|
2500
|
-
{ key: 'IF', label: 'Conditional' },
|
|
2501
|
-
{ key: 'FOREACH', label: 'Foreach' },
|
|
2502
|
-
];
|
|
2503
|
-
|
|
2504
|
-
/**
|
|
2505
|
-
* Renders a logic control block in the rich text editor.
|
|
2506
|
-
*/
|
|
2507
|
-
class RTELogicControlBlockRenderer extends VegaRTEExtensionRenderer {
|
|
2508
|
-
/**
|
|
2509
|
-
* @inheritDoc
|
|
2510
|
-
*/
|
|
2511
|
-
doRender(h, renderData) {
|
|
2512
|
-
return h('div', {
|
|
2513
|
-
key: renderData.id,
|
|
2514
|
-
class: 'statementsyntax',
|
|
2515
|
-
ref: this.useRef(renderData),
|
|
2516
|
-
}, h('span', {
|
|
2517
|
-
key: `${renderData.id}-1`,
|
|
2518
|
-
contenteditable: 'false',
|
|
2519
|
-
ref: this.useRef(renderData.children[0]),
|
|
2520
|
-
}, renderData.statementText));
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
/**
|
|
2525
|
-
* Strategy to convert a div with class 'statementsyntax' into an RTELogicControlBlock DTO.
|
|
2526
|
-
*/
|
|
2527
|
-
class DivToLogicControlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
2528
|
-
constructor() {
|
|
2529
|
-
super(...arguments);
|
|
2530
|
-
this.blockClassName = 'statementsyntax';
|
|
2531
|
-
}
|
|
2532
|
-
/**
|
|
2533
|
-
* @inheritDoc
|
|
2534
|
-
*/
|
|
2535
|
-
canHandle(elementsArray, currentIndex) {
|
|
2536
|
-
const element = elementsArray[currentIndex];
|
|
2537
|
-
return element &&
|
|
2538
|
-
element.nodeType === Node.ELEMENT_NODE &&
|
|
2539
|
-
element.classList.contains(this.blockClassName) &&
|
|
2540
|
-
this.isFunctionBlockChild(element)
|
|
2541
|
-
? 1
|
|
2542
|
-
: 0;
|
|
2543
|
-
}
|
|
2544
|
-
/**
|
|
2545
|
-
* @inheritDoc
|
|
2546
|
-
*/
|
|
2547
|
-
handle(elementsArray) {
|
|
2548
|
-
const element = elementsArray[0];
|
|
2549
|
-
return RTELogicControlBlock.from({
|
|
2550
|
-
id: generateUUID(),
|
|
2551
|
-
type: 'logic-control-block',
|
|
2552
|
-
statementText: element.innerText,
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
/**
|
|
2556
|
-
* The logic control block does not have child blocks to append. so this method is intentionally left empty.
|
|
2557
|
-
*/
|
|
2558
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2559
|
-
appendChildBlocks() { }
|
|
2560
|
-
/**
|
|
2561
|
-
* @inheritDoc
|
|
2562
|
-
*/
|
|
2563
|
-
shouldProceedToElementChildren() {
|
|
2564
|
-
return false;
|
|
2565
|
-
}
|
|
2566
|
-
/**
|
|
2567
|
-
* Checks if the given element is a child of a function block
|
|
2568
|
-
*
|
|
2569
|
-
* @param {HTMLElement} element - The HTML element to check
|
|
2570
|
-
* @returns {boolean} True if the element is a child of a function block, false otherwise
|
|
2571
|
-
*/
|
|
2572
|
-
isFunctionBlockChild(element) {
|
|
2573
|
-
return !!(element.parentElement && element.parentElement.classList.contains('statement'));
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* Strategy to convert a div with class 'statement' into an function block.
|
|
2579
|
-
*/
|
|
2580
|
-
class DivToFunctionBlockStrategy extends ElementToDTOStrategy {
|
|
2581
|
-
/**
|
|
2582
|
-
* @inheritDoc
|
|
2583
|
-
*/
|
|
2584
|
-
canHandle(elementsArray, currentIndex) {
|
|
2585
|
-
const element = elementsArray[currentIndex];
|
|
2586
|
-
return element &&
|
|
2587
|
-
element.tagName === 'DIV' &&
|
|
2588
|
-
element.classList.contains('statement') &&
|
|
2589
|
-
element.childNodes.length &&
|
|
2590
|
-
element.querySelector('.statementsyntax')
|
|
2591
|
-
? 1
|
|
2592
|
-
: 0;
|
|
2593
|
-
}
|
|
2594
|
-
/**
|
|
2595
|
-
* @inheritDoc
|
|
2596
|
-
*/
|
|
2597
|
-
handle() {
|
|
2598
|
-
return RTEFunctionBlock.from({
|
|
2599
|
-
id: generateUUID(),
|
|
2600
|
-
type: 'function-block',
|
|
2601
|
-
annotations: {
|
|
2602
|
-
customClass: ['statement'],
|
|
2603
|
-
},
|
|
2604
|
-
children: [],
|
|
2605
|
-
});
|
|
2606
|
-
}
|
|
2607
|
-
/**
|
|
2608
|
-
* @inheritDoc
|
|
2609
|
-
*/
|
|
2610
|
-
appendChildBlocks(currentBlock, childBlocks) {
|
|
2611
|
-
currentBlock.children = childBlocks.map((block) => {
|
|
2612
|
-
block.parent = currentBlock;
|
|
2613
|
-
return block;
|
|
2614
|
-
});
|
|
2615
|
-
}
|
|
2616
|
-
/**
|
|
2617
|
-
* @inheritDoc
|
|
2618
|
-
*/
|
|
2619
|
-
shouldProceedToElementChildren() {
|
|
2620
|
-
return true;
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
/**
|
|
2625
|
-
* Strategy to convert a div with class 'statementelement' into an function block.
|
|
2626
|
-
*/
|
|
2627
|
-
class DivToFunctionContentStrategy extends DivToLogicControlBlockStrategy {
|
|
2628
|
-
constructor() {
|
|
2629
|
-
super(...arguments);
|
|
2630
|
-
this.blockClassName = 'statementelement';
|
|
2631
|
-
}
|
|
2632
|
-
/**
|
|
2633
|
-
* @inheritDoc
|
|
2634
|
-
*/
|
|
2635
|
-
handle(elementsArray, options) {
|
|
2636
|
-
const element = elementsArray[0];
|
|
2637
|
-
const annotations = htmlElementToAnnotationGenerator.generate(RTETextBlock, element);
|
|
2638
|
-
const nodes = Array.from(elementsArray[0].childNodes);
|
|
2639
|
-
return RTETextBlock.from({
|
|
2640
|
-
id: generateUUID(),
|
|
2641
|
-
type: 'paragraph',
|
|
2642
|
-
annotations: Object.assign({ customClass: [this.blockClassName] }, annotations),
|
|
2643
|
-
nodes: this.generateChildNodes(nodes, undefined, options),
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
const functionBlockStylesCss = "div.statement{padding:2px 4px;background:rgba(var(--v-bg-accent3-secondary, 255, 239, 200));border:1px solid rgba(var(--v-bg-accent3-primary, 255, 220, 131));border-radius:4px;display:flex;flex-direction:row;justify-content:flex-start;align-items:stretch;gap:4px}div.statement .statementsyntax{padding:3px 0;line-height:22px}.rich-text-content div.statement .statementsyntax,.rich-text-content div.statement .statementelement{display:inline-block}div.statement+div.statement{margin-top:2px}div.statement .statementsyntax span{color:rgb(38, 42, 255);font-weight:bold}div.statement .statementelement{padding:2px 4px;background:rgba(var(--v-bg-secondary, 245, 247, 247));border:1px solid rgba(var(--v-border-color-input-field, 171, 198, 216));border-radius:4px;margin:0;min-width:8px}";
|
|
2649
|
-
|
|
2650
|
-
/**
|
|
2651
|
-
* Renderer for Function Block
|
|
2652
|
-
*/
|
|
2653
|
-
class RTEFunctionBlockRenderer extends VegaRTEExtensionRenderer {
|
|
2654
|
-
/**
|
|
2655
|
-
* @inheritDoc
|
|
2656
|
-
*/
|
|
2657
|
-
doRender(createElement, renderData) {
|
|
2658
|
-
return createElement('div', {
|
|
2659
|
-
key: renderData.id,
|
|
2660
|
-
class: this.getElementClassName(renderData),
|
|
2661
|
-
ref: this.useRef(renderData),
|
|
2662
|
-
});
|
|
2663
|
-
}
|
|
2664
|
-
/**
|
|
2665
|
-
* Defines the function block styles to be injected into the RTE scope.
|
|
2666
|
-
*
|
|
2667
|
-
* @returns {string} - The styles as a string.
|
|
2668
|
-
*/
|
|
2669
|
-
injectRTEScopeStyles() {
|
|
2670
|
-
return functionBlockStylesCss;
|
|
2671
|
-
}
|
|
2672
|
-
/**
|
|
2673
|
-
* Gets the class name for the function block element.
|
|
2674
|
-
*
|
|
2675
|
-
* @param {RTEFunctionBlock} block - The function block.
|
|
2676
|
-
* @returns {string} The class name for the function block element.
|
|
2677
|
-
*/
|
|
2678
|
-
getElementClassName(block) {
|
|
2679
|
-
let classes = block.getClasses();
|
|
2680
|
-
if (classes.indexOf('statement') < 0) {
|
|
2681
|
-
classes = 'statement ' + classes;
|
|
2682
|
-
}
|
|
2683
|
-
return classes.trim();
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
/**
|
|
2688
|
-
* Abstract class for action handler interceptors, which can intercept actions before they are handled.
|
|
2689
|
-
*/
|
|
2690
|
-
class ActionHandlerInterceptor {
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
/**
|
|
2694
|
-
* Prevent special type input in function block.
|
|
2695
|
-
*/
|
|
2696
|
-
class PreventNewParagraphInterceptor extends ActionHandlerInterceptor {
|
|
2697
|
-
/**
|
|
2698
|
-
* Checks the target block parent whether is function block.
|
|
2699
|
-
*
|
|
2700
|
-
* @param {InsertNewParagraphAction} _action - the action to be intercepted
|
|
2701
|
-
* @param {RTETextBlock} target - the target block
|
|
2702
|
-
* @returns {boolean} - true if the target block parent is function block, false otherwise
|
|
2703
|
-
*/
|
|
2704
|
-
canIntercept(_action, target) {
|
|
2705
|
-
return target.parent && target.parent instanceof RTEFunctionBlock;
|
|
2706
|
-
}
|
|
2707
|
-
/**
|
|
2708
|
-
* Insert a new paragraph behind of the function block instead of the target block.
|
|
2709
|
-
*
|
|
2710
|
-
* @param {ActionHandlerExecution} _execution - the original execution function
|
|
2711
|
-
* @param {ModifyContentAction} _action - the action to be intercepted
|
|
2712
|
-
* @param {RTETextBlock} target - the target block
|
|
2713
|
-
*/
|
|
2714
|
-
intercept(_execution, _action, target) {
|
|
2715
|
-
const insertParagraphAction = new InsertNewParagraphAction(target.children[0], 0);
|
|
2716
|
-
insertParagraphAction.isFlushable = true;
|
|
2717
|
-
target.parent.apply(insertParagraphAction);
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
/**
|
|
2722
|
-
* Insert a new paragraph behind of current function block strategy.
|
|
2723
|
-
*/
|
|
2724
|
-
class FunctionBlockInsertParagraphStrategy extends ActionHandleStrategy {
|
|
2725
|
-
/**
|
|
2726
|
-
* @inheritDoc
|
|
2727
|
-
*/
|
|
2728
|
-
handleAction(action, target) {
|
|
2729
|
-
const newParagraph = this.createNewParagraph('');
|
|
2730
|
-
if (newParagraph) {
|
|
2731
|
-
target.parent.apply(new InsertChildrenAfterAction(target, newParagraph));
|
|
2732
|
-
action.newBlock = newParagraph;
|
|
2733
|
-
this.focusToNextLine(newParagraph);
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
|
-
/**
|
|
2737
|
-
* Focus to next paragraph.
|
|
2738
|
-
*
|
|
2739
|
-
* @param {RTETextBlock} block - The paragraph need to focus.
|
|
2740
|
-
*/
|
|
2741
|
-
focusToNextLine(block) {
|
|
2742
|
-
const root = this.getRootContent(block);
|
|
2743
|
-
if (root) {
|
|
2744
|
-
root.apply(new UpdateCursorPositionAction(block.children[0], 1));
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
const PASTE_PLAIN_TEXT = 'PASTE_PLAIN_TEXT';
|
|
2750
|
-
/**
|
|
2751
|
-
* Action to paste plain text content into function block.
|
|
2752
|
-
*
|
|
2753
|
-
* @example functionBlock.apply(new PastePlainTextAction('content', range))
|
|
2754
|
-
* @example host.value.apply(new PastePlainTextAction('content', range))
|
|
2755
|
-
*/
|
|
2756
|
-
class PastePlainTextAction extends ModifyContentAction {
|
|
2757
|
-
constructor(blocksToBeInserted, startNode, startOffset) {
|
|
2758
|
-
super();
|
|
2759
|
-
this.type = PASTE_PLAIN_TEXT;
|
|
2760
|
-
this.blocksToBeInserted = blocksToBeInserted;
|
|
2761
|
-
this.startNode = startNode;
|
|
2762
|
-
this.startOffset = startOffset;
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
|
-
/**
|
|
2767
|
-
* Prevent special type input in function block.
|
|
2768
|
-
*/
|
|
2769
|
-
class PreventPasteContentInterceptor extends PreventNewParagraphInterceptor {
|
|
2770
|
-
/**
|
|
2771
|
-
* Paste plain text into text block.
|
|
2772
|
-
*
|
|
2773
|
-
* @param {ActionHandlerExecution} _execution - the original execution function
|
|
2774
|
-
* @param {ModifyContentAction} action - the action to be intercepted
|
|
2775
|
-
* @param {RTETextBlock} target - the target block
|
|
2776
|
-
*/
|
|
2777
|
-
intercept(_execution, action, target) {
|
|
2778
|
-
const { blocksToBeInserted, rteRange } = action;
|
|
2779
|
-
let { startNode, startOffset } = action;
|
|
2780
|
-
// Set the start offset from rteRange if available, this is to handle the paste issue https://gethired.atlassian.net/browse/VD-7779
|
|
2781
|
-
if (rteRange) {
|
|
2782
|
-
startNode = rteRange.startNode;
|
|
2783
|
-
startOffset = rteRange.startOffset;
|
|
2784
|
-
}
|
|
2785
|
-
const pastePlainTextAction = new PastePlainTextAction(blocksToBeInserted, startNode, startOffset);
|
|
2786
|
-
target.apply(pastePlainTextAction);
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
/**
|
|
2791
|
-
* Strategy to handle the paste content into function block.
|
|
2792
|
-
*/
|
|
2793
|
-
class PastePlainTextStrategy extends ActionHandleStrategy {
|
|
2794
|
-
/**
|
|
2795
|
-
* @inheritDoc
|
|
2796
|
-
*/
|
|
2797
|
-
handleAction(action, target) {
|
|
2798
|
-
const { blocksToBeInserted, startNode, startOffset } = action;
|
|
2799
|
-
if (startNode instanceof RTETextNode) {
|
|
2800
|
-
const textNodes = blocksToBeInserted.flatMap((block) => {
|
|
2801
|
-
if (block instanceof RTETextBlock) {
|
|
2802
|
-
this.copyLinkGroupAnnotations(target.annotationMap, block.annotationMap);
|
|
2803
|
-
return block.children;
|
|
2804
|
-
}
|
|
2805
|
-
return [];
|
|
2806
|
-
});
|
|
2807
|
-
if (textNodes.length > 0) {
|
|
2808
|
-
if (startOffset > 0) {
|
|
2809
|
-
target.apply(new InsertChildrenAfterAction(startNode, ...textNodes));
|
|
2810
|
-
}
|
|
2811
|
-
else {
|
|
2812
|
-
target.apply(new InsertChildrenBeforeAction(startNode, ...textNodes));
|
|
2813
|
-
}
|
|
2814
|
-
this.focusToNextLine(textNodes[textNodes.length - 1], textNodes[textNodes.length - 1].getRangeEndOffset());
|
|
2815
|
-
}
|
|
2816
|
-
}
|
|
2817
|
-
}
|
|
2818
|
-
/**
|
|
2819
|
-
* Focus to next paragraph.
|
|
2820
|
-
*
|
|
2821
|
-
* @param {RTETextNode} node - The text node need to focus.
|
|
2822
|
-
* @param {number} startOffset - The offset need to focus.
|
|
2823
|
-
*/
|
|
2824
|
-
focusToNextLine(node, startOffset) {
|
|
2825
|
-
const root = this.getRootContent(node);
|
|
2826
|
-
if (root) {
|
|
2827
|
-
root.apply(new UpdateCursorPositionAction(node, startOffset));
|
|
2828
|
-
}
|
|
2829
|
-
}
|
|
2830
|
-
/**
|
|
2831
|
-
* Copy link group annotations from copied block to target block.
|
|
2832
|
-
*
|
|
2833
|
-
* @param {BlockAnnotations} blockAnnotationMap - The target block annotation map.
|
|
2834
|
-
* @param {BlockAnnotations} copiedAnnotationMap - The copied block annotation map.
|
|
2835
|
-
*/
|
|
2836
|
-
copyLinkGroupAnnotations(blockAnnotationMap, copiedAnnotationMap) {
|
|
2837
|
-
if (copiedAnnotationMap && copiedAnnotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
2838
|
-
const copiedLinkGroupAnnotation = copiedAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2839
|
-
if (!blockAnnotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
2840
|
-
blockAnnotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, copiedAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP));
|
|
2841
|
-
}
|
|
2842
|
-
else {
|
|
2843
|
-
copiedLinkGroupAnnotation.linkGroups.forEach((nodes, groupKey) => {
|
|
2844
|
-
const existingAnnotation = blockAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2845
|
-
existingAnnotation.linkGroups.set(groupKey, nodes);
|
|
2846
|
-
});
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
|
|
2852
|
-
const convertLogicControlBlockStrategy = new DivToLogicControlBlockStrategy();
|
|
2853
|
-
const convertFunctionContentStrategy = new DivToFunctionContentStrategy();
|
|
2854
|
-
const convertFunctionBlockStrategy = new DivToFunctionBlockStrategy();
|
|
2855
|
-
/**
|
|
2856
|
-
* Function extension class for Vega Rich Text Editor.
|
|
2857
|
-
*/
|
|
2858
|
-
class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
2859
|
-
constructor() {
|
|
2860
|
-
super();
|
|
2861
|
-
this.toolbarButtonRenderer = new FunctionToolbarButtonRenderer();
|
|
2862
|
-
this.registerBlockBasicStrategies(RTELogicControlBlock.name);
|
|
2863
|
-
this.registerBlockBasicStrategies(RTEFunctionBlock.name);
|
|
2864
|
-
this.preventFunctionBlockDefaultInsertNewParagraph();
|
|
2865
|
-
this.registerNode('logic-control-block', RTELogicControlBlock);
|
|
2866
|
-
this.registerRenderer('logic-control-block', new RTELogicControlBlockRenderer());
|
|
2867
|
-
this.registerNode('function-block', RTEFunctionBlock);
|
|
2868
|
-
this.registerRenderer('function-block', new RTEFunctionBlockRenderer());
|
|
2869
|
-
this.registerToolbarButtonRenderer('functions', this.toolbarButtonRenderer);
|
|
2870
|
-
this.registerElementToBlockDTOClassStrategy(convertLogicControlBlockStrategy);
|
|
2871
|
-
this.registerElementToBlockDTOClassStrategy(convertFunctionContentStrategy);
|
|
2872
|
-
this.registerElementToBlockDTOClassStrategy(convertFunctionBlockStrategy);
|
|
2873
|
-
}
|
|
2874
|
-
/**
|
|
2875
|
-
* Initializes the extension with the given context
|
|
2876
|
-
*
|
|
2877
|
-
* @param {RTEExtensionContext} context - extension context
|
|
2878
|
-
*/
|
|
2879
|
-
initialExtension(context) {
|
|
2880
|
-
super.initialExtension(context);
|
|
2881
|
-
if (this.toolbarButtonRenderer) {
|
|
2882
|
-
this.toolbarButtonRenderer.injectExtensionContext(context);
|
|
2883
|
-
}
|
|
2884
|
-
}
|
|
2885
|
-
/**
|
|
2886
|
-
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
2887
|
-
*/
|
|
2888
|
-
preventFunctionBlockDefaultInsertNewParagraph() {
|
|
2889
|
-
this.unRegisterStrategy(ModifyContentActionType.INSERT_NEW_PARAGRAPH, RTELogicControlBlock.name);
|
|
2890
|
-
this.unRegisterStrategy(ModifyContentActionType.APPEND_CHILDREN, RTEFunctionBlock.name);
|
|
2891
|
-
this.unRegisterStrategy(ModifyContentActionType.INSERT_CHILDREN_AFTER, RTEFunctionBlock.name);
|
|
2892
|
-
this.unRegisterStrategy(ModifyContentActionType.INSERT_CHILDREN_BEFORE, RTEFunctionBlock.name);
|
|
2893
|
-
this.unRegisterStrategy(ModifyContentActionType.PASTE_CONTENT, RTELogicControlBlock.name);
|
|
2894
|
-
VegaRTEExtension.registerActionHandleStrategy(RTEFunctionBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new FunctionBlockInsertParagraphStrategy());
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
(() => {
|
|
2898
|
-
const insertFunctionBlockStrategy = new InsertFunctionBlockStrategy();
|
|
2899
|
-
VegaRTEExtension.registerActionHandleStrategy(VegaRTEContent.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2900
|
-
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2901
|
-
VegaRTEExtension.registerActionHandleStrategy(RTEImageBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2902
|
-
VegaRTEExtension.registerActionHandleStrategy(RTELogicControlBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2903
|
-
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, PASTE_PLAIN_TEXT, new PastePlainTextStrategy());
|
|
2904
|
-
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
2905
|
-
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
2906
|
-
})();
|
|
2907
|
-
|
|
2908
|
-
export { ActionHandlerInterceptor as A, InsertNodeToNearestRootAction as I, RTETokenToolbarButtonRenderer as R, VegaLoader as V, VegaNotify as a, VegaThemeManager as b, VegaDialog as c, VegaEventManager$1 as d, VegaZIndexManager$1 as e, VegaSkeletonLoader as f, VegaRTETokenExtension as g, VegaRTEFunctionExtension as h, VegaRTEToolbarButtonRenderer as i, VegaRTEExtension as j, VegaRTEExtensionRenderer as k, RTETokenNode as l, RTETokenNodeRenderer as m, InternalVegaZIndexManager$1 as n };
|