sprintify-ui 0.0.6 → 0.0.8
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/README.md +13 -0
- package/dist/sprintify-ui.es.js +9166 -8089
- package/dist/types/src/components/BaseApp.vue.d.ts +48 -0
- package/dist/types/src/components/BaseAppDialogs.vue.d.ts +80 -0
- package/dist/types/src/components/BaseAppNotifications.vue.d.ts +44 -0
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +7 -7
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +7 -7
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +4 -4
- package/dist/types/src/components/BaseDataIterator.vue.d.ts +4 -4
- package/dist/types/src/components/BaseDataTable.vue.d.ts +4 -4
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +20 -1
- package/dist/types/src/components/BaseInput.vue.d.ts +4 -4
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +4 -4
- package/dist/types/src/components/BasePassword.vue.d.ts +1 -1
- package/dist/types/src/components/BaseSelect.vue.d.ts +1 -1
- package/dist/types/src/components/BaseTextarea.vue.d.ts +4 -4
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +9 -1
- package/dist/types/src/index.d.ts +42 -32
- package/dist/types/src/stores/dialogs.d.ts +9 -0
- package/dist/types/src/stores/notifications.d.ts +10 -0
- package/dist/types/src/stores/systemAlerts.d.ts +9 -0
- package/dist/types/src/types/types.d.ts +58 -0
- package/package.json +1 -1
- package/src/components/BaseApp.vue +16 -0
- package/src/components/BaseAppDialogs.vue +113 -0
- package/src/components/BaseAppNotifications.vue +73 -0
- package/src/components/BaseDataTable.vue +8 -8
- package/src/components/BaseDatePicker.vue +1 -1
- package/src/components/BaseDateSelect.vue +1 -1
- package/src/components/BaseDialog.vue +1 -0
- package/src/components/BaseFileUploader.vue +16 -7
- package/src/components/BaseInputLabel.vue +3 -3
- package/src/components/BaseMediaLibrary.vue +10 -10
- package/src/components/BaseTagAutocomplete.vue +4 -4
- package/src/components/index.ts +16 -1
- package/src/index.ts +23 -14
- package/src/lang/en.json +9 -8
- package/src/lang/fr.json +9 -8
- package/src/stores/dialogs.ts +45 -0
- package/src/stores/notifications.ts +47 -0
- package/src/stores/systemAlerts.ts +33 -0
- package/src/types/types.ts +67 -0
- package/dist/types/src/components/BaseLoadingPage.vue.d.ts +0 -2
- package/src/components/BaseLoadingPage.vue +0 -19
|
@@ -6,9 +6,9 @@ declare const _default: {
|
|
|
6
6
|
$props: Partial<{
|
|
7
7
|
required: boolean;
|
|
8
8
|
type: string;
|
|
9
|
+
name: string;
|
|
9
10
|
placeholder: string;
|
|
10
11
|
disabled: boolean;
|
|
11
|
-
name: string;
|
|
12
12
|
autocomplete: boolean;
|
|
13
13
|
preventSubmit: boolean;
|
|
14
14
|
rows: number;
|
|
@@ -51,7 +51,7 @@ declare const _default: {
|
|
|
51
51
|
};
|
|
52
52
|
}>> & {
|
|
53
53
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
54
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "type" | "
|
|
54
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "type" | "name" | "placeholder" | "disabled" | "autocomplete" | "preventSubmit" | "rows">;
|
|
55
55
|
$attrs: {
|
|
56
56
|
[x: string]: unknown;
|
|
57
57
|
};
|
|
@@ -107,9 +107,9 @@ declare const _default: {
|
|
|
107
107
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], string, {
|
|
108
108
|
required: boolean;
|
|
109
109
|
type: string;
|
|
110
|
+
name: string;
|
|
110
111
|
placeholder: string;
|
|
111
112
|
disabled: boolean;
|
|
112
|
-
name: string;
|
|
113
113
|
autocomplete: boolean;
|
|
114
114
|
preventSubmit: boolean;
|
|
115
115
|
rows: number;
|
|
@@ -218,9 +218,9 @@ declare const _default: {
|
|
|
218
218
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", {
|
|
219
219
|
required: boolean;
|
|
220
220
|
type: string;
|
|
221
|
+
name: string;
|
|
221
222
|
placeholder: string;
|
|
222
223
|
disabled: boolean;
|
|
223
|
-
name: string;
|
|
224
224
|
autocomplete: boolean;
|
|
225
225
|
preventSubmit: boolean;
|
|
226
226
|
rows: number;
|
|
@@ -19,7 +19,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
19
|
onKeyDown(event: any): void;
|
|
20
20
|
onKeyUp(event: any): void;
|
|
21
21
|
onFocus(event: any): void;
|
|
22
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("input" | "
|
|
22
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("input" | "submit" | "update:modelValue" | "focus")[], "input" | "submit" | "update:modelValue" | "focus", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
23
|
modelValue: {
|
|
24
24
|
default: string;
|
|
25
25
|
type: StringConstructor;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import BaseAlert from './BaseAlert.vue';
|
|
2
|
+
import BaseApp from './BaseApp.vue';
|
|
3
|
+
import BaseAppDialogs from './BaseAppDialogs.vue';
|
|
4
|
+
import BaseAppNotifications from './BaseAppNotifications.vue';
|
|
2
5
|
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
3
6
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
4
7
|
import BaseAvatar from './BaseAvatar.vue';
|
|
@@ -16,10 +19,15 @@ import BaseDataIterator from './BaseDataIterator.vue';
|
|
|
16
19
|
import BaseDataTable from './BaseDataTable.vue';
|
|
17
20
|
import BaseDatePicker from './BaseDatePicker.vue';
|
|
18
21
|
import BaseDateSelect from './BaseDateSelect.vue';
|
|
22
|
+
import BaseDescriptionList from './BaseDescriptionList.vue';
|
|
23
|
+
import BaseDescriptionListItem from './BaseDescriptionListItem.vue';
|
|
24
|
+
import BaseDialog from './BaseDialog.vue';
|
|
25
|
+
import BaseFilePicker from './BaseFilePicker.vue';
|
|
26
|
+
import BaseFileUploader from './BaseFileUploader.vue';
|
|
19
27
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
20
28
|
import BaseLoadingCover from './BaseLoadingCover.vue';
|
|
21
29
|
import BaseMenu from './BaseMenu.vue';
|
|
22
30
|
import BaseMenuItem from './BaseMenuItem.vue';
|
|
23
31
|
import BaseTable from './BaseTable.vue';
|
|
24
32
|
import BaseTableColumn from './BaseTableColumn.vue';
|
|
25
|
-
export { BaseAlert, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseCard, BaseCardRow, BaseClipboard, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseIcon, BaseLoadingCover, BaseMenu, BaseMenuItem, BaseTable, BaseTableColumn, };
|
|
33
|
+
export { BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseCard, BaseCardRow, BaseClipboard, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseFilePicker, BaseFileUploader, BaseIcon, BaseLoadingCover, BaseMenu, BaseMenuItem, BaseTable, BaseTableColumn, };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { App } from 'vue';
|
|
3
3
|
import { I18n } from 'vue-i18n';
|
|
4
|
+
import { useDialogsStore } from './stores/dialogs';
|
|
5
|
+
import { useNotificationsStore } from './stores/notifications';
|
|
6
|
+
import { useSystemAlertStore } from './stores/systemAlerts';
|
|
4
7
|
declare const messages: {
|
|
5
8
|
en: {
|
|
6
9
|
sui: {
|
|
@@ -42,13 +45,6 @@ declare const messages: {
|
|
|
42
45
|
the_file_size_must_not_exceed_x: string;
|
|
43
46
|
the_file_type_is_invalid: string;
|
|
44
47
|
type_to_start_your_search: string;
|
|
45
|
-
up_to_x: string;
|
|
46
|
-
whoops: string;
|
|
47
|
-
x_rows_selected: string;
|
|
48
|
-
year: string;
|
|
49
|
-
yes_delete: string;
|
|
50
|
-
you_can_upload_up_to_n_files: string;
|
|
51
|
-
you_cannot_select_more_than_x_items: string;
|
|
52
48
|
units: {
|
|
53
49
|
b: string;
|
|
54
50
|
gb: string;
|
|
@@ -56,6 +52,14 @@ declare const messages: {
|
|
|
56
52
|
mb: string;
|
|
57
53
|
tb: string;
|
|
58
54
|
};
|
|
55
|
+
up_to_x: string;
|
|
56
|
+
upload_failed: string;
|
|
57
|
+
whoops: string;
|
|
58
|
+
x_rows_selected: string;
|
|
59
|
+
year: string;
|
|
60
|
+
yes_delete: string;
|
|
61
|
+
you_can_upload_up_to_n_files: string;
|
|
62
|
+
you_cannot_select_more_than_x_items: string;
|
|
59
63
|
};
|
|
60
64
|
};
|
|
61
65
|
fr: {
|
|
@@ -98,13 +102,6 @@ declare const messages: {
|
|
|
98
102
|
the_file_size_must_not_exceed_x: string;
|
|
99
103
|
the_file_type_is_invalid: string;
|
|
100
104
|
type_to_start_your_search: string;
|
|
101
|
-
up_to_x: string;
|
|
102
|
-
whoops: string;
|
|
103
|
-
x_rows_selected: string;
|
|
104
|
-
year: string;
|
|
105
|
-
yes_delete: string;
|
|
106
|
-
you_can_upload_up_to_n_files: string;
|
|
107
|
-
you_cannot_select_more_than_x_items: string;
|
|
108
105
|
units: {
|
|
109
106
|
b: string;
|
|
110
107
|
gb: string;
|
|
@@ -112,18 +109,26 @@ declare const messages: {
|
|
|
112
109
|
mb: string;
|
|
113
110
|
tb: string;
|
|
114
111
|
};
|
|
112
|
+
up_to_x: string;
|
|
113
|
+
upload_failed: string;
|
|
114
|
+
whoops: string;
|
|
115
|
+
x_rows_selected: string;
|
|
116
|
+
year: string;
|
|
117
|
+
yes_delete: string;
|
|
118
|
+
you_can_upload_up_to_n_files: string;
|
|
119
|
+
you_cannot_select_more_than_x_items: string;
|
|
115
120
|
};
|
|
116
121
|
};
|
|
117
122
|
};
|
|
118
123
|
import './assets/main.css';
|
|
119
|
-
interface
|
|
124
|
+
export interface Options {
|
|
120
125
|
i18n?: I18n<typeof messages, {}, {}, string, true>;
|
|
121
126
|
http?: AxiosInstance;
|
|
122
127
|
upload_url?: string;
|
|
123
128
|
formatQueryString?: (params: Record<string, any>) => string;
|
|
124
129
|
parseQueryString?: (params: string) => Record<string, any>;
|
|
125
130
|
}
|
|
126
|
-
declare const
|
|
131
|
+
declare const config: {
|
|
127
132
|
i18n: I18n<{
|
|
128
133
|
en: {
|
|
129
134
|
sui: {
|
|
@@ -165,13 +170,6 @@ declare const pluginConfig: {
|
|
|
165
170
|
the_file_size_must_not_exceed_x: string;
|
|
166
171
|
the_file_type_is_invalid: string;
|
|
167
172
|
type_to_start_your_search: string;
|
|
168
|
-
up_to_x: string;
|
|
169
|
-
whoops: string;
|
|
170
|
-
x_rows_selected: string;
|
|
171
|
-
year: string;
|
|
172
|
-
yes_delete: string;
|
|
173
|
-
you_can_upload_up_to_n_files: string;
|
|
174
|
-
you_cannot_select_more_than_x_items: string;
|
|
175
173
|
units: {
|
|
176
174
|
b: string;
|
|
177
175
|
gb: string;
|
|
@@ -179,6 +177,14 @@ declare const pluginConfig: {
|
|
|
179
177
|
mb: string;
|
|
180
178
|
tb: string;
|
|
181
179
|
};
|
|
180
|
+
up_to_x: string;
|
|
181
|
+
upload_failed: string;
|
|
182
|
+
whoops: string;
|
|
183
|
+
x_rows_selected: string;
|
|
184
|
+
year: string;
|
|
185
|
+
yes_delete: string;
|
|
186
|
+
you_can_upload_up_to_n_files: string;
|
|
187
|
+
you_cannot_select_more_than_x_items: string;
|
|
182
188
|
};
|
|
183
189
|
};
|
|
184
190
|
fr: {
|
|
@@ -221,13 +227,6 @@ declare const pluginConfig: {
|
|
|
221
227
|
the_file_size_must_not_exceed_x: string;
|
|
222
228
|
the_file_type_is_invalid: string;
|
|
223
229
|
type_to_start_your_search: string;
|
|
224
|
-
up_to_x: string;
|
|
225
|
-
whoops: string;
|
|
226
|
-
x_rows_selected: string;
|
|
227
|
-
year: string;
|
|
228
|
-
yes_delete: string;
|
|
229
|
-
you_can_upload_up_to_n_files: string;
|
|
230
|
-
you_cannot_select_more_than_x_items: string;
|
|
231
230
|
units: {
|
|
232
231
|
b: string;
|
|
233
232
|
gb: string;
|
|
@@ -235,6 +234,14 @@ declare const pluginConfig: {
|
|
|
235
234
|
mb: string;
|
|
236
235
|
tb: string;
|
|
237
236
|
};
|
|
237
|
+
up_to_x: string;
|
|
238
|
+
upload_failed: string;
|
|
239
|
+
whoops: string;
|
|
240
|
+
x_rows_selected: string;
|
|
241
|
+
year: string;
|
|
242
|
+
yes_delete: string;
|
|
243
|
+
you_can_upload_up_to_n_files: string;
|
|
244
|
+
you_cannot_select_more_than_x_items: string;
|
|
238
245
|
};
|
|
239
246
|
};
|
|
240
247
|
}, {}, {}, string, true>;
|
|
@@ -243,7 +250,7 @@ declare const pluginConfig: {
|
|
|
243
250
|
formatQueryString(params: Record<string, any>): string;
|
|
244
251
|
parseQueryString(params: string): Record<string, any>;
|
|
245
252
|
};
|
|
246
|
-
declare function install(app: App,
|
|
253
|
+
declare function install(app: App, options?: Options): void;
|
|
247
254
|
declare const _default: {
|
|
248
255
|
install: typeof install;
|
|
249
256
|
};
|
|
@@ -252,4 +259,7 @@ export * from './components';
|
|
|
252
259
|
export * from './constants';
|
|
253
260
|
export * from './utils';
|
|
254
261
|
export { messages };
|
|
255
|
-
export {
|
|
262
|
+
export { config };
|
|
263
|
+
export { useDialogsStore };
|
|
264
|
+
export { useNotificationsStore };
|
|
265
|
+
export { useSystemAlertStore };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dialog, DialogOptions } from '../types/types';
|
|
2
|
+
export declare const useDialogsStore: import("pinia").StoreDefinition<"dialogs", {
|
|
3
|
+
count: number;
|
|
4
|
+
dialogs: Dialog[];
|
|
5
|
+
}, {}, {
|
|
6
|
+
push(options: DialogOptions): void;
|
|
7
|
+
remove(dialog: Dialog): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Notification, NotificationOptions } from '../types/types';
|
|
2
|
+
export declare const useNotificationsStore: import("pinia").StoreDefinition<"notifications", {
|
|
3
|
+
count: number;
|
|
4
|
+
notifications: Notification[];
|
|
5
|
+
timeouts: Record<number, number>;
|
|
6
|
+
}, {}, {
|
|
7
|
+
push(options: NotificationOptions): void;
|
|
8
|
+
remove(notification: Notification): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SystemAlert, SystemAlertOptions } from '../types/types';
|
|
2
|
+
export declare const useSystemAlertStore: import("pinia").StoreDefinition<"systemAlerts", {
|
|
3
|
+
count: number;
|
|
4
|
+
systemAlerts: SystemAlert[];
|
|
5
|
+
}, {}, {
|
|
6
|
+
push(systemAlert: SystemAlertOptions): void;
|
|
7
|
+
remove(systemAlert: SystemAlert): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}>;
|
|
@@ -86,3 +86,61 @@ export interface BaseTableColumn {
|
|
|
86
86
|
thAttrs: (column: BaseTableColumn) => Record<string, any>;
|
|
87
87
|
tdAttrs: (row: Row, column: BaseTableColumn) => Record<string, any>;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* System alert
|
|
91
|
+
*/
|
|
92
|
+
export interface SystemAlertOptions {
|
|
93
|
+
color?: 'info' | 'success' | 'danger' | 'warning';
|
|
94
|
+
message: string;
|
|
95
|
+
to?: RouteLocationRaw;
|
|
96
|
+
action?: () => void;
|
|
97
|
+
closable?: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface SystemAlert {
|
|
100
|
+
id: number;
|
|
101
|
+
color: 'info' | 'success' | 'danger' | 'warning';
|
|
102
|
+
message: string;
|
|
103
|
+
to?: RouteLocationRaw;
|
|
104
|
+
action?: () => void;
|
|
105
|
+
closable: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Dialog
|
|
109
|
+
*/
|
|
110
|
+
export interface DialogOptions {
|
|
111
|
+
color?: 'info' | 'success' | 'danger' | 'warning';
|
|
112
|
+
title: string;
|
|
113
|
+
message: string;
|
|
114
|
+
confirmText?: string;
|
|
115
|
+
cancelText?: string;
|
|
116
|
+
closeOnOutsideClick?: boolean;
|
|
117
|
+
onConfirm?: () => void;
|
|
118
|
+
onCancel?: () => void;
|
|
119
|
+
}
|
|
120
|
+
export interface Dialog {
|
|
121
|
+
id: number;
|
|
122
|
+
color: 'info' | 'success' | 'danger' | 'warning';
|
|
123
|
+
title: string;
|
|
124
|
+
message: string;
|
|
125
|
+
confirmText: string;
|
|
126
|
+
cancelText: string;
|
|
127
|
+
closeOnOutsideClick: boolean;
|
|
128
|
+
onConfirm: () => void;
|
|
129
|
+
onCancel: () => void;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Notification
|
|
133
|
+
*/
|
|
134
|
+
export interface NotificationOptions {
|
|
135
|
+
title: string;
|
|
136
|
+
text: string;
|
|
137
|
+
color?: 'info' | 'success' | 'danger' | 'warning';
|
|
138
|
+
duration?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface Notification {
|
|
141
|
+
id: number;
|
|
142
|
+
title: string;
|
|
143
|
+
text: string;
|
|
144
|
+
color: 'info' | 'success' | 'danger' | 'warning';
|
|
145
|
+
duration: number;
|
|
146
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="min-h-full">
|
|
3
|
+
<slot />
|
|
4
|
+
|
|
5
|
+
<!-- Notifications -->
|
|
6
|
+
<BaseAppNotifications />
|
|
7
|
+
|
|
8
|
+
<!-- Dialogs -->
|
|
9
|
+
<BaseAppDialogs />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import BaseAppDialogs from './BaseAppDialogs.vue';
|
|
15
|
+
import BaseAppNotifications from './BaseAppNotifications.vue';
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<Transition
|
|
4
|
+
appear
|
|
5
|
+
enter-active-class="duration-300 ease-out"
|
|
6
|
+
enter-from-class="opacity-0"
|
|
7
|
+
enter-to-class="opacity-100"
|
|
8
|
+
leave-active-class="duration-200 ease-in"
|
|
9
|
+
leave-from-class="opacity-100"
|
|
10
|
+
leave-to-class="opacity-0"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
v-if="dialogs.length"
|
|
14
|
+
class="fixed inset-0 z-20 h-full w-full bg-black bg-opacity-60"
|
|
15
|
+
/>
|
|
16
|
+
</Transition>
|
|
17
|
+
|
|
18
|
+
<TransitionGroup
|
|
19
|
+
appear
|
|
20
|
+
enter-active-class="duration-300 ease-out"
|
|
21
|
+
enter-from-class="translate-y-10 opacity-0"
|
|
22
|
+
enter-to-class="translate-y-0 opacity-100"
|
|
23
|
+
leave-active-class="duration-200 ease-in"
|
|
24
|
+
leave-from-class="translate-y-0 opacity-100"
|
|
25
|
+
leave-to-class="translate-y-10 opacity-0"
|
|
26
|
+
tag="div"
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
v-for="dialog in dialogs"
|
|
30
|
+
:key="dialog.id"
|
|
31
|
+
scroll-lock-target
|
|
32
|
+
class="fixed inset-0 z-20 transform overflow-y-auto"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
class="fixed inset-0 h-full w-full"
|
|
39
|
+
@click="
|
|
40
|
+
dialog.closeOnOutsideClick
|
|
41
|
+
? cancel(dialog)
|
|
42
|
+
: refuseAnimation(dialog)
|
|
43
|
+
"
|
|
44
|
+
/>
|
|
45
|
+
<BaseDialog
|
|
46
|
+
:class="animationClasses[dialog.id] ?? ''"
|
|
47
|
+
:color="dialog.color"
|
|
48
|
+
:title="dialog.title"
|
|
49
|
+
:message="dialog.message"
|
|
50
|
+
:confirm-text="dialog.confirmText"
|
|
51
|
+
:cancel-text="dialog.cancelText"
|
|
52
|
+
@cancel="cancel(dialog)"
|
|
53
|
+
@confirm="confirm(dialog)"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</TransitionGroup>
|
|
58
|
+
</Teleport>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script lang="ts" setup>
|
|
62
|
+
import { Ref } from 'vue';
|
|
63
|
+
import { Dialog } from '@/types/types';
|
|
64
|
+
import BaseDialog from './BaseDialog.vue';
|
|
65
|
+
import { useDialogsStore } from '@/stores/dialogs';
|
|
66
|
+
import { disableScroll, enableScroll } from '@/utils/scrollPreventer';
|
|
67
|
+
|
|
68
|
+
const dialogStore = useDialogsStore();
|
|
69
|
+
|
|
70
|
+
const dialogs = computed(() => {
|
|
71
|
+
console.log(dialogStore.dialogs);
|
|
72
|
+
|
|
73
|
+
return dialogStore.dialogs;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
function confirm(dialog: Dialog) {
|
|
77
|
+
dialog.onConfirm();
|
|
78
|
+
remove(dialog);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function cancel(dialog: Dialog) {
|
|
82
|
+
dialog.onCancel();
|
|
83
|
+
remove(dialog);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function remove(dialog: Dialog) {
|
|
87
|
+
dialogStore.remove(dialog);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const animationClasses = ref({}) as Ref<Record<string, string>>;
|
|
91
|
+
|
|
92
|
+
function refuseAnimation(dialog: Dialog) {
|
|
93
|
+
animationClasses.value[dialog.id] = '';
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
animationClasses.value[dialog.id] = 'animate-shake';
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
watch(
|
|
100
|
+
() => dialogs.value.length,
|
|
101
|
+
() => {
|
|
102
|
+
if (dialogs.value.length == 0) {
|
|
103
|
+
enableScroll();
|
|
104
|
+
} else {
|
|
105
|
+
disableScroll();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
defineExpose({
|
|
111
|
+
dialogs,
|
|
112
|
+
});
|
|
113
|
+
</script>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div
|
|
4
|
+
class="pointer-events-none fixed inset-0 flex items-end justify-end p-6 md:p-8"
|
|
5
|
+
>
|
|
6
|
+
<div class="w-full max-w-sm">
|
|
7
|
+
<TransitionGroup
|
|
8
|
+
enter-active-class="transition duration-300 ease-out transform"
|
|
9
|
+
enter-from-class="sm:translate-y-0 sm:translate-x-4 translate-y-2 opacity-0"
|
|
10
|
+
enter-to-class="sm:translate-x-0 translate-y-0 opacity-100"
|
|
11
|
+
leave-active-class="transition duration-100 ease-in"
|
|
12
|
+
leave-from-class="sm:translate-x-0 translate-y-0 opacity-100"
|
|
13
|
+
leave-to-class="sm:translate-y-0 sm:translate-x-4 translate-y-2 opacity-0"
|
|
14
|
+
>
|
|
15
|
+
<div v-for="notification in notifications" :key="notification.id">
|
|
16
|
+
<div
|
|
17
|
+
class="mx-auto mt-4 flex w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-xl"
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="flex w-12 items-center justify-center"
|
|
21
|
+
:class="{
|
|
22
|
+
'bg-blue-500': notification.color == 'info',
|
|
23
|
+
'bg-red-500': notification.color == 'danger',
|
|
24
|
+
'bg-yellow-500': notification.color == 'warning',
|
|
25
|
+
'bg-green-500': notification.color == 'success',
|
|
26
|
+
}"
|
|
27
|
+
>
|
|
28
|
+
<svg
|
|
29
|
+
class="h-6 w-6 fill-current text-white"
|
|
30
|
+
viewBox="0 0 40 40"
|
|
31
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
d="M20 3.33331C10.8 3.33331 3.33337 10.8 3.33337 20C3.33337 29.2 10.8 36.6666 20 36.6666C29.2 36.6666 36.6667 29.2 36.6667 20C36.6667 10.8 29.2 3.33331 20 3.33331ZM21.6667 28.3333H18.3334V25H21.6667V28.3333ZM21.6667 21.6666H18.3334V11.6666H21.6667V21.6666Z"
|
|
35
|
+
/>
|
|
36
|
+
</svg>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div class="-mx-3 px-4 pt-2 pb-3">
|
|
40
|
+
<div class="mx-3">
|
|
41
|
+
<h3
|
|
42
|
+
class="mb-1 font-semibold leading-tight"
|
|
43
|
+
:class="{
|
|
44
|
+
'text-blue-500': notification.color == 'info',
|
|
45
|
+
'text-red-500': notification.color == 'danger',
|
|
46
|
+
'text-yellow-500': notification.color == 'warning',
|
|
47
|
+
'text-green-500': notification.color == 'success',
|
|
48
|
+
}"
|
|
49
|
+
>
|
|
50
|
+
{{ notification.title }}
|
|
51
|
+
</h3>
|
|
52
|
+
<p class="text-sm leading-tight text-slate-600">
|
|
53
|
+
{{ notification.text }}
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</TransitionGroup>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</Teleport>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script lang="ts" setup>
|
|
66
|
+
import { useNotificationsStore } from '@/index';
|
|
67
|
+
|
|
68
|
+
const notificationsStore = useNotificationsStore();
|
|
69
|
+
|
|
70
|
+
const notifications = computed(() => {
|
|
71
|
+
return notificationsStore.notifications;
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
@@ -166,8 +166,8 @@ import {
|
|
|
166
166
|
DataTableQuery,
|
|
167
167
|
MenuItemInterface,
|
|
168
168
|
} from '@/types/types';
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
import { useDialogsStore } from '@/stores/dialogs';
|
|
170
|
+
import { useNotificationsStore } from '../stores/notifications';
|
|
171
171
|
import BaseDataIterator from './BaseDataIterator.vue';
|
|
172
172
|
import { isArray } from 'lodash';
|
|
173
173
|
|
|
@@ -182,8 +182,8 @@ const i18n = useI18n();
|
|
|
182
182
|
|
|
183
183
|
const http = config.http;
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
const dialogs = useDialogsStore();
|
|
186
|
+
const notifications = useNotificationsStore();
|
|
187
187
|
|
|
188
188
|
const table = ref(null) as Ref<null | InstanceType<typeof BaseTable>>;
|
|
189
189
|
|
|
@@ -384,14 +384,14 @@ const canDelete = (row: CollectionItem): boolean => {
|
|
|
384
384
|
};
|
|
385
385
|
|
|
386
386
|
function onDeleteClick(row: CollectionItem) {
|
|
387
|
-
|
|
387
|
+
dialogs.push({
|
|
388
388
|
title: i18n.t('sui.delete_record') + '?',
|
|
389
389
|
message: i18n.t('sui.delete_record_description'),
|
|
390
390
|
color: 'danger',
|
|
391
391
|
closeOnOutsideClick: false,
|
|
392
392
|
confirmText: i18n.t('sui.yes_delete'),
|
|
393
393
|
onConfirm: () => onDelete(row),
|
|
394
|
-
});
|
|
394
|
+
});
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
const onDelete = (row: CollectionItem) => {
|
|
@@ -401,11 +401,11 @@ const onDelete = (row: CollectionItem) => {
|
|
|
401
401
|
|
|
402
402
|
http.delete(props.deleteUrl(row)).then((response) => {
|
|
403
403
|
if (response.data && response.data.message) {
|
|
404
|
-
|
|
404
|
+
notifications.push({
|
|
405
405
|
title: i18n.t('sui.success'),
|
|
406
406
|
text: response.data.message,
|
|
407
407
|
color: 'success',
|
|
408
|
-
});
|
|
408
|
+
});
|
|
409
409
|
}
|
|
410
410
|
emit('delete', row);
|
|
411
411
|
|