plugin-ui-for-kzt 0.0.17 → 0.0.18
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/components/BaseBadge/BaseBadge.vue.d.ts +49 -0
- package/dist/components/BaseBadge/BaseBadgeGroup.vue.d.ts +30 -0
- package/dist/components/BaseButton/BaseButton.vue.d.ts +1 -1
- package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +1 -1
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +1 -1
- package/dist/components/BaseChips/BaseChips.vue.d.ts +1 -1
- package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +1 -1
- package/dist/components/BaseInput/BaseInput.vue.d.ts +2 -2
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +3 -3
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +2 -2
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +2 -2
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +2 -2
- package/dist/components/BaseModal/BaseModal.vue.d.ts +4 -0
- package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +1 -1
- package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +1 -1
- package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -2
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +2 -2
- package/dist/components/BaseTag/BaseTag.vue.d.ts +61 -0
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +1 -1
- package/dist/components/BaseToggle/BaseToggle.vue.d.ts +1 -1
- package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
- package/dist/components/BaseUpload/BaseUpload.vue.d.ts +31 -0
- package/dist/components/{Modal/Modal.vue.d.ts → BaseUpload/ImageModal.vue.d.ts} +2 -10
- package/dist/components/Toaster/Toaster.vue.d.ts +1 -1
- package/dist/composables/useModal.d.ts +7 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1 -1
- package/dist/plugins/modalPlugin.d.ts +0 -13
- package/dist/sprite.svg +1 -1
- package/dist/store/modal.d.ts +154 -9
- package/example/App.vue +123 -311
- package/example/MyCustomModal.vue +37 -0
- package/package.json +1 -1
- package/src/assets/icons/add.svg +4 -0
- package/src/assets/icons/arrow-up.svg +4 -0
- package/src/assets/icons/close-circle.svg +5 -0
- package/src/assets/icons/close.svg +4 -0
- package/src/assets/icons/document-text.svg +4 -0
- package/src/assets/icons/export.svg +5 -0
- package/src/assets/icons/gallery.svg +5 -0
- package/src/assets/icons/notification-icon.svg +7 -0
- package/src/assets/icons/search-zoom-in.svg +6 -0
- package/src/assets/icons/trash.svg +7 -0
- package/src/assets/icons/upload.svg +5 -0
- package/src/components/BaseBadge/BaseBadge.vue +188 -0
- package/src/components/BaseBadge/BaseBadgeGroup.vue +120 -0
- package/src/components/BaseBadge/README.md +127 -0
- package/src/components/BaseBreadCrumbs/BaseBreadCrumbs.vue +2 -1
- package/src/components/BaseButton/BaseButton.vue +0 -112
- package/src/components/BaseInput/BaseInput.vue +4 -3
- package/src/components/BaseModal/BaseModal.vue +189 -0
- package/src/components/BaseTag/BaseTag.vue +245 -0
- package/src/components/BaseTag/README.md +125 -0
- package/src/components/BaseTextarea/BaseTextarea.vue +7 -14
- package/src/components/BaseUpload/BaseUpload.vue +392 -0
- package/src/components/BaseUpload/ImageModal.vue +25 -0
- package/src/composables/useModal.ts +14 -0
- package/src/index.ts +32 -19
- package/src/plugins/modalPlugin.ts +92 -76
- package/src/store/modal.ts +39 -16
- package/src/styles/root.scss +1 -0
- package/src/types/badge.d.ts +19 -0
- package/src/types/modal.d.ts +8 -0
- package/src/types/tag.d.ts +14 -0
- package/src/types/uploadedFile.d.ts +13 -0
- package/src/types/utils.d.ts +1 -1
- package/dist/types/index.d.ts +0 -5
- package/src/components/Modal/Modal.vue +0 -149
- package/src/components/Modal/README.md +0 -47
- package/src/types/index.ts +0 -7
package/src/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createPinia } from "pinia";
|
|
2
|
-
import Modal from "./components/Modal/Modal.vue";
|
|
3
2
|
import DataTable from "./components/DataTable/DataTable.vue";
|
|
4
3
|
import Tooltip from "./components/Tooltip/Tooltip.vue";
|
|
5
4
|
import Spinner from "./components/Spinner/Spinner.vue";
|
|
6
|
-
import ModalPlugin
|
|
5
|
+
import ModalPlugin from "./plugins/modalPlugin";
|
|
6
|
+
import { useModal } from "./composables/useModal";
|
|
7
7
|
import ToasterPlugin, { useToast } from "./plugins/toasterPlugin";
|
|
8
8
|
import "./sprite"; // Импортируем иконки для генерации спрайта
|
|
9
9
|
import "./styles/root.scss";
|
|
@@ -30,12 +30,20 @@ import BaseInputCurrency from "./components/BaseInputCurrency/BaseInputCurrency.
|
|
|
30
30
|
import BaseSegmentedButtons from "./components/BaseSegmentedButtons/BaseSegmentedButtons.vue";
|
|
31
31
|
import BaseChips from "./components/BaseChips/BaseChips.vue";
|
|
32
32
|
import BaseSwiper from "./components/BaseSwiper/BaseSwiper.vue";
|
|
33
|
+
import BaseModal from "./components/BaseModal/BaseModal.vue";
|
|
34
|
+
import BaseUpload from "./components/BaseUpload/BaseUpload.vue";
|
|
35
|
+
import BaseBadge from "./components/BaseBadge/BaseBadge.vue";
|
|
36
|
+
import BaseTag from "./components/BaseTag/BaseTag.vue";
|
|
37
|
+
import BaseBadgeGroup from "./components/BaseBadge/BaseBadgeGroup.vue";
|
|
33
38
|
|
|
34
|
-
const components = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
const components = {
|
|
40
|
+
BaseModal,
|
|
41
|
+
BaseTag,
|
|
42
|
+
BaseBadge,
|
|
43
|
+
BaseBadgeGroup,
|
|
44
|
+
DataTable,
|
|
45
|
+
Tooltip,
|
|
46
|
+
Spinner,
|
|
39
47
|
BaseIcon,
|
|
40
48
|
BaseBreadCrumbs,
|
|
41
49
|
BaseButton,
|
|
@@ -58,18 +66,19 @@ const components = {
|
|
|
58
66
|
BasePagination,
|
|
59
67
|
BaseSegmentedButtons,
|
|
60
68
|
BaseChips,
|
|
61
|
-
BaseSwiper
|
|
69
|
+
BaseSwiper,
|
|
70
|
+
BaseUpload
|
|
62
71
|
};
|
|
63
72
|
|
|
64
73
|
// Функция для загрузки sprite.svg
|
|
65
74
|
const loadSprite = () => {
|
|
66
75
|
const possiblePaths = [
|
|
67
76
|
"/sprite.svg",
|
|
68
|
-
"./sprite.svg",
|
|
77
|
+
"./sprite.svg",
|
|
69
78
|
"sprite.svg",
|
|
70
|
-
"/dist/sprite.svg"
|
|
79
|
+
"/dist/sprite.svg",
|
|
71
80
|
];
|
|
72
|
-
|
|
81
|
+
|
|
73
82
|
const tryLoadSprite = async (paths: string[]) => {
|
|
74
83
|
for (const path of paths) {
|
|
75
84
|
try {
|
|
@@ -89,7 +98,7 @@ const loadSprite = () => {
|
|
|
89
98
|
}
|
|
90
99
|
console.error("Не удалось загрузить SVG-спрайт ни с одного из путей");
|
|
91
100
|
};
|
|
92
|
-
|
|
101
|
+
|
|
93
102
|
tryLoadSprite(possiblePaths);
|
|
94
103
|
};
|
|
95
104
|
|
|
@@ -111,12 +120,15 @@ export default {
|
|
|
111
120
|
},
|
|
112
121
|
};
|
|
113
122
|
|
|
114
|
-
export {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
export {
|
|
124
|
+
BaseModal,
|
|
125
|
+
BaseBadgeGroup,
|
|
126
|
+
BaseBadge,
|
|
127
|
+
DataTable,
|
|
128
|
+
BaseTag,
|
|
129
|
+
Tooltip,
|
|
130
|
+
Spinner,
|
|
131
|
+
useModal,
|
|
120
132
|
useToast,
|
|
121
133
|
BaseIcon,
|
|
122
134
|
BaseBreadCrumbs,
|
|
@@ -140,5 +152,6 @@ export {
|
|
|
140
152
|
BasePagination,
|
|
141
153
|
BaseSegmentedButtons,
|
|
142
154
|
BaseChips,
|
|
143
|
-
BaseSwiper
|
|
155
|
+
BaseSwiper,
|
|
156
|
+
BaseUpload
|
|
144
157
|
};
|
|
@@ -1,89 +1,105 @@
|
|
|
1
|
-
import {createApp, h,
|
|
2
|
-
import {useModalStore} from
|
|
3
|
-
import
|
|
4
|
-
import {watch} from
|
|
5
|
-
import {
|
|
1
|
+
import { createApp, h, markRaw, provide } from 'vue';
|
|
2
|
+
import { useModalStore } from '../store/modal';
|
|
3
|
+
import BaseModal from '../components/BaseModal/BaseModal.vue';
|
|
4
|
+
import { watch } from 'vue';
|
|
5
|
+
import type { ICoreModalProps, ModalComponent } from '../types/modal';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
interface ModalInstance {
|
|
8
|
+
id: string;
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
props: ICoreModalProps;
|
|
11
|
+
app?: ReturnType<typeof createApp>;
|
|
12
|
+
component?: ModalComponent;
|
|
13
|
+
}
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
};
|
|
15
|
+
export default {
|
|
16
|
+
install(app: any) {
|
|
17
|
+
console.log('Installing ModalPlugin...');
|
|
18
|
+
const modalStore = useModalStore();
|
|
19
|
+
const modalContainer = document.createElement('div');
|
|
20
|
+
modalContainer.classList.add('modal-container');
|
|
21
|
+
document.body.appendChild(modalContainer);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const $modal = {
|
|
24
|
+
open(id: string, props: ICoreModalProps = {}, component?: ModalComponent) {
|
|
25
|
+
modalStore.openModal(id, props, component ? markRaw(component) : undefined);
|
|
26
|
+
},
|
|
27
|
+
close(id: string) {
|
|
28
|
+
modalStore.closeModal(id);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
() => modalStore.modals,
|
|
28
|
-
(newModals) => {
|
|
29
|
-
// Очищаем контейнер
|
|
30
|
-
modalContainer.innerHTML = "";
|
|
31
|
-
// Обновляем data-атрибут и класс
|
|
32
|
-
if (newModals.length > 0) {
|
|
33
|
-
modalContainer.classList.add("modal");
|
|
34
|
-
} else {
|
|
35
|
-
modalContainer.classList.remove("modal");
|
|
36
|
-
}
|
|
32
|
+
app.config.globalProperties.$modal = $modal;
|
|
33
|
+
app.provide('$modal', $modal);
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
newModals.forEach((modal) => {
|
|
40
|
-
modalContainer.dataset.modalId = String(modal.id);
|
|
41
|
-
modalContainer.setAttribute("name", modal.name);
|
|
35
|
+
const activeModals: ModalInstance[] = [];
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
37
|
+
watch(
|
|
38
|
+
() => modalStore.modals,
|
|
39
|
+
(newModals) => {
|
|
40
|
+
const modalIds = newModals.map((modal) => modal.id);
|
|
41
|
+
activeModals.forEach((modal, index) => {
|
|
42
|
+
if (!modalIds.includes(modal.id) || !modal.isOpen) {
|
|
43
|
+
modal.app?.unmount();
|
|
44
|
+
activeModals.splice(index, 1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
54
47
|
|
|
55
|
-
|
|
48
|
+
newModals.forEach((modal) => {
|
|
49
|
+
let existingModal = activeModals.find((m) => m.id === modal.id);
|
|
50
|
+
if (!existingModal && modal.isOpen) {
|
|
51
|
+
const modalApp = createApp({
|
|
52
|
+
setup() {
|
|
53
|
+
provide('$modal', $modal);
|
|
54
|
+
return () => h(BaseModal, {
|
|
55
|
+
onClose: () => modalStore.closeModal(modal.id),
|
|
56
56
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
modalApp.mount(modalContainer);
|
|
60
|
+
activeModals.push({
|
|
61
|
+
id: modal.id,
|
|
62
|
+
isOpen: modal.isOpen,
|
|
63
|
+
props: modal.props ?? { isOpen: modal.isOpen },
|
|
64
|
+
app: modalApp,
|
|
65
|
+
component: modal.component,
|
|
66
|
+
});
|
|
67
|
+
} else if (existingModal) {
|
|
68
|
+
existingModal.isOpen = modal.isOpen;
|
|
69
|
+
existingModal.props = modal.props ?? { isOpen: modal.isOpen };
|
|
70
|
+
existingModal.component = modal.component;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
modalContainer.classList.toggle('has-modals', activeModals.some((m) => m.isOpen));
|
|
75
|
+
},
|
|
76
|
+
{ immediate: true, deep: true }
|
|
77
|
+
);
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
79
|
+
const handleOverlayClick = (event: MouseEvent) => {
|
|
80
|
+
const topModal = activeModals.find(
|
|
81
|
+
(modal) => modal.isOpen && modal.id === modalStore.modals[modalStore.modals.length - 1]?.id
|
|
82
|
+
);
|
|
83
|
+
if (topModal && event.target === modalContainer && topModal.props.closable) {
|
|
84
|
+
modalStore.closeModal(topModal.id);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
75
87
|
|
|
76
|
-
|
|
77
|
-
const instance = getCurrentInstance();
|
|
78
|
-
return instance?.appContext.config.globalProperties.$modal;
|
|
79
|
-
}
|
|
88
|
+
modalContainer.addEventListener('click', handleOverlayClick);
|
|
80
89
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
const cleanup = () => {
|
|
91
|
+
activeModals.forEach((modal) => modal.app?.unmount());
|
|
92
|
+
modalContainer.removeEventListener('click', handleOverlayClick);
|
|
93
|
+
document.body.removeChild(modalContainer);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
if (app.unmount) {
|
|
97
|
+
const originalUnmount = app.unmount;
|
|
98
|
+
app.unmount = function () {
|
|
99
|
+
cleanup();
|
|
100
|
+
originalUnmount.call(app);
|
|
101
|
+
};
|
|
88
102
|
}
|
|
89
|
-
|
|
103
|
+
app._container?.addEventListener('beforeunload', cleanup);
|
|
104
|
+
},
|
|
105
|
+
};
|
package/src/store/modal.ts
CHANGED
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import {
|
|
2
|
+
import type { ICoreModalProps, ModalComponent } from '../types/modal';
|
|
3
3
|
|
|
4
4
|
export const useModalStore = defineStore('modal', {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
5
|
+
state: () => ({
|
|
6
|
+
modals: [] as { id: string; isOpen: boolean; props?: ICoreModalProps; component?: ModalComponent }[],
|
|
7
|
+
}),
|
|
8
|
+
actions: {
|
|
9
|
+
openModal(id: string, props: ICoreModalProps = {}, component?: ModalComponent) {
|
|
10
|
+
const existingModal = this.modals.find(modal => modal.id === id);
|
|
11
|
+
if (!existingModal) {
|
|
12
|
+
this.modals.push({ id, isOpen: true, props, component });
|
|
13
|
+
} else {
|
|
14
|
+
existingModal.isOpen = true;
|
|
15
|
+
existingModal.props = props;
|
|
16
|
+
existingModal.component = component;
|
|
17
|
+
}
|
|
19
18
|
},
|
|
20
|
-
|
|
19
|
+
closeModal(id: string) {
|
|
20
|
+
const modalIndex = this.modals.findIndex(modal => modal.id === id);
|
|
21
|
+
if (modalIndex !== -1) {
|
|
22
|
+
this.modals[modalIndex].isOpen = false;
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
this.modals = this.modals.filter(modal => modal.id !== id);
|
|
25
|
+
}, 300); // Синхронизация с анимацией
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
toggleModal(id: string, props: ICoreModalProps = {}, component?: ModalComponent) {
|
|
29
|
+
const modal = this.modals.find(modal => modal.id === id);
|
|
30
|
+
if (modal) {
|
|
31
|
+
this.closeModal(id);
|
|
32
|
+
} else {
|
|
33
|
+
this.openModal(id, props, component);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
getters: {
|
|
38
|
+
getModalState: (state) => (id: string) => {
|
|
39
|
+
const modal = state.modals.find(modal => modal.id === id);
|
|
40
|
+
return modal ? { isOpen: modal.isOpen, props: modal.props } : { isOpen: false, props: {} };
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
package/src/styles/root.scss
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ICoreColor, ICoreSize } from './utils';
|
|
2
|
+
|
|
3
|
+
type IIconName = 'arrow-right' | 'arrow-up';
|
|
4
|
+
|
|
5
|
+
interface IBaseBadgeProps {
|
|
6
|
+
hasDot?: boolean;
|
|
7
|
+
closable?: boolean;
|
|
8
|
+
arrowUpIcon?: boolean;
|
|
9
|
+
arrowRightIcon?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IBaseBadgeGroupProps {
|
|
13
|
+
arrowRightIcon?: boolean;
|
|
14
|
+
badgePosition?: 'left' | 'right'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ICoreBadgeGroupProps = ICoreSize & ICoreColor & IBaseBadgeGroupProps;
|
|
18
|
+
|
|
19
|
+
export type ICoreBadgeProps = ICoreSize & ICoreColor & IBaseBadgeProps;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ICoreColor, ICoreSize } from './utils';
|
|
2
|
+
|
|
3
|
+
type TColorTag = ICoreColor['color']['primary'] | ICoreColor['color']['secondary'];
|
|
4
|
+
|
|
5
|
+
interface IBaseTagProps {
|
|
6
|
+
text: string;
|
|
7
|
+
closable?: boolean;
|
|
8
|
+
color?: TColorTag;
|
|
9
|
+
isHasAddTag?: boolean,
|
|
10
|
+
inputText?: string;
|
|
11
|
+
addingTag?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ICoreTagProps = ICoreSize & IBaseTagProps;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface UploadedFile {
|
|
2
|
+
name: string;
|
|
3
|
+
size: number;
|
|
4
|
+
file: File;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface IpropsUpload {
|
|
8
|
+
acceptedFormats: string[]; // Фильтр по типу файлов (например, "image/*" для изображений)
|
|
9
|
+
multiple?: boolean; // Разрешить множественный выбор файлов
|
|
10
|
+
maxFileSize?: number; // Максимальный размер файла в байтах
|
|
11
|
+
onUpload?: (files: UploadedFile[]) => void; // Callback при загрузке файлов
|
|
12
|
+
onError?: (error: string) => void; // Callback при ошибке загрузки
|
|
13
|
+
}
|
package/src/types/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type Nullable<T> = T | null;
|
|
|
2
2
|
|
|
3
3
|
export type TCoreSize = 'large' | 'medium' | 'small' | 'extra-small' | 'custom';
|
|
4
4
|
|
|
5
|
-
export type TCoreColor = string | 'primary' | 'secondary' | 'tertiary-gray' | 'tertiary-blue' | 'quaternary-gray' | 'quaternary-blue' | 'link-blue' | 'link-critical' | 'link-gray' | 'custom';
|
|
5
|
+
export type TCoreColor = string | 'primary' | 'secondary' | 'tertiary-gray' | 'tertiary-blue' | 'quaternary-gray' | 'quaternary-blue' | 'link-blue' | 'link-critical' | 'link-gray' | 'gray' | 'error' | 'warning' | 'success' | 'custom';
|
|
6
6
|
export type TCoreInteractiveTag = 'link' | 'button' | 'span' | 'div' | 'a';
|
|
7
7
|
|
|
8
8
|
export interface ICoreSize {
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="modal-container" @click.stop>
|
|
3
|
-
<div
|
|
4
|
-
class="modal-container-header"
|
|
5
|
-
:class="{
|
|
6
|
-
'modal-container-header-show-all': showMore,
|
|
7
|
-
[getTypeModal.nameClass]: getTypeModal.nameClass.length,
|
|
8
|
-
}"
|
|
9
|
-
>
|
|
10
|
-
<div class="modal-container-header-title">
|
|
11
|
-
<component :is="getTypeModal.img"/>
|
|
12
|
-
<div>{{ options.title }}</div>
|
|
13
|
-
</div>
|
|
14
|
-
<div
|
|
15
|
-
class="modal-container-header-show-more"
|
|
16
|
-
@click="showMore = !showMore"
|
|
17
|
-
>
|
|
18
|
-
{{ showMore ? "Скрыть" : "Смотреть больше" }}
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<CloseIcon class="modal-button-close" @click="onClose"/>
|
|
22
|
-
<div v-if="showMore" class="modal-container-subtitle">
|
|
23
|
-
Описание: <br/>
|
|
24
|
-
{{ options.message }}
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script setup lang="ts">
|
|
30
|
-
import {ref, computed} from "vue";
|
|
31
|
-
import CloseIcon from "../icons/CloseIcon.vue";
|
|
32
|
-
import ErrorIcon from "../icons/ErrorIcon.vue";
|
|
33
|
-
import SuccessIcon from "../icons/SuccessIcon.vue";
|
|
34
|
-
import WarningIcon from "../icons/WarningIcon.vue";
|
|
35
|
-
import InfoIcon from "../icons/InfoIcon.vue";
|
|
36
|
-
import {IModalState, IModalType} from "../../types/index";
|
|
37
|
-
|
|
38
|
-
interface IProps {
|
|
39
|
-
options: IModalState
|
|
40
|
-
name: IModalType;
|
|
41
|
-
onClose: () => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const props = defineProps<IProps>();
|
|
45
|
-
const showMore = ref<boolean>(false);
|
|
46
|
-
|
|
47
|
-
const getTypeModal = computed<{ img: any; nameClass: string }>(() => {
|
|
48
|
-
switch (props.name) {
|
|
49
|
-
case "error":
|
|
50
|
-
return {img: ErrorIcon, nameClass: "error"};
|
|
51
|
-
case "success":
|
|
52
|
-
return {img: SuccessIcon, nameClass: "success"};
|
|
53
|
-
case "warning":
|
|
54
|
-
return {img: WarningIcon, nameClass: "warning"};
|
|
55
|
-
case "info":
|
|
56
|
-
return {img: InfoIcon, nameClass: "info"};
|
|
57
|
-
default:
|
|
58
|
-
return {img: WarningIcon, nameClass: "info"};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
</script>
|
|
62
|
-
<style lang="scss">
|
|
63
|
-
.modal {
|
|
64
|
-
position: fixed;
|
|
65
|
-
top: 0;
|
|
66
|
-
left: 0;
|
|
67
|
-
width: 100%;
|
|
68
|
-
height: 100%;
|
|
69
|
-
display: flex;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
align-items: center;
|
|
72
|
-
background: rgba(0, 0, 0, 0.2);
|
|
73
|
-
z-index: 9999;
|
|
74
|
-
}
|
|
75
|
-
</style>
|
|
76
|
-
|
|
77
|
-
<style lang="scss" scoped>
|
|
78
|
-
.modal {
|
|
79
|
-
|
|
80
|
-
&-button-close {
|
|
81
|
-
width: 12px;
|
|
82
|
-
height: 12px;
|
|
83
|
-
position: absolute;
|
|
84
|
-
top: 20px;
|
|
85
|
-
right: 20px;
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&-container {
|
|
90
|
-
position: relative;
|
|
91
|
-
font-family: "Roboto Condensed", serif;
|
|
92
|
-
font-optical-sizing: auto;
|
|
93
|
-
|
|
94
|
-
background: white;
|
|
95
|
-
border-radius: 16px;
|
|
96
|
-
max-width: 540px;
|
|
97
|
-
width: 100%;
|
|
98
|
-
|
|
99
|
-
&-header {
|
|
100
|
-
padding: 20px;
|
|
101
|
-
border-radius: 12px;
|
|
102
|
-
font-size: 20px;
|
|
103
|
-
font-weight: 400;
|
|
104
|
-
line-height: 24px;
|
|
105
|
-
|
|
106
|
-
&-show-all {
|
|
107
|
-
border-radius: 12px 12px 0 0;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&-title {
|
|
111
|
-
color: white;
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: start;
|
|
114
|
-
gap: 20px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&-show-more {
|
|
118
|
-
color: #f5c9c3;
|
|
119
|
-
text-align: right;
|
|
120
|
-
font-size: 16px;
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&-subtitle {
|
|
126
|
-
padding: 20px;
|
|
127
|
-
font-size: 18px;
|
|
128
|
-
font-weight: 400;
|
|
129
|
-
line-height: 24px;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.error {
|
|
135
|
-
background: #ee5542;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.success {
|
|
139
|
-
background: #15b853;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.warning {
|
|
143
|
-
background: #f4a900;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.info {
|
|
147
|
-
background: #0085cf;
|
|
148
|
-
}
|
|
149
|
-
</style>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Modal Window Plugin
|
|
2
|
-
|
|
3
|
-
Этот плагин для модальных окон позволяет отображать пользователю различные статусы проекта: **success**, **info**, **warning** и **error**.
|
|
4
|
-
|
|
5
|
-
## Описание
|
|
6
|
-
|
|
7
|
-
Модальное окно используется для информирования пользователя о статусах или событиях в проекте. В зависимости от переданного параметра `name`, модальное окно автоматически изменяет свой тип и стиль.
|
|
8
|
-
|
|
9
|
-
## Вызов модального окна
|
|
10
|
-
|
|
11
|
-
Модальное окно можно открыть и закрыть с помощью следующих команд:
|
|
12
|
-
|
|
13
|
-
- **Открыть модальное окно:** `$modal.open`
|
|
14
|
-
- **Закрыть модальное окно:** `$modal.close`
|
|
15
|
-
|
|
16
|
-
## Параметры
|
|
17
|
-
|
|
18
|
-
При вызове модального окна необходимо передать два параметра:
|
|
19
|
-
|
|
20
|
-
1. **name** (`string`)
|
|
21
|
-
- Принимает любое строковое значение.
|
|
22
|
-
- **Особенность:** В плагине реализован слушатель для параметра `name`, который меняет тип модального окна в зависимости от переданного значения (см. ниже описание типов).
|
|
23
|
-
|
|
24
|
-
2. **options** (`{ title: string; message: string; }`)
|
|
25
|
-
- **title:** Заголовок модального окна.
|
|
26
|
-
- **message:** Сообщение или основной текст, который будет отображён внутри модального окна.
|
|
27
|
-
|
|
28
|
-
## Типы модальных окон
|
|
29
|
-
|
|
30
|
-
В зависимости от значения параметра `name` модальное окно может принимать следующие типы:
|
|
31
|
-
|
|
32
|
-
- **success**8
|
|
33
|
-
- **info**
|
|
34
|
-
- **warning**
|
|
35
|
-
- **error**
|
|
36
|
-
|
|
37
|
-
## Пример использования
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
// Пример открытия модального окна с типом "success"
|
|
41
|
-
$modal.open('success', {
|
|
42
|
-
title: 'Операция выполнена успешно',
|
|
43
|
-
message: 'Ваш запрос был успешно обработан.'
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Пример закрытия модального окна
|
|
47
|
-
$modal.close();
|