@globalpayments/vega 2.28.1 → 2.30.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-512d84f4.js → app-globals-391d9a14.js} +9 -8
- package/dist/cjs/{array-6e559cde.js → array-5adef7b2.js} +13 -1
- package/dist/cjs/{child-nodes-event-prevent-slimmer-e383a914.js → child-nodes-event-prevent-slimmer-bed95a1b.js} +2 -2
- package/dist/cjs/{create-public-api-runtime-metrics-slimmer-7510221b.js → create-public-api-runtime-metrics-slimmer-5cc88124.js} +1 -0
- package/dist/cjs/{design-token-17b8e4d8.js → design-token-92906579.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-bf5ecbd8.js → element-appender-slimmer-415d261a.js} +726 -537
- package/dist/cjs/{event-emit-slimmer-8f51adaa.js → event-emit-slimmer-b321e3f5.js} +1 -1
- package/dist/cjs/{feature-flag-controller-078da332.js → feature-flag-controller-f0619cc7.js} +5 -0
- package/dist/cjs/{form-field-controller-slimmer-223f8ee3.js → form-field-controller-slimmer-a4231b97.js} +6 -6
- package/dist/cjs/{icon-manager-5a2b67cf.js → icon-manager-3787af39.js} +1 -1
- package/dist/cjs/index-09acd3c9.js +8 -0
- package/dist/cjs/index-d6bf3435.js +15 -0
- package/dist/cjs/index.cjs.js +16 -15
- package/dist/cjs/{internal-icon-manager-858baff1.js → internal-icon-manager-2ff58050.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-627b1328.js → internal-vega-event-manager-9ffb3ed1.js} +13 -3
- package/dist/cjs/{internal-vega-z-index-manager-23051df4.js → internal-vega-z-index-manager-f03ddb37.js} +1 -1
- package/dist/cjs/{legend-input-processor-6ab8782a.js → legend-input-processor-d0b3f621.js} +1 -1
- package/dist/cjs/loader.cjs.js +15 -14
- package/dist/cjs/{min-number-rule-84f21ad9.js → min-number-rule-115c5a3b.js} +1 -1
- package/dist/cjs/{mutation-observer-filters-79b60f28.js → mutation-observer-filters-e5a7f85a.js} +1 -1
- package/dist/cjs/{number-459031f7.js → number-4816603d.js} +11 -0
- package/dist/cjs/{responsive-format-facade-7bc51a43.js → responsive-format-facade-ad2f67bf.js} +1 -1
- package/dist/cjs/{static-subject-title-3599787e.js → static-subject-title-471e1793.js} +2 -0
- package/dist/cjs/{style-formatter-a0829641.js → style-formatter-68f3a5f8.js} +1 -1
- package/dist/cjs/sub-state-notify-slimmer-c729699e.js +81 -0
- package/dist/cjs/{sub-state-observer-slimmer-36660092.js → sub-state-observer-slimmer-c1332b19.js} +3 -73
- package/dist/cjs/{translation-0dd74433.js → translation-42c1b2c8.js} +2 -2
- package/dist/cjs/{translation-slimmer-83577cfd.js → translation-slimmer-32aa13e7.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-8d8f04f1.js → valid-credit-card-number-rule-4a9ae5d9.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +10 -10
- package/dist/cjs/vega-app-header-button.cjs.entry.js +11 -11
- package/dist/cjs/vega-banner.cjs.entry.js +7 -7
- package/dist/cjs/vega-bar-chart.cjs.entry.js +4 -4
- package/dist/cjs/vega-box.cjs.entry.js +4 -4
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +5 -5
- package/dist/cjs/vega-button-circle.cjs.entry.js +9 -9
- package/dist/cjs/vega-button-group_2.cjs.entry.js +11 -10
- package/dist/cjs/vega-button-link.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-calendar_3.cjs.entry.js +18 -17
- package/dist/cjs/vega-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-carousel.cjs.entry.js +5 -5
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +13 -13
- package/dist/cjs/vega-chip.cjs.entry.js +8 -8
- package/dist/cjs/vega-color-picker.cjs.entry.js +19 -13
- package/dist/cjs/vega-combo-box.cjs.entry.js +367 -183
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +23 -20
- package/dist/cjs/{vega-dialog-controller-6a8525b3.js → vega-dialog-controller-dce8cdaf.js} +1 -1
- package/dist/cjs/vega-dialog_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-divider.cjs.entry.js +3 -3
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +47 -32
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/{vega-event-id-e40ac8f0.js → vega-event-id-419d36a8.js} +2 -0
- package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +14 -14
- package/dist/cjs/vega-flex.cjs.entry.js +5 -5
- package/dist/cjs/vega-font.cjs.entry.js +3 -3
- package/dist/cjs/vega-form.cjs.entry.js +13 -13
- package/dist/cjs/vega-grid.cjs.entry.js +3 -3
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +16 -16
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +16 -16
- package/dist/cjs/vega-input-numeric.cjs.entry.js +410 -0
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +15 -15
- package/dist/cjs/vega-input-range.cjs.entry.js +14 -14
- package/dist/cjs/vega-input-select.cjs.entry.js +30 -18
- package/dist/cjs/vega-input.cjs.entry.js +218 -25
- package/dist/cjs/{vega-internal-event-id-c98e9a7d.js → vega-internal-event-id-99cc22e1.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +13 -13
- package/dist/cjs/vega-line-chart.cjs.entry.js +4 -4
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination.cjs.entry.js +12 -12
- package/dist/cjs/vega-pie-chart.cjs.entry.js +3 -3
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +4 -4
- package/dist/cjs/vega-radio_2.cjs.entry.js +13 -13
- package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +19 -18
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +18 -17
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +1006 -0
- package/dist/cjs/vega-signature-capture.cjs.entry.js +16 -16
- package/dist/cjs/{vega-skeleton-loader-controller-e886dc58.js → vega-skeleton-loader-controller-4a016b04.js} +4 -14
- package/dist/cjs/vega-stepper.cjs.entry.js +14 -14
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-table_8.cjs.entry.js +29 -28
- package/dist/cjs/vega-textarea.cjs.entry.js +13 -13
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +17 -17
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +11 -11
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega.cjs.js +15 -14
- package/dist/cjs/{y-axis-input-processor-cc6e9196.js → y-axis-input-processor-a0df5e74.js} +2 -2
- package/dist/collection/collection-manifest.json +16 -0
- package/dist/collection/components/vega-color-picker/vega-color-picker.css +8 -8
- package/dist/collection/components/vega-color-picker/vega-color-picker.js +30 -3
- package/dist/collection/components/vega-combo-box/slimmers/controllers/vega-combo-box-keyboard-controller.js +114 -0
- package/dist/collection/components/vega-combo-box/slimmers/controllers/vega-combo-box-value-controller.js +23 -0
- package/dist/collection/components/vega-combo-box/slimmers/renderers/vega-combo-box-dropdown-renderer.js +147 -0
- package/dist/collection/components/vega-combo-box/slimmers/renderers/vega-combo-box-renderer.js +50 -0
- package/dist/collection/components/vega-combo-box/vega-combo-box.js +30 -177
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-element-appender-controller.js +2 -0
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-search-renderer.js +19 -5
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +55 -9
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-compact-width-controller.js +118 -0
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-state-controller.js +46 -0
- package/dist/collection/components/vega-input/vega-input.css +104 -0
- package/dist/collection/components/vega-input/vega-input.js +44 -2
- package/dist/collection/components/vega-input-numeric/slimmers/controllers/vega-input-numeric-keyboard-controller.js +79 -0
- package/dist/collection/components/vega-input-numeric/slimmers/controllers/vega-input-numeric-value-controller.js +45 -0
- package/dist/collection/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.js +72 -0
- package/dist/collection/components/vega-input-numeric/vega-input-numeric.css +9 -0
- package/dist/collection/components/vega-input-numeric/vega-input-numeric.js +606 -0
- package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-dropdown-controller.js +7 -1
- package/dist/collection/components/vega-input-select/vega-input-select.js +55 -2
- package/dist/collection/components/vega-sidenav/icons/chevron-right.js +4 -0
- package/dist/collection/components/vega-sidenav/icons/toggle-button-bg.js +3 -0
- package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-backdrop-controller.js +101 -0
- package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-open-status-controller.js +316 -0
- package/dist/collection/components/vega-sidenav/slimmers/renderers/vega-sidenav-collapse-button-renderer.js +79 -0
- package/dist/collection/components/vega-sidenav/test/test.helper.js +68 -0
- package/dist/collection/components/vega-sidenav/utils/index.js +9 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav-group/slimmers/controllers/vega-sidenav-group-sub-state-controller.js +28 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav-group/vega-sidenav-group.css +172 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav-group/vega-sidenav-group.js +152 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav-link/slimmers/controllers/vega-sidenav-link-sub-state.controller.js +28 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav-link/vega-sidenav-link.css +136 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav-link/vega-sidenav-link.js +264 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav.css +300 -0
- package/dist/collection/components/vega-sidenav/vega-sidenav.js +422 -0
- package/dist/collection/constants/ui.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +13 -3
- package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/test/vega-event-manager.test.js +2 -1
- package/dist/collection/helpers/feature-control/feature-flags-map.js +5 -0
- package/dist/collection/helpers/slimmers/element-appender-container/body-positioned-wrapper/body-positioned-wrapper.abstract.js +13 -0
- package/dist/collection/helpers/slimmers/element-appender-container/{position-relative-to-wrapper.js → body-positioned-wrapper/position-relative-to-wrapper.js} +23 -21
- package/dist/collection/helpers/slimmers/element-appender-container/{vega-modal-wrapper.js → body-positioned-wrapper/vega-modal-wrapper.js} +18 -15
- package/dist/collection/helpers/slimmers/element-appender-container/{vega-popover-wrapper.js → body-positioned-wrapper/vega-popover-wrapper.js} +20 -19
- package/dist/collection/helpers/slimmers/element-appender-container/default-wrapper.js +19 -19
- package/dist/collection/helpers/slimmers/element-appender-container/element-appender-container-controller.js +3 -3
- package/dist/collection/helpers/slimmers/element-appender-slimmer.js +10 -0
- package/dist/collection/helpers/slimmers/position-calculation/base-position-calculation-strategy.js +345 -0
- package/dist/collection/helpers/slimmers/position-calculation/body-position-calculation-strategy.js +66 -0
- package/dist/collection/helpers/slimmers/position-calculation/position-calculation-controller.js +121 -0
- package/dist/collection/helpers/slimmers/position-calculation/screen-position-calculation-strategy.js +59 -0
- package/dist/collection/{utils/test/position.test.js → helpers/slimmers/position-calculation/test/body-position-calculation-strategy.test.js} +135 -45
- package/dist/collection/helpers/slimmers/position-calculation/test/screen-position-calculation-strategy.test.js +113 -0
- package/dist/collection/helpers/slimmers/sub-state/sub-state-notify-slimmer.js +8 -5
- package/dist/collection/helpers/slimmers/sub-state/test/sub-state-observer-slimmer.test.js +24 -0
- package/dist/collection/helpers/ui/element-appender.js +21 -70
- package/dist/collection/helpers/ui/test/element-appender.test.js +53 -0
- package/dist/collection/utils/number.js +10 -0
- package/dist/collection/utils/pagination.js +2 -2
- package/dist/collection/utils/test/number.test.js +5 -1
- package/dist/collection/value-model-adapters/angular-ng-model-accessor-adapter.js +1 -0
- package/dist/collection/value-model-adapters/vue-component-v-model-adaptor.js +1 -0
- package/dist/esm/{app-globals-41797af8.js → app-globals-00a57fbe.js} +8 -7
- package/dist/esm/{array-506b88b9.js → array-b668466e.js} +13 -2
- package/dist/esm/{child-nodes-event-prevent-slimmer-345c46c5.js → child-nodes-event-prevent-slimmer-db288af1.js} +2 -2
- package/dist/esm/{create-public-api-runtime-metrics-slimmer-928ad7f0.js → create-public-api-runtime-metrics-slimmer-cc1164bb.js} +1 -1
- package/dist/esm/{design-token-3671ce60.js → design-token-2a527af3.js} +1 -1
- package/dist/esm/{element-appender-slimmer-1172e2ea.js → element-appender-slimmer-48d826b2.js} +720 -531
- package/dist/esm/{event-emit-slimmer-eee9fd41.js → event-emit-slimmer-44cb4573.js} +1 -1
- package/dist/esm/{feature-flag-controller-10780eeb.js → feature-flag-controller-297c4b9b.js} +5 -0
- package/dist/esm/{form-field-controller-slimmer-edbaaf7c.js → form-field-controller-slimmer-a64c679c.js} +6 -6
- package/dist/esm/{icon-manager-0f030f8a.js → icon-manager-1ee2c968.js} +1 -1
- package/dist/esm/index-187f71d1.js +8 -0
- package/dist/esm/index-fda6b5ee.js +13 -0
- package/dist/esm/index.js +15 -14
- package/dist/esm/{internal-icon-manager-9671142a.js → internal-icon-manager-7004584d.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-722461c1.js → internal-vega-event-manager-8154661e.js} +13 -3
- package/dist/esm/{internal-vega-z-index-manager-0553458e.js → internal-vega-z-index-manager-7d2b54c3.js} +1 -1
- package/dist/esm/{legend-input-processor-abb0b4f4.js → legend-input-processor-0cef3ebe.js} +1 -1
- package/dist/esm/loader.js +15 -14
- package/dist/esm/{min-number-rule-8f643dbd.js → min-number-rule-31d48b22.js} +1 -1
- package/dist/esm/{mutation-observer-filters-9086b5cc.js → mutation-observer-filters-1035b064.js} +1 -1
- package/dist/esm/{number-e2519d1c.js → number-4398f2e1.js} +11 -1
- package/dist/esm/{responsive-format-facade-5a1329a7.js → responsive-format-facade-3dc84e41.js} +1 -1
- package/dist/esm/{static-subject-title-6987a80b.js → static-subject-title-500cf2a3.js} +2 -1
- package/dist/esm/{style-formatter-2fa5ce09.js → style-formatter-ccb2da0d.js} +1 -1
- package/dist/esm/sub-state-notify-slimmer-be5bcc4e.js +79 -0
- package/dist/esm/{sub-state-observer-slimmer-8eff5559.js → sub-state-observer-slimmer-cd7adab1.js} +5 -74
- package/dist/esm/{translation-0fa7cf77.js → translation-4eb3cf85.js} +2 -2
- package/dist/esm/{translation-slimmer-79f9a9c9.js → translation-slimmer-9d07a0ff.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-232f2986.js → valid-credit-card-number-rule-2aef3ad5.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +10 -10
- package/dist/esm/vega-app-header-button.entry.js +11 -11
- package/dist/esm/vega-banner.entry.js +7 -7
- package/dist/esm/vega-bar-chart.entry.js +4 -4
- package/dist/esm/vega-box.entry.js +4 -4
- package/dist/esm/vega-breadcrumb.entry.js +5 -5
- package/dist/esm/vega-button-circle.entry.js +9 -9
- package/dist/esm/vega-button-group_2.entry.js +8 -7
- package/dist/esm/vega-button-link.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +8 -8
- package/dist/esm/vega-calendar_3.entry.js +16 -15
- package/dist/esm/vega-card.entry.js +3 -3
- package/dist/esm/vega-carousel.entry.js +5 -5
- package/dist/esm/vega-checkbox_2.entry.js +13 -13
- package/dist/esm/vega-chip.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +20 -14
- package/dist/esm/vega-combo-box.entry.js +370 -186
- package/dist/esm/vega-date-picker_2.entry.js +23 -20
- package/dist/esm/{vega-dialog-controller-3b905672.js → vega-dialog-controller-8b343a17.js} +1 -1
- package/dist/esm/vega-dialog_2.entry.js +9 -9
- package/dist/esm/vega-divider.entry.js +3 -3
- package/dist/esm/vega-dropdown_5.entry.js +43 -28
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/{vega-event-id-7465a011.js → vega-event-id-b1655cbc.js} +2 -1
- package/dist/esm/vega-field-error.entry.js +1 -1
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +14 -14
- package/dist/esm/vega-flex.entry.js +5 -5
- package/dist/esm/vega-font.entry.js +3 -3
- package/dist/esm/vega-form.entry.js +13 -13
- package/dist/esm/vega-grid.entry.js +3 -3
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +16 -16
- package/dist/esm/vega-input-credit-card.entry.js +16 -16
- package/dist/esm/vega-input-numeric.entry.js +406 -0
- package/dist/esm/vega-input-phone-number.entry.js +15 -15
- package/dist/esm/vega-input-range.entry.js +14 -14
- package/dist/esm/vega-input-select.entry.js +30 -18
- package/dist/esm/vega-input.entry.js +219 -26
- package/dist/esm/{vega-internal-event-id-7e05cf4a.js → vega-internal-event-id-c8507b85.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +13 -13
- package/dist/esm/vega-line-chart.entry.js +4 -4
- package/dist/esm/vega-loader-wrapper_2.entry.js +2 -2
- package/dist/esm/vega-page-notification_2.entry.js +1 -1
- package/dist/esm/vega-pagination.entry.js +12 -12
- package/dist/esm/vega-pie-chart.entry.js +3 -3
- package/dist/esm/vega-popover_2.entry.js +9 -9
- package/dist/esm/vega-progress-tracker.entry.js +4 -4
- package/dist/esm/vega-radio_2.entry.js +13 -13
- package/dist/esm/vega-segment-control.entry.js +3 -3
- package/dist/esm/vega-selection-chip_2.entry.js +16 -15
- package/dist/esm/vega-selection-tile_2.entry.js +15 -14
- package/dist/esm/vega-sidenav_3.entry.js +1000 -0
- package/dist/esm/vega-signature-capture.entry.js +16 -16
- package/dist/esm/{vega-skeleton-loader-controller-6fb25f3b.js → vega-skeleton-loader-controller-cec6753f.js} +4 -14
- package/dist/esm/vega-stepper.entry.js +14 -14
- package/dist/esm/vega-tab-group_2.entry.js +6 -6
- package/dist/esm/vega-table_8.entry.js +19 -18
- package/dist/esm/vega-textarea.entry.js +13 -13
- package/dist/esm/vega-time-picker_2.entry.js +17 -17
- package/dist/esm/vega-toggle-switch.entry.js +11 -11
- package/dist/esm/vega-tooltip_2.entry.js +7 -7
- package/dist/esm/vega.js +15 -14
- package/dist/esm/{y-axis-input-processor-08c89594.js → y-axis-input-processor-a4d6aa50.js} +2 -2
- package/dist/types/components/vega-color-picker/vega-color-picker.d.ts +6 -0
- package/dist/types/components/vega-combo-box/slimmers/controllers/vega-combo-box-keyboard-controller.d.ts +29 -0
- package/dist/types/components/vega-combo-box/slimmers/controllers/vega-combo-box-value-controller.d.ts +14 -0
- package/dist/types/components/vega-combo-box/slimmers/renderers/vega-combo-box-dropdown-renderer.d.ts +41 -0
- package/dist/types/components/vega-combo-box/slimmers/renderers/vega-combo-box-renderer.d.ts +17 -0
- package/dist/types/components/vega-combo-box/vega-combo-box.d.ts +8 -48
- package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-search-renderer.d.ts +1 -0
- package/dist/types/components/vega-dropdown/types.d.ts +5 -0
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +21 -1
- package/dist/types/components/vega-input/slimmers/controllers/vega-input-compact-width-controller.d.ts +47 -0
- package/dist/types/components/vega-input/slimmers/controllers/vega-input-state-controller.d.ts +13 -0
- package/dist/types/components/vega-input/vega-input.d.ts +18 -6
- package/dist/types/components/vega-input-numeric/slimmers/controllers/vega-input-numeric-keyboard-controller.d.ts +18 -0
- package/dist/types/components/vega-input-numeric/slimmers/controllers/vega-input-numeric-value-controller.d.ts +20 -0
- package/dist/types/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.d.ts +19 -0
- package/dist/types/components/vega-input-numeric/vega-input-numeric.d.ts +169 -0
- package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-dropdown-controller.d.ts +1 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +20 -0
- package/dist/types/components/vega-sidenav/icons/chevron-right.d.ts +3 -0
- package/dist/types/components/vega-sidenav/icons/toggle-button-bg.d.ts +3 -0
- package/dist/types/components/vega-sidenav/slimmers/controllers/vega-sidenav-backdrop-controller.d.ts +42 -0
- package/dist/types/components/vega-sidenav/slimmers/controllers/vega-sidenav-open-status-controller.d.ts +94 -0
- package/dist/types/components/vega-sidenav/slimmers/renderers/vega-sidenav-collapse-button-renderer.d.ts +31 -0
- package/dist/types/components/vega-sidenav/test/test.helper.d.ts +6 -0
- package/dist/types/components/vega-sidenav/types.d.ts +24 -0
- package/dist/types/components/vega-sidenav/utils/index.d.ts +7 -0
- package/dist/types/components/vega-sidenav/vega-sidenav-group/slimmers/controllers/vega-sidenav-group-sub-state-controller.d.ts +10 -0
- package/dist/types/components/vega-sidenav/vega-sidenav-group/vega-sidenav-group.d.ts +47 -0
- package/dist/types/components/vega-sidenav/vega-sidenav-link/slimmers/controllers/vega-sidenav-link-sub-state.controller.d.ts +10 -0
- package/dist/types/components/vega-sidenav/vega-sidenav-link/vega-sidenav-link.d.ts +80 -0
- package/dist/types/components/vega-sidenav/vega-sidenav.d.ts +137 -0
- package/dist/types/components.d.ts +407 -1
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/feature-control/feature-flag.d.ts +2 -1
- package/dist/types/helpers/slimmers/element-appender-container/body-positioned-wrapper/body-positioned-wrapper.abstract.d.ts +15 -0
- package/dist/types/helpers/slimmers/element-appender-container/{position-relative-to-wrapper.d.ts → body-positioned-wrapper/position-relative-to-wrapper.d.ts} +5 -5
- package/dist/types/helpers/slimmers/element-appender-container/{vega-modal-wrapper.d.ts → body-positioned-wrapper/vega-modal-wrapper.d.ts} +5 -5
- package/dist/types/helpers/slimmers/element-appender-container/{vega-popover-wrapper.d.ts → body-positioned-wrapper/vega-popover-wrapper.d.ts} +5 -5
- package/dist/types/helpers/slimmers/element-appender-container/default-wrapper.d.ts +2 -2
- package/dist/types/helpers/slimmers/element-appender-container/element-appender-container-controller.d.ts +3 -3
- package/dist/types/helpers/slimmers/element-appender-slimmer.d.ts +1 -0
- package/dist/types/helpers/slimmers/position-calculation/base-position-calculation-strategy.d.ts +138 -0
- package/dist/types/helpers/slimmers/position-calculation/body-position-calculation-strategy.d.ts +34 -0
- package/dist/types/helpers/slimmers/position-calculation/position-calculation-controller.d.ts +54 -0
- package/dist/types/helpers/slimmers/position-calculation/screen-position-calculation-strategy.d.ts +34 -0
- package/dist/types/helpers/slimmers/position-calculation/test/body-position-calculation-strategy.test.d.ts +15 -0
- package/dist/types/helpers/slimmers/sub-state/sub-state-notify-slimmer.d.ts +1 -1
- package/dist/types/helpers/ui/element-appender.d.ts +9 -24
- package/dist/types/types/components.type.d.ts +7 -0
- package/dist/types/utils/number.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-d4c85e4e.entry.js → p-00c5aee5.entry.js} +1 -1
- package/dist/vega/{p-573948c2.js → p-04215e74.js} +1 -1
- package/dist/vega/p-042b4b3f.entry.js +1 -0
- package/dist/vega/{p-fd929ab5.entry.js → p-07a8cf89.entry.js} +1 -1
- package/dist/vega/p-0abe1ade.entry.js +1 -0
- package/dist/vega/p-0f0e4198.entry.js +1 -0
- package/dist/vega/{p-b86e8c8b.entry.js → p-11786565.entry.js} +1 -1
- package/dist/vega/{p-063c3ba6.entry.js → p-14f5a9ad.entry.js} +1 -1
- package/dist/vega/p-15023bad.entry.js +1 -0
- package/dist/vega/p-1be2fd46.entry.js +1 -0
- package/dist/vega/p-1bfcb6b7.entry.js +1 -0
- package/dist/vega/p-20d9c07c.entry.js +1 -0
- package/dist/vega/p-2306c736.js +1 -0
- package/dist/vega/p-262ec334.js +1 -0
- package/dist/vega/{p-a5f80d35.js → p-2d5a9f66.js} +1 -1
- package/dist/vega/{p-83af8ed7.js → p-302e7589.js} +1 -1
- package/dist/vega/p-32f651f7.js +1 -0
- package/dist/vega/p-34710a3c.entry.js +1 -0
- package/dist/vega/p-3903ce7a.entry.js +1 -0
- package/dist/vega/{p-b2053fa8.entry.js → p-4022f395.entry.js} +1 -1
- package/dist/vega/{p-51cd2a39.entry.js → p-438caeb3.entry.js} +1 -1
- package/dist/vega/{p-1ea57951.js → p-4d25df7d.js} +1 -1
- package/dist/vega/{p-319efe6c.js → p-4ffd7493.js} +1 -1
- package/dist/vega/p-5440344e.js +1 -0
- package/dist/vega/{p-fc746bae.entry.js → p-57d9bde6.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-5fbac513.js +1 -0
- package/dist/vega/{p-d686dd96.entry.js → p-623fe226.entry.js} +1 -1
- package/dist/vega/{p-be26b334.entry.js → p-63bee4f1.entry.js} +1 -1
- package/dist/vega/{p-40f6add9.entry.js → p-64ff6318.entry.js} +1 -1
- package/dist/vega/{p-9e6934fb.js → p-68ad953c.js} +1 -1
- package/dist/vega/{p-7a1df282.entry.js → p-69e63d21.entry.js} +1 -1
- package/dist/vega/{p-ac0ab38b.js → p-6a8f1251.js} +1 -1
- package/dist/vega/{p-9a4ffc2c.entry.js → p-72ecc510.entry.js} +1 -1
- package/dist/vega/{p-a2169994.entry.js → p-7372cd79.entry.js} +1 -1
- package/dist/vega/{p-7b40ac07.js → p-74958b1a.js} +1 -1
- package/dist/vega/{p-3fc59fd3.entry.js → p-760283d1.entry.js} +1 -1
- package/dist/vega/{p-152393dd.js → p-781fd6e0.js} +1 -1
- package/dist/vega/p-79019d08.js +1 -0
- package/dist/vega/p-7941701a.entry.js +1 -0
- package/dist/vega/{p-8fd6775a.entry.js → p-799cb0a4.entry.js} +1 -1
- package/dist/vega/{p-34545d2d.entry.js → p-7a6a0740.entry.js} +1 -1
- package/dist/vega/{p-a59c221b.entry.js → p-7df3aa44.entry.js} +1 -1
- package/dist/vega/p-80785fcf.entry.js +1 -0
- package/dist/vega/{p-8c72aa56.entry.js → p-83ef4c13.entry.js} +1 -1
- package/dist/vega/{p-1e33c6e3.entry.js → p-87640a4d.entry.js} +1 -1
- package/dist/vega/{p-1bbc62ef.entry.js → p-87cd0d6a.entry.js} +1 -1
- package/dist/vega/{p-22a85055.entry.js → p-8cfe4027.entry.js} +1 -1
- package/dist/vega/{p-056f448c.entry.js → p-9281cdb2.entry.js} +1 -1
- package/dist/vega/p-95b25b97.entry.js +1 -0
- package/dist/vega/p-9b45e5dc.entry.js +1 -0
- package/dist/vega/{p-4bc042ec.entry.js → p-9b9c0afb.entry.js} +1 -1
- package/dist/vega/{p-128fbe13.entry.js → p-9ba68531.entry.js} +2 -2
- package/dist/vega/{p-be784f53.js → p-9f3b1d77.js} +1 -1
- package/dist/vega/p-a66ea015.entry.js +1 -0
- package/dist/vega/p-a67748c6.entry.js +1 -0
- package/dist/vega/{p-33366630.entry.js → p-a6e1d9bc.entry.js} +1 -1
- package/dist/vega/{p-38d81bde.js → p-a9354a5c.js} +1 -1
- package/dist/vega/p-ab983e7d.js +1 -0
- package/dist/vega/p-ae3fd67e.js +1 -0
- package/dist/vega/p-b0502d01.js +1 -0
- package/dist/vega/{p-8b0533c4.entry.js → p-b1a249ef.entry.js} +1 -1
- package/dist/vega/{p-bccacf42.js → p-b347f967.js} +1 -1
- package/dist/vega/p-b3e754da.entry.js +1 -0
- package/dist/vega/{p-ddc70a7b.js → p-b62f0454.js} +1 -1
- package/dist/vega/{p-26d0d411.entry.js → p-b6e49ee9.entry.js} +1 -1
- package/dist/vega/{p-a901494d.entry.js → p-bb6f8b70.entry.js} +1 -1
- package/dist/vega/{p-456416ea.js → p-bdb94242.js} +1 -1
- package/dist/vega/{p-5d231a82.entry.js → p-be6041fc.entry.js} +1 -1
- package/dist/vega/{p-0dd750b0.entry.js → p-bf38199b.entry.js} +1 -1
- package/dist/vega/p-bf3fbb9b.js +1 -0
- package/dist/vega/p-c06e7880.js +1 -0
- package/dist/vega/{p-51622ace.entry.js → p-c3c2890e.entry.js} +1 -1
- package/dist/vega/{p-6874d6a1.entry.js → p-c6ed1982.entry.js} +1 -1
- package/dist/vega/{p-33596687.js → p-c7d70786.js} +1 -1
- package/dist/vega/p-cdebfee7.entry.js +1 -0
- package/dist/vega/p-cea70476.entry.js +1 -0
- package/dist/vega/{p-d550fc66.entry.js → p-d3c07efa.entry.js} +1 -1
- package/dist/vega/p-d71f968e.entry.js +1 -0
- package/dist/vega/{p-365c340d.entry.js → p-e165c9f1.entry.js} +1 -1
- package/dist/vega/{p-5dc98104.js → p-e5d7b4b8.js} +1 -1
- package/dist/vega/p-e6f91767.entry.js +1 -0
- package/dist/vega/p-e731976a.js +1 -0
- package/dist/vega/p-ed237efc.js +1 -0
- package/dist/vega/{p-cbeda6ca.entry.js → p-f2685ec5.entry.js} +1 -1
- package/dist/vega/{p-115e5967.js → p-f2851f16.js} +1 -1
- package/dist/vega/p-f5b0ce61.js +1 -0
- package/dist/vega/{p-a57eed48.entry.js → p-f64fb740.entry.js} +1 -1
- package/dist/vega/{p-80c0f98c.entry.js → p-fb3233db.entry.js} +1 -1
- package/dist/vega/{p-8f60c3ee.entry.js → p-ff22a95f.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +7 -3
- package/dist/collection/utils/position.js +0 -373
- package/dist/types/utils/position.d.ts +0 -17
- package/dist/vega/p-0120ce7a.js +0 -1
- package/dist/vega/p-0395e791.entry.js +0 -1
- package/dist/vega/p-048a97d1.entry.js +0 -1
- package/dist/vega/p-1f38eef6.entry.js +0 -1
- package/dist/vega/p-1fc5373a.entry.js +0 -1
- package/dist/vega/p-344ee7cb.js +0 -1
- package/dist/vega/p-3f5e44c1.js +0 -1
- package/dist/vega/p-41784db1.js +0 -1
- package/dist/vega/p-6168c1e7.js +0 -1
- package/dist/vega/p-64e8bb64.js +0 -1
- package/dist/vega/p-657df167.entry.js +0 -1
- package/dist/vega/p-68055c2d.entry.js +0 -1
- package/dist/vega/p-6d015656.entry.js +0 -1
- package/dist/vega/p-6e3cc7f0.entry.js +0 -1
- package/dist/vega/p-880f91fb.js +0 -1
- package/dist/vega/p-8843226a.entry.js +0 -1
- package/dist/vega/p-a10074a8.entry.js +0 -1
- package/dist/vega/p-a454acc4.entry.js +0 -1
- package/dist/vega/p-a8b1f19c.entry.js +0 -1
- package/dist/vega/p-acf8b473.js +0 -1
- package/dist/vega/p-d0a83562.entry.js +0 -1
- package/dist/vega/p-d4fb2264.entry.js +0 -1
- package/dist/vega/p-da86ba01.js +0 -1
- package/dist/vega/p-ead1a647.js +0 -1
- package/dist/vega/p-ead9a2b9.entry.js +0 -1
- package/dist/vega/p-ee68920f.js +0 -1
- package/dist/vega/p-f0ad06bd.entry.js +0 -1
- package/dist/vega/p-f2019f70.entry.js +0 -1
- package/dist/vega/p-f948debe.entry.js +0 -1
- package/dist/vega/p-fb6c90d6.js +0 -1
- /package/dist/types/{utils/test/position.test.d.ts → helpers/slimmers/position-calculation/test/screen-position-calculation-strategy.test.d.ts} +0 -0
package/dist/esm/{element-appender-slimmer-1172e2ea.js → element-appender-slimmer-48d826b2.js}
RENAMED
|
@@ -1,384 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as Placements, A as Alignments } from './ui-8424715a.js';
|
|
3
|
-
import { z as isTranslocationType } from './type-guard-63caf78b.js';
|
|
4
|
-
import { R as ResponsiveFormatFacade } from './responsive-format-facade-5a1329a7.js';
|
|
1
|
+
import { c as MapToComponentField, I as InjectVegaSlimmer, V as VegaSlimmer, L as LogUtility, M as MapToComponentMethod } from './global-slimmer-registry-17c4efd4.js';
|
|
5
2
|
import { f as findParent, c as isElementVisible, i as isParent } from './ui-0132dbb5.js';
|
|
6
|
-
import { I as InternalVegaZIndexManager } from './internal-vega-z-index-manager-
|
|
3
|
+
import { I as InternalVegaZIndexManager } from './internal-vega-z-index-manager-7d2b54c3.js';
|
|
7
4
|
import { c as createDynamicSlimmer } from './dynamic-slimmer-90b8af32.js';
|
|
8
5
|
import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-994c1e1b.js';
|
|
6
|
+
import { P as Placements, A as Alignments } from './ui-8424715a.js';
|
|
7
|
+
import { z as isTranslocationType } from './type-guard-63caf78b.js';
|
|
8
|
+
import { R as ResponsiveFormatFacade } from './responsive-format-facade-3dc84e41.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* Get the position of the element in the container according to the target element and the placement
|
|
12
|
-
* If give a translocation, it will apply the translocation to the result.
|
|
13
|
-
* Note: If you use this method to calculate the position, you should make container as relative position at first.
|
|
14
|
-
*
|
|
15
|
-
* @param {HTMLElement} container - The container element of the element to be positioned.
|
|
16
|
-
* @param {HTMLElement} element - The element to be positioned.
|
|
17
|
-
* @param {HTMLElement} target - The element to be positioned.
|
|
18
|
-
* @param {PlacementType | PlacementType[]} [placement] - The placement of the element, which can be a
|
|
19
|
-
* single placement or an array of placements.
|
|
20
|
-
* @param {PositionAlignmentType | PositionAlignmentType[]} alignment - The alignment of the element
|
|
21
|
-
* @param {TranslocationType} [translocation] - The offset of the element relative to the target.
|
|
22
|
-
* @returns {ElementPositionBox} A function that takes in a container, element, target, placement, and translocation and
|
|
23
|
-
* returns an ElementPositionBox.
|
|
24
|
-
*/
|
|
25
|
-
const getPositionBox = (container, element, target, placement, alignment, translocation = { X: 0, Y: 0 }) => {
|
|
26
|
-
const containerStyle = window.getComputedStyle(container);
|
|
27
|
-
if (containerStyle.position !== 'relative') {
|
|
28
|
-
LogUtility.warn(`Calculate position should make container as 'position: relative', otherwise the result might not be accurate.`);
|
|
29
|
-
}
|
|
30
|
-
const placements = getPlacements(placement);
|
|
31
|
-
const alignments = getAlignments(alignment);
|
|
32
|
-
const targetBox = getTargetBoundBox(target, container);
|
|
33
|
-
const elementBox = getElementBoundBox(element);
|
|
34
|
-
const containerBox = getElementScrollDimension(container);
|
|
35
|
-
const suitablePlacement = getSuitablePlacement(containerBox, elementBox, targetBox, placements);
|
|
36
|
-
const suitableAlignment = getSuitableAlignment(containerBox, elementBox, targetBox, suitablePlacement, alignments);
|
|
37
|
-
const positionBox = calculatePosition(elementBox, targetBox, suitablePlacement, suitableAlignment);
|
|
38
|
-
const translocationBox = getTranslocationBox(Array.isArray(placement) ? placement[0] : placement, suitablePlacement, translocation);
|
|
39
|
-
positionBox.placement = suitablePlacement;
|
|
40
|
-
positionBox.alignment = suitableAlignment;
|
|
41
|
-
positionBox.left += translocationBox.X;
|
|
42
|
-
positionBox.top += translocationBox.Y;
|
|
43
|
-
return positionBox;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* It returns the translocation of the element relative to the target element
|
|
47
|
-
*
|
|
48
|
-
* @param {Nullable<PlacementType>} originPlacement - The origin placement of the element.
|
|
49
|
-
* @param {PlacementType} placement - The suitable placement of the element.
|
|
50
|
-
* @param {TranslocationType} translocation - TranslocationType
|
|
51
|
-
* @returns {TranslocationType} A translocation object with X and Y properties.
|
|
52
|
-
*/
|
|
53
|
-
function getTranslocationBox(originPlacement, placement, translocation) {
|
|
54
|
-
const result = { X: 0, Y: 0 };
|
|
55
|
-
if (isTranslocationType(translocation)) {
|
|
56
|
-
let xValue = translocation.X;
|
|
57
|
-
let yValue = translocation.Y;
|
|
58
|
-
// If originPlacement and placement is not in same axis, it should reverse axis.
|
|
59
|
-
if ((originPlacement &&
|
|
60
|
-
['left', 'right'].includes(originPlacement) &&
|
|
61
|
-
['top', 'bottom'].includes(placement)) ||
|
|
62
|
-
(originPlacement &&
|
|
63
|
-
['top', 'bottom'].includes(originPlacement) &&
|
|
64
|
-
['left', 'right'].includes(placement))) {
|
|
65
|
-
xValue = translocation.Y;
|
|
66
|
-
yValue = translocation.X;
|
|
67
|
-
}
|
|
68
|
-
if (['bottom', 'top'].includes(placement)) {
|
|
69
|
-
result.Y = placement === 'top' ? -yValue : yValue;
|
|
70
|
-
result.X = xValue;
|
|
71
|
-
}
|
|
72
|
-
if (['left', 'right'].includes(placement)) {
|
|
73
|
-
result.X = placement === 'left' ? -xValue : xValue;
|
|
74
|
-
result.Y = yValue;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* It takes a placement string or array of placements and returns an array of placements
|
|
81
|
-
* if given placement is single, we should completion the placements with the default {@link Placements}
|
|
82
|
-
* and make given placement as default.
|
|
83
|
-
* if given placement is array, we should use it directly, even it partial of {@link Placements}.
|
|
84
|
-
* if not placement give. we should use {@link Placements}.
|
|
85
|
-
*
|
|
86
|
-
* @param {PlacementType | PlacementType[]} [placement] - The placement of the tooltip.
|
|
87
|
-
* @returns {PlacementType[]} ordered placements.
|
|
88
|
-
*/
|
|
89
|
-
function getPlacements(placement) {
|
|
90
|
-
if (typeof placement === 'string') {
|
|
91
|
-
const partial = Placements.filter((direction) => direction !== placement);
|
|
92
|
-
return [placement, ...partial];
|
|
93
|
-
}
|
|
94
|
-
else if (Array.isArray(placement)) {
|
|
95
|
-
return placement;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
return [...Placements];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* It returns acceptable alignments.
|
|
103
|
-
*
|
|
104
|
-
* @param {PositionAlignmentType | PositionAlignmentType[]} [alignment] - The alignment of the popup.
|
|
105
|
-
* @returns {PositionAlignmentType[]} acceptable alignments
|
|
106
|
-
*/
|
|
107
|
-
function getAlignments(alignment) {
|
|
108
|
-
if (typeof alignment === 'string') {
|
|
109
|
-
const partial = Alignments.filter((item) => item !== alignment);
|
|
110
|
-
return [alignment, ...partial];
|
|
111
|
-
}
|
|
112
|
-
else if (Array.isArray(alignment)) {
|
|
113
|
-
return alignment;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
return [...Alignments];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* It takes a placement, a target box, and a element box, and returns an element box
|
|
121
|
-
*
|
|
122
|
-
* @param {ElementBoundBox} elementBox - The position of the element element.
|
|
123
|
-
* @param {ElementBoundBox} targetBox - The position of the target element.
|
|
124
|
-
* @param {PlacementType} placement - The placement of the element.
|
|
125
|
-
* @param {PositionAlignmentType} alignment - The alignment of the element
|
|
126
|
-
* @returns {ElementPositionBox} An object with top and left properties.
|
|
127
|
-
*/
|
|
128
|
-
function calculatePosition(elementBox, targetBox, placement, alignment) {
|
|
129
|
-
return {
|
|
130
|
-
top: calculateTop(elementBox, targetBox, placement, alignment),
|
|
131
|
-
left: calculateLeft(elementBox, targetBox, placement, alignment),
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Calculate the left position of the element
|
|
136
|
-
*
|
|
137
|
-
* @param {ElementBoundBox} elementBox - The position box of the element.
|
|
138
|
-
* @param {ElementBoundBox} targetBox - The position box of the target element that is attached to.
|
|
139
|
-
* @param {PlacementType} placement - The placement of the element.
|
|
140
|
-
* @param {PositionAlignmentType} alignment - The alignment of the element
|
|
141
|
-
* @returns {number} The left position of the element.
|
|
142
|
-
*/
|
|
143
|
-
function calculateLeft(elementBox, targetBox, placement, alignment) {
|
|
144
|
-
switch (placement) {
|
|
145
|
-
case 'top':
|
|
146
|
-
case 'bottom': {
|
|
147
|
-
if (alignment === 'end') {
|
|
148
|
-
return targetBox.left + targetBox.width - elementBox.width;
|
|
149
|
-
}
|
|
150
|
-
else if (alignment === 'center') {
|
|
151
|
-
return targetBox.left - (elementBox.width - targetBox.width) / 2;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
return targetBox.left;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
case 'left': {
|
|
158
|
-
return targetBox.left - elementBox.width;
|
|
159
|
-
}
|
|
160
|
-
case 'right': {
|
|
161
|
-
return targetBox.left + targetBox.width;
|
|
162
|
-
}
|
|
163
|
-
/* istanbul ignore next */
|
|
164
|
-
default:
|
|
165
|
-
throw new Error(`Unexpected placement: ${placement}. Expected values are top, bottom, left, or right.`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Calculate the top position of the element
|
|
170
|
-
*
|
|
171
|
-
* @param {ElementBoundBox} elementBox - The position box of the element.
|
|
172
|
-
* @param {ElementBoundBox} targetBox - The position box of the target element that is attached to.
|
|
173
|
-
* @param {PlacementType} placement - The placement of the element.
|
|
174
|
-
* @param {PositionAlignmentType} alignment - The alignment of the element
|
|
175
|
-
* @returns {number} the top position of the element.
|
|
176
|
-
*/
|
|
177
|
-
function calculateTop(elementBox, targetBox, placement, alignment) {
|
|
178
|
-
switch (placement) {
|
|
179
|
-
case 'left':
|
|
180
|
-
case 'right': {
|
|
181
|
-
if (alignment === 'end') {
|
|
182
|
-
return targetBox.top + targetBox.height - elementBox.height;
|
|
183
|
-
}
|
|
184
|
-
else if (alignment === 'center') {
|
|
185
|
-
return targetBox.top - (elementBox.height - targetBox.height) / 2;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
return targetBox.top;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
case 'top': {
|
|
192
|
-
return targetBox.top - elementBox.height;
|
|
193
|
-
}
|
|
194
|
-
case 'bottom': {
|
|
195
|
-
return targetBox.top + targetBox.height;
|
|
196
|
-
}
|
|
197
|
-
/* istanbul ignore next */
|
|
198
|
-
default:
|
|
199
|
-
throw new Error(`Unexpected placement: ${placement}. Expected values are top, bottom, left, or right.`);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* It takes a list of placements and returns the first placement that has enough space to place the
|
|
204
|
-
* element
|
|
205
|
-
*
|
|
206
|
-
* @param {ElementScrollDimension} containerBox - The box of the container element.
|
|
207
|
-
* @param {ElementBoundBox} elementBox - The box of the element to be placed.
|
|
208
|
-
* @param {ElementBoundBox} targetBox - The box of the target element.
|
|
209
|
-
* @param {PlacementType[]} placements - The placements that we want to try.
|
|
210
|
-
* @returns {PlacementType} A function that takes in a containerBox, elementBox, targetBox, placements, and element.
|
|
211
|
-
*/
|
|
212
|
-
function getSuitablePlacement(containerBox, elementBox, targetBox, placements) {
|
|
213
|
-
const defaultPlacement = placements[0];
|
|
214
|
-
const suitablePlacement = placements.find((placement) => hasEnoughSpace(containerBox, placement, targetBox, elementBox));
|
|
215
|
-
if (suitablePlacement) {
|
|
216
|
-
return suitablePlacement;
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
LogUtility.warn(`
|
|
220
|
-
No enough space found for placing element and we will keep using the defined placement:
|
|
221
|
-
${defaultPlacement}
|
|
222
|
-
`);
|
|
223
|
-
return defaultPlacement;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* It takes a list of alignments and returns the suitable one that has enough space to fit the element
|
|
228
|
-
*
|
|
229
|
-
* @param {ElementScrollDimension} containerBox - The bounding box of the container element.
|
|
230
|
-
* @param {ElementBoundBox} elementBox - The box of the element that we want to position.
|
|
231
|
-
* @param {ElementBoundBox} targetBox - The box of the element that the element to be positioned is aligned to.
|
|
232
|
-
* @param {PlacementType} placement - The placement of the element relative to the target.
|
|
233
|
-
* @param {PositionAlignmentType[]} alignments - An array of alignments to try.
|
|
234
|
-
* @returns {PositionAlignmentType} the alignment that is suitable for the element.
|
|
235
|
-
*/
|
|
236
|
-
const getSuitableAlignment = (containerBox, elementBox, targetBox, placement, alignments) => {
|
|
237
|
-
const defaultAlignment = alignments[0];
|
|
238
|
-
const suitableAlignment = alignments.find((alignment) => hasEnoughAlignmentSpace(containerBox, targetBox, elementBox, placement, alignment));
|
|
239
|
-
if (suitableAlignment) {
|
|
240
|
-
return suitableAlignment;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
LogUtility.warn(`
|
|
244
|
-
No enough space found for placing element and we will keep using the defined alignment:
|
|
245
|
-
${defaultAlignment}
|
|
246
|
-
`);
|
|
247
|
-
return defaultAlignment;
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Whether the alignment space is enough
|
|
252
|
-
*
|
|
253
|
-
* @param {ElementScrollDimension} containerBox - The bounding box of the container element.
|
|
254
|
-
* @param {ElementBoundBox} targetBox - The position of the target element.
|
|
255
|
-
* @param {ElementBoundBox} elementBox - The box of the element that we're trying to position.
|
|
256
|
-
* @param {PlacementType} placement - The placement of the element relative to the target.
|
|
257
|
-
* @param {PlacementType} alignment - The alignment of the element relative to the target.
|
|
258
|
-
* @returns {boolean} return true if it has enough space, otherwise false
|
|
259
|
-
*/
|
|
260
|
-
function hasEnoughAlignmentSpace(containerBox, targetBox, elementBox, placement, alignment) {
|
|
261
|
-
if (['top', 'bottom'].includes(placement)) {
|
|
262
|
-
switch (alignment) {
|
|
263
|
-
case 'start': {
|
|
264
|
-
return targetBox.left + elementBox.width <= containerBox.width;
|
|
265
|
-
}
|
|
266
|
-
case 'center': {
|
|
267
|
-
return (targetBox.left >= elementBox.width - targetBox.width &&
|
|
268
|
-
targetBox.left + targetBox.width / 2 + elementBox.width / 2 <= containerBox.width);
|
|
269
|
-
}
|
|
270
|
-
case 'end': {
|
|
271
|
-
return targetBox.left + targetBox.width >= elementBox.width;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
if (['right', 'left'].includes(placement)) {
|
|
276
|
-
switch (alignment) {
|
|
277
|
-
case 'start': {
|
|
278
|
-
return targetBox.top + elementBox.height <= containerBox.height;
|
|
279
|
-
}
|
|
280
|
-
case 'center': {
|
|
281
|
-
return (targetBox.top >= elementBox.height - targetBox.height &&
|
|
282
|
-
targetBox.top + targetBox.height / 2 + elementBox.height / 2 <= containerBox.height);
|
|
283
|
-
}
|
|
284
|
-
case 'end': {
|
|
285
|
-
return targetBox.top + targetBox.height >= elementBox.height;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/* istanbul ignore next */
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* If the placement is top or left, then the target's top or left position must be greater than or
|
|
294
|
-
* equal to the element's height or width. If the placement is bottom or right, then the container's
|
|
295
|
-
* height or width minus the target's top or left position minus the target's height or width must be
|
|
296
|
-
* greater than or equal to the element's height or width.
|
|
297
|
-
*
|
|
298
|
-
* @param {ElementScrollDimension} containerBox - The bounding box of the container element.
|
|
299
|
-
* @param {PlacementType} placement - The placement of the element.
|
|
300
|
-
* @param {ElementBoundBox} targetBox - The position of the target element.
|
|
301
|
-
* @param {ElementBoundBox} elementBox - The dimensions of the element to be positioned.
|
|
302
|
-
* @returns {boolean} A boolean value.
|
|
303
|
-
*/
|
|
304
|
-
function hasEnoughSpace(containerBox, placement, targetBox, elementBox) {
|
|
305
|
-
switch (placement) {
|
|
306
|
-
case 'top':
|
|
307
|
-
return targetBox.top >= elementBox.height;
|
|
308
|
-
case 'bottom':
|
|
309
|
-
return containerBox.height - targetBox.top - targetBox.height >= elementBox.height;
|
|
310
|
-
case 'left':
|
|
311
|
-
return targetBox.left >= elementBox.width;
|
|
312
|
-
case 'right':
|
|
313
|
-
return containerBox.width - targetBox.left - targetBox.width >= elementBox.width;
|
|
314
|
-
/* istanbul ignore next */
|
|
315
|
-
default:
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* It returns the position of an element relative to its container and also includes the scroll height of container.
|
|
321
|
-
*
|
|
322
|
-
* @param {HTMLElement} target - The element that you want to position.
|
|
323
|
-
* @param {HTMLElement} container - The container element that the target element is inside of.
|
|
324
|
-
* @returns {ElementBoundBox} An object with the properties width, height, top, and left.
|
|
325
|
-
*/
|
|
326
|
-
function getTargetBoundBox(target, container) {
|
|
327
|
-
const containerRect = container.getBoundingClientRect();
|
|
328
|
-
const targetRect = target.getBoundingClientRect();
|
|
329
|
-
const targetTop = targetRect.top - containerRect.top + container.scrollTop;
|
|
330
|
-
const targetLeft = targetRect.left - containerRect.left + container.scrollLeft;
|
|
331
|
-
return {
|
|
332
|
-
width: targetRect.width,
|
|
333
|
-
height: targetRect.height,
|
|
334
|
-
top: targetTop,
|
|
335
|
-
left: targetLeft,
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* "Get the width, height, and top position of an element."
|
|
340
|
-
*
|
|
341
|
-
* The function takes an element as an argument and returns an object with three properties: width,
|
|
342
|
-
* height, and top.
|
|
343
|
-
*
|
|
344
|
-
* Note: If element is hide, we should temporary change it to `block` to get the bounding client rect of element,
|
|
345
|
-
* After do that, this element will change to origin `hide`, if not, it will be contained in the calculate of `document.documentElement.scrollHeight`
|
|
346
|
-
*
|
|
347
|
-
* @param {HTMLElement} element - HTMLElement - The element to get the position box for.
|
|
348
|
-
* @returns {ElementBoundBox} An object with the width, height, and top properties of the element.
|
|
349
|
-
*/
|
|
350
|
-
function getElementBoundBox(element) {
|
|
351
|
-
const isElementHide = element.classList.contains('vega-force-hidden');
|
|
352
|
-
if (isElementHide)
|
|
353
|
-
element.classList.remove('vega-force-hidden');
|
|
354
|
-
const elementRect = element.getBoundingClientRect();
|
|
355
|
-
if (isElementHide)
|
|
356
|
-
element.classList.add('vega-force-hidden');
|
|
357
|
-
return {
|
|
358
|
-
width: elementRect.width,
|
|
359
|
-
height: elementRect.height,
|
|
360
|
-
left: elementRect.left,
|
|
361
|
-
top: elementRect.top,
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* "Get the width and height of an element."
|
|
366
|
-
*
|
|
367
|
-
* The function takes a single parameter, a container element, and returns an object with two
|
|
368
|
-
* properties: width and height
|
|
369
|
-
*
|
|
370
|
-
* @param {HTMLElement} container - The container element that the tooltip will be positioned relative
|
|
371
|
-
* to.
|
|
372
|
-
* @returns {ElementScrollDimension} An object with two properties: width and height.
|
|
373
|
-
*/
|
|
374
|
-
function getElementScrollDimension(container) {
|
|
375
|
-
return {
|
|
376
|
-
width: container.scrollWidth,
|
|
377
|
-
height: container.scrollHeight,
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
382
11
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
383
12
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
384
13
|
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;
|
|
@@ -388,32 +17,46 @@ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
388
17
|
* This class is is used to retrieve the body element of document.
|
|
389
18
|
*/
|
|
390
19
|
class DefaultWrapper {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The canRetrieve function return is always true.
|
|
22
|
+
*
|
|
23
|
+
* @returns {boolean} the boolean type.
|
|
24
|
+
*/
|
|
25
|
+
canRetrieve() {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The retrieve function get the body element of document.
|
|
30
|
+
*
|
|
31
|
+
* @returns {HTMLElement} the element.
|
|
32
|
+
*/
|
|
33
|
+
retrieve() {
|
|
34
|
+
const container = document.body;
|
|
35
|
+
if (this.showConfig.appendableElement.parentElement !== container) {
|
|
36
|
+
container.append(this.showConfig.appendableElement);
|
|
37
|
+
}
|
|
38
|
+
return container;
|
|
410
39
|
}
|
|
411
40
|
}
|
|
412
|
-
__decorate$
|
|
41
|
+
__decorate$9([
|
|
413
42
|
MapToComponentField()
|
|
414
43
|
], DefaultWrapper.prototype, "showConfig", void 0);
|
|
415
44
|
|
|
416
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Body positioned wrapper.
|
|
47
|
+
*/
|
|
48
|
+
class BodyPositionedWrapper {
|
|
49
|
+
/**
|
|
50
|
+
* Valid is a body position used wrapper.
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} can retrieve or not.
|
|
53
|
+
*/
|
|
54
|
+
canRetrieve() {
|
|
55
|
+
return !this.showConfig.isScreenPosition;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
417
60
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
418
61
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
419
62
|
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;
|
|
@@ -424,34 +67,35 @@ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
424
67
|
*
|
|
425
68
|
* @property {HTMLElement} showConfig the show config
|
|
426
69
|
*/
|
|
427
|
-
class PositionRelativeToWrapper {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
!!
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
70
|
+
class PositionRelativeToWrapper extends BodyPositionedWrapper {
|
|
71
|
+
/**
|
|
72
|
+
* The canRetrieve function just determines whether the showConfig contains the positionRelativeTo object.
|
|
73
|
+
*
|
|
74
|
+
* @returns {boolean} the boolean type.
|
|
75
|
+
*/
|
|
76
|
+
canRetrieve() {
|
|
77
|
+
return (super.canRetrieve() &&
|
|
78
|
+
!!this.showConfig.positionRelativeTo &&
|
|
79
|
+
!!document.querySelector(this.showConfig.positionRelativeTo));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The retrieve function query the element of positionRelativeTo in showConfig.
|
|
83
|
+
*
|
|
84
|
+
* @returns {HTMLElement} the element.
|
|
85
|
+
*/
|
|
86
|
+
retrieve() {
|
|
87
|
+
const container = document.querySelector(this.showConfig.positionRelativeTo);
|
|
88
|
+
if (this.showConfig.appendableElement.parentElement !== container) {
|
|
89
|
+
container.append(this.showConfig.appendableElement);
|
|
90
|
+
}
|
|
91
|
+
return container;
|
|
448
92
|
}
|
|
449
93
|
}
|
|
450
|
-
__decorate$
|
|
94
|
+
__decorate$8([
|
|
451
95
|
MapToComponentField()
|
|
452
96
|
], PositionRelativeToWrapper.prototype, "showConfig", void 0);
|
|
453
97
|
|
|
454
|
-
var __decorate$
|
|
98
|
+
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
455
99
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
456
100
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
457
101
|
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;
|
|
@@ -462,20 +106,22 @@ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
462
106
|
*
|
|
463
107
|
* @property {HTMLElement} showConfig the show config
|
|
464
108
|
*/
|
|
465
|
-
class VegaModalWrapper {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
109
|
+
class VegaModalWrapper extends BodyPositionedWrapper {
|
|
110
|
+
/**
|
|
111
|
+
* The canRetrieve function just determines whether the target of showConfig has the `vega-modal` element. If not, search upwards layer by layer.
|
|
112
|
+
*
|
|
113
|
+
* @returns {boolean} the boolean type.
|
|
114
|
+
*/
|
|
115
|
+
canRetrieve() {
|
|
116
|
+
return super.canRetrieve() && !!findParent(this.showConfig.target, 'vega-modal');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The retrieve function get the slot position of vega-modal element.
|
|
120
|
+
*
|
|
121
|
+
* @returns {HTMLElement} the element.
|
|
122
|
+
*/
|
|
123
|
+
retrieve() {
|
|
124
|
+
return this.getVegaModalShowConfigContainer();
|
|
479
125
|
}
|
|
480
126
|
/**
|
|
481
127
|
* This function `getVegaModalContentWithoutScroll` determines whether vega-modal has a slot whose name is `content` or `modal-content`. If there is a component rendered in the modal, the elementAppender added to the corresponding slot attribute is added. If not, the elementAppender is not directly appended to the root directory of vega-modal.
|
|
@@ -508,11 +154,11 @@ class VegaModalWrapper {
|
|
|
508
154
|
return modalContentScrollable ? modalContentScrollable : modalDialog;
|
|
509
155
|
}
|
|
510
156
|
}
|
|
511
|
-
__decorate$
|
|
157
|
+
__decorate$7([
|
|
512
158
|
MapToComponentField({ writable: true })
|
|
513
159
|
], VegaModalWrapper.prototype, "showConfig", void 0);
|
|
514
160
|
|
|
515
|
-
var __decorate$
|
|
161
|
+
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
516
162
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
517
163
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
518
164
|
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;
|
|
@@ -523,31 +169,31 @@ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
523
169
|
*
|
|
524
170
|
* @property {HTMLElement} showConfig the show config
|
|
525
171
|
*/
|
|
526
|
-
class VegaPopoverWrapper {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
172
|
+
class VegaPopoverWrapper extends BodyPositionedWrapper {
|
|
173
|
+
/**
|
|
174
|
+
* The canRetrieve function just determine whether the target of showConfig has the class `vega-popover`. If not, search upwards layer by layer.
|
|
175
|
+
*
|
|
176
|
+
* @returns {boolean} the boolean type.
|
|
177
|
+
*/
|
|
178
|
+
canRetrieve() {
|
|
179
|
+
return super.canRetrieve() && !!findParent(this.showConfig.target, '.vega-popover');
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The retrieve function get the element that if the target of showConfig does not have the class vega-popover, search upwards layer by layer until this element is found.
|
|
183
|
+
*
|
|
184
|
+
* @returns {HTMLElement} the element.
|
|
185
|
+
*/
|
|
186
|
+
retrieve() {
|
|
187
|
+
const container = findParent(this.showConfig.target, '.vega-popover');
|
|
188
|
+
container.append(this.showConfig.appendableElement);
|
|
189
|
+
return container;
|
|
544
190
|
}
|
|
545
191
|
}
|
|
546
|
-
__decorate$
|
|
192
|
+
__decorate$6([
|
|
547
193
|
MapToComponentField()
|
|
548
194
|
], VegaPopoverWrapper.prototype, "showConfig", void 0);
|
|
549
195
|
|
|
550
|
-
var __decorate$
|
|
196
|
+
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
551
197
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
552
198
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
553
199
|
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;
|
|
@@ -591,25 +237,606 @@ class ElementAppenderContainerController extends VegaSlimmer {
|
|
|
591
237
|
];
|
|
592
238
|
}
|
|
593
239
|
}
|
|
594
|
-
__decorate$
|
|
240
|
+
__decorate$5([
|
|
595
241
|
MapToComponentField({ writable: true })
|
|
596
242
|
], ElementAppenderContainerController.prototype, "container", void 0);
|
|
597
|
-
__decorate$
|
|
243
|
+
__decorate$5([
|
|
598
244
|
MapToComponentField({ writable: true })
|
|
599
245
|
], ElementAppenderContainerController.prototype, "showConfig", void 0);
|
|
600
|
-
__decorate$
|
|
246
|
+
__decorate$5([
|
|
601
247
|
InjectVegaSlimmer()
|
|
602
248
|
], ElementAppenderContainerController.prototype, "positionRelativeToWrapper", void 0);
|
|
603
|
-
__decorate$
|
|
249
|
+
__decorate$5([
|
|
604
250
|
InjectVegaSlimmer()
|
|
605
251
|
], ElementAppenderContainerController.prototype, "vegaPopoverWrapper", void 0);
|
|
606
|
-
__decorate$
|
|
252
|
+
__decorate$5([
|
|
607
253
|
InjectVegaSlimmer()
|
|
608
254
|
], ElementAppenderContainerController.prototype, "vegaModalWrapper", void 0);
|
|
609
|
-
__decorate$
|
|
255
|
+
__decorate$5([
|
|
610
256
|
InjectVegaSlimmer()
|
|
611
257
|
], ElementAppenderContainerController.prototype, "defaultWrapper", void 0);
|
|
612
258
|
|
|
259
|
+
/**
|
|
260
|
+
* calculate position
|
|
261
|
+
*/
|
|
262
|
+
class BasePositionCalculationStrategy extends VegaSlimmer {
|
|
263
|
+
/**
|
|
264
|
+
* Get the position box.
|
|
265
|
+
*
|
|
266
|
+
* @param {PlacementType[]} placement - previous placement.
|
|
267
|
+
* @param {PositionAlignmentType[]} alignment - previous placement.
|
|
268
|
+
* @returns {ElementPositionBox} A function that takes in a container, element, target, placement, and translocation and
|
|
269
|
+
* returns an ElementPositionBox.
|
|
270
|
+
*/
|
|
271
|
+
getPositionBox(placement, alignment) {
|
|
272
|
+
const placements = placement || this.getPlacements();
|
|
273
|
+
const alignments = alignment || this.getAlignments();
|
|
274
|
+
const targetBox = this.getTargetBoundBox();
|
|
275
|
+
const elementBox = this.getElementBoundBox();
|
|
276
|
+
const containerBox = this.getElementScrollDimension();
|
|
277
|
+
const suitablePlacement = this.getSuitablePlacement(containerBox, elementBox, targetBox, placements);
|
|
278
|
+
const suitableAlignment = this.getSuitableAlignment(containerBox, elementBox, targetBox, suitablePlacement, alignments);
|
|
279
|
+
const positionBox = this.calculatePosition(elementBox, targetBox, suitablePlacement, suitableAlignment);
|
|
280
|
+
const translocationBox = this.getTranslocationBox(suitablePlacement);
|
|
281
|
+
positionBox.placement = suitablePlacement;
|
|
282
|
+
positionBox.alignment = suitableAlignment;
|
|
283
|
+
positionBox.left += translocationBox.X;
|
|
284
|
+
positionBox.top += translocationBox.Y;
|
|
285
|
+
return positionBox;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* "Get the width, height, and top position of an element."
|
|
289
|
+
*
|
|
290
|
+
* The function takes an element as an argument and returns an object with three properties: width,
|
|
291
|
+
* height, and top.
|
|
292
|
+
*
|
|
293
|
+
* Note: If element is hide, we should temporary change it to `block` to get the bounding client rect of element,
|
|
294
|
+
* After do that, this element will change to origin `hide`, if not, it will be contained in the calculate of `document.documentElement.scrollHeight`
|
|
295
|
+
*
|
|
296
|
+
* @returns {ElementBoundBox} An object with the width, height, and top properties of the element.
|
|
297
|
+
*/
|
|
298
|
+
getElementBoundBox() {
|
|
299
|
+
const element = this.showConfig.appendableElement;
|
|
300
|
+
const isElementHide = element.classList.contains('vega-force-hidden');
|
|
301
|
+
if (isElementHide)
|
|
302
|
+
element.classList.remove('vega-force-hidden');
|
|
303
|
+
const elementRect = element.getBoundingClientRect();
|
|
304
|
+
if (isElementHide)
|
|
305
|
+
element.classList.add('vega-force-hidden');
|
|
306
|
+
return {
|
|
307
|
+
width: elementRect.width,
|
|
308
|
+
height: elementRect.height,
|
|
309
|
+
left: elementRect.left,
|
|
310
|
+
top: elementRect.top,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* It takes a placement string or array of placements and returns an array of placements
|
|
315
|
+
* if given placement is single, we should completion the placements with the default {@link Placements}
|
|
316
|
+
* and make given placement as default.
|
|
317
|
+
* if given placement is array, we should use it directly, even it partial of {@link Placements}.
|
|
318
|
+
* if not placement give. we should use {@link Placements}.
|
|
319
|
+
*
|
|
320
|
+
* @returns {PlacementType[]} ordered placements.
|
|
321
|
+
*/
|
|
322
|
+
getPlacements() {
|
|
323
|
+
const placement = this.showConfig.placement;
|
|
324
|
+
if (typeof placement === 'string') {
|
|
325
|
+
const partial = Placements.filter((direction) => direction !== placement);
|
|
326
|
+
return [placement, ...partial];
|
|
327
|
+
}
|
|
328
|
+
else if (Array.isArray(placement)) {
|
|
329
|
+
return placement;
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
return [...Placements];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* It returns acceptable alignments.
|
|
337
|
+
*
|
|
338
|
+
* @returns {PositionAlignmentType[]} acceptable alignments
|
|
339
|
+
*/
|
|
340
|
+
getAlignments() {
|
|
341
|
+
const alignment = this.showConfig.alignment;
|
|
342
|
+
if (typeof alignment === 'string') {
|
|
343
|
+
const partial = Alignments.filter((item) => item !== alignment);
|
|
344
|
+
return [alignment, ...partial];
|
|
345
|
+
}
|
|
346
|
+
else if (Array.isArray(alignment)) {
|
|
347
|
+
return alignment;
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
return [...Alignments];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* It takes a placement, a target box, and a element box, and returns an element box
|
|
355
|
+
*
|
|
356
|
+
* @param {ElementBoundBox} elementBox - The position of the element element.
|
|
357
|
+
* @param {ElementBoundBox} targetBox - The position of the target element.
|
|
358
|
+
* @param {PlacementType} placement - The placement of the element.
|
|
359
|
+
* @param {PositionAlignmentType} alignment - The alignment of the element
|
|
360
|
+
* @returns {ElementPositionBox} An object with top and left properties.
|
|
361
|
+
*/
|
|
362
|
+
calculatePosition(elementBox, targetBox, placement, alignment) {
|
|
363
|
+
return {
|
|
364
|
+
top: this.calculateTop(elementBox, targetBox, placement, alignment),
|
|
365
|
+
left: this.calculateLeft(elementBox, targetBox, placement, alignment),
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* It returns the translocation of the element relative to the target element
|
|
370
|
+
*
|
|
371
|
+
* @param {PlacementType} placement - The suitable placement of the element.
|
|
372
|
+
* @returns {TranslocationType} A translocation object with X and Y properties.
|
|
373
|
+
*/
|
|
374
|
+
getTranslocationBox(placement) {
|
|
375
|
+
const originPlacement = Array.isArray(this.showConfig.placement)
|
|
376
|
+
? this.showConfig.placement[0]
|
|
377
|
+
: this.showConfig.placement;
|
|
378
|
+
const translocation = this.getTranslocation();
|
|
379
|
+
const result = { X: 0, Y: 0 };
|
|
380
|
+
if (isTranslocationType(translocation)) {
|
|
381
|
+
let xValue = translocation.X;
|
|
382
|
+
let yValue = translocation.Y;
|
|
383
|
+
// If originPlacement and placement is not in same axis, it should reverse axis.
|
|
384
|
+
if ((originPlacement &&
|
|
385
|
+
['left', 'right'].includes(originPlacement) &&
|
|
386
|
+
['top', 'bottom'].includes(placement)) ||
|
|
387
|
+
(originPlacement &&
|
|
388
|
+
['top', 'bottom'].includes(originPlacement) &&
|
|
389
|
+
['left', 'right'].includes(placement))) {
|
|
390
|
+
xValue = translocation.Y;
|
|
391
|
+
yValue = translocation.X;
|
|
392
|
+
}
|
|
393
|
+
if (['bottom', 'top'].includes(placement)) {
|
|
394
|
+
result.Y = placement === 'top' ? -yValue : yValue;
|
|
395
|
+
result.X = xValue;
|
|
396
|
+
}
|
|
397
|
+
if (['left', 'right'].includes(placement)) {
|
|
398
|
+
result.X = placement === 'left' ? -xValue : xValue;
|
|
399
|
+
result.Y = yValue;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return result;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Calculate the left position of the element
|
|
406
|
+
*
|
|
407
|
+
* @param {ElementBoundBox} elementBox - The position box of the element.
|
|
408
|
+
* @param {ElementBoundBox} targetBox - The position box of the target element that is attached to.
|
|
409
|
+
* @param {PlacementType} placement - The placement of the element.
|
|
410
|
+
* @param {PositionAlignmentType} alignment - The alignment of the element
|
|
411
|
+
* @returns {number} The left position of the element.
|
|
412
|
+
*/
|
|
413
|
+
calculateLeft(elementBox, targetBox, placement, alignment) {
|
|
414
|
+
switch (placement) {
|
|
415
|
+
case 'top':
|
|
416
|
+
case 'bottom': {
|
|
417
|
+
if (alignment === 'end') {
|
|
418
|
+
return targetBox.left + targetBox.width - elementBox.width;
|
|
419
|
+
}
|
|
420
|
+
else if (alignment === 'center') {
|
|
421
|
+
return targetBox.left - (elementBox.width - targetBox.width) / 2;
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
return targetBox.left;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
case 'left': {
|
|
428
|
+
return targetBox.left - elementBox.width;
|
|
429
|
+
}
|
|
430
|
+
case 'right': {
|
|
431
|
+
return targetBox.left + targetBox.width;
|
|
432
|
+
}
|
|
433
|
+
/* istanbul ignore next */
|
|
434
|
+
default:
|
|
435
|
+
throw new Error(`Unexpected placement: ${placement}. Expected values are top, bottom, left, or right.`);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Calculate the top position of the element
|
|
440
|
+
*
|
|
441
|
+
* @param {ElementBoundBox} elementBox - The position box of the element.
|
|
442
|
+
* @param {ElementBoundBox} targetBox - The position box of the target element that is attached to.
|
|
443
|
+
* @param {PlacementType} placement - The placement of the element.
|
|
444
|
+
* @param {PositionAlignmentType} alignment - The alignment of the element
|
|
445
|
+
* @returns {number} the top position of the element.
|
|
446
|
+
*/
|
|
447
|
+
calculateTop(elementBox, targetBox, placement, alignment) {
|
|
448
|
+
switch (placement) {
|
|
449
|
+
case 'left':
|
|
450
|
+
case 'right': {
|
|
451
|
+
if (alignment === 'end') {
|
|
452
|
+
return targetBox.top + targetBox.height - elementBox.height;
|
|
453
|
+
}
|
|
454
|
+
else if (alignment === 'center') {
|
|
455
|
+
return targetBox.top - (elementBox.height - targetBox.height) / 2;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
return targetBox.top;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
case 'top': {
|
|
462
|
+
return targetBox.top - elementBox.height;
|
|
463
|
+
}
|
|
464
|
+
case 'bottom': {
|
|
465
|
+
return targetBox.top + targetBox.height;
|
|
466
|
+
}
|
|
467
|
+
/* istanbul ignore next */
|
|
468
|
+
default:
|
|
469
|
+
throw new Error(`Unexpected placement: ${placement}. Expected values are top, bottom, left, or right.`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* It takes a list of placements and returns the first placement that has enough space to place the
|
|
474
|
+
* element
|
|
475
|
+
*
|
|
476
|
+
* @param {ElementScrollDimension} containerBox - The box of the container element.
|
|
477
|
+
* @param {ElementBoundBox} elementBox - The box of the element to be placed.
|
|
478
|
+
* @param {ElementBoundBox} targetBox - The box of the target element.
|
|
479
|
+
* @param {PlacementType[]} placements - The placements that we want to try.
|
|
480
|
+
* @returns {PlacementType} A function that takes in a containerBox, elementBox, targetBox, placements, and element.
|
|
481
|
+
*/
|
|
482
|
+
getSuitablePlacement(containerBox, elementBox, targetBox, placements) {
|
|
483
|
+
const defaultPlacement = placements[0];
|
|
484
|
+
const suitablePlacement = placements.find((placement) => this.hasEnoughSpace(containerBox, placement, targetBox, elementBox));
|
|
485
|
+
if (suitablePlacement) {
|
|
486
|
+
return suitablePlacement;
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
LogUtility.warn(`
|
|
490
|
+
No enough space found for placing element and we will keep using the defined placement:
|
|
491
|
+
${defaultPlacement}
|
|
492
|
+
`);
|
|
493
|
+
return defaultPlacement;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* It takes a list of alignments and returns the suitable one that has enough space to fit the element
|
|
498
|
+
*
|
|
499
|
+
* @param {ElementScrollDimension} containerBox - The bounding box of the container element.
|
|
500
|
+
* @param {ElementBoundBox} elementBox - The box of the element that we want to position.
|
|
501
|
+
* @param {ElementBoundBox} targetBox - The box of the element that the element to be positioned is aligned to.
|
|
502
|
+
* @param {PlacementType} placement - The placement of the element relative to the target.
|
|
503
|
+
* @param {PositionAlignmentType[]} alignments - An array of alignments to try.
|
|
504
|
+
* @returns {PositionAlignmentType} the alignment that is suitable for the element.
|
|
505
|
+
*/
|
|
506
|
+
getSuitableAlignment(containerBox, elementBox, targetBox, placement, alignments) {
|
|
507
|
+
const defaultAlignment = alignments[0];
|
|
508
|
+
const suitableAlignment = alignments.find((alignment) => this.hasEnoughAlignmentSpace(containerBox, targetBox, elementBox, placement, alignment));
|
|
509
|
+
if (suitableAlignment) {
|
|
510
|
+
return suitableAlignment;
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
LogUtility.warn(`
|
|
514
|
+
No enough space found for placing element and we will keep using the defined alignment:
|
|
515
|
+
${defaultAlignment}
|
|
516
|
+
`);
|
|
517
|
+
return defaultAlignment;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Whether the alignment space is enough
|
|
522
|
+
*
|
|
523
|
+
* @param {ElementScrollDimension} containerBox - The bounding box of the container element.
|
|
524
|
+
* @param {ElementBoundBox} targetBox - The position of the target element.
|
|
525
|
+
* @param {ElementBoundBox} elementBox - The box of the element that we're trying to position.
|
|
526
|
+
* @param {PlacementType} placement - The placement of the element relative to the target.
|
|
527
|
+
* @param {PlacementType} alignment - The alignment of the element relative to the target.
|
|
528
|
+
* @returns {boolean} return true if it has enough space, otherwise false
|
|
529
|
+
*/
|
|
530
|
+
hasEnoughAlignmentSpace(containerBox, targetBox, elementBox, placement, alignment) {
|
|
531
|
+
if (['top', 'bottom'].includes(placement)) {
|
|
532
|
+
switch (alignment) {
|
|
533
|
+
case 'start': {
|
|
534
|
+
return targetBox.left + elementBox.width <= containerBox.width;
|
|
535
|
+
}
|
|
536
|
+
case 'center': {
|
|
537
|
+
return (targetBox.left >= (elementBox.width - targetBox.width) / 2 &&
|
|
538
|
+
targetBox.left + targetBox.width / 2 + elementBox.width / 2 <= containerBox.width);
|
|
539
|
+
}
|
|
540
|
+
case 'end': {
|
|
541
|
+
return targetBox.left + targetBox.width >= elementBox.width;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (['right', 'left'].includes(placement)) {
|
|
546
|
+
switch (alignment) {
|
|
547
|
+
case 'start': {
|
|
548
|
+
return targetBox.top + elementBox.height <= containerBox.height;
|
|
549
|
+
}
|
|
550
|
+
case 'center': {
|
|
551
|
+
return (targetBox.top >= (elementBox.height - targetBox.height) / 2 &&
|
|
552
|
+
targetBox.top + targetBox.height / 2 + elementBox.height / 2 <= containerBox.height);
|
|
553
|
+
}
|
|
554
|
+
case 'end': {
|
|
555
|
+
return targetBox.top + targetBox.height >= elementBox.height;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
/* istanbul ignore next */
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* If the placement is top or left, then the target's top or left position must be greater than or
|
|
564
|
+
* equal to the element's height or width. If the placement is bottom or right, then the container's
|
|
565
|
+
* height or width minus the target's top or left position minus the target's height or width must be
|
|
566
|
+
* greater than or equal to the element's height or width.
|
|
567
|
+
*
|
|
568
|
+
* @param {ElementScrollDimension} containerBox - The bounding box of the container element.
|
|
569
|
+
* @param {PlacementType} placement - The placement of the element.
|
|
570
|
+
* @param {ElementBoundBox} targetBox - The position of the target element.
|
|
571
|
+
* @param {ElementBoundBox} elementBox - The dimensions of the element to be positioned.
|
|
572
|
+
* @returns {boolean} A boolean value.
|
|
573
|
+
*/
|
|
574
|
+
hasEnoughSpace(containerBox, placement, targetBox, elementBox) {
|
|
575
|
+
switch (placement) {
|
|
576
|
+
case 'top':
|
|
577
|
+
return targetBox.top >= elementBox.height;
|
|
578
|
+
case 'bottom':
|
|
579
|
+
return containerBox.height - targetBox.top - targetBox.height >= elementBox.height;
|
|
580
|
+
case 'left':
|
|
581
|
+
return targetBox.left >= elementBox.width;
|
|
582
|
+
case 'right':
|
|
583
|
+
return containerBox.width - targetBox.left - targetBox.width >= elementBox.width;
|
|
584
|
+
/* istanbul ignore next */
|
|
585
|
+
default:
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Retrieves and formats the translocation.
|
|
591
|
+
*
|
|
592
|
+
* @returns {TranslocationType} current translocation.
|
|
593
|
+
*/
|
|
594
|
+
getTranslocation() {
|
|
595
|
+
const translocation = this.showConfig.translocation;
|
|
596
|
+
return translocation && ResponsiveFormatFacade.format(translocation, 'translocation');
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
601
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
602
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
603
|
+
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;
|
|
604
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* calculate position by body container
|
|
608
|
+
*/
|
|
609
|
+
class BodyPositionCalculationStrategy extends BasePositionCalculationStrategy {
|
|
610
|
+
/**
|
|
611
|
+
* Get the position of the element in the container according to the target element and the placement
|
|
612
|
+
* If give a translocation, it will apply the translocation to the result.
|
|
613
|
+
* Note: If you use this method to calculate the position, you should make container as relative position at first.
|
|
614
|
+
*
|
|
615
|
+
* @returns {ElementPositionBox} A function that takes in a container, element, target, placement, and translocation and
|
|
616
|
+
* returns an ElementPositionBox.
|
|
617
|
+
*/
|
|
618
|
+
getPosition() {
|
|
619
|
+
const containerStyle = window.getComputedStyle(this.container);
|
|
620
|
+
if (containerStyle.position !== 'relative') {
|
|
621
|
+
LogUtility.warn(`Calculate position should make container as 'position: relative', otherwise the result might not be accurate.`);
|
|
622
|
+
}
|
|
623
|
+
return this.getPositionBox();
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* It returns the position of an element relative to its container and also includes the scroll height of container.
|
|
627
|
+
*
|
|
628
|
+
* @returns {ElementBoundBox} An object with the properties width, height, top, and left.
|
|
629
|
+
*/
|
|
630
|
+
getTargetBoundBox() {
|
|
631
|
+
const containerRect = this.container.getBoundingClientRect();
|
|
632
|
+
const targetRect = this.showConfig.target.getBoundingClientRect();
|
|
633
|
+
const targetTop = targetRect.top - containerRect.top + this.container.scrollTop;
|
|
634
|
+
const targetLeft = targetRect.left - containerRect.left + this.container.scrollLeft;
|
|
635
|
+
return {
|
|
636
|
+
width: targetRect.width,
|
|
637
|
+
height: targetRect.height,
|
|
638
|
+
top: targetTop,
|
|
639
|
+
left: targetLeft,
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* "Get the width and height of an element."
|
|
644
|
+
*
|
|
645
|
+
* The function takes a single parameter, a container element, and returns an object with two
|
|
646
|
+
* properties: width and height
|
|
647
|
+
*
|
|
648
|
+
* @returns {ElementScrollDimension} An object with two properties: width and height.
|
|
649
|
+
*/
|
|
650
|
+
getElementScrollDimension() {
|
|
651
|
+
return {
|
|
652
|
+
width: this.container.scrollWidth,
|
|
653
|
+
height: this.container.scrollHeight,
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
__decorate$4([
|
|
658
|
+
MapToComponentField()
|
|
659
|
+
], BodyPositionCalculationStrategy.prototype, "container", void 0);
|
|
660
|
+
__decorate$4([
|
|
661
|
+
MapToComponentField()
|
|
662
|
+
], BodyPositionCalculationStrategy.prototype, "showConfig", void 0);
|
|
663
|
+
|
|
664
|
+
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
665
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
666
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
667
|
+
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;
|
|
668
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* calculate position by screen container
|
|
672
|
+
*/
|
|
673
|
+
class ScreenPositionCalculationStrategy extends BasePositionCalculationStrategy {
|
|
674
|
+
/**
|
|
675
|
+
* Get the position of the element in the container according to the target element and the placement
|
|
676
|
+
* If give a translocation, it will apply the translocation to the result.
|
|
677
|
+
*
|
|
678
|
+
* @param {boolean} usePreviousPlacement - Should keep use previous placement and alignment.
|
|
679
|
+
* @returns {ElementPositionBox} A function that takes in a container, element, target, placement, and translocation and
|
|
680
|
+
* returns an ElementPositionBox.
|
|
681
|
+
*/
|
|
682
|
+
getPosition(usePreviousPlacement) {
|
|
683
|
+
const positionBox = usePreviousPlacement
|
|
684
|
+
? this.getPositionBox([this.previousPositionBox.placement], [this.previousPositionBox.alignment])
|
|
685
|
+
: this.getPositionBox();
|
|
686
|
+
this.previousPositionBox = positionBox;
|
|
687
|
+
return positionBox;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* It returns the position of an element relative to its container and also includes the scroll height of container.
|
|
691
|
+
*
|
|
692
|
+
* @returns {ElementBoundBox} An object with the properties width, height, top, and left.
|
|
693
|
+
*/
|
|
694
|
+
getTargetBoundBox() {
|
|
695
|
+
const targetRect = this.showConfig.target.getBoundingClientRect();
|
|
696
|
+
return {
|
|
697
|
+
width: targetRect.width,
|
|
698
|
+
height: targetRect.height,
|
|
699
|
+
top: targetRect.top,
|
|
700
|
+
left: targetRect.left,
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* "Get the width and height of an element."
|
|
705
|
+
*
|
|
706
|
+
* The function takes a single parameter, a container element, and returns an object with two
|
|
707
|
+
* properties: width and height
|
|
708
|
+
*
|
|
709
|
+
* @returns {ElementScrollDimension} An object with two properties: width and height.
|
|
710
|
+
*/
|
|
711
|
+
getElementScrollDimension() {
|
|
712
|
+
return {
|
|
713
|
+
width: window.innerWidth,
|
|
714
|
+
height: window.innerHeight,
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
__decorate$3([
|
|
719
|
+
MapToComponentField()
|
|
720
|
+
], ScreenPositionCalculationStrategy.prototype, "showConfig", void 0);
|
|
721
|
+
|
|
722
|
+
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
723
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
724
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
725
|
+
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;
|
|
726
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
727
|
+
};
|
|
728
|
+
/**
|
|
729
|
+
* Calculation and adjustment of positions for appendable elements based on target element positions.
|
|
730
|
+
*/
|
|
731
|
+
class PositionCalculationController extends VegaSlimmer {
|
|
732
|
+
constructor() {
|
|
733
|
+
super(...arguments);
|
|
734
|
+
this.bodyPositionStrategy = new BodyPositionCalculationStrategy();
|
|
735
|
+
this.screenPositionStrategy = new ScreenPositionCalculationStrategy();
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Sets the calculate postion strategy.
|
|
739
|
+
*/
|
|
740
|
+
setCalculationStrategy() {
|
|
741
|
+
this.positionStrategy = this.showConfig.isScreenPosition
|
|
742
|
+
? this.screenPositionStrategy
|
|
743
|
+
: this.bodyPositionStrategy;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Calculates the position and applies it to the appendable element.
|
|
747
|
+
*
|
|
748
|
+
* @param {boolean} [usePreviousPlacement] - Should keep use previous placement and alignment.
|
|
749
|
+
*/
|
|
750
|
+
adjustPosition(usePreviousPlacement) {
|
|
751
|
+
this.adjustWidth();
|
|
752
|
+
this.adjustHeight();
|
|
753
|
+
this.applyPosition(this.positionStrategy.getPosition(usePreviousPlacement));
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Apply the position to the appendable element.
|
|
757
|
+
*
|
|
758
|
+
* @param {ElementPositionBox} positionBox - position box
|
|
759
|
+
*/
|
|
760
|
+
applyPosition(positionBox) {
|
|
761
|
+
const appendableElement = this.showConfig.appendableElement;
|
|
762
|
+
if (this.showConfig.isScreenPosition) {
|
|
763
|
+
appendableElement.style.position = 'fixed';
|
|
764
|
+
}
|
|
765
|
+
appendableElement.style.left = `${positionBox.left}px`;
|
|
766
|
+
appendableElement.style.top = `${positionBox.top}px`;
|
|
767
|
+
appendableElement.classList.remove('vega-placement-left', 'vega-placement-right', 'vega-placement-top', 'vega-placement-bottom');
|
|
768
|
+
appendableElement.classList.remove('vega-alignment-start', 'vega-alignment-center', 'vega-alignment-end');
|
|
769
|
+
appendableElement.classList.add(`vega-placement-${positionBox.placement}`);
|
|
770
|
+
appendableElement.classList.add(`vega-alignment-${positionBox.alignment}`);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* It sets the width of the appendable element to the width of the target element if the
|
|
774
|
+
* matchTargetWidth property is true, otherwise it sets the width of the appendable element to the
|
|
775
|
+
* size property
|
|
776
|
+
*
|
|
777
|
+
* @returns {void}
|
|
778
|
+
*/
|
|
779
|
+
adjustWidth() {
|
|
780
|
+
if (this.showConfig.matchTargetWidth) {
|
|
781
|
+
const { width: hostWidth } = this.showConfig.target.getBoundingClientRect();
|
|
782
|
+
this.setRelatedWidth('width', hostWidth);
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
this.setRelatedWidth('width', this.showConfig.size);
|
|
786
|
+
this.setRelatedWidth('minWidth', this.showConfig.minWidth);
|
|
787
|
+
this.setRelatedWidth('maxWidth', this.showConfig.maxWidth);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* It takes a name and a value, formats the value, and then sets the style of the element
|
|
792
|
+
*
|
|
793
|
+
* @param {'width' | 'maxWidth' | 'minWidth'} name - 'width' | 'maxWidth' | 'minWidth'
|
|
794
|
+
* @param {ResponsiveType<SizeType>} value - ResponsiveType<SizeType>
|
|
795
|
+
* @returns {void}
|
|
796
|
+
*/
|
|
797
|
+
setRelatedWidth(name, value) {
|
|
798
|
+
if (!value)
|
|
799
|
+
return;
|
|
800
|
+
const formattedValue = ResponsiveFormatFacade.format(value, 'size');
|
|
801
|
+
if (formattedValue) {
|
|
802
|
+
this.showConfig.appendableElement.style[name] =
|
|
803
|
+
typeof formattedValue === 'number' ? `${formattedValue}px` : formattedValue;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* > If the `matchContainerHeight` property is set to `true`, then the maximum height of the dropdown
|
|
808
|
+
* is set to the height of the container minus the height of the target minus the top offset of the
|
|
809
|
+
* target
|
|
810
|
+
*
|
|
811
|
+
* @returns {void}
|
|
812
|
+
*/
|
|
813
|
+
adjustHeight() {
|
|
814
|
+
if (this.showConfig.matchContainerHeight) {
|
|
815
|
+
const { height: targetHeight } = this.showConfig.target.getBoundingClientRect();
|
|
816
|
+
let maxHeight = this.container.scrollHeight - this.showConfig.target.offsetTop - targetHeight;
|
|
817
|
+
if (this.showConfig.maxHeight) {
|
|
818
|
+
maxHeight = Math.min(maxHeight, this.showConfig.maxHeight);
|
|
819
|
+
}
|
|
820
|
+
this.showConfig.appendableElement.style.maxHeight = `${maxHeight}px`;
|
|
821
|
+
}
|
|
822
|
+
else if (this.showConfig.maxHeight) {
|
|
823
|
+
this.showConfig.appendableElement.style.maxHeight = `${this.showConfig.maxHeight}px`;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
__decorate$2([
|
|
828
|
+
MapToComponentField()
|
|
829
|
+
], PositionCalculationController.prototype, "container", void 0);
|
|
830
|
+
__decorate$2([
|
|
831
|
+
MapToComponentField()
|
|
832
|
+
], PositionCalculationController.prototype, "showConfig", void 0);
|
|
833
|
+
__decorate$2([
|
|
834
|
+
InjectVegaSlimmer()
|
|
835
|
+
], PositionCalculationController.prototype, "bodyPositionStrategy", void 0);
|
|
836
|
+
__decorate$2([
|
|
837
|
+
InjectVegaSlimmer()
|
|
838
|
+
], PositionCalculationController.prototype, "screenPositionStrategy", void 0);
|
|
839
|
+
|
|
613
840
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
614
841
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
615
842
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -654,8 +881,6 @@ class ElementAppender {
|
|
|
654
881
|
// https://gethired.atlassian.net/browse/VD-1087
|
|
655
882
|
if (isElementVisible(this.showConfig.target) &&
|
|
656
883
|
isElementVisible(this.showConfig.appendableElement)) {
|
|
657
|
-
this.adjustWidth();
|
|
658
|
-
this.adjustHeight();
|
|
659
884
|
this.adjustPosition();
|
|
660
885
|
}
|
|
661
886
|
},
|
|
@@ -664,6 +889,7 @@ class ElementAppender {
|
|
|
664
889
|
},
|
|
665
890
|
]);
|
|
666
891
|
this.elementAppenderContainerController = new ElementAppenderContainerController();
|
|
892
|
+
this.positionCalculationController = new PositionCalculationController();
|
|
667
893
|
this.showConfigCallback = showConfigCallback;
|
|
668
894
|
this.showConfigCallbackTarget = showConfigCallbackTarget;
|
|
669
895
|
const config = this.getShowConfig();
|
|
@@ -688,8 +914,6 @@ class ElementAppender {
|
|
|
688
914
|
/* A function that takes no parameters and returns nothing. It sets the position of the appendable
|
|
689
915
|
element. */
|
|
690
916
|
this.prepareShow();
|
|
691
|
-
this.adjustWidth();
|
|
692
|
-
this.adjustHeight();
|
|
693
917
|
this.adjustPosition();
|
|
694
918
|
this.setZIndex();
|
|
695
919
|
this.toggleShow(true);
|
|
@@ -705,6 +929,18 @@ class ElementAppender {
|
|
|
705
929
|
this.resetContainerPosition();
|
|
706
930
|
InternalVegaZIndexManager.removeZIndex(this.showConfig.appendableElement, 'base');
|
|
707
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* Update position while window scroll.
|
|
934
|
+
*/
|
|
935
|
+
onScroll() {
|
|
936
|
+
var _a;
|
|
937
|
+
const currentTargetRect = this.showConfig.target.getBoundingClientRect();
|
|
938
|
+
if (this.showConfig.isScreenPosition &&
|
|
939
|
+
(currentTargetRect.left !== ((_a = this.previousTargetRect) === null || _a === void 0 ? void 0 : _a.left) ||
|
|
940
|
+
currentTargetRect.top !== this.previousTargetRect.top)) {
|
|
941
|
+
this.adjustPosition(true);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
708
944
|
/* istanbul ignore next */
|
|
709
945
|
/**
|
|
710
946
|
* It removes the z-index from the appendable element, removes the appendable element from the DOM, and
|
|
@@ -814,76 +1050,16 @@ class ElementAppender {
|
|
|
814
1050
|
this.container.style.position = 'relative';
|
|
815
1051
|
}
|
|
816
1052
|
this.showConfig.appendableElement.style.boxSizing = 'border-box';
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* It sets the width of the appendable element to the width of the target element if the
|
|
820
|
-
* matchTargetWidth property is true, otherwise it sets the width of the appendable element to the
|
|
821
|
-
* size property
|
|
822
|
-
*
|
|
823
|
-
* @returns {void}
|
|
824
|
-
*/
|
|
825
|
-
adjustWidth() {
|
|
826
|
-
if (this.showConfig.matchTargetWidth) {
|
|
827
|
-
const { width: hostWidth } = this.showConfig.target.getBoundingClientRect();
|
|
828
|
-
this.setRelatedWidth('width', hostWidth);
|
|
829
|
-
}
|
|
830
|
-
else {
|
|
831
|
-
this.setRelatedWidth('width', this.showConfig.size);
|
|
832
|
-
this.setRelatedWidth('minWidth', this.showConfig.minWidth);
|
|
833
|
-
this.setRelatedWidth('maxWidth', this.showConfig.maxWidth);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* It takes a name and a value, formats the value, and then sets the style of the element
|
|
838
|
-
*
|
|
839
|
-
* @param {'width' | 'maxWidth' | 'minWidth'} name - 'width' | 'maxWidth' | 'minWidth'
|
|
840
|
-
* @param {ResponsiveType<SizeType>} value - ResponsiveType<SizeType>
|
|
841
|
-
* @returns {void}
|
|
842
|
-
*/
|
|
843
|
-
setRelatedWidth(name, value) {
|
|
844
|
-
if (!value)
|
|
845
|
-
return;
|
|
846
|
-
const formattedValue = ResponsiveFormatFacade.format(value, 'size');
|
|
847
|
-
if (formattedValue) {
|
|
848
|
-
this.showConfig.appendableElement.style[name] =
|
|
849
|
-
typeof formattedValue === 'number' ? `${formattedValue}px` : formattedValue;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* > If the `matchContainerHeight` property is set to `true`, then the maximum height of the dropdown
|
|
854
|
-
* is set to the height of the container minus the height of the target minus the top offset of the
|
|
855
|
-
* target
|
|
856
|
-
*
|
|
857
|
-
* @returns {void}
|
|
858
|
-
*/
|
|
859
|
-
adjustHeight() {
|
|
860
|
-
if (this.showConfig.matchContainerHeight) {
|
|
861
|
-
const { height: targetHeight } = this.showConfig.target.getBoundingClientRect();
|
|
862
|
-
let maxHeight = this.container.scrollHeight - this.showConfig.target.offsetTop - targetHeight;
|
|
863
|
-
if (this.showConfig.maxHeight) {
|
|
864
|
-
maxHeight = Math.min(maxHeight, this.showConfig.maxHeight);
|
|
865
|
-
}
|
|
866
|
-
this.showConfig.appendableElement.style.maxHeight = `${maxHeight}px`;
|
|
867
|
-
}
|
|
868
|
-
else if (this.showConfig.maxHeight) {
|
|
869
|
-
this.showConfig.appendableElement.style.maxHeight = `${this.showConfig.maxHeight}px`;
|
|
870
|
-
}
|
|
1053
|
+
this.positionCalculationController.setCalculationStrategy();
|
|
871
1054
|
}
|
|
872
1055
|
/**
|
|
873
1056
|
* A function that takes no parameters and returns nothing. It sets the position of the appendable element.
|
|
874
1057
|
*
|
|
1058
|
+
* @param {boolean} usePreviousPlacement - Should keep use previous placement and alignment.
|
|
875
1059
|
* @returns {void}
|
|
876
1060
|
*/
|
|
877
|
-
adjustPosition() {
|
|
878
|
-
|
|
879
|
-
ResponsiveFormatFacade.format(this.showConfig.translocation, 'translocation');
|
|
880
|
-
const positionBox = getPositionBox(this.container, this.showConfig.appendableElement, this.showConfig.target, this.showConfig.placement, this.showConfig.alignment, translocation);
|
|
881
|
-
this.showConfig.appendableElement.style.left = `${positionBox.left}px`;
|
|
882
|
-
this.showConfig.appendableElement.style.top = `${positionBox.top}px`;
|
|
883
|
-
this.showConfig.appendableElement.classList.remove('vega-placement-left', 'vega-placement-right', 'vega-placement-top', 'vega-placement-bottom');
|
|
884
|
-
this.showConfig.appendableElement.classList.remove('vega-alignment-start', 'vega-alignment-center', 'vega-alignment-end');
|
|
885
|
-
this.showConfig.appendableElement.classList.add(`vega-placement-${positionBox.placement}`);
|
|
886
|
-
this.showConfig.appendableElement.classList.add(`vega-alignment-${positionBox.alignment}`);
|
|
1061
|
+
adjustPosition(usePreviousPlacement) {
|
|
1062
|
+
this.positionCalculationController.adjustPosition(usePreviousPlacement);
|
|
887
1063
|
}
|
|
888
1064
|
/**
|
|
889
1065
|
* Sets the z-index of the appendable element to 11000.
|
|
@@ -919,6 +1095,9 @@ __decorate$1([
|
|
|
919
1095
|
__decorate$1([
|
|
920
1096
|
InjectVegaSlimmer()
|
|
921
1097
|
], ElementAppender.prototype, "elementAppenderContainerController", void 0);
|
|
1098
|
+
__decorate$1([
|
|
1099
|
+
InjectVegaSlimmer()
|
|
1100
|
+
], ElementAppender.prototype, "positionCalculationController", void 0);
|
|
922
1101
|
|
|
923
1102
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
924
1103
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -944,6 +1123,7 @@ class ElementAppenderSlimmer extends VegaSlimmer {
|
|
|
944
1123
|
(_f = this.showConfig.appendableElement) === null || _f === void 0 ? void 0 : _f.addEventListener('mouseleave', this.elementMouseLeaveHandler);
|
|
945
1124
|
}
|
|
946
1125
|
window.addEventListener('mousedown', this.globalMouseDownHandler);
|
|
1126
|
+
document.addEventListener('scroll', this.globalScrollHandler, { capture: true });
|
|
947
1127
|
};
|
|
948
1128
|
/* It's a function that listens to the click event on the dropdown. It checks if the trigger
|
|
949
1129
|
property is equal to 'click'. If it is, then it toggles the dropdown. */
|
|
@@ -1005,6 +1185,14 @@ class ElementAppenderSlimmer extends VegaSlimmer {
|
|
|
1005
1185
|
this.hide();
|
|
1006
1186
|
}
|
|
1007
1187
|
};
|
|
1188
|
+
/* istanbul ignore next */
|
|
1189
|
+
/* Listen global scroll event */
|
|
1190
|
+
this.globalScrollHandler = () => {
|
|
1191
|
+
var _a;
|
|
1192
|
+
if (this.showConfig && this.showConfig.isScreenPosition && this.isShowing()) {
|
|
1193
|
+
(_a = this.elementAppender) === null || _a === void 0 ? void 0 : _a.onScroll();
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1008
1196
|
/* A timer that will hide the dropdown after a certain amount of time. */
|
|
1009
1197
|
this.createDelayHideTimer = () => {
|
|
1010
1198
|
this.delayHideTimer = setTimeout(() => {
|
|
@@ -1091,6 +1279,7 @@ class ElementAppenderSlimmer extends VegaSlimmer {
|
|
|
1091
1279
|
(_f = this.showConfig.appendableElement) === null || _f === void 0 ? void 0 : _f.removeEventListener('mouseleave', this.elementMouseLeaveHandler);
|
|
1092
1280
|
}
|
|
1093
1281
|
window.removeEventListener('mousedown', this.globalMouseDownHandler);
|
|
1282
|
+
document.removeEventListener('scroll', this.globalScrollHandler);
|
|
1094
1283
|
}
|
|
1095
1284
|
}
|
|
1096
1285
|
ElementAppenderSlimmer.DELAY_HIDE_TIME = 100;
|