@webitel/ui-sdk 0.1.3-vue3 → 0.1.4-vite
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/README.md +1 -1
- package/dist/img/sprite/arrow-mix.svg +5 -0
- package/dist/img/sprite/azure.svg +19 -0
- package/dist/img/sprite/email.svg +3 -0
- package/dist/img/sprite/index.js +1 -1
- package/dist/img/sprite/meta.svg +17 -0
- package/dist/img/sprite/options.svg +5 -0
- package/dist/img/sprite/role.svg +3 -0
- package/dist/img/sprite/scorecard.svg +4 -0
- package/dist/img/sprite/user.svg +3 -0
- package/dist/ui-sdk.common.js +36397 -11631
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +36402 -11636
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +27 -4
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +24 -8
- package/src/api/axios/generateInstance.js +25 -0
- package/src/api/defaults/getDefaultGetListResponse/getDefaultGetListResponse.js +6 -0
- package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +9 -0
- package/src/api/defaults/index.js +7 -0
- package/src/api/interceptors/request/updateToken.interceptor.js +10 -0
- package/src/api/interceptors/response/handleUnauthorized.interceptor.js +12 -0
- package/src/api/transformers/applyTransform.js +8 -0
- package/src/api/transformers/camelToSnake/camelToSnake.transformer.js +4 -0
- package/src/api/transformers/generateUrl/generateUrl.transformer.js +13 -0
- package/src/api/transformers/index.js +23 -0
- package/src/api/transformers/log/log.transformer.js +6 -0
- package/src/api/transformers/merge/merge.transformer.js +5 -0
- package/src/api/transformers/mergeEach/mergeEach.transformer.js +8 -0
- package/src/api/transformers/notify/notify.transformer.js +32 -0
- package/src/api/transformers/sanitize/sanitize.transformer.js +12 -0
- package/src/api/transformers/snakeToCamel/snakeToCamel.transformer.js +4 -0
- package/src/api/transformers/starToSearch/starToSearch.transformer.js +12 -0
- package/src/components/index.js +63 -55
- package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +25 -0
- package/src/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue +48 -0
- package/src/components/transitions/wt-expand-transition.vue +41 -39
- package/src/components/{organisms/wt-app-header → wt-app-header}/__tests__/WtAppNavigator.spec.js +2 -2
- package/src/components/{organisms/wt-app-header → wt-app-header}/__tests__/WtHeaderActions.spec.js +1 -1
- package/src/{css/components/organisms → components}/wt-app-header/_variables.scss +3 -2
- package/src/components/wt-app-header/wt-app-header.vue +29 -0
- package/src/components/{organisms/wt-app-header → wt-app-header}/wt-app-navigator.vue +69 -40
- package/src/components/wt-avatar/_variables.scss +32 -0
- package/src/components/wt-avatar/wt-avatar.vue +187 -0
- package/src/components/{atoms/wt-badge → wt-badge}/wt-badge.vue +20 -13
- package/src/components/wt-button/Readme.md +23 -0
- package/src/components/{atoms/wt-button → wt-button}/__tests__/WtButton.spec.js +1 -1
- package/src/components/wt-button/_variables.scss +41 -0
- package/src/components/wt-button/wt-button.vue +205 -0
- package/src/components/wt-button-select/Readme.md +13 -0
- package/src/components/{molecules/wt-button-select → wt-button-select}/__tests__/WtButtonSelect.spec.js +16 -5
- package/src/components/wt-button-select/_variables.scss +7 -0
- package/src/components/wt-button-select/wt-button-select.vue +130 -0
- package/src/components/{molecules/wt-checkbox → wt-checkbox}/__tests__/WtCheckbox.spec.js +6 -6
- package/src/components/wt-checkbox/wt-checkbox.vue +191 -0
- package/src/{css/components/atoms → components}/wt-chip/wt-chip.scss +1 -1
- package/src/components/wt-chip/wt-chip.vue +24 -0
- package/src/components/{atoms/wt-context-menu → wt-context-menu}/__tests__/WtContextMenu.spec.js +1 -1
- package/src/{css/components/atoms → components}/wt-context-menu/_variables.scss +2 -0
- package/src/components/{atoms/wt-context-menu → wt-context-menu}/wt-context-menu.vue +68 -42
- package/src/components/{molecules/wt-datepicker → wt-datepicker}/__tests__/WtDatepicker.spec.js +4 -4
- package/src/components/wt-datepicker/_variables.scss +56 -0
- package/src/components/wt-datepicker/wt-datepicker.vue +240 -0
- package/src/components/wt-divider/wt-divider.vue +30 -0
- package/src/components/wt-dummy/__tests__/WtDummy.spec.js +9 -0
- package/src/components/wt-dummy/wt-dummy.vue +73 -0
- package/src/components/{organisms/wt-error-page → wt-error-page}/__tests__/wt-error-page.spec.js +3 -3
- package/src/components/{organisms/wt-error-page → wt-error-page}/wt-error-page.vue +2 -2
- package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +9 -0
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +67 -0
- package/src/components/{organisms/wt-filters-panel-wrapper → wt-filters-panel-wrapper}/wt-filters-panel-wrapper.vue +6 -6
- package/src/components/{organisms/wt-headline → wt-headline}/wt-headline.vue +5 -0
- package/src/components/wt-headline-nav/Readme.md +9 -0
- package/src/components/{organisms/wt-headline-nav → wt-headline-nav}/__tests__/wt-headline-nav.spec.js +1 -1
- package/src/components/wt-headline-nav/_variables.scss +8 -0
- package/src/components/{organisms/wt-headline-nav → wt-headline-nav}/wt-headline-nav.vue +41 -29
- package/src/components/{molecules/wt-hint → wt-hint}/wt-hint.vue +7 -1
- package/src/components/wt-icon/Readme.md +327 -0
- package/src/components/{atoms/wt-icon → wt-icon}/__tests__/WtIcon.spec.js +2 -2
- package/src/components/wt-icon/_variables.scss +31 -0
- package/src/components/wt-icon/docs/cleanup-svg-fill-none.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-fill.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-viewbox-correct.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-viewbox-incorrect.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-width-height.png +0 -0
- package/src/components/wt-icon/docs/svg-icon-code-example.png +0 -0
- package/src/components/wt-icon/docs/svg-sprite-in-dom.png +0 -0
- package/src/components/wt-icon/wt-icon.vue +172 -0
- package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtAddIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtDeleteIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtDownloadIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtEditIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtHistoryIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtRefreshIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/wt-add-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-delete-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-download-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-edit-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-history-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-refresh-icon-action.vue +27 -0
- package/src/components/wt-icon-action/wt-icon-action.vue +54 -0
- package/src/components/wt-icon-btn/Readme.md +10 -0
- package/src/components/{molecules/wt-icon-btn → wt-icon-btn}/__tests__/WtIconBtn.spec.js +2 -2
- package/src/components/wt-icon-btn/_variables.scss +9 -0
- package/src/components/wt-icon-btn/wt-icon-btn.vue +47 -0
- package/src/components/{atoms/wt-indicator → wt-indicator}/__tests__/WtIndicator.spec.js +2 -2
- package/src/{css/components/atoms → components}/wt-indicator/_variables.scss +3 -3
- package/src/components/{atoms/wt-indicator → wt-indicator}/wt-indicator.vue +5 -0
- package/src/components/{molecules/wt-input → wt-input}/__tests__/WtInput.spec.js +3 -3
- package/src/components/{molecules/wt-input → wt-input}/wt-input.vue +40 -20
- package/src/{css/components/atoms → components}/wt-input-info/_variables.scss +2 -2
- package/src/components/wt-input-info/wt-input-info.vue +40 -0
- package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +9 -0
- package/src/components/wt-item-link/wt-item-link.vue +57 -0
- package/src/components/{molecules/wt-label → wt-label}/wt-label.vue +5 -0
- package/src/components/{molecules/wt-load-bar → wt-load-bar}/wt-load-bar.vue +7 -2
- package/src/{css/components/atoms → components}/wt-loader/_variables.scss +2 -2
- package/src/components/{atoms/wt-loader → wt-loader}/wt-loader.vue +22 -17
- package/src/components/{organisms/wt-navigation-bar → wt-navigation-bar}/__tests__/WtNavigationBar.spec.js +22 -18
- package/src/components/{organisms/wt-navigation-bar → wt-navigation-bar}/wt-navigation-bar.vue +27 -16
- package/src/components/{molecules/wt-notification → wt-notification}/__tests__/WtNotification.spec.js +1 -1
- package/src/components/wt-notification/wt-notification.vue +86 -0
- package/src/components/{organisms/wt-notifications-bar → wt-notifications-bar}/__tests__/WtNotificationsBar.spec.js +6 -6
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +78 -0
- package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +9 -0
- package/src/components/wt-page-header/wt-page-header.vue +83 -0
- package/src/components/{organisms/wt-page-wrapper → wt-page-wrapper}/wt-page-wrapper.vue +6 -0
- package/src/components/{organisms/wt-pagination → wt-pagination}/__tests__/WtPagination.spec.js +2 -1
- package/src/components/{organisms/wt-pagination → wt-pagination}/wt-pagination.vue +7 -1
- package/src/{css/components/organisms → components}/wt-player/_variables.scss +1 -1
- package/src/components/{organisms/wt-player → wt-player}/wt-player.vue +10 -5
- package/src/components/{molecules/wt-popup → wt-popup}/wt-popup.vue +5 -0
- package/src/components/{molecules/wt-progress-bar → wt-progress-bar}/__tests__/WtProgressBar.spec.js +2 -2
- package/src/{css/components/molecules → components}/wt-progress-bar/_variables.scss +2 -2
- package/src/components/{molecules/wt-progress-bar → wt-progress-bar}/wt-progress-bar.vue +13 -3
- package/src/components/{molecules/wt-radio → wt-radio}/__tests__/WtRadio.spec.js +6 -6
- package/src/components/wt-radio/wt-radio.vue +180 -0
- package/src/components/wt-rounded-action/Readme.md +68 -0
- package/src/components/{atoms/wt-rounded-action → wt-rounded-action}/__tests__/WtRoundedAction.spec.js +1 -1
- package/src/components/wt-rounded-action/_variables.scss +14 -0
- package/src/components/wt-rounded-action/wt-rounded-action.vue +139 -0
- package/src/components/{molecules/wt-search-bar → wt-search-bar}/__tests__/WtSearchBar.spec.js +9 -0
- package/src/components/wt-search-bar/wt-search-bar.vue +222 -0
- package/src/components/{molecules/wt-select → wt-select}/__tests__/WtSelect.spec.js +3 -3
- package/src/components/{molecules/wt-select → wt-select}/mixins/__tests__/multiselectMixin.spec.js +4 -4
- package/src/components/{molecules/wt-select → wt-select}/mixins/multiselectMixin.js +9 -4
- package/src/components/{molecules/wt-select → wt-select}/wt-select.vue +23 -9
- package/src/components/{molecules/wt-slider → wt-slider}/wt-slider.vue +8 -3
- package/src/components/{organisms/wt-status-select → wt-status-select}/__tests__/WtStatusSelect.spec.js +1 -1
- package/src/components/{organisms/wt-status-select → wt-status-select}/_internals/StatusOptions.lookup.js +1 -1
- package/src/components/{organisms/wt-status-select → wt-status-select}/wt-status-select.vue +27 -23
- package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +18 -0
- package/src/components/wt-stepper/wt-stepper.vue +89 -0
- package/src/components/{molecules/wt-switcher → wt-switcher}/__tests__/WtSwitcher.spec.js +5 -5
- package/src/components/wt-switcher/wt-switcher.vue +191 -0
- package/src/components/{organisms/wt-table → wt-table}/__tests__/WtTable.spec.js +11 -11
- package/src/components/{organisms/wt-table → wt-table}/wt-table.vue +20 -3
- package/src/components/{organisms/wt-table-actions → wt-table-actions}/wt-table-actions.vue +5 -0
- package/src/components/{organisms/wt-table-column-select → wt-table-column-select}/__tests__/WtTableColumnSelect.spec.js +3 -3
- package/src/components/wt-table-column-select/wt-table-column-select.vue +178 -0
- package/src/components/{molecules/wt-tabs → wt-tabs}/__tests__/WtTabs.spec.js +3 -3
- package/src/{css/components/molecules → components}/wt-tabs/_variables.scss +1 -1
- package/src/components/{molecules/wt-tabs → wt-tabs}/wt-tabs.vue +9 -1
- package/src/components/{molecules/wt-tags-input → wt-tags-input}/__tests__/WtTagsInput.spec.js +7 -7
- package/src/components/{molecules/wt-tags-input → wt-tags-input}/wt-tags-input.vue +18 -7
- package/src/components/{molecules/wt-textarea → wt-textarea}/__tests__/WtTextarea.spec.js +4 -4
- package/src/components/wt-textarea/wt-textarea.vue +223 -0
- package/src/components/{molecules/wt-time-input → wt-time-input}/__tests__/WtTimeInput.spec.js +3 -3
- package/src/components/wt-time-input/wt-time-input.vue +187 -0
- package/src/components/{molecules/wt-timepicker → wt-timepicker}/__tests__/WtTimepicker.spec.js +13 -13
- package/src/components/{molecules/wt-timepicker → wt-timepicker}/wt-timepicker.vue +13 -5
- package/src/components/{atoms/wt-tooltip → wt-tooltip}/__tests__/WtTooltip.spec.js +1 -1
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +68 -0
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +48 -0
- package/src/components/wt-tooltip/_variables.scss +11 -0
- package/src/components/wt-tooltip/wt-tooltip.vue +150 -0
- package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +14 -0
- package/src/composables/useCachedInterval/useCachedInterval.js +21 -0
- package/src/composables/useDestroyableSortable/useDestroyableSortable.js +66 -0
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +83 -0
- package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +37 -0
- package/src/css/main.scss +0 -3
- package/src/css/styleguide/colors/_colors.scss +177 -147
- package/src/css/styleguide/colors/_deprecated.scss +151 -0
- package/src/css/styleguide/colors/_palette.scss +358 -0
- package/src/directives/clickaway/clickaway.js +3 -0
- package/src/directives/index.js +7 -0
- package/src/enums/WebitelApplications/AdminSections.enum.js +4 -0
- package/src/enums/WebitelApplications/AuditorSections.enum.js +5 -0
- package/src/enums/WebitelApplications/CrmSections.enum.js +5 -0
- package/src/enums/WebitelApplications/WebitelApplications.enum.js +1 -0
- package/src/locale/.DS_Store +0 -0
- package/src/locale/en/en.js +96 -13
- package/src/locale/es/es.js +282 -0
- package/src/locale/i18n.js +4 -0
- package/src/locale/ru/ru.js +97 -12
- package/src/locale/ua/ua.js +98 -13
- package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +5 -7
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +17 -13
- package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +23 -31
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +12 -15
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +12 -12
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +2 -2
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +3 -3
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +2 -2
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +5 -5
- package/src/mixins/validationMixin/useValidation.js +41 -0
- package/src/mixins/validationMixin/validationMixin.js +17 -12
- package/src/modules/AgentStatusSelect/api/agent-status.js +24 -0
- package/src/modules/AgentStatusSelect/api/pause-cause.js +47 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +83 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +18 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +122 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +55 -0
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +107 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +14 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +60 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question.spec.js +14 -0
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +70 -0
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +132 -0
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +154 -0
- package/src/modules/AuditForm/components/audit-form-question.vue +136 -0
- package/src/modules/AuditForm/components/audit-form.vue +183 -0
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +24 -0
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +45 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +89 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +97 -0
- package/src/modules/AuditForm/components/questions/score/__tests__/audit-form-question-score.spec.js +30 -0
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +132 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +13 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionSchema.js +8 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionScoreSchema.js +8 -0
- package/src/modules/CardStoreModule/composables/useCardStore.js +55 -0
- package/src/modules/CardStoreModule/store/CardStoreModule.js +84 -0
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +87 -0
- package/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup.js +28 -0
- package/src/modules/FilesExport/FilesExport.js +4 -1
- package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -1
- package/src/modules/Filters/classes/BaseFilterSchema.js +13 -0
- package/src/modules/Filters/components/filter-pagination.vue +61 -0
- package/src/modules/Filters/components/filter-table-fields.vue +61 -0
- package/src/modules/Filters/composables/useTableFilters.js +17 -0
- package/src/modules/Filters/restores/filterFieldsRestore.js +9 -0
- package/src/modules/Filters/restores/readme.md +1 -0
- package/src/modules/Filters/store/FiltersStoreModule.js +181 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +10 -12
- package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +10 -12
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +12 -12
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +10 -12
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +10 -12
- package/src/modules/QueryFilters/components/abstract-api-filter.vue +1 -1
- package/src/modules/QueryFilters/components/abstract-enum-filter.vue +1 -1
- package/src/modules/QueryFilters/components/filter-datetime.vue +4 -3
- package/src/modules/QueryFilters/components/filter-from-to.vue +15 -8
- package/src/modules/QueryFilters/components/filter-table-fields.vue +101 -0
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +11 -11
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +11 -13
- package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +18 -25
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +14 -9
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +12 -14
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +2 -2
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +4 -4
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +21 -8
- package/src/modules/TableStoreModule/composables/useTableStore.js +58 -0
- package/src/modules/TableStoreModule/store/TableStoreModule.js +207 -0
- package/src/modules/Userinfo/api/auth.js +6 -4
- package/src/modules/Userinfo/api/userinfo.js +16 -4
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +27 -0
- package/src/modules/Userinfo/components/__tests__/auth.spec.js +11 -12
- package/src/modules/Userinfo/components/the-auth.vue +1 -1
- package/src/modules/Userinfo/enums/Permissions.enum.js +7 -0
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +41 -1
- package/src/plugins/breakpoint/breakpoint.plugin.js +5 -4
- package/src/scripts/__tests__/updateObject.spec.js +19 -0
- package/src/scripts/caseConverters.js +2 -2
- package/src/scripts/debounce.js +3 -9
- package/src/scripts/eventBus.js +7 -3
- package/src/scripts/updateObject.js +6 -0
- package/src/store/BaseStoreModules/ApiStoreModule.js +93 -0
- package/src/store/ReactiveNowStoreModule/ReactiveNowStoreModule.js +27 -0
- package/src/validators/decimalValidator.js +9 -0
- package/src/validators/domainValidator.js +5 -0
- package/src/components/atoms/wt-avatar/wt-avatar.vue +0 -102
- package/src/components/atoms/wt-button/wt-button.vue +0 -288
- package/src/components/atoms/wt-chip/wt-chip.vue +0 -23
- package/src/components/atoms/wt-divider/wt-divider.vue +0 -25
- package/src/components/atoms/wt-icon/wt-icon.vue +0 -150
- package/src/components/atoms/wt-input-info/wt-input-info.vue +0 -35
- package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +0 -156
- package/src/components/atoms/wt-tooltip/wt-tooltip.vue +0 -48
- package/src/components/molecules/wt-button-select/wt-button-select.vue +0 -184
- package/src/components/molecules/wt-checkbox/wt-checkbox.vue +0 -179
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +0 -203
- package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +0 -79
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +0 -300
- package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +0 -75
- package/src/components/molecules/wt-notification/wt-notification.vue +0 -75
- package/src/components/molecules/wt-radio/wt-radio.vue +0 -170
- package/src/components/molecules/wt-search-bar/wt-search-bar.vue +0 -194
- package/src/components/molecules/wt-switcher/wt-switcher.vue +0 -182
- package/src/components/molecules/wt-textarea/wt-textarea.vue +0 -215
- package/src/components/molecules/wt-time-input/wt-time-input.vue +0 -190
- package/src/components/organisms/wt-app-header/wt-app-header.vue +0 -24
- package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +0 -71
- package/src/components/organisms/wt-table/__tests__/WtTableDeleteAction.spec.js +0 -9
- package/src/components/organisms/wt-table/__tests__/WtTableEditAction.spec.js +0 -9
- package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +0 -21
- package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +0 -22
- package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +0 -120
- package/src/css/components/_components.scss +0 -45
- package/src/css/components/atoms/wt-avatar/_variables.scss +0 -14
- package/src/css/components/atoms/wt-button/_variables.scss +0 -47
- package/src/css/components/atoms/wt-icon/_variables.scss +0 -8
- package/src/css/components/atoms/wt-rounded-action/_variables.scss +0 -7
- package/src/css/components/atoms/wt-tooltip/_variables.scss +0 -29
- package/src/css/components/molecules/wt-button-select/_variables.scss +0 -18
- package/src/css/components/molecules/wt-datepicker/_variables.scss +0 -21
- package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +0 -90
- package/src/css/components/molecules/wt-datetimepicker/_variables.scss +0 -11
- package/src/css/components/molecules/wt-icon-btn/_variables.scss +0 -3
- package/src/css/components/organisms/wt-headline-nav/_variables.scss +0 -5
- /package/src/components/{organisms/wt-app-header → wt-app-header}/__tests__/WtAppHeader.spec.js +0 -0
- /package/src/components/{organisms/wt-app-header → wt-app-header}/wt-header-actions.vue +0 -0
- /package/src/components/{atoms/wt-avatar → wt-avatar}/__tests__/wt-avatar.spec.js +0 -0
- /package/src/components/{atoms/wt-badge → wt-badge}/__tests__/wt-badge.spec.js +0 -0
- /package/src/{css/components/atoms → components}/wt-badge/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-checkbox/_variables.scss +0 -0
- /package/src/components/{atoms/wt-chip → wt-chip}/__tests__/WtChip.spec.js +0 -0
- /package/src/{css/components/atoms → components}/wt-chip/_variables.scss +0 -0
- /package/src/components/{molecules/wt-copy-action → wt-copy-action}/__tests__/WtCopyAction.spec.js +0 -0
- /package/src/components/{molecules/wt-copy-action → wt-copy-action}/wt-copy-action.vue +0 -0
- /package/src/components/{atoms/wt-divider → wt-divider}/__tests__/WtDivider.spec.js +0 -0
- /package/src/{css/components/atoms → components}/wt-divider/_variables.scss +0 -0
- /package/src/components/{organisms/wt-filters-panel-wrapper/__tests__/wt-filters-panel-wrapper.spec.js → wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js} +0 -0
- /package/src/components/{organisms/wt-headline → wt-headline}/__tests__/WtHeadline.spec.js +0 -0
- /package/src/{css/components/organisms → components}/wt-headline/_variables.scss +0 -0
- /package/src/components/{molecules/wt-hint → wt-hint}/__tests__/WtHint.spec.js +0 -0
- /package/src/{css/components/molecules → components}/wt-input/_variables.scss +0 -0
- /package/src/components/{atoms/wt-input-info → wt-input-info}/__tests__/WtInputInfo.spec.js +0 -0
- /package/src/components/{molecules/wt-label → wt-label}/__tests__/WtLabel.spec.js +0 -0
- /package/src/{css/components/atoms → components}/wt-label/_variables.scss +0 -0
- /package/src/components/{molecules/wt-label → wt-label}/mixins/labelUsageMixin.js +0 -0
- /package/src/components/{molecules/wt-load-bar → wt-load-bar}/__tests__/WtLoadBar.spec.js +0 -0
- /package/src/{css/components/molecules → components}/wt-load-bar/_variables.scss +0 -0
- /package/src/components/{atoms/wt-loader → wt-loader}/__tests__/WtLoader.spec.js +0 -0
- /package/src/components/{atoms/wt-loader → wt-loader}/_internals/wt-loader--md.vue +0 -0
- /package/src/components/{atoms/wt-loader → wt-loader}/_internals/wt-loader--sm.vue +0 -0
- /package/src/{css/components/organisms → components}/wt-navigation-bar/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-notification/_variables.scss +0 -0
- /package/src/{css/components/organisms → components}/wt-notifications-bar/_variables.scss +0 -0
- /package/src/components/{organisms/wt-page-wrapper → wt-page-wrapper}/__tests__/WtPageWrapper.spec.js +0 -0
- /package/src/{css/components/organisms → components}/wt-page-wrapper/_variables.scss +0 -0
- /package/src/{css/components/organisms → components}/wt-pagination/_variables.scss +0 -0
- /package/src/components/{organisms/wt-player → wt-player}/__tests__/WtPlayer.spec.js +0 -0
- /package/src/components/{molecules/wt-popup → wt-popup}/__tests__/WtPopup.spec.js +0 -0
- /package/src/{css/components/molecules → components}/wt-popup/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-radio/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-search-bar/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-select/_multiselect.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-select/_variables.scss +0 -0
- /package/src/components/{molecules/wt-slider → wt-slider}/__tests__/WtSlider.spec.js +0 -0
- /package/src/{css/components/molecules → components}/wt-slider/_variables.scss +0 -0
- /package/src/{css/components/organisms → components}/wt-status-select/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-switcher/_variables.scss +0 -0
- /package/src/components/{organisms/wt-table → wt-table}/_internals/getSortOrder.js +0 -0
- /package/src/{css/components/organisms → components}/wt-table/_variables.scss +0 -0
- /package/src/components/{organisms/wt-table-actions → wt-table-actions}/__tests__/WtTableActions.spec.js +0 -0
- /package/src/{css/components/organisms → components}/wt-table-actions/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-tags-input/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-textarea/_variables.scss +0 -0
- /package/src/{css/components/molecules → components}/wt-timepicker/_variables.scss +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="wt-time-input"
|
|
4
|
+
:class="{
|
|
5
|
+
'wt-time-input--outline': outline,
|
|
6
|
+
'wt-time-input--disabled': disabled,
|
|
7
|
+
'wt-time-input--invalid': invalid,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<wt-label
|
|
11
|
+
v-bind="labelProps"
|
|
12
|
+
v-if="hasLabel"
|
|
13
|
+
:for="name"
|
|
14
|
+
:outline="outline"
|
|
15
|
+
:disabled="disabled"
|
|
16
|
+
:invalid="invalid"
|
|
17
|
+
>
|
|
18
|
+
<!-- @slot Custom input label -->
|
|
19
|
+
<slot
|
|
20
|
+
v-bind="{ label }"
|
|
21
|
+
name="label"
|
|
22
|
+
>{{ label }}</slot>
|
|
23
|
+
</wt-label>
|
|
24
|
+
<div class="wt-time-input__wrapper">
|
|
25
|
+
<input
|
|
26
|
+
:id="name"
|
|
27
|
+
class="wt-time-input__input"
|
|
28
|
+
:value="value"
|
|
29
|
+
:min="0"
|
|
30
|
+
:max="maxValue"
|
|
31
|
+
:disabled="disabled"
|
|
32
|
+
type="number"
|
|
33
|
+
@input="$emit('input', $event.target.value)"
|
|
34
|
+
>
|
|
35
|
+
</div>
|
|
36
|
+
<wt-input-info
|
|
37
|
+
v-if="showInfo"
|
|
38
|
+
:invalid="invalid"
|
|
39
|
+
>{{ validationText }}
|
|
40
|
+
</wt-input-info>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import validationMixin from '../../mixins/validationMixin/validationMixin';
|
|
46
|
+
|
|
47
|
+
export default {
|
|
48
|
+
name: 'wt-time-input',
|
|
49
|
+
mixins: [validationMixin],
|
|
50
|
+
props: {
|
|
51
|
+
/**
|
|
52
|
+
* Current input value (`v-model`)
|
|
53
|
+
*/
|
|
54
|
+
value: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 0,
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Form input label
|
|
60
|
+
*/
|
|
61
|
+
label: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: '',
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Form input name
|
|
67
|
+
*/
|
|
68
|
+
name: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: '',
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Time type: day, minute, second
|
|
74
|
+
*/
|
|
75
|
+
maxValue: {
|
|
76
|
+
type: Number,
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Native input required attribute
|
|
80
|
+
*/
|
|
81
|
+
required: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false,
|
|
84
|
+
description: 'Native input required attribute',
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Native input disabled attribute
|
|
88
|
+
*/
|
|
89
|
+
disabled: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false,
|
|
92
|
+
description: 'Native input disabled attribute',
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
outline: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
labelProps: {
|
|
101
|
+
type: Object,
|
|
102
|
+
description: 'Object with props, passed down to wt-label as props',
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
hideInputInfo: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
computed: {
|
|
111
|
+
hasLabel() {
|
|
112
|
+
return !!(this.label || this.$slots.label);
|
|
113
|
+
},
|
|
114
|
+
showInfo() {
|
|
115
|
+
return this.isValidation && !this.hideInputInfo;
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<style lang="scss" scoped>
|
|
122
|
+
.wt-time-input {
|
|
123
|
+
display: inline-block;
|
|
124
|
+
cursor: text;
|
|
125
|
+
|
|
126
|
+
&--disabled {
|
|
127
|
+
pointer-events: none;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.wt-time-input__wrapper {
|
|
132
|
+
position: relative;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.wt-label {
|
|
136
|
+
text-align: center;
|
|
137
|
+
|
|
138
|
+
.wt-time-input:hover &,
|
|
139
|
+
.wt-time-input:focus-within & {
|
|
140
|
+
color: var(--form-label--hover-color);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.wt-time-input--invalid:hover &,
|
|
144
|
+
.wt-time-input--invalid:focus-within & {
|
|
145
|
+
color: var(--label--invalid-color);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.wt-time-input__input {
|
|
150
|
+
@extend %typo-body-1;
|
|
151
|
+
|
|
152
|
+
display: block;
|
|
153
|
+
width: 100%;
|
|
154
|
+
box-sizing: border-box;
|
|
155
|
+
padding: var(--input-padding);
|
|
156
|
+
color: var(--form-input-color);
|
|
157
|
+
border: var(--input-border);
|
|
158
|
+
border-color: var(--form-border-color);
|
|
159
|
+
border-radius: var(--border-radius);
|
|
160
|
+
transition: var(--transition);
|
|
161
|
+
|
|
162
|
+
.wt-time-input:hover &,
|
|
163
|
+
&:focus {
|
|
164
|
+
border-color: var(--form-border--hover-color);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.wt-time-input--outline & {
|
|
168
|
+
border-color: var(--form-outline-border-color);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.wt-time-input--outline:hover &,
|
|
172
|
+
.wt-time-input--outline &:focus {
|
|
173
|
+
border-color: var(--form-outline-border--hover-color);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.wt-time-input--disabled & {
|
|
177
|
+
background: var(--form-border--disabled-color);
|
|
178
|
+
border-color: var(--form-border--disabled-color);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.wt-time-input--invalid &,
|
|
182
|
+
.wt-time-input--invalid:hover & {
|
|
183
|
+
border-color: var(--false-color);
|
|
184
|
+
outline: none; // prevent outline overlapping false color
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</style>
|
package/src/components/{molecules/wt-timepicker → wt-timepicker}/__tests__/WtTimepicker.spec.js
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
1
|
+
import { shallowMount, mount } from '@vue/test-utils';
|
|
2
2
|
import WtTimepicker from '../wt-timepicker.vue';
|
|
3
3
|
import WtTimeInput from '../../wt-time-input/wt-time-input.vue';
|
|
4
4
|
|
|
@@ -13,22 +13,22 @@ describe('WtTimepicker', () => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it('renders only specified by format time inputs', () => {
|
|
16
|
-
const wrapper =
|
|
16
|
+
const wrapper = mount(WtTimepicker, {
|
|
17
17
|
stubs: {
|
|
18
18
|
WtTimeInput,
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
props: { format: 'mm' },
|
|
21
21
|
});
|
|
22
22
|
expect(wrapper.findAllComponents(WtTimeInput).length).toBe(1);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
it('Correctly converts value from MIN time-input to output', () => {
|
|
25
|
+
it('Correctly converts value from MIN time-input to output', async () => {
|
|
26
26
|
const value = 0;
|
|
27
|
-
const wrapper =
|
|
28
|
-
stubs: {
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
27
|
+
const wrapper = mount(WtTimepicker, {
|
|
28
|
+
// stubs: {
|
|
29
|
+
// WtTimeInput,
|
|
30
|
+
// },
|
|
31
|
+
props: { value },
|
|
32
32
|
});
|
|
33
33
|
wrapper.findAllComponents(WtTimeInput).at(0).vm.$emit('input', 21);
|
|
34
34
|
expect(wrapper.emitted().input[0]).toEqual([21 * 60 * 60]);
|
|
@@ -36,11 +36,11 @@ describe('WtTimepicker', () => {
|
|
|
36
36
|
|
|
37
37
|
it('Correctly converts value from HOUR time-input to output', () => {
|
|
38
38
|
const value = 0;
|
|
39
|
-
const wrapper =
|
|
39
|
+
const wrapper = mount(WtTimepicker, {
|
|
40
40
|
stubs: {
|
|
41
41
|
WtTimeInput,
|
|
42
42
|
},
|
|
43
|
-
|
|
43
|
+
props: { value },
|
|
44
44
|
});
|
|
45
45
|
wrapper.findAllComponents(WtTimeInput).at(1).vm.$emit('input', 21);
|
|
46
46
|
expect(wrapper.emitted().input[0]).toEqual([21 * 60]);
|
|
@@ -48,11 +48,11 @@ describe('WtTimepicker', () => {
|
|
|
48
48
|
|
|
49
49
|
it('Correctly converts value from SEC time-input to output', () => {
|
|
50
50
|
const value = 0;
|
|
51
|
-
const wrapper =
|
|
51
|
+
const wrapper = mount(WtTimepicker, {
|
|
52
52
|
stubs: {
|
|
53
53
|
WtTimeInput,
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
props: { value },
|
|
56
56
|
});
|
|
57
57
|
wrapper.findAllComponents(WtTimeInput).at(2).vm.$emit('input', 21);
|
|
58
58
|
expect(wrapper.emitted().input[0]).toEqual([21]);
|
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="wt-timepicker" :class="{'wt-timepicker--invalid': invalid}">
|
|
3
3
|
<wt-label
|
|
4
|
+
v-bind="labelProps"
|
|
4
5
|
v-if="label"
|
|
5
6
|
:invalid="invalid"
|
|
6
|
-
v-bind="labelProps"
|
|
7
7
|
>
|
|
8
8
|
{{ `${label} (${format})` }}
|
|
9
9
|
</wt-label>
|
|
10
10
|
<div class="wt-timepicker__wrapper">
|
|
11
11
|
<wt-time-input
|
|
12
12
|
v-if="isHour"
|
|
13
|
-
|
|
13
|
+
:value="hour"
|
|
14
14
|
:v="v"
|
|
15
15
|
:label="label ? null : $t('webitelUI.timepicker.hour') "
|
|
16
16
|
:maxValue="dateMode ? null : 23"
|
|
17
17
|
:disabled="disabled"
|
|
18
18
|
hide-input-info
|
|
19
|
+
@input="hour = $event"
|
|
19
20
|
></wt-time-input>
|
|
20
21
|
<wt-time-input
|
|
21
22
|
v-if="isMin"
|
|
22
|
-
|
|
23
|
+
:value="min"
|
|
23
24
|
:v="v"
|
|
24
25
|
:label="label ? null : $t('webitelUI.timepicker.min')"
|
|
25
26
|
:maxValue="59"
|
|
26
27
|
:disabled="disabled"
|
|
27
28
|
hide-input-info
|
|
29
|
+
@input="min = $event"
|
|
28
30
|
></wt-time-input>
|
|
29
31
|
<wt-time-input
|
|
30
32
|
v-if="isSec"
|
|
31
|
-
|
|
33
|
+
:value="sec"
|
|
32
34
|
:v="v"
|
|
33
35
|
:label="label ? null : $t('webitelUI.timepicker.sec')"
|
|
34
36
|
:maxValue="59"
|
|
35
37
|
:disabled="disabled"
|
|
36
38
|
hide-input-info
|
|
39
|
+
@input="sec = $event"
|
|
37
40
|
></wt-time-input>
|
|
38
41
|
</div>
|
|
39
42
|
<wt-input-info
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
</template>
|
|
46
49
|
|
|
47
50
|
<script>
|
|
48
|
-
import validationMixin from '
|
|
51
|
+
import validationMixin from '../../mixins/validationMixin/validationMixin';
|
|
49
52
|
|
|
50
53
|
const SEC_IN_HOUR = 60 * 60;
|
|
51
54
|
const SEC_IN_MIN = 60;
|
|
@@ -139,7 +142,12 @@ export default {
|
|
|
139
142
|
};
|
|
140
143
|
</script>
|
|
141
144
|
|
|
145
|
+
<style lang="scss">
|
|
146
|
+
@import './variables.scss';
|
|
147
|
+
</style>
|
|
148
|
+
|
|
142
149
|
<style lang="scss" scoped>
|
|
150
|
+
|
|
143
151
|
.wt-timepicker {
|
|
144
152
|
display: flex;
|
|
145
153
|
flex-direction: column;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// https://github.com/Akryum/floating-vue/blob/main/packages/floating-vue/src/util/events.ts
|
|
2
|
+
import { onBeforeUnmount, onMounted } from 'vue';
|
|
3
|
+
|
|
4
|
+
const SHOW_EVENT_MAP = {
|
|
5
|
+
hover: 'mouseenter',
|
|
6
|
+
focus: 'focus',
|
|
7
|
+
click: 'click',
|
|
8
|
+
touch: 'touchstart',
|
|
9
|
+
pointer: 'pointerdown',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// https://github.com/Akryum/floating-vue/blob/main/packages/floating-vue/src/util/events.ts
|
|
13
|
+
const HIDE_EVENT_MAP = {
|
|
14
|
+
hover: 'mouseleave',
|
|
15
|
+
focus: 'blur',
|
|
16
|
+
click: 'click',
|
|
17
|
+
touch: 'touchend',
|
|
18
|
+
pointer: 'pointerup',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
22
|
+
export const useTooltipTriggerSubscriptions = ({
|
|
23
|
+
target, triggers, show, hide,
|
|
24
|
+
}) => {
|
|
25
|
+
const subscribeTriggers = () => {
|
|
26
|
+
const setEventListeners = (target, triggers) => {
|
|
27
|
+
triggers.forEach((trigger) => {
|
|
28
|
+
const showEvent = SHOW_EVENT_MAP[trigger];
|
|
29
|
+
if (showEvent) {
|
|
30
|
+
target.addEventListener(showEvent, show);
|
|
31
|
+
} else {
|
|
32
|
+
console.log(`No Tooltip Show event for ${trigger} trigger`);
|
|
33
|
+
}
|
|
34
|
+
const hideEvent = HIDE_EVENT_MAP[trigger];
|
|
35
|
+
if (hideEvent) {
|
|
36
|
+
target.addEventListener(hideEvent, hide);
|
|
37
|
+
} else {
|
|
38
|
+
console.log(`No Tooltip Hide event for ${trigger} trigger`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
setEventListeners(target.value, triggers);
|
|
44
|
+
};
|
|
45
|
+
const unsubscribeTriggers = () => {
|
|
46
|
+
const unsetEventListeners = (target, triggers) => {
|
|
47
|
+
triggers.forEach((trigger) => {
|
|
48
|
+
const showEvent = SHOW_EVENT_MAP[trigger];
|
|
49
|
+
if (showEvent) {
|
|
50
|
+
target.removeEventListener(showEvent, show);
|
|
51
|
+
} else {
|
|
52
|
+
console.log(`No Tooltip Show event for ${trigger} trigger`);
|
|
53
|
+
}
|
|
54
|
+
const hideEvent = HIDE_EVENT_MAP[trigger];
|
|
55
|
+
if (hideEvent) {
|
|
56
|
+
target.removeEventListener(hideEvent, hide);
|
|
57
|
+
} else {
|
|
58
|
+
console.log(`No Tooltip Hide event for ${trigger} trigger`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
unsetEventListeners(target.value, triggers);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
onMounted(() => subscribeTriggers());
|
|
67
|
+
onBeforeUnmount(() => unsubscribeTriggers());
|
|
68
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<aside
|
|
3
|
+
class="wt-tooltip-floating"
|
|
4
|
+
ref="floating"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</aside>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
/*
|
|
12
|
+
* We need to create separate floating component so that we could set
|
|
13
|
+
* eventListeners on it at mount
|
|
14
|
+
*
|
|
15
|
+
* wt-tooltip itself can't do it, because floating is rendered conditionally
|
|
16
|
+
* through v-if so that there's no way to attach eventListeners to floating
|
|
17
|
+
* on tooltip mount
|
|
18
|
+
* */
|
|
19
|
+
|
|
20
|
+
import { ref } from 'vue';
|
|
21
|
+
import { useTooltipTriggerSubscriptions } from './useTooltipTriggerSubscriptions';
|
|
22
|
+
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
triggers: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: () => [],
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits([
|
|
31
|
+
'show',
|
|
32
|
+
'hide',
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const floating = ref(null);
|
|
36
|
+
|
|
37
|
+
useTooltipTriggerSubscriptions({
|
|
38
|
+
target: floating,
|
|
39
|
+
triggers: props.triggers,
|
|
40
|
+
show: () => emit('show'),
|
|
41
|
+
hide: () => emit('hide'),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
:root {
|
|
3
|
+
--tooltip-padding: var(--spacing-2xs) var(--spacing-xs);
|
|
4
|
+
|
|
5
|
+
--tooltip-light-text-color: var(--text-primary-color);
|
|
6
|
+
--tooltip-light-bg-color: var(--main-color);
|
|
7
|
+
--tooltip-dark-text-color: var(--text-contrast-color);
|
|
8
|
+
--tooltip-dark-bg-color: var(--contrast-color);
|
|
9
|
+
|
|
10
|
+
--tooltip-elevation: var(--elevation-10);
|
|
11
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="{
|
|
4
|
+
'wt-tooltip--contrast': contrast,
|
|
5
|
+
'wt-tooltip--visible': isVisible,
|
|
6
|
+
}"
|
|
7
|
+
class="wt-tooltip"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
ref="activator"
|
|
11
|
+
class="wt-tooltip__activator"
|
|
12
|
+
>
|
|
13
|
+
<slot name="activator"></slot>
|
|
14
|
+
</div>
|
|
15
|
+
<wt-tooltip-floating
|
|
16
|
+
v-if="isVisible"
|
|
17
|
+
ref="floating"
|
|
18
|
+
class="wt-tooltip__floating"
|
|
19
|
+
v-clickaway="hideTooltip"
|
|
20
|
+
:class="[popperClass]"
|
|
21
|
+
:style="floatingStyles"
|
|
22
|
+
:triggers="popperTriggers"
|
|
23
|
+
@show="showTooltip"
|
|
24
|
+
@hide="hideTooltip"
|
|
25
|
+
>
|
|
26
|
+
<slot v-bind="{ hide: hideTooltip }"></slot>
|
|
27
|
+
</wt-tooltip-floating>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup>
|
|
32
|
+
import {
|
|
33
|
+
ref, onMounted, watch,
|
|
34
|
+
} from 'vue';
|
|
35
|
+
import {
|
|
36
|
+
useFloating, autoPlacement, shift, flip, offset, autoUpdate,
|
|
37
|
+
} from '@floating-ui/vue';
|
|
38
|
+
import { useTooltipTriggerSubscriptions } from './_internals/useTooltipTriggerSubscriptions';
|
|
39
|
+
import WtTooltipFloating from './_internals/wt-tooltip-floating.vue';
|
|
40
|
+
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
visible: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
contrast: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
placement: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'auto',
|
|
53
|
+
},
|
|
54
|
+
popperTriggers: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default: () => [],
|
|
57
|
+
},
|
|
58
|
+
triggers: {
|
|
59
|
+
type: Array,
|
|
60
|
+
default: () => ['hover', 'focus', 'touch'],
|
|
61
|
+
},
|
|
62
|
+
popperClass: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const activator = ref(null);
|
|
69
|
+
const floating = ref(null);
|
|
70
|
+
|
|
71
|
+
const isVisible = ref(false);
|
|
72
|
+
|
|
73
|
+
const showTooltip = (event = {}) => {
|
|
74
|
+
if (isVisible.value) return;
|
|
75
|
+
isVisible.value = true;
|
|
76
|
+
|
|
77
|
+
// https://github.com/Akryum/floating-vue/blob/main/packages/floating-vue/src/components/Popper.ts#L884
|
|
78
|
+
event.usedByTooltip = true;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const hideTooltip = (event = {}) => {
|
|
82
|
+
if (event.usedByTooltip) return;
|
|
83
|
+
isVisible.value = false;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// https://floating-ui.com/docs/misc#clipping
|
|
87
|
+
const { floatingStyles } = useFloating(activator, floating, {
|
|
88
|
+
placement: props.placement === 'auto' ? null : props.placement,
|
|
89
|
+
strategy: 'fixed', // https://floating-ui.com/docs/computeposition#strategy
|
|
90
|
+
// https://floating-ui.com/docs/middleware
|
|
91
|
+
|
|
92
|
+
/* WE SHOULD USE v-if INSTEAD OF OPACITY VISIBILITY
|
|
93
|
+
TOGGLE BECAUSE OF PERFORMANCE ISSUES, RELATED TO USAGE OF AUTO_UPDATE OF POSITIONS
|
|
94
|
+
*/
|
|
95
|
+
whileElementsMounted: autoUpdate, // https://floating-ui.com/docs/vue#anchoring
|
|
96
|
+
middleware: [
|
|
97
|
+
shift(), offset(4),
|
|
98
|
+
props.placement === 'auto' ? autoPlacement() : flip(),
|
|
99
|
+
],
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
useTooltipTriggerSubscriptions({
|
|
103
|
+
target: activator,
|
|
104
|
+
triggers: props.triggers,
|
|
105
|
+
show: showTooltip,
|
|
106
|
+
hide: hideTooltip,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
watch(props.visible, (value) => {
|
|
110
|
+
if (value) showTooltip();
|
|
111
|
+
else hideTooltip();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
if (props.visible) showTooltip();
|
|
116
|
+
});
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style lang="scss">
|
|
120
|
+
@import './variables.scss';
|
|
121
|
+
</style>
|
|
122
|
+
|
|
123
|
+
<style lang="scss" scoped>
|
|
124
|
+
|
|
125
|
+
.wt-tooltip {
|
|
126
|
+
display: inline-block;
|
|
127
|
+
height: fit-content;
|
|
128
|
+
|
|
129
|
+
&__activator {
|
|
130
|
+
line-height: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.wt-tooltip-floating {
|
|
134
|
+
@extend %typo-body-2;
|
|
135
|
+
padding: var(--spacing-2xs) var(--spacing-xs);
|
|
136
|
+
color: var(--contrast-color);
|
|
137
|
+
background: var(--main-color);
|
|
138
|
+
border-radius: var(--border-radius);
|
|
139
|
+
box-shadow: var(--elevation-10);
|
|
140
|
+
z-index: 1000;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&--contrast {
|
|
144
|
+
.wt-tooltip-floating {
|
|
145
|
+
color: var(--main-color);
|
|
146
|
+
background: var(--contrast-color);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCachedInterval } from '../useCachedInterval';
|
|
2
|
+
|
|
3
|
+
describe('useCachedInterval', () => {
|
|
4
|
+
it('subscribe', (done) => {
|
|
5
|
+
const callback = jest.fn();
|
|
6
|
+
const { subscribe } = useCachedInterval({ timeout: 10 });
|
|
7
|
+
subscribe(callback);
|
|
8
|
+
expect(callback).toHaveBeenCalledTimes(1);
|
|
9
|
+
setTimeout(() => {
|
|
10
|
+
expect(callback).toHaveBeenCalledTimes(2);
|
|
11
|
+
done();
|
|
12
|
+
}, 10);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { onBeforeUnmount } from 'vue';
|
|
2
|
+
import preventHiddenPageCallsDecorator
|
|
3
|
+
from '../../scripts/preventHiddenPageCallsDecorator';
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
6
|
+
export const useCachedInterval = ({
|
|
7
|
+
timeout,
|
|
8
|
+
localStorageKey = 'auto-refresh',
|
|
9
|
+
}) => {
|
|
10
|
+
let interval = null;
|
|
11
|
+
|
|
12
|
+
onBeforeUnmount(() => {
|
|
13
|
+
if (interval) clearInterval(interval);
|
|
14
|
+
});
|
|
15
|
+
const subscribe = (callback) => {
|
|
16
|
+
const _timeout = timeout || +localStorage.getItem(localStorageKey) || 5 * 60 * 1000;
|
|
17
|
+
callback();
|
|
18
|
+
interval = setInterval(preventHiddenPageCallsDecorator(callback), _timeout);
|
|
19
|
+
};
|
|
20
|
+
return { subscribe };
|
|
21
|
+
};
|