@milaboratories/uikit 2.3.13 → 2.3.14
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/.turbo/turbo-build.log +65 -43
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +9 -0
- package/dist/components/DataTable/TableComponent.vue.js +23 -23
- package/dist/components/PlAccordion/{ExpandTransition.vue2.js → ExpandTransition.vue.js} +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +1 -0
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +1 -1
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js +1 -1
- package/dist/components/PlConfirmDialog.vue.d.ts +22 -0
- package/dist/components/PlConfirmDialog.vue.d.ts.map +1 -0
- package/dist/components/PlConfirmDialog.vue.js +63 -0
- package/dist/components/PlConfirmDialog.vue.js.map +1 -0
- package/dist/components/PlConfirmDialog.vue2.js +5 -0
- package/dist/components/PlConfirmDialog.vue2.js.map +1 -0
- package/dist/components/PlDialogModal/PlDialogModal.vue.d.ts +8 -4
- package/dist/components/PlDialogModal/PlDialogModal.vue.d.ts.map +1 -1
- package/dist/components/PlDialogModal/PlDialogModal.vue.js +38 -38
- package/dist/components/PlDialogModal/PlDialogModal.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.js +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.d.ts +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.d.ts.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +1 -1
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.d.ts +1 -1
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.d.ts.map +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.d.ts +4 -0
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.d.ts.map +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js +47 -43
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue.d.ts.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue2.js +20 -16
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue.d.ts.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue2.js +10 -9
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue3.js +29 -29
- package/dist/components/PlElementList/utils.d.ts.map +1 -1
- package/dist/components/PlElementList/utils.js +4 -3
- package/dist/components/PlElementList/utils.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +1 -1
- package/dist/components/PlSidebar/PlSidebarGroup.vue.d.ts +20 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue.d.ts.map +1 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue.js +10 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue.js.map +1 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue2.js +21 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue2.js.map +1 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue3.js +11 -0
- package/dist/components/PlSidebar/PlSidebarGroup.vue3.js.map +1 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue.d.ts +30 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue.d.ts.map +1 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue.js +10 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue.js.map +1 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue2.js +39 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue2.js.map +1 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue3.js +17 -0
- package/dist/components/PlSidebar/PlSidebarItem.vue3.js.map +1 -0
- package/dist/components/PlSidebar/index.d.ts +3 -0
- package/dist/components/PlSidebar/index.d.ts.map +1 -0
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.d.ts +22 -0
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.d.ts.map +1 -0
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +150 -0
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -0
- package/dist/components/PlSlideModal/PlPureSlideModal.vue2.js +5 -0
- package/dist/components/PlSlideModal/PlPureSlideModal.vue2.js.map +1 -0
- package/dist/components/PlSlideModal/PlSlideModal.vue.d.ts +3 -42
- package/dist/components/PlSlideModal/PlSlideModal.vue.d.ts.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue.js +7 -162
- package/dist/components/PlSlideModal/PlSlideModal.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue2.js +45 -2
- package/dist/components/PlSlideModal/PlSlideModal.vue2.js.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue3.js +9 -0
- package/dist/components/PlSlideModal/PlSlideModal.vue3.js.map +1 -0
- package/dist/components/PlSlideModal/index.d.ts +1 -0
- package/dist/components/PlSlideModal/index.d.ts.map +1 -1
- package/dist/components/PlSlideModal/props.d.ts +20 -0
- package/dist/components/PlSlideModal/props.d.ts.map +1 -0
- package/dist/components/PlSlideModal/props.js +10 -0
- package/dist/components/PlSlideModal/props.js.map +1 -0
- package/dist/components/PlTextArea/PlTextArea.vue.js +1 -1
- package/dist/components/PlTextField/PlTextField.vue.js +1 -1
- package/dist/composition/useConfirm.d.ts +8 -0
- package/dist/composition/useConfirm.d.ts.map +1 -0
- package/dist/composition/useConfirm.js +23 -0
- package/dist/composition/useConfirm.js.map +1 -0
- package/dist/generated/components/svg/images/{SvgRequired.vue.js → SvgRequired.vue2.js} +1 -1
- package/dist/generated/components/svg/images/SvgRequired.vue2.js.map +1 -0
- package/dist/index.d.ts +49 -47
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +202 -194
- package/dist/index.js.map +1 -1
- package/dist/lib/model/common/dist/index.js +6 -6
- package/dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js +1 -1
- package/dist/node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js +3 -3
- package/dist/sdk/model/dist/index.js +90 -90
- package/dist/sdk/model/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/assets/variables.scss +4 -1
- package/src/components/PlBtnGhost/pl-btn-ghost.scss +0 -7
- package/src/components/PlConfirmDialog.vue +55 -0
- package/src/components/PlDialogModal/PlDialogModal.vue +6 -2
- package/src/components/PlEditableTitle/PlEditableTitle.vue +13 -2
- package/src/components/PlElementList/PlElementList.vue +14 -6
- package/src/components/PlElementList/PlElementListItem.vue +6 -4
- package/src/components/PlElementList/utils.ts +2 -0
- package/src/components/PlSidebar/PlSidebarGroup.vue +35 -0
- package/src/components/PlSidebar/PlSidebarItem.vue +59 -0
- package/src/components/PlSidebar/index.ts +2 -0
- package/src/components/PlSlideModal/PlPureSlideModal.vue +57 -0
- package/src/components/PlSlideModal/PlSlideModal.vue +31 -75
- package/src/components/PlSlideModal/index.ts +1 -0
- package/src/components/PlSlideModal/pl-slide-modal.scss +5 -4
- package/src/components/PlSlideModal/props.ts +25 -0
- package/src/composition/useConfirm.ts +35 -0
- package/src/index.ts +51 -47
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +0 -1
- package/dist/generated/components/svg/images/SvgRequired.vue.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"default": "./dist/index.js"
|
|
10
10
|
},
|
|
11
11
|
"./styles": "./dist/index.js",
|
|
12
|
+
"./styles/variables": "./src/assets/variables.scss",
|
|
12
13
|
"./assets/mixins.scss": "./src/assets/mixins.scss",
|
|
13
14
|
"./svg/icons/*": "./src/assets/icons/icon-assets-min/*",
|
|
14
15
|
"./svg/images/*": "./src/assets/images/*"
|
|
@@ -23,8 +24,8 @@
|
|
|
23
24
|
"@vueuse/core": "^13.3.0",
|
|
24
25
|
"d3": "^7.9.0",
|
|
25
26
|
"resize-observer-polyfill": "^1.5.1",
|
|
26
|
-
"@milaboratories/helpers": "^1.6.
|
|
27
|
-
"@platforma-sdk/model": "^1.40.
|
|
27
|
+
"@milaboratories/helpers": "^1.6.18",
|
|
28
|
+
"@platforma-sdk/model": "^1.40.5"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
@@ -34,8 +35,8 @@
|
|
|
34
35
|
"vue-tsc": "^2.2.10",
|
|
35
36
|
"yarpm": "^1.2.0",
|
|
36
37
|
"svgo": "^3.3.2",
|
|
37
|
-
"@milaboratories/build-configs": "1.0.4",
|
|
38
38
|
"@milaboratories/ts-configs": "1.0.4",
|
|
39
|
+
"@milaboratories/build-configs": "1.0.4",
|
|
39
40
|
"@milaboratories/eslint-config": "^1.0.4"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
--btn-sec-press-grey: rgba(155, 171, 204, 0.24);
|
|
32
32
|
--btn-active-select: rgba(99, 224, 36, 0.24);
|
|
33
33
|
--btn-switcher: linear-gradient(180deg, #a1e59c 0%, #d0f5b0 100%);
|
|
34
|
+
|
|
35
|
+
--btn-accent-positive-500: #ECFBE5;
|
|
34
36
|
//disable
|
|
35
37
|
--dis-00: #ffffff;
|
|
36
38
|
--dis-01: light-dark(#cfd1db, #3d3d42);
|
|
@@ -63,7 +65,8 @@
|
|
|
63
65
|
--gradient-violet: linear-gradient(180deg, #bca3ff 0%, #e5e5ff 100%);
|
|
64
66
|
--TT-gradient-violet: linear-gradient(180deg, #bca3ff 0%, #e5e5ff 100%);
|
|
65
67
|
--gradient-light-lime: linear-gradient(180deg, #EBFFEB 0%, transparent 100%);
|
|
66
|
-
|
|
68
|
+
//box shadow
|
|
69
|
+
--shadow-l: 0px 8px 16px -4px rgba(15, 36, 77, 0.16), 0px 12px 32px -4px rgba(15, 36, 77, 0.16);
|
|
67
70
|
// Layout
|
|
68
71
|
--main-spacing: 24px;
|
|
69
72
|
--gap-v: 24px;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { PlBtnPrimary } from './PlBtnPrimary';
|
|
3
|
+
import { PlBtnSecondary } from './PlBtnSecondary';
|
|
4
|
+
import { PlDialogModal } from './PlDialogModal';
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
opened?: boolean;
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
confirmLabel: string;
|
|
12
|
+
cancelLabel: string;
|
|
13
|
+
onConfirm?: () => void;
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
}>(), {
|
|
16
|
+
opened: true,
|
|
17
|
+
onCancel: undefined,
|
|
18
|
+
onConfirm: undefined,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const emits = defineEmits<{
|
|
23
|
+
confirm: [];
|
|
24
|
+
cancel: [];
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
const handleConfirm = () => {
|
|
28
|
+
emits('confirm');
|
|
29
|
+
props.onConfirm?.();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleCancel = () => {
|
|
33
|
+
emits('cancel');
|
|
34
|
+
props.onCancel?.();
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<PlDialogModal v-model="props.opened" :closable="false" @click.stop>
|
|
40
|
+
<template #title>
|
|
41
|
+
{{ title }}
|
|
42
|
+
</template>
|
|
43
|
+
<template #default>
|
|
44
|
+
{{ message }}
|
|
45
|
+
</template>
|
|
46
|
+
<template #actions>
|
|
47
|
+
<PlBtnPrimary @click.stop="handleConfirm">
|
|
48
|
+
{{ props.confirmLabel }}
|
|
49
|
+
</PlBtnPrimary>
|
|
50
|
+
<PlBtnSecondary @click.stop="handleCancel">
|
|
51
|
+
{{ props.cancelLabel }}
|
|
52
|
+
</PlBtnSecondary>
|
|
53
|
+
</template>
|
|
54
|
+
</PlDialogModal>
|
|
55
|
+
</template>
|
|
@@ -7,11 +7,15 @@ export default {
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { useEventListener } from '../../composition/useEventListener';
|
|
9
9
|
import './pl-dialog-modal.scss';
|
|
10
|
-
import { computed, ref
|
|
10
|
+
import { computed, ref } from 'vue';
|
|
11
11
|
import PlCloseModalBtn from '../../utils/PlCloseModalBtn.vue';
|
|
12
12
|
import type { Size } from '../../types';
|
|
13
13
|
|
|
14
|
-
const slots =
|
|
14
|
+
const slots = defineSlots<{
|
|
15
|
+
title: () => unknown;
|
|
16
|
+
default: () => unknown;
|
|
17
|
+
actions: () => unknown;
|
|
18
|
+
}>();
|
|
15
19
|
|
|
16
20
|
const emit = defineEmits(['update:modelValue']);
|
|
17
21
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useTransformedModel } from '../../composition/useTransformedModel';
|
|
3
3
|
import style from './pl-editable-title.module.scss';
|
|
4
|
-
import { computed, ref } from 'vue';
|
|
4
|
+
import { computed, onMounted, ref } from 'vue';
|
|
5
5
|
|
|
6
6
|
const model = defineModel<string>();
|
|
7
7
|
|
|
@@ -27,6 +27,10 @@ const props = withDefaults(
|
|
|
27
27
|
* Min title length
|
|
28
28
|
*/
|
|
29
29
|
minLength?: number;
|
|
30
|
+
/**
|
|
31
|
+
* If true, input will be focused on mount
|
|
32
|
+
*/
|
|
33
|
+
autofocus?: boolean;
|
|
30
34
|
}>(),
|
|
31
35
|
{
|
|
32
36
|
placeholder: 'Title',
|
|
@@ -58,6 +62,8 @@ const local = useTransformedModel(model, {
|
|
|
58
62
|
},
|
|
59
63
|
});
|
|
60
64
|
|
|
65
|
+
const inputRef = ref<HTMLInputElement>();
|
|
66
|
+
|
|
61
67
|
const computedStyle = computed(() => ({
|
|
62
68
|
maxWidth: props.maxWidth ?? '80%',
|
|
63
69
|
}));
|
|
@@ -67,7 +73,12 @@ const save = () => {
|
|
|
67
73
|
local.reset();
|
|
68
74
|
};
|
|
69
75
|
|
|
70
|
-
|
|
76
|
+
onMounted(() => {
|
|
77
|
+
if (props.autofocus) {
|
|
78
|
+
inputRef.value?.focus();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
71
82
|
</script>
|
|
72
83
|
|
|
73
84
|
<template>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script generic="T extends unknown = unknown, K extends number | string = number | string" lang="ts" setup>
|
|
2
|
-
import type { ShallowRef } from 'vue';
|
|
3
|
-
import { computed, shallowRef, watch } from 'vue';
|
|
4
2
|
import { isFunction, shallowHash } from '@milaboratories/helpers';
|
|
5
3
|
import { useSortable } from '@vueuse/integrations/useSortable';
|
|
6
4
|
import { type SortableEvent } from 'sortablejs';
|
|
7
|
-
import {
|
|
5
|
+
import type { ShallowRef } from 'vue';
|
|
6
|
+
import { computed, shallowRef, watch } from 'vue';
|
|
8
7
|
import PlElementListItem from './PlElementListItem.vue';
|
|
8
|
+
import { moveElements } from './utils.ts';
|
|
9
9
|
|
|
10
10
|
const itemsRef = defineModel<T[]>('items', { required: true });
|
|
11
11
|
|
|
@@ -142,9 +142,17 @@ function createSortable(toggler: ShallowRef<boolean>, elRef: ShallowRef<undefine
|
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
});
|
|
145
|
-
watch(
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
watch(
|
|
146
|
+
[elRef, () => props.disableDragging, toggler],
|
|
147
|
+
([elRef, disabled, on]) => {
|
|
148
|
+
if (!elRef || disabled || !on) {
|
|
149
|
+
sortable.stop();
|
|
150
|
+
} else {
|
|
151
|
+
sortable.start();
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{ immediate: true },
|
|
155
|
+
);
|
|
148
156
|
|
|
149
157
|
return sortable;
|
|
150
158
|
}
|
|
@@ -37,6 +37,7 @@ const emit = defineEmits<{
|
|
|
37
37
|
:class="[$style.root, {
|
|
38
38
|
[$style.active]: props.isActive,
|
|
39
39
|
[$style.pinned]: props.isPinned,
|
|
40
|
+
[$style.opened]: props.isExpanded,
|
|
40
41
|
[$style.disabled]: props.isToggled,
|
|
41
42
|
}]"
|
|
42
43
|
>
|
|
@@ -125,6 +126,11 @@ const emit = defineEmits<{
|
|
|
125
126
|
|
|
126
127
|
&:hover {
|
|
127
128
|
--border-color: var(--border-color-focus);
|
|
129
|
+
--head-background: var(--gradient-light-lime);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&.opened {
|
|
133
|
+
--head-background: var(--gradient-light-lime);
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
&.disabled {
|
|
@@ -152,10 +158,6 @@ const emit = defineEmits<{
|
|
|
152
158
|
min-height: 40px;
|
|
153
159
|
border-radius: var(--border-radius) var(--border-radius) 0 0;
|
|
154
160
|
background: var(--head-background);
|
|
155
|
-
|
|
156
|
-
&:hover, &.opened {
|
|
157
|
-
--head-background: var(--gradient-light-lime);
|
|
158
|
-
}
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
.contentChevron {
|
|
@@ -2,6 +2,8 @@ export const moveElements = <T>(array: T[], from: number, to: number): T[] => {
|
|
|
2
2
|
if (to >= 0 && to < array.length) {
|
|
3
3
|
const element = array.splice(from, 1)[0];
|
|
4
4
|
array.splice(to, 0, element);
|
|
5
|
+
} else {
|
|
6
|
+
console.warn(`Invalid move operation: from ${from} to ${to} in array of length ${array.length}`);
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
return array;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const slots = defineSlots<{
|
|
3
|
+
[K in `item-${number}`]: () => unknown;
|
|
4
|
+
}>();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div :class="$style.root">
|
|
9
|
+
<template v-for="name in Object.keys(slots) as `item-${number}`[]" :key="name" >
|
|
10
|
+
<div :class="$style.item">
|
|
11
|
+
<slot :name="name" />
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style lang="scss" module>
|
|
18
|
+
@use '../../assets/variables.scss';
|
|
19
|
+
|
|
20
|
+
.root {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.item {
|
|
27
|
+
width: 1000%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
border-right: 1px solid var(--border-color-div-grey);
|
|
30
|
+
|
|
31
|
+
&:last-child {
|
|
32
|
+
border-right: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const slots = defineSlots<{
|
|
3
|
+
'header'?: () => unknown;
|
|
4
|
+
'header-content'?: () => unknown;
|
|
5
|
+
'body'?: () => unknown;
|
|
6
|
+
'body-content'?: () => unknown;
|
|
7
|
+
'footer'?: () => unknown;
|
|
8
|
+
'footer-content'?: () => unknown;
|
|
9
|
+
}>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div :class="$style.root">
|
|
14
|
+
<slot name="header">
|
|
15
|
+
<div v-if="slots['header-content']" :class="$style.header">
|
|
16
|
+
<slot name="header-content" />
|
|
17
|
+
</div>
|
|
18
|
+
</slot>
|
|
19
|
+
<slot name="body">
|
|
20
|
+
<div v-if="slots['body-content']" :class="$style.body">
|
|
21
|
+
<slot name="body-content" />
|
|
22
|
+
</div>
|
|
23
|
+
</slot>
|
|
24
|
+
<slot name="footer">
|
|
25
|
+
<div v-if="slots['footer-content']" :class="$style.footer">
|
|
26
|
+
<slot name="footer-content" />
|
|
27
|
+
</div>
|
|
28
|
+
</slot>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style lang="scss" module>
|
|
33
|
+
@use '../../assets/variables.scss';
|
|
34
|
+
|
|
35
|
+
.root {
|
|
36
|
+
position: relative;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
}
|
|
40
|
+
.close {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 8px;
|
|
44
|
+
right: 8px;
|
|
45
|
+
padding: 8px;
|
|
46
|
+
}
|
|
47
|
+
.header {
|
|
48
|
+
padding: 24px;
|
|
49
|
+
}
|
|
50
|
+
.body {
|
|
51
|
+
flex-grow: 1;
|
|
52
|
+
padding: 24px;
|
|
53
|
+
overflow-y: auto;
|
|
54
|
+
}
|
|
55
|
+
.footer {
|
|
56
|
+
padding: 24px;
|
|
57
|
+
border-top: 1px solid var(--border-color-div-grey);
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'PlPureSlideModal',
|
|
4
|
+
inheritAttrs: false,
|
|
5
|
+
};
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import './pl-slide-modal.scss';
|
|
10
|
+
import { ref, useAttrs } from 'vue';
|
|
11
|
+
import TransitionSlidePanel from '../TransitionSlidePanel.vue';
|
|
12
|
+
import { useClickOutside, useEventListener } from '../../index';
|
|
13
|
+
import type { Props } from './props';
|
|
14
|
+
import { defaultProps } from './props';
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
(e: 'update:modelValue', value: boolean): void;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
const modal = ref();
|
|
21
|
+
const attrs = useAttrs();
|
|
22
|
+
const props = withDefaults(
|
|
23
|
+
defineProps<Props>(),
|
|
24
|
+
defaultProps,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
useClickOutside(modal, () => {
|
|
28
|
+
if (props.modelValue && props.closeOnOutsideClick) {
|
|
29
|
+
emit('update:modelValue', false);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
useEventListener(document, 'keydown', (evt: KeyboardEvent) => {
|
|
34
|
+
if (evt.key === 'Escape') {
|
|
35
|
+
emit('update:modelValue', false);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<Teleport to="body">
|
|
42
|
+
<TransitionSlidePanel>
|
|
43
|
+
<div
|
|
44
|
+
v-if="props.modelValue"
|
|
45
|
+
ref="modal"
|
|
46
|
+
class="pl-slide-modal"
|
|
47
|
+
:style="{ width: props.width }"
|
|
48
|
+
v-bind="attrs"
|
|
49
|
+
@keyup.esc="emit('update:modelValue', false)"
|
|
50
|
+
>
|
|
51
|
+
<div class="close-dialog-btn" @click="emit('update:modelValue', false)" />
|
|
52
|
+
<slot />
|
|
53
|
+
</div>
|
|
54
|
+
</TransitionSlidePanel>
|
|
55
|
+
<div v-if="props.modelValue && props.shadow" class="pl-slide-modal__shadow" @keyup.esc="emit('update:modelValue', false)" />
|
|
56
|
+
</Teleport>
|
|
57
|
+
</template>
|
|
@@ -7,86 +7,42 @@ export default {
|
|
|
7
7
|
|
|
8
8
|
<script lang="ts" setup>
|
|
9
9
|
import './pl-slide-modal.scss';
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
const slots = useSlots(); // title & actions
|
|
15
|
-
|
|
16
|
-
const emit = defineEmits<{
|
|
17
|
-
(e: 'update:modelValue', value: boolean): void;
|
|
18
|
-
}>();
|
|
10
|
+
import { useAttrs, useSlots } from 'vue';
|
|
11
|
+
import PlPureSlideModal from './PlPureSlideModal.vue';
|
|
12
|
+
import type { Props } from './props';
|
|
13
|
+
import { defaultProps } from './props';
|
|
19
14
|
|
|
15
|
+
const slots = useSlots();
|
|
16
|
+
const attrs = useAttrs();
|
|
20
17
|
const props = withDefaults(
|
|
21
|
-
defineProps<
|
|
22
|
-
|
|
23
|
-
* Determines whether the modal is open
|
|
24
|
-
*/
|
|
25
|
-
modelValue: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Css `width` value (px, %, em etc)
|
|
28
|
-
*/
|
|
29
|
-
width?: string;
|
|
30
|
-
/**
|
|
31
|
-
* If `true`, then show shadow (default value `false`)
|
|
32
|
-
*/
|
|
33
|
-
shadow?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* If `true`, the modal window closes when clicking outside the modal area (default: `true`)
|
|
36
|
-
*/
|
|
37
|
-
closeOnOutsideClick?: boolean;
|
|
38
|
-
}>(),
|
|
39
|
-
{
|
|
40
|
-
modelValue: false,
|
|
41
|
-
width: '368px',
|
|
42
|
-
shadow: false,
|
|
43
|
-
closeOnOutsideClick: true,
|
|
44
|
-
},
|
|
18
|
+
defineProps<Props>(),
|
|
19
|
+
defaultProps,
|
|
45
20
|
);
|
|
46
21
|
|
|
47
|
-
const modal = ref();
|
|
48
|
-
|
|
49
|
-
const $attrs = useAttrs();
|
|
50
|
-
|
|
51
|
-
useClickOutside(modal, () => {
|
|
52
|
-
if (props.modelValue && props.closeOnOutsideClick) {
|
|
53
|
-
emit('update:modelValue', false);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
useEventListener(document, 'keydown', (evt: KeyboardEvent) => {
|
|
58
|
-
if (evt.key === 'Escape') {
|
|
59
|
-
emit('update:modelValue', false);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
22
|
</script>
|
|
63
23
|
|
|
64
24
|
<template>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</div>
|
|
82
|
-
<div class="pl-slide-modal__content">
|
|
83
|
-
<slot />
|
|
84
|
-
</div>
|
|
85
|
-
<div v-if="slots.actions" class="pl-slide-modal__actions">
|
|
86
|
-
<slot name="actions" />
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</TransitionSlidePanel>
|
|
90
|
-
<div v-if="modelValue && shadow" class="pl-slide-modal__shadow" @keyup.esc="emit('update:modelValue', false)" />
|
|
91
|
-
</Teleport>
|
|
25
|
+
<PlPureSlideModal
|
|
26
|
+
v-bind="{...props, ...attrs}"
|
|
27
|
+
:class="[$style.root, { 'has-title': slots.title, 'has-actions': slots.actions }]"
|
|
28
|
+
>
|
|
29
|
+
<div v-if="slots.title" class="pl-slide-modal__title">
|
|
30
|
+
<span class="pl-slide-modal__title-content">
|
|
31
|
+
<slot name="title" />
|
|
32
|
+
</span>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="pl-slide-modal__content">
|
|
35
|
+
<slot />
|
|
36
|
+
</div>
|
|
37
|
+
<div v-if="slots.actions" class="pl-slide-modal__actions">
|
|
38
|
+
<slot name="actions" />
|
|
39
|
+
</div>
|
|
40
|
+
</PlPureSlideModal>
|
|
92
41
|
</template>
|
|
42
|
+
|
|
43
|
+
<style lang="css" module>
|
|
44
|
+
.root {
|
|
45
|
+
--padding-top: 24px;
|
|
46
|
+
--padding-bottom: 24px;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
@use "../../assets/mixins.scss" as *;
|
|
2
2
|
|
|
3
3
|
.pl-slide-modal {
|
|
4
|
-
--padding-top:
|
|
5
|
-
--padding-bottom:
|
|
4
|
+
--padding-top: 0;
|
|
5
|
+
--padding-bottom: 0;
|
|
6
6
|
position: absolute;
|
|
7
7
|
top: var(--title-bar-height);
|
|
8
8
|
right: 0;
|
|
9
9
|
bottom: 0;
|
|
10
10
|
z-index: var(--z-slide-dialog);
|
|
11
|
-
display:
|
|
12
|
-
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
13
|
padding-top: var(--padding-top);
|
|
14
14
|
padding-bottom: var(--padding-bottom);
|
|
15
15
|
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
.close-dialog-btn {
|
|
31
31
|
position: absolute;
|
|
32
|
+
z-index: 1;
|
|
32
33
|
top: 12px;
|
|
33
34
|
right: 12px;
|
|
34
35
|
cursor: pointer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type Props = {
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether the modal is open
|
|
4
|
+
*/
|
|
5
|
+
modelValue: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Css `width` value (px, %, em etc)
|
|
8
|
+
*/
|
|
9
|
+
width?: string;
|
|
10
|
+
/**
|
|
11
|
+
* If `true`, then show shadow (default value `false`)
|
|
12
|
+
*/
|
|
13
|
+
shadow?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If `true`, the modal window closes when clicking outside the modal area (default: `true`)
|
|
16
|
+
*/
|
|
17
|
+
closeOnOutsideClick?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const defaultProps: Props = {
|
|
21
|
+
modelValue: false,
|
|
22
|
+
width: '368px',
|
|
23
|
+
shadow: false,
|
|
24
|
+
closeOnOutsideClick: true,
|
|
25
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { h, render } from 'vue';
|
|
2
|
+
import PlConfirmDialog from '../components/PlConfirmDialog.vue';
|
|
3
|
+
|
|
4
|
+
export type ConfirmProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
confirmLabel?: string;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function useConfirm(props: ConfirmProps) {
|
|
12
|
+
return () => {
|
|
13
|
+
return new Promise<boolean>((resolve) => {
|
|
14
|
+
const vnode = h(PlConfirmDialog, {
|
|
15
|
+
opened: true,
|
|
16
|
+
title: props.title,
|
|
17
|
+
message: props.message,
|
|
18
|
+
confirmLabel: props.confirmLabel ?? 'Confirm',
|
|
19
|
+
cancelLabel: props.cancelLabel ?? 'Cancel',
|
|
20
|
+
onConfirm: () => finish(true),
|
|
21
|
+
onCancel: () => finish(false),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const mountPoint = document.createElement('div');
|
|
25
|
+
document.body.appendChild(mountPoint);
|
|
26
|
+
render(vnode, mountPoint);
|
|
27
|
+
|
|
28
|
+
function finish(result: boolean) {
|
|
29
|
+
resolve(result);
|
|
30
|
+
render(null, mountPoint);
|
|
31
|
+
mountPoint.remove();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|