adminforth 2.45.0-next.3 → 2.45.0-next.5
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/dist/spa/src/adminforth.ts +5 -3
- package/dist/spa/src/components/AcceptModal.vue +24 -25
- package/dist/spa/src/stores/modal.ts +5 -1
- package/dist/spa/src/types/FrontendAPI.ts +10 -0
- package/dist/spa/src/utils/listUtils.ts +1 -1
- package/dist/spa/src/utils/utils.ts +4 -2
- package/dist/types/FrontendAPI.d.ts +8 -0
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/package.json +1 -1
|
@@ -118,11 +118,13 @@ class FrontendAPI implements FrontendAPIInterface {
|
|
|
118
118
|
|
|
119
119
|
confirm(params: Parameters<FrontendAPIInterface['confirm']>[0]): ReturnType<FrontendAPIInterface['confirm']> {
|
|
120
120
|
return new Promise((resolve, reject) => {
|
|
121
|
-
this.modalStore.setModalContent({
|
|
122
|
-
|
|
121
|
+
this.modalStore.setModalContent({
|
|
122
|
+
title: params.title,
|
|
123
|
+
guardMessage: params.guardMessage,
|
|
124
|
+
content: params.message,
|
|
123
125
|
contentHTML: params.messageHtml,
|
|
124
126
|
acceptText: params.yes || 'Yes',
|
|
125
|
-
cancelText: params.no || 'Cancel'
|
|
127
|
+
cancelText: params.no || 'Cancel'
|
|
126
128
|
})
|
|
127
129
|
this.modalStore.onAcceptFunction = resolve
|
|
128
130
|
this.modalStore.onCancelFunction = reject
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
ref="modalRef"
|
|
5
5
|
:beforeCloseFunction="()=>{modalStore.onAcceptFunction(false);modalStore.isOpened=false}"
|
|
6
6
|
backgroundCustomClasses="z-[998]"
|
|
7
|
-
modalCustomClasses="z-[999]"
|
|
7
|
+
modalCustomClasses="z-[999] flex items-center justify-center"
|
|
8
8
|
>
|
|
9
|
-
<div class="relative p-6 sm:p-8 w-[440px] bg-white rounded-
|
|
9
|
+
<div class="relative p-6 sm:p-8 w-[440px] bg-white rounded-lg shadow-xl dark:bg-gray-800" >
|
|
10
10
|
|
|
11
11
|
<button type="button" @click="modalStore.togleModal()" class="absolute top-4 right-4 text-gray-400 hover:text-gray-900 transition-colors dark:hover:text-white" >
|
|
12
12
|
<svg class="w-3.5 h-3.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
|
|
@@ -14,28 +14,30 @@
|
|
|
14
14
|
</svg>
|
|
15
15
|
</button>
|
|
16
16
|
|
|
17
|
-
<div class="text-center">
|
|
18
|
-
<div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-red-50 mb-
|
|
17
|
+
<div class="text-center flex flex-col">
|
|
18
|
+
<div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-red-50 mb-4 relative dark:bg-red-900/20">
|
|
19
19
|
<IconClipboardDocumentSolid class="w-10 h-10 text-red-500" />
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
<div class="absolute bottom-1 right-1 bg-red-500 rounded-full w-[18px] h-[18px] flex items-center justify-center border-2 border-white dark:border-gray-800">
|
|
21
|
+
<span class="text-white text-[10px] font-medium">!</span>
|
|
22
|
+
</div>
|
|
22
23
|
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<h3 class="mb-4 text-2xl font-bold text-gray-900 dark:text-white">
|
|
26
|
-
There are unsaved changes.
|
|
27
|
-
</h3>
|
|
28
24
|
|
|
29
|
-
<div class="
|
|
30
|
-
<
|
|
31
|
-
|
|
25
|
+
<div class="flex flex-col gap-3">
|
|
26
|
+
<h3 v-if="modalStore?.modalContent?.title" class="text-2xl font-bold text-gray-900 dark:text-white">
|
|
27
|
+
{{ modalStore.modalContent.title }}
|
|
28
|
+
</h3>
|
|
29
|
+
|
|
30
|
+
<div class="text-[15px] text-gray-600 dark:text-gray-300">
|
|
31
|
+
<div v-if="modalStore?.modalContent?.contentHTML" class="font-medium" v-html="modalStore.modalContent.contentHTML"></div>
|
|
32
|
+
<p v-else-if="modalStore?.modalContent?.content" class="font-medium">{{ modalStore.modalContent.content }}</p>
|
|
33
|
+
</div>
|
|
32
34
|
</div>
|
|
33
35
|
|
|
34
|
-
<hr class="border-t border-gray-100 dark:border-gray-700
|
|
36
|
+
<hr class="border-t border-gray-100 dark:border-gray-700 my-6">
|
|
35
37
|
|
|
36
38
|
<div class="flex justify-center gap-4 w-full">
|
|
37
39
|
<button @click="()=>{modalStore.onAcceptFunction(false);modalStore.togleModal()}" type="button" class="flex-1 py-2.5 px-4 text-sm font-medium text-gray-700 bg-white rounded-lg border border-gray-200 hover:bg-gray-50 focus:ring-4 focus:ring-gray-100 transition-all dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700">
|
|
38
|
-
|
|
40
|
+
{{ modalStore?.modalContent?.cancelText }}
|
|
39
41
|
</button>
|
|
40
42
|
|
|
41
43
|
<button
|
|
@@ -44,18 +46,15 @@
|
|
|
44
46
|
class="flex-1 flex items-center justify-center py-2.5 px-4 text-sm font-medium transition-all focus:outline-none
|
|
45
47
|
text-white bg-red-600 hover:bg-red-700
|
|
46
48
|
dark:bg-red-500 dark:hover:bg-red-600
|
|
47
|
-
border
|
|
48
|
-
rounded-lg shadow-sm focus:z-10 focus:ring-4
|
|
49
|
+
border-none rounded-lg shadow-sm focus:z-10 focus:ring-4
|
|
49
50
|
focus:ring-red-100 dark:focus:ring-red-900 gap-1">
|
|
50
|
-
|
|
51
|
+
{{ modalStore?.modalContent?.acceptText }}
|
|
51
52
|
</button>
|
|
52
53
|
</div>
|
|
53
54
|
|
|
54
|
-
<div class="flex items-center justify-center mt-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
</svg>
|
|
58
|
-
<span>Your changes will not be saved</span>
|
|
55
|
+
<div v-if="modalStore?.modalContent?.guardMessage" class="flex items-center justify-center mt-6 text-xs text-gray-400 gap-1.5 font-medium">
|
|
56
|
+
<IconShieldCheck class="w-4 h-4" />
|
|
57
|
+
<span> {{ modalStore?.modalContent?.guardMessage }}</span>
|
|
59
58
|
</div>
|
|
60
59
|
|
|
61
60
|
</div>
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
import { watch, ref } from 'vue';
|
|
69
68
|
import { useModalStore } from '@/stores/modal';
|
|
70
69
|
import { Modal } from '@/afcl';
|
|
71
|
-
import { IconClipboardDocumentSolid } from '@iconify-prerendered/vue-heroicons';
|
|
70
|
+
import { IconClipboardDocumentSolid, IconShieldCheck } from '@iconify-prerendered/vue-heroicons';
|
|
72
71
|
|
|
73
72
|
|
|
74
73
|
const modalRef = ref();
|
|
@@ -3,6 +3,7 @@ import { defineStore } from 'pinia'
|
|
|
3
3
|
|
|
4
4
|
type ModalContentType = {
|
|
5
5
|
title?: string;
|
|
6
|
+
guardMessage?: string;
|
|
6
7
|
content?: string;
|
|
7
8
|
contentHTML?: string;
|
|
8
9
|
acceptText?: string;
|
|
@@ -13,6 +14,7 @@ import { defineStore } from 'pinia'
|
|
|
13
14
|
export const useModalStore = defineStore('modal', () => {
|
|
14
15
|
const modalContent = ref({
|
|
15
16
|
title: 'title',
|
|
17
|
+
guardMessage: 'guardMessage',
|
|
16
18
|
content: '',
|
|
17
19
|
contentHTML: '',
|
|
18
20
|
acceptText: 'acceptText',
|
|
@@ -32,7 +34,8 @@ export const useModalStore = defineStore('modal', () => {
|
|
|
32
34
|
}
|
|
33
35
|
function setModalContent(content: ModalContentType) {
|
|
34
36
|
modalContent.value = {
|
|
35
|
-
title: content.title || '
|
|
37
|
+
title: content.title || '',
|
|
38
|
+
guardMessage: content.guardMessage || '',
|
|
36
39
|
content: content.content || '',
|
|
37
40
|
contentHTML: content.contentHTML || '',
|
|
38
41
|
acceptText: content.acceptText || 'acceptText',
|
|
@@ -43,6 +46,7 @@ export const useModalStore = defineStore('modal', () => {
|
|
|
43
46
|
isOpened.value = false;
|
|
44
47
|
modalContent.value = {
|
|
45
48
|
title: 'title',
|
|
49
|
+
guardMessage: 'guardMessage',
|
|
46
50
|
content: 'content',
|
|
47
51
|
contentHTML: '',
|
|
48
52
|
acceptText: 'acceptText',
|
|
@@ -160,6 +160,16 @@ export interface FrontendAPIInterface {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export type ConfirmParams = {
|
|
163
|
+
/**
|
|
164
|
+
* The title to display in the dialog
|
|
165
|
+
*/
|
|
166
|
+
title?: string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The message to display in the dialog as a warning that action is irreversible
|
|
170
|
+
*/
|
|
171
|
+
guardMessage?: string;
|
|
172
|
+
|
|
163
173
|
/**
|
|
164
174
|
* The message to display in the dialog
|
|
165
175
|
*/
|
|
@@ -781,9 +781,11 @@ export async function onBeforeRouteLeaveCreateEditViewGuard(initialValues: any,
|
|
|
781
781
|
generateMessageHtmlForRecordChange(changedFields, t);
|
|
782
782
|
|
|
783
783
|
const answer = await confirm({
|
|
784
|
+
title: t('There are unsaved changes'),
|
|
785
|
+
guardMessage: t('Your changes will not be saved'),
|
|
784
786
|
messageHtml,
|
|
785
|
-
yes: t('
|
|
786
|
-
no: t('
|
|
787
|
+
yes: t('Leave without saving'),
|
|
788
|
+
no: t('Stay and continue'),
|
|
787
789
|
});
|
|
788
790
|
|
|
789
791
|
return answer;
|
|
@@ -164,6 +164,14 @@ export interface FrontendAPIInterface {
|
|
|
164
164
|
}>): void;
|
|
165
165
|
}
|
|
166
166
|
export type ConfirmParams = {
|
|
167
|
+
/**
|
|
168
|
+
* The title to display in the dialog
|
|
169
|
+
*/
|
|
170
|
+
title?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The message to display in the dialog as a warning that action is irreversible
|
|
173
|
+
*/
|
|
174
|
+
guardMessage?: string;
|
|
167
175
|
/**
|
|
168
176
|
* The message to display in the dialog
|
|
169
177
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontendAPI.d.ts","sourceRoot":"","sources":["../../types/FrontendAPI.ts"],"names":[],"mappings":"AAA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G;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,OAAO,YAAY,CAAC;IAEnD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAE/B;;OAEG;IACH,OAAO,CAAC,EAAE;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CAE3C,CAAA;AAID,oBAAY,YAAY;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,IAAI,SAAS;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontendAPI.js","sourceRoot":"","sources":["../../types/FrontendAPI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FrontendAPI.js","sourceRoot":"","sources":["../../types/FrontendAPI.ts"],"names":[],"mappings":"AA8NA,MAAM,CAAN,IAAY,YAKT;AALH,WAAY,YAAY;IACpB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,6BAAa,CAAA;AACf,CAAC,EALS,YAAY,KAAZ,YAAY,QAKrB"}
|