@globalpayments/vega 2.53.0 → 2.54.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-4ecf85bb.js → app-globals-f1ff47e3.js} +1 -1
- package/dist/cjs/{selection-controller-1d7c0999.js → component-value-history-controller-slimmer.abstract-6bfb9145.js} +82 -0
- package/dist/cjs/{design-token-3f4f0bc3.js → design-token-d15e60fa.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-1946ff07.js → element-appender-slimmer-2f16891f.js} +3 -3
- package/dist/cjs/{form-field-controller-slimmer-e721359b.js → form-field-controller-slimmer-dc6d0fe1.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/{inject-keyboard-manager-dd628ccc.js → inject-keyboard-manager-11df8296.js} +1 -1
- package/dist/cjs/{keyboard-manager-8c74eeb9.js → keyboard-manager-1843112c.js} +6 -0
- package/dist/cjs/{keyboard-manager-slimmer-eb364bee.js → keyboard-manager-slimmer-0a5f5770.js} +1 -1
- package/dist/cjs/loader.cjs.js +5 -4
- package/dist/cjs/{page-resize-observer-slimmer-efa79728.js → page-resize-observer-slimmer-11937d6f.js} +3 -3
- package/dist/cjs/{responsive-format-facade-6b81192d.js → responsive-format-facade-4a19e115.js} +2 -2
- package/dist/cjs/{style-formatter-497d0fa4.js → style-formatter-b8cea5ee.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +5 -5
- package/dist/cjs/vega-app-footer.cjs.entry.js +2 -2
- package/dist/cjs/vega-app-header-button.cjs.entry.js +4 -4
- package/dist/cjs/vega-box.cjs.entry.js +6 -5
- package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +4 -4
- package/dist/cjs/vega-calendar_3.cjs.entry.js +1 -1
- package/dist/cjs/vega-card.cjs.entry.js +5 -4
- package/dist/cjs/vega-carousel.cjs.entry.js +22 -23
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +210 -94
- package/dist/cjs/vega-color-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-combo-box.cjs.entry.js +5 -5
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-dialog_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-divider.cjs.entry.js +5 -4
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +24 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -4
- package/dist/cjs/vega-flex.cjs.entry.js +6 -5
- package/dist/cjs/vega-font.cjs.entry.js +5 -4
- package/dist/cjs/vega-form.cjs.entry.js +3 -3
- package/dist/cjs/vega-grid.cjs.entry.js +5 -4
- package/dist/cjs/vega-icon.cjs.entry.js +4 -4
- package/dist/cjs/vega-image-uploader.cjs.entry.js +5 -5
- 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-phone-number.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-range.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-select.cjs.entry.js +5 -5
- package/dist/cjs/vega-input.cjs.entry.js +2 -2
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +6 -6
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +4 -3
- package/dist/cjs/vega-pagination.cjs.entry.js +3 -3
- package/dist/cjs/vega-popover_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-radio_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +28 -4
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +37 -75
- package/dist/cjs/vega-segment-control.cjs.entry.js +1 -1
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +4 -4
- package/dist/cjs/vega-signature-capture.cjs.entry.js +5 -5
- package/dist/cjs/{vega-skeleton-loader-controller-ae2ab090.js → vega-skeleton-loader-controller-3833c813.js} +1 -1
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_8.cjs.entry.js +4 -4
- package/dist/cjs/vega-text.cjs.entry.js +2 -1
- package/dist/cjs/vega-textarea.cjs.entry.js +3 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -6
- package/dist/cjs/vega.cjs.js +5 -4
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +43 -3
- package/dist/collection/components/vega-app-header-button/vega-app-header-button.js +1 -1
- package/dist/collection/components/vega-carousel/vega-carousel.js +19 -19
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-history-controller.js +88 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +36 -23
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.js +11 -1
- package/dist/collection/components/vega-code-block/vega-code-block.js +5 -0
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-list-renderer.js +4 -1
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +29 -0
- package/dist/collection/components/vega-nav/vega-left-nav-link/vega-left-nav-link.css +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +28 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/history-controller.js +28 -67
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +2 -2
- package/dist/collection/components/vega-virtual-scroll/slimmers/controllers/vega-virtual-scroll-mode-controller.js +4 -1
- package/dist/collection/components/vega-virtual-scroll/vega-virtual-scroll.js +2 -1
- package/dist/collection/helpers/keyboard/keyboard-manager.js +6 -0
- package/dist/collection/helpers/keyboard/test/keyboard-manager.test.js +31 -0
- package/dist/collection/helpers/slimmers/component-value-history-controller-slimmer.abstract.js +81 -0
- package/dist/collection/helpers/slimmers/page-resize-observer-slimmer.js +3 -3
- package/dist/collection/helpers/slimmers/test/page-resize-observer-slimmer.test.js +56 -0
- package/dist/esm/{app-globals-d96d623d.js → app-globals-4881974a.js} +1 -1
- package/dist/esm/{selection-controller-3d6dfc87.js → component-value-history-controller-slimmer.abstract-0a0ef33f.js} +82 -1
- package/dist/esm/{design-token-2060cd0d.js → design-token-9bbefd23.js} +1 -1
- package/dist/esm/{element-appender-slimmer-dbdad1df.js → element-appender-slimmer-8652e8d7.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-846cda92.js → form-field-controller-slimmer-6f49d396.js} +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/{inject-keyboard-manager-e39c0fd9.js → inject-keyboard-manager-a15cf43c.js} +1 -1
- package/dist/esm/{keyboard-manager-9564ad83.js → keyboard-manager-f496a623.js} +6 -0
- package/dist/esm/{keyboard-manager-slimmer-2218e6ba.js → keyboard-manager-slimmer-a4cc9593.js} +1 -1
- package/dist/esm/loader.js +5 -4
- package/dist/esm/{page-resize-observer-slimmer-c51f1912.js → page-resize-observer-slimmer-0bf7fbf3.js} +3 -3
- package/dist/esm/{responsive-format-facade-8c0ce819.js → responsive-format-facade-bcc2fd21.js} +2 -2
- package/dist/esm/{style-formatter-1eca1299.js → style-formatter-00d6c32f.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +5 -5
- package/dist/esm/vega-app-footer.entry.js +2 -2
- package/dist/esm/vega-app-header-button.entry.js +4 -4
- package/dist/esm/vega-box.entry.js +6 -5
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +4 -4
- package/dist/esm/vega-calendar_3.entry.js +1 -1
- package/dist/esm/vega-card.entry.js +5 -4
- package/dist/esm/vega-carousel.entry.js +22 -23
- package/dist/esm/vega-checkbox_2.entry.js +3 -3
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +207 -91
- package/dist/esm/vega-color-picker.entry.js +3 -3
- package/dist/esm/vega-combo-box.entry.js +5 -5
- package/dist/esm/vega-date-picker_2.entry.js +8 -8
- package/dist/esm/vega-dialog_2.entry.js +5 -5
- package/dist/esm/vega-divider.entry.js +5 -4
- package/dist/esm/vega-dropdown_5.entry.js +24 -9
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +5 -4
- package/dist/esm/vega-flex.entry.js +6 -5
- package/dist/esm/vega-font.entry.js +5 -4
- package/dist/esm/vega-form.entry.js +3 -3
- package/dist/esm/vega-grid.entry.js +5 -4
- package/dist/esm/vega-icon.entry.js +4 -4
- package/dist/esm/vega-image-uploader.entry.js +5 -5
- package/dist/esm/vega-input-credit-card.entry.js +3 -3
- package/dist/esm/vega-input-numeric.entry.js +4 -4
- package/dist/esm/vega-input-phone-number.entry.js +4 -4
- package/dist/esm/vega-input-range.entry.js +2 -2
- package/dist/esm/vega-input-select.entry.js +5 -5
- package/dist/esm/vega-input.entry.js +2 -2
- package/dist/esm/vega-left-nav_5.entry.js +6 -6
- package/dist/esm/vega-loader-wrapper_2.entry.js +4 -3
- package/dist/esm/vega-pagination.entry.js +3 -3
- package/dist/esm/vega-popover_2.entry.js +6 -6
- package/dist/esm/vega-radio_2.entry.js +4 -4
- package/dist/esm/vega-rich-text-content.entry.js +28 -4
- package/dist/esm/vega-rich-text-editor_4.entry.js +35 -73
- package/dist/esm/vega-segment-control.entry.js +1 -1
- package/dist/esm/vega-selection-chip_2.entry.js +5 -5
- package/dist/esm/vega-selection-tile_2.entry.js +2 -2
- package/dist/esm/vega-sidenav_3.entry.js +4 -4
- package/dist/esm/vega-signature-capture.entry.js +5 -5
- package/dist/esm/{vega-skeleton-loader-controller-06f48dd2.js → vega-skeleton-loader-controller-9d1ffa6c.js} +1 -1
- package/dist/esm/vega-stepper.entry.js +3 -3
- package/dist/esm/vega-tab-group_2.entry.js +2 -2
- package/dist/esm/vega-table_8.entry.js +4 -4
- package/dist/esm/vega-text.entry.js +2 -1
- package/dist/esm/vega-textarea.entry.js +3 -3
- package/dist/esm/vega-time-picker_2.entry.js +8 -8
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +7 -6
- package/dist/esm/vega.js +5 -4
- package/dist/types/components/vega-app-footer/types.d.ts +1 -0
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +12 -0
- package/dist/types/components/vega-app-header-button/types.d.ts +1 -0
- package/dist/types/components/vega-carousel/vega-carousel.d.ts +1 -1
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-history-controller.d.ts +47 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.d.ts +8 -1
- package/dist/types/components/vega-code-block/vega-code-block.d.ts +2 -0
- 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 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/history-controller.d.ts +8 -19
- package/dist/types/components/vega-virtual-scroll/vega-virtual-scroll.d.ts +1 -0
- package/dist/types/components.d.ts +32 -2
- package/dist/types/helpers/slimmers/component-value-history-controller-slimmer.abstract.d.ts +48 -0
- package/dist/types/utils/timer.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-05588c85.entry.js → p-002062c3.entry.js} +1 -1
- package/dist/vega/{p-2490a391.entry.js → p-063d0bee.entry.js} +1 -1
- package/dist/vega/{p-029300db.entry.js → p-0e8324f2.entry.js} +1 -1
- package/dist/vega/{p-62734ef7.entry.js → p-13ca73c7.entry.js} +1 -1
- package/dist/vega/p-1b165fbb.entry.js +1 -0
- package/dist/vega/{p-2a4c313e.entry.js → p-1d41f551.entry.js} +1 -1
- package/dist/vega/p-1e4b6f0a.entry.js +1 -0
- package/dist/vega/{p-abac6b00.entry.js → p-23064067.entry.js} +1 -1
- package/dist/vega/{p-a2d47741.entry.js → p-246090cf.entry.js} +1 -1
- package/dist/vega/{p-5f594deb.entry.js → p-29262ad6.entry.js} +1 -1
- package/dist/vega/p-327be043.js +1 -0
- package/dist/vega/p-43ba9a8a.entry.js +1 -0
- package/dist/vega/{p-685939dc.entry.js → p-468bf93a.entry.js} +1 -1
- package/dist/vega/{p-310f0791.entry.js → p-4df90a1b.entry.js} +1 -1
- package/dist/vega/p-4f5079bc.entry.js +1 -0
- package/dist/vega/p-547692bf.entry.js +1 -0
- package/dist/vega/{p-e00da6d4.entry.js → p-56dc1345.entry.js} +1 -1
- package/dist/vega/{p-06db5a2e.entry.js → p-57005931.entry.js} +1 -1
- package/dist/vega/p-5a6b8846.entry.js +1 -0
- package/dist/vega/p-5e8e4aba.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-888e3f52.entry.js → p-61e1e356.entry.js} +1 -1
- package/dist/vega/p-6bd7114d.entry.js +1 -0
- package/dist/vega/{p-10edaab7.entry.js → p-72e14f49.entry.js} +1 -1
- package/dist/vega/p-73821eba.entry.js +1 -0
- package/dist/vega/{p-75855aaf.entry.js → p-7704a608.entry.js} +1 -1
- package/dist/vega/{p-7f2c98df.entry.js → p-78937642.entry.js} +1 -1
- package/dist/vega/{p-ca0294c9.entry.js → p-79370ad4.entry.js} +1 -1
- package/dist/vega/p-7cb11f3f.entry.js +1 -0
- package/dist/vega/p-7d9cd9c8.js +1 -0
- package/dist/vega/{p-40577e8e.js → p-822cd8e5.js} +1 -1
- package/dist/vega/{p-517615af.entry.js → p-8270bb8f.entry.js} +1 -1
- package/dist/vega/{p-c22c628b.entry.js → p-84a31a31.entry.js} +1 -1
- package/dist/vega/{p-092c87b5.entry.js → p-9a0d3d2d.entry.js} +1 -1
- package/dist/vega/p-9dc9fcf3.js +1 -0
- package/dist/vega/{p-fb306e0e.entry.js → p-a2c4c241.entry.js} +1 -1
- package/dist/vega/p-a46ac2eb.js +1 -0
- package/dist/vega/{p-adadb1a1.entry.js → p-a63e2fee.entry.js} +1 -1
- package/dist/vega/p-ad858290.entry.js +1 -0
- package/dist/vega/{p-3e8a8aa5.entry.js → p-b6e0d996.entry.js} +1 -1
- package/dist/vega/{p-33bd7e31.js → p-b89a9760.js} +1 -1
- package/dist/vega/{p-72eb8998.entry.js → p-bbdc6170.entry.js} +1 -1
- package/dist/vega/{p-35c9cd1d.entry.js → p-c10b4f47.entry.js} +1 -1
- package/dist/vega/{p-eeab4167.entry.js → p-c212a1e3.entry.js} +1 -1
- package/dist/vega/{p-e1ba6325.entry.js → p-c48a8510.entry.js} +1 -1
- package/dist/vega/{p-ab2a6d14.entry.js → p-c5afd9aa.entry.js} +1 -1
- package/dist/vega/{p-efb06a25.entry.js → p-c7e2a155.entry.js} +1 -1
- package/dist/vega/p-c8a87f06.entry.js +1 -0
- package/dist/vega/p-c990e249.js +1 -0
- package/dist/vega/{p-8d3764d3.entry.js → p-ca91268b.entry.js} +1 -1
- package/dist/vega/p-cae183fd.entry.js +1 -0
- package/dist/vega/p-cb36ccf0.entry.js +1 -0
- package/dist/vega/{p-55563f5f.js → p-cc6410e6.js} +1 -1
- package/dist/vega/{p-eb832119.js → p-d5f1794e.js} +1 -1
- package/dist/vega/{p-72e64237.js → p-da1d0c02.js} +1 -1
- package/dist/vega/{p-812b9d6d.entry.js → p-da95668c.entry.js} +1 -1
- package/dist/vega/p-e66f6b59.entry.js +9 -0
- package/dist/vega/p-e8b56d3f.entry.js +1 -0
- package/dist/vega/p-ec3495de.entry.js +1 -0
- package/dist/vega/{p-44dee180.entry.js → p-ecd9a973.entry.js} +1 -1
- package/dist/vega/p-f17c9093.entry.js +1 -0
- package/dist/vega/{p-b13fff4d.entry.js → p-f50cd6c3.entry.js} +1 -1
- package/dist/vega/{p-b4a1a8e1.entry.js → p-f7062473.entry.js} +1 -1
- package/dist/vega/{p-a0dab2d0.js → p-f9cf7e36.js} +1 -1
- package/dist/vega/{p-d8eec0bb.entry.js → p-fc790de5.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-06fb002a.js +0 -1
- package/dist/vega/p-0f034db5.entry.js +0 -1
- package/dist/vega/p-0fb26be0.entry.js +0 -9
- package/dist/vega/p-1df029c2.js +0 -1
- package/dist/vega/p-2f5d9aab.js +0 -1
- package/dist/vega/p-32a24ef1.entry.js +0 -1
- package/dist/vega/p-3a6b4208.entry.js +0 -1
- package/dist/vega/p-3b34389d.js +0 -1
- package/dist/vega/p-52905c68.entry.js +0 -1
- package/dist/vega/p-642da014.entry.js +0 -1
- package/dist/vega/p-65cca90f.js +0 -1
- package/dist/vega/p-7f0def5a.entry.js +0 -1
- package/dist/vega/p-834434d5.js +0 -1
- package/dist/vega/p-8a0d7805.entry.js +0 -1
- package/dist/vega/p-90954fe4.entry.js +0 -1
- package/dist/vega/p-afc49b98.entry.js +0 -1
- package/dist/vega/p-b7594b78.entry.js +0 -1
- package/dist/vega/p-c91190df.entry.js +0 -1
- package/dist/vega/p-cb643d8d.entry.js +0 -1
- package/dist/vega/p-e16e23b7.entry.js +0 -1
- package/dist/vega/p-e5f1fd0b.entry.js +0 -1
- package/dist/vega/p-f2f31686.entry.js +0 -1
- package/dist/vega/p-f41ae5e0.entry.js +0 -1
|
@@ -18,6 +18,7 @@ import { VegaPageUpdate } from '../../helpers/event-manager/event-id/vega-event-
|
|
|
18
18
|
import { createDeprecatedPropertySlimmer, } from '../../helpers/slimmers/deprecated-property-slimmer';
|
|
19
19
|
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../helpers/slimmers/component-usage-runtime-metrics';
|
|
20
20
|
import { VegaCarouselRuntimeMetricsPayloadDefinition } from '../../constants/runtime-metrics-payload-definition/vega-carousel/runtime-metrics-payload-definition';
|
|
21
|
+
import { tryGetDocument } from '../../utils/try-get-document';
|
|
21
22
|
/**
|
|
22
23
|
* @vegaVersion 1.0.2
|
|
23
24
|
*/
|
|
@@ -133,7 +134,7 @@ export class VegaCarousel {
|
|
|
133
134
|
item.gap = this.spacing;
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
|
-
|
|
137
|
+
disconnectedCallback() {
|
|
137
138
|
if (this.mutationObserver) {
|
|
138
139
|
this.mutationObserver.disconnect();
|
|
139
140
|
}
|
|
@@ -233,26 +234,25 @@ export class VegaCarousel {
|
|
|
233
234
|
wrapChildContentAsCarouselItem() {
|
|
234
235
|
const carouselItemWrapperList = [];
|
|
235
236
|
const carouselContentElementArray = this.carouselContentElements;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
if (tryGetDocument()) {
|
|
238
|
+
for (let j = 0; j < this.totalPages; j++) {
|
|
239
|
+
const carouselItemWrapper = tryGetDocument().createElement('vega-grid');
|
|
240
|
+
carouselItemWrapper.setAttribute('gap', this.spacing);
|
|
241
|
+
carouselItemWrapper.setAttribute('column', this.currentItemsPerPage.toString());
|
|
242
|
+
carouselItemWrapper.setAttribute('row', '1');
|
|
243
|
+
for (let i = j * this.currentItemsPerPage; i < carouselContentElementArray.length && i < this.currentItemsPerPage * (j + 1); i++) {
|
|
244
|
+
const divInner = tryGetDocument().createElement('div');
|
|
245
|
+
divInner.appendChild(carouselContentElementArray[i]);
|
|
246
|
+
carouselItemWrapper.appendChild(divInner);
|
|
247
|
+
}
|
|
248
|
+
const divOuter = tryGetDocument().createElement('div');
|
|
249
|
+
divOuter.classList.add('carousel-item');
|
|
250
|
+
j === 0 && divOuter.classList.add('active');
|
|
251
|
+
divOuter.appendChild(carouselItemWrapper);
|
|
252
|
+
carouselItemWrapperList.push(divOuter);
|
|
247
253
|
}
|
|
248
|
-
|
|
249
|
-
const divOuter = document.createElement('div');
|
|
250
|
-
divOuter.classList.add('carousel-item');
|
|
251
|
-
j === 0 && divOuter.classList.add('active');
|
|
252
|
-
divOuter.appendChild(carouselItemWrapper);
|
|
253
|
-
carouselItemWrapperList.push(divOuter);
|
|
254
|
+
this.host.replaceChildren(...carouselItemWrapperList);
|
|
254
255
|
}
|
|
255
|
-
this.host.replaceChildren(...carouselItemWrapperList);
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
258
|
* 1.make targetItem from translateX(-/+100%) to translateX(0).
|
|
@@ -0,0 +1,88 @@
|
|
|
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, MapToComponentMethod } from 'vega-slimmer/core';
|
|
8
|
+
import { ComponentValueHistoryControllerSlimmer } from '../../../../helpers/slimmers/component-value-history-controller-slimmer.abstract';
|
|
9
|
+
/**
|
|
10
|
+
* The class used to control the code block history.
|
|
11
|
+
* It extends the ComponentValueHistoryControllerSlimmer to manage the history of code block states.
|
|
12
|
+
*/
|
|
13
|
+
export class VegaCodeBlockHistoryController extends ComponentValueHistoryControllerSlimmer {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
/**
|
|
17
|
+
* Get the effective target elements for the code block history.
|
|
18
|
+
*
|
|
19
|
+
* @returns {HTMLElement[]} - An array of effective target elements.
|
|
20
|
+
*/
|
|
21
|
+
this.getEffectiveTargets = () => {
|
|
22
|
+
return [this.contentRenderer.getCodeContentContainerRef()];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Invoke the method to back up the current code block state.
|
|
27
|
+
*/
|
|
28
|
+
async undo() {
|
|
29
|
+
if (this.undoStack.length > 1) {
|
|
30
|
+
const clonedState = this.undoStack.pop();
|
|
31
|
+
this.redoStack.push(clonedState);
|
|
32
|
+
const prev = this.undoStack[this.undoStack.length - 1];
|
|
33
|
+
if (prev) {
|
|
34
|
+
await this.restoreState(prev);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Invoke the redo action to restore the last undone state.
|
|
40
|
+
*/
|
|
41
|
+
async redo() {
|
|
42
|
+
const clonedState = this.redoStack.pop();
|
|
43
|
+
this.undoStack.push(clonedState);
|
|
44
|
+
await this.restoreState(clonedState);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Set the initial state of the code block history when the component is loaded.
|
|
48
|
+
*/
|
|
49
|
+
initialHistory() {
|
|
50
|
+
this.registerHistory({
|
|
51
|
+
value: this.value,
|
|
52
|
+
offset: this.value.code.length,
|
|
53
|
+
}, true);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the ineffective target elements for the code block history.
|
|
57
|
+
*
|
|
58
|
+
* @returns { HTMLElement[]} - An empty array, as there are no ineffective targets for the code block.
|
|
59
|
+
*/
|
|
60
|
+
getIneffectiveTargets() {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Restore the state of the code block from the given state.
|
|
65
|
+
*
|
|
66
|
+
* @param {CodeBlockState} state - The state to restore.
|
|
67
|
+
*/
|
|
68
|
+
async restoreState(state) {
|
|
69
|
+
const { value, offset } = state;
|
|
70
|
+
this.selectionController.setNextCodeBlockRange(offset);
|
|
71
|
+
this.valueController.updateValue(value.code, value.language);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
__decorate([
|
|
75
|
+
MapToComponentField()
|
|
76
|
+
], VegaCodeBlockHistoryController.prototype, "contentRenderer", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
MapToComponentField()
|
|
79
|
+
], VegaCodeBlockHistoryController.prototype, "value", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
MapToComponentField()
|
|
82
|
+
], VegaCodeBlockHistoryController.prototype, "valueController", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
MapToComponentField()
|
|
85
|
+
], VegaCodeBlockHistoryController.prototype, "selectionController", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
MapToComponentMethod('componentDidLoad')
|
|
88
|
+
], VegaCodeBlockHistoryController.prototype, "initialHistory", null);
|
|
@@ -28,30 +28,37 @@ export class CodeBlockInputController extends VegaSlimmer {
|
|
|
28
28
|
this.handleBeforeInput = (e) => {
|
|
29
29
|
e.stopPropagation();
|
|
30
30
|
const inputType = e.inputType;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
switch (inputType) {
|
|
32
|
+
case 'insertFromPaste':
|
|
33
|
+
if (e.dataTransfer) {
|
|
34
|
+
// Should prevent the paste action if the content is a file.
|
|
35
|
+
if (e.dataTransfer.files && e.dataTransfer.files.length) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Should prevent the paste action if the plain text is empty.
|
|
40
|
+
const htmlContent = e.dataTransfer.getData('text/html');
|
|
41
|
+
// eslint-disable-next-line no-restricted-globals
|
|
42
|
+
const tempContainer = document.createElement('div');
|
|
43
|
+
tempContainer.innerHTML = htmlContent;
|
|
44
|
+
if (htmlContent && !tempContainer.innerText) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
case 'deleteContentBackward':
|
|
51
|
+
if (!this.value || !this.value.code || this.value.code === '') {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.handleDeleteAction(e);
|
|
56
|
+
}
|
|
35
57
|
return;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const htmlContent = e.dataTransfer.getData('text/html');
|
|
39
|
-
// eslint-disable-next-line no-restricted-globals
|
|
40
|
-
const tempContainer = document.createElement('div');
|
|
41
|
-
tempContainer.innerHTML = htmlContent;
|
|
42
|
-
if (htmlContent && !tempContainer.innerText) {
|
|
58
|
+
case 'historyUndo':
|
|
59
|
+
case 'historyRedo':
|
|
43
60
|
e.preventDefault();
|
|
44
61
|
return;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else if (inputType === 'deleteContentBackward') {
|
|
48
|
-
if (!this.value || !this.value.code || this.value.code === '') {
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.handleDeleteAction(e);
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
62
|
}
|
|
56
63
|
this.updateCodeBlockRange(e);
|
|
57
64
|
};
|
|
@@ -105,8 +112,11 @@ export class CodeBlockInputController extends VegaSlimmer {
|
|
|
105
112
|
content = content.slice(0, contentStartOffset - 1) + content.slice(contentStartOffset);
|
|
106
113
|
nextOffset -= 1;
|
|
107
114
|
}
|
|
108
|
-
this.valueController.updateValue(content, this.value.language);
|
|
109
115
|
this.selectionController.setNextCodeBlockRange(nextOffset);
|
|
116
|
+
this.valueController.updateValue(content, this.value.language, {
|
|
117
|
+
recordHistory: true,
|
|
118
|
+
offset: nextOffset,
|
|
119
|
+
});
|
|
110
120
|
}
|
|
111
121
|
}
|
|
112
122
|
/**
|
|
@@ -187,7 +197,10 @@ export class CodeBlockInputController extends VegaSlimmer {
|
|
|
187
197
|
if (this.isInsertLineBreakInLowVersionFirefox(newText)) {
|
|
188
198
|
newText = newText + '\n';
|
|
189
199
|
}
|
|
190
|
-
this.valueController.updateValue(newText, (_a = this.value) === null || _a === void 0 ? void 0 : _a.language
|
|
200
|
+
this.valueController.updateValue(newText, (_a = this.value) === null || _a === void 0 ? void 0 : _a.language, {
|
|
201
|
+
recordHistory: true,
|
|
202
|
+
offset: this.selectionController.getCurrentRange().contentOffset,
|
|
203
|
+
});
|
|
191
204
|
}
|
|
192
205
|
}
|
|
193
206
|
/**
|
|
@@ -14,14 +14,21 @@ export class VegaCodeBlockValueController extends VegaSlimmer {
|
|
|
14
14
|
*
|
|
15
15
|
* @param {string} code - The new code content.
|
|
16
16
|
* @param {string} language - The new code language.
|
|
17
|
+
* @param {CodeBlockHistoryState} codeBlockHistoryState - Update the history or not.
|
|
17
18
|
*/
|
|
18
|
-
updateValue(code, language) {
|
|
19
|
+
updateValue(code, language, codeBlockHistoryState) {
|
|
19
20
|
if (!this.value || this.value.code !== code || this.value.language !== language) {
|
|
20
21
|
this.value = {
|
|
21
22
|
language: language,
|
|
22
23
|
code,
|
|
23
24
|
};
|
|
24
25
|
this.changeEventEmitter.emit(this.value);
|
|
26
|
+
if (codeBlockHistoryState && codeBlockHistoryState.recordHistory) {
|
|
27
|
+
this.historyController.registerHistory({
|
|
28
|
+
value: this.value,
|
|
29
|
+
offset: codeBlockHistoryState.offset,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
@@ -39,6 +46,9 @@ __decorate([
|
|
|
39
46
|
__decorate([
|
|
40
47
|
MapToComponentField()
|
|
41
48
|
], VegaCodeBlockValueController.prototype, "changeEventEmitter", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
MapToComponentField()
|
|
51
|
+
], VegaCodeBlockValueController.prototype, "historyController", void 0);
|
|
42
52
|
__decorate([
|
|
43
53
|
MapToComponentMethod('connectedCallback')
|
|
44
54
|
], VegaCodeBlockValueController.prototype, "initialValue", null);
|
|
@@ -27,6 +27,7 @@ import { DefaultCodeHighlightParseController } from './slimmers/controllers/defa
|
|
|
27
27
|
import { ComponentGlobalStyleSlimmer } from '../../helpers/slimmers/component-global-style-slimmer';
|
|
28
28
|
import codeColorVariable from './code-color-variable.css';
|
|
29
29
|
import { InsertCompositionTextController } from './slimmers/controllers/insert-composition-text-controller';
|
|
30
|
+
import { VegaCodeBlockHistoryController } from './slimmers/controllers/vega-code-block-history-controller';
|
|
30
31
|
/**
|
|
31
32
|
* A component for capturing and displaying syntax-highlighted code blocks with copy-to-clipboard functionality.
|
|
32
33
|
*
|
|
@@ -50,6 +51,7 @@ export class VegaCodeBlock {
|
|
|
50
51
|
this.inputController = new CodeBlockInputController();
|
|
51
52
|
this.insertCompositionTextController = new InsertCompositionTextController();
|
|
52
53
|
this.focusController = new VegaCodeBlockFocusController();
|
|
54
|
+
this.historyController = new VegaCodeBlockHistoryController();
|
|
53
55
|
this.changeEventEmitter = createEventEmitSlimmer(VegaCodeBlock, VegaChange);
|
|
54
56
|
this.removeEventEmitter = createEventEmitSlimmer(VegaCodeBlock, VegaRemove);
|
|
55
57
|
this.eventPreventSlimmer = new ChildNodesEventPreventSlimmer([VegaChange], () => this.codeBlockRenderer.getToolbarContainerRef());
|
|
@@ -393,6 +395,9 @@ __decorate([
|
|
|
393
395
|
__decorate([
|
|
394
396
|
InjectVegaSlimmer()
|
|
395
397
|
], VegaCodeBlock.prototype, "focusController", void 0);
|
|
398
|
+
__decorate([
|
|
399
|
+
InjectVegaSlimmer()
|
|
400
|
+
], VegaCodeBlock.prototype, "historyController", void 0);
|
|
396
401
|
__decorate([
|
|
397
402
|
InjectVegaSlimmer()
|
|
398
403
|
], VegaCodeBlock.prototype, "changeEventEmitter", void 0);
|
package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-list-renderer.js
CHANGED
|
@@ -58,7 +58,7 @@ export class VegaDropdownListRenderer extends VegaSlimmer {
|
|
|
58
58
|
return item['children']
|
|
59
59
|
? this.groupLevelRenderer.render(item, index, fixHeight)
|
|
60
60
|
: this.itemLevelRenderer.render(item, fixHeight);
|
|
61
|
-
}, viewportMaxHeight: this.defaultMaxHeightOfItemsContainer, ref: (e) => (this.virtualScrollRef = e), isLoading: this.isLazyLoading }))));
|
|
61
|
+
}, viewportMaxHeight: this.defaultMaxHeightOfItemsContainer, ref: (e) => (this.virtualScrollRef = e), isLoading: this.isLazyLoading, virtualizationThreshold: this.virtualizationThreshold }))));
|
|
62
62
|
}
|
|
63
63
|
renderDropdownListBySlot() {
|
|
64
64
|
return (h("ul", { role: "menu", "aria-label": "dropdown-ul", class: {
|
|
@@ -104,3 +104,6 @@ __decorate([
|
|
|
104
104
|
__decorate([
|
|
105
105
|
MapToComponentField()
|
|
106
106
|
], VegaDropdownListRenderer.prototype, "translationSlimmer", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
MapToComponentField()
|
|
109
|
+
], VegaDropdownListRenderer.prototype, "virtualizationThreshold", void 0);
|
|
@@ -237,6 +237,14 @@ export class VegaDropdown {
|
|
|
237
237
|
* @vegaVersion 2.46.0
|
|
238
238
|
*/
|
|
239
239
|
this.resettable = false;
|
|
240
|
+
/**
|
|
241
|
+
* The count of the source that will be used as the threshold for determining whether to use virtual scrolling.
|
|
242
|
+
* If the count of source exceeds this threshold, we employ virtual scrolling. Otherwise, normal item rendering is used
|
|
243
|
+
* If the value is 0, it means we will disable the virtualization all the time.
|
|
244
|
+
*
|
|
245
|
+
* @vegaVersion 2.54.0
|
|
246
|
+
*/
|
|
247
|
+
this.virtualizationThreshold = 60;
|
|
240
248
|
}
|
|
241
249
|
watchIsDropdownShow() {
|
|
242
250
|
methodPlaceholder();
|
|
@@ -903,6 +911,27 @@ export class VegaDropdown {
|
|
|
903
911
|
"attribute": "resettable",
|
|
904
912
|
"reflect": false,
|
|
905
913
|
"defaultValue": "false"
|
|
914
|
+
},
|
|
915
|
+
"virtualizationThreshold": {
|
|
916
|
+
"type": "number",
|
|
917
|
+
"mutable": false,
|
|
918
|
+
"complexType": {
|
|
919
|
+
"original": "number",
|
|
920
|
+
"resolved": "number",
|
|
921
|
+
"references": {}
|
|
922
|
+
},
|
|
923
|
+
"required": false,
|
|
924
|
+
"optional": false,
|
|
925
|
+
"docs": {
|
|
926
|
+
"tags": [{
|
|
927
|
+
"name": "vegaVersion",
|
|
928
|
+
"text": "2.54.0"
|
|
929
|
+
}],
|
|
930
|
+
"text": "The count of the source that will be used as the threshold for determining whether to use virtual scrolling.\nIf the count of source exceeds this threshold, we employ virtual scrolling. Otherwise, normal item rendering is used\nIf the value is 0, it means we will disable the virtualization all the time."
|
|
931
|
+
},
|
|
932
|
+
"attribute": "virtualization-threshold",
|
|
933
|
+
"reflect": false,
|
|
934
|
+
"defaultValue": "60"
|
|
906
935
|
}
|
|
907
936
|
}; }
|
|
908
937
|
static get states() { return {
|
package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js
CHANGED
|
@@ -3,10 +3,25 @@ import { RTEBlockRenderer } from './block-renderer.abstract';
|
|
|
3
3
|
import { RTECodeBlock } from '../../blocks/code-block';
|
|
4
4
|
import RTECodeBlockNodeRenderer from '../nodes/code-block-node-renderer';
|
|
5
5
|
import { ZERO_WIDTH_SPACE } from '../../../constants/constant';
|
|
6
|
+
import { tryGetDocument } from '../../../../../utils/try-get-document';
|
|
6
7
|
/**
|
|
7
8
|
* The code block renderer.
|
|
8
9
|
*/
|
|
9
10
|
class RTECodeBlockRenderer extends RTEBlockRenderer {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
/**
|
|
14
|
+
* Prevent the click event bubble, avoid the rich text content trigger focus event.
|
|
15
|
+
*
|
|
16
|
+
* @param {MouseEvent} e - The event object.
|
|
17
|
+
*/
|
|
18
|
+
this.preventParentDoFocus = (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
if (e.type === 'keydown') {
|
|
21
|
+
this.dispatchMockKeydownEvent(e);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
10
25
|
/**
|
|
11
26
|
* Check the input block type.
|
|
12
27
|
*
|
|
@@ -51,12 +66,21 @@ class RTECodeBlockRenderer extends RTEBlockRenderer {
|
|
|
51
66
|
} }, ZERO_WIDTH_SPACE));
|
|
52
67
|
}
|
|
53
68
|
/**
|
|
54
|
-
*
|
|
69
|
+
* If redo and undo in code block, here need a mock keydown event to make the helper class `KeyboardManager` could monitor the current keydown event.
|
|
55
70
|
*
|
|
56
|
-
* @param {
|
|
71
|
+
* @param {KeyboardEvent} e - The keyboard event object.
|
|
57
72
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
dispatchMockKeydownEvent(e) {
|
|
74
|
+
const safeDocument = tryGetDocument();
|
|
75
|
+
if (safeDocument) {
|
|
76
|
+
const { type, code, metaKey, ctrlKey, shiftKey } = e;
|
|
77
|
+
const event = new Event(type, { bubbles: false, cancelable: true });
|
|
78
|
+
event['code'] = code;
|
|
79
|
+
event['metaKey'] = metaKey;
|
|
80
|
+
event['ctrlKey'] = ctrlKey;
|
|
81
|
+
event['shiftKey'] = shiftKey;
|
|
82
|
+
safeDocument.dispatchEvent(event);
|
|
83
|
+
}
|
|
60
84
|
}
|
|
61
85
|
}
|
|
62
86
|
export default new RTECodeBlockRenderer();
|
package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/history-controller.js
CHANGED
|
@@ -6,40 +6,54 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { MapToComponentField, MapToComponentMethod } from 'vega-slimmer/core';
|
|
8
8
|
import { RTEEditorState } from '../../dto/editor-state';
|
|
9
|
-
import { debounce } from '../../../../utils/timer';
|
|
10
9
|
import { RTESelectionState } from '../../dto/selection-state';
|
|
11
|
-
import {
|
|
10
|
+
import { ComponentValueHistoryControllerSlimmer } from '../../../../helpers/slimmers/component-value-history-controller-slimmer.abstract';
|
|
12
11
|
/**
|
|
13
12
|
* History controller for RTE.
|
|
14
13
|
*/
|
|
15
|
-
export class HistoryController extends
|
|
14
|
+
export class HistoryController extends ComponentValueHistoryControllerSlimmer {
|
|
16
15
|
constructor() {
|
|
17
|
-
super(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/**
|
|
18
|
+
* Gets the effective target elements for the RTE history.
|
|
19
|
+
*
|
|
20
|
+
* @returns {HTMLElement[]} - An array of effective target elements.
|
|
21
|
+
*/
|
|
22
|
+
this.getEffectiveTargets = () => {
|
|
23
|
+
return [this.vegaRichTextEditorRenderer.getRTEEditableElementRef()];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Gets the ineffective target elements for the RTE history.
|
|
27
|
+
*
|
|
28
|
+
* @returns {HTMLElement[]} - An array of ineffective target elements.
|
|
29
|
+
*/
|
|
30
|
+
this.getIneffectiveTargets = () => {
|
|
31
|
+
const editorElementRef = this.vegaRichTextEditorRenderer.getRTEEditableElementRef();
|
|
32
|
+
let result = [];
|
|
33
|
+
if (editorElementRef) {
|
|
34
|
+
result = Array.from(editorElementRef.querySelectorAll('.code-block-container'));
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
24
38
|
}
|
|
25
39
|
/**
|
|
26
40
|
* Component lifecycle - [componentDidLoad]
|
|
27
41
|
*/
|
|
28
42
|
registerInitState() {
|
|
29
43
|
if (this.value) {
|
|
30
|
-
this.
|
|
44
|
+
this.registerHistory(new RTEEditorState(this.value, new RTESelectionState(this.selectionController.getCurrentRange())), true);
|
|
31
45
|
}
|
|
32
46
|
}
|
|
33
47
|
/**
|
|
34
48
|
* Restores the previous state from the undo stack.
|
|
35
49
|
*/
|
|
36
50
|
async undo() {
|
|
37
|
-
if (this.undoStack.length >
|
|
51
|
+
if (this.undoStack.length > 1) {
|
|
38
52
|
const clonedState = this.undoStack.pop().clone();
|
|
39
53
|
this.redoStack.push(clonedState);
|
|
40
54
|
const prev = this.undoStack[this.undoStack.length - 1];
|
|
41
55
|
if (prev) {
|
|
42
|
-
await this.restoreState(prev
|
|
56
|
+
await this.restoreState(prev);
|
|
43
57
|
}
|
|
44
58
|
}
|
|
45
59
|
}
|
|
@@ -53,69 +67,16 @@ export class HistoryController extends KeyboardManagerSlimmer {
|
|
|
53
67
|
await this.restoreState(clonedState);
|
|
54
68
|
}
|
|
55
69
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Registers history based on the editor state.
|
|
58
|
-
*
|
|
59
|
-
* @param {RTEEditorState} editorState - The state to record in history.
|
|
60
|
-
*/
|
|
61
|
-
registerHistory(editorState) {
|
|
62
|
-
// TODO: feat: add a `force` option to register history immediately when needed.
|
|
63
|
-
this.registerHistoryDebounced(editorState);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Internal function to register history immediately.
|
|
67
|
-
*
|
|
68
|
-
* @param {RTEEditorState} state - The state to record in history.
|
|
69
|
-
*/
|
|
70
|
-
internalRegisterHistory(state) {
|
|
71
|
-
this.redoStack = []; // clear redo stack when new action happens.
|
|
72
|
-
this.undoStack.push(state);
|
|
73
|
-
}
|
|
74
70
|
/**
|
|
75
71
|
* Restores the editor state based on the provided history state.
|
|
76
72
|
*
|
|
77
73
|
* @param {RTEEditorState} state - The state to restore to.
|
|
78
74
|
*/
|
|
79
75
|
async restoreState(state) {
|
|
80
|
-
const { content, selection } = state;
|
|
76
|
+
const { content, selection } = state.clone();
|
|
81
77
|
this.selectionController.setSelectionState(selection);
|
|
82
78
|
await this.valueController.flushChanges(content, false);
|
|
83
79
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns the keyboard shortcut options for undo/redo functionality.
|
|
86
|
-
*
|
|
87
|
-
* @returns {KeyboardEventListener[]} - An array of keyboard shortcut options.
|
|
88
|
-
*/
|
|
89
|
-
getKeyboardShortcutOptions() {
|
|
90
|
-
const baseOption = {
|
|
91
|
-
keyCode: 'KeyZ',
|
|
92
|
-
activeElementInScope: [this.vegaRichTextEditorRenderer.getRTEEditableElementRef()],
|
|
93
|
-
eventName: 'keydown',
|
|
94
|
-
modifierPressed: true,
|
|
95
|
-
};
|
|
96
|
-
return [
|
|
97
|
-
Object.assign(Object.assign({}, baseOption), { shiftKey: false,
|
|
98
|
-
/**
|
|
99
|
-
* Callback function for the undo action.
|
|
100
|
-
*
|
|
101
|
-
* @param {KeyboardEvent} e - The keyboard event triggered by the user.
|
|
102
|
-
*/
|
|
103
|
-
callback: (e) => {
|
|
104
|
-
e.preventDefault();
|
|
105
|
-
void this.undo();
|
|
106
|
-
} }),
|
|
107
|
-
Object.assign(Object.assign({}, baseOption), { shiftKey: true,
|
|
108
|
-
/**
|
|
109
|
-
* Callback function for the redo action.
|
|
110
|
-
*
|
|
111
|
-
* @param {KeyboardEvent} e - The keyboard event triggered by the user.
|
|
112
|
-
*/
|
|
113
|
-
callback: (e) => {
|
|
114
|
-
e.preventDefault();
|
|
115
|
-
void this.redo();
|
|
116
|
-
} }),
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
80
|
}
|
|
120
81
|
__decorate([
|
|
121
82
|
MapToComponentField()
|
package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js
CHANGED
|
@@ -69,10 +69,10 @@ export class ValueController extends VegaSlimmer {
|
|
|
69
69
|
* @param {boolean} recordHistory - Whether to record the change in history.
|
|
70
70
|
*/
|
|
71
71
|
async flushChanges(newValue, recordHistory = true) {
|
|
72
|
+
this.value = newValue.clone();
|
|
72
73
|
if (recordHistory) {
|
|
73
|
-
this.historyController.registerHistory(new RTEEditorState(
|
|
74
|
+
this.historyController.registerHistory(new RTEEditorState(this.value, new RTESelectionState(this.selectionController.getCurrentRange())));
|
|
74
75
|
}
|
|
75
|
-
this.value = newValue.clone();
|
|
76
76
|
await waitForComponentDidRender(this.host);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -44,7 +44,10 @@ export class VegaVirtualScrollModeController extends VegaSlimmer {
|
|
|
44
44
|
*/
|
|
45
45
|
setMode() {
|
|
46
46
|
const originalMode = this.mode;
|
|
47
|
-
this.mode =
|
|
47
|
+
this.mode =
|
|
48
|
+
this.source.length > this.virtualizationThreshold && this.virtualizationThreshold > 0
|
|
49
|
+
? 'virtual'
|
|
50
|
+
: 'normal';
|
|
48
51
|
if (originalMode === 'normal' && this.mode === 'virtual') {
|
|
49
52
|
this.positionController.changeModeFromNormalToVirtual();
|
|
50
53
|
}
|
|
@@ -52,6 +52,7 @@ export class VegaVirtualScroll {
|
|
|
52
52
|
/**
|
|
53
53
|
* The count of the source that will be used as the threshold for determining whether to use virtual scrolling.
|
|
54
54
|
* If the count of source exceeds this threshold, we employ virtual scrolling. Otherwise, normal item rendering is used
|
|
55
|
+
* If the value is 0, it means we will disable the virtualization all the time.
|
|
55
56
|
*
|
|
56
57
|
* @vegaVersion 2.3.0
|
|
57
58
|
*/
|
|
@@ -199,7 +200,7 @@ export class VegaVirtualScroll {
|
|
|
199
200
|
"name": "vegaVersion",
|
|
200
201
|
"text": "2.3.0"
|
|
201
202
|
}],
|
|
202
|
-
"text": "The count of the source that will be used as the threshold for determining whether to use virtual scrolling.\nIf the count of source exceeds this threshold, we employ virtual scrolling. Otherwise, normal item rendering is used"
|
|
203
|
+
"text": "The count of the source that will be used as the threshold for determining whether to use virtual scrolling.\nIf the count of source exceeds this threshold, we employ virtual scrolling. Otherwise, normal item rendering is used\nIf the value is 0, it means we will disable the virtualization all the time."
|
|
203
204
|
},
|
|
204
205
|
"attribute": "virtualization-threshold",
|
|
205
206
|
"reflect": false,
|
|
@@ -76,6 +76,9 @@ class KeyboardManager {
|
|
|
76
76
|
const isKeyCodeAccepted = Array.isArray(listener.keyCode)
|
|
77
77
|
? listener.keyCode.includes(keyCode)
|
|
78
78
|
: listener.keyCode === keyCode;
|
|
79
|
+
if (!isKeyCodeAccepted) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
79
82
|
/* istanbul ignore next */
|
|
80
83
|
if (typeof listener.activeElementInScope === 'function') {
|
|
81
84
|
activeElementInScope = listener.activeElementInScope();
|
|
@@ -95,6 +98,9 @@ class KeyboardManager {
|
|
|
95
98
|
return isParent(getDeepActiveElementInShadow(), element);
|
|
96
99
|
})
|
|
97
100
|
: true;
|
|
101
|
+
if (!isActiveElementInScope) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
98
104
|
const isActiveElementOutScope = listener.activeElementOutScope
|
|
99
105
|
? activeElementOutScope.every((element) => !isParent(getDeepActiveElementInShadow(), element))
|
|
100
106
|
: true;
|
|
@@ -203,4 +203,35 @@ describe('KeyboardManager', () => {
|
|
|
203
203
|
expect(callback2).toBeCalledTimes(1);
|
|
204
204
|
expect(callback3).toBeCalledTimes(2);
|
|
205
205
|
});
|
|
206
|
+
test('should not check the next condition when the prev condition is not pass', () => {
|
|
207
|
+
const callback = jest.fn();
|
|
208
|
+
const inScopeCallback = jest.fn().mockReturnValue([button1]);
|
|
209
|
+
const mockArray = new Array();
|
|
210
|
+
spyOn(mockArray, 'every').and.callThrough();
|
|
211
|
+
const outScopeCallback = jest.fn().mockReturnValue(mockArray);
|
|
212
|
+
KeyboardManager.register([
|
|
213
|
+
{
|
|
214
|
+
keyCode: 'Tab',
|
|
215
|
+
activeElementInScope: inScopeCallback,
|
|
216
|
+
activeElementOutScope: outScopeCallback,
|
|
217
|
+
callback: callback,
|
|
218
|
+
},
|
|
219
|
+
]);
|
|
220
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'ArrowUp' }));
|
|
221
|
+
expect(callback).toBeCalledTimes(0);
|
|
222
|
+
expect(inScopeCallback).toBeCalledTimes(0);
|
|
223
|
+
expect(outScopeCallback).toBeCalledTimes(0);
|
|
224
|
+
Object.assign(document, { activeElement: button2 });
|
|
225
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
226
|
+
expect(callback).toBeCalledTimes(0);
|
|
227
|
+
expect(inScopeCallback).toBeCalledTimes(1);
|
|
228
|
+
expect(outScopeCallback).toBeCalledTimes(1);
|
|
229
|
+
expect(mockArray.every).toBeCalledTimes(0);
|
|
230
|
+
Object.assign(document, { activeElement: button1 });
|
|
231
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
232
|
+
expect(callback).toBeCalledTimes(1);
|
|
233
|
+
expect(inScopeCallback).toBeCalledTimes(2);
|
|
234
|
+
expect(outScopeCallback).toBeCalledTimes(2);
|
|
235
|
+
expect(mockArray.every).toBeCalledTimes(1);
|
|
236
|
+
});
|
|
206
237
|
});
|