@webitel/ui-sdk 0.1.11 → 0.1.112
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 +29 -29
- package/dist/img/plyr.svg +70 -0
- package/dist/img/svg-sprites/attach.svg +4 -0
- package/dist/img/svg-sprites/index.js +1 -0
- package/dist/img/svg-sprites/wt-icon.svg +880 -0
- package/dist/ui-sdk.common.js +8287 -4335
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +8287 -4335
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +3 -1
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +62 -41
- package/src/components/atoms/wt-badge/__tests__/WtBadge.spec.js +19 -0
- package/src/components/atoms/wt-badge/wt-badge.vue +23 -0
- package/src/components/atoms/wt-button/__tests__/WtButton.spec.js +29 -0
- package/src/components/atoms/wt-button/wt-button.vue +212 -0
- package/src/components/atoms/wt-divider/__tests__/WtDivider.spec.js +9 -0
- package/src/components/atoms/wt-divider/wt-divider.vue +25 -0
- package/src/components/atoms/wt-icon/__tests__/WtIcon.spec.js +24 -0
- package/src/components/atoms/wt-icon/wt-icon.vue +138 -0
- package/src/components/atoms/wt-indicator/__tests__/WtIndicator.spec.js +29 -0
- package/src/components/atoms/wt-indicator/wt-indicator.vue +81 -0
- package/src/components/atoms/wt-input-info/__tests__/WtInputInfo.spec.js +9 -0
- package/src/components/atoms/wt-input-info/wt-input-info.vue +35 -0
- package/src/components/atoms/wt-loader/__tests__/WtLoader.spec.js +9 -0
- package/src/components/atoms/wt-loader/_internals/wt-loader--md.vue +83 -0
- package/src/components/atoms/wt-loader/_internals/wt-loader--sm.vue +189 -0
- package/src/components/atoms/wt-loader/wt-loader.vue +34 -0
- package/src/components/atoms/wt-rounded-action/__tests__/WtRoundedAction.spec.js +20 -0
- package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +227 -0
- package/src/components/atoms/wt-tooltip/__tests__/WtTooltip.spec.js +29 -0
- package/src/components/atoms/wt-tooltip/wt-tooltip.vue +54 -0
- package/src/components/index.js +98 -0
- package/src/components/molecules/wt-checkbox/__tests__/WtCheckbox.spec.js +41 -0
- package/src/components/molecules/wt-checkbox/wt-checkbox.vue +175 -0
- package/src/components/molecules/wt-datepicker/__tests__/WtDatepicker.spec.js +28 -0
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +209 -0
- package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +67 -0
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +314 -0
- package/src/components/molecules/wt-icon-btn/__tests__/WtIconBtn.spec.js +31 -0
- package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +113 -0
- package/src/components/molecules/wt-input/__tests__/WtInput.spec.js +25 -0
- package/src/components/molecules/wt-input/wt-input.vue +316 -0
- package/src/components/molecules/wt-label/__tests__/WtLabel.spec.js +9 -0
- package/src/components/molecules/wt-label/wt-label.vue +87 -0
- package/src/components/molecules/wt-notification/__tests__/WtNotification.spec.js +21 -0
- package/src/components/molecules/wt-notification/wt-notification.vue +74 -0
- package/src/components/molecules/wt-popup/__tests__/WtPopup.spec.js +47 -0
- package/src/components/molecules/wt-popup/wt-popup.vue +130 -0
- package/src/components/molecules/wt-progress-bar/__tests__/WtProgressBar.spec.js +17 -0
- package/src/components/molecules/wt-progress-bar/wt-progress-bar.vue +80 -0
- package/src/components/molecules/wt-radio/__tests__/WtRadio.spec.js +42 -0
- package/src/components/molecules/wt-radio/wt-radio.vue +168 -0
- package/src/components/molecules/wt-search-bar/__tests__/WtSearchBar.spec.js +36 -0
- package/src/components/molecules/wt-search-bar/wt-search-bar.vue +203 -0
- package/src/components/molecules/wt-select/__tests__/WtSelect.spec.js +53 -0
- package/src/components/molecules/wt-select/wt-select.vue +492 -0
- package/src/components/molecules/wt-slider/__tests__/WtSlider.spec.js +9 -0
- package/src/components/molecules/wt-slider/wt-slider.vue +175 -0
- package/src/components/molecules/wt-switcher/__tests__/WtSwitcher.spec.js +31 -0
- package/src/components/molecules/wt-switcher/wt-switcher.vue +177 -0
- package/src/components/molecules/wt-tabs/__tests__/WtTabs.spec.js +36 -0
- package/src/components/molecules/wt-tabs/wt-tabs.vue +127 -0
- package/src/components/molecules/wt-tags-input/__tests__/WtTagsInput.spec.js +45 -0
- package/src/components/molecules/wt-tags-input/wt-tags-input.vue +295 -0
- package/src/components/molecules/wt-textarea/__tests__/WtTextarea.spec.js +46 -0
- package/src/components/molecules/wt-textarea/wt-textarea.vue +185 -0
- package/src/components/molecules/wt-time-input/__tests__/WtTimeInput.spec.js +25 -0
- package/src/components/molecules/wt-time-input/wt-time-input.vue +192 -0
- package/src/components/molecules/wt-timepicker/__tests__/WtTimepicker.spec.js +60 -0
- package/src/components/molecules/wt-timepicker/wt-timepicker.vue +176 -0
- package/src/components/organisms/wt-app-header/__tests__/WtAppHeader.spec.js +19 -0
- package/src/components/organisms/wt-app-header/__tests__/WtAppNavigator.spec.js +23 -0
- package/src/components/organisms/wt-app-header/__tests__/WtHeaderActions.spec.js +21 -0
- package/src/components/organisms/wt-app-header/wt-app-header.vue +23 -0
- package/src/components/organisms/wt-app-header/wt-app-navigator.vue +245 -0
- package/src/components/organisms/wt-app-header/wt-header-actions.vue +177 -0
- package/src/components/organisms/wt-error-page/__tests__/wt-error-page.spec.js +17 -0
- package/src/components/organisms/wt-error-page/wt-error-page.vue +104 -0
- package/src/components/organisms/wt-filters-panel-wrapper/__tests__/wt-filters-panel-wrapper.spec.js +24 -0
- package/src/components/organisms/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +146 -0
- package/src/components/organisms/wt-headline/__tests__/WtHeadline.spec.js +47 -0
- package/src/components/organisms/wt-headline/wt-headline.vue +46 -0
- package/src/components/organisms/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +64 -0
- package/src/components/organisms/wt-navigation-bar/wt-navigation-bar.vue +249 -0
- package/src/components/organisms/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +50 -0
- package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +71 -0
- package/src/components/organisms/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +33 -0
- package/src/components/organisms/wt-page-wrapper/wt-page-wrapper.vue +60 -0
- package/src/components/organisms/wt-pagination/__tests__/WtPagination.spec.js +38 -0
- package/src/components/organisms/wt-pagination/wt-pagination.vue +134 -0
- package/src/components/organisms/wt-player/__tests__/WtPlayer.spec.js +9 -0
- package/src/components/organisms/wt-player/wt-player.vue +116 -0
- package/src/components/organisms/wt-status-select/__tests__/WtStatusSelect.spec.js +25 -0
- package/src/components/organisms/wt-status-select/_internals/StatusOptions.lookup.js +24 -0
- package/src/components/organisms/wt-status-select/wt-status-select.vue +110 -0
- package/src/components/organisms/wt-table/__tests__/WtTable.spec.js +133 -0
- package/src/components/organisms/wt-table/__tests__/WtTableDeleteAction.spec.js +9 -0
- package/src/components/organisms/wt-table/__tests__/WtTableEditAction.spec.js +9 -0
- package/src/components/organisms/wt-table/_internals/getSortOrder.js +12 -0
- package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +18 -0
- package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +19 -0
- package/src/components/organisms/wt-table/wt-table.vue +241 -0
- package/src/components/organisms/wt-table-actions/__tests__/WtTableActions.spec.js +9 -0
- package/src/components/organisms/wt-table-actions/wt-table-actions.vue +90 -0
- package/src/components/organisms/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +31 -0
- package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +113 -0
- package/src/components/transitions/__tests__/ExpandTransition.spec.js +9 -0
- package/src/components/transitions/expand-transition.vue +70 -0
- package/src/css/colors/_colors.scss +151 -67
- package/src/css/components/_components.scss +38 -25
- package/src/css/components/atoms/wt-badge/_variables.scss +6 -5
- package/src/css/components/atoms/wt-badge/wt-badge.scss +36 -8
- package/src/css/components/atoms/wt-button/_variables.scss +46 -46
- package/src/css/components/atoms/wt-divider/_variables.scss +4 -4
- package/src/css/components/atoms/wt-icon/_variables.scss +7 -28
- package/src/css/components/atoms/wt-indicator/_variables.scss +18 -0
- package/src/css/components/atoms/wt-input-info/_variables.scss +6 -5
- package/src/css/components/atoms/wt-label/_variables.scss +4 -4
- package/src/css/components/atoms/wt-loader/_variables.scss +7 -7
- package/src/css/components/atoms/wt-rounded-action/_variables.scss +30 -0
- package/src/css/components/atoms/wt-tooltip/_variables.scss +9 -9
- package/src/css/components/molecules/wt-checkbox/_variables.scss +3 -3
- package/src/css/components/molecules/wt-datepicker/_variables.scss +19 -19
- package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +100 -100
- package/src/css/components/molecules/wt-datetimepicker/_variables.scss +11 -11
- package/src/css/components/molecules/wt-icon-btn/_variables.scss +2 -2
- package/src/css/components/molecules/wt-input/_variables.scss +5 -5
- package/src/css/components/molecules/wt-notification/_variables.scss +9 -9
- package/src/css/components/molecules/wt-popup/_variables.scss +11 -10
- package/src/css/components/molecules/wt-progress-bar/_variables.scss +11 -0
- package/src/css/components/molecules/wt-radio/_variables.scss +6 -6
- package/src/css/components/molecules/wt-search-bar/_variables.scss +3 -3
- package/src/css/components/molecules/wt-select/_variables.scss +24 -22
- package/src/css/components/molecules/wt-slider/_variables.scss +15 -0
- package/src/css/components/molecules/wt-switcher/_variables.scss +17 -14
- package/src/css/components/molecules/wt-tabs/_variables.scss +13 -13
- package/src/css/components/molecules/wt-tags-input/_variables.scss +25 -0
- package/src/css/components/molecules/wt-textarea/_variables.scss +4 -4
- package/src/css/components/molecules/wt-timepicker/_variables.scss +4 -3
- package/src/css/components/organisms/wt-app-header/_variables.scss +20 -0
- package/src/css/components/organisms/wt-headline/_variables.scss +7 -0
- package/src/css/components/organisms/wt-navigation-bar/_variables.scss +14 -0
- package/src/css/components/organisms/wt-notifications-bar/_variables.scss +7 -0
- package/src/css/components/organisms/wt-page-wrapper/_variables.scss +5 -0
- package/src/css/components/organisms/wt-pagination/_variables.scss +6 -6
- package/src/css/components/organisms/wt-status-select/_variables.scss +6 -0
- package/src/css/components/organisms/wt-table/_variables.scss +16 -0
- package/src/css/components/organisms/wt-table-actions/_variables.scss +4 -0
- package/src/css/display-helpers/_display-helpers.scss +21 -0
- package/src/css/fonts/_fonts.scss +9 -0
- package/src/css/main.scss +68 -65
- package/src/css/shadows/_shadows.scss +7 -0
- package/src/css/sizes/_sizes.scss +2 -0
- package/src/css/sizes/_spacing.scss +17 -0
- package/src/css/sizes/_viewport-breakpoints.scss +20 -0
- package/src/css/styleguide/{styleguide.scss → _styleguide.scss} +4 -3
- package/src/css/styleguide/scroll.scss +43 -40
- package/src/css/transitions/_transitions.scss +1 -0
- package/src/css/transitions/fade/_fade.scss +8 -0
- package/src/css/typography/_typography.scss +72 -72
- package/src/enums/AgentStatus/AgentStatus.enum.js +6 -0
- package/src/enums/WebitelApplications/AdminSections.enum.js +41 -0
- package/src/enums/WebitelApplications/SupervisorSections.enum.js +7 -0
- package/src/enums/WebitelApplications/WebitelApplications.enum.js +10 -0
- package/src/locale/en/en.js +135 -0
- package/src/locale/i18n.js +2 -0
- package/src/locale/ru/ru.js +135 -2
- package/src/locale/ua/ua.js +160 -0
- package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +57 -0
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +66 -0
- package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +93 -0
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +60 -0
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +48 -0
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +37 -0
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +23 -0
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +29 -0
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +30 -0
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +79 -0
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +75 -0
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +47 -0
- package/src/mixins/validationMixin/validationMixin.js +40 -0
- package/src/modules/CSVExport/CSVExport.js +88 -0
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +63 -0
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +46 -0
- package/src/modules/FilesExport/FilesExport.js +110 -0
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +66 -0
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +46 -0
- package/src/modules/FilesExport/scripts/generateMediaURL.js +7 -0
- package/src/modules/QueryFilters/api/__tests__/defaults.spec.js +18 -0
- package/src/modules/QueryFilters/api/defaults.js +16 -0
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +32 -0
- package/src/modules/QueryFilters/classes/BaseFilterSchema.js +6 -0
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +23 -0
- package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +25 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +54 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +40 -0
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +49 -0
- package/src/modules/QueryFilters/components/abstract-api-filter.vue +42 -0
- package/src/modules/QueryFilters/components/abstract-enum-filter.vue +32 -0
- package/src/modules/QueryFilters/components/filter-search.vue +33 -0
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +48 -0
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +54 -0
- package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +74 -0
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +58 -0
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +48 -0
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +39 -0
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +36 -0
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +34 -0
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +36 -0
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +66 -0
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +56 -0
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +50 -0
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +83 -0
- package/src/modules/QueryFilters/store/queryFilters.js +6 -0
- package/src/modules/Userinfo/api/BaseAPIService.js +7 -0
- package/src/modules/Userinfo/api/auth.js +29 -0
- package/src/modules/Userinfo/api/userinfo.js +32 -0
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +170 -0
- package/src/modules/Userinfo/components/__tests__/auth.spec.js +57 -0
- package/src/modules/Userinfo/components/the-auth.vue +75 -0
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +112 -0
- package/src/scripts/__tests__/caseConverters.spec.js +65 -0
- package/src/scripts/__tests__/convertDuration.spec.js +21 -0
- package/src/scripts/__tests__/debounce.spec.js +15 -0
- package/src/scripts/__tests__/editProxy.spec.js +9 -0
- package/src/scripts/__tests__/isEmpty.spec.js +16 -0
- package/src/scripts/__tests__/prettifyFileSize.spec.js +18 -0
- package/src/scripts/__tests__/prettifyTime.spec.js +18 -0
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +16 -0
- package/src/scripts/__tests__/sortQueryAdapters.spec.js +12 -0
- package/src/scripts/caseConverters.js +78 -0
- package/src/scripts/convertDuration.js +15 -0
- package/src/scripts/editProxy.js +9 -0
- package/src/scripts/eventBus.js +4 -0
- package/src/scripts/isEmpty.js +9 -0
- package/src/scripts/prettifyFileSize.js +11 -0
- package/src/scripts/prettifyTime.js +9 -0
- package/src/scripts/preventHiddenPageCallsDecorator.js +6 -0
- package/src/scripts/sortQueryAdapters.js +21 -0
- package/src/store/BaseStoreModules/BaseStoreModule.js +49 -0
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +104 -0
- package/src/store/helpers/__tests__/getNamespacedState.spec.js +11 -0
- package/src/store/helpers/getNamespacedState.js +5 -0
- package/dist/img/arrow-down--active--md.7b60f2fb6090366652124f77c543a516.svg +0 -3
- package/dist/img/arrow-down--disabled--md.f58424cd673258365e78863edd1e92cc.svg +0 -3
- package/dist/img/arrow-down--md.1843b60e1c244e066a650e8d19ea83c9.svg +0 -3
- package/dist/img/calendar--active--md.7fd3d949ec7234a4940ea452d95b4165.svg +0 -6
- package/dist/img/calendar--disabled--md.8e7a1e18f93ae8af270060400e6f881c.svg +0 -3
- package/dist/img/calendar--md.9c265581c3a405ff0f0e46e8092f36b8.svg +0 -6
- package/src/css/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/css/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/css/fonts.scss +0 -9
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const snakeToCamel = (str) => str.replace(
|
|
2
|
+
/([a-z])([_])([a-z])/g,
|
|
3
|
+
(group, p1, p2, p3) => [p1, p3.toUpperCase()].join(''),
|
|
4
|
+
);
|
|
5
|
+
|
|
6
|
+
export const camelToSnake = (str) => str.replace(
|
|
7
|
+
/([A-Z])/g,
|
|
8
|
+
(group) => group.toLowerCase()
|
|
9
|
+
.replace('', '_'),
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const kebabToCamel = (str) => str.replace(
|
|
13
|
+
/([-_][a-z])/g,
|
|
14
|
+
(group) => group.toUpperCase()
|
|
15
|
+
.replace('-', ''),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const camelToKebab = (str) => str.replace(
|
|
19
|
+
/([A-Z])/g,
|
|
20
|
+
(group) => group.toLowerCase()
|
|
21
|
+
.replace('', '-'),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const objSnakeToCamel = (obj, skipKeys = []) => {
|
|
25
|
+
if (!obj) return obj;
|
|
26
|
+
const newObj = {};
|
|
27
|
+
if (Array.isArray(obj)) {
|
|
28
|
+
return obj.map((value) => {
|
|
29
|
+
if (typeof value === 'object') {
|
|
30
|
+
return objSnakeToCamel(value, skipKeys);
|
|
31
|
+
} if (typeof value === 'string') return snakeToCamel(value);
|
|
32
|
+
return value; // number
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
Object.keys(obj)
|
|
36
|
+
.forEach((oldKey) => {
|
|
37
|
+
if (skipKeys.includes(oldKey)) {
|
|
38
|
+
newObj[oldKey] = obj[oldKey];
|
|
39
|
+
} else {
|
|
40
|
+
const newKey = snakeToCamel(oldKey);
|
|
41
|
+
let value = obj[oldKey];
|
|
42
|
+
if (Array.isArray(value) || (value !== null && value.constructor === Object)) {
|
|
43
|
+
value = objSnakeToCamel(value, skipKeys);
|
|
44
|
+
}
|
|
45
|
+
newObj[newKey] = value;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return newObj;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const objCamelToSnake = (obj, skipKeys = []) => {
|
|
53
|
+
if (!obj) return obj;
|
|
54
|
+
const newObj = {};
|
|
55
|
+
if (Array.isArray(obj)) {
|
|
56
|
+
return obj.map((value) => {
|
|
57
|
+
if (typeof value === 'object') {
|
|
58
|
+
return objCamelToSnake(value, skipKeys);
|
|
59
|
+
} if (typeof value === 'string') return camelToSnake(value);
|
|
60
|
+
return value; // number
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
Object.keys(obj)
|
|
64
|
+
.forEach((oldKey) => {
|
|
65
|
+
if (skipKeys.includes(oldKey)) {
|
|
66
|
+
newObj[oldKey] = obj[oldKey];
|
|
67
|
+
} else {
|
|
68
|
+
const newKey = camelToSnake(oldKey);
|
|
69
|
+
let value = obj[oldKey];
|
|
70
|
+
if (Array.isArray(value) || (value !== null && value.constructor === Object)) {
|
|
71
|
+
value = objCamelToSnake(value, skipKeys);
|
|
72
|
+
}
|
|
73
|
+
newObj[newKey] = value;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return newObj;
|
|
78
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const convertDuration = (duration) => {
|
|
2
|
+
if (!duration) return '00:00:00';
|
|
3
|
+
|
|
4
|
+
let hour = `${Math.floor(duration / 3600)}`;
|
|
5
|
+
let min = `${Math.floor((duration % 3600) / 60)}`;
|
|
6
|
+
let sec = `${Math.floor((duration % 3600) % 60)}`;
|
|
7
|
+
|
|
8
|
+
if (hour.length === 1) hour = `0${hour}`;
|
|
9
|
+
if (min.length === 1) min = `0${min}`;
|
|
10
|
+
if (sec.length === 1) sec = `0${sec}`;
|
|
11
|
+
|
|
12
|
+
return `${hour}:${min}:${sec}`;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default convertDuration;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// checks if value is Falsy,
|
|
2
|
+
// including empty arrays or objects
|
|
3
|
+
const isEmpty = (value) => {
|
|
4
|
+
if (Array.isArray(value)) return !value.length;
|
|
5
|
+
if (typeof value === 'object') return !value || !Object.keys(value).length;
|
|
6
|
+
return !value;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default isEmpty;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const prettifyFileSize = (size) => {
|
|
2
|
+
// eslint-disable-next-line no-param-reassign
|
|
3
|
+
if (typeof size === 'string') size = +size;
|
|
4
|
+
if (!size) return '0';
|
|
5
|
+
const k = 1024;
|
|
6
|
+
const sizes = ['b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb'];
|
|
7
|
+
const i = Math.floor(Math.log(size) / Math.log(k));
|
|
8
|
+
return `${parseFloat((size / k ** i).toFixed(2))} ${sizes[i]}`;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default prettifyFileSize;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const prettifyTime = (time) => {
|
|
2
|
+
let date;
|
|
3
|
+
if (time instanceof Date) date = time;
|
|
4
|
+
else if (typeof time === 'number') date = new Date(time);
|
|
5
|
+
else date = new Date(+time);
|
|
6
|
+
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default prettifyTime;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const SortSymbols = Object.freeze({
|
|
2
|
+
ASC: 'asc',
|
|
3
|
+
DESC: 'desc',
|
|
4
|
+
NONE: null,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export const sortToQueryAdapter = (order) => {
|
|
8
|
+
switch (order) {
|
|
9
|
+
case SortSymbols.ASC: return '+';
|
|
10
|
+
case SortSymbols.DESC: return '-';
|
|
11
|
+
default: return '';
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const queryToSortAdapter = (order) => {
|
|
16
|
+
switch (order) {
|
|
17
|
+
case '+': return SortSymbols.ASC;
|
|
18
|
+
case '-': return SortSymbols.DESC;
|
|
19
|
+
default: return SortSymbols.NONE;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default class BaseStoreModule {
|
|
2
|
+
state = {};
|
|
3
|
+
|
|
4
|
+
getters = {};
|
|
5
|
+
|
|
6
|
+
actions = {};
|
|
7
|
+
|
|
8
|
+
mutations = {};
|
|
9
|
+
|
|
10
|
+
modules = {};
|
|
11
|
+
|
|
12
|
+
attachAPIModule(APIModule) {
|
|
13
|
+
this._APIModule = APIModule;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
generateAPIActions() {
|
|
18
|
+
if (!this._APIModule) throw new ReferenceError('attach API module first!');
|
|
19
|
+
this.actions.GET_LIST = (context, params = {}) => this._APIModule.getList({ ...context.state, ...params });
|
|
20
|
+
this.actions.GET_ITEM = (context, params = {}) => this._APIModule.get({ ...context.state, ...params });
|
|
21
|
+
this.actions.POST_ITEM = (context) => this._APIModule.add(context.state);
|
|
22
|
+
this.actions.PATCH_ITEM = (context, { id, changes }) => (this._APIModule.patch({ ...context.state, id, changes }));
|
|
23
|
+
this.actions.UPD_ITEM = (context) => this._APIModule.update(context.state);
|
|
24
|
+
this.actions.DELETE_ITEM = (context, id) => this._APIModule.delete({ ...context.state, id });
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setChildModules(modules) {
|
|
29
|
+
this.modules = modules;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getModule({
|
|
34
|
+
state = {},
|
|
35
|
+
getters = {},
|
|
36
|
+
actions = {},
|
|
37
|
+
mutations = {},
|
|
38
|
+
namespaced = true,
|
|
39
|
+
} = {}) {
|
|
40
|
+
return {
|
|
41
|
+
namespaced,
|
|
42
|
+
state: { ...this.state, ...state },
|
|
43
|
+
getters: { ...this.getters, ...getters },
|
|
44
|
+
actions: { ...this.actions, ...actions },
|
|
45
|
+
mutations: { ...this.mutations, ...mutations },
|
|
46
|
+
modules: this.modules,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import BaseStoreModule from '../BaseStoreModule';
|
|
2
|
+
|
|
3
|
+
const APIModule = {
|
|
4
|
+
getList: jest.fn(),
|
|
5
|
+
get: jest.fn(),
|
|
6
|
+
add: jest.fn(),
|
|
7
|
+
update: jest.fn(),
|
|
8
|
+
patch: jest.fn(),
|
|
9
|
+
delete: jest.fn(),
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe('Base Store Module', () => {
|
|
13
|
+
let module;
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
module = new BaseStoreModule();
|
|
16
|
+
});
|
|
17
|
+
it('attaches api module and generates API actions from it', () => {
|
|
18
|
+
const _module = module
|
|
19
|
+
.attachAPIModule(APIModule)
|
|
20
|
+
.generateAPIActions()
|
|
21
|
+
.getModule();
|
|
22
|
+
expect(_module.actions.GET_LIST).toBeTruthy();
|
|
23
|
+
expect(_module.actions.GET_ITEM).toBeTruthy();
|
|
24
|
+
expect(_module.actions.POST_ITEM).toBeTruthy();
|
|
25
|
+
expect(_module.actions.PATCH_ITEM).toBeTruthy();
|
|
26
|
+
expect(_module.actions.UPD_ITEM).toBeTruthy();
|
|
27
|
+
expect(_module.actions.DELETE_ITEM).toBeTruthy();
|
|
28
|
+
});
|
|
29
|
+
it('generated GET_LIST correctly gets passed params', () => {
|
|
30
|
+
const state = { jest: 'jest' };
|
|
31
|
+
const params = { jest2: 'jest1' };
|
|
32
|
+
const context = { state };
|
|
33
|
+
const expectedParams = { jest: 'jest', jest2: 'jest1' };
|
|
34
|
+
const _module = module
|
|
35
|
+
.attachAPIModule(APIModule)
|
|
36
|
+
.generateAPIActions()
|
|
37
|
+
.getModule();
|
|
38
|
+
_module.actions.GET_LIST(context, params);
|
|
39
|
+
expect(APIModule.getList).toHaveBeenCalledWith(expectedParams);
|
|
40
|
+
});
|
|
41
|
+
it('generated GET_ITEM correctly gets passed params', () => {
|
|
42
|
+
const state = { jest: 'jest' };
|
|
43
|
+
const params = { jest2: 'jest1' };
|
|
44
|
+
const context = { state };
|
|
45
|
+
const expectedParams = { jest: 'jest', jest2: 'jest1' };
|
|
46
|
+
const _module = module
|
|
47
|
+
.attachAPIModule(APIModule)
|
|
48
|
+
.generateAPIActions()
|
|
49
|
+
.getModule();
|
|
50
|
+
_module.actions.GET_ITEM(context, params);
|
|
51
|
+
expect(APIModule.get).toHaveBeenCalledWith(expectedParams);
|
|
52
|
+
});
|
|
53
|
+
it('generated POST_ITEM correctly gets passed params', () => {
|
|
54
|
+
const state = { jest: 'jest' };
|
|
55
|
+
const context = { state };
|
|
56
|
+
const expectedParams = { jest: 'jest' };
|
|
57
|
+
const _module = module
|
|
58
|
+
.attachAPIModule(APIModule)
|
|
59
|
+
.generateAPIActions()
|
|
60
|
+
.getModule();
|
|
61
|
+
_module.actions.POST_ITEM(context);
|
|
62
|
+
expect(APIModule.add).toHaveBeenCalledWith(expectedParams);
|
|
63
|
+
});
|
|
64
|
+
it('generated PATCH_ITEM correctly gets passed params', () => {
|
|
65
|
+
const state = { jest: 'jest' };
|
|
66
|
+
const params = { id: '1', changes: { jest: 'my change!' } };
|
|
67
|
+
const context = { state };
|
|
68
|
+
const expectedParams = { jest: 'jest', id: '1', changes: { jest: 'my change!' } };
|
|
69
|
+
const _module = module
|
|
70
|
+
.attachAPIModule(APIModule)
|
|
71
|
+
.generateAPIActions()
|
|
72
|
+
.getModule();
|
|
73
|
+
_module.actions.PATCH_ITEM(context, params);
|
|
74
|
+
expect(APIModule.patch).toHaveBeenCalledWith(expectedParams);
|
|
75
|
+
});
|
|
76
|
+
it('generated UPD_ITEM correctly gets passed params', () => {
|
|
77
|
+
const state = { jest: 'jest' };
|
|
78
|
+
const context = { state };
|
|
79
|
+
const expectedParams = { jest: 'jest' };
|
|
80
|
+
const _module = module
|
|
81
|
+
.attachAPIModule(APIModule)
|
|
82
|
+
.generateAPIActions()
|
|
83
|
+
.getModule();
|
|
84
|
+
_module.actions.UPD_ITEM(context);
|
|
85
|
+
expect(APIModule.update).toHaveBeenCalledWith(expectedParams);
|
|
86
|
+
});
|
|
87
|
+
it('generated DELETE_ITEM correctly gets passed params', () => {
|
|
88
|
+
const state = { jest: 'jest' };
|
|
89
|
+
const params = '1';
|
|
90
|
+
const context = { state };
|
|
91
|
+
const expectedParams = { jest: 'jest', id: '1' };
|
|
92
|
+
const _module = module
|
|
93
|
+
.attachAPIModule(APIModule)
|
|
94
|
+
.generateAPIActions()
|
|
95
|
+
.getModule();
|
|
96
|
+
_module.actions.DELETE_ITEM(context, params);
|
|
97
|
+
expect(APIModule.delete).toHaveBeenCalledWith(expectedParams);
|
|
98
|
+
});
|
|
99
|
+
it('sets child modules', () => {
|
|
100
|
+
const jest = { state: 'jest' };
|
|
101
|
+
const _module = module.setChildModules({ jest }).getModule();
|
|
102
|
+
expect(_module.modules).toEqual({ jest });
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import getNamespacedState from '../getNamespacedState';
|
|
2
|
+
|
|
3
|
+
describe('getNamespacedState', () => {
|
|
4
|
+
const searchedValue = 'jest!';
|
|
5
|
+
const state = { lvl1: { lvl2: { lvl3: searchedValue } } };
|
|
6
|
+
|
|
7
|
+
it('correctly returns nested object values', () => {
|
|
8
|
+
const namespace = 'lvl1/lvl2/lvl3';
|
|
9
|
+
expect(getNamespacedState(state, namespace)).toBe(searchedValue);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M11.5049 14.7841L7.20524 10.2583C6.93159 9.97038 6.93159 9.5036 7.20524 9.21584C7.47865 8.92805 7.9221 8.92805 8.19549 9.21584L12.0001 13.2205L15.8045 9.21595C16.078 8.92817 16.5214 8.92817 16.7949 9.21595C17.0684 9.50374 17.0684 9.97049 16.7949 10.2584L12.4951 14.7842C12.3583 14.9281 12.1792 15 12.0001 15C11.8209 15 11.6417 14.928 11.5049 14.7841Z" fill="black"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M11.5049 14.7841L7.20524 10.2583C6.93159 9.97038 6.93159 9.5036 7.20524 9.21584C7.47865 8.92805 7.9221 8.92805 8.19549 9.21584L12.0001 13.2205L15.8045 9.21595C16.078 8.92817 16.5214 8.92817 16.7949 9.21595C17.0684 9.50374 17.0684 9.97049 16.7949 10.2584L12.4951 14.7842C12.3583 14.9281 12.1792 15 12.0001 15C11.8209 15 11.6417 14.928 11.5049 14.7841Z" fill="#EAEAEA"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M11.5049 14.7841L7.20524 10.2583C6.93159 9.97038 6.93159 9.5036 7.20524 9.21584C7.47865 8.92805 7.9221 8.92805 8.19549 9.21584L12.0001 13.2205L15.8045 9.21595C16.078 8.92817 16.5214 8.92817 16.7949 9.21595C17.0684 9.50374 17.0684 9.97049 16.7949 10.2584L12.4951 14.7842C12.3583 14.9281 12.1792 15 12.0001 15C11.8209 15 11.6417 14.928 11.5049 14.7841Z" fill="#ACACAC"/>
|
|
3
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 1.25C16.4142 1.25 16.75 1.58579 16.75 2V6C16.75 6.41421 16.4142 6.75 16 6.75C15.5858 6.75 15.25 6.41421 15.25 6V2C15.25 1.58579 15.5858 1.25 16 1.25Z" fill="black"/>
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1.25C8.41421 1.25 8.75 1.58579 8.75 2V6C8.75 6.41421 8.41421 6.75 8 6.75C7.58579 6.75 7.25 6.41421 7.25 6V2C7.25 1.58579 7.58579 1.25 8 1.25Z" fill="black"/>
|
|
4
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 9C2.25 8.58579 2.58579 8.25 3 8.25H21C21.4142 8.25 21.75 8.58579 21.75 9C21.75 9.41421 21.4142 9.75 21 9.75H3C2.58579 9.75 2.25 9.41421 2.25 9Z" fill="black"/>
|
|
5
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 6C2.25 4.48579 3.48579 3.25 5 3.25H19C20.5142 3.25 21.75 4.48579 21.75 6V19C21.75 20.5142 20.5142 21.75 19 21.75H5C3.48579 21.75 2.25 20.5142 2.25 19V6ZM5 4.75C4.31421 4.75 3.75 5.31421 3.75 6V19C3.75 19.6858 4.31421 20.25 5 20.25H19C19.6858 20.25 20.25 19.6858 20.25 19V6C20.25 5.31421 19.6858 4.75 19 4.75H5Z" fill="black"/>
|
|
6
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.75 2C8.75 1.58579 8.41421 1.25 8 1.25C7.58579 1.25 7.25 1.58579 7.25 2V3.25H5C3.48579 3.25 2.25 4.48579 2.25 6V19C2.25 20.5142 3.48579 21.75 5 21.75H19C20.5142 21.75 21.75 20.5142 21.75 19V6C21.75 4.48579 20.5142 3.25 19 3.25H16.75V2C16.75 1.58579 16.4142 1.25 16 1.25C15.5858 1.25 15.25 1.58579 15.25 2V3.25H8.75V2ZM7.25 4.75V6C7.25 6.41421 7.58579 6.75 8 6.75C8.41421 6.75 8.75 6.41421 8.75 6V4.75H15.25V6C15.25 6.41421 15.5858 6.75 16 6.75C16.4142 6.75 16.75 6.41421 16.75 6V4.75H19C19.6858 4.75 20.25 5.31421 20.25 6V8.25H3.75V6C3.75 5.31421 4.31421 4.75 5 4.75H7.25ZM3.75 9.75V19C3.75 19.6858 4.31421 20.25 5 20.25H19C19.6858 20.25 20.25 19.6858 20.25 19V9.75H3.75Z" fill="#EAEAEA"/>
|
|
3
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 1.25C16.4142 1.25 16.75 1.58579 16.75 2V6C16.75 6.41421 16.4142 6.75 16 6.75C15.5858 6.75 15.25 6.41421 15.25 6V2C15.25 1.58579 15.5858 1.25 16 1.25Z" fill="#808080"/>
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1.25C8.41421 1.25 8.75 1.58579 8.75 2V6C8.75 6.41421 8.41421 6.75 8 6.75C7.58579 6.75 7.25 6.41421 7.25 6V2C7.25 1.58579 7.58579 1.25 8 1.25Z" fill="#808080"/>
|
|
4
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 9C2.25 8.58579 2.58579 8.25 3 8.25H21C21.4142 8.25 21.75 8.58579 21.75 9C21.75 9.41421 21.4142 9.75 21 9.75H3C2.58579 9.75 2.25 9.41421 2.25 9Z" fill="#808080"/>
|
|
5
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 6C2.25 4.48579 3.48579 3.25 5 3.25H19C20.5142 3.25 21.75 4.48579 21.75 6V19C21.75 20.5142 20.5142 21.75 19 21.75H5C3.48579 21.75 2.25 20.5142 2.25 19V6ZM5 4.75C4.31421 4.75 3.75 5.31421 3.75 6V19C3.75 19.6858 4.31421 20.25 5 20.25H19C19.6858 20.25 20.25 19.6858 20.25 19V6C20.25 5.31421 19.6858 4.75 19 4.75H5Z" fill="#808080"/>
|
|
6
|
-
</svg>
|
|
Binary file
|
|
Binary file
|
package/src/css/fonts.scss
DELETED