@milaboratories/uikit 1.2.9 → 1.2.10
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/CHANGELOG.md +6 -0
- package/dist/pl-uikit.js +753 -736
- package/dist/pl-uikit.umd.cjs +3 -3
- package/dist/src/components/PlSlideModal/PlSlideModal.vue.d.ts +32 -3
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/PlLogView/PlLogView.vue +1 -1
- package/src/components/PlSlideModal/PlSlideModal.vue +84 -20
- package/src/composition/useClickOutside.ts +5 -1
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ const scrollDown = () => {
|
|
|
32
32
|
tapIf(contentRef.value, (el) => {
|
|
33
33
|
// 100px from bottom (temp)
|
|
34
34
|
if (el.clientHeight + el.scrollTop + 100 > el.scrollHeight) {
|
|
35
|
-
el.scrollTo(
|
|
35
|
+
el.scrollTo(el.scrollLeft, el.scrollHeight);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
};
|
|
@@ -1,26 +1,45 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
export default {
|
|
3
|
+
name: 'PlSlideModal',
|
|
3
4
|
inheritAttrs: false,
|
|
4
5
|
};
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<script lang="ts" setup>
|
|
8
|
-
import { computed, ref, useAttrs } from 'vue';
|
|
9
|
+
import { computed, ref, useAttrs, useSlots } from 'vue';
|
|
9
10
|
import TransitionSlidePanel from '@/components/TransitionSlidePanel.vue';
|
|
10
11
|
import { useClickOutside, useEventListener } from '@/index';
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const slots = useSlots(); // title & actions
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: 'update:modelValue', value: boolean): void;
|
|
17
|
+
}>();
|
|
13
18
|
|
|
14
19
|
const props = withDefaults(
|
|
15
20
|
defineProps<{
|
|
21
|
+
/**
|
|
22
|
+
* Determines whether the modal is open
|
|
23
|
+
*/
|
|
16
24
|
modelValue: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Css `width` value (px, %, em etc)
|
|
27
|
+
*/
|
|
17
28
|
width?: string;
|
|
29
|
+
/**
|
|
30
|
+
* If `true`, then show shadow (default value `false`)
|
|
31
|
+
*/
|
|
18
32
|
shadow?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* If `true`, the modal window closes when clicking outside the modal area.
|
|
35
|
+
*/
|
|
36
|
+
closeOnOutsideClick?: boolean;
|
|
19
37
|
}>(),
|
|
20
38
|
{
|
|
21
39
|
modelValue: false,
|
|
22
|
-
width:
|
|
40
|
+
width: '368px',
|
|
23
41
|
shadow: false,
|
|
42
|
+
closeOnOutsideClick: true,
|
|
24
43
|
},
|
|
25
44
|
);
|
|
26
45
|
|
|
@@ -31,7 +50,7 @@ const modal = ref();
|
|
|
31
50
|
const $attrs = useAttrs();
|
|
32
51
|
|
|
33
52
|
useClickOutside(modal, () => {
|
|
34
|
-
if (props.modelValue) {
|
|
53
|
+
if (props.modelValue && props.closeOnOutsideClick) {
|
|
35
54
|
emit('update:modelValue', false);
|
|
36
55
|
}
|
|
37
56
|
});
|
|
@@ -46,37 +65,54 @@ useEventListener(document, 'keydown', (evt: KeyboardEvent) => {
|
|
|
46
65
|
<template>
|
|
47
66
|
<Teleport to="body">
|
|
48
67
|
<TransitionSlidePanel>
|
|
49
|
-
<div
|
|
68
|
+
<div
|
|
69
|
+
v-if="modelValue"
|
|
70
|
+
ref="modal"
|
|
71
|
+
:style="{ width }"
|
|
72
|
+
v-bind="$attrs"
|
|
73
|
+
class="pl-slide-modal"
|
|
74
|
+
:class="{ 'has-title': slots.title }"
|
|
75
|
+
@keyup.esc="emit('update:modelValue', false)"
|
|
76
|
+
>
|
|
50
77
|
<div class="close-dialog-btn" @click="emit('update:modelValue', false)" />
|
|
51
|
-
<div class="slide-
|
|
78
|
+
<div v-if="slots.title" class="pl-slide-modal__title">
|
|
79
|
+
<slot name="title" />
|
|
80
|
+
</div>
|
|
81
|
+
<div class="pl-slide-modal__content">
|
|
52
82
|
<slot />
|
|
53
83
|
</div>
|
|
84
|
+
<div v-if="slots.actions" class="pl-slide-modal__actions">
|
|
85
|
+
<slot name="actions" />
|
|
86
|
+
</div>
|
|
54
87
|
</div>
|
|
55
88
|
</TransitionSlidePanel>
|
|
56
|
-
<div v-if="modelValue && shadow" class="dialog-modal__shadow" @keyup.esc="emit('update:modelValue', false)" />
|
|
89
|
+
<div v-if="modelValue && shadow" class="pl-dialog-modal__shadow" @keyup.esc="emit('update:modelValue', false)" />
|
|
57
90
|
</Teleport>
|
|
58
91
|
</template>
|
|
59
92
|
|
|
60
|
-
<style lang="scss"
|
|
93
|
+
<style lang="scss">
|
|
61
94
|
@import '@/assets/mixins.scss';
|
|
62
95
|
|
|
63
|
-
.slide-modal {
|
|
96
|
+
.pl-slide-modal {
|
|
97
|
+
--padding-top: 24px;
|
|
64
98
|
position: absolute;
|
|
65
99
|
top: var(--title-bar-height);
|
|
66
100
|
right: 0;
|
|
67
101
|
bottom: 0;
|
|
68
102
|
z-index: 3;
|
|
69
|
-
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
padding-top: var(--padding-top);
|
|
70
106
|
|
|
71
107
|
will-change: transform;
|
|
72
108
|
|
|
73
109
|
background-color: #fff;
|
|
74
110
|
|
|
75
|
-
border-left: 1px solid var(--
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
111
|
+
border-left: 1px solid var(--div-grey);
|
|
112
|
+
/* Shadow L */
|
|
113
|
+
box-shadow:
|
|
114
|
+
0px 8px 16px -4px rgba(15, 36, 77, 0.16),
|
|
115
|
+
0px 12px 32px -4px rgba(15, 36, 77, 0.16);
|
|
80
116
|
|
|
81
117
|
.close-dialog-btn {
|
|
82
118
|
position: absolute;
|
|
@@ -90,15 +126,43 @@ useEventListener(document, 'keydown', (evt: KeyboardEvent) => {
|
|
|
90
126
|
}
|
|
91
127
|
}
|
|
92
128
|
|
|
93
|
-
&.
|
|
129
|
+
&.has-title {
|
|
130
|
+
--padding-top: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__title {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
font-family: var(--font-family-base);
|
|
137
|
+
font-size: 28px;
|
|
138
|
+
font-style: normal;
|
|
139
|
+
font-weight: 500;
|
|
140
|
+
line-height: 32px; /* 114.286% */
|
|
141
|
+
letter-spacing: -0.56px;
|
|
142
|
+
padding: 24px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&__actions {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: 6px;
|
|
94
149
|
padding: 0;
|
|
95
|
-
|
|
96
|
-
|
|
150
|
+
min-height: 88px;
|
|
151
|
+
padding: 0 24px;
|
|
152
|
+
button {
|
|
153
|
+
min-width: 160px;
|
|
154
|
+
}
|
|
97
155
|
}
|
|
98
156
|
|
|
157
|
+
// Closes modal too
|
|
158
|
+
|
|
99
159
|
&__content {
|
|
100
|
-
|
|
101
|
-
|
|
160
|
+
flex: 1;
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
gap: 24px;
|
|
164
|
+
padding: 16px 0;
|
|
165
|
+
margin: 0 24px;
|
|
102
166
|
}
|
|
103
167
|
}
|
|
104
168
|
</style>
|
|
@@ -6,10 +6,14 @@ type HtmlRef = Ref<HTMLElement | undefined>;
|
|
|
6
6
|
|
|
7
7
|
export function useClickOutside(el: HtmlRef | HtmlRef[], cb: () => void) {
|
|
8
8
|
useEventListener(document, 'click', (event) => {
|
|
9
|
+
if (!document.contains(event.target as Node)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
const values = flatValue(el)
|
|
10
14
|
.map((e) => e.value)
|
|
11
15
|
.filter((v) => !!v) as HTMLElement[];
|
|
12
|
-
if (!values.some((v) => v?.contains(event.target as
|
|
16
|
+
if (!values.some((v) => v?.contains(event.target as Node))) {
|
|
13
17
|
cb();
|
|
14
18
|
}
|
|
15
19
|
});
|