@webitel/ui-sdk 24.12.29 → 24.12.34
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/CHANGELOG.md +271 -131
- package/README.md +6 -0
- package/dist/img/sprite/index.js +8 -2
- package/dist/img/sprite/tree-collapse.svg +4 -0
- package/dist/img/sprite/tree-cross.svg +5 -0
- package/dist/img/sprite/tree-line.svg +10 -0
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +7736 -7442
- package/dist/ui-sdk.umd.cjs +17 -17
- package/package.json +13 -6
- package/src/api/axios/generateInstance.js +6 -2
- package/src/api/clients/agents/agentChats.js +18 -19
- package/src/api/clients/agents/agents.js +29 -7
- package/src/api/clients/buckets/buckets.js +16 -3
- package/src/api/clients/calendars/calendars.js +21 -3
- package/src/api/clients/catalog/catalog.js +1 -3
- package/src/api/clients/chatGateways/chatGateways.js +41 -12
- package/src/api/clients/communications/communications.js +25 -6
- package/src/api/clients/configurations/configurations.js +13 -3
- package/src/api/clients/flows/flow.js +20 -9
- package/src/api/clients/gateways/gateways.js +12 -3
- package/src/api/clients/lists/blacklists.js +16 -3
- package/src/api/clients/media/media.js +16 -3
- package/src/api/clients/queues/queues.js +16 -6
- package/src/api/clients/roles/roles.js +3 -1
- package/src/api/clients/skills/skills.js +16 -3
- package/src/api/clients/teams/teams.js +17 -7
- package/src/api/clients/users/__tests__/users.spec.js +3 -1
- package/src/api/clients/users/users.js +8 -2
- package/src/api/clients//321/201ontacts/contactChatMessagesHistory.js +21 -13
- package/src/api/clients//321/201ontacts/contacts.js +38 -15
- package/src/api/history/transcript/callTranscript.js +10 -2
- package/src/api/interceptors/request/updateToken.interceptor.js +2 -1
- package/src/api/transformers/applyTransform.js +5 -1
- package/src/api/transformers/camelToSnake/camelToSnake.transformer.js +2 -1
- package/src/api/transformers/snakeToCamel/snakeToCamel.transformer.js +2 -1
- package/src/assets/icons/sprite/index.js +8 -2
- package/src/assets/icons/sprite/tree-collapse.svg +4 -0
- package/src/assets/icons/sprite/tree-cross.svg +5 -0
- package/src/assets/icons/sprite/tree-line.svg +10 -0
- package/src/components/index.js +8 -12
- package/src/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-1.vue +4 -2
- package/src/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-2.vue +3 -4
- package/src/components/on-demand/wt-navigation-menu/components/wt-navigation-menu.vue +6 -6
- package/src/components/on-demand/wt-route-transition/wt-route-transition.vue +12 -12
- package/src/components/on-demand/wt-save-failed-popup/wt-save-failed-popup.vue +1 -3
- package/src/components/on-demand/wt-selection-popup/wt-selection-popup.vue +3 -3
- package/src/components/on-demand/wt-start-page/components/start-page-card.vue +4 -2
- package/src/components/on-demand/wt-start-page/components/start-page-logo.vue +1 -1
- package/src/components/on-demand/wt-start-page/components/wt-start-page.vue +2 -3
- package/src/components/on-demand/wt-table-transition/wt-table-transition.vue +7 -7
- package/src/components/wt-action-bar/wt-action-bar.vue +16 -12
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +3 -1
- package/src/components/wt-app-header/_variables.scss +0 -1
- package/src/components/wt-app-header/wt-app-header.vue +4 -4
- package/src/components/wt-app-header/wt-app-navigator.vue +6 -7
- package/src/components/wt-app-header/wt-header-actions.vue +6 -8
- package/src/components/wt-avatar/wt-avatar.vue +4 -3
- package/src/components/wt-badge/wt-badge.vue +1 -2
- package/src/components/wt-button/wt-button.vue +3 -5
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +6 -2
- package/src/components/wt-button-select/wt-button-select.vue +3 -4
- package/src/components/wt-checkbox/_variables.scss +1 -2
- package/src/components/wt-checkbox/wt-checkbox.vue +1 -2
- package/src/components/wt-chip/_variables.scss +0 -1
- package/src/components/wt-confirm-dialog/wt-confirm-dialog.vue +15 -5
- package/src/components/wt-context-menu/_variables.scss +3 -1
- package/src/components/wt-context-menu/wt-context-menu.vue +1 -3
- package/src/components/wt-copy-action/wt-copy-action.vue +1 -2
- package/src/components/wt-datepicker/_variables.scss +17 -5
- package/src/components/wt-datepicker/wt-datepicker.vue +2 -7
- package/src/components/wt-divider/_variables.scss +0 -1
- package/src/components/wt-divider/wt-divider.vue +5 -3
- package/src/components/wt-dual-panel/__tests__/WtDualPanel.js +2 -2
- package/src/components/wt-dual-panel/wt-dual-panel.vue +6 -5
- package/src/components/wt-dummy/_variables.scss +0 -1
- package/src/components/wt-dummy/wt-dummy.vue +1 -1
- package/src/components/wt-empty/wt-empty.vue +42 -34
- package/src/components/wt-error-page/_variables.scss +0 -1
- package/src/components/wt-error-page/wt-error-page.vue +2 -4
- package/src/components/wt-expansion-panel/_variables.scss +0 -1
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +3 -8
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +12 -4
- package/src/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +8 -7
- package/src/components/wt-headline/_variables.scss +0 -1
- package/src/components/wt-headline-nav/_variables.scss +0 -1
- package/src/components/wt-headline-nav/wt-headline-nav.vue +2 -1
- package/src/components/wt-hint/wt-hint.vue +1 -3
- package/src/components/wt-icon/_variables.scss +0 -1
- package/src/components/wt-icon-action/wt-icon-action.vue +13 -12
- package/src/components/wt-icon-btn/_variables.scss +0 -2
- package/src/components/wt-icon-btn/wt-icon-btn.vue +4 -6
- package/src/components/wt-image/wt-image.vue +14 -13
- package/src/components/wt-indicator/wt-indicator.vue +2 -7
- package/src/components/wt-input/_variables.scss +1 -2
- package/src/components/wt-input/wt-input.vue +13 -10
- package/src/components/wt-input-info/_variables.scss +0 -1
- package/src/components/wt-intersection-observer/__tests__/WtIntersectionObserver.spec.js +1 -1
- package/src/components/wt-intersection-observer/wt-intersection-observer.vue +9 -8
- package/src/components/wt-item-link/_variables.scss +0 -1
- package/src/components/wt-label/_variables.scss +0 -1
- package/src/components/wt-label/wt-label.vue +1 -4
- package/src/components/wt-load-bar/_variables.scss +0 -1
- package/src/components/wt-load-bar/wt-load-bar.vue +0 -1
- package/src/components/wt-loader/_variables.scss +0 -2
- package/src/components/wt-loader/wt-loader.vue +1 -3
- package/src/components/wt-logo/wt-logo.vue +1 -1
- package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +9 -3
- package/src/components/wt-navigation-bar/_variables.scss +9 -3
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +27 -11
- package/src/components/wt-notification/_variables.scss +0 -1
- package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +1 -1
- package/src/components/wt-notifications-bar/_variables.scss +1 -2
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -2
- package/src/components/wt-page-header/wt-page-header.vue +3 -2
- package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +3 -1
- package/src/components/wt-page-wrapper/_variables.scss +0 -1
- package/src/components/wt-page-wrapper/wt-page-wrapper.vue +0 -2
- package/src/components/wt-pagination/_variables.scss +1 -2
- package/src/components/wt-pagination/wt-pagination.vue +2 -1
- package/src/components/wt-player/_variables.scss +6 -2
- package/src/components/wt-player/wt-player.vue +52 -53
- package/src/components/wt-popup/_variables.scss +0 -1
- package/src/components/wt-popup/wt-popup.vue +2 -8
- package/src/components/wt-progress-bar/_variables.scss +0 -1
- package/src/components/wt-progress-bar/wt-progress-bar.vue +7 -6
- package/src/components/wt-radio/_variables.scss +1 -2
- package/src/components/wt-radio/wt-radio.vue +1 -2
- package/src/components/wt-rounded-action/_variables.scss +3 -1
- package/src/components/wt-search-bar/_variables.scss +4 -2
- package/src/components/wt-search-bar/wt-search-bar.vue +10 -4
- package/src/components/wt-select/_multiselect.scss +9 -15
- package/src/components/wt-select/_variables.scss +3 -2
- package/src/components/wt-select/mixins/multiselectMixin.js +2 -1
- package/src/components/wt-select/wt-select.vue +25 -26
- package/src/components/wt-slider/_variables.scss +0 -1
- package/src/components/wt-slider/wt-slider.vue +3 -3
- package/src/components/wt-status-select/_variables.scss +8 -4
- package/src/components/wt-stepper/_variables.scss +0 -1
- package/src/components/wt-stepper/wt-stepper.vue +5 -5
- package/src/components/wt-switcher/_variables.scss +0 -1
- package/src/components/wt-switcher/wt-switcher.vue +2 -3
- package/src/components/wt-table/__tests__/WtTable.spec.js +8 -2
- package/src/components/wt-table/_variables.scss +0 -1
- package/src/components/wt-table/types/table-header.ts +8 -0
- package/src/components/wt-table/wt-table.vue +111 -109
- package/src/components/wt-table-actions/_variables.scss +1 -2
- package/src/components/wt-table-actions/wt-table-actions.vue +1 -2
- package/src/components/wt-table-column-select/wt-table-column-select.vue +11 -8
- package/src/components/wt-tabs/_variables.scss +0 -1
- package/src/components/wt-tabs/wt-tabs.vue +6 -6
- package/src/components/wt-tags-input/__tests__/WtTagsInput.spec.js +6 -6
- package/src/components/wt-tags-input/mixin/taggableMixin.js +3 -1
- package/src/components/wt-tags-input/wt-tags-input.vue +8 -10
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +6 -2
- package/src/components/wt-textarea/_variables.scss +0 -1
- package/src/components/wt-textarea/wt-textarea.vue +6 -7
- package/src/components/wt-time-input/wt-time-input.vue +1 -2
- package/src/components/wt-timepicker/_variables.scss +1 -2
- package/src/components/wt-timepicker/wt-timepicker.vue +10 -8
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +6 -1
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +1 -3
- package/src/components/wt-tooltip/_variables.scss +0 -1
- package/src/components/wt-tooltip/wt-tooltip.vue +13 -2
- package/src/components/wt-tree-table/_variables.scss +19 -0
- package/src/components/wt-tree-table/wt-tree-table.vue +323 -0
- package/src/components/wt-tree-table-row/wt-tree-table-row.vue +171 -0
- package/src/composables/useAccessControl/useAccessControl.js +12 -4
- package/src/composables/useCachedInterval/useCachedInterval.js +6 -2
- package/src/composables/useCachedItemInstanceName/useCachedItemInstanceName.js +4 -1
- package/src/composables/useCard/useCardComponent.js +10 -9
- package/src/composables/useCard/useCardTabs.js +6 -3
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +20 -10
- package/src/composables/useValidate/useValidate.js +1 -1
- package/src/composables/useWtTable/useWtTable.ts +25 -0
- package/src/css/main.scss +7 -1
- package/src/css/pages/table-page.scss +1 -2
- package/src/css/styleguide/border-radius/_border-radius.scss +1 -1
- package/src/css/styleguide/colors/_deprecated.scss +83 -24
- package/src/css/styleguide/colors/_palette.scss +1340 -251
- package/src/css/styleguide/colors/reusable/_text-field.scss +6 -2
- package/src/css/styleguide/fonts/_fonts.scss +36 -18
- package/src/css/styleguide/spacings/_spacings.scss +1 -1
- package/src/css/styleguide/transitions/_transitions.scss +1 -1
- package/src/css/styleguide/transitions/fade/_fade.scss +5 -4
- package/src/css/styleguide/viewport-breakpoints/_viewport-breakpoints.scss +0 -1
- package/src/enums/WebitelApplications/WebitelApplications.enum.js +7 -7
- package/src/enums/index.js +5 -10
- package/src/locale/en/en.js +5 -2
- package/src/locale/ru/ru.js +7 -3
- package/src/locale/ua/ua.js +7 -3
- package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +2 -1
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +3 -1
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +2 -1
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +2 -1
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +4 -1
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +2 -1
- package/src/mixins/validationMixin/useValidation.js +17 -7
- package/src/mixins/validationMixin/validationMixin.js +16 -8
- package/src/modules/AgentStatusSelect/api/pause-cause.js +4 -1
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +18 -6
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +3 -2
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +5 -2
- package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +6 -2
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +12 -4
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +18 -5
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +4 -2
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +15 -5
- package/src/modules/AuditForm/components/audit-form-question.vue +10 -4
- package/src/modules/AuditForm/components/audit-form.vue +24 -7
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +6 -2
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +5 -5
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +9 -4
- package/src/modules/CSVExport/CSVExport.js +5 -2
- package/src/modules/CSVExport/XLSExport.js +7 -7
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +4 -1
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +3 -1
- package/src/modules/CSVExport/mixins/exportXLSMixin.js +3 -1
- package/src/modules/CardStoreModule/composables/useCardStore.js +6 -2
- package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +3 -3
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +6 -3
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +6 -2
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -2
- package/src/modules/FilesExport/scripts/generateMediaURL.js +2 -1
- package/src/modules/Filters/classes/BaseFilterSchema.js +15 -6
- package/src/modules/Filters/components/filter-datetime.vue +7 -5
- package/src/modules/Filters/components/filter-pagination.vue +7 -5
- package/src/modules/Filters/components/filter-search.vue +4 -4
- package/src/modules/Filters/components/filter-select.vue +33 -24
- package/src/modules/Filters/components/filter-table-fields.vue +1 -3
- package/src/modules/Filters/composables/useTableFilters.js +3 -1
- package/src/modules/Filters/scripts/getters/localStorageGetter.js +6 -2
- package/src/modules/Filters/scripts/getters/queryGetter.js +2 -1
- package/src/modules/Filters/scripts/setters/localStorageSetter.js +6 -2
- package/src/modules/Filters/scripts/setters/querySetter.js +2 -1
- package/src/modules/Filters/scripts/utils/changeRouteQuery.js +2 -1
- package/src/modules/Filters/store/FiltersStoreModule.js +3 -3
- package/src/modules/Notifications/store/NotificationsStoreModule.js +14 -5
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +10 -3
- package/src/modules/ObjectPermissions/_internals/components/permissions-role-row.vue +1 -3
- package/src/modules/ObjectPermissions/_internals/components/permissions-role-select.vue +1 -3
- package/src/modules/ObjectPermissions/_internals/components/permissions-tab-role-popup.vue +8 -5
- package/src/modules/ObjectPermissions/_internals/modules/filters/store/filters.store.js +3 -4
- package/src/modules/ObjectPermissions/_internals/store/helpers/createObjectPermissionsStoreModule.js +1 -2
- package/src/modules/ObjectPermissions/_internals/store/modules/objectPermissionsStoreModule.js +10 -14
- package/src/modules/ObjectPermissions/components/permissions-tab.vue +12 -12
- package/src/modules/ObjectPermissions/store/index.js +2 -6
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +3 -1
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +6 -2
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +7 -2
- package/src/modules/QueryFilters/components/abstract-api-filter.vue +15 -5
- package/src/modules/QueryFilters/components/abstract-enum-filter.vue +15 -5
- package/src/modules/QueryFilters/components/filter-datetime.vue +1 -3
- package/src/modules/QueryFilters/components/filter-from-to.vue +1 -1
- package/src/modules/QueryFilters/components/filter-search.vue +1 -3
- package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -3
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +4 -1
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +9 -3
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +10 -3
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +4 -2
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -1
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +2 -1
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +10 -3
- package/src/modules/TableComponentModule/composables/useTableEmpty.js +13 -4
- package/src/modules/TableStoreModule/composables/useTableStore.js +18 -6
- package/src/modules/TableStoreModule/store/TableStoreModule.js +36 -21
- package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +7 -2
- package/src/modules/Userinfo/api/userinfo.js +4 -1
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +3 -1
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +25 -9
- package/src/plugins/breakpoint/breakpoint.plugin.js +2 -1
- package/src/scripts/__tests__/caseConverters.spec.js +4 -1
- package/src/scripts/__tests__/updateObject.spec.js +6 -2
- package/src/scripts/caseConverters.js +37 -29
- package/src/scripts/compareSize.ts +9 -6
- package/src/scripts/debounce.js +2 -1
- package/src/scripts/index.js +2 -8
- package/src/scripts/logger.js +4 -4
- package/src/scripts/preventHiddenPageCallsDecorator.js +6 -2
- package/src/scripts/saveAsJSON.js +3 -1
- package/src/scripts/sortQueryAdapters.js +11 -0
- package/src/store/BaseStoreModules/ApiStoreModule.js +26 -7
- package/src/store/BaseStoreModules/BaseStoreModule.js +2 -1
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +28 -7
- package/src/store/helpers/getNamespacedState.js +3 -1
- package/src/store/new/modules/apiStoreModule/apiStoreModule.js +19 -14
- package/src/store/new/modules/cardStoreModule/useCardStore.js +6 -2
- package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +6 -8
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +31 -28
- package/src/store/new/modules/tableStoreModule/useTableStore.js +18 -6
- package/src/validators/variableSearchValidator/__tests__/variableSearchValidator.spec.js +2 -1
- package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +3 -1
- package/src/components/wt-table/_internals/getSortOrder.js +0 -12
- /package/dist/img/sprite/{plus.svg → tree-expand.svg} +0 -0
- /package/src/assets/icons/sprite/{plus.svg → tree-expand.svg} +0 -0
|
@@ -15,8 +15,12 @@ export default {
|
|
|
15
15
|
computed: {
|
|
16
16
|
filterSchema() {
|
|
17
17
|
if (!this.$store)
|
|
18
|
-
throw new Error(
|
|
19
|
-
|
|
18
|
+
throw new Error(
|
|
19
|
+
'Vuex is required for default filterSchema baseFilterMixin property',
|
|
20
|
+
);
|
|
21
|
+
return getNamespacedState(this.$store.state, this.namespace)[
|
|
22
|
+
this.filterQuery
|
|
23
|
+
];
|
|
20
24
|
},
|
|
21
25
|
value() {
|
|
22
26
|
return this.filterSchema.value;
|
|
@@ -29,7 +33,9 @@ export default {
|
|
|
29
33
|
},
|
|
30
34
|
setValue(payload) {
|
|
31
35
|
if (!this.$store)
|
|
32
|
-
throw new Error(
|
|
36
|
+
throw new Error(
|
|
37
|
+
'Vuex is required for default setValue() baseFilterMixin method',
|
|
38
|
+
);
|
|
33
39
|
return this.$store.dispatch(`${this.namespace}/SET_FILTER`, payload);
|
|
34
40
|
},
|
|
35
41
|
},
|
|
@@ -35,7 +35,9 @@ export default {
|
|
|
35
35
|
if (optsHaveLocale) {
|
|
36
36
|
return this.options.map((opt) => ({
|
|
37
37
|
...opt,
|
|
38
|
-
name: Array.isArray(opt.locale)
|
|
38
|
+
name: Array.isArray(opt.locale)
|
|
39
|
+
? this.$tc(...opt.locale)
|
|
40
|
+
: this.$t(opt.locale),
|
|
39
41
|
}));
|
|
40
42
|
}
|
|
41
43
|
return this.options;
|
|
@@ -60,7 +62,10 @@ export default {
|
|
|
60
62
|
newValue = newValue.concat(
|
|
61
63
|
value
|
|
62
64
|
.filter(
|
|
63
|
-
(val) =>
|
|
65
|
+
(val) =>
|
|
66
|
+
!this.localizedOptions.some(
|
|
67
|
+
(option) => val === option[this.storedProp],
|
|
68
|
+
),
|
|
64
69
|
)
|
|
65
70
|
.map((val) => ({ [this.storedProp]: val, name: val })),
|
|
66
71
|
);
|
|
@@ -69,7 +74,9 @@ export default {
|
|
|
69
74
|
/*
|
|
70
75
|
see comments above
|
|
71
76
|
*/
|
|
72
|
-
newValue = this.localizedOptions.find(
|
|
77
|
+
newValue = this.localizedOptions.find(
|
|
78
|
+
(option) => value === option[this.storedProp],
|
|
79
|
+
);
|
|
73
80
|
if (this.allowCustomValues) {
|
|
74
81
|
newValue = newValue || { [this.storedProp]: value, name: value };
|
|
75
82
|
}
|
|
@@ -24,13 +24,15 @@ export default {
|
|
|
24
24
|
|
|
25
25
|
restorePage() {
|
|
26
26
|
const defaultPage = 1;
|
|
27
|
-
const value =
|
|
27
|
+
const value =
|
|
28
|
+
+this.getValueFromQuery({ filterQuery: 'page' }) || defaultPage;
|
|
28
29
|
this.setPage(value);
|
|
29
30
|
},
|
|
30
31
|
|
|
31
32
|
restoreSize() {
|
|
32
33
|
const defaultSize = 10;
|
|
33
|
-
const value =
|
|
34
|
+
const value =
|
|
35
|
+
+this.getValueFromQuery({ filterQuery: 'size' }) || defaultSize;
|
|
34
36
|
this.setSize(value);
|
|
35
37
|
},
|
|
36
38
|
|
|
@@ -18,7 +18,8 @@ const getNextSortOrder = (sort) => {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const encodeSortQuery = ({ column, order }) =>
|
|
21
|
+
const encodeSortQuery = ({ column, order }) =>
|
|
22
|
+
`${sortToQueryAdapter(order)}${column.field}`;
|
|
22
23
|
|
|
23
24
|
const decodeSortQuery = ({ value }) => {
|
|
24
25
|
const sort = queryToSortAdapter(value.slice(0, 1));
|
|
@@ -27,7 +27,8 @@ export default class QueryFiltersStoreModule extends BaseStoreModule {
|
|
|
27
27
|
let newValue = value;
|
|
28
28
|
if (newValue) {
|
|
29
29
|
if (multiple && !Array.isArray(newValue)) newValue = [newValue];
|
|
30
|
-
} else if (newValue === null || newValue === undefined)
|
|
30
|
+
} else if (newValue === null || newValue === undefined)
|
|
31
|
+
newValue = defaultValue;
|
|
31
32
|
context.commit('SET_FILTER', { filter, value: newValue });
|
|
32
33
|
},
|
|
33
34
|
RESET_FILTERS: (context) => {
|
|
@@ -66,7 +66,10 @@ describe('QueryFiltersStoreModule actions', () => {
|
|
|
66
66
|
it('SET_FILTER: sets array value filter with null value to defaultValue', () => {
|
|
67
67
|
const filter = { filter: arrayFilter, value: null };
|
|
68
68
|
module.actions.SET_FILTER(context, filter);
|
|
69
|
-
expect(context.commit).toHaveBeenCalledWith('SET_FILTER', {
|
|
69
|
+
expect(context.commit).toHaveBeenCalledWith('SET_FILTER', {
|
|
70
|
+
filter: filter.filter,
|
|
71
|
+
value: [],
|
|
72
|
+
});
|
|
70
73
|
});
|
|
71
74
|
it('SET_FILTER: sets "false" value filter', () => {
|
|
72
75
|
const filter = { filter: valueFilter, value: false };
|
|
@@ -86,11 +89,15 @@ describe('QueryFiltersStoreModule mutations', () => {
|
|
|
86
89
|
const module = new QueryFiltersStoreModule().getModule();
|
|
87
90
|
it('correctly mutates state at RESET_FILTERS call', () => {
|
|
88
91
|
expect(
|
|
89
|
-
Object.values(state).every(
|
|
92
|
+
Object.values(state).every(
|
|
93
|
+
(filter) => filter.value === filter.defaultValue,
|
|
94
|
+
),
|
|
90
95
|
).toBeFalsy();
|
|
91
96
|
module.mutations.RESET_FILTERS(state);
|
|
92
97
|
expect(
|
|
93
|
-
Object.values(state).every(
|
|
98
|
+
Object.values(state).every(
|
|
99
|
+
(filter) => filter.value === filter.defaultValue,
|
|
100
|
+
),
|
|
94
101
|
).toBeTruthy();
|
|
95
102
|
});
|
|
96
103
|
});
|
|
@@ -8,7 +8,10 @@ import EmptyTableLight from '../_internals/assets/empty-table-light.svg';
|
|
|
8
8
|
import EmptyFiltersDark from '../_internals/assets/empty-filters-dark.svg';
|
|
9
9
|
import EmptyFiltersLight from '../_internals/assets/empty-filters-light.svg';
|
|
10
10
|
|
|
11
|
-
export const useTableEmpty = (
|
|
11
|
+
export const useTableEmpty = (
|
|
12
|
+
{ dataList, filters, error, isLoading },
|
|
13
|
+
overrides = {},
|
|
14
|
+
) => {
|
|
12
15
|
const store = useStore();
|
|
13
16
|
const { t } = useI18n();
|
|
14
17
|
|
|
@@ -98,11 +101,17 @@ export const useTableEmpty = ({ dataList, filters, error, isLoading }, overrides
|
|
|
98
101
|
const image = computed(() => {
|
|
99
102
|
switch (emptyCause.value) {
|
|
100
103
|
case EmptyCause.ERROR:
|
|
101
|
-
return darkMode?.value
|
|
104
|
+
return darkMode?.value
|
|
105
|
+
? merged.value.image.error.dark
|
|
106
|
+
: merged.value.image.error.light;
|
|
102
107
|
case EmptyCause.FILTERS:
|
|
103
|
-
return darkMode?.value
|
|
108
|
+
return darkMode?.value
|
|
109
|
+
? merged.value.image.filters.dark
|
|
110
|
+
: merged.value.image.filters.light;
|
|
104
111
|
case EmptyCause.EMPTY:
|
|
105
|
-
return darkMode?.value
|
|
112
|
+
return darkMode?.value
|
|
113
|
+
? merged.value.image.empty.dark
|
|
114
|
+
: merged.value.image.empty.light;
|
|
106
115
|
default:
|
|
107
116
|
return null;
|
|
108
117
|
}
|
|
@@ -7,17 +7,29 @@ export const useTableStore = (namespace) => {
|
|
|
7
7
|
|
|
8
8
|
const tableNamespace = `${namespace}/table`;
|
|
9
9
|
|
|
10
|
-
const dataList = computed(
|
|
10
|
+
const dataList = computed(
|
|
11
|
+
() => getNamespacedState(store.state, tableNamespace).dataList,
|
|
12
|
+
);
|
|
11
13
|
|
|
12
|
-
const selected = computed(
|
|
14
|
+
const selected = computed(
|
|
15
|
+
() => getNamespacedState(store.state, tableNamespace).selected,
|
|
16
|
+
);
|
|
13
17
|
|
|
14
|
-
const isLoading = computed(
|
|
18
|
+
const isLoading = computed(
|
|
19
|
+
() => getNamespacedState(store.state, tableNamespace).isLoading,
|
|
20
|
+
);
|
|
15
21
|
|
|
16
|
-
const headers = computed(
|
|
22
|
+
const headers = computed(
|
|
23
|
+
() => getNamespacedState(store.state, tableNamespace).headers,
|
|
24
|
+
);
|
|
17
25
|
|
|
18
|
-
const isNext = computed(
|
|
26
|
+
const isNext = computed(
|
|
27
|
+
() => getNamespacedState(store.state, tableNamespace).isNextPage,
|
|
28
|
+
);
|
|
19
29
|
|
|
20
|
-
const error = computed(
|
|
30
|
+
const error = computed(
|
|
31
|
+
() => getNamespacedState(store.state, tableNamespace).errors,
|
|
32
|
+
);
|
|
21
33
|
|
|
22
34
|
function loadData(payload) {
|
|
23
35
|
return store.dispatch(`${tableNamespace}/LOAD_DATA_LIST`, payload);
|
|
@@ -2,8 +2,7 @@ import {
|
|
|
2
2
|
queryToSortAdapter,
|
|
3
3
|
sortToQueryAdapter,
|
|
4
4
|
} from '../../../scripts/sortQueryAdapters.js';
|
|
5
|
-
import BaseStoreModule
|
|
6
|
-
from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
5
|
+
import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
7
6
|
import FilterEvent from '../../Filters/enums/FilterEvent.enum.js';
|
|
8
7
|
|
|
9
8
|
export default class TableStoreModule extends BaseStoreModule {
|
|
@@ -48,7 +47,8 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
48
47
|
|
|
49
48
|
actions = {
|
|
50
49
|
// FIXME: maybe move to filters module?
|
|
51
|
-
SET_FILTER: (context, payload) =>
|
|
50
|
+
SET_FILTER: (context, payload) =>
|
|
51
|
+
context.dispatch('filters/SET_FILTER', payload),
|
|
52
52
|
|
|
53
53
|
// FIXME: maybe move to filters module?
|
|
54
54
|
ON_FILTER_EVENT: async (context, { event, payload }) => {
|
|
@@ -67,14 +67,16 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
67
67
|
// FIXME: maybe move to filters module?
|
|
68
68
|
HANDLE_FILTERS_RESTORE: async (context, { fields, sort }) => {
|
|
69
69
|
if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
|
|
70
|
-
if (fields?.length)
|
|
70
|
+
if (fields?.length)
|
|
71
|
+
await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
|
|
71
72
|
return context.dispatch('LOAD_DATA_LIST');
|
|
72
73
|
},
|
|
73
74
|
|
|
74
75
|
// FIXME: maybe move to filters module?
|
|
75
76
|
HANDLE_FILTER_RESET: async (context, { fields, sort }) => {
|
|
76
77
|
if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
|
|
77
|
-
if (fields?.length)
|
|
78
|
+
if (fields?.length)
|
|
79
|
+
await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
|
|
78
80
|
return context.dispatch('LOAD_DATA_LIST');
|
|
79
81
|
},
|
|
80
82
|
|
|
@@ -112,17 +114,19 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
112
114
|
const nextSort = queryToSortAdapter(value?.slice(0, 1) || '');
|
|
113
115
|
const field = nextSort ? value.slice(1) : value;
|
|
114
116
|
|
|
115
|
-
const headers = context.state.headers.map(
|
|
116
|
-
|
|
117
|
+
const headers = context.state.headers.map(
|
|
118
|
+
({ sort: currentSort, ...header }) => {
|
|
119
|
+
let sort;
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (field) {
|
|
122
|
+
sort = field === header.field ? nextSort : currentSort;
|
|
123
|
+
} else {
|
|
124
|
+
sort = nextSort; // null
|
|
125
|
+
}
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
return { ...header, sort };
|
|
128
|
+
},
|
|
129
|
+
);
|
|
126
130
|
|
|
127
131
|
context.commit('SET', { path: 'headers', value: headers });
|
|
128
132
|
},
|
|
@@ -133,10 +137,13 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
133
137
|
|
|
134
138
|
const params = context.getters.GET_LIST_PARAMS(query);
|
|
135
139
|
try {
|
|
136
|
-
const { items = [], next = false } = await context.dispatch(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
const { items = [], next = false } = await context.dispatch(
|
|
141
|
+
'api/GET_LIST',
|
|
142
|
+
{
|
|
143
|
+
context,
|
|
144
|
+
params,
|
|
145
|
+
},
|
|
146
|
+
);
|
|
140
147
|
|
|
141
148
|
context.commit('SET', { path: 'dataList', value: items });
|
|
142
149
|
context.commit('SET', { path: 'isNextPage', value: next });
|
|
@@ -159,7 +166,10 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
159
166
|
});
|
|
160
167
|
},
|
|
161
168
|
|
|
162
|
-
PATCH_ITEM_PROPERTY: async (
|
|
169
|
+
PATCH_ITEM_PROPERTY: async (
|
|
170
|
+
context,
|
|
171
|
+
{ item: _item, index, prop, value },
|
|
172
|
+
) => {
|
|
163
173
|
const item = _item || context.state.dataList[index];
|
|
164
174
|
|
|
165
175
|
const { id, etag } = item;
|
|
@@ -198,7 +208,10 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
198
208
|
await context.dispatch('LOAD_DATA_LIST');
|
|
199
209
|
|
|
200
210
|
/* if no items on current page after DELETE, move to prev page [WTEL-3793] */
|
|
201
|
-
if (
|
|
211
|
+
if (
|
|
212
|
+
!context.state.dataList.length &&
|
|
213
|
+
context.getters.FILTERS.page > 1
|
|
214
|
+
) {
|
|
202
215
|
await context.dispatch('SET_FILTER', {
|
|
203
216
|
name: 'page',
|
|
204
217
|
value: context.getters.FILTERS.page - 1,
|
|
@@ -216,7 +229,9 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
216
229
|
},
|
|
217
230
|
|
|
218
231
|
DELETE_BULK: async (context, deleted) =>
|
|
219
|
-
Promise.allSettled(
|
|
232
|
+
Promise.allSettled(
|
|
233
|
+
deleted.map((item) => context.dispatch('DELETE_SINGLE', item)),
|
|
234
|
+
),
|
|
220
235
|
|
|
221
236
|
SET_SELECTED: (context, selected) => {
|
|
222
237
|
context.commit('SET', { path: 'selected', value: selected });
|
|
@@ -15,7 +15,10 @@ describe('TableStoreModule', () => {
|
|
|
15
15
|
|
|
16
16
|
const state = { headers };
|
|
17
17
|
|
|
18
|
-
expect(new TableStoreModule({}).getters.FIELDS(state)).toEqual([
|
|
18
|
+
expect(new TableStoreModule({}).getters.FIELDS(state)).toEqual([
|
|
19
|
+
'id',
|
|
20
|
+
'age',
|
|
21
|
+
]);
|
|
19
22
|
});
|
|
20
23
|
});
|
|
21
24
|
|
|
@@ -230,7 +233,9 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
230
233
|
value: ['surname'],
|
|
231
234
|
});
|
|
232
235
|
|
|
233
|
-
expect(store.getters['table/filters/GET_FILTER']('fields')).toEqual([
|
|
236
|
+
expect(store.getters['table/filters/GET_FILTER']('fields')).toEqual([
|
|
237
|
+
'surname',
|
|
238
|
+
]);
|
|
234
239
|
|
|
235
240
|
expect(store.getters['table/FIELDS']).toEqual(['id', 'included']);
|
|
236
241
|
|
|
@@ -220,7 +220,9 @@ export default class ApplicationsAccess {
|
|
|
220
220
|
constructor({ access, value } = { value: true }) {
|
|
221
221
|
/* if access, deeply merge with falsy values schema
|
|
222
222
|
if no access, "not configured => full permissions" */
|
|
223
|
-
this.access = access
|
|
223
|
+
this.access = access
|
|
224
|
+
? ApplicationsAccess.restore(access)
|
|
225
|
+
: applicationsAccess(value);
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
// minify schema for API sending
|
|
@@ -29,11 +29,15 @@ export default class UserinfoStoreModule extends BaseStoreModule {
|
|
|
29
29
|
getters = {
|
|
30
30
|
THIS_APP: (state) => state.thisApp,
|
|
31
31
|
// if no access[app] => accessed by default
|
|
32
|
-
CHECK_APP_ACCESS: (state) => (app) =>
|
|
32
|
+
CHECK_APP_ACCESS: (state) => (app) =>
|
|
33
|
+
!state.access[app] || state.access[app]?._enabled,
|
|
33
34
|
CHECK_OBJECT_ACCESS:
|
|
34
35
|
(state, getters) =>
|
|
35
36
|
({ name, route }) => {
|
|
36
|
-
if (
|
|
37
|
+
if (
|
|
38
|
+
!state.access[getters.THIS_APP] ||
|
|
39
|
+
!state.access[getters.THIS_APP]._enabled
|
|
40
|
+
)
|
|
37
41
|
return false;
|
|
38
42
|
if (route) return getters.CHECK_OBJECT_ACCESS_BY_ROUTE(route);
|
|
39
43
|
return getters.CHECK_OBJECT_ACCESS_BY_NAME(name);
|
|
@@ -41,8 +45,8 @@ export default class UserinfoStoreModule extends BaseStoreModule {
|
|
|
41
45
|
CHECK_OBJECT_ACCESS_BY_NAME: (state, getters) => (name) =>
|
|
42
46
|
state.access[getters.THIS_APP][name]?._enabled,
|
|
43
47
|
CHECK_OBJECT_ACCESS_BY_ROUTE: (state, getters) => (route) => {
|
|
44
|
-
const accessKey = Object.keys(state.access[getters.THIS_APP]).find(
|
|
45
|
-
route.name.includes(object),
|
|
48
|
+
const accessKey = Object.keys(state.access[getters.THIS_APP]).find(
|
|
49
|
+
(object) => route.name.includes(object),
|
|
46
50
|
);
|
|
47
51
|
return state.access[getters.THIS_APP][accessKey]?._enabled;
|
|
48
52
|
},
|
|
@@ -55,7 +59,9 @@ export default class UserinfoStoreModule extends BaseStoreModule {
|
|
|
55
59
|
GET_OBJECT_SCOPE_BY_NAME: (state) => (name) =>
|
|
56
60
|
Object.values(state.scope).find((object) => name === object.name),
|
|
57
61
|
GET_OBJECT_SCOPE_BY_ROUTE: (state) => (route) =>
|
|
58
|
-
Object.values(state.scope).find((object) =>
|
|
62
|
+
Object.values(state.scope).find((object) =>
|
|
63
|
+
route.name.includes(object.route),
|
|
64
|
+
),
|
|
59
65
|
HAS_READ_ACCESS: (state, getters) => (checkedObject) => {
|
|
60
66
|
if (!getters.CHECK_OBJECT_ACCESS(checkedObject)) return false;
|
|
61
67
|
if (state.permissions[Permissions.READ]) return true;
|
|
@@ -131,8 +137,14 @@ export default class UserinfoStoreModule extends BaseStoreModule {
|
|
|
131
137
|
try {
|
|
132
138
|
await context.dispatch('RESET_STATE');
|
|
133
139
|
const session = { ...defaultSession, ..._session };
|
|
134
|
-
const scope = await context.dispatch(
|
|
135
|
-
|
|
140
|
+
const scope = await context.dispatch(
|
|
141
|
+
'CONVERT_USER_SCOPE',
|
|
142
|
+
session.scope,
|
|
143
|
+
);
|
|
144
|
+
const permissions = await context.dispatch(
|
|
145
|
+
'CONVERT_USER_PERMISSIONS',
|
|
146
|
+
session.permissions,
|
|
147
|
+
);
|
|
136
148
|
context.commit('SET_SESSION', { ...session, scope, permissions });
|
|
137
149
|
await context.dispatch('SET_LOADING', false);
|
|
138
150
|
} catch (err) {
|
|
@@ -140,13 +152,17 @@ export default class UserinfoStoreModule extends BaseStoreModule {
|
|
|
140
152
|
}
|
|
141
153
|
},
|
|
142
154
|
|
|
143
|
-
LOGOUT: async (
|
|
155
|
+
LOGOUT: async (
|
|
156
|
+
context,
|
|
157
|
+
{ authUrl = import.meta.env.VITE_AUTH_URL } = {},
|
|
158
|
+
) => {
|
|
144
159
|
if (!authUrl) throw new Error('No authUrl for LOGOUT provided');
|
|
145
160
|
await userinfo.logout();
|
|
146
161
|
window.location.href = authUrl;
|
|
147
162
|
},
|
|
148
163
|
|
|
149
|
-
SET_APPLICATIONS_ACCESS: (context, access) =>
|
|
164
|
+
SET_APPLICATIONS_ACCESS: (context, access) =>
|
|
165
|
+
context.commit('SET_APPLICATIONS_ACCESS', access),
|
|
150
166
|
|
|
151
167
|
SET_LOADING: (context, isLoading) => {
|
|
152
168
|
context.commit('SET_LOADING', isLoading);
|
|
@@ -37,7 +37,8 @@ const breakpoint = reactive({
|
|
|
37
37
|
width: 0,
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
const getClientWidth = () =>
|
|
40
|
+
const getClientWidth = () =>
|
|
41
|
+
Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
41
42
|
|
|
42
43
|
const getClientHeight = () =>
|
|
43
44
|
Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
@@ -60,7 +60,10 @@ describe('Case converters', () => {
|
|
|
60
60
|
|
|
61
61
|
it('Camel-Snake Arrays', () => {
|
|
62
62
|
const camelArr = ['camelToSnake', { camelToSnake: { camelToSnake: null } }];
|
|
63
|
-
const snakeArr = [
|
|
63
|
+
const snakeArr = [
|
|
64
|
+
'camel_to_snake',
|
|
65
|
+
{ camel_to_snake: { camel_to_snake: null } },
|
|
66
|
+
];
|
|
64
67
|
expect(objCamelToSnake(camelArr)).toEqual(snakeArr);
|
|
65
68
|
expect(objSnakeToCamel(snakeArr)).toEqual(camelArr);
|
|
66
69
|
});
|
|
@@ -9,11 +9,15 @@ describe('updateObject', () => {
|
|
|
9
9
|
it('changes shallow value', () => {
|
|
10
10
|
const original = { jest: 'jest' };
|
|
11
11
|
const result = { jest: 'huest' };
|
|
12
|
-
expect(
|
|
12
|
+
expect(
|
|
13
|
+
updateObject({ obj: original, path: 'jest', value: 'huest' }),
|
|
14
|
+
).toEqual(result);
|
|
13
15
|
});
|
|
14
16
|
it('changes deep value', () => {
|
|
15
17
|
const original = { jest: { deep: 'jest' } };
|
|
16
18
|
const result = { jest: { deep: 'huest' } };
|
|
17
|
-
expect(
|
|
19
|
+
expect(
|
|
20
|
+
updateObject({ obj: original, path: 'jest.deep', value: 'huest' }),
|
|
21
|
+
).toEqual(result);
|
|
18
22
|
});
|
|
19
23
|
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export const snakeToCamel = (str) =>
|
|
2
|
-
str.replace(/([a-z])([_])([a-z])/g, (group, p1, p2, p3) =>
|
|
2
|
+
str.replace(/([a-z])([_])([a-z])/g, (group, p1, p2, p3) =>
|
|
3
|
+
[p1, p3.toUpperCase()].join(''),
|
|
4
|
+
);
|
|
3
5
|
|
|
4
6
|
export const camelToSnake = (str) =>
|
|
5
|
-
str.replace(/([a-z])([A-Z])/g, (group, p1, p2) =>
|
|
7
|
+
str.replace(/([a-z])([A-Z])/g, (group, p1, p2) =>
|
|
8
|
+
[p1, '_', p2.toLowerCase()].join(''),
|
|
9
|
+
);
|
|
6
10
|
|
|
7
11
|
export const kebabToCamel = (str) =>
|
|
8
12
|
str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', ''));
|
|
@@ -16,36 +20,40 @@ export const kebabToSnake = (str) =>
|
|
|
16
20
|
export const snakeToKebab = (str) =>
|
|
17
21
|
str.replace(/([-_][a-z])/g, (group) => group.replace('_', '-'));
|
|
18
22
|
|
|
19
|
-
const convertObject =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const convertObject =
|
|
24
|
+
({ self, converter }) =>
|
|
25
|
+
(obj, skipKeys) => {
|
|
26
|
+
if (!obj) return obj;
|
|
27
|
+
const newObj = {};
|
|
28
|
+
if (Array.isArray(obj)) {
|
|
29
|
+
return obj.map((value) => {
|
|
30
|
+
if (typeof value === 'object') {
|
|
31
|
+
return self(value, skipKeys);
|
|
32
|
+
}
|
|
33
|
+
if (typeof value === 'string') return converter(value);
|
|
34
|
+
return value; // number
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
Object.keys(obj).forEach((oldKey) => {
|
|
38
|
+
if (skipKeys.includes(oldKey)) {
|
|
39
|
+
newObj[oldKey] = obj[oldKey];
|
|
40
|
+
} else {
|
|
41
|
+
const newKey = converter(oldKey);
|
|
42
|
+
let value = obj[oldKey];
|
|
43
|
+
if (
|
|
44
|
+
Array.isArray(value) ||
|
|
45
|
+
(value !== null &&
|
|
46
|
+
value !== undefined &&
|
|
47
|
+
value.constructor === Object)
|
|
48
|
+
) {
|
|
49
|
+
value = self(value, skipKeys);
|
|
50
|
+
}
|
|
51
|
+
newObj[newKey] = value;
|
|
26
52
|
}
|
|
27
|
-
if (typeof value === 'string') return converter(value);
|
|
28
|
-
return value; // number
|
|
29
53
|
});
|
|
30
|
-
}
|
|
31
|
-
Object.keys(obj).forEach((oldKey) => {
|
|
32
|
-
if (skipKeys.includes(oldKey)) {
|
|
33
|
-
newObj[oldKey] = obj[oldKey];
|
|
34
|
-
} else {
|
|
35
|
-
const newKey = converter(oldKey);
|
|
36
|
-
let value = obj[oldKey];
|
|
37
|
-
if (
|
|
38
|
-
Array.isArray(value) ||
|
|
39
|
-
(value !== null && value !== undefined && value.constructor === Object)
|
|
40
|
-
) {
|
|
41
|
-
value = self(value, skipKeys);
|
|
42
|
-
}
|
|
43
|
-
newObj[newKey] = value;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
};
|
|
55
|
+
return newObj;
|
|
56
|
+
};
|
|
49
57
|
|
|
50
58
|
export const objSnakeToCamel = (obj, skipKeys = []) => {
|
|
51
59
|
return convertObject({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import ComponentSize from '../enums/ComponentSize/ComponentSize.enum.js';
|
|
2
2
|
|
|
3
3
|
export enum eComponentSize {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
XS = 'xs',
|
|
5
|
+
SM = 'sm',
|
|
6
|
+
MD = 'md',
|
|
7
|
+
LG = 'lg',
|
|
8
|
+
XL = 'xl',
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const numerics = Object.values(ComponentSize).reduce((nums, size, index) => {
|
|
@@ -67,6 +67,9 @@ export const greaterThen = (s1, s2) => {
|
|
|
67
67
|
* @param s2
|
|
68
68
|
* @returns {boolean}
|
|
69
69
|
*/
|
|
70
|
-
export const greaterOrEqual = (
|
|
70
|
+
export const greaterOrEqual = (
|
|
71
|
+
s1: eComponentSize,
|
|
72
|
+
s2: eComponentSize,
|
|
73
|
+
): boolean => {
|
|
71
74
|
return compareSize(s1, s2) >= 0;
|
|
72
75
|
};
|
package/src/scripts/debounce.js
CHANGED
package/src/scripts/index.js
CHANGED
|
@@ -4,14 +4,10 @@ import eventBus from './eventBus.js';
|
|
|
4
4
|
import isEmpty from './isEmpty.js';
|
|
5
5
|
import prettifyFileSize from './prettifyFileSize.js';
|
|
6
6
|
import prettifyTime from './prettifyTime.js';
|
|
7
|
-
import preventHiddenPageCallsDecorator
|
|
8
|
-
from './preventHiddenPageCallsDecorator.js';
|
|
7
|
+
import preventHiddenPageCallsDecorator from './preventHiddenPageCallsDecorator.js';
|
|
9
8
|
import saveAsJSON from './saveAsJSON.js';
|
|
10
9
|
import { wtlog } from './logger.js';
|
|
11
|
-
import {
|
|
12
|
-
sortToQueryAdapter,
|
|
13
|
-
queryToSortAdapter,
|
|
14
|
-
} from './sortQueryAdapters.js';
|
|
10
|
+
import { sortToQueryAdapter, queryToSortAdapter } from './sortQueryAdapters.js';
|
|
15
11
|
import updateObject from './updateObject.js';
|
|
16
12
|
import {
|
|
17
13
|
compareSize,
|
|
@@ -32,12 +28,10 @@ import {
|
|
|
32
28
|
objCamelToKebab,
|
|
33
29
|
} from './caseConverters.js';
|
|
34
30
|
|
|
35
|
-
|
|
36
31
|
export {
|
|
37
32
|
// sortQueryAdapters.js
|
|
38
33
|
sortToQueryAdapter,
|
|
39
34
|
queryToSortAdapter,
|
|
40
|
-
|
|
41
35
|
updateObject,
|
|
42
36
|
preventHiddenPageCallsDecorator,
|
|
43
37
|
saveAsJSON,
|
package/src/scripts/logger.js
CHANGED
|
@@ -6,8 +6,8 @@ const validateConfig = (config) => {
|
|
|
6
6
|
|
|
7
7
|
const logger =
|
|
8
8
|
(globalApp) =>
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
(type) =>
|
|
10
|
+
(...params) => {
|
|
11
11
|
if (validateConfig(params[0])) {
|
|
12
12
|
const config = params[0];
|
|
13
13
|
|
|
@@ -16,9 +16,9 @@ const logger =
|
|
|
16
16
|
const path = window?.location?.href || 'non-browser env';
|
|
17
17
|
|
|
18
18
|
return (...msgs) => {
|
|
19
|
-
|
|
19
|
+
const prependix = `@webitel/${app}:${entity}:${module}:`;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const appendix = `[${timestamp}][${path}]`;
|
|
22
22
|
|
|
23
23
|
return console[type](prependix, ...msgs, appendix);
|
|
24
24
|
};
|