@globalpayments/vega 2.96.0 → 2.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-38afea36.js → app-globals-3f57f7b9.js} +10 -10
- package/dist/cjs/{code-block-4126dc3b.js → code-block-28a7732e.js} +7 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-38ba956e.js → component-value-history-controller-slimmer.abstract-50cdba6e.js} +3 -3
- package/dist/cjs/{content-state-50e8a03c.js → content-state-e2ab0f06.js} +2 -2
- package/dist/cjs/{date-required-rule-4ab06a82.js → date-required-rule-5250f26d.js} +1 -1
- package/dist/cjs/{design-token-d3d12fa0.js → design-token-74674ee7.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-7773fdab.js → element-appender-slimmer-ccb2e3c2.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-d638ba12.js → form-field-controller-slimmer-58621b5e.js} +5 -14
- package/dist/cjs/form-field-key-8d5edf75.js +25 -0
- package/dist/cjs/{image-annotation-action-89363de8.js → image-annotation-action-b54dc669.js} +2 -2
- package/dist/cjs/{image-extension-c881c454.js → image-extension-1e3eeaa3.js} +2 -2
- package/dist/cjs/index.cjs.js +17 -17
- package/dist/cjs/{inject-keyboard-manager-5a105612.js → inject-keyboard-manager-6a6f5c9f.js} +1 -1
- package/dist/cjs/{internal-calendar-period-factory-b76006f7.js → internal-calendar-period-factory-dfcdd3f6.js} +1 -1
- package/dist/cjs/{internal-translation-controller-eb02c3b1.js → internal-translation-controller-1dac2df8.js} +7 -0
- package/dist/cjs/{keyboard-manager-ca76d4dc.js → keyboard-manager-c56033b1.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-a1223714.js → keyboard-manager-slimmer-7043a106.js} +1 -1
- package/dist/cjs/{link-extension-b7f99a52.js → link-extension-71c27ff3.js} +3 -3
- package/dist/cjs/loader.cjs.js +12 -12
- package/dist/cjs/{month-view-generator-876c50d4.js → month-view-generator-7b704a80.js} +1 -1
- package/dist/cjs/{public-rules-72894208.js → public-rules-55e34d2e.js} +7 -7
- package/dist/cjs/{range-95d41dea.js → range-eebe0e3c.js} +1 -1
- package/dist/cjs/{responsive-format-facade-25e9f30d.js → responsive-format-facade-493d1763.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-4d6d2493.js → rich-text-editor-required-rule-4fdee376.js} +1 -1
- package/dist/cjs/{split-cell-operation-70be116d.js → split-cell-operation-51097409.js} +3 -3
- package/dist/cjs/{state-border-formatter-f1ce0f3b.js → state-border-formatter-711c7aaa.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-b22f7754.js → string-format-strategy.abstract-b61bdcbd.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-d2c248f7.js → string-input-formatter-slimmer-18d45942.js} +1 -1
- package/dist/cjs/{string-mask-strategy-fc01a500.js → string-mask-strategy-ad3fa0ac.js} +2 -2
- package/dist/cjs/{style-formatter-73205450.js → style-formatter-8f711cb0.js} +2 -2
- package/dist/cjs/{time-required-rule-12d2f394.js → time-required-rule-87417359.js} +1 -1
- package/dist/cjs/{token-extension-eb828948.js → token-extension-608bbf7b.js} +8 -8
- package/dist/cjs/{translation-slimmer-9099f56c.js → translation-slimmer-77c7f37d.js} +1 -1
- package/dist/cjs/{type-guard-f354af8b.js → type-guard-a57ef3ac.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-8d370163.js → valid-credit-card-number-rule-4c0a3040.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
- package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-backdrop.cjs.entry.js +63 -8
- package/dist/cjs/vega-box.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +3 -3
- package/dist/cjs/vega-calendar_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +20 -3
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
- package/dist/cjs/vega-color-picker.cjs.entry.js +11 -2
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +12 -3
- package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +17 -8
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +22 -13
- package/dist/cjs/vega-dialog_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +12 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-form.cjs.entry.js +28 -25
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +14 -5
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +16 -7
- package/dist/cjs/vega-input-numeric.cjs.entry.js +14 -5
- package/dist/cjs/vega-input-passcode.cjs.entry.js +14 -5
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +13 -4
- package/dist/cjs/vega-input-range.cjs.entry.js +12 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +14 -5
- package/dist/cjs/vega-input.cjs.entry.js +9 -7
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +71 -11
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
- package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +17 -5
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +32 -9
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +1581 -428
- package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +1 -1
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +13 -4
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +11 -2
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +16 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +12 -3
- package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
- package/dist/cjs/vega-textarea.cjs.entry.js +12 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +18 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +12 -3
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
- package/dist/cjs/vega.cjs.js +12 -12
- package/dist/collection/components/vega-backdrop/slimmers/controller/vega-backdrop-visible-controller.js +63 -8
- package/dist/collection/components/vega-checkbox/vega-checkbox-group/vega-checkbox-group.js +33 -1
- package/dist/collection/components/vega-checkbox/vega-checkbox.js +34 -2
- package/dist/collection/components/vega-color-picker/vega-color-picker.js +33 -1
- package/dist/collection/components/vega-color-swatch/vega-color-swatch-picker/vega-color-swatch-picker.js +33 -1
- package/dist/collection/components/vega-combo-box/vega-combo-box.js +33 -1
- package/dist/collection/components/vega-date-picker/vega-date-picker.js +33 -1
- package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +33 -1
- package/dist/collection/components/vega-form/slimmers/controllers/vega-form-field-controller.js +9 -9
- package/dist/collection/components/vega-form/slimmers/controllers/vega-form-field-validation-state-controller.js +5 -5
- package/dist/collection/components/vega-form/slimmers/renderers/native-form-renderer.js +4 -1
- package/dist/collection/components/vega-form/vega-form.js +32 -0
- package/dist/collection/components/vega-image-uploader/vega-image-uploader.js +33 -1
- package/dist/collection/components/vega-input/vega-input.js +5 -4
- package/dist/collection/components/vega-input-credit-card/vega-input-credit-card.js +34 -2
- package/dist/collection/components/vega-input-numeric/vega-input-numeric.js +33 -1
- package/dist/collection/components/vega-input-passcode/vega-input-passcode.js +33 -1
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +33 -1
- package/dist/collection/components/vega-input-range/vega-input-range.js +33 -1
- package/dist/collection/components/vega-input-select/vega-input-select.js +33 -1
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-backdrop-manager.js +17 -1
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.js +48 -5
- package/dist/collection/components/vega-radio/vega-radio-group/vega-radio-group.js +18 -3
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +26 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/keyboard-link-handler.js +297 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +33 -1
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/controllers/link-editor-controller.js +398 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/controllers/link-editor-state-manager.js +111 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/controllers/link-type-config-controller.js +173 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/link-type-handler.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.js +114 -106
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/utils/link-url-normalizer.js +80 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.js +44 -1
- package/dist/collection/components/vega-selection-chip/vega-selection-chip-group/vega-selection-chip-group.js +33 -1
- package/dist/collection/components/vega-selection-tile/vega-selection-tile-group/vega-selection-tile-group.js +33 -1
- package/dist/collection/components/vega-signature-capture/vega-signature-capture.js +33 -1
- package/dist/collection/components/vega-stepper/vega-stepper.js +34 -2
- package/dist/collection/components/vega-textarea/vega-textarea.js +34 -2
- package/dist/collection/components/vega-time-picker/vega-time-picker.js +33 -1
- package/dist/collection/components/vega-toggle-switch/vega-toggle-switch.js +34 -2
- package/dist/collection/helpers/slimmers/{field-error-controller-silmmer.js → form/field-error-controller-silmmer.js} +3 -3
- package/dist/collection/helpers/slimmers/{field-error-ui-controller-slimmer.js → form/field-error-ui-controller-slimmer.js} +9 -9
- package/dist/collection/helpers/slimmers/{form-field-controller-slimmer.js → form/form-field-controller-slimmer.js} +9 -18
- package/dist/collection/helpers/slimmers/{form-field-message-translator.js → form/form-field-message-translator.js} +1 -1
- package/dist/collection/helpers/slimmers/{form-field-state-controller-slimmer.js → form/form-field-state-controller-slimmer.js} +1 -1
- package/dist/collection/helpers/slimmers/{form-field-valid-invoke-slimmer.js → form/form-field-valid-invoke-slimmer.js} +2 -2
- package/dist/collection/helpers/slimmers/form/utils/form-field-key.js +20 -0
- package/dist/collection/helpers/translation/locales/en.js +7 -0
- package/dist/collection/helpers/validator/form-field-controller.js +5 -4
- package/dist/esm/{app-globals-d7b651c1.js → app-globals-d3991e53.js} +10 -10
- package/dist/esm/{code-block-0a88b481.js → code-block-8df86434.js} +5 -2
- package/dist/esm/{component-value-history-controller-slimmer.abstract-6846edfa.js → component-value-history-controller-slimmer.abstract-e4b95997.js} +3 -3
- package/dist/esm/{content-state-79ca99e5.js → content-state-c63fbeda.js} +2 -2
- package/dist/esm/{date-required-rule-b88e1650.js → date-required-rule-85334d0c.js} +1 -1
- package/dist/esm/{design-token-76bd217c.js → design-token-10ff79b5.js} +3 -3
- package/dist/esm/{element-appender-slimmer-73ad10ae.js → element-appender-slimmer-24be8e94.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-395c23e3.js → form-field-controller-slimmer-d8628837.js} +5 -14
- package/dist/esm/form-field-key-44ab39d0.js +22 -0
- package/dist/esm/{image-annotation-action-bb299ef1.js → image-annotation-action-fcceff95.js} +2 -2
- package/dist/esm/{image-extension-48a96f98.js → image-extension-3280bdb0.js} +2 -2
- package/dist/esm/index.js +17 -17
- package/dist/esm/{inject-keyboard-manager-86126b5b.js → inject-keyboard-manager-ea1aad5b.js} +1 -1
- package/dist/esm/{internal-calendar-period-factory-3a07dba0.js → internal-calendar-period-factory-7b294fb6.js} +1 -1
- package/dist/esm/{internal-translation-controller-16709132.js → internal-translation-controller-fac22598.js} +7 -0
- package/dist/esm/{keyboard-manager-a0c3e1cf.js → keyboard-manager-50da85d7.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-f3f66c15.js → keyboard-manager-slimmer-1f7c8bfb.js} +1 -1
- package/dist/esm/{link-extension-09534514.js → link-extension-f92c06ef.js} +3 -3
- package/dist/esm/loader.js +12 -12
- package/dist/esm/{month-view-generator-fd0e1856.js → month-view-generator-a1a9a4ec.js} +1 -1
- package/dist/esm/{public-rules-5eb03ef0.js → public-rules-3695aaf7.js} +7 -7
- package/dist/esm/{range-d4deb7df.js → range-717d552d.js} +1 -1
- package/dist/esm/{responsive-format-facade-ced96b0b.js → responsive-format-facade-f19b601c.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-5bbbce23.js → rich-text-editor-required-rule-2e39264a.js} +1 -1
- package/dist/esm/{split-cell-operation-7f3058ad.js → split-cell-operation-6c26af91.js} +3 -3
- package/dist/esm/{state-border-formatter-b680e922.js → state-border-formatter-bfda33aa.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-23faab71.js → string-format-strategy.abstract-1f4ff1b3.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-4b4866a6.js → string-input-formatter-slimmer-68b2af39.js} +1 -1
- package/dist/esm/{string-mask-strategy-66586cd8.js → string-mask-strategy-bbbcdbef.js} +2 -2
- package/dist/esm/{style-formatter-f4e16af5.js → style-formatter-e9adc8f4.js} +2 -2
- package/dist/esm/{time-required-rule-6e80a9ab.js → time-required-rule-1ce2d0a0.js} +1 -1
- package/dist/esm/{token-extension-40c32bcc.js → token-extension-5082a4d2.js} +8 -8
- package/dist/esm/{translation-slimmer-21748a0e.js → translation-slimmer-ee0f0e76.js} +1 -1
- package/dist/esm/{type-guard-ec5e8628.js → type-guard-f2624334.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-ca5a47d6.js → valid-credit-card-number-rule-60212b1d.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -6
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-backdrop.entry.js +63 -8
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +3 -3
- package/dist/esm/vega-calendar_5.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +20 -3
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +11 -2
- package/dist/esm/vega-color-swatch-picker.entry.js +12 -3
- package/dist/esm/vega-color-swatch.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +17 -8
- package/dist/esm/vega-date-picker_2.entry.js +22 -13
- package/dist/esm/vega-dialog_2.entry.js +3 -3
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +7 -7
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +12 -3
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +28 -25
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +14 -5
- package/dist/esm/vega-input-credit-card.entry.js +16 -7
- package/dist/esm/vega-input-numeric.entry.js +14 -5
- package/dist/esm/vega-input-passcode.entry.js +14 -5
- package/dist/esm/vega-input-phone-number.entry.js +13 -4
- package/dist/esm/vega-input-range.entry.js +12 -3
- package/dist/esm/vega-input-select.entry.js +14 -5
- package/dist/esm/vega-input.entry.js +9 -7
- package/dist/esm/vega-left-nav_5.entry.js +71 -11
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-popover_2.entry.js +8 -8
- package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
- package/dist/esm/vega-radio_2.entry.js +17 -5
- package/dist/esm/vega-rich-text-content.entry.js +32 -9
- package/dist/esm/vega-rich-text-editor_4.entry.js +1581 -428
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +1 -1
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
- package/dist/esm/vega-selection-chip_2.entry.js +13 -4
- package/dist/esm/vega-selection-tile_2.entry.js +11 -2
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +16 -7
- package/dist/esm/vega-stepper.entry.js +12 -3
- package/dist/esm/vega-table_11.entry.js +4 -4
- package/dist/esm/vega-textarea.entry.js +12 -3
- package/dist/esm/vega-time-picker_2.entry.js +18 -9
- package/dist/esm/vega-toggle-switch.entry.js +12 -3
- package/dist/esm/vega-tooltip_2.entry.js +6 -6
- package/dist/esm/vega.js +12 -12
- package/dist/sri/vega-sri-manifest.json +314 -310
- package/dist/types/components/vega-backdrop/slimmers/controller/vega-backdrop-visible-controller.d.ts +21 -0
- package/dist/types/components/vega-checkbox/vega-checkbox-group/vega-checkbox-group.d.ts +9 -1
- package/dist/types/components/vega-checkbox/vega-checkbox.d.ts +9 -1
- package/dist/types/components/vega-color-picker/vega-color-picker.d.ts +9 -1
- package/dist/types/components/vega-color-swatch/vega-color-swatch-picker/vega-color-swatch-picker.d.ts +9 -1
- package/dist/types/components/vega-combo-box/vega-combo-box.d.ts +9 -1
- package/dist/types/components/vega-date-picker/vega-date-picker.d.ts +9 -1
- package/dist/types/components/vega-file-uploader/vega-file-uploader.d.ts +9 -1
- package/dist/types/components/vega-form/slimmers/controllers/vega-form-field-controller.d.ts +3 -2
- package/dist/types/components/vega-form/slimmers/renderers/native-form-renderer.d.ts +1 -0
- package/dist/types/components/vega-form/vega-form.d.ts +8 -0
- package/dist/types/components/vega-image-uploader/vega-image-uploader.d.ts +9 -1
- package/dist/types/components/vega-input/vega-input.d.ts +3 -2
- package/dist/types/components/vega-input-credit-card/vega-input-credit-card.d.ts +9 -1
- package/dist/types/components/vega-input-numeric/vega-input-numeric.d.ts +9 -1
- package/dist/types/components/vega-input-passcode/vega-input-passcode.d.ts +9 -1
- package/dist/types/components/vega-input-phone-number/vega-input-phone-number.d.ts +9 -1
- package/dist/types/components/vega-input-range/vega-input-range.d.ts +9 -1
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +9 -1
- package/dist/types/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-backdrop-manager.d.ts +7 -0
- package/dist/types/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.d.ts +17 -0
- package/dist/types/components/vega-radio/vega-radio-group/vega-radio-group.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/link/type.d.ts +34 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +4 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/keyboard-link-handler.d.ts +111 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +9 -1
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/controllers/link-editor-controller.d.ts +149 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/controllers/link-editor-state-manager.d.ts +84 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/controllers/link-type-config-controller.d.ts +82 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/link-type-handler.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.d.ts +24 -17
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/utils/link-url-normalizer.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/types.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.d.ts +12 -0
- package/dist/types/components/vega-selection-chip/vega-selection-chip-group/vega-selection-chip-group.d.ts +9 -1
- package/dist/types/components/vega-selection-tile/vega-selection-tile-group/vega-selection-tile-group.d.ts +9 -1
- package/dist/types/components/vega-signature-capture/vega-signature-capture.d.ts +9 -1
- package/dist/types/components/vega-stepper/vega-stepper.d.ts +9 -1
- package/dist/types/components/vega-textarea/vega-textarea.d.ts +9 -1
- package/dist/types/components/vega-time-picker/vega-time-picker.d.ts +9 -1
- package/dist/types/components/vega-toggle-switch/vega-toggle-switch.d.ts +9 -1
- package/dist/types/components.d.ts +287 -4
- package/dist/types/helpers/slimmers/{field-error-controller-silmmer.d.ts → form/field-error-controller-silmmer.d.ts} +1 -1
- package/dist/types/helpers/slimmers/{field-error-ui-controller-slimmer.d.ts → form/field-error-ui-controller-slimmer.d.ts} +2 -2
- package/dist/types/helpers/slimmers/{form-field-controller-slimmer.d.ts → form/form-field-controller-slimmer.d.ts} +6 -14
- package/dist/types/helpers/slimmers/{form-field-message-translator.d.ts → form/form-field-message-translator.d.ts} +2 -2
- package/dist/types/helpers/slimmers/{form-field-state-controller-slimmer.d.ts → form/form-field-state-controller-slimmer.d.ts} +2 -2
- package/dist/types/helpers/slimmers/{form-field-valid-invoke-slimmer.d.ts → form/form-field-valid-invoke-slimmer.d.ts} +3 -3
- package/dist/types/helpers/slimmers/form/utils/form-field-key.d.ts +17 -0
- package/dist/types/helpers/translation/interface.d.ts +7 -0
- package/dist/types/helpers/validator/form-field-controller.d.ts +3 -3
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-040ea356.entry.js +1 -0
- package/dist/vega/p-046203cb.entry.js +1 -0
- package/dist/vega/p-0499e65a.entry.js +1 -0
- package/dist/vega/p-0809c651.js +1 -0
- package/dist/vega/{p-3c23ec90.js → p-09524fec.js} +1 -1
- package/dist/vega/{p-74f86ff9.entry.js → p-0cf3b5c1.entry.js} +1 -1
- package/dist/vega/p-10d43a80.entry.js +1 -0
- package/dist/vega/{p-3d6f761a.entry.js → p-1132a74e.entry.js} +1 -1
- package/dist/vega/{p-ba662fe5.js → p-12e8a1b2.js} +1 -1
- package/dist/vega/{p-55e0014a.js → p-1d5e05d9.js} +1 -1
- package/dist/vega/{p-3dee1e55.js → p-1e0a8fd3.js} +1 -1
- package/dist/vega/{p-919cddc3.js → p-1ea9ad9a.js} +1 -1
- package/dist/vega/p-21626b93.entry.js +1 -0
- package/dist/vega/p-21f608e8.entry.js +1 -0
- package/dist/vega/p-2540fd1c.entry.js +1 -0
- package/dist/vega/{p-9f201152.entry.js → p-26760c66.entry.js} +1 -1
- package/dist/vega/{p-892edf88.entry.js → p-2acf9b42.entry.js} +1 -1
- package/dist/vega/p-2bb60f89.js +1 -0
- package/dist/vega/{p-b1eb9ff0.js → p-2c2e8615.js} +1 -1
- package/dist/vega/p-2d158cbd.js +1 -0
- package/dist/vega/p-2d7388c9.entry.js +1 -0
- package/dist/vega/{p-b3a2ce06.entry.js → p-2eb8e167.entry.js} +1 -1
- package/dist/vega/{p-6a51d720.js → p-2ff4ae1c.js} +1 -1
- package/dist/vega/p-3488a3f1.entry.js +1 -0
- package/dist/vega/p-363ee8a5.entry.js +1 -0
- package/dist/vega/p-36c89520.entry.js +1 -0
- package/dist/vega/{p-e1737c8e.entry.js → p-3980dfa8.entry.js} +1 -1
- package/dist/vega/{p-14baa886.js → p-39c5054b.js} +1 -1
- package/dist/vega/p-3af5e87b.entry.js +1 -0
- package/dist/vega/{p-8db904dc.js → p-456f678b.js} +1 -1
- package/dist/vega/{p-6c9c2f8c.entry.js → p-461100b8.entry.js} +1 -1
- package/dist/vega/p-4c3a08be.entry.js +1 -0
- package/dist/vega/p-53fd3c41.entry.js +1 -0
- package/dist/vega/{p-6fcec7c7.entry.js → p-56417ec5.entry.js} +1 -1
- package/dist/vega/{p-9f11b579.js → p-5e37b041.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-a0a58295.entry.js → p-5f96e741.entry.js} +1 -1
- package/dist/vega/p-6b76b572.entry.js +1 -0
- package/dist/vega/{p-75e33859.js → p-6c95a6a3.js} +1 -1
- package/dist/vega/p-703ac992.entry.js +1 -0
- package/dist/vega/p-71909102.js +1 -0
- package/dist/vega/{p-e1b57e8f.entry.js → p-72ab5cd5.entry.js} +1 -1
- package/dist/vega/{p-8720816e.js → p-781b7a54.js} +1 -1
- package/dist/vega/{p-7950f3e2.entry.js → p-81d4dfcb.entry.js} +1 -1
- package/dist/vega/p-8611465f.entry.js +1 -0
- package/dist/vega/{p-0d18368b.js → p-874e5624.js} +1 -1
- package/dist/vega/{p-c4564904.js → p-8e7932bc.js} +1 -1
- package/dist/vega/p-8ed3b2b6.entry.js +1 -0
- package/dist/vega/{p-1dfbc542.entry.js → p-8ff92914.entry.js} +1 -1
- package/dist/vega/{p-9bdc6e11.entry.js → p-92528dc9.entry.js} +1 -1
- package/dist/vega/p-9664e914.entry.js +1 -0
- package/dist/vega/p-98fc5821.entry.js +1 -0
- package/dist/vega/{p-6c7b6d45.js → p-9be02fa5.js} +1 -1
- package/dist/vega/p-9c4c474e.entry.js +1 -0
- package/dist/vega/{p-8354cff0.entry.js → p-a034dfc0.entry.js} +1 -1
- package/dist/vega/{p-e48a870f.entry.js → p-a484e32d.entry.js} +1 -1
- package/dist/vega/{p-b9e72de2.entry.js → p-a8174ad8.entry.js} +1 -1
- package/dist/vega/{p-49e1cf4d.entry.js → p-a91927eb.entry.js} +1 -1
- package/dist/vega/{p-2df5d59b.entry.js → p-abbceebf.entry.js} +1 -1
- package/dist/vega/{p-e4266b45.entry.js → p-ac94ba1b.entry.js} +1 -1
- package/dist/vega/{p-b775e51f.js → p-ae2abdfa.js} +1 -1
- package/dist/vega/{p-bb60e381.entry.js → p-aeb50cad.entry.js} +1 -1
- package/dist/vega/{p-a890d60b.entry.js → p-b00ec194.entry.js} +1 -1
- package/dist/vega/{p-f78944d7.entry.js → p-b3733762.entry.js} +1 -1
- package/dist/vega/p-b594a11c.entry.js +1 -0
- package/dist/vega/{p-b4e7c967.js → p-b622c455.js} +1 -1
- package/dist/vega/{p-1232b553.entry.js → p-b98ead05.entry.js} +1 -1
- package/dist/vega/{p-e5ff77f7.entry.js → p-c2277448.entry.js} +1 -1
- package/dist/vega/{p-ec5dee32.js → p-c29934ef.js} +1 -1
- package/dist/vega/p-c3646101.entry.js +1 -0
- package/dist/vega/p-ca270da3.entry.js +1 -0
- package/dist/vega/{p-b4c26035.entry.js → p-ccbe3f1b.entry.js} +1 -1
- package/dist/vega/{p-6cde45fc.js → p-cd69aeae.js} +1 -1
- package/dist/vega/{p-84b7a775.js → p-d25c1a48.js} +1 -1
- package/dist/vega/{p-5924adae.entry.js → p-d2cbcf5e.entry.js} +1 -1
- package/dist/vega/{p-96da7d30.entry.js → p-d3413a78.entry.js} +1 -1
- package/dist/vega/{p-f1974321.js → p-d609c3fd.js} +1 -1
- package/dist/vega/{p-3345d903.js → p-dad7d2ac.js} +1 -1
- package/dist/vega/{p-61ce8029.js → p-dbb4b1d1.js} +1 -1
- package/dist/vega/p-dcd3e3a7.js +1 -0
- package/dist/vega/p-de8f0d98.js +1 -0
- package/dist/vega/{p-22cc174e.entry.js → p-deaf037a.entry.js} +1 -1
- package/dist/vega/p-e1029acc.js +1 -0
- package/dist/vega/p-e18c0656.entry.js +1 -0
- package/dist/vega/p-e3fdb65c.entry.js +1 -0
- package/dist/vega/p-e7e963ba.entry.js +1 -0
- package/dist/vega/{p-312d8205.js → p-e9b005df.js} +1 -1
- package/dist/vega/{p-9d3f69cb.js → p-e9d09211.js} +1 -1
- package/dist/vega/{p-3c309a38.js → p-f1078e63.js} +1 -1
- package/dist/vega/{p-595998d9.entry.js → p-f29ea345.entry.js} +1 -1
- package/dist/vega/p-f5095035.entry.js +1 -0
- package/dist/vega/{p-f29d9707.entry.js → p-f95d8d10.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-0512308f.entry.js +0 -1
- package/dist/vega/p-1d8312d3.entry.js +0 -1
- package/dist/vega/p-2d77ae73.entry.js +0 -1
- package/dist/vega/p-2d8d4d5b.entry.js +0 -1
- package/dist/vega/p-320091b7.js +0 -1
- package/dist/vega/p-36949349.js +0 -1
- package/dist/vega/p-4151f53a.entry.js +0 -1
- package/dist/vega/p-4ff48b84.js +0 -1
- package/dist/vega/p-5e4517eb.entry.js +0 -1
- package/dist/vega/p-6680ba17.entry.js +0 -1
- package/dist/vega/p-80b7945a.entry.js +0 -1
- package/dist/vega/p-841b3281.entry.js +0 -1
- package/dist/vega/p-87e5cb56.entry.js +0 -1
- package/dist/vega/p-91303402.entry.js +0 -1
- package/dist/vega/p-97215133.js +0 -1
- package/dist/vega/p-9d96d83f.entry.js +0 -1
- package/dist/vega/p-a05a2f1e.entry.js +0 -1
- package/dist/vega/p-a775825e.entry.js +0 -1
- package/dist/vega/p-acaff62d.entry.js +0 -1
- package/dist/vega/p-ae146458.entry.js +0 -1
- package/dist/vega/p-b63319e9.entry.js +0 -1
- package/dist/vega/p-b660f38c.entry.js +0 -1
- package/dist/vega/p-b8c13ac9.entry.js +0 -1
- package/dist/vega/p-b8ffa42f.entry.js +0 -1
- package/dist/vega/p-bbad318e.entry.js +0 -1
- package/dist/vega/p-c0e42c03.entry.js +0 -1
- package/dist/vega/p-c41f5684.entry.js +0 -1
- package/dist/vega/p-c54b5a8f.entry.js +0 -1
- package/dist/vega/p-cd1e976c.entry.js +0 -1
- package/dist/vega/p-d9158512.js +0 -1
- package/dist/vega/p-e62d41ee.js +0 -1
- package/dist/vega/p-ebe32b25.entry.js +0 -1
- package/dist/vega/p-ec162599.entry.js +0 -1
- package/dist/vega/p-fc7e4c8a.entry.js +0 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { forceUpdate } from '@stencil/core';
|
|
8
|
+
import { MapToComponentField, MapToComponentMethod, VegaSlimmer } from 'vega-slimmer/core';
|
|
9
|
+
import { waitForComponentDidRender } from '../../../../../helpers/common/wait-for-component-did-render';
|
|
10
|
+
import { VegaInternalComponentDidRender, VegaInternalPopoverUpdateTarget, } from '../../../../../helpers/event-manager/event-id/vega-internal-event-id';
|
|
11
|
+
import domNodeSubjectFactory from '../../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-factory';
|
|
12
|
+
import ChangeManager from '../../../../../helpers/change-manager/change-manager';
|
|
13
|
+
import remoteInvocationRegistry from '../../../../../helpers/remote-invocation/remote-invocation-registry';
|
|
14
|
+
import { LINK_TYPE_HANDLER_MAP } from '../renderers/link-type-handler';
|
|
15
|
+
import { LinkUrlNormalizer } from '../utils/link-url-normalizer';
|
|
16
|
+
import { RTE_DEFAULT_LINK_TYPE_KEY, RTE_EMAIL_LINK_TYPE_KEY } from '../../../constants/constant';
|
|
17
|
+
/**
|
|
18
|
+
* Coordinates link editor state, popover behavior, and submit actions.
|
|
19
|
+
*/
|
|
20
|
+
export class LinkEditorController extends VegaSlimmer {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.linkUrlNormalizer = new LinkUrlNormalizer();
|
|
24
|
+
this.linkTypeHandlers = LINK_TYPE_HANDLER_MAP;
|
|
25
|
+
}
|
|
26
|
+
/** Initializes the popover target after the component loads. */
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
this.updatePopoverTarget();
|
|
29
|
+
}
|
|
30
|
+
/** Notifies observers after each render cycle. */
|
|
31
|
+
componentDidRender() {
|
|
32
|
+
ChangeManager.notify(domNodeSubjectFactory.getSubject(this.host, VegaInternalComponentDidRender), {});
|
|
33
|
+
}
|
|
34
|
+
/** Focuses the URL input when the status changes to linkEdit. */
|
|
35
|
+
watchStatusChange() {
|
|
36
|
+
if (this.status === 'linkEdit') {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
void ((_a = this.renderer.getUrlInputRef()) === null || _a === void 0 ? void 0 : _a.doFocus());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Invalidates link type cache and updates the popover target when the target changes. */
|
|
44
|
+
watchTargetChange() {
|
|
45
|
+
this.linkTypeConfigController.invalidateConfiguredLinkTypesCache();
|
|
46
|
+
this.updatePopoverTarget();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Prepares the editor state before the popover is shown.
|
|
50
|
+
*
|
|
51
|
+
* @returns {Promise<void>} Resolves when the popover show work completes.
|
|
52
|
+
* Resolves when the popover show work completes.
|
|
53
|
+
*/
|
|
54
|
+
async handlePopoverShow() {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
this.linkTypeConfigController.invalidateConfiguredLinkTypesCache();
|
|
57
|
+
this.linkEditorStateManager.clearFormValues();
|
|
58
|
+
if (this.linkEditorStateManager.getShouldResetStatusOnNextShow()) {
|
|
59
|
+
this.linkEditorStateManager.setShouldResetStatusOnNextShow(false);
|
|
60
|
+
if (this.status !== 'editOrUnlinkSelection') {
|
|
61
|
+
this.status = 'editOrUnlinkSelection';
|
|
62
|
+
forceUpdate(this.host);
|
|
63
|
+
await this.waitForRender();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (this.status === 'linkEdit') {
|
|
67
|
+
const resolvedKey = this.linkTypeConfigController.resolveInitialLinkTypeKey((_a = this.record) === null || _a === void 0 ? void 0 : _a.linkType, (_b = this.record) === null || _b === void 0 ? void 0 : _b.url);
|
|
68
|
+
if (resolvedKey !== this.linkEditorStateManager.getSelectedLinkTypeKey()) {
|
|
69
|
+
this.linkEditorStateManager.setSelectedLinkTypeKey(resolvedKey);
|
|
70
|
+
this.linkEditorStateManager.setSubmitDisabled(true);
|
|
71
|
+
await ((_d = (_c = this.renderer.getFormRef()) === null || _c === void 0 ? void 0 : _c.reset) === null || _d === void 0 ? void 0 : _d.call(_c));
|
|
72
|
+
forceUpdate(this.host);
|
|
73
|
+
await this.waitForRender();
|
|
74
|
+
}
|
|
75
|
+
await this.populateEditForm();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Clears form state after the popover hides.
|
|
80
|
+
*
|
|
81
|
+
* @returns {void} No return value.
|
|
82
|
+
*/
|
|
83
|
+
handlePopoverHide() {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
void ((_b = (_a = this.renderer.getFormRef()) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
86
|
+
this.linkEditorStateManager.clearFormValues();
|
|
87
|
+
if (this.linkTypeConfigController.hasConfiguredLinkTypes()) {
|
|
88
|
+
this.updateSubmitDisabledState('');
|
|
89
|
+
}
|
|
90
|
+
if (this.resetStatusAfterHide) {
|
|
91
|
+
this.linkEditorStateManager.setShouldResetStatusOnNextShow(true);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Switches the editor into link edit mode.
|
|
96
|
+
*
|
|
97
|
+
* @returns {void} No return value.
|
|
98
|
+
*/
|
|
99
|
+
handleEditAction() {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
this.linkEditorStateManager.setSelectedLinkTypeKey(this.linkTypeConfigController.resolveInitialLinkTypeKey((_a = this.record) === null || _a === void 0 ? void 0 : _a.linkType, (_b = this.record) === null || _b === void 0 ? void 0 : _b.url));
|
|
102
|
+
this.status = 'linkEdit';
|
|
103
|
+
forceUpdate(this.host);
|
|
104
|
+
void this.waitForRender().then(() => this.populateEditForm());
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Removes the current selection link and closes the popover.
|
|
108
|
+
*
|
|
109
|
+
* @returns {Promise<void>} Resolves when unlinking finishes.
|
|
110
|
+
*/
|
|
111
|
+
async handleUnlinkAction() {
|
|
112
|
+
this.changeEventEmitter.emit({ action: 'unlink' });
|
|
113
|
+
await this.renderer.getPopoverRef().hide();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Updates submit state from URL input changes.
|
|
117
|
+
*
|
|
118
|
+
* @param {CustomEvent<string>} e - URL input change event.
|
|
119
|
+
* @returns {void} No return value.
|
|
120
|
+
*/
|
|
121
|
+
handleUrlVegaChange(e) {
|
|
122
|
+
if (this.linkTypeConfigController.hasConfiguredLinkTypes()) {
|
|
123
|
+
this.updateSubmitDisabledState(e.detail);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Submits the current link when Enter is pressed or hides the popover when Escape is pressed.
|
|
128
|
+
*
|
|
129
|
+
* @param {KeyboardEvent} e - Key down event.
|
|
130
|
+
* @returns {void} No return value.
|
|
131
|
+
*/
|
|
132
|
+
handleKeyDown(e) {
|
|
133
|
+
if (e.key === 'Escape') {
|
|
134
|
+
void this.renderer.getPopoverRef().hide();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (e.key === 'Enter') {
|
|
138
|
+
if (this.linkTypeConfigController.hasConfiguredLinkTypes() &&
|
|
139
|
+
this.linkEditorStateManager.getIsSubmitDisabled()) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
void this.submitLink();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Switches the active form when the link type changes.
|
|
147
|
+
*
|
|
148
|
+
* @param {NotifyObserverPayload<string>} payload - Selected link type change payload.
|
|
149
|
+
* @returns {Promise<void>} Resolves when the link type switch completes.
|
|
150
|
+
*/
|
|
151
|
+
async handleLinkTypeChange(payload) {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
153
|
+
const previousLinkTypeKey = this.linkEditorStateManager.getSelectedLinkTypeKey();
|
|
154
|
+
const nextLinkTypeKey = payload.detail ||
|
|
155
|
+
((_a = this.linkTypeConfigController.getConfiguredLinkTypes()[0]) === null || _a === void 0 ? void 0 : _a.key) ||
|
|
156
|
+
RTE_DEFAULT_LINK_TYPE_KEY;
|
|
157
|
+
if (previousLinkTypeKey === nextLinkTypeKey) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const currentFormValues = (_d = (await ((_c = (_b = this.renderer.getFormRef()) === null || _b === void 0 ? void 0 : _b.getValue) === null || _c === void 0 ? void 0 : _c.call(_b)))) !== null && _d !== void 0 ? _d : {};
|
|
161
|
+
const currentSharedTextValue = (_e = currentFormValues.text) !== null && _e !== void 0 ? _e : this.linkEditorStateManager.getSharedTextValue();
|
|
162
|
+
this.linkEditorStateManager.setSharedTextValue(currentSharedTextValue);
|
|
163
|
+
const currentTypeValues = Object.assign({}, currentFormValues);
|
|
164
|
+
delete currentTypeValues.text;
|
|
165
|
+
const hasAnyValue = Object.values(currentTypeValues).some((value) => value);
|
|
166
|
+
if (hasAnyValue) {
|
|
167
|
+
this.linkEditorStateManager.cacheFormValues(previousLinkTypeKey, currentTypeValues);
|
|
168
|
+
}
|
|
169
|
+
const savedValues = this.linkEditorStateManager.getCachedFormValues(nextLinkTypeKey);
|
|
170
|
+
this.linkEditorStateManager.setSelectedLinkTypeKey(nextLinkTypeKey);
|
|
171
|
+
this.linkEditorStateManager.setSubmitDisabled(true);
|
|
172
|
+
forceUpdate(this.host);
|
|
173
|
+
if (savedValues && ((_f = this.renderer.getFormRef()) === null || _f === void 0 ? void 0 : _f.setValue)) {
|
|
174
|
+
void this.waitForRender().then(() => this.performFormRestore(Object.assign(Object.assign({}, savedValues), { text: this.linkEditorStateManager.getSharedTextValue() })));
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
await ((_h = (_g = this.renderer.getFormRef()) === null || _g === void 0 ? void 0 : _g.reset) === null || _h === void 0 ? void 0 : _h.call(_g));
|
|
178
|
+
void this.waitForRender().then(() => { var _a; return (_a = this.renderer.getUrlInputRef()) === null || _a === void 0 ? void 0 : _a.doFocus(); });
|
|
179
|
+
const sharedTextValue = this.linkEditorStateManager.getSharedTextValue();
|
|
180
|
+
await ((_k = (_j = this.renderer.getFormRef()) === null || _j === void 0 ? void 0 : _j.setValue) === null || _k === void 0 ? void 0 : _k.call(_j, { text: sharedTextValue }));
|
|
181
|
+
this.syncTextInputValue(sharedTextValue);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Builds and emits the final link payload.
|
|
185
|
+
*
|
|
186
|
+
* @returns {Promise<void>} Resolves when the link submit flow completes.
|
|
187
|
+
*/
|
|
188
|
+
async submitLink() {
|
|
189
|
+
var _a, _b, _c, _d;
|
|
190
|
+
const formValues = (_c = (await ((_b = (_a = this.renderer.getFormRef()) === null || _a === void 0 ? void 0 : _a.getValue) === null || _b === void 0 ? void 0 : _b.call(_a)))) !== null && _c !== void 0 ? _c : {};
|
|
191
|
+
const selectedLinkTypeKey = this.linkEditorStateManager.getSelectedLinkTypeKey();
|
|
192
|
+
const handler = this.linkTypeHandlers.get(selectedLinkTypeKey);
|
|
193
|
+
if (!handler) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const deps = {
|
|
197
|
+
normalizeUrl: this.normalizeUrlByDefaultProtocol.bind(this),
|
|
198
|
+
buildEmailUrl: this.buildEmailLinkUrl.bind(this),
|
|
199
|
+
};
|
|
200
|
+
const text = handler.getTextValue(formValues);
|
|
201
|
+
let normalizedUrl = handler.buildFinalUrl(formValues, deps);
|
|
202
|
+
normalizedUrl = this.preserveExistingMailtoUrlIfUnchanged(formValues, normalizedUrl);
|
|
203
|
+
if (normalizedUrl.length === 0) {
|
|
204
|
+
if ((_d = this.record) === null || _d === void 0 ? void 0 : _d.url) {
|
|
205
|
+
this.changeEventEmitter.emit({ action: 'unlink' });
|
|
206
|
+
await this.renderer.getPopoverRef().hide();
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (normalizedUrl.length > 0) {
|
|
211
|
+
this.changeEventEmitter.emit({
|
|
212
|
+
action: 'link',
|
|
213
|
+
payload: Object.assign({ text: text || handler.getFallbackText(formValues) || normalizedUrl, url: normalizedUrl }, (this.linkTypeConfigController.hasConfiguredLinkTypes()
|
|
214
|
+
? { linkType: selectedLinkTypeKey }
|
|
215
|
+
: {})),
|
|
216
|
+
});
|
|
217
|
+
await this.renderer.getPopoverRef().hide();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Populates the edit form from the active record.
|
|
222
|
+
*
|
|
223
|
+
* @returns {Promise<void>} Resolves when the edit form is populated.
|
|
224
|
+
*/
|
|
225
|
+
async populateEditForm() {
|
|
226
|
+
var _a, _b, _c, _d, _e;
|
|
227
|
+
const handler = this.linkTypeHandlers.get(this.linkEditorStateManager.getSelectedLinkTypeKey());
|
|
228
|
+
if (!handler) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const deps = {
|
|
232
|
+
parseMailtoUrl: this.parseMailtoUrl.bind(this),
|
|
233
|
+
normalizeUrl: this.normalizeUrlByDefaultProtocol.bind(this),
|
|
234
|
+
};
|
|
235
|
+
const requiredValue = this.linkTypeConfigController.hasConfiguredLinkTypes()
|
|
236
|
+
? handler.getRequiredValue(this.record, deps)
|
|
237
|
+
: '';
|
|
238
|
+
const initialFormValues = handler.getInitialFormValues(this.record, deps);
|
|
239
|
+
this.linkEditorStateManager.setSharedTextValue(initialFormValues.text || '');
|
|
240
|
+
await ((_b = (_a = this.renderer.getFormRef()) === null || _a === void 0 ? void 0 : _a.setValue) === null || _b === void 0 ? void 0 : _b.call(_a, initialFormValues));
|
|
241
|
+
this.syncTextInputValue(initialFormValues.text || '');
|
|
242
|
+
this.updateSubmitDisabledState(requiredValue);
|
|
243
|
+
await ((_d = (_c = this.renderer.getFormRef()) === null || _c === void 0 ? void 0 : _c.setValue) === null || _d === void 0 ? void 0 : _d.call(_c, handler.getInitialFormValues(this.record, deps)));
|
|
244
|
+
await ((_e = this.renderer.getUrlInputRef()) === null || _e === void 0 ? void 0 : _e.doFocus());
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Updates the popover target via the remote invocation registry.
|
|
248
|
+
*
|
|
249
|
+
* @returns {void} No return value.
|
|
250
|
+
*/
|
|
251
|
+
updatePopoverTarget() {
|
|
252
|
+
remoteInvocationRegistry.call(domNodeSubjectFactory.getSubject(this.renderer.getPopoverRef(), VegaInternalPopoverUpdateTarget), this.target);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Preserves an unchanged mailto URL when the form edits are equivalent.
|
|
256
|
+
*
|
|
257
|
+
* @param {Record<string, string>} formValues - Current form values.
|
|
258
|
+
* @param {string} normalizedUrl - Normalized URL candidate.
|
|
259
|
+
* @returns {string} The preserved or normalized URL.
|
|
260
|
+
*/
|
|
261
|
+
preserveExistingMailtoUrlIfUnchanged(formValues, normalizedUrl) {
|
|
262
|
+
var _a;
|
|
263
|
+
if (this.linkEditorStateManager.getSelectedLinkTypeKey() !== RTE_EMAIL_LINK_TYPE_KEY ||
|
|
264
|
+
!((_a = this.record) === null || _a === void 0 ? void 0 : _a.url)) {
|
|
265
|
+
return normalizedUrl;
|
|
266
|
+
}
|
|
267
|
+
const existingUrl = this.record.url;
|
|
268
|
+
if (!existingUrl.startsWith('mailto:')) {
|
|
269
|
+
return normalizedUrl;
|
|
270
|
+
}
|
|
271
|
+
const existingMailto = this.parseMailtoUrl(existingUrl);
|
|
272
|
+
const nextEmailAddress = (formValues.emailAddress || '').trim();
|
|
273
|
+
const nextSubject = (formValues.messageSubject || '').trim();
|
|
274
|
+
const nextBody = (formValues.messageBody || '').trim();
|
|
275
|
+
if (nextEmailAddress === existingMailto.emailAddress &&
|
|
276
|
+
nextSubject === existingMailto.subject &&
|
|
277
|
+
nextBody === existingMailto.body) {
|
|
278
|
+
return existingUrl;
|
|
279
|
+
}
|
|
280
|
+
return normalizedUrl;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Normalizes a URL using the currently selected link type protocol.
|
|
284
|
+
*
|
|
285
|
+
* @param {string} url - URL to normalize.
|
|
286
|
+
* @returns {string} The normalized URL.
|
|
287
|
+
*/
|
|
288
|
+
normalizeUrlByDefaultProtocol(url) {
|
|
289
|
+
return this.linkUrlNormalizer.normalizeUrlByDefaultProtocol(url, this.linkTypeConfigController.getDefaultProtocolForLinkType(this.linkEditorStateManager.getSelectedLinkTypeKey()));
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Parses a mailto URL into structured parts.
|
|
293
|
+
*
|
|
294
|
+
* @param {string} url - Mailto URL to parse.
|
|
295
|
+
* @returns {MailtoUrlParts} The parsed mailto parts.
|
|
296
|
+
*/
|
|
297
|
+
parseMailtoUrl(url) {
|
|
298
|
+
return this.linkUrlNormalizer.parseMailtoUrl(url);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Builds a mailto URL from the email form fields.
|
|
302
|
+
*
|
|
303
|
+
* @param {string} emailAddress - Email address value.
|
|
304
|
+
* @param {string} subject - Subject value.
|
|
305
|
+
* @param {string} body - Body value.
|
|
306
|
+
* @returns {string} The generated mailto URL.
|
|
307
|
+
*/
|
|
308
|
+
buildEmailLinkUrl(emailAddress, subject, body) {
|
|
309
|
+
return this.linkUrlNormalizer.buildEmailLinkUrl(emailAddress, subject, body);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Enables or disables submit based on the normalized URL value.
|
|
313
|
+
*
|
|
314
|
+
* @param {string} url - URL value to evaluate.
|
|
315
|
+
* @returns {void} No return value.
|
|
316
|
+
*/
|
|
317
|
+
updateSubmitDisabledState(url) {
|
|
318
|
+
const nextDisabled = this.normalizeUrlByDefaultProtocol(url).length === 0;
|
|
319
|
+
if (this.linkEditorStateManager.getIsSubmitDisabled() !== nextDisabled) {
|
|
320
|
+
this.linkEditorStateManager.setSubmitDisabled(nextDisabled);
|
|
321
|
+
forceUpdate(this.host);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Restores cached form values after the next render.
|
|
326
|
+
*
|
|
327
|
+
* @param {Record<string, string>} savedValues - Link type-specific values to restore.
|
|
328
|
+
* @returns {Promise<void>} Resolves after restoring cached values.
|
|
329
|
+
*/
|
|
330
|
+
async performFormRestore(savedValues) {
|
|
331
|
+
var _a, _b, _c, _d, _e;
|
|
332
|
+
await ((_b = (_a = this.renderer.getFormRef()) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
333
|
+
await ((_d = (_c = this.renderer.getFormRef()) === null || _c === void 0 ? void 0 : _c.setValue) === null || _d === void 0 ? void 0 : _d.call(_c, savedValues));
|
|
334
|
+
this.syncTextInputValue(savedValues.text || '');
|
|
335
|
+
const restoredRequiredValue = savedValues.url || savedValues.emailAddress || '';
|
|
336
|
+
this.updateSubmitDisabledState(restoredRequiredValue);
|
|
337
|
+
await ((_e = this.renderer.getUrlInputRef()) === null || _e === void 0 ? void 0 : _e.doFocus());
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Keeps text input UI in sync as a fallback when form setValue timing misses visual update.
|
|
341
|
+
*
|
|
342
|
+
* @param {string} textValue - Text value to display.
|
|
343
|
+
* @returns {void} No return value.
|
|
344
|
+
*/
|
|
345
|
+
syncTextInputValue(textValue) {
|
|
346
|
+
const textInput = this.renderer.getTextInputRef();
|
|
347
|
+
if (textInput) {
|
|
348
|
+
textInput.value = textValue;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Waits for the host to finish rendering.
|
|
353
|
+
*
|
|
354
|
+
* @returns {Promise<unknown>} A promise that resolves after the host renders.
|
|
355
|
+
*/
|
|
356
|
+
waitForRender() {
|
|
357
|
+
return waitForComponentDidRender(this.host);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
__decorate([
|
|
361
|
+
MapToComponentField()
|
|
362
|
+
], LinkEditorController.prototype, "host", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
MapToComponentField({ writable: true })
|
|
365
|
+
], LinkEditorController.prototype, "status", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
MapToComponentField()
|
|
368
|
+
], LinkEditorController.prototype, "record", void 0);
|
|
369
|
+
__decorate([
|
|
370
|
+
MapToComponentField()
|
|
371
|
+
], LinkEditorController.prototype, "changeEventEmitter", void 0);
|
|
372
|
+
__decorate([
|
|
373
|
+
MapToComponentField()
|
|
374
|
+
], LinkEditorController.prototype, "resetStatusAfterHide", void 0);
|
|
375
|
+
__decorate([
|
|
376
|
+
MapToComponentField()
|
|
377
|
+
], LinkEditorController.prototype, "target", void 0);
|
|
378
|
+
__decorate([
|
|
379
|
+
MapToComponentField()
|
|
380
|
+
], LinkEditorController.prototype, "renderer", void 0);
|
|
381
|
+
__decorate([
|
|
382
|
+
MapToComponentField()
|
|
383
|
+
], LinkEditorController.prototype, "linkTypeConfigController", void 0);
|
|
384
|
+
__decorate([
|
|
385
|
+
MapToComponentField()
|
|
386
|
+
], LinkEditorController.prototype, "linkEditorStateManager", void 0);
|
|
387
|
+
__decorate([
|
|
388
|
+
MapToComponentMethod('componentDidLoad')
|
|
389
|
+
], LinkEditorController.prototype, "componentDidLoad", null);
|
|
390
|
+
__decorate([
|
|
391
|
+
MapToComponentMethod('componentDidRender')
|
|
392
|
+
], LinkEditorController.prototype, "componentDidRender", null);
|
|
393
|
+
__decorate([
|
|
394
|
+
MapToComponentMethod('watchStatusChange')
|
|
395
|
+
], LinkEditorController.prototype, "watchStatusChange", null);
|
|
396
|
+
__decorate([
|
|
397
|
+
MapToComponentMethod('watchTargetChange')
|
|
398
|
+
], LinkEditorController.prototype, "watchTargetChange", null);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { VegaSlimmer } from 'vega-slimmer/core';
|
|
2
|
+
import { RTE_DEFAULT_LINK_TYPE_KEY } from '../../../constants/constant';
|
|
3
|
+
/**
|
|
4
|
+
* Stores link editor state across popover interactions.
|
|
5
|
+
*/
|
|
6
|
+
export class LinkEditorStateManager extends VegaSlimmer {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.isSubmitDisabled = true;
|
|
10
|
+
this.selectedLinkTypeKey = RTE_DEFAULT_LINK_TYPE_KEY;
|
|
11
|
+
this.shouldResetStatusOnNextShow = false;
|
|
12
|
+
this.formValuesByType = new Map();
|
|
13
|
+
this.sharedTextValue = '';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns whether submit is currently disabled.
|
|
17
|
+
*
|
|
18
|
+
* @returns {boolean} True when submit is disabled.
|
|
19
|
+
*/
|
|
20
|
+
getIsSubmitDisabled() {
|
|
21
|
+
return this.isSubmitDisabled;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Updates the submit disabled state.
|
|
25
|
+
*
|
|
26
|
+
* @param {boolean} isSubmitDisabled - Next disabled state.
|
|
27
|
+
* @returns {void} No return value.
|
|
28
|
+
*/
|
|
29
|
+
setSubmitDisabled(isSubmitDisabled) {
|
|
30
|
+
this.isSubmitDisabled = isSubmitDisabled;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the selected link type key.
|
|
34
|
+
*
|
|
35
|
+
* @returns {string} The selected link type key.
|
|
36
|
+
*/
|
|
37
|
+
getSelectedLinkTypeKey() {
|
|
38
|
+
return this.selectedLinkTypeKey;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Updates the selected link type key.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} selectedLinkTypeKey - Next link type key.
|
|
44
|
+
* @returns {void} No return value.
|
|
45
|
+
*/
|
|
46
|
+
setSelectedLinkTypeKey(selectedLinkTypeKey) {
|
|
47
|
+
this.selectedLinkTypeKey = selectedLinkTypeKey;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns whether the status should reset on the next show.
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} True when the next show should reset the status.
|
|
53
|
+
*/
|
|
54
|
+
getShouldResetStatusOnNextShow() {
|
|
55
|
+
return this.shouldResetStatusOnNextShow;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Updates whether the status should reset on the next show.
|
|
59
|
+
*
|
|
60
|
+
* @param {boolean} shouldResetStatusOnNextShow - Next reset flag.
|
|
61
|
+
* @returns {void} No return value.
|
|
62
|
+
*/
|
|
63
|
+
setShouldResetStatusOnNextShow(shouldResetStatusOnNextShow) {
|
|
64
|
+
this.shouldResetStatusOnNextShow = shouldResetStatusOnNextShow;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Clears all cached form values.
|
|
68
|
+
*
|
|
69
|
+
* @returns {void} No return value.
|
|
70
|
+
*/
|
|
71
|
+
clearFormValues() {
|
|
72
|
+
this.formValuesByType.clear();
|
|
73
|
+
this.sharedTextValue = '';
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns the text value shared across link types.
|
|
77
|
+
*
|
|
78
|
+
* @returns {string} Shared text value.
|
|
79
|
+
*/
|
|
80
|
+
getSharedTextValue() {
|
|
81
|
+
return this.sharedTextValue;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Updates the text value shared across link types.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} textValue - Next shared text value.
|
|
87
|
+
* @returns {void} No return value.
|
|
88
|
+
*/
|
|
89
|
+
setSharedTextValue(textValue) {
|
|
90
|
+
this.sharedTextValue = textValue;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Stores form values for a given link type key.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} linkTypeKey - Link type cache key.
|
|
96
|
+
* @param {Record<string, string>} formValues - Form values to cache.
|
|
97
|
+
* @returns {void} No return value.
|
|
98
|
+
*/
|
|
99
|
+
cacheFormValues(linkTypeKey, formValues) {
|
|
100
|
+
this.formValuesByType.set(linkTypeKey, formValues);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns cached form values for a given link type key.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} linkTypeKey - Link type cache key.
|
|
106
|
+
* @returns {Record<string, string> | undefined} The cached form values, if any.
|
|
107
|
+
*/
|
|
108
|
+
getCachedFormValues(linkTypeKey) {
|
|
109
|
+
return this.formValuesByType.get(linkTypeKey);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
|
|
8
|
+
import { findParent } from '../../../../../utils/ui';
|
|
9
|
+
import { VegaRTELinkExtension } from '../../../extensions/link/link-extension';
|
|
10
|
+
import { LINK_TYPE_HANDLER_MAP } from '../renderers/link-type-handler';
|
|
11
|
+
import { RTE_DEFAULT_LINK_TYPE_KEY, RTE_EMAIL_LINK_TYPE_KEY, RTE_SUPPORTED_LINK_TYPE_KEYS, } from '../../../constants/constant';
|
|
12
|
+
/**
|
|
13
|
+
* Resolves configured link types and their defaults.
|
|
14
|
+
*/
|
|
15
|
+
export class LinkTypeConfigController extends VegaSlimmer {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.configuredLinkTypesCache = null;
|
|
19
|
+
this.linkTypeHandlers = LINK_TYPE_HANDLER_MAP;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns the configured link types, using a cache when available.
|
|
23
|
+
*
|
|
24
|
+
* @returns {VegaRTELinkType[]} The configured link types.
|
|
25
|
+
*/
|
|
26
|
+
getConfiguredLinkTypes() {
|
|
27
|
+
if (this.configuredLinkTypesCache) {
|
|
28
|
+
return this.configuredLinkTypesCache;
|
|
29
|
+
}
|
|
30
|
+
const configuredLinkTypes = this.resolveConfiguredLinkTypes();
|
|
31
|
+
this.configuredLinkTypesCache = configuredLinkTypes;
|
|
32
|
+
return configuredLinkTypes;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Clears the cached configured link types.
|
|
36
|
+
*
|
|
37
|
+
* @returns {void} No return value.
|
|
38
|
+
*/
|
|
39
|
+
invalidateConfiguredLinkTypesCache() {
|
|
40
|
+
this.configuredLinkTypesCache = null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the initial link type key for the current record.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} recordLinkType - Link type from the active record.
|
|
46
|
+
* @param {string} recordUrl - URL from the active record.
|
|
47
|
+
* @returns {string} The resolved initial link type key.
|
|
48
|
+
*/
|
|
49
|
+
resolveInitialLinkTypeKey(recordLinkType, recordUrl) {
|
|
50
|
+
var _a;
|
|
51
|
+
const configuredLinkTypes = this.getConfiguredLinkTypes();
|
|
52
|
+
if (recordLinkType &&
|
|
53
|
+
configuredLinkTypes.some((item) => item.key === recordLinkType)) {
|
|
54
|
+
return recordLinkType;
|
|
55
|
+
}
|
|
56
|
+
const normalizedRecordUrl = (recordUrl || '').trim().toLowerCase();
|
|
57
|
+
if (normalizedRecordUrl.startsWith('mailto:') &&
|
|
58
|
+
configuredLinkTypes.some((item) => item.key === RTE_EMAIL_LINK_TYPE_KEY)) {
|
|
59
|
+
return RTE_EMAIL_LINK_TYPE_KEY;
|
|
60
|
+
}
|
|
61
|
+
return ((_a = configuredLinkTypes[0]) === null || _a === void 0 ? void 0 : _a.key) || RTE_DEFAULT_LINK_TYPE_KEY;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns whether any configured link types are available.
|
|
65
|
+
*
|
|
66
|
+
* @returns {boolean} True when configured link types exist.
|
|
67
|
+
*/
|
|
68
|
+
hasConfiguredLinkTypes() {
|
|
69
|
+
return this.getConfiguredLinkTypes().length > 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns the default protocol for a given link type key.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} selectedLinkTypeKey - Selected link type key.
|
|
75
|
+
* @returns {string | undefined} The default protocol, if configured.
|
|
76
|
+
*/
|
|
77
|
+
getDefaultProtocolForLinkType(selectedLinkTypeKey) {
|
|
78
|
+
var _a;
|
|
79
|
+
const linkConfig = this.getLinkConfig();
|
|
80
|
+
const selectedLinkType = this.getConfiguredLinkTypes().find((item) => item.key === selectedLinkTypeKey);
|
|
81
|
+
return (_a = selectedLinkType === null || selectedLinkType === void 0 ? void 0 : selectedLinkType.defaultProtocol) !== null && _a !== void 0 ? _a : linkConfig.defaultProtocol;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns the active link configuration for the current editor host.
|
|
85
|
+
*
|
|
86
|
+
* @returns {VegaRTELinkExtensionConfig} The active link configuration.
|
|
87
|
+
*/
|
|
88
|
+
getLinkConfig() {
|
|
89
|
+
const rteHost = findParent(this.host, 'vega-rich-text-editor');
|
|
90
|
+
return VegaRTELinkExtension.configStore.get(rteHost) || {};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Normalizes configured link types and filters unsupported entries.
|
|
94
|
+
*
|
|
95
|
+
* @returns {VegaRTELinkType[]} The normalized configured link types.
|
|
96
|
+
*/
|
|
97
|
+
resolveConfiguredLinkTypes() {
|
|
98
|
+
const linkConfig = this.getLinkConfig();
|
|
99
|
+
const configLinkTypes = linkConfig.linkTypes || [];
|
|
100
|
+
const normalizedByKey = new Map();
|
|
101
|
+
configLinkTypes.forEach((item) => {
|
|
102
|
+
const key = item.key.trim();
|
|
103
|
+
if (!key || !LinkTypeConfigController.SUPPORTED_LINK_TYPE_KEYS.has(key)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!normalizedByKey.has(key)) {
|
|
107
|
+
normalizedByKey.set(key, this.normalizeSupportedLinkType(item, key, linkConfig.defaultProtocol));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (normalizedByKey.size === 0) {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
if (normalizedByKey.has(RTE_EMAIL_LINK_TYPE_KEY)) {
|
|
114
|
+
return [
|
|
115
|
+
normalizedByKey.get(RTE_DEFAULT_LINK_TYPE_KEY) ||
|
|
116
|
+
this.createDefaultUrlLinkType(linkConfig.defaultProtocol),
|
|
117
|
+
normalizedByKey.get(RTE_EMAIL_LINK_TYPE_KEY),
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
return [
|
|
121
|
+
normalizedByKey.get(RTE_DEFAULT_LINK_TYPE_KEY) ||
|
|
122
|
+
this.createDefaultUrlLinkType(linkConfig.defaultProtocol),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates the default URL link type descriptor.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} configDefaultProtocol - Default protocol from config.
|
|
129
|
+
* @returns {VegaRTELinkType} The default URL link type descriptor.
|
|
130
|
+
*/
|
|
131
|
+
createDefaultUrlLinkType(configDefaultProtocol) {
|
|
132
|
+
const normalizedConfigDefaultProtocol = (configDefaultProtocol || '').trim();
|
|
133
|
+
return {
|
|
134
|
+
key: RTE_DEFAULT_LINK_TYPE_KEY,
|
|
135
|
+
label: this.translationSlimmer.t('URL'),
|
|
136
|
+
defaultProtocol: normalizedConfigDefaultProtocol || undefined,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Normalizes a supported link type while preserving its key.
|
|
141
|
+
*
|
|
142
|
+
* @param {VegaRTELinkType} item - Raw configured link type.
|
|
143
|
+
* @param {string} key - Normalized link type key.
|
|
144
|
+
* @param {string} configDefaultProtocol - Default protocol from config.
|
|
145
|
+
* @returns {VegaRTELinkType} The normalized link type descriptor.
|
|
146
|
+
*/
|
|
147
|
+
normalizeSupportedLinkType(item, key, configDefaultProtocol) {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
const normalizedItemDefaultProtocol = (item.defaultProtocol || '').trim();
|
|
150
|
+
const normalizedConfigDefaultProtocol = (configDefaultProtocol || '').trim();
|
|
151
|
+
const handler = this.linkTypeHandlers.get(key);
|
|
152
|
+
const fallbackDefaultProtocol = (_a = handler === null || handler === void 0 ? void 0 : handler.defaultFallbackProtocol) !== null && _a !== void 0 ? _a : (normalizedConfigDefaultProtocol || undefined);
|
|
153
|
+
return Object.assign(Object.assign({}, item), { key, label: ((_b = item.label) === null || _b === void 0 ? void 0 : _b.trim()) || this.getDefaultLinkTypeLabel(key), defaultProtocol: normalizedItemDefaultProtocol || fallbackDefaultProtocol });
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Returns the translated default label for a link type key.
|
|
157
|
+
*
|
|
158
|
+
* @param {string} key - Link type key.
|
|
159
|
+
* @returns {string} The translated label for the link type.
|
|
160
|
+
*/
|
|
161
|
+
getDefaultLinkTypeLabel(key) {
|
|
162
|
+
return key === RTE_EMAIL_LINK_TYPE_KEY
|
|
163
|
+
? this.translationSlimmer.t('Email')
|
|
164
|
+
: this.translationSlimmer.t('URL');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
LinkTypeConfigController.SUPPORTED_LINK_TYPE_KEYS = new Set(RTE_SUPPORTED_LINK_TYPE_KEYS);
|
|
168
|
+
__decorate([
|
|
169
|
+
MapToComponentField()
|
|
170
|
+
], LinkTypeConfigController.prototype, "host", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
MapToComponentField()
|
|
173
|
+
], LinkTypeConfigController.prototype, "translationSlimmer", void 0);
|