@inriver/inri 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.eslintrc.js +5 -5
- package/azure/pipelines/single-build-release.yml +20 -0
- package/azure/pipelines/templates/deployFramework.yml +30 -0
- package/azure/pipelines/templates/publishFramwork.yml +39 -0
- package/componentProperties.d.ts +8 -8
- package/configs/base-eslint-config.js +36 -36
- package/configs/base-tailwind-config.js +149 -149
- package/i18n.ts +11 -11
- package/index.ts +29 -29
- package/package.json +7 -2
- package/src/components/CAutoBreadcrumbs.vue +72 -72
- package/src/components/CBtn.vue +98 -98
- package/src/components/CColorPicker.vue +55 -55
- package/src/components/CContextMenu.vue +29 -29
- package/src/components/CDatePicker.vue +51 -51
- package/src/components/CDeleteTileBtn.vue +52 -52
- package/src/components/CDialog.vue +253 -253
- package/src/components/CDialogCloseBtn.vue +9 -9
- package/src/components/CDirtyCheck.vue +68 -68
- package/src/components/CDrawer.vue +44 -44
- package/src/components/CDrawerButton.vue +91 -91
- package/src/components/CExpansionItem.vue +57 -57
- package/src/components/CExpansionItemWithCheckbox.vue +41 -41
- package/src/components/CFileDropzone.vue +114 -114
- package/src/components/CGrid.vue +101 -101
- package/src/components/CHeader.vue +10 -10
- package/src/components/CHeaderLinks.vue +61 -61
- package/src/components/CHeaderMenuLink.vue +51 -51
- package/src/components/CHeaderSearch.vue +142 -142
- package/src/components/CIconBtn.vue +70 -70
- package/src/components/CMenuItem.vue +66 -66
- package/src/components/CPageContainer.vue +11 -11
- package/src/components/CPageError.vue +24 -24
- package/src/components/CPageSpinner.vue +18 -18
- package/src/components/CSearch.vue +45 -45
- package/src/components/CSection.vue +29 -29
- package/src/components/CSectionTitle.vue +8 -8
- package/src/components/CSelect.vue +208 -208
- package/src/components/CSlideEffect.vue +62 -62
- package/src/components/CSpinner.vue +107 -107
- package/src/components/CTableActions.vue +16 -16
- package/src/components/CTileBtn.vue +178 -178
- package/src/components/CTimePicker.vue +42 -42
- package/src/components/CToggleGridView.vue +26 -26
- package/src/components/CToggleSidebarBtn.vue +19 -19
- package/src/components/CTooltip.vue +44 -44
- package/src/components/CTreeNode.vue +39 -39
- package/src/components/cards/CBannerCard.vue +103 -103
- package/src/components/cards/CSmallCard.vue +149 -149
- package/src/components/internal-components/ConfirmDialog.vue +78 -78
- package/src/composables/useDialog.ts +46 -46
- package/src/composables/useDirtyCheck.ts +25 -25
- package/src/composables/useDoubleClickListener.ts +28 -28
- package/src/composables/useSelectable.ts +62 -62
- package/src/composables/useTruncateChips.ts +46 -46
- package/src/i18n/de/index.ts +17 -17
- package/src/i18n/en/index.ts +84 -84
- package/src/i18n/es/index.ts +7 -7
- package/src/i18n/fr/index.ts +7 -7
- package/src/init/initInriFramework.ts +37 -37
- package/src/init/useInriApp.ts +55 -55
- package/src/layouts/CLayoutBlank.vue +7 -7
- package/src/layouts/CLayoutWithBackButton.vue +50 -50
- package/src/layouts/CLayoutWithSidebars.vue +46 -46
- package/src/layouts/layout-fragments/CPageAutoBreadcrumbs.vue +6 -6
- package/src/layouts/layout-fragments/CPageBackButton.vue +18 -18
- package/src/layouts/layout-fragments/CPageBlank.vue +20 -20
- package/src/layouts/layout-fragments/CPageFlexCol.vue +5 -5
- package/src/layouts/layout-fragments/CPageLeftSidebar.vue +5 -5
- package/src/layouts/layout-fragments/CPageMainContent.vue +5 -5
- package/src/layouts/layout-fragments/CPageOuterWrapper.vue +5 -5
- package/src/layouts/layout-fragments/CPageRightSidebar.vue +5 -5
- package/src/layouts/layout-fragments/CPageTitle.vue +34 -34
- package/src/plugins/dialog.ts +45 -45
- package/src/plugins/errors/ErrorFactories.ts +59 -59
- package/src/plugins/errors/Errors.ts +156 -156
- package/src/plugins/errors/Exception.ts +6 -6
- package/src/plugins/errors/globalErrorHandler.ts +21 -21
- package/src/plugins/errors/handleError.ts +34 -34
- package/src/plugins/errors/logger.ts +16 -16
- package/src/plugins/errors/vueErrorHandler.ts +26 -26
- package/src/plugins/globalAppConfig.ts +25 -25
- package/src/plugins/i18n.ts +46 -46
- package/src/plugins/inriIcons.ts +58 -58
- package/src/plugins/inriverQuasarComponentConfigurations.ts +67 -67
- package/src/plugins/library.ts +119 -119
- package/src/plugins/notify.ts +153 -153
- package/src/plugins/quasar-user-options.ts +19 -19
- package/src/plugins/validationRules.ts +292 -292
- package/src/shims-vue.d.ts +6 -6
- package/src/stores/inriStore.ts +54 -54
- package/src/stores/interfaceLanguageStore.ts +27 -27
- package/src/styles/_css-variables.scss +101 -101
- package/src/styles/_reset.scss +67 -67
- package/src/styles/_transitions.scss +9 -9
- package/src/styles/_utils.scss +15 -15
- package/src/styles/components/_breadcrumbs.scss +3 -3
- package/src/styles/components/_checkboxes.scss +17 -17
- package/src/styles/components/_chips.scss +17 -17
- package/src/styles/components/_forms.scss +203 -203
- package/src/styles/components/_menu.scss +12 -12
- package/src/styles/components/_notifications.scss +24 -24
- package/src/styles/components/_q-editor.scss +14 -14
- package/src/styles/components/_radio-buttons.scss +17 -17
- package/src/styles/components/_tables.scss +92 -92
- package/src/styles/components/_tooltips.scss +5 -5
- package/src/styles/components/_tree.scss +86 -86
- package/src/styles/components/_truncated-chips.scss +39 -39
- package/src/styles/main.scss +45 -45
- package/src/styles/quasar.variables.scss +50 -50
- package/src/styles/tailwind/index.css +2 -2
- package/src/typings.d.ts +70 -70
- package/src/utils/colorUtils.ts +73 -73
- package/src/utils/errorUtils.ts +37 -37
- package/src/utils/fileUtils.ts +57 -57
- package/src/utils/helpers.ts +6 -6
- package/src/utils/routeUtils.ts +23 -23
- package/tsconfig.json +34 -34
package/src/typings.d.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
interface Components {
|
|
2
|
-
CBannerCard: typeof import('./components/cards/CBannerCard.vue')['default'],
|
|
3
|
-
CSmallCard: typeof import('./components/cards/CSmallCard.vue')['default'],
|
|
4
|
-
ConfirmDialog: typeof import('./components/internal-components/ConfirmDialog.vue')['default'],
|
|
5
|
-
CAutoBreadcrumbs: typeof import('./components/CAutoBreadcrumbs.vue')['default'],
|
|
6
|
-
CBtn: typeof import('./components/CBtn.vue')['default'],
|
|
7
|
-
CColorPicker: typeof import('./components/CColorPicker.vue')['default'],
|
|
8
|
-
CContextMenu: typeof import('./components/CContextMenu.vue')['default'],
|
|
9
|
-
CDatePicker: typeof import('./components/CDatePicker.vue')['default'],
|
|
10
|
-
CDialog: typeof import('./components/CDialog.vue')['default'],
|
|
11
|
-
CDialogCloseBtn: typeof import('./components/CDialogCloseBtn.vue')['default'],
|
|
12
|
-
CDirtyCheck: typeof import('./components/CDirtyCheck.vue')['default'],
|
|
13
|
-
CDrawer: typeof import('./components/CDrawer.vue')['default'],
|
|
14
|
-
CDrawerButton: typeof import('./components/CDrawerButton.vue')['default'],
|
|
15
|
-
CExpansionItem: typeof import('./components/CExpansionItem.vue')['default'],
|
|
16
|
-
CExpansionItemWithCheckbox: typeof import('./components/CExpansionItemWithCheckbox.vue')['default'],
|
|
17
|
-
CGrid: typeof import('./components/CGrid.vue')['default'],
|
|
18
|
-
CHeader: typeof import('./components/CHeader.vue')['default'],
|
|
19
|
-
CHeaderLinks: typeof import('./components/CHeaderLinks.vue')['default'],
|
|
20
|
-
CHeaderMenuLink: typeof import('./components/CHeaderMenuLink.vue')['default'],
|
|
21
|
-
CHeaderSearch: typeof import('./components/CHeaderSearch.vue')['default'],
|
|
22
|
-
CIconBtn: typeof import('./components/CIconBtn.vue')['default'],
|
|
23
|
-
CMenuItem: typeof import('./components/CMenuItem.vue')['default'],
|
|
24
|
-
CPageContainer: typeof import('./components/CPageContainer.vue')['default'],
|
|
25
|
-
CPageError: typeof import('./components/CPageError.vue')['default'],
|
|
26
|
-
CPageSpinner: typeof import('./components/CPageSpinner.vue')['default'],
|
|
27
|
-
CSearch: typeof import('./components/CSearch.vue')['default'],
|
|
28
|
-
CSection: typeof import('./components/CSection.vue')['default'],
|
|
29
|
-
CSectionTitle: typeof import('./components/CSectionTitle.vue')['default'],
|
|
30
|
-
CSelect: typeof import('./components/CSelect.vue')['default'],
|
|
31
|
-
CSlideEffect: typeof import('./components/CSlideEffect.vue')['default'],
|
|
32
|
-
CSpinner: typeof import('./components/CSpinner.vue')['default'],
|
|
33
|
-
CTableActions: typeof import('./components/CTableActions.vue')['default'],
|
|
34
|
-
CTileBtn: typeof import('./components/CTileBtn.vue')['default'],
|
|
35
|
-
CTimePicker: typeof import('./components/CTimePicker.vue')['default'],
|
|
36
|
-
CToggleGridView: typeof import('./components/CToggleGridView.vue')['default'],
|
|
37
|
-
CToggleSidebarBtn: typeof import('./components/CToggleSidebarBtn.vue')['default'],
|
|
38
|
-
CTooltip: typeof import('./components/CTooltip.vue')['default'],
|
|
39
|
-
CTreeNode: typeof import('./components/CTreeNode.vue')['default'],
|
|
40
|
-
CDeleteTileBtn: typeof import('./components/CDeleteTileBtn.vue')['default'],
|
|
41
|
-
CFileDropzone: typeof import('./components/CFileDropzone.vue')['default'],
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface Layouts {
|
|
45
|
-
CLayoutBlank: typeof import('./layouts/CLayoutBlank.vue')['default'],
|
|
46
|
-
CLayoutWithBackButton: typeof import('./layouts/CLayoutWithBackButton.vue')['default'],
|
|
47
|
-
CLayoutWithSidebars: typeof import('./layouts/CLayoutWithSidebars.vue')['default'],
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface LayoutFragments {
|
|
51
|
-
CPageAutoBreadcrumbs: typeof import('./layouts/layout-fragments/CPageAutoBreadcrumbs.vue')['default'],
|
|
52
|
-
CPageBackButton: typeof import('./layouts/layout-fragments/CPageBackButton.vue')['default'],
|
|
53
|
-
CPageBlank: typeof import('./layouts/layout-fragments/CPageBlank.vue')['default'],
|
|
54
|
-
CPageFlexCol: typeof import('./layouts/layout-fragments/CPageFlexCol.vue')['default'],
|
|
55
|
-
CPageLeftSidebar: typeof import('./layouts/layout-fragments/CPageLeftSidebar.vue')['default'],
|
|
56
|
-
CPageMainContent: typeof import('./layouts/layout-fragments/CPageMainContent.vue')['default'],
|
|
57
|
-
CPageOuterWrapper: typeof import('./layouts/layout-fragments/CPageOuterWrapper.vue')['default'],
|
|
58
|
-
CPageRightSidebar: typeof import('./layouts/layout-fragments/CPageRightSidebar.vue')['default'],
|
|
59
|
-
CPageTitle: typeof import('./layouts/layout-fragments/CPageTitle.vue')['default'],
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface GlobalComponents extends Components, Layouts, LayoutFragments {}
|
|
63
|
-
|
|
64
|
-
export interface ComponentCustomProperties {
|
|
65
|
-
$validate: typeof import('./plugins/validationRules')['rules'],
|
|
66
|
-
$notify: typeof import('./plugins/notify')['default'],
|
|
67
|
-
$dialog: typeof import('./plugins/dialog')['default'],
|
|
68
|
-
$colors: typeof import('./utils/colorUtils')['colors'],
|
|
69
|
-
$inri: typeof import('./plugins/inriverQuasarComponentConfigurations')['quasarComponentConfigurations'],
|
|
70
|
-
}
|
|
1
|
+
interface Components {
|
|
2
|
+
CBannerCard: typeof import('./components/cards/CBannerCard.vue')['default'],
|
|
3
|
+
CSmallCard: typeof import('./components/cards/CSmallCard.vue')['default'],
|
|
4
|
+
ConfirmDialog: typeof import('./components/internal-components/ConfirmDialog.vue')['default'],
|
|
5
|
+
CAutoBreadcrumbs: typeof import('./components/CAutoBreadcrumbs.vue')['default'],
|
|
6
|
+
CBtn: typeof import('./components/CBtn.vue')['default'],
|
|
7
|
+
CColorPicker: typeof import('./components/CColorPicker.vue')['default'],
|
|
8
|
+
CContextMenu: typeof import('./components/CContextMenu.vue')['default'],
|
|
9
|
+
CDatePicker: typeof import('./components/CDatePicker.vue')['default'],
|
|
10
|
+
CDialog: typeof import('./components/CDialog.vue')['default'],
|
|
11
|
+
CDialogCloseBtn: typeof import('./components/CDialogCloseBtn.vue')['default'],
|
|
12
|
+
CDirtyCheck: typeof import('./components/CDirtyCheck.vue')['default'],
|
|
13
|
+
CDrawer: typeof import('./components/CDrawer.vue')['default'],
|
|
14
|
+
CDrawerButton: typeof import('./components/CDrawerButton.vue')['default'],
|
|
15
|
+
CExpansionItem: typeof import('./components/CExpansionItem.vue')['default'],
|
|
16
|
+
CExpansionItemWithCheckbox: typeof import('./components/CExpansionItemWithCheckbox.vue')['default'],
|
|
17
|
+
CGrid: typeof import('./components/CGrid.vue')['default'],
|
|
18
|
+
CHeader: typeof import('./components/CHeader.vue')['default'],
|
|
19
|
+
CHeaderLinks: typeof import('./components/CHeaderLinks.vue')['default'],
|
|
20
|
+
CHeaderMenuLink: typeof import('./components/CHeaderMenuLink.vue')['default'],
|
|
21
|
+
CHeaderSearch: typeof import('./components/CHeaderSearch.vue')['default'],
|
|
22
|
+
CIconBtn: typeof import('./components/CIconBtn.vue')['default'],
|
|
23
|
+
CMenuItem: typeof import('./components/CMenuItem.vue')['default'],
|
|
24
|
+
CPageContainer: typeof import('./components/CPageContainer.vue')['default'],
|
|
25
|
+
CPageError: typeof import('./components/CPageError.vue')['default'],
|
|
26
|
+
CPageSpinner: typeof import('./components/CPageSpinner.vue')['default'],
|
|
27
|
+
CSearch: typeof import('./components/CSearch.vue')['default'],
|
|
28
|
+
CSection: typeof import('./components/CSection.vue')['default'],
|
|
29
|
+
CSectionTitle: typeof import('./components/CSectionTitle.vue')['default'],
|
|
30
|
+
CSelect: typeof import('./components/CSelect.vue')['default'],
|
|
31
|
+
CSlideEffect: typeof import('./components/CSlideEffect.vue')['default'],
|
|
32
|
+
CSpinner: typeof import('./components/CSpinner.vue')['default'],
|
|
33
|
+
CTableActions: typeof import('./components/CTableActions.vue')['default'],
|
|
34
|
+
CTileBtn: typeof import('./components/CTileBtn.vue')['default'],
|
|
35
|
+
CTimePicker: typeof import('./components/CTimePicker.vue')['default'],
|
|
36
|
+
CToggleGridView: typeof import('./components/CToggleGridView.vue')['default'],
|
|
37
|
+
CToggleSidebarBtn: typeof import('./components/CToggleSidebarBtn.vue')['default'],
|
|
38
|
+
CTooltip: typeof import('./components/CTooltip.vue')['default'],
|
|
39
|
+
CTreeNode: typeof import('./components/CTreeNode.vue')['default'],
|
|
40
|
+
CDeleteTileBtn: typeof import('./components/CDeleteTileBtn.vue')['default'],
|
|
41
|
+
CFileDropzone: typeof import('./components/CFileDropzone.vue')['default'],
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface Layouts {
|
|
45
|
+
CLayoutBlank: typeof import('./layouts/CLayoutBlank.vue')['default'],
|
|
46
|
+
CLayoutWithBackButton: typeof import('./layouts/CLayoutWithBackButton.vue')['default'],
|
|
47
|
+
CLayoutWithSidebars: typeof import('./layouts/CLayoutWithSidebars.vue')['default'],
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface LayoutFragments {
|
|
51
|
+
CPageAutoBreadcrumbs: typeof import('./layouts/layout-fragments/CPageAutoBreadcrumbs.vue')['default'],
|
|
52
|
+
CPageBackButton: typeof import('./layouts/layout-fragments/CPageBackButton.vue')['default'],
|
|
53
|
+
CPageBlank: typeof import('./layouts/layout-fragments/CPageBlank.vue')['default'],
|
|
54
|
+
CPageFlexCol: typeof import('./layouts/layout-fragments/CPageFlexCol.vue')['default'],
|
|
55
|
+
CPageLeftSidebar: typeof import('./layouts/layout-fragments/CPageLeftSidebar.vue')['default'],
|
|
56
|
+
CPageMainContent: typeof import('./layouts/layout-fragments/CPageMainContent.vue')['default'],
|
|
57
|
+
CPageOuterWrapper: typeof import('./layouts/layout-fragments/CPageOuterWrapper.vue')['default'],
|
|
58
|
+
CPageRightSidebar: typeof import('./layouts/layout-fragments/CPageRightSidebar.vue')['default'],
|
|
59
|
+
CPageTitle: typeof import('./layouts/layout-fragments/CPageTitle.vue')['default'],
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GlobalComponents extends Components, Layouts, LayoutFragments {}
|
|
63
|
+
|
|
64
|
+
export interface ComponentCustomProperties {
|
|
65
|
+
$validate: typeof import('./plugins/validationRules')['rules'],
|
|
66
|
+
$notify: typeof import('./plugins/notify')['default'],
|
|
67
|
+
$dialog: typeof import('./plugins/dialog')['default'],
|
|
68
|
+
$colors: typeof import('./utils/colorUtils')['colors'],
|
|
69
|
+
$inri: typeof import('./plugins/inriverQuasarComponentConfigurations')['quasarComponentConfigurations'],
|
|
70
|
+
}
|
package/src/utils/colorUtils.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
interface RelatedColors {
|
|
2
|
-
onColor: string,
|
|
3
|
-
onAltColor?: string,
|
|
4
|
-
effectColor: string,
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const baseColors = ['primary', 'secondary', 'accent', 'surface']
|
|
8
|
-
export const blackAndWhiteColors = ['black', 'white']
|
|
9
|
-
export const spotColors = ['blue', 'purple', 'red', 'orange', 'yellow', 'green']
|
|
10
|
-
export const lightColors = ['blue-light', 'purple-light', 'red-light', 'orange-light', 'yellow-light', 'green-light']
|
|
11
|
-
export const greyColors = ['grey-darkest', 'grey-darker', 'grey-dark', 'grey', 'grey-light', 'grey-lighter']
|
|
12
|
-
|
|
13
|
-
export const colors = {
|
|
14
|
-
baseColors,
|
|
15
|
-
blackAndWhiteColors,
|
|
16
|
-
spotColors,
|
|
17
|
-
lightColors,
|
|
18
|
-
greyColors,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const getRelatedColors = (color): RelatedColors | null => {
|
|
22
|
-
if (color === 'primary') {
|
|
23
|
-
return {
|
|
24
|
-
onColor: 'on-primary',
|
|
25
|
-
onAltColor: 'on-primary-alt',
|
|
26
|
-
effectColor: 'primary-effect',
|
|
27
|
-
} as RelatedColors
|
|
28
|
-
} else if (color === 'secondary') {
|
|
29
|
-
return {
|
|
30
|
-
onColor: 'on-secondary',
|
|
31
|
-
onAltColor: 'on-secondary-alt',
|
|
32
|
-
effectColor: 'secondary-effect',
|
|
33
|
-
} as RelatedColors
|
|
34
|
-
} else if (color === 'accent') {
|
|
35
|
-
return {
|
|
36
|
-
onColor: 'on-accent',
|
|
37
|
-
onAltColor: 'on-accent-alt',
|
|
38
|
-
effectColor: 'accent-effect',
|
|
39
|
-
} as RelatedColors
|
|
40
|
-
} else if (color === 'surface') {
|
|
41
|
-
return {
|
|
42
|
-
onColor: 'on-surface',
|
|
43
|
-
effectColor: 'surface-effect',
|
|
44
|
-
} as RelatedColors
|
|
45
|
-
} else if (spotColors.includes(color)) {
|
|
46
|
-
return {
|
|
47
|
-
onColor: 'grey-darkest',
|
|
48
|
-
effectColor: `${color}-light`,
|
|
49
|
-
} as RelatedColors
|
|
50
|
-
} else if (color === 'black') {
|
|
51
|
-
return {
|
|
52
|
-
onColor: 'white',
|
|
53
|
-
effectColor: 'grey-darker',
|
|
54
|
-
} as RelatedColors
|
|
55
|
-
} else if (color === 'white') {
|
|
56
|
-
return {
|
|
57
|
-
onColor: 'grey-darkest',
|
|
58
|
-
effectColor: 'grey-lighter',
|
|
59
|
-
} as RelatedColors
|
|
60
|
-
} else if (color === 'grey-lighter') {
|
|
61
|
-
return {
|
|
62
|
-
onColor: 'grey-darkest',
|
|
63
|
-
effectColor: 'grey-light',
|
|
64
|
-
} as RelatedColors
|
|
65
|
-
} else if (color.endsWith('-light')) {
|
|
66
|
-
return {
|
|
67
|
-
onColor: 'grey-darkest',
|
|
68
|
-
effectColor: color.replace('-light', ''),
|
|
69
|
-
} as RelatedColors
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return null
|
|
73
|
-
}
|
|
1
|
+
interface RelatedColors {
|
|
2
|
+
onColor: string,
|
|
3
|
+
onAltColor?: string,
|
|
4
|
+
effectColor: string,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const baseColors = ['primary', 'secondary', 'accent', 'surface']
|
|
8
|
+
export const blackAndWhiteColors = ['black', 'white']
|
|
9
|
+
export const spotColors = ['blue', 'purple', 'red', 'orange', 'yellow', 'green']
|
|
10
|
+
export const lightColors = ['blue-light', 'purple-light', 'red-light', 'orange-light', 'yellow-light', 'green-light']
|
|
11
|
+
export const greyColors = ['grey-darkest', 'grey-darker', 'grey-dark', 'grey', 'grey-light', 'grey-lighter']
|
|
12
|
+
|
|
13
|
+
export const colors = {
|
|
14
|
+
baseColors,
|
|
15
|
+
blackAndWhiteColors,
|
|
16
|
+
spotColors,
|
|
17
|
+
lightColors,
|
|
18
|
+
greyColors,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const getRelatedColors = (color): RelatedColors | null => {
|
|
22
|
+
if (color === 'primary') {
|
|
23
|
+
return {
|
|
24
|
+
onColor: 'on-primary',
|
|
25
|
+
onAltColor: 'on-primary-alt',
|
|
26
|
+
effectColor: 'primary-effect',
|
|
27
|
+
} as RelatedColors
|
|
28
|
+
} else if (color === 'secondary') {
|
|
29
|
+
return {
|
|
30
|
+
onColor: 'on-secondary',
|
|
31
|
+
onAltColor: 'on-secondary-alt',
|
|
32
|
+
effectColor: 'secondary-effect',
|
|
33
|
+
} as RelatedColors
|
|
34
|
+
} else if (color === 'accent') {
|
|
35
|
+
return {
|
|
36
|
+
onColor: 'on-accent',
|
|
37
|
+
onAltColor: 'on-accent-alt',
|
|
38
|
+
effectColor: 'accent-effect',
|
|
39
|
+
} as RelatedColors
|
|
40
|
+
} else if (color === 'surface') {
|
|
41
|
+
return {
|
|
42
|
+
onColor: 'on-surface',
|
|
43
|
+
effectColor: 'surface-effect',
|
|
44
|
+
} as RelatedColors
|
|
45
|
+
} else if (spotColors.includes(color)) {
|
|
46
|
+
return {
|
|
47
|
+
onColor: 'grey-darkest',
|
|
48
|
+
effectColor: `${color}-light`,
|
|
49
|
+
} as RelatedColors
|
|
50
|
+
} else if (color === 'black') {
|
|
51
|
+
return {
|
|
52
|
+
onColor: 'white',
|
|
53
|
+
effectColor: 'grey-darker',
|
|
54
|
+
} as RelatedColors
|
|
55
|
+
} else if (color === 'white') {
|
|
56
|
+
return {
|
|
57
|
+
onColor: 'grey-darkest',
|
|
58
|
+
effectColor: 'grey-lighter',
|
|
59
|
+
} as RelatedColors
|
|
60
|
+
} else if (color === 'grey-lighter') {
|
|
61
|
+
return {
|
|
62
|
+
onColor: 'grey-darkest',
|
|
63
|
+
effectColor: 'grey-light',
|
|
64
|
+
} as RelatedColors
|
|
65
|
+
} else if (color.endsWith('-light')) {
|
|
66
|
+
return {
|
|
67
|
+
onColor: 'grey-darkest',
|
|
68
|
+
effectColor: color.replace('-light', ''),
|
|
69
|
+
} as RelatedColors
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return null
|
|
73
|
+
}
|
package/src/utils/errorUtils.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { i18n } from '../plugins/i18n'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Try to get an error message returned from the server. It could be a i18n key or just a normal error message.
|
|
5
|
-
* If a namespace is given then try to find the translation here. Fallback to the shared generic errors.
|
|
6
|
-
* @param [error] - Exception
|
|
7
|
-
* @param {string?} [namespace] - optional namespace where you want to find your i18n translation ('folders' will try to get from 'folders.foo_error')
|
|
8
|
-
*/
|
|
9
|
-
export const getErrorMessage = (error: any, namespace: string | undefined = undefined) : string => {
|
|
10
|
-
const t = i18n.global.t
|
|
11
|
-
const te = i18n.global.te
|
|
12
|
-
|
|
13
|
-
const errorDescription = error.response?.data?.errorDescription ||
|
|
14
|
-
error.response?.data?.message ||
|
|
15
|
-
error.response?.data ||
|
|
16
|
-
error.request?.statusText ||
|
|
17
|
-
error?.message ||
|
|
18
|
-
error.toString()
|
|
19
|
-
|
|
20
|
-
if (!errorDescription) {
|
|
21
|
-
return t('inri.error.undefined_error')
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let translatedError
|
|
25
|
-
|
|
26
|
-
// First try to get the translation from the given namespace
|
|
27
|
-
if (namespace) {
|
|
28
|
-
translatedError = te(`${namespace}.${errorDescription}`) ? t(`${namespace}.${errorDescription}`) : undefined
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// If not found in namespace or namespace is not defined try to get it from the global errors
|
|
32
|
-
if (!translatedError) {
|
|
33
|
-
translatedError = te(`inri.error.${errorDescription}`) ? t(`inri.error.${errorDescription}`) : undefined
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return translatedError || errorDescription || t('inri.error.undefined_error')
|
|
37
|
-
}
|
|
1
|
+
import { i18n } from '../plugins/i18n'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Try to get an error message returned from the server. It could be a i18n key or just a normal error message.
|
|
5
|
+
* If a namespace is given then try to find the translation here. Fallback to the shared generic errors.
|
|
6
|
+
* @param [error] - Exception
|
|
7
|
+
* @param {string?} [namespace] - optional namespace where you want to find your i18n translation ('folders' will try to get from 'folders.foo_error')
|
|
8
|
+
*/
|
|
9
|
+
export const getErrorMessage = (error: any, namespace: string | undefined = undefined) : string => {
|
|
10
|
+
const t = i18n.global.t
|
|
11
|
+
const te = i18n.global.te
|
|
12
|
+
|
|
13
|
+
const errorDescription = error.response?.data?.errorDescription ||
|
|
14
|
+
error.response?.data?.message ||
|
|
15
|
+
error.response?.data ||
|
|
16
|
+
error.request?.statusText ||
|
|
17
|
+
error?.message ||
|
|
18
|
+
error.toString()
|
|
19
|
+
|
|
20
|
+
if (!errorDescription) {
|
|
21
|
+
return t('inri.error.undefined_error')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let translatedError
|
|
25
|
+
|
|
26
|
+
// First try to get the translation from the given namespace
|
|
27
|
+
if (namespace) {
|
|
28
|
+
translatedError = te(`${namespace}.${errorDescription}`) ? t(`${namespace}.${errorDescription}`) : undefined
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// If not found in namespace or namespace is not defined try to get it from the global errors
|
|
32
|
+
if (!translatedError) {
|
|
33
|
+
translatedError = te(`inri.error.${errorDescription}`) ? t(`inri.error.${errorDescription}`) : undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return translatedError || errorDescription || t('inri.error.undefined_error')
|
|
37
|
+
}
|
package/src/utils/fileUtils.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
export const invalidFileChars = ['#', '%', '&', '{', '}', '\\', '<', '>', '*', '?', '/', '$', '!', "'", '"', ':', '@', '+', '`', '|', '=']
|
|
2
|
-
|
|
3
|
-
export const maxFileLength = 30
|
|
4
|
-
|
|
5
|
-
export const forbiddenFilePrefixAndSuffix = ['.', '-', '_']
|
|
6
|
-
|
|
7
|
-
export const invalidFileExtensions = ['.exe']
|
|
8
|
-
|
|
9
|
-
export function getFileExtension (fileName = '') {
|
|
10
|
-
if (fileName.includes('.')) {
|
|
11
|
-
return fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return ''
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Converts bytes to an appropriate size unit, outputted in a readable format
|
|
19
|
-
* @param {number} bytes - Value to be converted and formatted
|
|
20
|
-
* @param {number} [decimals] - Specifies how many decimals the result should contain, defaults to 0 (no decimals)
|
|
21
|
-
* @returns {string} The converted value in a readable format
|
|
22
|
-
*/
|
|
23
|
-
export function bytesToReadableSize (bytes: number, decimals = 0) {
|
|
24
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB']
|
|
25
|
-
|
|
26
|
-
if (bytes === 0) {
|
|
27
|
-
return '0 Bytes'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const dm = decimals < 0 ? 0 : decimals
|
|
31
|
-
const i = Math.floor(Math.log(bytes) / Math.log(1024))
|
|
32
|
-
|
|
33
|
-
return (bytes / Math.pow(1024, i)).toFixed(dm) + ' ' + sizes[i]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Converts a file to a Base64 encoded string
|
|
38
|
-
* @param { File | any } file - File object
|
|
39
|
-
* @returns A promise that returns a Base64 encoded string when resolved
|
|
40
|
-
*/
|
|
41
|
-
export function convertFileToBase64 (file) {
|
|
42
|
-
return new Promise<string>((resolve, reject) => {
|
|
43
|
-
const reader = new FileReader()
|
|
44
|
-
reader.onload = () => {
|
|
45
|
-
const result = reader.result as string
|
|
46
|
-
resolve(result.split(',').pop() as string)
|
|
47
|
-
}
|
|
48
|
-
reader.onerror = reject
|
|
49
|
-
reader.readAsDataURL(file)
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const textFileExtensionWhitelist = ['txt', 'md', 'xml']
|
|
54
|
-
|
|
55
|
-
export function isTextFile (filename: string) {
|
|
56
|
-
return textFileExtensionWhitelist.includes(getFileExtension(filename).toLowerCase())
|
|
57
|
-
}
|
|
1
|
+
export const invalidFileChars = ['#', '%', '&', '{', '}', '\\', '<', '>', '*', '?', '/', '$', '!', "'", '"', ':', '@', '+', '`', '|', '=']
|
|
2
|
+
|
|
3
|
+
export const maxFileLength = 30
|
|
4
|
+
|
|
5
|
+
export const forbiddenFilePrefixAndSuffix = ['.', '-', '_']
|
|
6
|
+
|
|
7
|
+
export const invalidFileExtensions = ['.exe']
|
|
8
|
+
|
|
9
|
+
export function getFileExtension (fileName = '') {
|
|
10
|
+
if (fileName.includes('.')) {
|
|
11
|
+
return fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return ''
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Converts bytes to an appropriate size unit, outputted in a readable format
|
|
19
|
+
* @param {number} bytes - Value to be converted and formatted
|
|
20
|
+
* @param {number} [decimals] - Specifies how many decimals the result should contain, defaults to 0 (no decimals)
|
|
21
|
+
* @returns {string} The converted value in a readable format
|
|
22
|
+
*/
|
|
23
|
+
export function bytesToReadableSize (bytes: number, decimals = 0) {
|
|
24
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB']
|
|
25
|
+
|
|
26
|
+
if (bytes === 0) {
|
|
27
|
+
return '0 Bytes'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const dm = decimals < 0 ? 0 : decimals
|
|
31
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024))
|
|
32
|
+
|
|
33
|
+
return (bytes / Math.pow(1024, i)).toFixed(dm) + ' ' + sizes[i]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Converts a file to a Base64 encoded string
|
|
38
|
+
* @param { File | any } file - File object
|
|
39
|
+
* @returns A promise that returns a Base64 encoded string when resolved
|
|
40
|
+
*/
|
|
41
|
+
export function convertFileToBase64 (file) {
|
|
42
|
+
return new Promise<string>((resolve, reject) => {
|
|
43
|
+
const reader = new FileReader()
|
|
44
|
+
reader.onload = () => {
|
|
45
|
+
const result = reader.result as string
|
|
46
|
+
resolve(result.split(',').pop() as string)
|
|
47
|
+
}
|
|
48
|
+
reader.onerror = reject
|
|
49
|
+
reader.readAsDataURL(file)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const textFileExtensionWhitelist = ['txt', 'md', 'xml']
|
|
54
|
+
|
|
55
|
+
export function isTextFile (filename: string) {
|
|
56
|
+
return textFileExtensionWhitelist.includes(getFileExtension(filename).toLowerCase())
|
|
57
|
+
}
|
package/src/utils/helpers.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Helpful function if you want to generate different size images from eg. faker.js
|
|
2
|
-
export function getRandomInt (min: number, max: number) {
|
|
3
|
-
min = Math.ceil(min)
|
|
4
|
-
max = Math.floor(max)
|
|
5
|
-
return Math.floor(Math.random() * (max - min) + min)
|
|
6
|
-
}
|
|
1
|
+
// Helpful function if you want to generate different size images from eg. faker.js
|
|
2
|
+
export function getRandomInt (min: number, max: number) {
|
|
3
|
+
min = Math.ceil(min)
|
|
4
|
+
max = Math.floor(max)
|
|
5
|
+
return Math.floor(Math.random() * (max - min) + min)
|
|
6
|
+
}
|
package/src/utils/routeUtils.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteRecordNormalized } from 'vue-router'
|
|
2
|
-
|
|
3
|
-
function isRouteLocation (arg): arg is RouteLocationNormalized | RouteLocationNormalizedLoaded {
|
|
4
|
-
return arg && arg.params
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const getRouteTitle = (
|
|
8
|
-
route: RouteLocationNormalized | RouteLocationNormalizedLoaded | RouteRecordNormalized | string,
|
|
9
|
-
to?: RouteLocationNormalized | RouteLocationNormalizedLoaded | RouteRecordNormalized | string,
|
|
10
|
-
) => {
|
|
11
|
-
let title = typeof route !== 'string' ? route.meta.title as string : route
|
|
12
|
-
|
|
13
|
-
// If "to" is not passed as a parameter then use the current route as "to"
|
|
14
|
-
to = to || route
|
|
15
|
-
|
|
16
|
-
if (isRouteLocation(to)) {
|
|
17
|
-
for (const [key, value] of Object.entries(to.params)) {
|
|
18
|
-
title = title.replace(`:${key}`, value as string)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return title
|
|
23
|
-
}
|
|
1
|
+
import { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteRecordNormalized } from 'vue-router'
|
|
2
|
+
|
|
3
|
+
function isRouteLocation (arg): arg is RouteLocationNormalized | RouteLocationNormalizedLoaded {
|
|
4
|
+
return arg && arg.params
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const getRouteTitle = (
|
|
8
|
+
route: RouteLocationNormalized | RouteLocationNormalizedLoaded | RouteRecordNormalized | string,
|
|
9
|
+
to?: RouteLocationNormalized | RouteLocationNormalizedLoaded | RouteRecordNormalized | string,
|
|
10
|
+
) => {
|
|
11
|
+
let title = typeof route !== 'string' ? route.meta.title as string : route
|
|
12
|
+
|
|
13
|
+
// If "to" is not passed as a parameter then use the current route as "to"
|
|
14
|
+
to = to || route
|
|
15
|
+
|
|
16
|
+
if (isRouteLocation(to)) {
|
|
17
|
+
for (const [key, value] of Object.entries(to.params)) {
|
|
18
|
+
title = title.replace(`:${key}`, value as string)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return title
|
|
23
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowJs": true,
|
|
4
|
-
"noImplicitAny": false,
|
|
5
|
-
"target": "esnext",
|
|
6
|
-
"module": "esnext",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"jsx": "preserve",
|
|
9
|
-
"importHelpers": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"baseUrl": ".",
|
|
16
|
-
"lib": [
|
|
17
|
-
"esnext",
|
|
18
|
-
"dom",
|
|
19
|
-
"dom.iterable",
|
|
20
|
-
"scripthost"
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
"include": [
|
|
24
|
-
"src/**/*.ts",
|
|
25
|
-
"src/**/*.tsx",
|
|
26
|
-
"src/**/*.vue",
|
|
27
|
-
"tests/**/*.ts",
|
|
28
|
-
"tests/**/*.tsx",
|
|
29
|
-
"componentProperties.d.ts"
|
|
30
|
-
],
|
|
31
|
-
"exclude": [
|
|
32
|
-
"node_modules"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"noImplicitAny": false,
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"jsx": "preserve",
|
|
9
|
+
"importHelpers": true,
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"lib": [
|
|
17
|
+
"esnext",
|
|
18
|
+
"dom",
|
|
19
|
+
"dom.iterable",
|
|
20
|
+
"scripthost"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"src/**/*.ts",
|
|
25
|
+
"src/**/*.tsx",
|
|
26
|
+
"src/**/*.vue",
|
|
27
|
+
"tests/**/*.ts",
|
|
28
|
+
"tests/**/*.tsx",
|
|
29
|
+
"componentProperties.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules"
|
|
33
|
+
]
|
|
34
|
+
}
|