@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
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-dialog
|
|
3
|
-
ref="dialogRef"
|
|
4
|
-
class="c-dialog"
|
|
5
|
-
@hide="onDialogHide"
|
|
6
|
-
>
|
|
7
|
-
<q-card
|
|
8
|
-
data-id="confirm-dialog"
|
|
9
|
-
class="dialog-card"
|
|
10
|
-
>
|
|
11
|
-
<q-card-section class="px-5 pt-6 pb-4">
|
|
12
|
-
<h3
|
|
13
|
-
v-if="title"
|
|
14
|
-
data-id="confirm-dialog-title"
|
|
15
|
-
>
|
|
16
|
-
{{ title }}
|
|
17
|
-
</h3>
|
|
18
|
-
<div
|
|
19
|
-
data-id="confirm-dialog-description"
|
|
20
|
-
class="mt-2px"
|
|
21
|
-
>
|
|
22
|
-
{{ text }}
|
|
23
|
-
</div>
|
|
24
|
-
</q-card-section>
|
|
25
|
-
|
|
26
|
-
<div class="dialog-card-action-buttons px-5 pt-2 pb-10">
|
|
27
|
-
<c-btn
|
|
28
|
-
data-id="confirm-dialog-ok-button"
|
|
29
|
-
:label="confirmButtonText || $t('inri.common.confirm')"
|
|
30
|
-
:color="confirmButtonColor"
|
|
31
|
-
@click="onDialogOK"
|
|
32
|
-
/>
|
|
33
|
-
<c-btn
|
|
34
|
-
v-if="!hideCancelButton"
|
|
35
|
-
data-id="confirm-dialog-cancel-button"
|
|
36
|
-
:label="cancelButtonText || $t('inri.common.cancel')"
|
|
37
|
-
color="surface"
|
|
38
|
-
@click="onDialogCancel"
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
</q-card>
|
|
42
|
-
</q-dialog>
|
|
43
|
-
</template>
|
|
44
|
-
|
|
45
|
-
<script setup lang="ts">
|
|
46
|
-
// For further documentation regarding custom programmatic dialogs:
|
|
47
|
-
// https://quasar.dev/quasar-plugins/dialog
|
|
48
|
-
|
|
49
|
-
import { useDialogPluginComponent } from 'quasar'
|
|
50
|
-
|
|
51
|
-
defineProps({
|
|
52
|
-
title: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: undefined,
|
|
55
|
-
},
|
|
56
|
-
text: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: undefined,
|
|
59
|
-
},
|
|
60
|
-
confirmButtonText: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: undefined,
|
|
63
|
-
},
|
|
64
|
-
cancelButtonText: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: undefined,
|
|
67
|
-
},
|
|
68
|
-
confirmButtonColor: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: 'primary',
|
|
71
|
-
},
|
|
72
|
-
hideCancelButton: Boolean,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
defineEmits([...useDialogPluginComponent.emits])
|
|
76
|
-
|
|
77
|
-
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent()
|
|
78
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<q-dialog
|
|
3
|
+
ref="dialogRef"
|
|
4
|
+
class="c-dialog"
|
|
5
|
+
@hide="onDialogHide"
|
|
6
|
+
>
|
|
7
|
+
<q-card
|
|
8
|
+
data-id="confirm-dialog"
|
|
9
|
+
class="dialog-card"
|
|
10
|
+
>
|
|
11
|
+
<q-card-section class="px-5 pt-6 pb-4">
|
|
12
|
+
<h3
|
|
13
|
+
v-if="title"
|
|
14
|
+
data-id="confirm-dialog-title"
|
|
15
|
+
>
|
|
16
|
+
{{ title }}
|
|
17
|
+
</h3>
|
|
18
|
+
<div
|
|
19
|
+
data-id="confirm-dialog-description"
|
|
20
|
+
class="mt-2px"
|
|
21
|
+
>
|
|
22
|
+
{{ text }}
|
|
23
|
+
</div>
|
|
24
|
+
</q-card-section>
|
|
25
|
+
|
|
26
|
+
<div class="dialog-card-action-buttons px-5 pt-2 pb-10">
|
|
27
|
+
<c-btn
|
|
28
|
+
data-id="confirm-dialog-ok-button"
|
|
29
|
+
:label="confirmButtonText || $t('inri.common.confirm')"
|
|
30
|
+
:color="confirmButtonColor"
|
|
31
|
+
@click="onDialogOK"
|
|
32
|
+
/>
|
|
33
|
+
<c-btn
|
|
34
|
+
v-if="!hideCancelButton"
|
|
35
|
+
data-id="confirm-dialog-cancel-button"
|
|
36
|
+
:label="cancelButtonText || $t('inri.common.cancel')"
|
|
37
|
+
color="surface"
|
|
38
|
+
@click="onDialogCancel"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</q-card>
|
|
42
|
+
</q-dialog>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
// For further documentation regarding custom programmatic dialogs:
|
|
47
|
+
// https://quasar.dev/quasar-plugins/dialog
|
|
48
|
+
|
|
49
|
+
import { useDialogPluginComponent } from 'quasar'
|
|
50
|
+
|
|
51
|
+
defineProps({
|
|
52
|
+
title: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: undefined,
|
|
55
|
+
},
|
|
56
|
+
text: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: undefined,
|
|
59
|
+
},
|
|
60
|
+
confirmButtonText: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: undefined,
|
|
63
|
+
},
|
|
64
|
+
cancelButtonText: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: undefined,
|
|
67
|
+
},
|
|
68
|
+
confirmButtonColor: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: 'primary',
|
|
71
|
+
},
|
|
72
|
+
hideCancelButton: Boolean,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
defineEmits([...useDialogPluginComponent.emits])
|
|
76
|
+
|
|
77
|
+
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent()
|
|
78
|
+
</script>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { getCurrentInstance, reactive, toRefs } from 'vue'
|
|
2
|
-
import notify from '../plugins/notify'
|
|
3
|
-
import { useDirtyCheck } from './useDirtyCheck'
|
|
4
|
-
|
|
5
|
-
export function useDialog (data?: object, immediate = true) {
|
|
6
|
-
const { isDirty, freezeCleanData } = useDirtyCheck(data, immediate)
|
|
7
|
-
const { emit } = getCurrentInstance() as any
|
|
8
|
-
|
|
9
|
-
const state = reactive({
|
|
10
|
-
isLoading: false,
|
|
11
|
-
showDialog: true,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
// Functions
|
|
15
|
-
function closeAfterTimeout () {
|
|
16
|
-
state.showDialog = false
|
|
17
|
-
|
|
18
|
-
// Let the q-dialog close transition finish before we tell our parent to close.
|
|
19
|
-
// This way we can use v-if on our parent to destroy the component but still have graceful transitions.
|
|
20
|
-
setTimeout(() => {
|
|
21
|
-
emit('update:show', false)
|
|
22
|
-
}, 500)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function cancel () {
|
|
26
|
-
closeAfterTimeout()
|
|
27
|
-
emit('after-cancel')
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function confirmSuccess (msg: string | null | undefined, returnValue: any | undefined = undefined) {
|
|
31
|
-
closeAfterTimeout()
|
|
32
|
-
state.isLoading = false
|
|
33
|
-
emit('after-confirm', returnValue)
|
|
34
|
-
|
|
35
|
-
if (msg) {
|
|
1
|
+
import { getCurrentInstance, reactive, toRefs } from 'vue'
|
|
2
|
+
import notify from '../plugins/notify'
|
|
3
|
+
import { useDirtyCheck } from './useDirtyCheck'
|
|
4
|
+
|
|
5
|
+
export function useDialog (data?: object, immediate = true) {
|
|
6
|
+
const { isDirty, freezeCleanData } = useDirtyCheck(data, immediate)
|
|
7
|
+
const { emit } = getCurrentInstance() as any
|
|
8
|
+
|
|
9
|
+
const state = reactive({
|
|
10
|
+
isLoading: false,
|
|
11
|
+
showDialog: true,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// Functions
|
|
15
|
+
function closeAfterTimeout () {
|
|
16
|
+
state.showDialog = false
|
|
17
|
+
|
|
18
|
+
// Let the q-dialog close transition finish before we tell our parent to close.
|
|
19
|
+
// This way we can use v-if on our parent to destroy the component but still have graceful transitions.
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
emit('update:show', false)
|
|
22
|
+
}, 500)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function cancel () {
|
|
26
|
+
closeAfterTimeout()
|
|
27
|
+
emit('after-cancel')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function confirmSuccess (msg: string | null | undefined, returnValue: any | undefined = undefined) {
|
|
31
|
+
closeAfterTimeout()
|
|
32
|
+
state.isLoading = false
|
|
33
|
+
emit('after-confirm', returnValue)
|
|
34
|
+
|
|
35
|
+
if (msg) {
|
|
36
36
|
notify.success(msg)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
...toRefs(state),
|
|
42
|
-
cancel,
|
|
43
|
-
confirmSuccess,
|
|
44
|
-
isDirty,
|
|
45
|
-
freezeCleanData,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
...toRefs(state),
|
|
42
|
+
cancel,
|
|
43
|
+
confirmSuccess,
|
|
44
|
+
isDirty,
|
|
45
|
+
freezeCleanData,
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { computed, reactive, ref } from 'vue'
|
|
2
|
-
|
|
3
|
-
export function useDirtyCheck (data?: object, immediate = true) {
|
|
4
|
-
const isEnabled = ref(immediate)
|
|
5
|
-
const reactiveData = reactive(data || {})
|
|
6
|
-
const initialData = ref(JSON.stringify(reactiveData))
|
|
7
|
-
|
|
8
|
-
const isDirty = computed(() => {
|
|
9
|
-
if (!data || !isEnabled.value) {
|
|
10
|
-
return false
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return JSON.stringify(reactiveData) !== initialData.value
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
function freezeCleanData () {
|
|
17
|
-
isEnabled.value = true
|
|
18
|
-
initialData.value = JSON.stringify(reactiveData)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
isDirty,
|
|
23
|
-
freezeCleanData,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { computed, reactive, ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function useDirtyCheck (data?: object, immediate = true) {
|
|
4
|
+
const isEnabled = ref(immediate)
|
|
5
|
+
const reactiveData = reactive(data || {})
|
|
6
|
+
const initialData = ref(JSON.stringify(reactiveData))
|
|
7
|
+
|
|
8
|
+
const isDirty = computed(() => {
|
|
9
|
+
if (!data || !isEnabled.value) {
|
|
10
|
+
return false
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return JSON.stringify(reactiveData) !== initialData.value
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
function freezeCleanData () {
|
|
17
|
+
isEnabled.value = true
|
|
18
|
+
initialData.value = JSON.stringify(reactiveData)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
isDirty,
|
|
23
|
+
freezeCleanData,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Ref } from 'vue'
|
|
2
|
-
import { useEventListener } from '@vueuse/core'
|
|
3
|
-
|
|
4
|
-
export function useDoubleClickListener (
|
|
5
|
-
target: Ref<HTMLElement | undefined> | HTMLElement,
|
|
6
|
-
callback: (e: Event) => any,
|
|
7
|
-
) {
|
|
8
|
-
let clickCounter = 0
|
|
9
|
-
let clickTimer
|
|
10
|
-
|
|
11
|
-
function clickHandler (e) {
|
|
12
|
-
clickCounter++
|
|
13
|
-
|
|
14
|
-
if (clickCounter === 1) {
|
|
15
|
-
clickTimer = window.setTimeout(function () {
|
|
16
|
-
clickCounter = 0
|
|
17
|
-
}, 500)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (clickCounter > 1) {
|
|
21
|
-
clearTimeout(clickTimer)
|
|
22
|
-
clickCounter = 0
|
|
23
|
-
callback(e)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
useEventListener(target as any, 'click', clickHandler)
|
|
28
|
-
}
|
|
1
|
+
import { Ref } from 'vue'
|
|
2
|
+
import { useEventListener } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
export function useDoubleClickListener (
|
|
5
|
+
target: Ref<HTMLElement | undefined> | HTMLElement,
|
|
6
|
+
callback: (e: Event) => any,
|
|
7
|
+
) {
|
|
8
|
+
let clickCounter = 0
|
|
9
|
+
let clickTimer
|
|
10
|
+
|
|
11
|
+
function clickHandler (e) {
|
|
12
|
+
clickCounter++
|
|
13
|
+
|
|
14
|
+
if (clickCounter === 1) {
|
|
15
|
+
clickTimer = window.setTimeout(function () {
|
|
16
|
+
clickCounter = 0
|
|
17
|
+
}, 500)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (clickCounter > 1) {
|
|
21
|
+
clearTimeout(clickTimer)
|
|
22
|
+
clickCounter = 0
|
|
23
|
+
callback(e)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
useEventListener(target as any, 'click', clickHandler)
|
|
28
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { getCurrentInstance, computed, ref } from 'vue'
|
|
2
|
-
|
|
3
|
-
export default function useSelectable (allItems, selectedItems) {
|
|
4
|
-
const { emit } = getCurrentInstance() as any
|
|
5
|
-
|
|
6
|
-
// This will convert a "reactive" array to "ref". "ref"s will still be a ref.
|
|
7
|
-
// This lets us use a reactive -or- ref array as a parameter.
|
|
8
|
-
const _allItems = ref(allItems)
|
|
9
|
-
|
|
10
|
-
const allSelectedStatus = computed(() => {
|
|
11
|
-
if (!selectedItems.value || !selectedItems.value.length) {
|
|
12
|
-
return false
|
|
13
|
-
} else if (_allItems.value.length === selectedItems.value.length) {
|
|
14
|
-
return true
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return undefined
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
function toggleItem (evt, item = undefined) {
|
|
21
|
-
// If someone passes just one parameter we assume it's the item that we want to toggle instead of the event.
|
|
22
|
-
// The evt parameter is not actually used here, but is automatically passed along on a Q-Table row click.
|
|
23
|
-
const _item = item || evt
|
|
24
|
-
const existingItemIndex = selectedItems.value.findIndex(i => JSON.stringify(i) === JSON.stringify(_item))
|
|
25
|
-
|
|
26
|
-
if (existingItemIndex >= 0) {
|
|
27
|
-
// Remove item
|
|
28
|
-
selectedItems.value.splice(existingItemIndex, 1)
|
|
29
|
-
} else {
|
|
30
|
-
// Add item
|
|
31
|
-
selectedItems.value.push(_item)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function toggleAllItems () {
|
|
36
|
-
if (allSelectedStatus.value === false) {
|
|
37
|
-
selectedItems.value = [..._allItems.value]
|
|
38
|
-
} else {
|
|
39
|
-
selectedItems.value = []
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function toggleAllItemsWithEmit (evt, emitString = 'update:modelValue') {
|
|
44
|
-
if (allSelectedStatus.value === false) {
|
|
45
|
-
emit(emitString, [..._allItems.value])
|
|
46
|
-
} else {
|
|
47
|
-
emit(emitString, [])
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function isSelected (item) {
|
|
52
|
-
return selectedItems.value.includes(item)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
allSelectedStatus,
|
|
57
|
-
toggleItem,
|
|
58
|
-
toggleAllItems,
|
|
59
|
-
toggleAllItemsWithEmit,
|
|
60
|
-
isSelected,
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
import { getCurrentInstance, computed, ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export default function useSelectable (allItems, selectedItems) {
|
|
4
|
+
const { emit } = getCurrentInstance() as any
|
|
5
|
+
|
|
6
|
+
// This will convert a "reactive" array to "ref". "ref"s will still be a ref.
|
|
7
|
+
// This lets us use a reactive -or- ref array as a parameter.
|
|
8
|
+
const _allItems = ref(allItems)
|
|
9
|
+
|
|
10
|
+
const allSelectedStatus = computed(() => {
|
|
11
|
+
if (!selectedItems.value || !selectedItems.value.length) {
|
|
12
|
+
return false
|
|
13
|
+
} else if (_allItems.value.length === selectedItems.value.length) {
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return undefined
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
function toggleItem (evt, item = undefined) {
|
|
21
|
+
// If someone passes just one parameter we assume it's the item that we want to toggle instead of the event.
|
|
22
|
+
// The evt parameter is not actually used here, but is automatically passed along on a Q-Table row click.
|
|
23
|
+
const _item = item || evt
|
|
24
|
+
const existingItemIndex = selectedItems.value.findIndex(i => JSON.stringify(i) === JSON.stringify(_item))
|
|
25
|
+
|
|
26
|
+
if (existingItemIndex >= 0) {
|
|
27
|
+
// Remove item
|
|
28
|
+
selectedItems.value.splice(existingItemIndex, 1)
|
|
29
|
+
} else {
|
|
30
|
+
// Add item
|
|
31
|
+
selectedItems.value.push(_item)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function toggleAllItems () {
|
|
36
|
+
if (allSelectedStatus.value === false) {
|
|
37
|
+
selectedItems.value = [..._allItems.value]
|
|
38
|
+
} else {
|
|
39
|
+
selectedItems.value = []
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function toggleAllItemsWithEmit (evt, emitString = 'update:modelValue') {
|
|
44
|
+
if (allSelectedStatus.value === false) {
|
|
45
|
+
emit(emitString, [..._allItems.value])
|
|
46
|
+
} else {
|
|
47
|
+
emit(emitString, [])
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isSelected (item) {
|
|
52
|
+
return selectedItems.value.includes(item)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
allSelectedStatus,
|
|
57
|
+
toggleItem,
|
|
58
|
+
toggleAllItems,
|
|
59
|
+
toggleAllItemsWithEmit,
|
|
60
|
+
isSelected,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { nextTick } from 'vue'
|
|
2
|
-
|
|
3
|
-
export function useTruncateChips () {
|
|
4
|
-
const chipsColumnHeaderSelector = '.js-chips-column-header'
|
|
5
|
-
const chipsWrapperSelector = '.truncated-chips'
|
|
6
|
-
const chipSelector = '.q-chip'
|
|
7
|
-
const truncatedChipClass = 'truncated-chip'
|
|
8
|
-
const arrowBtnOffset = 32
|
|
9
|
-
|
|
10
|
-
function onResize () {
|
|
11
|
-
truncateChips()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function truncateChips () {
|
|
15
|
-
nextTick(() => {
|
|
16
|
-
const chipsHeaderRect = document.querySelector(chipsColumnHeaderSelector)?.getBoundingClientRect() as DOMRect
|
|
17
|
-
const chipsWrappers = document.querySelectorAll(chipsWrapperSelector)
|
|
18
|
-
|
|
19
|
-
// There is one chips wrapper for every row in a table
|
|
20
|
-
chipsWrappers.forEach(wrapper => {
|
|
21
|
-
const renderedChips = Array.from(wrapper.querySelectorAll(chipSelector))
|
|
22
|
-
|
|
23
|
-
// Reset hidden
|
|
24
|
-
renderedChips.forEach(chip => chip.classList.remove(truncatedChipClass))
|
|
25
|
-
|
|
26
|
-
// Check coordinates
|
|
27
|
-
renderedChips.every((chip) => {
|
|
28
|
-
const chipRect = chip.getBoundingClientRect()
|
|
29
|
-
|
|
30
|
-
// As soon as you find a chip that goes outside the boundaries then hide it (and all the following chips in the list)
|
|
31
|
-
if (chipRect.right > (chipsHeaderRect.right - arrowBtnOffset)) {
|
|
32
|
-
chip.classList.add(truncatedChipClass)
|
|
33
|
-
return false
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return true
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
onResize,
|
|
44
|
-
truncateChips,
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
import { nextTick } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function useTruncateChips () {
|
|
4
|
+
const chipsColumnHeaderSelector = '.js-chips-column-header'
|
|
5
|
+
const chipsWrapperSelector = '.truncated-chips'
|
|
6
|
+
const chipSelector = '.q-chip'
|
|
7
|
+
const truncatedChipClass = 'truncated-chip'
|
|
8
|
+
const arrowBtnOffset = 32
|
|
9
|
+
|
|
10
|
+
function onResize () {
|
|
11
|
+
truncateChips()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function truncateChips () {
|
|
15
|
+
nextTick(() => {
|
|
16
|
+
const chipsHeaderRect = document.querySelector(chipsColumnHeaderSelector)?.getBoundingClientRect() as DOMRect
|
|
17
|
+
const chipsWrappers = document.querySelectorAll(chipsWrapperSelector)
|
|
18
|
+
|
|
19
|
+
// There is one chips wrapper for every row in a table
|
|
20
|
+
chipsWrappers.forEach(wrapper => {
|
|
21
|
+
const renderedChips = Array.from(wrapper.querySelectorAll(chipSelector))
|
|
22
|
+
|
|
23
|
+
// Reset hidden
|
|
24
|
+
renderedChips.forEach(chip => chip.classList.remove(truncatedChipClass))
|
|
25
|
+
|
|
26
|
+
// Check coordinates
|
|
27
|
+
renderedChips.every((chip) => {
|
|
28
|
+
const chipRect = chip.getBoundingClientRect()
|
|
29
|
+
|
|
30
|
+
// As soon as you find a chip that goes outside the boundaries then hide it (and all the following chips in the list)
|
|
31
|
+
if (chipRect.right > (chipsHeaderRect.right - arrowBtnOffset)) {
|
|
32
|
+
chip.classList.add(truncatedChipClass)
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return true
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
onResize,
|
|
44
|
+
truncateChips,
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/i18n/de/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
inri: {
|
|
3
|
-
common: {
|
|
4
|
-
ok: 'OK',
|
|
5
|
-
save: 'Speichern',
|
|
6
|
-
cancel: 'Abbrechen',
|
|
7
|
-
confirm: 'Bestätigen',
|
|
8
|
-
yes: 'Ja',
|
|
9
|
-
},
|
|
10
|
-
languages: {
|
|
11
|
-
en: 'englisch',
|
|
12
|
-
de: 'deutsch',
|
|
13
|
-
fr: 'französisch',
|
|
14
|
-
es: 'spanisch',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
inri: {
|
|
3
|
+
common: {
|
|
4
|
+
ok: 'OK',
|
|
5
|
+
save: 'Speichern',
|
|
6
|
+
cancel: 'Abbrechen',
|
|
7
|
+
confirm: 'Bestätigen',
|
|
8
|
+
yes: 'Ja',
|
|
9
|
+
},
|
|
10
|
+
languages: {
|
|
11
|
+
en: 'englisch',
|
|
12
|
+
de: 'deutsch',
|
|
13
|
+
fr: 'französisch',
|
|
14
|
+
es: 'spanisch',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|