@inriver/inri 1.14.0 → 1.15.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 +6 -0
- package/azure/pipelines/templates/deployFramework.yml +50 -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,52 +1,52 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<c-tile-btn
|
|
3
|
-
data-id="delete-btn"
|
|
4
|
-
v-bind="computedTooltip"
|
|
5
|
-
icon="mdi-delete-outline"
|
|
6
|
-
slide-effect-color="red-light"
|
|
7
|
-
icon-size="20"
|
|
8
|
-
/>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
import { computed } from 'vue'
|
|
13
|
-
import { useI18n } from 'vue-i18n'
|
|
14
|
-
|
|
15
|
-
const { t } = useI18n()
|
|
16
|
-
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
tooltip: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: undefined,
|
|
21
|
-
},
|
|
22
|
-
tooltipLeft: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: undefined,
|
|
25
|
-
},
|
|
26
|
-
tooltipRight: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: undefined,
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const computedTooltip = computed(() => {
|
|
33
|
-
if (props.tooltip) {
|
|
34
|
-
return {
|
|
35
|
-
tooltip: props.tooltip,
|
|
36
|
-
}
|
|
37
|
-
} else if (props.tooltipRight) {
|
|
38
|
-
return {
|
|
39
|
-
tooltipRight: props.tooltipRight,
|
|
40
|
-
}
|
|
41
|
-
} else if (props.tooltipLeft) {
|
|
42
|
-
return {
|
|
43
|
-
tooltipLeft: props.tooltipLeft,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Default is just "delete" to the left
|
|
48
|
-
return {
|
|
49
|
-
tooltipLeft: t('inri.common.delete'),
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<c-tile-btn
|
|
3
|
+
data-id="delete-btn"
|
|
4
|
+
v-bind="computedTooltip"
|
|
5
|
+
icon="mdi-delete-outline"
|
|
6
|
+
slide-effect-color="red-light"
|
|
7
|
+
icon-size="20"
|
|
8
|
+
/>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
import { useI18n } from 'vue-i18n'
|
|
14
|
+
|
|
15
|
+
const { t } = useI18n()
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
tooltip: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: undefined,
|
|
21
|
+
},
|
|
22
|
+
tooltipLeft: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: undefined,
|
|
25
|
+
},
|
|
26
|
+
tooltipRight: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: undefined,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const computedTooltip = computed(() => {
|
|
33
|
+
if (props.tooltip) {
|
|
34
|
+
return {
|
|
35
|
+
tooltip: props.tooltip,
|
|
36
|
+
}
|
|
37
|
+
} else if (props.tooltipRight) {
|
|
38
|
+
return {
|
|
39
|
+
tooltipRight: props.tooltipRight,
|
|
40
|
+
}
|
|
41
|
+
} else if (props.tooltipLeft) {
|
|
42
|
+
return {
|
|
43
|
+
tooltipLeft: props.tooltipLeft,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Default is just "delete" to the left
|
|
48
|
+
return {
|
|
49
|
+
tooltipLeft: t('inri.common.delete'),
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
@@ -1,253 +1,253 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-dialog
|
|
3
|
-
data-id="dialog"
|
|
4
|
-
class="c-dialog"
|
|
5
|
-
:model-value="modelValue"
|
|
6
|
-
:position="position"
|
|
7
|
-
transition-show="fade"
|
|
8
|
-
transition-hide="fade"
|
|
9
|
-
no-refocus
|
|
10
|
-
@update:model-value="cancel"
|
|
11
|
-
@keydown.ctrl.s.prevent="confirm"
|
|
12
|
-
>
|
|
13
|
-
<c-dirty-check
|
|
14
|
-
:is-dirty="isDirty"
|
|
15
|
-
:is-dialog-open="modelValue"
|
|
16
|
-
/>
|
|
17
|
-
|
|
18
|
-
<q-card
|
|
19
|
-
class="dialog-card"
|
|
20
|
-
:style="{ maxWidth: maxWidth ? maxWidth : false }"
|
|
21
|
-
>
|
|
22
|
-
<q-form
|
|
23
|
-
ref="dialogForm"
|
|
24
|
-
greedy
|
|
25
|
-
class="flex flex-col flex-nowrap max-h-full"
|
|
26
|
-
@submit.prevent=""
|
|
27
|
-
>
|
|
28
|
-
<q-card-section class="px-5 pt-6 pb-4">
|
|
29
|
-
<slot name="header">
|
|
30
|
-
<h3 data-id="dialog-title">
|
|
31
|
-
{{ title }}
|
|
32
|
-
</h3>
|
|
33
|
-
</slot>
|
|
34
|
-
<div
|
|
35
|
-
v-if="text"
|
|
36
|
-
class="mt-2px"
|
|
37
|
-
>
|
|
38
|
-
{{ text }}
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div class="absolute right-0 top-0">
|
|
42
|
-
<slot name="corner-buttons" />
|
|
43
|
-
<c-dialog-close-btn @click="cancel" />
|
|
44
|
-
</div>
|
|
45
|
-
</q-card-section>
|
|
46
|
-
|
|
47
|
-
<q-card-section
|
|
48
|
-
v-if="$slots.default"
|
|
49
|
-
class="px-5 pb-4 overflow-y-overlay flex-1"
|
|
50
|
-
:class="contentClass"
|
|
51
|
-
>
|
|
52
|
-
<slot />
|
|
53
|
-
</q-card-section>
|
|
54
|
-
|
|
55
|
-
<div class="dialog-card-action-buttons px-5 pt-2 pb-10">
|
|
56
|
-
<c-btn
|
|
57
|
-
v-if="!hideConfirmButton"
|
|
58
|
-
data-id="dialog-confirm-button"
|
|
59
|
-
:label="confirmButtonText || $t('inri.common.confirm')"
|
|
60
|
-
:disabled="confirmIsDisabled"
|
|
61
|
-
@click="confirm"
|
|
62
|
-
>
|
|
63
|
-
<q-tooltip v-if="confirmIsDisabled">
|
|
64
|
-
{{ disabledConfirmTooltip || $t('inri.dialog.confirm_tooltip_invalid_fields') }}
|
|
65
|
-
</q-tooltip>
|
|
66
|
-
</c-btn>
|
|
67
|
-
<c-btn
|
|
68
|
-
v-if="!hideCancelButton"
|
|
69
|
-
data-id="dialog-cancel-button"
|
|
70
|
-
:label="cancelButtonText || $t('inri.common.cancel')"
|
|
71
|
-
color="surface"
|
|
72
|
-
@click="cancel"
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
</q-form>
|
|
76
|
-
|
|
77
|
-
<q-inner-loading :showing="isLoading">
|
|
78
|
-
<c-spinner />
|
|
79
|
-
</q-inner-loading>
|
|
80
|
-
</q-card>
|
|
81
|
-
</q-dialog>
|
|
82
|
-
</template>
|
|
83
|
-
|
|
84
|
-
<script setup lang="ts">
|
|
85
|
-
import { PropType, computed, ref } from 'vue'
|
|
86
|
-
import notify from '../plugins/notify'
|
|
87
|
-
import dialog from '../plugins/dialog'
|
|
88
|
-
import { useI18n } from 'vue-i18n'
|
|
89
|
-
|
|
90
|
-
const { t } = useI18n()
|
|
91
|
-
|
|
92
|
-
const props = defineProps({
|
|
93
|
-
modelValue: Boolean,
|
|
94
|
-
title: {
|
|
95
|
-
type: String,
|
|
96
|
-
default: '',
|
|
97
|
-
},
|
|
98
|
-
isDirty: {
|
|
99
|
-
type: Boolean,
|
|
100
|
-
default: undefined,
|
|
101
|
-
},
|
|
102
|
-
disableConfirm: Boolean,
|
|
103
|
-
disabledConfirmTooltip: {
|
|
104
|
-
type: String,
|
|
105
|
-
default: undefined,
|
|
106
|
-
},
|
|
107
|
-
confirmButtonText: {
|
|
108
|
-
type: String,
|
|
109
|
-
default: undefined,
|
|
110
|
-
},
|
|
111
|
-
cancelButtonText: {
|
|
112
|
-
type: String,
|
|
113
|
-
default: undefined,
|
|
114
|
-
},
|
|
115
|
-
hideConfirmButton: Boolean,
|
|
116
|
-
hideCancelButton: Boolean,
|
|
117
|
-
ignoreDirtyCheckOnConfirm: Boolean,
|
|
118
|
-
isLoading: Boolean,
|
|
119
|
-
confirmCancelTitle: {
|
|
120
|
-
type: String,
|
|
121
|
-
default: undefined,
|
|
122
|
-
},
|
|
123
|
-
confirmCancelMessage: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: undefined,
|
|
126
|
-
},
|
|
127
|
-
maxWidth: {
|
|
128
|
-
type: [String, Number],
|
|
129
|
-
default: '100%',
|
|
130
|
-
},
|
|
131
|
-
contentClass: {
|
|
132
|
-
type: String,
|
|
133
|
-
default: '',
|
|
134
|
-
},
|
|
135
|
-
text: {
|
|
136
|
-
type: String,
|
|
137
|
-
default: undefined,
|
|
138
|
-
},
|
|
139
|
-
position: {
|
|
140
|
-
type: String as PropType<'top' | 'standard' | 'right' | 'bottom' | 'left' | undefined>,
|
|
141
|
-
default: 'top',
|
|
142
|
-
},
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
const emit = defineEmits([
|
|
146
|
-
'confirm',
|
|
147
|
-
'cancel',
|
|
148
|
-
])
|
|
149
|
-
|
|
150
|
-
// State etc.
|
|
151
|
-
const confirmIsDisabled = computed(() => {
|
|
152
|
-
return (
|
|
153
|
-
props.disableConfirm ||
|
|
154
|
-
props.isLoading ||
|
|
155
|
-
(!props.ignoreDirtyCheckOnConfirm && props.isDirty === false)
|
|
156
|
-
)
|
|
157
|
-
})
|
|
158
|
-
const dialogForm = ref()
|
|
159
|
-
|
|
160
|
-
// Functions
|
|
161
|
-
function cancel () {
|
|
162
|
-
if (props.isDirty) {
|
|
163
|
-
dialog.confirm({
|
|
164
|
-
title: props.confirmCancelTitle || t('inri.dialog.unsaved_changes_title'),
|
|
165
|
-
text: props.confirmCancelMessage || t('inri.dialog.unsaved_changes_message'),
|
|
166
|
-
}).onOk(() => {
|
|
167
|
-
emit('cancel')
|
|
168
|
-
})
|
|
169
|
-
} else {
|
|
170
|
-
emit('cancel')
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function confirm () {
|
|
175
|
-
if (!props.disableConfirm) {
|
|
176
|
-
dialogForm.value.validate().then(success => {
|
|
177
|
-
if (success) {
|
|
178
|
-
emit('confirm')
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
} else {
|
|
182
|
-
notify.error(props.disabledConfirmTooltip || t('inri.dialog.confirm_tooltip_invalid_fields'))
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// So that we can trigger confirm/cancel from a component ref
|
|
187
|
-
defineExpose({
|
|
188
|
-
confirm,
|
|
189
|
-
cancel,
|
|
190
|
-
})
|
|
191
|
-
</script>
|
|
192
|
-
|
|
193
|
-
<style lang="scss">
|
|
194
|
-
// This css is also shared by the programmatic dialogs
|
|
195
|
-
.c-dialog {
|
|
196
|
-
.q-dialog__backdrop {
|
|
197
|
-
background: var(--dialog-backdrop-color);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.q-dialog__inner > div {
|
|
201
|
-
border-radius: 0;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.dialog-card {
|
|
205
|
-
display: flex;
|
|
206
|
-
max-height: 100vh;
|
|
207
|
-
flex-direction: column;
|
|
208
|
-
width: 100%;
|
|
209
|
-
box-shadow: var(--dialog-shadow);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.dialog-card-action-buttons {
|
|
213
|
-
.c-btn {
|
|
214
|
-
width: 100%;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.c-btn + .c-btn {
|
|
218
|
-
margin-top: 16px;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// 'sm' displays
|
|
224
|
-
@media (min-width: 640px) {
|
|
225
|
-
.c-dialog {
|
|
226
|
-
.dialog-card-action-buttons {
|
|
227
|
-
.c-btn {
|
|
228
|
-
width: auto;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.c-btn + .c-btn {
|
|
232
|
-
margin-top: 0;
|
|
233
|
-
margin-left: 10px;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// 'md' displays
|
|
240
|
-
@media (min-width: 1024px) {
|
|
241
|
-
.c-dialog {
|
|
242
|
-
// position="top" (default) should be offset with 60px from the top
|
|
243
|
-
.q-dialog__inner.fixed-top {
|
|
244
|
-
padding: 0 60px;
|
|
245
|
-
|
|
246
|
-
.dialog-card {
|
|
247
|
-
top: 61px;
|
|
248
|
-
max-height: calc(100vh - 120px);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-dialog
|
|
3
|
+
data-id="dialog"
|
|
4
|
+
class="c-dialog"
|
|
5
|
+
:model-value="modelValue"
|
|
6
|
+
:position="position"
|
|
7
|
+
transition-show="fade"
|
|
8
|
+
transition-hide="fade"
|
|
9
|
+
no-refocus
|
|
10
|
+
@update:model-value="cancel"
|
|
11
|
+
@keydown.ctrl.s.prevent="confirm"
|
|
12
|
+
>
|
|
13
|
+
<c-dirty-check
|
|
14
|
+
:is-dirty="isDirty"
|
|
15
|
+
:is-dialog-open="modelValue"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<q-card
|
|
19
|
+
class="dialog-card"
|
|
20
|
+
:style="{ maxWidth: maxWidth ? maxWidth : false }"
|
|
21
|
+
>
|
|
22
|
+
<q-form
|
|
23
|
+
ref="dialogForm"
|
|
24
|
+
greedy
|
|
25
|
+
class="flex flex-col flex-nowrap max-h-full"
|
|
26
|
+
@submit.prevent=""
|
|
27
|
+
>
|
|
28
|
+
<q-card-section class="px-5 pt-6 pb-4">
|
|
29
|
+
<slot name="header">
|
|
30
|
+
<h3 data-id="dialog-title">
|
|
31
|
+
{{ title }}
|
|
32
|
+
</h3>
|
|
33
|
+
</slot>
|
|
34
|
+
<div
|
|
35
|
+
v-if="text"
|
|
36
|
+
class="mt-2px"
|
|
37
|
+
>
|
|
38
|
+
{{ text }}
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="absolute right-0 top-0">
|
|
42
|
+
<slot name="corner-buttons" />
|
|
43
|
+
<c-dialog-close-btn @click="cancel" />
|
|
44
|
+
</div>
|
|
45
|
+
</q-card-section>
|
|
46
|
+
|
|
47
|
+
<q-card-section
|
|
48
|
+
v-if="$slots.default"
|
|
49
|
+
class="px-5 pb-4 overflow-y-overlay flex-1"
|
|
50
|
+
:class="contentClass"
|
|
51
|
+
>
|
|
52
|
+
<slot />
|
|
53
|
+
</q-card-section>
|
|
54
|
+
|
|
55
|
+
<div class="dialog-card-action-buttons px-5 pt-2 pb-10">
|
|
56
|
+
<c-btn
|
|
57
|
+
v-if="!hideConfirmButton"
|
|
58
|
+
data-id="dialog-confirm-button"
|
|
59
|
+
:label="confirmButtonText || $t('inri.common.confirm')"
|
|
60
|
+
:disabled="confirmIsDisabled"
|
|
61
|
+
@click="confirm"
|
|
62
|
+
>
|
|
63
|
+
<q-tooltip v-if="confirmIsDisabled">
|
|
64
|
+
{{ disabledConfirmTooltip || $t('inri.dialog.confirm_tooltip_invalid_fields') }}
|
|
65
|
+
</q-tooltip>
|
|
66
|
+
</c-btn>
|
|
67
|
+
<c-btn
|
|
68
|
+
v-if="!hideCancelButton"
|
|
69
|
+
data-id="dialog-cancel-button"
|
|
70
|
+
:label="cancelButtonText || $t('inri.common.cancel')"
|
|
71
|
+
color="surface"
|
|
72
|
+
@click="cancel"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</q-form>
|
|
76
|
+
|
|
77
|
+
<q-inner-loading :showing="isLoading">
|
|
78
|
+
<c-spinner />
|
|
79
|
+
</q-inner-loading>
|
|
80
|
+
</q-card>
|
|
81
|
+
</q-dialog>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
import { PropType, computed, ref } from 'vue'
|
|
86
|
+
import notify from '../plugins/notify'
|
|
87
|
+
import dialog from '../plugins/dialog'
|
|
88
|
+
import { useI18n } from 'vue-i18n'
|
|
89
|
+
|
|
90
|
+
const { t } = useI18n()
|
|
91
|
+
|
|
92
|
+
const props = defineProps({
|
|
93
|
+
modelValue: Boolean,
|
|
94
|
+
title: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: '',
|
|
97
|
+
},
|
|
98
|
+
isDirty: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: undefined,
|
|
101
|
+
},
|
|
102
|
+
disableConfirm: Boolean,
|
|
103
|
+
disabledConfirmTooltip: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: undefined,
|
|
106
|
+
},
|
|
107
|
+
confirmButtonText: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: undefined,
|
|
110
|
+
},
|
|
111
|
+
cancelButtonText: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: undefined,
|
|
114
|
+
},
|
|
115
|
+
hideConfirmButton: Boolean,
|
|
116
|
+
hideCancelButton: Boolean,
|
|
117
|
+
ignoreDirtyCheckOnConfirm: Boolean,
|
|
118
|
+
isLoading: Boolean,
|
|
119
|
+
confirmCancelTitle: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: undefined,
|
|
122
|
+
},
|
|
123
|
+
confirmCancelMessage: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: undefined,
|
|
126
|
+
},
|
|
127
|
+
maxWidth: {
|
|
128
|
+
type: [String, Number],
|
|
129
|
+
default: '100%',
|
|
130
|
+
},
|
|
131
|
+
contentClass: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: '',
|
|
134
|
+
},
|
|
135
|
+
text: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: undefined,
|
|
138
|
+
},
|
|
139
|
+
position: {
|
|
140
|
+
type: String as PropType<'top' | 'standard' | 'right' | 'bottom' | 'left' | undefined>,
|
|
141
|
+
default: 'top',
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const emit = defineEmits([
|
|
146
|
+
'confirm',
|
|
147
|
+
'cancel',
|
|
148
|
+
])
|
|
149
|
+
|
|
150
|
+
// State etc.
|
|
151
|
+
const confirmIsDisabled = computed(() => {
|
|
152
|
+
return (
|
|
153
|
+
props.disableConfirm ||
|
|
154
|
+
props.isLoading ||
|
|
155
|
+
(!props.ignoreDirtyCheckOnConfirm && props.isDirty === false)
|
|
156
|
+
)
|
|
157
|
+
})
|
|
158
|
+
const dialogForm = ref()
|
|
159
|
+
|
|
160
|
+
// Functions
|
|
161
|
+
function cancel () {
|
|
162
|
+
if (props.isDirty) {
|
|
163
|
+
dialog.confirm({
|
|
164
|
+
title: props.confirmCancelTitle || t('inri.dialog.unsaved_changes_title'),
|
|
165
|
+
text: props.confirmCancelMessage || t('inri.dialog.unsaved_changes_message'),
|
|
166
|
+
}).onOk(() => {
|
|
167
|
+
emit('cancel')
|
|
168
|
+
})
|
|
169
|
+
} else {
|
|
170
|
+
emit('cancel')
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function confirm () {
|
|
175
|
+
if (!props.disableConfirm) {
|
|
176
|
+
dialogForm.value.validate().then(success => {
|
|
177
|
+
if (success) {
|
|
178
|
+
emit('confirm')
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
} else {
|
|
182
|
+
notify.error(props.disabledConfirmTooltip || t('inri.dialog.confirm_tooltip_invalid_fields'))
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// So that we can trigger confirm/cancel from a component ref
|
|
187
|
+
defineExpose({
|
|
188
|
+
confirm,
|
|
189
|
+
cancel,
|
|
190
|
+
})
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<style lang="scss">
|
|
194
|
+
// This css is also shared by the programmatic dialogs
|
|
195
|
+
.c-dialog {
|
|
196
|
+
.q-dialog__backdrop {
|
|
197
|
+
background: var(--dialog-backdrop-color);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.q-dialog__inner > div {
|
|
201
|
+
border-radius: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.dialog-card {
|
|
205
|
+
display: flex;
|
|
206
|
+
max-height: 100vh;
|
|
207
|
+
flex-direction: column;
|
|
208
|
+
width: 100%;
|
|
209
|
+
box-shadow: var(--dialog-shadow);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.dialog-card-action-buttons {
|
|
213
|
+
.c-btn {
|
|
214
|
+
width: 100%;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.c-btn + .c-btn {
|
|
218
|
+
margin-top: 16px;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 'sm' displays
|
|
224
|
+
@media (min-width: 640px) {
|
|
225
|
+
.c-dialog {
|
|
226
|
+
.dialog-card-action-buttons {
|
|
227
|
+
.c-btn {
|
|
228
|
+
width: auto;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.c-btn + .c-btn {
|
|
232
|
+
margin-top: 0;
|
|
233
|
+
margin-left: 10px;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 'md' displays
|
|
240
|
+
@media (min-width: 1024px) {
|
|
241
|
+
.c-dialog {
|
|
242
|
+
// position="top" (default) should be offset with 60px from the top
|
|
243
|
+
.q-dialog__inner.fixed-top {
|
|
244
|
+
padding: 0 60px;
|
|
245
|
+
|
|
246
|
+
.dialog-card {
|
|
247
|
+
top: 61px;
|
|
248
|
+
max-height: calc(100vh - 120px);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
</style>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<c-tile-btn
|
|
3
|
-
icon="mdi-close"
|
|
4
|
-
data-id="dialog-close-button"
|
|
5
|
-
:tooltip="$t('inri.common.close')"
|
|
6
|
-
small
|
|
7
|
-
class="absolute right-0 top-0"
|
|
8
|
-
/>
|
|
9
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<c-tile-btn
|
|
3
|
+
icon="mdi-close"
|
|
4
|
+
data-id="dialog-close-button"
|
|
5
|
+
:tooltip="$t('inri.common.close')"
|
|
6
|
+
small
|
|
7
|
+
class="absolute right-0 top-0"
|
|
8
|
+
/>
|
|
9
|
+
</template>
|