@quazardous/qdadm 2.22.0 → 2.22.1
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/package.json
CHANGED
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
* - #error: Custom error display
|
|
33
33
|
* - #loading: Custom loading display
|
|
34
34
|
*/
|
|
35
|
-
import { computed, type PropType } from 'vue'
|
|
35
|
+
import { computed, inject, type PropType } from 'vue'
|
|
36
|
+
import { GUARD_DIALOG_HOST } from '../../composables/useGuardStore'
|
|
36
37
|
import PageHeader from '../layout/PageHeader.vue'
|
|
37
38
|
import FormActions from './FormActions.vue'
|
|
38
39
|
import UnsavedChangesDialog from '../dialogs/UnsavedChangesDialog.vue'
|
|
@@ -122,6 +123,10 @@ const headerActions = computed<ResolvedAction[]>(() =>
|
|
|
122
123
|
// Get error message from fetchError
|
|
123
124
|
const fetchErrorMessage = computed<string | null>(() => formatFetchError(props.fetchError))
|
|
124
125
|
|
|
126
|
+
// A qdadm layout (AppLayout, BaseLayout) renders the registered guard dialog: rendering it here too
|
|
127
|
+
// stacked two identical dialogs (#2267). Without such a layout, this page renders it.
|
|
128
|
+
const layoutRendersGuardDialog = inject(GUARD_DIALOG_HOST, false)
|
|
129
|
+
|
|
125
130
|
// Guard dialog handlers
|
|
126
131
|
function onGuardSaveAndLeave(): void {
|
|
127
132
|
if (props.guardDialog?.onSaveAndLeave) {
|
|
@@ -225,7 +230,7 @@ function onGuardStay(): void {
|
|
|
225
230
|
|
|
226
231
|
<!-- Unsaved Changes Dialog -->
|
|
227
232
|
<UnsavedChangesDialog
|
|
228
|
-
v-if="guardDialog"
|
|
233
|
+
v-if="guardDialog && !layoutRendersGuardDialog"
|
|
229
234
|
:visible="guardDialog.visible.value"
|
|
230
235
|
:saving="saving"
|
|
231
236
|
:hasOnSave="guardDialog.hasOnSave"
|
|
@@ -19,7 +19,7 @@ import { useNavigation, type NavSection } from '../../composables/useNavigation'
|
|
|
19
19
|
import { prettifyRole } from '../../utils/formatters'
|
|
20
20
|
import { useApp } from '../../composables/useApp'
|
|
21
21
|
import { useAuth } from '../../composables/useAuth'
|
|
22
|
-
import { useGuardDialog } from '../../composables/useGuardStore'
|
|
22
|
+
import { useGuardDialog, GUARD_DIALOG_HOST } from '../../composables/useGuardStore'
|
|
23
23
|
import { useNavContext, type BreadcrumbItem, type NavLinkItem } from '../../composables/useNavContext'
|
|
24
24
|
import QdButton from '../base/QdButton.vue'
|
|
25
25
|
import Breadcrumb from 'primevue/breadcrumb'
|
|
@@ -56,6 +56,8 @@ const homeRoute = inject<string>('qdadmHomeRoute', 'home')
|
|
|
56
56
|
|
|
57
57
|
// Guard dialog from shared store (registered by useBareForm/useEntityItemFormPage when a form is active)
|
|
58
58
|
const guardDialog = useGuardDialog()
|
|
59
|
+
// This layout renders it: pages below do not render their own (#2267)
|
|
60
|
+
provide(GUARD_DIALOG_HOST, true)
|
|
59
61
|
|
|
60
62
|
const router = useRouter()
|
|
61
63
|
const route = useRoute()
|
|
@@ -35,7 +35,7 @@ import { RouterView } from 'vue-router'
|
|
|
35
35
|
import ConfirmDialog from 'primevue/confirmdialog'
|
|
36
36
|
import Zone from './Zone.vue'
|
|
37
37
|
import { LAYOUT_ZONES } from '../../zones/zones'
|
|
38
|
-
import { useGuardDialog } from '../../composables/useGuardStore'
|
|
38
|
+
import { useGuardDialog, GUARD_DIALOG_HOST } from '../../composables/useGuardStore'
|
|
39
39
|
import UnsavedChangesDialog from '../dialogs/UnsavedChangesDialog.vue'
|
|
40
40
|
import type { BreadcrumbItem, NavLinkItem } from '../../composables/useNavContext'
|
|
41
41
|
|
|
@@ -52,6 +52,8 @@ const hasMainSlot: boolean = !!slots.main
|
|
|
52
52
|
|
|
53
53
|
// Guard dialog from shared store (registered by useBareForm/useEntityItemFormPage when a form is active)
|
|
54
54
|
const guardDialog = useGuardDialog()
|
|
55
|
+
// This layout renders it: pages below do not render their own (#2267)
|
|
56
|
+
provide(GUARD_DIALOG_HOST, true)
|
|
55
57
|
|
|
56
58
|
// Provide breadcrumb/navlinks override mechanism for child pages
|
|
57
59
|
const breadcrumbOverride = ref<BreadcrumbItem[] | null>(null)
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
* and parent components (AppLayout) to render it.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { shallowRef, type ShallowRef, type Ref } from 'vue'
|
|
8
|
+
import { shallowRef, type InjectionKey, type ShallowRef, type Ref } from 'vue'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Provided by a layout that renders the registered guard dialog (#2267). FormPage renders its own dialog only
|
|
12
|
+
* without one above it, so a dirty form never shows the dialog twice.
|
|
13
|
+
*/
|
|
14
|
+
export const GUARD_DIALOG_HOST: InjectionKey<boolean> = Symbol('qdadm.guardDialogHost')
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* Guard dialog interface
|