@globalpayments/vega 2.71.0 → 2.72.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-837be7a6.js → app-globals-c6be6013.js} +8 -7
- package/dist/cjs/{child-nodes-event-prevent-slimmer-f8840f1b.js → child-nodes-event-prevent-slimmer-871855df.js} +1 -1
- package/dist/cjs/{code-block-bb4cbafa.js → code-block-a7c8825f.js} +14 -66
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-cf7b4bda.js → component-value-history-controller-slimmer.abstract-868de3c4.js} +5 -5
- package/dist/cjs/{date-required-rule-4e1f84fd.js → date-required-rule-99cca681.js} +3 -3
- package/dist/cjs/{design-token-00fe8d2f.js → design-token-d9c4dff6.js} +6 -7
- package/dist/cjs/{dom-node-subject-observer-factory-f040608b.js → dom-node-subject-observer-factory-1c8f7880.js} +5 -1
- package/dist/cjs/{dto-renderer-manager-c917dade.js → dto-renderer-manager-f3820a6b.js} +4 -4
- package/dist/cjs/{element-appender-slimmer-f8e89f37.js → element-appender-slimmer-3dc36dfa.js} +49 -11
- package/dist/cjs/{event-emit-slimmer-7afe8d78.js → event-emit-slimmer-f7255138.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-f865d397.js → form-field-controller-slimmer-57525f26.js} +3 -3
- package/dist/cjs/{function-extension-28a4d781.js → function-extension-d4fc3b7a.js} +40 -19
- package/dist/cjs/{image-annotation-action-8843adbf.js → image-annotation-action-64414e40.js} +3 -3
- package/dist/cjs/{index-4b896e76.js → index-c7fbf32b.js} +2 -2
- package/dist/cjs/index.cjs.js +17 -19
- package/dist/cjs/{inject-keyboard-manager-13c66257.js → inject-keyboard-manager-a6101379.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-45d451de.js → internal-vega-event-manager-0e1ba774.js} +3 -2
- package/dist/cjs/{keyboard-manager-af0d08a6.js → keyboard-manager-d8adb0ed.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-62f072cd.js → keyboard-manager-slimmer-15e65357.js} +1 -1
- package/dist/cjs/{language-extension-99c6fb40.js → language-extension-d23e5369.js} +2 -2
- package/dist/cjs/loader.cjs.js +13 -13
- package/dist/cjs/month-view-generator-706c5477.js +102 -0
- package/dist/cjs/{public-rules-759c745b.js → public-rules-0847e6fa.js} +15 -15
- package/dist/cjs/{range-0b597850.js → range-14190f6b.js} +1 -1
- package/dist/cjs/{responsive-format-facade-1d9c13a9.js → responsive-format-facade-77d357fb.js} +4 -4
- package/dist/cjs/{rich-text-editor-required-rule-92d0640e.js → rich-text-editor-required-rule-65d85060.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-07a95352.js → string-format-strategy.abstract-a8264fca.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-8236b5e1.js → string-input-formatter-slimmer-4332d1c7.js} +4 -4
- package/dist/cjs/{string-mask-strategy-6bdad95e.js → string-mask-strategy-4e7d3780.js} +2 -2
- package/dist/cjs/{style-formatter-1daa8371.js → style-formatter-4fd65f6f.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-78682046.js → sub-state-notify-slimmer-9fe1ab65.js} +2 -2
- package/dist/cjs/{sub-state-observer-slimmer-73aecfff.js → sub-state-observer-slimmer-2f6f4d28.js} +2 -2
- package/dist/cjs/{time-required-rule-ccf178e7.js → time-required-rule-9d39a620.js} +3 -3
- package/dist/cjs/{type-guard-f12b5bae.js → type-guard-69d2cf01.js} +1224 -1
- package/dist/cjs/{valid-credit-card-number-rule-ce5c9147.js → valid-credit-card-number-rule-9f40d1d9.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +11 -12
- package/dist/cjs/vega-app-header-button.cjs.entry.js +16 -17
- package/dist/cjs/vega-banner.cjs.entry.js +3 -3
- package/dist/cjs/vega-box.cjs.entry.js +15 -16
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/vega-button-circle.cjs.entry.js +15 -16
- package/dist/cjs/vega-button-group_2.cjs.entry.js +60 -10
- package/dist/cjs/vega-button-link.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +15 -15
- package/dist/cjs/vega-calendar_4.cjs.entry.js +87 -909
- package/dist/cjs/vega-card.cjs.entry.js +14 -15
- package/dist/cjs/vega-carousel.cjs.entry.js +14 -14
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-chip.cjs.entry.js +16 -17
- package/dist/cjs/vega-code-block.cjs.entry.js +13 -13
- package/dist/cjs/vega-color-picker.cjs.entry.js +6 -6
- package/dist/cjs/vega-combo-box.cjs.entry.js +13 -13
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +1757 -1568
- package/dist/cjs/vega-dialog_2.cjs.entry.js +14 -15
- package/dist/cjs/vega-divider.cjs.entry.js +10 -11
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +18 -29
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
- package/dist/cjs/vega-flag-icon.cjs.entry.js +10 -11
- package/dist/cjs/vega-flex.cjs.entry.js +15 -16
- package/dist/cjs/vega-font.cjs.entry.js +14 -15
- package/dist/cjs/vega-form.cjs.entry.js +9 -9
- package/dist/cjs/vega-grid.cjs.entry.js +14 -15
- package/dist/cjs/vega-icon.cjs.entry.js +14 -15
- package/dist/cjs/vega-image-uploader.cjs.entry.js +15 -15
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +14 -14
- package/dist/cjs/vega-input-numeric.cjs.entry.js +13 -13
- package/dist/cjs/vega-input-passcode.cjs.entry.js +12 -12
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +13 -13
- package/dist/cjs/vega-input-range.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-select.cjs.entry.js +13 -13
- package/dist/cjs/vega-input.cjs.entry.js +11 -11
- package/dist/cjs/{vega-internal-event-id-6d4a2c53.js → vega-internal-event-id-a5ef414b.js} +6 -4
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +14 -15
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +13 -13
- package/dist/cjs/vega-popover_2.cjs.entry.js +17 -18
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +313 -73
- package/dist/cjs/vega-radio_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +9 -8
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +19 -19
- package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +16 -16
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +12 -12
- package/dist/cjs/vega-signature-capture.cjs.entry.js +13 -14
- package/dist/cjs/vega-stepper.cjs.entry.js +7 -7
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-table_11.cjs.entry.js +12 -12
- package/dist/cjs/vega-textarea.cjs.entry.js +7 -7
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +38 -39
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +6 -6
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +14 -14
- package/dist/cjs/vega.cjs.js +13 -13
- package/dist/collection/components/vega-button/vega-button.css +4 -0
- package/dist/collection/components/vega-button-group/vega-button-group-item/slimmers/controllers/vega-button-group-item-sub-state-controller.js +7 -0
- package/dist/collection/components/vega-button-group/vega-button-group-item/slimmers/renderers/vega-button-group-item-renderer.js +25 -2
- package/dist/collection/components/vega-button-group/vega-button-group-item/vega-button-group-item.js +31 -2
- package/dist/collection/components/vega-button-group/vega-button-group.js +37 -0
- package/dist/collection/components/vega-button-link/vega-button-link.css +4 -0
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-calendar-open-state-controller.js +149 -0
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-format-controller.js +3 -1
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-keyboard-controller.js +1 -1
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-value-controller.js +10 -26
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +107 -445
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-input-renderer-base.abstract.js +5 -1
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-range-input-renderer.js +24 -17
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-renderer.js +15 -20
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-single-input-renderer.js +6 -17
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/constants.js +14 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/dto/calendar-selection.js +126 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-allow-repick-controller.js +70 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-current-period-controller.js +204 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-min-max-date-controller.js +56 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-selection-controller.js +191 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-state-base.abstract.js +54 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-today-controller.js +37 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.js +76 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.js +192 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.js +168 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +669 -278
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.js +667 -3
- package/dist/collection/components/vega-date-picker/vega-date-picker.css +0 -11
- package/dist/collection/components/vega-date-picker/vega-date-picker.js +23 -40
- package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.js +3 -15
- package/dist/collection/components/vega-input-select/vega-input-select.js +1 -1
- package/dist/collection/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-step-controller.js +154 -0
- package/dist/collection/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.js +101 -0
- package/dist/collection/components/vega-progress-tracker/vega-progress-tracker.css +68 -77
- package/dist/collection/components/vega-progress-tracker/vega-progress-tracker.js +71 -86
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +11 -63
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/insert-token-node-strategy.js +5 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.js +12 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.js +16 -10
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-style.test.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +9 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +15 -15
- package/dist/collection/constants/regex.js +1 -0
- package/dist/collection/constants/ui.js +3 -0
- package/dist/collection/helpers/calendar/calendar-date.js +273 -1
- package/dist/collection/helpers/calendar/calendar-period/calendar-period.abstract.js +9 -0
- package/dist/collection/helpers/calendar/calendar-period/month-period.js +16 -4
- package/dist/collection/helpers/calendar/test/calendar-date.test.js +73 -0
- package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +9 -0
- package/dist/collection/helpers/calendar/test/calendar-period/month-period.test.js +41 -0
- package/dist/collection/helpers/calendar/test/calendar-period/week-period.test.js +11 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +3 -2
- package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +3 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +5 -2
- package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +2 -1
- package/dist/collection/helpers/slimmers/position-calculation/position-calculation-controller.js +7 -0
- package/dist/collection/helpers/ui/element-appender.js +35 -5
- package/dist/collection/types/type-guard.js +10 -0
- package/dist/collection/utils/date.js +14 -3
- package/dist/collection/utils/e2e-utils.js +8 -2
- package/dist/collection/utils/test/date.test.js +2 -0
- package/dist/esm/{app-globals-fd4b7d97.js → app-globals-3d7e8bad.js} +8 -7
- package/dist/esm/{child-nodes-event-prevent-slimmer-76331524.js → child-nodes-event-prevent-slimmer-6f7ae2c7.js} +1 -1
- package/dist/esm/{code-block-ecb4491b.js → code-block-8fb548ff.js} +15 -67
- package/dist/esm/{component-value-history-controller-slimmer.abstract-5d618b88.js → component-value-history-controller-slimmer.abstract-05f3ff05.js} +5 -5
- package/dist/esm/{date-required-rule-8944f3bf.js → date-required-rule-a9980386.js} +1 -1
- package/dist/esm/{design-token-2d77e8f5.js → design-token-ee017ea0.js} +4 -5
- package/dist/esm/{dom-node-subject-observer-factory-dca87b70.js → dom-node-subject-observer-factory-479cc5ef.js} +4 -2
- package/dist/esm/{dto-renderer-manager-d862ae78.js → dto-renderer-manager-d185c7ba.js} +4 -4
- package/dist/esm/{element-appender-slimmer-6791c332.js → element-appender-slimmer-00bc1a3c.js} +51 -13
- package/dist/esm/{event-emit-slimmer-4e28e9f8.js → event-emit-slimmer-76fbfe1f.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-bf071b75.js → form-field-controller-slimmer-14379261.js} +4 -4
- package/dist/esm/{function-extension-8d39db56.js → function-extension-3f886d01.js} +41 -20
- package/dist/esm/{image-annotation-action-d0af138c.js → image-annotation-action-3ce95526.js} +3 -3
- package/dist/esm/{index-c943d263.js → index-03a016ed.js} +2 -2
- package/dist/esm/index.js +19 -21
- package/dist/esm/{inject-keyboard-manager-ffd351b9.js → inject-keyboard-manager-9241968c.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-516aa721.js → internal-vega-event-manager-e44672ed.js} +3 -2
- package/dist/esm/{keyboard-manager-5d8f3582.js → keyboard-manager-89acac79.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-f39214e4.js → keyboard-manager-slimmer-e303cb7d.js} +1 -1
- package/dist/esm/{language-extension-8f51f5ff.js → language-extension-36c79ea1.js} +2 -2
- package/dist/esm/loader.js +15 -15
- package/dist/esm/month-view-generator-4bec99fd.js +98 -0
- package/dist/esm/{page-resize-observer-slimmer-0bf7fbf3.js → page-resize-observer-slimmer-8744cb44.js} +1 -1
- package/dist/esm/{public-rules-d10e76f4.js → public-rules-0f5a36c2.js} +15 -15
- package/dist/esm/{range-f7b9e2fb.js → range-f10f4c85.js} +1 -1
- package/dist/esm/{responsive-format-facade-267935ae.js → responsive-format-facade-6df7d17a.js} +6 -6
- package/dist/esm/{rich-text-editor-required-rule-774b822b.js → rich-text-editor-required-rule-d0cde24f.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-452f4398.js → string-format-strategy.abstract-75540c16.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-3acd240c.js → string-input-formatter-slimmer-af085f0a.js} +4 -4
- package/dist/esm/{string-mask-strategy-6232a1c1.js → string-mask-strategy-4a18ed1a.js} +2 -2
- package/dist/esm/{style-formatter-3f88c491.js → style-formatter-e6879600.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-56380f02.js → sub-state-notify-slimmer-430e150c.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-3504e2f2.js → sub-state-observer-slimmer-17bb0328.js} +2 -2
- package/dist/esm/{time-required-rule-a01163b5.js → time-required-rule-8ec1faf5.js} +1 -1
- package/dist/esm/{type-guard-12f7654b.js → type-guard-b48aec98.js} +1204 -2
- package/dist/esm/{ui-8424715a.js → ui-28fd4193.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-81443274.js → valid-credit-card-number-rule-96eaf9b1.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +13 -14
- package/dist/esm/vega-app-header-button.entry.js +18 -19
- package/dist/esm/vega-banner.entry.js +3 -3
- package/dist/esm/vega-box.entry.js +17 -18
- package/dist/esm/vega-breadcrumb.entry.js +4 -4
- package/dist/esm/vega-button-circle.entry.js +17 -18
- package/dist/esm/vega-button-group_2.entry.js +60 -10
- package/dist/esm/vega-button-link.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +17 -17
- package/dist/esm/vega-calendar_4.entry.js +46 -868
- package/dist/esm/vega-card.entry.js +16 -17
- package/dist/esm/vega-carousel.entry.js +16 -16
- package/dist/esm/vega-checkbox_2.entry.js +9 -9
- package/dist/esm/vega-chip.entry.js +18 -19
- package/dist/esm/vega-code-block.entry.js +14 -14
- package/dist/esm/vega-color-picker.entry.js +8 -8
- package/dist/esm/vega-combo-box.entry.js +15 -15
- package/dist/esm/vega-date-picker_2.entry.js +1744 -1555
- package/dist/esm/vega-dialog_2.entry.js +16 -17
- package/dist/esm/vega-divider.entry.js +12 -13
- package/dist/esm/vega-dropdown_5.entry.js +20 -31
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +8 -8
- package/dist/esm/vega-flag-icon.entry.js +12 -13
- package/dist/esm/vega-flex.entry.js +17 -18
- package/dist/esm/vega-font.entry.js +16 -17
- package/dist/esm/vega-form.entry.js +11 -11
- package/dist/esm/vega-grid.entry.js +16 -17
- package/dist/esm/vega-icon.entry.js +16 -17
- package/dist/esm/vega-image-uploader.entry.js +17 -17
- package/dist/esm/vega-input-credit-card.entry.js +16 -16
- package/dist/esm/vega-input-numeric.entry.js +15 -15
- package/dist/esm/vega-input-passcode.entry.js +14 -14
- package/dist/esm/vega-input-phone-number.entry.js +15 -15
- package/dist/esm/vega-input-range.entry.js +9 -9
- package/dist/esm/vega-input-select.entry.js +15 -15
- package/dist/esm/vega-input.entry.js +13 -13
- package/dist/esm/{vega-internal-event-id-5c3e5f7f.js → vega-internal-event-id-71c67c39.js} +4 -3
- package/dist/esm/vega-item-toggle.entry.js +4 -4
- package/dist/esm/vega-left-nav_5.entry.js +16 -17
- package/dist/esm/vega-loader-wrapper_2.entry.js +11 -11
- package/dist/esm/vega-page-notification_2.entry.js +1 -1
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +15 -15
- package/dist/esm/vega-popover_2.entry.js +19 -20
- package/dist/esm/vega-progress-tracker.entry.js +315 -75
- package/dist/esm/vega-radio_2.entry.js +12 -12
- package/dist/esm/vega-rich-text-content.entry.js +10 -9
- package/dist/esm/vega-rich-text-editor_4.entry.js +21 -21
- package/dist/esm/vega-segment-control.entry.js +5 -5
- package/dist/esm/vega-selection-chip_2.entry.js +18 -18
- package/dist/esm/vega-selection-tile_2.entry.js +10 -10
- package/dist/esm/vega-sidenav_3.entry.js +14 -14
- package/dist/esm/vega-signature-capture.entry.js +15 -16
- package/dist/esm/vega-stepper.entry.js +9 -9
- package/dist/esm/vega-tab-group_2.entry.js +6 -6
- package/dist/esm/vega-table_11.entry.js +14 -14
- package/dist/esm/vega-text.entry.js +2 -2
- package/dist/esm/vega-textarea.entry.js +9 -9
- package/dist/esm/vega-time-picker_2.entry.js +19 -20
- package/dist/esm/vega-toggle-switch.entry.js +8 -8
- package/dist/esm/vega-tooltip_2.entry.js +16 -16
- package/dist/esm/vega.js +15 -15
- package/dist/sri/vega-sri-manifest.json +330 -338
- package/dist/types/components/vega-button-group/types.d.ts +2 -1
- package/dist/types/components/vega-button-group/vega-button-group-item/slimmers/controllers/vega-button-group-item-sub-state-controller.d.ts +1 -0
- package/dist/types/components/vega-button-group/vega-button-group-item/slimmers/renderers/vega-button-group-item-renderer.d.ts +11 -0
- package/dist/types/components/vega-button-group/vega-button-group-item/vega-button-group-item.d.ts +7 -0
- package/dist/types/components/vega-button-group/vega-button-group.d.ts +8 -0
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-calendar-open-state-controller.d.ts +60 -0
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-value-controller.d.ts +3 -4
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +29 -124
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-input-renderer-base.abstract.d.ts +1 -0
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-range-input-renderer.d.ts +5 -5
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-renderer.d.ts +2 -3
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-single-input-renderer.d.ts +1 -4
- package/dist/types/components/vega-date-picker/types.d.ts +9 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/constants.d.ts +1 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/dto/calendar-selection.d.ts +62 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-allow-repick-controller.d.ts +31 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-current-period-controller.d.ts +78 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-min-max-date-controller.d.ts +20 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-selection-controller.d.ts +75 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-state-base.abstract.d.ts +29 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-today-controller.d.ts +15 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +18 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.d.ts +40 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.d.ts +32 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.d.ts +182 -0
- package/dist/types/components/vega-date-picker/vega-date-picker.d.ts +6 -14
- package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.d.ts +0 -4
- package/dist/types/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-step-controller.d.ts +65 -0
- package/dist/types/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.d.ts +19 -0
- package/dist/types/components/vega-progress-tracker/type.d.ts +1 -0
- package/dist/types/components/vega-progress-tracker/vega-progress-tracker.d.ts +14 -10
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +6 -1
- package/dist/types/components.d.ts +197 -5
- package/dist/types/constants/regex.d.ts +1 -0
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/helpers/calendar/calendar-date.d.ts +86 -2
- package/dist/types/helpers/calendar/calendar-period/calendar-period.abstract.d.ts +7 -0
- package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +3 -1
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +5 -2
- package/dist/types/helpers/ui/element-appender.d.ts +14 -0
- package/dist/types/types/components.type.d.ts +4 -0
- package/dist/types/types/type-guard.d.ts +8 -0
- package/dist/types/utils/date.d.ts +11 -2
- package/dist/types/utils/e2e-utils.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-7c1d08db.entry.js → p-06ab90c4.entry.js} +1 -1
- package/dist/vega/{p-58769a72.entry.js → p-09cd025a.entry.js} +1 -1
- package/dist/vega/p-0b696b0e.entry.js +1 -0
- package/dist/vega/{p-9e59345f.entry.js → p-0f5453a7.entry.js} +1 -1
- package/dist/vega/{p-7d9cd9c8.js → p-10ac8b57.js} +1 -1
- package/dist/vega/p-154f39e4.entry.js +1 -0
- package/dist/vega/p-161b9c5b.js +1 -0
- package/dist/vega/p-169b7252.entry.js +1 -0
- package/dist/vega/{p-1f26de89.js → p-17f3897a.js} +1 -1
- package/dist/vega/p-1832e051.js +1 -0
- package/dist/vega/p-19728819.js +1 -0
- package/dist/vega/{p-a6010b93.entry.js → p-1e0d8228.entry.js} +1 -1
- package/dist/vega/p-207cfa6a.js +1 -0
- package/dist/vega/{p-61d9cdf9.entry.js → p-213310e1.entry.js} +1 -1
- package/dist/vega/p-27e641a0.entry.js +1 -0
- package/dist/vega/p-2872565e.js +1 -0
- package/dist/vega/{p-b5ba0c11.js → p-294b0b76.js} +1 -1
- package/dist/vega/p-2c744c20.js +1 -0
- package/dist/vega/{p-ea96635b.entry.js → p-314bf1d5.entry.js} +1 -1
- package/dist/vega/{p-cac6239b.entry.js → p-34f624d6.entry.js} +1 -1
- package/dist/vega/p-39b8dda9.entry.js +1 -0
- package/dist/vega/p-3af9421b.entry.js +1 -0
- package/dist/vega/{p-1bb0c934.js → p-3d128c07.js} +1 -1
- package/dist/vega/{p-19522949.js → p-3d85411d.js} +1 -1
- package/dist/vega/{p-69aec6af.entry.js → p-3eb0d55c.entry.js} +1 -1
- package/dist/vega/{p-8c6b6ad7.entry.js → p-3fbfffa1.entry.js} +1 -1
- package/dist/vega/{p-74168615.js → p-40f39194.js} +1 -1
- package/dist/vega/{p-db57dddc.js → p-41026b90.js} +1 -1
- package/dist/vega/{p-0f7dec29.entry.js → p-4cc49d2b.entry.js} +1 -1
- package/dist/vega/{p-54e56f0d.entry.js → p-4ea28b2b.entry.js} +1 -1
- package/dist/vega/{p-c6ae78f2.entry.js → p-4f56da1d.entry.js} +1 -1
- package/dist/vega/{p-91d71ae9.entry.js → p-563b67a0.entry.js} +1 -1
- package/dist/vega/p-59e02528.js +1 -0
- package/dist/vega/p-5ac6bf4e.entry.js +1 -0
- package/dist/vega/p-5c379abd.entry.js +1 -0
- package/dist/vega/{p-b9798158.js → p-5c71a548.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-5fdbff48.js +1 -0
- package/dist/vega/{p-35cd469a.entry.js → p-62e45daf.entry.js} +1 -1
- package/dist/vega/{p-bfb86c3e.entry.js → p-65749591.entry.js} +1 -1
- package/dist/vega/{p-71f9c4d4.js → p-6c1ef2ed.js} +1 -1
- package/dist/vega/p-6ee95368.entry.js +1 -0
- package/dist/vega/{p-fde50319.js → p-707d542e.js} +1 -1
- package/dist/vega/{p-75b5894f.entry.js → p-7089cafe.entry.js} +1 -1
- package/dist/vega/{p-b27fcac4.entry.js → p-74f3516e.entry.js} +1 -1
- package/dist/vega/p-7a5b3ad3.entry.js +1 -0
- package/dist/vega/{p-652626b6.entry.js → p-7c22e766.entry.js} +1 -1
- package/dist/vega/{p-5e708ad5.entry.js → p-8233c5b6.entry.js} +1 -1
- package/dist/vega/p-82bd84f9.js +1 -0
- package/dist/vega/{p-235bf01b.entry.js → p-86b1e8dd.entry.js} +1 -1
- package/dist/vega/p-87960572.entry.js +1 -0
- package/dist/vega/{p-2f09c6aa.js → p-883192ed.js} +1 -1
- package/dist/vega/p-8c5acc0b.entry.js +1 -0
- package/dist/vega/{p-cbabb07a.entry.js → p-94a58223.entry.js} +1 -1
- package/dist/vega/p-95059e57.entry.js +1 -0
- package/dist/vega/p-990b11a7.entry.js +1 -0
- package/dist/vega/p-9a83a6b0.js +1 -0
- package/dist/vega/p-a23f6ed1.entry.js +1 -0
- package/dist/vega/{p-924b4e24.js → p-a4ec6575.js} +1 -1
- package/dist/vega/{p-379f1b40.entry.js → p-a7633138.entry.js} +1 -1
- package/dist/vega/{p-3925c16b.js → p-a8dad05d.js} +1 -1
- package/dist/vega/p-a9268981.entry.js +1 -0
- package/dist/vega/p-afb834d8.js +1 -0
- package/dist/vega/p-b05ec86a.entry.js +1 -0
- package/dist/vega/{p-98fb9eaa.entry.js → p-b1ad3107.entry.js} +1 -1
- package/dist/vega/{p-4a467973.js → p-b2eea369.js} +1 -1
- package/dist/vega/{p-796d840c.entry.js → p-b3d29c1e.entry.js} +1 -1
- package/dist/vega/{p-c2f21426.entry.js → p-b6c92e7a.entry.js} +1 -1
- package/dist/vega/{p-447c7590.js → p-b842f649.js} +1 -1
- package/dist/vega/{p-35252108.js → p-b8a7a54b.js} +1 -1
- package/dist/vega/{p-330c224f.entry.js → p-b96b7f33.entry.js} +1 -1
- package/dist/vega/p-bc1cbd6c.js +1 -0
- package/dist/vega/p-bc7df5e7.entry.js +1 -0
- package/dist/vega/p-bca97027.entry.js +1 -0
- package/dist/vega/p-beed225e.entry.js +1 -0
- package/dist/vega/p-c1db0a81.entry.js +1 -0
- package/dist/vega/{p-c0223a17.entry.js → p-c4b010be.entry.js} +1 -1
- package/dist/vega/{p-18e8c54a.entry.js → p-c4b30117.entry.js} +1 -1
- package/dist/vega/{p-ad65f65f.entry.js → p-c5cf9a89.entry.js} +1 -1
- package/dist/vega/{p-a0467b83.js → p-cb7211c3.js} +1 -1
- package/dist/vega/p-cb72ebb5.js +1 -0
- package/dist/vega/{p-3c865f86.entry.js → p-cbefc113.entry.js} +1 -1
- package/dist/vega/{p-8fae8f9e.js → p-d1d0f08a.js} +1 -1
- package/dist/vega/{p-52efaadb.entry.js → p-d4413277.entry.js} +1 -1
- package/dist/vega/p-d991fb11.js +1 -0
- package/dist/vega/{p-9ce249a9.js → p-de70aac1.js} +1 -1
- package/dist/vega/{p-e6351dab.entry.js → p-e1e306c3.entry.js} +1 -1
- package/dist/vega/p-e49c6368.js +1 -0
- package/dist/vega/{p-de97c6d9.js → p-e8d0e71c.js} +1 -1
- package/dist/vega/p-e9838fb4.entry.js +1 -0
- package/dist/vega/p-ea0b6e85.entry.js +1 -0
- package/dist/vega/p-ec412511.entry.js +1 -0
- package/dist/vega/{p-3e040167.entry.js → p-ec4c21d1.entry.js} +1 -1
- package/dist/vega/{p-85f9a980.js → p-eebe9176.js} +1 -1
- package/dist/vega/{p-7b42da4f.entry.js → p-efa4ee14.entry.js} +1 -1
- package/dist/vega/p-f9facf79.entry.js +1 -0
- package/dist/vega/{p-dde03224.entry.js → p-fa63b926.entry.js} +1 -1
- package/dist/vega/p-fc6fca08.entry.js +1 -0
- package/dist/vega/p-fcb3ff5b.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -2
- package/dist/cjs/date-0a6bb035.js +0 -95
- package/dist/cjs/mobilefriendly-aa2e50e9.js +0 -13
- package/dist/cjs/state-background-color-formatter-aa5570f6.js +0 -85
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-calendar-controller.js +0 -282
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-element-appender-controller.js +0 -35
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-mobile-controller.js +0 -53
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-month-year-change-event-controller.js +0 -139
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-zindex-controller.js +0 -49
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-month-year-dropdown-renderer.js +0 -341
- package/dist/esm/date-c55b97f0.js +0 -87
- package/dist/esm/mobilefriendly-c5d0573d.js +0 -11
- package/dist/esm/state-background-color-formatter-0f01d27a.js +0 -82
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-calendar-controller.d.ts +0 -96
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-element-appender-controller.d.ts +0 -12
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-mobile-controller.d.ts +0 -18
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-month-year-change-event-controller.d.ts +0 -46
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-zindex-controller.d.ts +0 -15
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-month-year-dropdown-renderer.d.ts +0 -97
- package/dist/vega/p-08835909.js +0 -1
- package/dist/vega/p-0cdb38d3.js +0 -1
- package/dist/vega/p-0e5297b9.entry.js +0 -1
- package/dist/vega/p-0feceaac.entry.js +0 -1
- package/dist/vega/p-115b42e6.entry.js +0 -1
- package/dist/vega/p-1372b984.js +0 -1
- package/dist/vega/p-1739a877.entry.js +0 -1
- package/dist/vega/p-1a59703b.entry.js +0 -1
- package/dist/vega/p-1e92737c.entry.js +0 -1
- package/dist/vega/p-257ff60b.entry.js +0 -1
- package/dist/vega/p-25a3fad7.entry.js +0 -1
- package/dist/vega/p-2622f0a8.entry.js +0 -1
- package/dist/vega/p-26c4f07c.entry.js +0 -1
- package/dist/vega/p-2ec7e020.entry.js +0 -1
- package/dist/vega/p-308aa2e3.js +0 -1
- package/dist/vega/p-33f3f306.js +0 -1
- package/dist/vega/p-37020002.entry.js +0 -1
- package/dist/vega/p-38cb2b40.js +0 -1
- package/dist/vega/p-4e13a26f.js +0 -1
- package/dist/vega/p-5972c101.entry.js +0 -1
- package/dist/vega/p-5d827fe5.js +0 -1
- package/dist/vega/p-65a9af84.entry.js +0 -1
- package/dist/vega/p-67eb405d.entry.js +0 -1
- package/dist/vega/p-67f159c3.js +0 -1
- package/dist/vega/p-71ddccf2.entry.js +0 -1
- package/dist/vega/p-785d9ac3.entry.js +0 -1
- package/dist/vega/p-7a590741.entry.js +0 -1
- package/dist/vega/p-824a06ba.js +0 -1
- package/dist/vega/p-8350506e.js +0 -1
- package/dist/vega/p-867a4970.js +0 -1
- package/dist/vega/p-880569ec.entry.js +0 -1
- package/dist/vega/p-8ac2f43f.entry.js +0 -1
- package/dist/vega/p-8ff96b8c.entry.js +0 -13
- package/dist/vega/p-9794fd88.entry.js +0 -1
- package/dist/vega/p-a10b9f2e.js +0 -12
- package/dist/vega/p-a630ce73.entry.js +0 -1
- package/dist/vega/p-b1faebe0.js +0 -1
- package/dist/vega/p-b8b9ed2c.js +0 -1
- package/dist/vega/p-b9b81702.entry.js +0 -1
- package/dist/vega/p-bcc396c2.entry.js +0 -1
- package/dist/vega/p-bccee21e.js +0 -1
- package/dist/vega/p-c224b44c.js +0 -1
- package/dist/vega/p-fb320b50.entry.js +0 -1
- package/dist/vega/p-ff470366.entry.js +0 -1
|
@@ -316,7 +316,7 @@ describe('content state', () => {
|
|
|
316
316
|
nodes: [{ id: '1-1', type: 'text', text: 'This is a paragraph' }],
|
|
317
317
|
},
|
|
318
318
|
]);
|
|
319
|
-
expect(contentState.toHtml()).toEqualHtml(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;margin-top: 0px; margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
319
|
+
expect(contentState.toHtml()).toEqualHtml(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;margin-top: 0px; margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
320
320
|
});
|
|
321
321
|
it('should convert text node with annotations to HTML correctly', () => {
|
|
322
322
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -336,7 +336,7 @@ describe('content state', () => {
|
|
|
336
336
|
],
|
|
337
337
|
},
|
|
338
338
|
]);
|
|
339
|
-
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">This is a paragraph.</span><code style="font-family: Roboto Mono;white-space: pre-wrap;"> code</code><span> text</span></p>`);
|
|
339
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">This is a paragraph.</span><code style="font-family: Roboto Mono;white-space: pre-wrap;"> code</code><span> text</span></p>`);
|
|
340
340
|
});
|
|
341
341
|
it('should convert text block with annotations to HTML with inline styles correctly', () => {
|
|
342
342
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -354,7 +354,7 @@ describe('content state', () => {
|
|
|
354
354
|
],
|
|
355
355
|
},
|
|
356
356
|
]);
|
|
357
|
-
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span style="font-weight: 700;text-decoration: underline;">This is a paragraph</span></p>`);
|
|
357
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span style="font-weight: 700;text-decoration: underline;">This is a paragraph</span></p>`);
|
|
358
358
|
});
|
|
359
359
|
it('should convert image block to HTML correctly', () => {
|
|
360
360
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -399,7 +399,7 @@ describe('content state', () => {
|
|
|
399
399
|
],
|
|
400
400
|
},
|
|
401
401
|
]);
|
|
402
|
-
expect(contentState.toHtml()).toEqual(`<ul style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ul>`);
|
|
402
|
+
expect(contentState.toHtml()).toEqual(`<ul style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ul>`);
|
|
403
403
|
});
|
|
404
404
|
it('should convert number list block to HTML correctly', () => {
|
|
405
405
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -420,7 +420,7 @@ describe('content state', () => {
|
|
|
420
420
|
],
|
|
421
421
|
},
|
|
422
422
|
]);
|
|
423
|
-
expect(contentState.toHtml()).toEqual(`<ol style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ol>`);
|
|
423
|
+
expect(contentState.toHtml()).toEqual(`<ol style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ol>`);
|
|
424
424
|
});
|
|
425
425
|
it('should convert code block to HTML correctly', () => {
|
|
426
426
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -456,7 +456,7 @@ describe('content state', () => {
|
|
|
456
456
|
],
|
|
457
457
|
},
|
|
458
458
|
]);
|
|
459
|
-
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><a href="https://example.com" target="_blank" style="color: rgba(var(--v-text-link, 19, 98, 226, 1));"><span>This is a link</span></a></p>`);
|
|
459
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><a href="https://example.com" target="_blank" style="color: rgba(var(--v-text-link, 19, 98, 226, 1));"><span>This is a link</span></a></p>`);
|
|
460
460
|
});
|
|
461
461
|
it('should convert a complex value to HTML correctly', () => {
|
|
462
462
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -789,7 +789,7 @@ describe('content state', () => {
|
|
|
789
789
|
],
|
|
790
790
|
},
|
|
791
791
|
]);
|
|
792
|
-
expect(contentState.toHtml()).toEqual(`<div style="font-family: Inter;font-size: 36px;line-height: 40px;font-weight: 500;"><span style="font-weight: 700;">Title</span></div><div style="font-family: Inter;font-size: 28px;line-height: 32px;font-weight: 500;"><span>Subtitle</span></div><h1 style="font-family: Inter;font-size: 22px;line-height: 24px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 1</span></h1><h2 style="font-family: Inter;font-size: 20px;line-height: 24px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 2</span></h2><h3 style="font-family: Inter;font-size: 18px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 3</span></h3><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Paragraph</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Bold text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-style: italic;">Italic text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="text-decoration: underline;">Underline text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="text-decoration: underline;">Strikethrough text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><code style="font-family: Roboto Mono;white-space: pre-wrap;">Code text</code></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="color: #BD2947;">Color text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: left;"><span>Left align</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span>Right align</span></p><ul style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>list item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>list item 2</span></li></ul><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;margin-left: 32px;"><span>More indent</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><a href="https://www.google.com" target="_blank" style="color: rgba(var(--v-text-link, 19, 98, 226, 1));"><span>Link text</span></a></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span></span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span></span></p>`);
|
|
792
|
+
expect(contentState.toHtml()).toEqual(`<div style="font-family: Inter;font-size: 36px;line-height: 40px;min-height: 40px;font-weight: 500;"><span style="font-weight: 700;">Title</span></div><div style="font-family: Inter;font-size: 28px;line-height: 32px;min-height: 32px;font-weight: 500;"><span>Subtitle</span></div><h1 style="font-family: Inter;font-size: 22px;line-height: 24px;min-height: 24px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 1</span></h1><h2 style="font-family: Inter;font-size: 20px;line-height: 24px;min-height: 24px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 2</span></h2><h3 style="font-family: Inter;font-size: 18px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 3</span></h3><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Paragraph</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Bold text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-style: italic;">Italic text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="text-decoration: underline;">Underline text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="text-decoration: underline;">Strikethrough text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><code style="font-family: Roboto Mono;white-space: pre-wrap;">Code text</code></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="color: #BD2947;">Color text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: left;"><span>Left align</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span>Right align</span></p><ul style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>list item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>list item 2</span></li></ul><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;margin-left: 32px;"><span>More indent</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><a href="https://www.google.com" target="_blank" style="color: rgba(var(--v-text-link, 19, 98, 226, 1));"><span>Link text</span></a></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span></span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span></span></p>`);
|
|
793
793
|
});
|
|
794
794
|
it('should convert paragraph with custom attributes to HTML correctly', () => {
|
|
795
795
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -818,7 +818,7 @@ describe('content state', () => {
|
|
|
818
818
|
],
|
|
819
819
|
},
|
|
820
820
|
]);
|
|
821
|
-
expect(contentState.toHtml()).toEqualHtml(`<p id="p-element" dir="dir-p" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500; margin-top: 0px; margin-bottom: 0px;"><span id="span-element" dir="dir-span">This is a paragraph</span></p>`);
|
|
821
|
+
expect(contentState.toHtml()).toEqualHtml(`<p id="p-element" dir="dir-p" style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500; margin-top: 0px; margin-bottom: 0px;"><span id="span-element" dir="dir-span">This is a paragraph</span></p>`);
|
|
822
822
|
});
|
|
823
823
|
it('should convert text node with custom attributes to HTML correctly', () => {
|
|
824
824
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -868,7 +868,7 @@ describe('content state', () => {
|
|
|
868
868
|
],
|
|
869
869
|
},
|
|
870
870
|
]);
|
|
871
|
-
expect(contentState.toHtml()).toEqual(`<p id="p-element" dir="dir-p" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span id="text1" style="font-weight: 700;">This is a paragraph.</span><code id="text2" style="font-family: Roboto Mono;white-space: pre-wrap;"> code</code><span id="text3"> text</span></p>`);
|
|
871
|
+
expect(contentState.toHtml()).toEqual(`<p id="p-element" dir="dir-p" style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span id="text1" style="font-weight: 700;">This is a paragraph.</span><code id="text2" style="font-family: Roboto Mono;white-space: pre-wrap;"> code</code><span id="text3"> text</span></p>`);
|
|
872
872
|
});
|
|
873
873
|
it('should convert bullet list block with custom attributes to HTML correctly', () => {
|
|
874
874
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -904,7 +904,7 @@ describe('content state', () => {
|
|
|
904
904
|
},
|
|
905
905
|
},
|
|
906
906
|
]);
|
|
907
|
-
expect(contentState.toHtml()).toEqual(`<ul id="ul" style="padding-left: 8px;margin-left: 16px;"><li id="list1" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li id="list2" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ul>`);
|
|
907
|
+
expect(contentState.toHtml()).toEqual(`<ul id="ul" style="padding-left: 8px;margin-left: 16px;"><li id="list1" style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li id="list2" style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ul>`);
|
|
908
908
|
});
|
|
909
909
|
it('should convert paragraph with custom class to HTML correctly', () => {
|
|
910
910
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -1025,7 +1025,7 @@ describe('content state', () => {
|
|
|
1025
1025
|
],
|
|
1026
1026
|
},
|
|
1027
1027
|
]);
|
|
1028
|
-
expect(contentState.toHtml()).toEqualHtml(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 700; margin-top: 0px; margin-bottom: 0px;"><span style="font-weight: 700">This is a paragraph</span></p>`);
|
|
1028
|
+
expect(contentState.toHtml()).toEqualHtml(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 700; margin-top: 0px; margin-bottom: 0px;"><span style="font-weight: 700">This is a paragraph</span></p>`);
|
|
1029
1029
|
});
|
|
1030
1030
|
it('should convert text node with custom style to HTML correctly', () => {
|
|
1031
1031
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -1074,7 +1074,7 @@ describe('content state', () => {
|
|
|
1074
1074
|
],
|
|
1075
1075
|
},
|
|
1076
1076
|
]);
|
|
1077
|
-
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span style="font-weight: 700;padding: 20px;">This is a paragraph.</span><code style="font-family: Roboto Mono;white-space: pre-wrap;padding: 30px;"> code</code><span style="padding: 40px;"> text</span></p>`);
|
|
1077
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span style="font-weight: 700;padding: 20px;">This is a paragraph.</span><code style="font-family: Roboto Mono;white-space: pre-wrap;padding: 30px;"> code</code><span style="padding: 40px;"> text</span></p>`);
|
|
1078
1078
|
});
|
|
1079
1079
|
it('should convert bullet list block with custom style to HTML correctly', () => {
|
|
1080
1080
|
const contentState = VegaRTEContent.fromJSON([
|
|
@@ -1110,7 +1110,7 @@ describe('content state', () => {
|
|
|
1110
1110
|
},
|
|
1111
1111
|
},
|
|
1112
1112
|
]);
|
|
1113
|
-
expect(contentState.toHtml()).toEqual(`<ul style="padding-left: 8px;margin-left: 16px;padding: 60px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;padding: 40px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;padding: 50px;"><span>Item 2</span></li></ul>`);
|
|
1113
|
+
expect(contentState.toHtml()).toEqual(`<ul style="padding-left: 8px;margin-left: 16px;padding: 60px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;padding: 40px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;padding: 50px;"><span>Item 2</span></li></ul>`);
|
|
1114
1114
|
});
|
|
1115
1115
|
it('should log warning when call toHtml with deprecated parameter', () => {
|
|
1116
1116
|
setVegaLogLevel('warn');
|
|
@@ -2839,8 +2839,8 @@ Line 1
|
|
|
2839
2839
|
nodes: [{ id: '1-1', type: 'text', text: 'This is a paragraph' }],
|
|
2840
2840
|
},
|
|
2841
2841
|
];
|
|
2842
|
-
expect(VegaRTEContent.fromJSON(content).toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
2843
|
-
expect(VegaRTEContent.fromJSON(content).toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
2842
|
+
expect(VegaRTEContent.fromJSON(content).toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
2843
|
+
expect(VegaRTEContent.fromJSON(content).toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;min-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
2844
2844
|
expect(VegaRTEContent.fromJSON(content, { autoMatchFormat: false }).toHtml()).toEqual(`<p><span>This is a paragraph</span></p>`);
|
|
2845
2845
|
expect(VegaRTEContent.fromJSON(content, { autoMatchFormat: false }).toHtml()).toEqual(`<p><span>This is a paragraph</span></p>`);
|
|
2846
2846
|
});
|
|
@@ -4,3 +4,4 @@ export const VisaRegex = /^4/;
|
|
|
4
4
|
export const MasterCardRegex = /^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/;
|
|
5
5
|
export const AmexRegex = /^3[47]/;
|
|
6
6
|
export const DiscoverRegex = /^(6011|65|64[4-9]|622)/;
|
|
7
|
+
export const DateFormatParserRegex = /(\\)?(Y{2,4}|M{1,4}|D{1,2}|d{1,4})/g;
|
|
@@ -88,6 +88,9 @@ export const VegaNativeEventName = [
|
|
|
88
88
|
'monthYearChange',
|
|
89
89
|
'complete',
|
|
90
90
|
'paste',
|
|
91
|
+
'clear',
|
|
92
|
+
'periodChange',
|
|
93
|
+
'selectionChange',
|
|
91
94
|
];
|
|
92
95
|
// eslint-disable-next-line @typescript-eslint/typedef
|
|
93
96
|
export const CssStates = ['default', 'hover', 'active', 'focus-visible'];
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { VegaInternalTranslation } from '../translation';
|
|
2
2
|
import { CalendarDateTime } from './calendar-date-time';
|
|
3
3
|
import { getSystemTimezone } from './utils';
|
|
4
|
+
import { DateFormatParserRegex } from '../../constants/regex';
|
|
5
|
+
import { compareIsAfter, compareIsBefore, pad } from '../../utils/date';
|
|
6
|
+
// TODO: Need rename calendar-date as vega-date to manage all date operation in vega project
|
|
7
|
+
// https://gethired.atlassian.net/browse/VD-5918
|
|
4
8
|
/**
|
|
5
9
|
* Calendar date class
|
|
6
10
|
*/
|
|
@@ -20,6 +24,153 @@ export class CalendarDate {
|
|
|
20
24
|
static from(currentDate, timezone = getSystemTimezone()) {
|
|
21
25
|
return CalendarDateTime.fromDate(currentDate, timezone).calendarDate;
|
|
22
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Converts a date string to CalendarDate with optional format and timezone parameters.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} dateString - The string date.
|
|
31
|
+
* @param {string} [format] - The format of string date
|
|
32
|
+
* @param {string} [lang] - lang
|
|
33
|
+
* @returns {Nullable<CalendarDate>} - CalendarDate.
|
|
34
|
+
*/
|
|
35
|
+
static fromString(dateString, format = 'MM/DD/YYYY', lang = 'en-us') {
|
|
36
|
+
if (!dateString)
|
|
37
|
+
return null;
|
|
38
|
+
const formatMatchers = [];
|
|
39
|
+
let formatMatcher = null;
|
|
40
|
+
// Analyze the format and find the corresponding positions for year, month, and day.
|
|
41
|
+
// Data: formatMatchers = [['DD', index: 0, ...], ['MM', index: 3, ...], ['YYYY', index: 7, ...]]
|
|
42
|
+
while ((formatMatcher = DateFormatParserRegex.exec(format)) != null) {
|
|
43
|
+
if (formatMatcher[1] === '\\')
|
|
44
|
+
continue;
|
|
45
|
+
formatMatchers.push(formatMatcher);
|
|
46
|
+
}
|
|
47
|
+
if (formatMatchers.length) {
|
|
48
|
+
const datePattern = {
|
|
49
|
+
year: undefined,
|
|
50
|
+
month: undefined,
|
|
51
|
+
shortMonth: undefined,
|
|
52
|
+
longMonth: undefined,
|
|
53
|
+
day: undefined,
|
|
54
|
+
value: '',
|
|
55
|
+
};
|
|
56
|
+
const firstMatcher = formatMatchers[0];
|
|
57
|
+
if (firstMatcher && firstMatcher.index > 0) {
|
|
58
|
+
datePattern.value += '.*?';
|
|
59
|
+
}
|
|
60
|
+
// According `matchers` to generate a new regex which can parse the date by corresponding year, month and day
|
|
61
|
+
// Data: dateRegex = "(\d{2}).*?(\d{2}).*?(\d{4}).*?"
|
|
62
|
+
// datePattern = {day: 1, longMonth: null, month: 2, shortMonth: null, year: 3, value: "(\d{2}).*?(\d{2}).*?(\d{4}).*?"}
|
|
63
|
+
for (const [k, match] of Object.entries(formatMatchers)) {
|
|
64
|
+
const key = Number(k);
|
|
65
|
+
if (match) {
|
|
66
|
+
const { group, pattern } = this.getPatternByFormatToken(match[0], lang);
|
|
67
|
+
datePattern[group] = key + 1;
|
|
68
|
+
datePattern.value += pattern;
|
|
69
|
+
datePattern.value += '.*?';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const dateRegex = new RegExp(`^${datePattern.value}$`);
|
|
73
|
+
if (dateRegex.test(dateString)) {
|
|
74
|
+
// Parse the date
|
|
75
|
+
// Example: parsedDate = ['08-02-2020', '08', '02', '2020']
|
|
76
|
+
const parsedDate = dateRegex.exec(dateString);
|
|
77
|
+
if (parsedDate &&
|
|
78
|
+
datePattern.year &&
|
|
79
|
+
(datePattern.month || datePattern.shortMonth || datePattern.longMonth) &&
|
|
80
|
+
datePattern.day) {
|
|
81
|
+
const year = Number(parsedDate[datePattern.year]);
|
|
82
|
+
let month = 1;
|
|
83
|
+
if (datePattern.month) {
|
|
84
|
+
month = Number(parsedDate[datePattern.month]) - 1;
|
|
85
|
+
}
|
|
86
|
+
else if (datePattern.shortMonth) {
|
|
87
|
+
month = this.shortMonths(lang).indexOf(parsedDate[datePattern.shortMonth]);
|
|
88
|
+
}
|
|
89
|
+
else if (datePattern.longMonth) {
|
|
90
|
+
month = this.longMonths(lang).indexOf(parsedDate[datePattern.longMonth]);
|
|
91
|
+
}
|
|
92
|
+
const day = Number(parsedDate[datePattern.day]);
|
|
93
|
+
const fullYear = Number(pad(year, 4, `${new Date().getFullYear()}`.slice(0, 2)));
|
|
94
|
+
if (isNaN(Date.parse(`${fullYear}-${pad(month + 1)}-${pad(day)}`)))
|
|
95
|
+
return null;
|
|
96
|
+
return this.from(new Date(fullYear, month, day, 0, 0, 0, 0));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return this.from(new Date(dateString));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get regex pattern by format token.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} token - The format token.
|
|
106
|
+
* @param {string} lang - Language.
|
|
107
|
+
* @returns {FormatPatternType} - regex pattern.
|
|
108
|
+
*/
|
|
109
|
+
static getPatternByFormatToken(token, lang) {
|
|
110
|
+
switch (token) {
|
|
111
|
+
case 'YY':
|
|
112
|
+
case 'YYYY':
|
|
113
|
+
return {
|
|
114
|
+
group: 'year',
|
|
115
|
+
pattern: `(\\d{${token.length}})`,
|
|
116
|
+
};
|
|
117
|
+
case 'M':
|
|
118
|
+
return {
|
|
119
|
+
group: 'month',
|
|
120
|
+
pattern: '(\\d{1,2})',
|
|
121
|
+
};
|
|
122
|
+
case 'MM':
|
|
123
|
+
return {
|
|
124
|
+
group: 'month',
|
|
125
|
+
pattern: '(\\d{2})',
|
|
126
|
+
};
|
|
127
|
+
case 'MMM':
|
|
128
|
+
return {
|
|
129
|
+
group: 'shortMonth',
|
|
130
|
+
pattern: `(${this.shortMonths(lang).join('|')})`,
|
|
131
|
+
};
|
|
132
|
+
case 'MMMM':
|
|
133
|
+
return {
|
|
134
|
+
group: 'longMonth',
|
|
135
|
+
pattern: `(${this.longMonths(lang).join('|')})`,
|
|
136
|
+
};
|
|
137
|
+
case 'D':
|
|
138
|
+
return {
|
|
139
|
+
group: 'day',
|
|
140
|
+
pattern: '(\\d{1,2})',
|
|
141
|
+
};
|
|
142
|
+
case 'DD':
|
|
143
|
+
return {
|
|
144
|
+
group: 'day',
|
|
145
|
+
pattern: '(\\d{2})',
|
|
146
|
+
};
|
|
147
|
+
/* istanbul ignore next */
|
|
148
|
+
default: {
|
|
149
|
+
return {
|
|
150
|
+
group: 'unknown',
|
|
151
|
+
pattern: '(.*)',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Shorts months.
|
|
158
|
+
*
|
|
159
|
+
* @param {string} lang - Language
|
|
160
|
+
* @returns {string[]} - Shorts months.
|
|
161
|
+
*/
|
|
162
|
+
static shortMonths(lang) {
|
|
163
|
+
return this.MONTHS.map((month) => new Date(2019, month).toLocaleString(lang, { month: 'short' }));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Long months.
|
|
167
|
+
*
|
|
168
|
+
* @param {string} lang - Language
|
|
169
|
+
* @returns {string[]} - Long months.
|
|
170
|
+
*/
|
|
171
|
+
static longMonths(lang) {
|
|
172
|
+
return this.MONTHS.map((month) => new Date(2019, month).toLocaleString(lang, { month: 'long' }));
|
|
173
|
+
}
|
|
23
174
|
/**
|
|
24
175
|
* The year of the calendar date
|
|
25
176
|
*
|
|
@@ -53,6 +204,44 @@ export class CalendarDate {
|
|
|
53
204
|
set date(value) {
|
|
54
205
|
this._date = value;
|
|
55
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Converts CalendarDate to a string with an optional format specifier.
|
|
209
|
+
*
|
|
210
|
+
* @param {string} [format] - The format of string date
|
|
211
|
+
* @param {string} [lang] - Language
|
|
212
|
+
* @returns {string} The string date.
|
|
213
|
+
*/
|
|
214
|
+
toString(format = 'MM/DD/YYYY', lang = 'en-us') {
|
|
215
|
+
let result = '';
|
|
216
|
+
const formatMatchers = [];
|
|
217
|
+
let formatMatcher = null;
|
|
218
|
+
while ((formatMatcher = DateFormatParserRegex.exec(format)) != null) {
|
|
219
|
+
if (formatMatcher[1] === '\\')
|
|
220
|
+
continue;
|
|
221
|
+
formatMatchers.push(formatMatcher);
|
|
222
|
+
}
|
|
223
|
+
if (formatMatchers.length) {
|
|
224
|
+
// add start line of tokens are not at the beginning
|
|
225
|
+
const firstMatcher = formatMatchers[0];
|
|
226
|
+
if (firstMatcher && firstMatcher.index > 0) {
|
|
227
|
+
result += format.substring(0, firstMatcher.index);
|
|
228
|
+
}
|
|
229
|
+
for (const [k, match] of Object.entries(formatMatchers)) {
|
|
230
|
+
const key = Number(k);
|
|
231
|
+
if (match) {
|
|
232
|
+
result += this.getDateItemByFormatToken(match[0], lang);
|
|
233
|
+
const nextMatch = formatMatchers[key + 1];
|
|
234
|
+
if (nextMatch) {
|
|
235
|
+
result += format.substring(match.index + match[0].length, nextMatch.index);
|
|
236
|
+
}
|
|
237
|
+
if (key === formatMatchers.length - 1) {
|
|
238
|
+
result += format.substring(match.index + match[0].length);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return result.replace(/\\/g, '');
|
|
244
|
+
}
|
|
56
245
|
/**
|
|
57
246
|
* Verify whether the calendar date is today
|
|
58
247
|
*
|
|
@@ -112,11 +301,13 @@ export class CalendarDate {
|
|
|
112
301
|
/**
|
|
113
302
|
* The function "equal" compares the year, month, and date of two CalendarDate objects and returns true if they are equal.
|
|
114
303
|
*
|
|
115
|
-
* @param {CalendarDate} calendarDate - The `equal` method in the code snippet is a function that compares the year, month, and date of the current `CalendarDate` object with another
|
|
304
|
+
* @param {Nullable<CalendarDate>} calendarDate - The `equal` method in the code snippet is a function that compares the year, month, and date of the current `CalendarDate` object with another
|
|
116
305
|
* `CalendarDate` object passed as a parameter. The method returns `true` if all three values (year, month, date) are equal
|
|
117
306
|
* @returns {boolean} The date is same day with current
|
|
118
307
|
*/
|
|
119
308
|
equal(calendarDate) {
|
|
309
|
+
if (!calendarDate)
|
|
310
|
+
return false;
|
|
120
311
|
const { year, month, date } = calendarDate;
|
|
121
312
|
return this._year === year && this._month === month && this._date === date;
|
|
122
313
|
}
|
|
@@ -131,4 +322,85 @@ export class CalendarDate {
|
|
|
131
322
|
month: isShortName ? 'short' : 'long',
|
|
132
323
|
}));
|
|
133
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* To determine if it is larger than a given `CalendarDate`.
|
|
327
|
+
*
|
|
328
|
+
* @param {Nullable<CalendarDate>} calendarDate - A `CalendarDate`
|
|
329
|
+
* @returns {boolean} - Compared result
|
|
330
|
+
*/
|
|
331
|
+
isAfter(calendarDate) {
|
|
332
|
+
if (!calendarDate)
|
|
333
|
+
return false;
|
|
334
|
+
return compareIsAfter(this.toDate(), calendarDate.toDate());
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* To determine if it is less than a given `CalendarDate`.
|
|
338
|
+
*
|
|
339
|
+
* @param {Nullable<CalendarDate>} calendarDate - A `CalendarDate`
|
|
340
|
+
* @returns {boolean} - Compared result
|
|
341
|
+
*/
|
|
342
|
+
isBefore(calendarDate) {
|
|
343
|
+
if (!calendarDate)
|
|
344
|
+
return false;
|
|
345
|
+
return compareIsBefore(this.toDate(), calendarDate.toDate());
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Get first day of month.
|
|
349
|
+
*
|
|
350
|
+
* @returns {CalendarDate} - First day of month.
|
|
351
|
+
*/
|
|
352
|
+
firstDateOfMonth() {
|
|
353
|
+
return CalendarDate.from(new Date(this.year, this.month - 1, 1));
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Get last day of month.
|
|
357
|
+
*
|
|
358
|
+
* @returns {CalendarDate} - Last day of month.
|
|
359
|
+
*/
|
|
360
|
+
lastDateOfMonth() {
|
|
361
|
+
return CalendarDate.from(new Date(this.year, this.month, 0));
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Adjusts the calendar date by adding the specified number of years, months, and days.
|
|
365
|
+
*
|
|
366
|
+
* @param {number} [years=0] - The number of years to add.
|
|
367
|
+
* @param {number} [months=0] - The number of months to add.
|
|
368
|
+
* @param {number} [days=0] - The number of days to add.
|
|
369
|
+
* @returns {CalendarDate} - A new CalendarDate object with the adjusted date.
|
|
370
|
+
*/
|
|
371
|
+
add(years = 0, months = 0, days = 0) {
|
|
372
|
+
const currentDate = this.toDate();
|
|
373
|
+
const adjustedDate = new Date(currentDate.getFullYear() + years, currentDate.getMonth() + months, currentDate.getDate() + days);
|
|
374
|
+
return CalendarDate.from(adjustedDate);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Get year, month and day value by format token.
|
|
378
|
+
*
|
|
379
|
+
* @param {string} token - The format token.
|
|
380
|
+
* @param {string} lang - Language.
|
|
381
|
+
* @returns {string} - year, month and day value.
|
|
382
|
+
*/
|
|
383
|
+
getDateItemByFormatToken(token, lang) {
|
|
384
|
+
switch (token) {
|
|
385
|
+
case 'YY':
|
|
386
|
+
return String(this.year).slice(-2);
|
|
387
|
+
case 'YYYY':
|
|
388
|
+
return String(this.year);
|
|
389
|
+
case 'M':
|
|
390
|
+
return String(this.month);
|
|
391
|
+
case 'MM':
|
|
392
|
+
return `0${this.month}`.slice(-2);
|
|
393
|
+
case 'MMM':
|
|
394
|
+
return CalendarDate.shortMonths(lang)[this.month - 1];
|
|
395
|
+
case 'MMMM':
|
|
396
|
+
return CalendarDate.longMonths(lang)[this.month - 1];
|
|
397
|
+
case 'D':
|
|
398
|
+
return String(this.date);
|
|
399
|
+
case 'DD':
|
|
400
|
+
return `0${this.date}`.slice(-2);
|
|
401
|
+
default:
|
|
402
|
+
return '';
|
|
403
|
+
}
|
|
404
|
+
}
|
|
134
405
|
}
|
|
406
|
+
CalendarDate.MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
@@ -83,6 +83,15 @@ export class CalendarPeriod {
|
|
|
83
83
|
now() {
|
|
84
84
|
return this.createBy(CalendarDate.from(new Date(), this._timezone));
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Check the give period is equal to current period
|
|
88
|
+
*
|
|
89
|
+
* @param {CalendarPeriod} [period] - Give period to compare
|
|
90
|
+
* @returns {boolean} compare result
|
|
91
|
+
*/
|
|
92
|
+
equal(period) {
|
|
93
|
+
return this.startDate.equal(period.startDate) && this.endDate.equal(period.endDate);
|
|
94
|
+
}
|
|
86
95
|
/**
|
|
87
96
|
* Calculate the period start date and end date.
|
|
88
97
|
*
|
|
@@ -43,16 +43,28 @@ export class MonthPeriod extends CalendarPeriod {
|
|
|
43
43
|
* @inheritDoc
|
|
44
44
|
*/
|
|
45
45
|
next() {
|
|
46
|
-
const
|
|
47
|
-
|
|
46
|
+
const current = this.current.toDate();
|
|
47
|
+
const year = current.getFullYear();
|
|
48
|
+
const month = current.getMonth() + 1;
|
|
49
|
+
const day = current.getDate();
|
|
50
|
+
// Get the last day of the next month
|
|
51
|
+
const lastDayOfNextMonth = new Date(year, month + 1, 0).getDate();
|
|
52
|
+
const nextDay = Math.min(day, lastDayOfNextMonth);
|
|
53
|
+
const next = new Date(year, month, nextDay);
|
|
48
54
|
return this.createBy(CalendarDate.from(next));
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* @inheritDoc
|
|
52
58
|
*/
|
|
53
59
|
previous() {
|
|
54
|
-
const
|
|
55
|
-
|
|
60
|
+
const current = this.current.toDate();
|
|
61
|
+
const year = current.getFullYear();
|
|
62
|
+
const month = current.getMonth() - 1;
|
|
63
|
+
const day = current.getDate();
|
|
64
|
+
// Get the last day of the previous month
|
|
65
|
+
const lastDayOfPreviousMonth = new Date(year, month + 1, 0).getDate();
|
|
66
|
+
const previousDay = Math.min(day, lastDayOfPreviousMonth);
|
|
67
|
+
const previous = new Date(year, month, previousDay);
|
|
56
68
|
return this.createBy(CalendarDate.from(previous));
|
|
57
69
|
}
|
|
58
70
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LogUtility } from '../../../utils/log';
|
|
1
2
|
import { CalendarDate } from '../calendar-date';
|
|
2
3
|
describe('calendar-date', () => {
|
|
3
4
|
it('should new a calendar date with value', () => {
|
|
@@ -72,6 +73,78 @@ describe('calendar-date', () => {
|
|
|
72
73
|
expect(new CalendarDate(2024, 2, 10).getMonthName()).toBe('February');
|
|
73
74
|
expect(new CalendarDate(2024, 2, 10).getMonthName(true)).toBe('Feb');
|
|
74
75
|
});
|
|
76
|
+
it('should return as expected when set timezone', () => {
|
|
77
|
+
spyOn(LogUtility, 'warn');
|
|
78
|
+
CalendarDate.from(new Date('2025-03-25T05:30:00.211Z'), 'test');
|
|
79
|
+
expect(LogUtility.warn).toHaveBeenCalledWith(`Invalid timezone:`, expect.anything());
|
|
80
|
+
expect(CalendarDate.from(new Date('2025-03-25T05:30:00.211Z'), 'Etc/GMT+8').date).toEqual(24);
|
|
81
|
+
});
|
|
82
|
+
it('should return compare result when call large', () => {
|
|
83
|
+
const calendarDate = new CalendarDate(2024, 2, 10);
|
|
84
|
+
expect(calendarDate.isAfter(new CalendarDate(2023, 2, 10))).toEqual(true);
|
|
85
|
+
expect(calendarDate.isAfter(new CalendarDate(2024, 1, 10))).toEqual(true);
|
|
86
|
+
expect(calendarDate.isAfter(new CalendarDate(2024, 2, 9))).toEqual(true);
|
|
87
|
+
expect(calendarDate.isAfter(new CalendarDate(2024, 2, 10))).toEqual(false);
|
|
88
|
+
expect(calendarDate.isAfter(new CalendarDate(2025, 2, 10))).toEqual(false);
|
|
89
|
+
expect(calendarDate.isAfter(new CalendarDate(2024, 3, 10))).toEqual(false);
|
|
90
|
+
expect(calendarDate.isAfter(new CalendarDate(2024, 2, 12))).toEqual(false);
|
|
91
|
+
expect(calendarDate.isAfter(null)).toEqual(false);
|
|
92
|
+
});
|
|
93
|
+
it('should return compare result when call less', () => {
|
|
94
|
+
const calendarDate = new CalendarDate(2024, 2, 10);
|
|
95
|
+
expect(calendarDate.isBefore(new CalendarDate(2023, 2, 10))).toEqual(false);
|
|
96
|
+
expect(calendarDate.isBefore(new CalendarDate(2024, 1, 10))).toEqual(false);
|
|
97
|
+
expect(calendarDate.isBefore(new CalendarDate(2024, 2, 9))).toEqual(false);
|
|
98
|
+
expect(calendarDate.isBefore(new CalendarDate(2024, 2, 10))).toEqual(false);
|
|
99
|
+
expect(calendarDate.isBefore(new CalendarDate(2025, 2, 10))).toEqual(true);
|
|
100
|
+
expect(calendarDate.isBefore(new CalendarDate(2024, 3, 10))).toEqual(true);
|
|
101
|
+
expect(calendarDate.isBefore(new CalendarDate(2024, 2, 12))).toEqual(true);
|
|
102
|
+
expect(calendarDate.isBefore(null)).toEqual(false);
|
|
103
|
+
});
|
|
104
|
+
it('should return as expected when call fromString and toString method', () => {
|
|
105
|
+
expect(CalendarDate.fromString('03/12/2012').toString()).toEqual('03/12/2012');
|
|
106
|
+
expect(CalendarDate.fromString('2012-03-12', 'YYYY-MM-DD').toString('DD/MM/YYYY')).toEqual('12/03/2012');
|
|
107
|
+
expect(CalendarDate.fromString('2012-03-12', 'YYYY-MM-DD').toString()).toEqual('03/12/2012');
|
|
108
|
+
expect(CalendarDate.fromString('2012-24-24', 'YYYY-MM-DD')).toEqual(null);
|
|
109
|
+
expect(CalendarDate.fromString('03/12/2012', 'YYYY-MM-DD').toString()).toEqual('03/12/2012');
|
|
110
|
+
expect(CalendarDate.fromString('10-9-8', 'YY-M-D').toString()).toEqual('09/08/2010');
|
|
111
|
+
expect(CalendarDate.fromString('10-Aug-8', 'YY-MMM-D').toString()).toEqual('08/08/2010');
|
|
112
|
+
expect(CalendarDate.fromString('10-March-8', 'YY-MMMM-D').toString()).toEqual('03/08/2010');
|
|
113
|
+
expect(CalendarDate.fromString('10-March-8', 'YY\\D').toString()).toEqual('03/10/2008');
|
|
114
|
+
expect(CalendarDate.fromString('-2022-10-8', '-YYYY-MM-DD').toString()).toEqual('10/08/2022');
|
|
115
|
+
expect(CalendarDate.fromString('2022-10', '-YYYY-MM').toString()).toEqual('10/01/2022');
|
|
116
|
+
expect(CalendarDate.fromString('')).toEqual(null);
|
|
117
|
+
const date = CalendarDate.fromString('2012-03-12', 'YYYY-MM-DD');
|
|
118
|
+
expect(date.toString('YYYY-MMM-DD')).toEqual('2012-Mar-12');
|
|
119
|
+
expect(date.toString('YYYY-MMMM-DD')).toEqual('2012-March-12');
|
|
120
|
+
expect(date.toString('YY-M-D')).toEqual('12-3-12');
|
|
121
|
+
expect(date.toString('YY-M-TT')).toEqual('12-3-TT');
|
|
122
|
+
expect(date.toString('YY\\DD')).toEqual('12DD');
|
|
123
|
+
expect(date.toString('--YYYY-DD-MM')).toEqual('--2012-12-03');
|
|
124
|
+
expect(date.toString('MM-dd')).toEqual('03-');
|
|
125
|
+
});
|
|
126
|
+
it('should return as expected when call firstDateOfMonth method', () => {
|
|
127
|
+
expect(CalendarDate.fromString('03/12/2012').firstDateOfMonth().toString()).toEqual('03/01/2012');
|
|
128
|
+
expect(CalendarDate.fromString('02/12/2012').firstDateOfMonth().toString()).toEqual('02/01/2012');
|
|
129
|
+
expect(CalendarDate.fromString('2012-12-24', 'YYYY-MM-DD').firstDateOfMonth().toString()).toEqual('12/01/2012');
|
|
130
|
+
});
|
|
131
|
+
it('should return as expected when call lastDateOfMonth method', () => {
|
|
132
|
+
expect(CalendarDate.fromString('03/12/2012').lastDateOfMonth().toString()).toEqual('03/31/2012');
|
|
133
|
+
expect(CalendarDate.fromString('02/12/2012').lastDateOfMonth().toString()).toEqual('02/29/2012');
|
|
134
|
+
expect(CalendarDate.fromString('2012-11-24', 'YYYY-MM-DD').lastDateOfMonth().toString()).toEqual('11/30/2012');
|
|
135
|
+
});
|
|
136
|
+
it('should return as expected when call add method', () => {
|
|
137
|
+
const date = CalendarDate.fromString('03/12/2012');
|
|
138
|
+
expect(date.add(3).toString()).toEqual('03/12/2015');
|
|
139
|
+
expect(date.add(-3).toString()).toEqual('03/12/2009');
|
|
140
|
+
expect(date.add(0, 10).toString()).toEqual('01/12/2013');
|
|
141
|
+
expect(date.add(0, -10).toString()).toEqual('05/12/2011');
|
|
142
|
+
expect(date.add(0, 0, 30).toString()).toEqual('04/11/2012');
|
|
143
|
+
expect(date.add(0, 0, -30).toString()).toEqual('02/11/2012');
|
|
144
|
+
expect(date.add(3, 10, 30).toString()).toEqual('02/11/2016');
|
|
145
|
+
expect(date.add(-3, -10, -30).toString()).toEqual('04/12/2008');
|
|
146
|
+
expect(date.add().toString()).toEqual('03/12/2012');
|
|
147
|
+
});
|
|
75
148
|
});
|
|
76
149
|
describe('CalendarDate Timezone', () => {
|
|
77
150
|
it('should create calendar date', () => {
|
|
@@ -78,6 +78,15 @@ describe('day-period', () => {
|
|
|
78
78
|
dayPeriod = dayPeriod.previous();
|
|
79
79
|
expect(dayPeriod.current.date).toEqual(8);
|
|
80
80
|
});
|
|
81
|
+
it('should return proper when call equal', () => {
|
|
82
|
+
const period1 = new DayPeriod(new CalendarDate(2022, 4, 5));
|
|
83
|
+
const period2 = new DayPeriod(new CalendarDate(2022, 4, 5));
|
|
84
|
+
const period3 = new DayPeriod(new CalendarDate(2022, 4, 6));
|
|
85
|
+
const period4 = new DayPeriod(new CalendarDate(2022, 5, 5));
|
|
86
|
+
expect(period1.equal(period2)).toEqual(true);
|
|
87
|
+
expect(period1.equal(period3)).toEqual(false);
|
|
88
|
+
expect(period1.equal(period4)).toEqual(false);
|
|
89
|
+
});
|
|
81
90
|
});
|
|
82
91
|
describe('DayPeriod Timezone', () => {
|
|
83
92
|
beforeEach(() => {
|