@globalpayments/vega 2.66.0 → 2.68.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-ab28f910.js → app-globals-f7106a22.js} +15 -14
- package/dist/cjs/{child-nodes-event-prevent-slimmer-eb803b14.js → child-nodes-event-prevent-slimmer-f8840f1b.js} +1 -1
- package/dist/cjs/{code-block-ab97a0a0.js → code-block-39074880.js} +514 -319
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-5630341e.js → component-value-history-controller-slimmer.abstract-ddedf543.js} +2 -2
- package/dist/cjs/{design-token-847739f1.js → design-token-e14a4e66.js} +1 -1
- package/dist/cjs/{dto-renderer-manager-d0f0f2c0.js → dto-renderer-manager-b7969d6c.js} +1587 -1563
- package/dist/cjs/{element-appender-slimmer-aead9bbb.js → element-appender-slimmer-7ee27ab3.js} +5 -5
- package/dist/cjs/{event-emit-slimmer-d21a0935.js → event-emit-slimmer-7afe8d78.js} +1 -1
- package/dist/cjs/{token-extension-aa8d5cce.js → function-extension-f0e845f2.js} +1019 -96
- package/dist/cjs/{image-annotation-action-d84de785.js → image-annotation-action-7f0626c8.js} +15 -25
- package/dist/cjs/index.cjs.js +36 -24
- package/dist/cjs/{internal-vega-event-manager-4d1ce667.js → internal-vega-event-manager-45d451de.js} +5 -2
- package/dist/cjs/{language-extension-d257e65d.js → language-extension-d0103d1a.js} +5 -5
- package/dist/cjs/loader.cjs.js +8 -8
- package/dist/cjs/{public-rules-d2b9b8f0.js → public-rules-8b67eaba.js} +3 -3
- package/dist/cjs/{range-d610028e.js → range-002671b6.js} +1 -1
- package/dist/cjs/{responsive-format-facade-71e7b74c.js → responsive-format-facade-347db035.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-a8fe5f50.js → rich-text-editor-required-rule-5392bd8a.js} +1 -1
- package/dist/cjs/{style-formatter-6facb42b.js → style-formatter-0a09f0dd.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +7 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-banner.cjs.entry.js +2 -2
- package/dist/cjs/vega-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-circle.cjs.entry.js +9 -9
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-link.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-calendar_4.cjs.entry.js +307 -269
- package/dist/cjs/vega-card.cjs.entry.js +7 -7
- package/dist/cjs/vega-carousel.cjs.entry.js +7 -7
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +9 -9
- package/dist/cjs/vega-code-block.cjs.entry.js +6 -6
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +12 -12
- package/dist/cjs/vega-dialog_2.cjs.entry.js +138 -44
- package/dist/cjs/vega-divider.cjs.entry.js +7 -7
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +24 -5
- package/dist/cjs/vega-file-uploader.cjs.entry.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-flex.cjs.entry.js +8 -8
- package/dist/cjs/vega-font.cjs.entry.js +7 -7
- package/dist/cjs/vega-form.cjs.entry.js +3 -3
- package/dist/cjs/vega-grid.cjs.entry.js +7 -7
- package/dist/cjs/vega-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-passcode.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +38 -14
- package/dist/cjs/vega-input.cjs.entry.js +14 -3
- package/dist/cjs/vega-item-toggle.cjs.entry.js +2 -2
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +11 -11
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +7 -7
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +2 -2
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +93 -16
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +107 -54
- package/dist/cjs/vega-segment-control.cjs.entry.js +2 -2
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +10 -10
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_8.cjs.entry.js +11 -11
- package/dist/cjs/vega-textarea.cjs.entry.js +24 -4
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega.cjs.js +8 -8
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/calendar-event-sorter.js +3 -3
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/layout/day-view-timed-event-layout-column.js +1 -1
- package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +3 -4
- package/dist/collection/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.js +11 -3
- package/dist/collection/components/vega-field-label/vega-field-label.js +42 -0
- package/dist/collection/components/vega-input/vega-input.js +48 -2
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-renderer.js +16 -5
- package/dist/collection/components/vega-input-select/vega-input-select.css +2 -44
- package/dist/collection/components/vega-input-select/vega-input-select.js +81 -1
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.js +95 -16
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-z-index-controller.js +4 -1
- package/dist/collection/components/vega-modal/slimmers/models/vega-modal-open-state.js +9 -0
- package/dist/collection/components/vega-modal/slimmers/renderers/vega-modal-renderer.js +4 -1
- package/dist/collection/components/vega-modal/vega-modal.js +19 -16
- package/dist/collection/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-extensions-styles-controller.js +60 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +7 -1
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.js +17 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor-registry.js +61 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor.abstract.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +30 -6
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +10 -3
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/paste-content-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/annotation-style.js +87 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +27 -9
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +1 -12
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +14 -5
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +7 -37
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +14 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +19 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +44 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +51 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-new-paragraph-interceptor.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-paste-content-interceptor.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/function-block-insert-paragraph-strategy.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/paste-plain-text-strategy.js +68 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/actions/insert-function-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/actions/paste-plain-text-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +97 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.js +73 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-node.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +75 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +71 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.js +5 -6
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/public-api.js +8 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +9 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +0 -12
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +12 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +30 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +10 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +2 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +32 -2
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-style.test.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +3 -0
- package/dist/collection/components/vega-selection-chip/vega-selection-chip.js +1 -1
- package/dist/collection/components/vega-table/vega-table.css +2 -1
- package/dist/collection/components/vega-textarea/vega-textarea.js +88 -2
- package/dist/collection/global/scripts/before-vega-load.js +2 -0
- package/dist/collection/helpers/calendar/calendar-date-time.js +136 -0
- package/dist/collection/helpers/calendar/calendar-date.js +10 -4
- package/dist/collection/helpers/calendar/calendar-event.js +38 -193
- package/dist/collection/helpers/calendar/calendar-time.js +120 -0
- package/dist/collection/helpers/calendar/index.js +2 -0
- package/dist/collection/helpers/calendar/test/calendar-date-time.test.js +27 -0
- package/dist/collection/helpers/calendar/test/calendar-event.test.js +24 -22
- package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +2 -2
- package/dist/collection/helpers/calendar/test/calendar-period/month-period.test.js +2 -2
- package/dist/collection/helpers/calendar/test/calendar-period/week-period.test.js +6 -6
- package/dist/collection/helpers/calendar/test/calendar-time.test.js +45 -0
- package/dist/collection/helpers/calendar/test/utils.test.js +1 -29
- package/dist/collection/helpers/calendar/utils.js +0 -66
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +5 -2
- package/dist/collection/helpers/rte-manager/dto-action-strategy-manager.js +2 -0
- package/dist/esm/{app-globals-37a60cc1.js → app-globals-2f689986.js} +6 -5
- package/dist/esm/{child-nodes-event-prevent-slimmer-735cb880.js → child-nodes-event-prevent-slimmer-76331524.js} +1 -1
- package/dist/esm/{code-block-11b2bc1c.js → code-block-e8839202.js} +511 -318
- package/dist/esm/{component-value-history-controller-slimmer.abstract-16c5cb96.js → component-value-history-controller-slimmer.abstract-c6f94113.js} +2 -2
- package/dist/esm/{design-token-297dc528.js → design-token-e9e6b011.js} +1 -1
- package/dist/esm/{dto-renderer-manager-a1a3b6d2.js → dto-renderer-manager-7abc53bf.js} +1587 -1565
- package/dist/esm/{element-appender-slimmer-f7233708.js → element-appender-slimmer-8dbc8387.js} +2 -2
- package/dist/esm/{event-emit-slimmer-28fd360c.js → event-emit-slimmer-4e28e9f8.js} +1 -1
- package/dist/esm/{token-extension-b690953f.js → function-extension-eb1d062f.js} +1018 -97
- package/dist/esm/{image-annotation-action-fc46c920.js → image-annotation-action-7957653a.js} +14 -24
- package/dist/esm/index.js +9 -9
- package/dist/esm/{internal-vega-event-manager-a5a5938d.js → internal-vega-event-manager-516aa721.js} +5 -2
- package/dist/esm/{language-extension-314a2b18.js → language-extension-3331131f.js} +3 -3
- package/dist/esm/loader.js +8 -8
- package/dist/esm/{public-rules-c6a6946d.js → public-rules-e613dead.js} +3 -3
- package/dist/esm/{range-b78254de.js → range-adf206fd.js} +1 -1
- package/dist/esm/{responsive-format-facade-a41e1be7.js → responsive-format-facade-b0712993.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-d50c24da.js → rich-text-editor-required-rule-43857573.js} +1 -1
- package/dist/esm/{style-formatter-f7effaac.js → style-formatter-a20a1ef4.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +7 -7
- package/dist/esm/vega-app-header-button.entry.js +8 -8
- package/dist/esm/vega-banner.entry.js +2 -2
- package/dist/esm/vega-box.entry.js +8 -8
- package/dist/esm/vega-breadcrumb.entry.js +3 -3
- package/dist/esm/vega-button-circle.entry.js +9 -9
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button-link.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +8 -8
- package/dist/esm/vega-calendar_4.entry.js +307 -269
- package/dist/esm/vega-card.entry.js +7 -7
- package/dist/esm/vega-carousel.entry.js +7 -7
- package/dist/esm/vega-checkbox_2.entry.js +3 -3
- package/dist/esm/vega-chip.entry.js +9 -9
- package/dist/esm/vega-code-block.entry.js +6 -6
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +3 -3
- package/dist/esm/vega-date-picker_2.entry.js +8 -8
- package/dist/esm/vega-dialog_2.entry.js +132 -38
- package/dist/esm/vega-divider.entry.js +7 -7
- package/dist/esm/vega-dropdown_5.entry.js +9 -9
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +24 -5
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +6 -6
- package/dist/esm/vega-flex.entry.js +8 -8
- package/dist/esm/vega-font.entry.js +7 -7
- package/dist/esm/vega-form.entry.js +3 -3
- package/dist/esm/vega-grid.entry.js +7 -7
- package/dist/esm/vega-icon.entry.js +6 -6
- package/dist/esm/vega-image-uploader.entry.js +7 -7
- package/dist/esm/vega-input-credit-card.entry.js +3 -3
- package/dist/esm/vega-input-numeric.entry.js +3 -3
- package/dist/esm/vega-input-passcode.entry.js +3 -3
- package/dist/esm/vega-input-phone-number.entry.js +6 -6
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +38 -14
- package/dist/esm/vega-input.entry.js +14 -3
- package/dist/esm/vega-item-toggle.entry.js +2 -2
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +6 -6
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +7 -7
- package/dist/esm/vega-popover_2.entry.js +9 -9
- package/dist/esm/vega-progress-tracker.entry.js +2 -2
- package/dist/esm/vega-radio_2.entry.js +3 -3
- package/dist/esm/vega-rich-text-content.entry.js +93 -16
- package/dist/esm/vega-rich-text-editor_4.entry.js +107 -54
- package/dist/esm/vega-segment-control.entry.js +2 -2
- package/dist/esm/vega-selection-chip_2.entry.js +8 -8
- package/dist/esm/vega-selection-tile_2.entry.js +3 -3
- package/dist/esm/vega-sidenav_3.entry.js +6 -6
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +3 -3
- package/dist/esm/vega-tab-group_2.entry.js +3 -3
- package/dist/esm/vega-table_8.entry.js +8 -8
- package/dist/esm/vega-textarea.entry.js +25 -5
- package/dist/esm/vega-time-picker_2.entry.js +9 -9
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +7 -7
- package/dist/esm/vega.js +8 -8
- package/dist/sri/vega-sri-manifest.json +273 -273
- package/dist/types/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.d.ts +1 -0
- package/dist/types/components/vega-field-label/types.d.ts +12 -0
- package/dist/types/components/vega-field-label/vega-field-label.d.ts +13 -1
- package/dist/types/components/vega-input/vega-input.d.ts +14 -2
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-renderer.d.ts +3 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +25 -0
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.d.ts +31 -2
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-z-index-controller.d.ts +1 -0
- package/dist/types/components/vega-modal/slimmers/models/vega-modal-open-state.d.ts +9 -0
- package/dist/types/components/vega-modal/slimmers/renderers/vega-modal-renderer.d.ts +1 -0
- package/dist/types/components/vega-modal/types.d.ts +9 -0
- package/dist/types/components/vega-modal/vega-modal.d.ts +8 -2
- package/dist/types/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-extensions-styles-controller.d.ts +26 -0
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-content/vega-rich-text-content.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor-registry.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor.abstract.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +9 -2
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/paste-content-action.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation-style.d.ts +46 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +10 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +19 -3
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +36 -3
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-new-paragraph-interceptor.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-paste-content-interceptor.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/function-block-insert-paragraph-strategy.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/paste-plain-text-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/actions/insert-function-block-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/actions/paste-plain-text-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +58 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.d.ts +55 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/logic-control-node.d.ts +48 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-extension.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.d.ts +3 -4
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +8 -2
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +8 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +2 -11
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/annotation-style.test.d.ts +1 -0
- package/dist/types/components/vega-textarea/vega-textarea.d.ts +26 -0
- package/dist/types/components.d.ts +66 -4
- package/dist/types/helpers/calendar/calendar-date-time.d.ts +76 -0
- package/dist/types/helpers/calendar/calendar-event.d.ts +18 -57
- package/dist/types/helpers/calendar/calendar-time.d.ts +64 -0
- package/dist/types/helpers/calendar/index.d.ts +2 -0
- package/dist/types/helpers/calendar/test/calendar-date-time.test.d.ts +1 -0
- package/dist/types/helpers/calendar/test/calendar-time.test.d.ts +1 -0
- package/dist/types/helpers/calendar/utils.d.ts +0 -25
- package/dist/types/types/components.type.d.ts +1 -1
- package/dist/types/types/public-api.d.ts +2 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-6f7d42a0.entry.js → p-00376f71.entry.js} +1 -1
- package/dist/vega/p-018d70a5.js +1 -0
- package/dist/vega/p-0849f85e.js +1 -0
- package/dist/vega/{p-b431f9d5.entry.js → p-0a55f984.entry.js} +1 -1
- package/dist/vega/p-0f7dec29.entry.js +1 -0
- package/dist/vega/{p-47cae62d.entry.js → p-113d305b.entry.js} +1 -1
- package/dist/vega/{p-015cdbe7.entry.js → p-115b42e6.entry.js} +1 -1
- package/dist/vega/p-16358fec.entry.js +1 -0
- package/dist/vega/{p-af5bfe34.js → p-16d68187.js} +1 -1
- package/dist/vega/{p-92a22562.entry.js → p-18e8c54a.entry.js} +1 -1
- package/dist/vega/{p-6f6ccf67.entry.js → p-1922303e.entry.js} +1 -1
- package/dist/vega/{p-74d61782.entry.js → p-19256107.entry.js} +1 -1
- package/dist/vega/{p-59298f5e.entry.js → p-1dcb1fcd.entry.js} +2 -2
- package/dist/vega/{p-7f69081b.entry.js → p-1dd7f8b2.entry.js} +1 -1
- package/dist/vega/{p-d006e732.entry.js → p-22fe8c61.entry.js} +1 -1
- package/dist/vega/{p-524693d8.entry.js → p-238afe1b.entry.js} +1 -1
- package/dist/vega/p-240d9d35.entry.js +1 -0
- package/dist/vega/{p-b82d3915.entry.js → p-24419ebe.entry.js} +1 -1
- package/dist/vega/p-2478f65e.js +1 -0
- package/dist/vega/{p-358e9800.entry.js → p-2c945862.entry.js} +1 -1
- package/dist/vega/{p-5f58d1da.entry.js → p-2e32fbe6.entry.js} +1 -1
- package/dist/vega/p-2f04d2ac.js +1 -0
- package/dist/vega/p-30a8d9d6.entry.js +1 -0
- package/dist/vega/{p-e6cccee4.js → p-369810ae.js} +1 -1
- package/dist/vega/p-3ad87199.entry.js +1 -0
- package/dist/vega/{p-fe2e859f.entry.js → p-3b800f1b.entry.js} +1 -1
- package/dist/vega/p-437f865f.js +1 -0
- package/dist/vega/{p-de624f7d.entry.js → p-48bc03fa.entry.js} +1 -1
- package/dist/vega/{p-46830028.entry.js → p-54ddd06f.entry.js} +1 -1
- package/dist/vega/{p-5a0524ab.entry.js → p-56636a58.entry.js} +1 -1
- package/dist/vega/{p-fc8c5869.entry.js → p-56f77466.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-ab1001f5.entry.js → p-61d9cdf9.entry.js} +1 -1
- package/dist/vega/{p-39b9c57b.entry.js → p-626246b4.entry.js} +1 -1
- package/dist/vega/{p-ff3bb4e2.entry.js → p-634499cb.entry.js} +1 -1
- package/dist/vega/p-6609d87e.entry.js +1 -0
- package/dist/vega/p-69d27eaf.entry.js +1 -0
- package/dist/vega/{p-7efb5ebe.entry.js → p-705dad87.entry.js} +1 -1
- package/dist/vega/{p-8d574fbd.entry.js → p-75b5894f.entry.js} +1 -1
- package/dist/vega/{p-00071542.entry.js → p-76b1dae4.entry.js} +1 -1
- package/dist/vega/{p-54b62ecf.js → p-7747c163.js} +1 -1
- package/dist/vega/{p-0ed53cce.entry.js → p-787caad3.entry.js} +1 -1
- package/dist/vega/{p-129c0ce1.js → p-79e6e12c.js} +1 -1
- package/dist/vega/{p-cc519f53.entry.js → p-7dde3be9.entry.js} +1 -1
- package/dist/vega/p-8233d814.entry.js +1 -0
- package/dist/vega/{p-5e32866d.entry.js → p-83a50ac2.entry.js} +1 -1
- package/dist/vega/p-8506e8c3.js +1 -0
- package/dist/vega/{p-47fa359b.js → p-85407fb9.js} +1 -1
- package/dist/vega/{p-892cbe7c.entry.js → p-880569ec.entry.js} +1 -1
- package/dist/vega/{p-0113a83c.entry.js → p-8dba59a6.entry.js} +1 -1
- package/dist/vega/p-94e167b8.entry.js +1 -0
- package/dist/vega/{p-b2aaab66.entry.js → p-98fb9eaa.entry.js} +1 -1
- package/dist/vega/{p-3288a65b.entry.js → p-99bf5993.entry.js} +1 -1
- package/dist/vega/p-a211ae63.js +1 -0
- package/dist/vega/{p-fef846d5.entry.js → p-a2506cb5.entry.js} +1 -1
- package/dist/vega/{p-4e33fff6.entry.js → p-a6fb5a40.entry.js} +1 -1
- package/dist/vega/{p-bee1cc34.entry.js → p-b5060e84.entry.js} +1 -1
- package/dist/vega/{p-616cd622.entry.js → p-b78670c9.entry.js} +1 -1
- package/dist/vega/{p-d5761532.entry.js → p-b8558278.entry.js} +1 -1
- package/dist/vega/{p-8d655fd2.entry.js → p-bb0f2b5f.entry.js} +1 -1
- package/dist/vega/{p-a7631c6b.js → p-bb37a401.js} +1 -1
- package/dist/vega/p-bccee21e.js +1 -0
- package/dist/vega/{p-2553031f.entry.js → p-bd0e55a2.entry.js} +1 -1
- package/dist/vega/{p-65693321.entry.js → p-c0223a17.entry.js} +1 -1
- package/dist/vega/{p-2d430dc4.entry.js → p-c26332ae.entry.js} +1 -1
- package/dist/vega/{p-7f9ec104.entry.js → p-c54148fb.entry.js} +1 -1
- package/dist/vega/{p-276b1163.entry.js → p-d3905af1.entry.js} +2 -2
- package/dist/vega/p-d4893487.js +1 -0
- package/dist/vega/{p-d1dacaeb.entry.js → p-d67200e8.entry.js} +1 -1
- package/dist/vega/{p-725f0a2c.js → p-db57dddc.js} +1 -1
- package/dist/vega/{p-ed8bc4f0.entry.js → p-de02f404.entry.js} +1 -1
- package/dist/vega/{p-d4452dbc.entry.js → p-de8c5fae.entry.js} +1 -1
- package/dist/vega/{p-7b145620.js → p-de97c6d9.js} +1 -1
- package/dist/vega/{p-34800282.entry.js → p-e0979451.entry.js} +1 -1
- package/dist/vega/{p-1a3cb65e.entry.js → p-e6351dab.entry.js} +1 -1
- package/dist/vega/{p-8d096fea.entry.js → p-f0fb3fdd.entry.js} +1 -1
- package/dist/vega/{p-ea05a2fc.entry.js → p-f3399ef1.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-019f7f95.js +0 -1
- package/dist/vega/p-03a1e82e.entry.js +0 -1
- package/dist/vega/p-0d1eca78.entry.js +0 -1
- package/dist/vega/p-16370cfb.js +0 -1
- package/dist/vega/p-3a7f177a.entry.js +0 -1
- package/dist/vega/p-41c3fcb4.js +0 -1
- package/dist/vega/p-81105691.entry.js +0 -1
- package/dist/vega/p-822c6092.js +0 -1
- package/dist/vega/p-8edf3513.js +0 -1
- package/dist/vega/p-a1b7a179.entry.js +0 -1
- package/dist/vega/p-ab8f99e9.entry.js +0 -1
- package/dist/vega/p-bf7f755b.js +0 -1
- package/dist/vega/p-bf9476cd.entry.js +0 -1
- package/dist/vega/p-c1da8328.entry.js +0 -1
- package/dist/vega/p-c6ce2869.js +0 -1
- package/dist/vega/p-d0e6454e.entry.js +0 -1
- package/dist/vega/p-d88e88a7.js +0 -1
- package/dist/vega/p-f360c9ba.js +0 -1
|
@@ -2,8 +2,9 @@ import calendarEventRepeatPatternFactory from '../../components/vega-calendar/sl
|
|
|
2
2
|
import { generateUUID } from '../../utils/misc';
|
|
3
3
|
import { VegaInternalTranslation } from '../translation';
|
|
4
4
|
import { CalendarDate } from './calendar-date';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { CalendarTime } from './calendar-time';
|
|
6
|
+
import { CalendarDateTime } from './calendar-date-time';
|
|
7
|
+
import { getSystemTimezone, WeekdayLongNames } from './utils';
|
|
7
8
|
const CalendarDateFormatReg = /^\d{1,2}\/\d{1,2}\/\d{4}/;
|
|
8
9
|
const CalendarTimeFormatReg = /^\d{1,2}:\d{1,2}/;
|
|
9
10
|
/** The `CalendarEvent` class in TypeScript represents a calendar event with methods to validate required fields, initialize dates and times, and determine if it is a group event. */
|
|
@@ -101,7 +102,7 @@ export class CalendarEvent {
|
|
|
101
102
|
* @returns {Date} The `startDate` property of type `Date` is being returned.
|
|
102
103
|
*/
|
|
103
104
|
get startDate() {
|
|
104
|
-
return this.
|
|
105
|
+
return this._startDateTime.toDate();
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
108
|
* The function returns the end date property of an object.
|
|
@@ -109,23 +110,23 @@ export class CalendarEvent {
|
|
|
109
110
|
* @returns {Date} The `endDate` property of type `Date` is being returned.
|
|
110
111
|
*/
|
|
111
112
|
get endDate() {
|
|
112
|
-
return this.
|
|
113
|
+
return this._endDateTime.toDate();
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
* This function returns the start time as a
|
|
116
|
+
* This function returns the start time as a CalendarTime.
|
|
116
117
|
*
|
|
117
|
-
* @returns {
|
|
118
|
+
* @returns {CalendarTime} The event start time.
|
|
118
119
|
*/
|
|
119
120
|
get startTime() {
|
|
120
|
-
return this.
|
|
121
|
+
return this._startDateTime.calendarTime;
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
|
-
* This function returns the end time as a
|
|
124
|
+
* This function returns the end time as a CalendarTime.
|
|
124
125
|
*
|
|
125
|
-
* @returns {
|
|
126
|
+
* @returns {CalendarTime} The event end time.
|
|
126
127
|
*/
|
|
127
128
|
get endTime() {
|
|
128
|
-
return this.
|
|
129
|
+
return this._endDateTime.calendarTime;
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
131
132
|
* This function returns the number of days that an event spans.
|
|
@@ -150,7 +151,7 @@ export class CalendarEvent {
|
|
|
150
151
|
const endDate = this._eventSpansDays > 1
|
|
151
152
|
? new Date(startDate.year, startDate.month - 1, startDate.date + (this._eventSpansDays - 1))
|
|
152
153
|
: startDate.toDate();
|
|
153
|
-
const result = new CalendarEvent(Object.assign(Object.assign({}, this._event), { startDate: startDate.toDate(), endDate: endDate, startTime: this.startTime, endTime: this.endTime }), eventKey);
|
|
154
|
+
const result = new CalendarEvent(Object.assign(Object.assign({}, this._event), { startDate: startDate.toDate(), endDate: endDate, startTime: this.startTime.toString(), endTime: this.endTime.toString() }), eventKey);
|
|
154
155
|
return result;
|
|
155
156
|
}
|
|
156
157
|
/**
|
|
@@ -193,8 +194,8 @@ export class CalendarEvent {
|
|
|
193
194
|
*/
|
|
194
195
|
generateDateTimeString(viewDate, timeFormat) {
|
|
195
196
|
const weekDay = VegaInternalTranslation.t(Object.values(WeekdayLongNames)[viewDate.toDate().getDay()]);
|
|
196
|
-
const startTime =
|
|
197
|
-
const endTime =
|
|
197
|
+
const startTime = this.startTime.toString(timeFormat);
|
|
198
|
+
const endTime = this.endTime.toString(timeFormat);
|
|
198
199
|
return `${weekDay}, ${viewDate.date} ${viewDate.getMonthName(true)} ${viewDate.year} ${startTime} - ${endTime}`;
|
|
199
200
|
}
|
|
200
201
|
/**
|
|
@@ -202,13 +203,8 @@ export class CalendarEvent {
|
|
|
202
203
|
*
|
|
203
204
|
* @returns {number} the minutes
|
|
204
205
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const [endHour, endMinutes] = this.endTime.split(':');
|
|
208
|
-
const now = CalendarDate.from(new Date(), this._timezone);
|
|
209
|
-
const startDate = new Date(now.year, now.month, now.date, Number(startHour), Number(startMinutes));
|
|
210
|
-
const endDate = new Date(now.year, now.month, now.date, Number(endHour) === 0 && Number(startHour) !== 0 ? 24 : Number(endHour), Number(endMinutes));
|
|
211
|
-
return (endDate.valueOf() - startDate.valueOf()) / (60 * 1000);
|
|
206
|
+
getEventMinutes() {
|
|
207
|
+
return CalendarTime.calculateDuration(this.startTime, this.endTime, 'minutes');
|
|
212
208
|
}
|
|
213
209
|
/**
|
|
214
210
|
* This function returns an array of repeat series based on a given calendar period.
|
|
@@ -232,36 +228,8 @@ export class CalendarEvent {
|
|
|
232
228
|
*/
|
|
233
229
|
updateTimezone(timezone) {
|
|
234
230
|
this._timezone = timezone;
|
|
235
|
-
this.
|
|
236
|
-
this.
|
|
237
|
-
this.initRepeatPattern();
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* The function `convertTimeTo24Hour` converts a time string from 12-hour format to 24-hour format in TypeScript.
|
|
241
|
-
*
|
|
242
|
-
* @param {string} timeString - The `convertTimeTo24Hour` function you provided is used to convert a
|
|
243
|
-
* time string from 12-hour format to 24-hour format. The function checks if the input time string is
|
|
244
|
-
* in 12-hour format and contains either 'am' or 'pm'.
|
|
245
|
-
* @returns {string} The `convertTimeTo24Hour` function returns a string representing the input time string
|
|
246
|
-
* converted to 24-hour format. If the input time string is in 12-hour format and contains 'am' or
|
|
247
|
-
* 'pm', it converts it to 24-hour format. If the input time string is not in 12-hour format or does
|
|
248
|
-
* not contain 'am' or 'pm', it returns the original input
|
|
249
|
-
*/
|
|
250
|
-
convertTimeTo24Hour(timeString) {
|
|
251
|
-
timeString = timeString.toLocaleLowerCase();
|
|
252
|
-
if (timeString.indexOf('am') > 0 || timeString.indexOf('pm') > 0) {
|
|
253
|
-
if (timeString.indexOf('am') > 0) {
|
|
254
|
-
timeString = timeString.replace('am', '').trim();
|
|
255
|
-
const [hour, minutes] = timeString.split(':');
|
|
256
|
-
return `${hour === '12' ? '00' : hour}:${minutes}`;
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
timeString = timeString.replace('pm', '').trim();
|
|
260
|
-
const [hour, minutes] = timeString.split(':');
|
|
261
|
-
return `${hour === '12' ? '12' : Number(hour) + 12}:${minutes}`;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return timeString;
|
|
231
|
+
this._startDateTime.setTimezone(timezone);
|
|
232
|
+
this._endDateTime.setTimezone(timezone);
|
|
265
233
|
}
|
|
266
234
|
/**
|
|
267
235
|
* The function `checkEventRequireField` validates the required fields of a calendar event item in TypeScript.
|
|
@@ -293,164 +261,41 @@ export class CalendarEvent {
|
|
|
293
261
|
*/
|
|
294
262
|
initDate(eventOptions) {
|
|
295
263
|
const { startDate, startTime, endDate, endTime } = eventOptions;
|
|
296
|
-
|
|
297
|
-
this.
|
|
298
|
-
this.processEndDate(endDate || '', endTime || '', originalDateParts);
|
|
299
|
-
this._endTime = this.formatTimeForDisplay(this._endDate, endTime || '');
|
|
264
|
+
this.processStartDate(startDate, startTime);
|
|
265
|
+
this.processEndDate(endDate, endTime, startDate);
|
|
300
266
|
}
|
|
301
267
|
/**
|
|
302
|
-
*
|
|
268
|
+
* Parse the supplied start date/time, normalize into calendar wrappers.
|
|
303
269
|
*
|
|
304
|
-
* @param {string | Date} startDate -
|
|
305
|
-
* @param {string} startTime -
|
|
306
|
-
* @returns {DateParts | undefined} originalDateParts information
|
|
270
|
+
* @param {string | Date} startDate - Raw start date value from the event payload.
|
|
271
|
+
* @param {string} startTime - Optional textual time component to parse.
|
|
307
272
|
*/
|
|
308
273
|
processStartDate(startDate, startTime) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
year: startDate.getFullYear(),
|
|
314
|
-
month: startDate.getMonth(),
|
|
315
|
-
date: startDate.getDate(),
|
|
316
|
-
};
|
|
317
|
-
tempDate = startDate;
|
|
318
|
-
}
|
|
319
|
-
else if (startDate && typeof startDate === 'string') {
|
|
320
|
-
const [month, day, year] = startDate.split('/');
|
|
321
|
-
originalDateParts = {
|
|
322
|
-
year: Number(year),
|
|
323
|
-
month: Number(month) - 1,
|
|
324
|
-
date: Number(day),
|
|
325
|
-
};
|
|
326
|
-
tempDate = new Date(originalDateParts.year, originalDateParts.month, originalDateParts.date);
|
|
327
|
-
}
|
|
328
|
-
if (startTime && originalDateParts && tempDate) {
|
|
329
|
-
const { timeHours, timeMinutes } = this.getCurrentHourAndMinutes(startTime);
|
|
330
|
-
tempDate = new Date(originalDateParts.year, originalDateParts.month, originalDateParts.date, timeHours, timeMinutes, 0);
|
|
331
|
-
}
|
|
332
|
-
if (tempDate) {
|
|
333
|
-
this._startDate = this.convertDateToTimezone(tempDate);
|
|
334
|
-
}
|
|
335
|
-
return originalDateParts;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Process end date
|
|
339
|
-
*
|
|
340
|
-
* @param {string | Date} endDate - End date (string or Date object)
|
|
341
|
-
* @param {string} endTime - End time string
|
|
342
|
-
* @param {DateParts | undefined} fallbackDateParts - Default date parts to use when endDate is empty
|
|
343
|
-
*/
|
|
344
|
-
processEndDate(endDate, endTime, fallbackDateParts) {
|
|
345
|
-
let tempDate;
|
|
346
|
-
if (endDate && typeof endDate === 'object') {
|
|
347
|
-
tempDate = endDate;
|
|
348
|
-
}
|
|
349
|
-
else if (endDate && typeof endDate === 'string') {
|
|
350
|
-
const [month, day, year] = endDate.split('/');
|
|
351
|
-
tempDate = new Date(Number(year), Number(month) - 1, Number(day), 23, 59, 59);
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
if (fallbackDateParts) {
|
|
355
|
-
tempDate = new Date(fallbackDateParts.year, fallbackDateParts.month, fallbackDateParts.date, 23, 59, 59);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (endTime && tempDate) {
|
|
359
|
-
const { timeHours, timeMinutes } = this.getCurrentHourAndMinutes(endTime, 23, 59);
|
|
360
|
-
tempDate = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), timeHours, timeMinutes, 59);
|
|
361
|
-
}
|
|
362
|
-
if (tempDate) {
|
|
363
|
-
this._endDate = this.convertDateToTimezone(tempDate);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Format time for display
|
|
368
|
-
*
|
|
369
|
-
* @param {Date} date - Date object
|
|
370
|
-
* @param {string} originalTime - Original time string
|
|
371
|
-
* @returns {string} Formatted time string
|
|
372
|
-
*/
|
|
373
|
-
formatTimeForDisplay(date, originalTime) {
|
|
374
|
-
const shouldUseOriginalTime = Boolean(originalTime) && this._timezone === getSystemTimezone();
|
|
375
|
-
if (shouldUseOriginalTime) {
|
|
376
|
-
const convertedTime = this.convertTimeTo24Hour(originalTime);
|
|
377
|
-
const [hour, minutes] = convertedTime.split(':');
|
|
378
|
-
return `${date.getHours().toString().padStart(hour.length, '0')}:${date
|
|
379
|
-
.getMinutes()
|
|
380
|
-
.toString()
|
|
381
|
-
.padStart(minutes.length, '0')}`;
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
return `${date.getHours()}:${date.getMinutes()}`;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Parses a time string and extracts hour and minute values.
|
|
389
|
-
* If the time string is empty or invalid, returns the provided default values.
|
|
390
|
-
*
|
|
391
|
-
* @param {string} time - The time string to parse (e.g., "14:30", "2:30 PM")
|
|
392
|
-
* @param {number} defaultHours - Default hour value to use when time is empty (default: 0)
|
|
393
|
-
* @param {number} defaultMinutes - Default minute value to use when time is empty (default: 0)
|
|
394
|
-
* @returns {CalendarTimeHourMinutes} An object containing timeHours and timeMinutes as numbers
|
|
395
|
-
*/
|
|
396
|
-
getCurrentHourAndMinutes(time, defaultHours = 0, defaultMinutes = 0) {
|
|
397
|
-
let timeHours = defaultHours;
|
|
398
|
-
let timeMinutes = defaultMinutes;
|
|
399
|
-
if (time) {
|
|
400
|
-
const timeString = this.convertTimeTo24Hour(time).split(':');
|
|
401
|
-
timeHours = Number(timeString[0]);
|
|
402
|
-
timeMinutes = Number(timeString[1]);
|
|
403
|
-
}
|
|
404
|
-
return { timeHours, timeMinutes };
|
|
274
|
+
this._startDateTime = CalendarDateTime.fromInitDataSource(startDate, {
|
|
275
|
+
timezone: this._timezone,
|
|
276
|
+
time: startTime,
|
|
277
|
+
});
|
|
405
278
|
}
|
|
406
279
|
/**
|
|
407
|
-
*
|
|
280
|
+
* Parse the supplied end date/time, normalize into calendar wrappers.
|
|
408
281
|
*
|
|
409
|
-
* @param {Date}
|
|
410
|
-
* @
|
|
282
|
+
* @param {string | Date | undefined} endDate - The raw end date value from the event payload.
|
|
283
|
+
* @param {string | undefined} endTime - The optional textual end time component to parse.
|
|
284
|
+
* @param {string | Date} originStartDate - The start date value to use as fallback if endDate is missing.
|
|
411
285
|
*/
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
month: '2-digit',
|
|
419
|
-
day: '2-digit',
|
|
420
|
-
hour: '2-digit',
|
|
421
|
-
minute: '2-digit',
|
|
422
|
-
second: '2-digit',
|
|
423
|
-
hour12: false,
|
|
424
|
-
});
|
|
425
|
-
const targetParts = targetFormatter.formatToParts(date);
|
|
426
|
-
const getYear = targetParts.find((part) => part.type === 'year');
|
|
427
|
-
const getMonth = targetParts.find((part) => part.type === 'month');
|
|
428
|
-
const getDay = targetParts.find((part) => part.type === 'day');
|
|
429
|
-
const getHour = targetParts.find((part) => part.type === 'hour');
|
|
430
|
-
const getMinute = targetParts.find((part) => part.type === 'minute');
|
|
431
|
-
const getSecond = targetParts.find((part) => part.type === 'second');
|
|
432
|
-
if (getYear && getMonth && getDay && getHour && getMinute && getSecond) {
|
|
433
|
-
const year = parseInt(getYear.value, 10);
|
|
434
|
-
const month = parseInt(getMonth.value, 10);
|
|
435
|
-
const day = parseInt(getDay.value, 10);
|
|
436
|
-
const hour = parseInt(getHour.value, 10);
|
|
437
|
-
const minute = parseInt(getMinute.value, 10);
|
|
438
|
-
const second = parseInt(getSecond.value, 10);
|
|
439
|
-
return new Date(year, month - 1, day, hour, minute, second);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
catch (error) {
|
|
443
|
-
LogUtility.warn('Invalid timezone:', this._timezone);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
return date;
|
|
286
|
+
processEndDate(endDate, endTime, originStartDate) {
|
|
287
|
+
this._endDateTime = CalendarDateTime.fromInitDataSource(endDate || originStartDate, {
|
|
288
|
+
timezone: this._timezone,
|
|
289
|
+
time: endTime,
|
|
290
|
+
endTimeMissing: !endTime && !endDate,
|
|
291
|
+
});
|
|
447
292
|
}
|
|
448
293
|
/**
|
|
449
294
|
* The function initializes a repeat pattern controller for a calendar event with specified start and end dates and repeat options.
|
|
450
295
|
*/
|
|
451
296
|
initRepeatPattern() {
|
|
452
297
|
if (this._event.repeatOptions && this._event.repeatOptions.frequency) {
|
|
453
|
-
this.repeatPattern = calendarEventRepeatPatternFactory.getPattern(this.
|
|
298
|
+
this.repeatPattern = calendarEventRepeatPatternFactory.getPattern(this.startDate, this._event.repeatOptions, this._timezone);
|
|
454
299
|
}
|
|
455
300
|
}
|
|
456
301
|
/**
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { VegaInternalTranslation } from '../translation';
|
|
2
|
+
/**
|
|
3
|
+
* CalendarTime represents hours/minutes in 24-hour format and centralizes parsing/formatting logic.
|
|
4
|
+
*/
|
|
5
|
+
export class CalendarTime {
|
|
6
|
+
constructor(hours, minutes) {
|
|
7
|
+
this._hours = hours;
|
|
8
|
+
this._minutes = minutes;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse a raw time string into a CalendarTime instance.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} rawTime - Source time value such as "9:00" or "9am".
|
|
14
|
+
* @returns {CalendarTime} Parsed time.
|
|
15
|
+
*/
|
|
16
|
+
static fromString(rawTime) {
|
|
17
|
+
const normalized = this.convertTimeTo24Hour(rawTime);
|
|
18
|
+
const [hourPart, minutePart] = normalized.split(':');
|
|
19
|
+
return new CalendarTime(Number(hourPart), Number(minutePart));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build a CalendarTime from a Date instance while preserving hours/minutes.
|
|
23
|
+
*
|
|
24
|
+
* @param {Date} date - The source date.
|
|
25
|
+
* @returns {CalendarTime} Time representation extracted from the date.
|
|
26
|
+
*/
|
|
27
|
+
static fromDate(date) {
|
|
28
|
+
return new CalendarTime(date.getHours(), date.getMinutes());
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Calculate the duration in the requested precision between two CalendarTime values, accounting for overnight spans.
|
|
32
|
+
*
|
|
33
|
+
* @param {CalendarTime} start - Start time of the interval.
|
|
34
|
+
* @param {CalendarTime} end - End time of the interval.
|
|
35
|
+
* @param {'minutes' | 'hours'} precision - Desired unit of measure for the result (defaults to minutes).
|
|
36
|
+
* @returns {number} Duration expressed in the requested precision.
|
|
37
|
+
*/
|
|
38
|
+
static calculateDuration(start, end, precision = 'minutes') {
|
|
39
|
+
const startMinutes = start.totalMinutes;
|
|
40
|
+
let endMinutes = end.totalMinutes;
|
|
41
|
+
if (end.hours === 0 && start.hours !== 0) {
|
|
42
|
+
endMinutes += 24 * 60;
|
|
43
|
+
}
|
|
44
|
+
const durationMinutes = endMinutes - startMinutes;
|
|
45
|
+
return precision === 'hours' ? durationMinutes / 60 : durationMinutes;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Normalize various time inputs (e.g. 9am, 9:30 PM) to a 24-hour HH:mm string.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} timeString - User supplied time value.
|
|
51
|
+
* @returns {string} 24-hour formatted string.
|
|
52
|
+
*/
|
|
53
|
+
static convertTimeTo24Hour(timeString) {
|
|
54
|
+
const normalized = timeString.toLocaleLowerCase();
|
|
55
|
+
if (normalized.includes('am') || normalized.includes('pm')) {
|
|
56
|
+
const isAm = normalized.includes('am');
|
|
57
|
+
const cleaned = normalized.replace('am', '').replace('pm', '').trim();
|
|
58
|
+
const [rawHour, rawMinutes] = cleaned.split(':');
|
|
59
|
+
const minutes = rawMinutes.padStart(2, '0');
|
|
60
|
+
if (isAm) {
|
|
61
|
+
return `${rawHour === '12' ? '00' : rawHour}:${minutes}`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const convertedHour = rawHour === '12' ? '12' : `${Number(rawHour) + 12}`;
|
|
65
|
+
return `${convertedHour}:${minutes}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return timeString;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Hour component in 24-hour clock.
|
|
72
|
+
*
|
|
73
|
+
* @returns {number} Hours between 0-23.
|
|
74
|
+
*/
|
|
75
|
+
get hours() {
|
|
76
|
+
return this._hours;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Minute component.
|
|
80
|
+
*
|
|
81
|
+
* @returns {number} Minutes between 0-59.
|
|
82
|
+
*/
|
|
83
|
+
get minutes() {
|
|
84
|
+
return this._minutes;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Total minutes elapsed since midnight for this time value.
|
|
88
|
+
*
|
|
89
|
+
* @returns {number} Minutes from 00:00.
|
|
90
|
+
*/
|
|
91
|
+
get totalMinutes() {
|
|
92
|
+
return this._hours * 60 + this._minutes;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Format the time into a string using a simple formatter.
|
|
96
|
+
*
|
|
97
|
+
* @param {TimeStringFormat} format - time string Format. Defaults to 'hh:mm'.
|
|
98
|
+
* @returns {string} Formatted time string.
|
|
99
|
+
*/
|
|
100
|
+
toString(format = 'hh:mm') {
|
|
101
|
+
const defaultHours = this._hours.toString().padStart(2, '0');
|
|
102
|
+
const defaultMinutes = this._minutes.toString().padStart(2, '0');
|
|
103
|
+
const normalizedFormat = format.toLowerCase();
|
|
104
|
+
switch (normalizedFormat) {
|
|
105
|
+
case 'hh:m':
|
|
106
|
+
return `${defaultHours}:${this._minutes}`;
|
|
107
|
+
case 'h:mm':
|
|
108
|
+
return `${this._hours}:${defaultMinutes}`;
|
|
109
|
+
case 'h:m':
|
|
110
|
+
return `${this._hours}:${this._minutes}`;
|
|
111
|
+
case '12-hour': {
|
|
112
|
+
const amPm = this._hours >= 12 ? 'pm' : 'am';
|
|
113
|
+
const hour12 = this._hours % 12 || 12;
|
|
114
|
+
return `${hour12}:${defaultMinutes} ${VegaInternalTranslation.t(amPm)}`;
|
|
115
|
+
}
|
|
116
|
+
default:
|
|
117
|
+
return `${defaultHours}:${defaultMinutes}`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -7,4 +7,6 @@ export { DayPeriod } from './calendar-period/day-period';
|
|
|
7
7
|
export { WeekPeriod } from './calendar-period/week-period';
|
|
8
8
|
export { MonthPeriod } from './calendar-period/month-period';
|
|
9
9
|
export { CalendarDate } from './calendar-date';
|
|
10
|
+
export { CalendarDateTime } from './calendar-date-time';
|
|
11
|
+
export { CalendarTime } from './calendar-time';
|
|
10
12
|
export { CalendarView } from './calendar-view';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CalendarDateTime } from '../index';
|
|
2
|
+
describe('calendar-date-time', () => {
|
|
3
|
+
it('normalizes native dates into timezone aware date and time', () => {
|
|
4
|
+
const sourceDate = new Date(2025, 5, 14, 10, 5, 30);
|
|
5
|
+
const dateTime = CalendarDateTime.fromDate(sourceDate, 'UTC');
|
|
6
|
+
const calendarDate = dateTime.calendarDate;
|
|
7
|
+
const calendarTime = dateTime.calendarTime;
|
|
8
|
+
expect(calendarDate.year).toBe(2025);
|
|
9
|
+
expect(calendarDate.month).toBe(6);
|
|
10
|
+
expect(calendarDate.date).toBe(14);
|
|
11
|
+
expect(calendarTime.toString()).toBe('10:05');
|
|
12
|
+
});
|
|
13
|
+
it('supports composing from input date and time string', () => {
|
|
14
|
+
const dateTime = CalendarDateTime.fromInitDataSource('2025-10-29', {
|
|
15
|
+
time: '1:30 pm',
|
|
16
|
+
timezone: 'UTC',
|
|
17
|
+
});
|
|
18
|
+
expect(dateTime.calendarTime.toString()).toBe('13:30');
|
|
19
|
+
});
|
|
20
|
+
it('falls back to end of day when requested', () => {
|
|
21
|
+
const dateTime = CalendarDateTime.fromInitDataSource('2025-10-29', {
|
|
22
|
+
endTimeMissing: true,
|
|
23
|
+
timezone: 'UTC',
|
|
24
|
+
});
|
|
25
|
+
expect(dateTime.calendarTime.toString()).toBe('23:59');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -25,9 +25,11 @@ describe('calendar-event', () => {
|
|
|
25
25
|
expect(calendarEvent.eventKey).not.toBeNull();
|
|
26
26
|
expect(calendarEvent.title).toEqual('Event title');
|
|
27
27
|
expect(calendarEvent.isAllDayEvent).toEqual(false);
|
|
28
|
-
expect(calendarEvent.startTime).toEqual('13:44');
|
|
29
|
-
expect(calendarEvent.endTime).toEqual('14:44');
|
|
30
|
-
expect(calendarEvent.startDate).toEqual(mockDate);
|
|
28
|
+
expect(calendarEvent.startTime.toString()).toEqual('13:44');
|
|
29
|
+
expect(calendarEvent.endTime.toString()).toEqual('14:44');
|
|
30
|
+
expect(calendarEvent.startDate.getFullYear()).toEqual(mockDate.getFullYear());
|
|
31
|
+
expect(calendarEvent.startDate.getMonth()).toEqual(mockDate.getMonth());
|
|
32
|
+
expect(calendarEvent.startDate.getDate()).toEqual(mockDate.getDate());
|
|
31
33
|
expect(calendarEvent.endDate.getDate()).toEqual(13);
|
|
32
34
|
expect(calendarEvent.endDate.getMonth()).toEqual(5);
|
|
33
35
|
expect(calendarEvent.isRepeatEvent).toEqual(false);
|
|
@@ -65,25 +67,25 @@ describe('calendar-event', () => {
|
|
|
65
67
|
expect(calendarEvent1.startDate.getDate()).toEqual(13);
|
|
66
68
|
expect(calendarEvent1.startDate.getMonth()).toEqual(5);
|
|
67
69
|
expect(calendarEvent1.startDate.getFullYear()).toEqual(2024);
|
|
68
|
-
expect(calendarEvent1.startTime).toEqual('0:0');
|
|
70
|
+
expect(calendarEvent1.startTime.toString('h:m')).toEqual('0:0');
|
|
69
71
|
expect(calendarEvent1.endDate.getDate()).toEqual(13);
|
|
70
72
|
expect(calendarEvent1.endDate.getMonth()).toEqual(5);
|
|
71
73
|
expect(calendarEvent1.endDate.getFullYear()).toEqual(2024);
|
|
72
|
-
expect(calendarEvent1.endTime).toEqual('14:44');
|
|
74
|
+
expect(calendarEvent1.endTime.toString()).toEqual('14:44');
|
|
73
75
|
const calendarEvent2 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startTime: '10:00' }));
|
|
74
|
-
expect(calendarEvent2.startTime).toEqual('10:00');
|
|
76
|
+
expect(calendarEvent2.startTime.toString()).toEqual('10:00');
|
|
75
77
|
});
|
|
76
78
|
it('should init end date and time field correct', () => {
|
|
77
79
|
const calendarEvent1 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { endDate: '06/14/2024', endTime: '18:00' }));
|
|
78
80
|
expect(calendarEvent1.endDate.getDate()).toEqual(14);
|
|
79
81
|
expect(calendarEvent1.endDate.getMonth()).toEqual(5);
|
|
80
82
|
expect(calendarEvent1.endDate.getFullYear()).toEqual(2024);
|
|
81
|
-
expect(calendarEvent1.endTime).toEqual('18:00');
|
|
83
|
+
expect(calendarEvent1.endTime.toString()).toEqual('18:00');
|
|
82
84
|
const calendarEvent2 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { endDate: new Date(2024, 5, 13, 15, 0), endTime: '' }));
|
|
83
85
|
expect(calendarEvent2.endDate.getDate()).toEqual(13);
|
|
84
86
|
expect(calendarEvent2.endDate.getMonth()).toEqual(5);
|
|
85
87
|
expect(calendarEvent2.endDate.getFullYear()).toEqual(2024);
|
|
86
|
-
expect(calendarEvent2.endTime).toEqual('15:0');
|
|
88
|
+
expect(calendarEvent2.endTime.toString('hh:m')).toEqual('15:0');
|
|
87
89
|
});
|
|
88
90
|
it('should get group event correct', () => {
|
|
89
91
|
const calendarEvent1 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { endDate: '06/14/2024', endTime: '18:00' }));
|
|
@@ -101,22 +103,22 @@ describe('calendar-event', () => {
|
|
|
101
103
|
});
|
|
102
104
|
it('should get event duration correct', () => {
|
|
103
105
|
const calendarEvent1 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', startTime: '10:00', endTime: '11:00', endDate: '06/14/2024' }));
|
|
104
|
-
expect(calendarEvent1.
|
|
106
|
+
expect(calendarEvent1.getEventMinutes()).toEqual(60);
|
|
105
107
|
const calendarEvent2 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', startTime: '23:00', endTime: '00:00', endDate: '06/14/2024' }));
|
|
106
|
-
expect(calendarEvent2.
|
|
108
|
+
expect(calendarEvent2.getEventMinutes()).toEqual(60);
|
|
107
109
|
const calendarEvent3 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', startTime: '00:00', endTime: '00:30', endDate: '06/14/2024' }));
|
|
108
|
-
expect(calendarEvent3.
|
|
110
|
+
expect(calendarEvent3.getEventMinutes()).toEqual(30);
|
|
109
111
|
});
|
|
110
112
|
it('should init the event time correct when use 12-hour', () => {
|
|
111
113
|
const calendarEvent1 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', startTime: '12:00 am', endTime: '12:00 pm', endDate: '06/14/2024' }));
|
|
112
|
-
expect(calendarEvent1.startTime).toEqual('00:00');
|
|
113
|
-
expect(calendarEvent1.endTime).toEqual('12:00');
|
|
114
|
+
expect(calendarEvent1.startTime.toString()).toEqual('00:00');
|
|
115
|
+
expect(calendarEvent1.endTime.toString()).toEqual('12:00');
|
|
114
116
|
const calendarEvent2 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', startTime: '1:00 am', endTime: '2:00 am', endDate: '06/14/2024' }));
|
|
115
|
-
expect(calendarEvent2.startTime).toEqual('1:00');
|
|
116
|
-
expect(calendarEvent2.endTime).toEqual('2:00');
|
|
117
|
+
expect(calendarEvent2.startTime.toString('h:mm')).toEqual('1:00');
|
|
118
|
+
expect(calendarEvent2.endTime.toString('h:mm')).toEqual('2:00');
|
|
117
119
|
const calendarEvent3 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', startTime: '1:00 pm', endTime: '2:30 pm', endDate: '06/14/2024' }));
|
|
118
|
-
expect(calendarEvent3.startTime).toEqual('13:00');
|
|
119
|
-
expect(calendarEvent3.endTime).toEqual('14:30');
|
|
120
|
+
expect(calendarEvent3.startTime.toString()).toEqual('13:00');
|
|
121
|
+
expect(calendarEvent3.endTime.toString()).toEqual('14:30');
|
|
120
122
|
});
|
|
121
123
|
it('should create event correct when call copyTo', () => {
|
|
122
124
|
const calendarEvent1 = new CalendarEvent(Object.assign(Object.assign({}, rawEvent), { startDate: '06/14/2024', endDate: '06/15/2024', startTime: '12:00 am', endTime: '12:00 pm', repeatOptions: {
|
|
@@ -214,13 +216,13 @@ describe('calendar event with timezone', () => {
|
|
|
214
216
|
await page.waitForChanges();
|
|
215
217
|
expect(component.calendarEvents).toHaveLength(1);
|
|
216
218
|
const calendarEvent = component.calendarEvents[0];
|
|
217
|
-
expect(calendarEvent.startTime).toBe('09:00');
|
|
219
|
+
expect(calendarEvent.startTime.toString()).toBe('09:00');
|
|
218
220
|
calendarElement.timezone = 'Asia/Shanghai';
|
|
219
|
-
expect(calendarEvent.startTime).toBe('17:0');
|
|
220
|
-
expect(calendarEvent.endTime).toBe('1:0');
|
|
221
|
+
expect(calendarEvent.startTime.toString('hh:m')).toBe('17:0');
|
|
222
|
+
expect(calendarEvent.endTime.toString('h:m')).toBe('1:0');
|
|
221
223
|
calendarElement.timezone = 'America/New_York';
|
|
222
|
-
expect(calendarEvent.startTime).toBe('5:0');
|
|
223
|
-
expect(calendarEvent.endTime).toBe('13:0');
|
|
224
|
+
expect(calendarEvent.startTime.toString('h:m')).toBe('5:0');
|
|
225
|
+
expect(calendarEvent.endTime.toString('hh:m')).toBe('13:0');
|
|
224
226
|
});
|
|
225
227
|
it('should handle timezone conversion with invalid timezone gracefully', async () => {
|
|
226
228
|
const testEvents = [
|
|
@@ -93,8 +93,8 @@ describe('DayPeriod Timezone', () => {
|
|
|
93
93
|
expect(dayPeriod.endDate).toEqual(new CalendarDate(2025, 10, 29));
|
|
94
94
|
});
|
|
95
95
|
it('should create day period with timezone Asia/Shanghai', () => {
|
|
96
|
-
|
|
97
|
-
const dayPeriod = new DayPeriod(
|
|
96
|
+
const shanghaiDate = new CalendarDate(2025, 10, 30);
|
|
97
|
+
const dayPeriod = new DayPeriod(shanghaiDate, true, 'Asia/Shanghai');
|
|
98
98
|
expect(dayPeriod.current).toEqual(new CalendarDate(2025, 10, 30));
|
|
99
99
|
expect(dayPeriod.startDate).toEqual(new CalendarDate(2025, 10, 30));
|
|
100
100
|
expect(dayPeriod.endDate).toEqual(new CalendarDate(2025, 10, 30));
|
|
@@ -80,8 +80,8 @@ describe('MonthPeriod Timezone', () => {
|
|
|
80
80
|
expect(monthPeriod.endDate.month).toBe(11);
|
|
81
81
|
});
|
|
82
82
|
it('should create month period with timezone Asia/Shanghai', () => {
|
|
83
|
-
|
|
84
|
-
const monthPeriod = new MonthPeriod(
|
|
83
|
+
const shanghaiDate = new CalendarDate(2025, 11, 1);
|
|
84
|
+
const monthPeriod = new MonthPeriod(shanghaiDate, true, 'Asia/Shanghai');
|
|
85
85
|
expect(monthPeriod.current).toEqual(new CalendarDate(2025, 11, 1));
|
|
86
86
|
expect(monthPeriod.startDate.month).toBe(10);
|
|
87
87
|
expect(monthPeriod.endDate.month).toBe(12);
|
|
@@ -73,8 +73,8 @@ describe('WeekPeriod Timezone', () => {
|
|
|
73
73
|
expect(weekPeriod.endDate).toEqual(new CalendarDate(2025, 11, 1));
|
|
74
74
|
});
|
|
75
75
|
it('should create week period with timezone Asia/Shanghai', () => {
|
|
76
|
-
|
|
77
|
-
const weekPeriod = new WeekPeriod(
|
|
76
|
+
const shanghaiDate = new CalendarDate(2025, 10, 28);
|
|
77
|
+
const weekPeriod = new WeekPeriod(shanghaiDate, true, 'Asia/Shanghai');
|
|
78
78
|
expect(weekPeriod.current).toEqual(new CalendarDate(2025, 10, 28));
|
|
79
79
|
expect(weekPeriod.startDate).toEqual(new CalendarDate(2025, 10, 26));
|
|
80
80
|
expect(weekPeriod.endDate).toEqual(new CalendarDate(2025, 11, 1));
|
|
@@ -87,12 +87,12 @@ describe('WeekPeriod Timezone', () => {
|
|
|
87
87
|
expect(nextWeek.endDate).toEqual(new CalendarDate(2025, 11, 8));
|
|
88
88
|
});
|
|
89
89
|
it('should go to now with timezone America/New_York', () => {
|
|
90
|
-
jest.setSystemTime(new Date('2025-
|
|
90
|
+
jest.setSystemTime(new Date('2025-12-15T12:00:00Z'));
|
|
91
91
|
const weekPeriod = new WeekPeriod(undefined, true, 'America/New_York');
|
|
92
92
|
const nowPeriod = weekPeriod.now();
|
|
93
|
-
expect(nowPeriod.current).toEqual(new CalendarDate(2025,
|
|
94
|
-
expect(nowPeriod.startDate).toEqual(new CalendarDate(2025,
|
|
95
|
-
expect(nowPeriod.endDate).toEqual(new CalendarDate(2025,
|
|
93
|
+
expect(nowPeriod.current).toEqual(new CalendarDate(2025, 12, 15));
|
|
94
|
+
expect(nowPeriod.startDate).toEqual(new CalendarDate(2025, 12, 14));
|
|
95
|
+
expect(nowPeriod.endDate).toEqual(new CalendarDate(2025, 12, 20));
|
|
96
96
|
});
|
|
97
97
|
it('should handle week period at year boundary', () => {
|
|
98
98
|
const weekPeriod = new WeekPeriod(new CalendarDate(2025, 12, 31));
|