@veritree/ui 0.5.0 → 0.5.1
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/package.json
CHANGED
package/src/Drawer/VTDrawer.vue
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
:id="id"
|
|
5
5
|
:class="{ Drawer: headless, 'fixed inset-0 z-50 h-screen': !headless }"
|
|
6
6
|
aria-modal="true"
|
|
7
|
-
@click="
|
|
7
|
+
@click="onClick"
|
|
8
8
|
>
|
|
9
9
|
<slot></slot>
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import { genId } from
|
|
14
|
+
import { genId } from "~/utils/ids";
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
name:
|
|
17
|
+
name: "VTDrawer",
|
|
18
18
|
|
|
19
19
|
provide() {
|
|
20
20
|
return {
|
|
@@ -53,7 +53,7 @@ export default {
|
|
|
53
53
|
},
|
|
54
54
|
|
|
55
55
|
model: {
|
|
56
|
-
prop:
|
|
56
|
+
prop: "visible",
|
|
57
57
|
},
|
|
58
58
|
|
|
59
59
|
props: {
|
|
@@ -104,10 +104,21 @@ export default {
|
|
|
104
104
|
|
|
105
105
|
emit() {
|
|
106
106
|
this.$nextTick(() => {
|
|
107
|
-
this.$emit(
|
|
108
|
-
this.$emit(
|
|
107
|
+
this.$emit("input", false);
|
|
108
|
+
this.$emit("hidden");
|
|
109
109
|
});
|
|
110
110
|
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Hides the dialog when clicking outside its content.
|
|
114
|
+
*
|
|
115
|
+
* @param {object} event
|
|
116
|
+
*/
|
|
117
|
+
onClick(ev) {
|
|
118
|
+
console.log(ev);
|
|
119
|
+
if (!ev || ev.target.id !== this.overlay.id) return;
|
|
120
|
+
this.hide();
|
|
121
|
+
},
|
|
111
122
|
},
|
|
112
123
|
};
|
|
113
124
|
</script>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<FadeInOut>
|
|
3
3
|
<div
|
|
4
4
|
v-if="visible"
|
|
5
|
+
:id="id"
|
|
5
6
|
:class="{
|
|
6
7
|
'Drawer-overlay': headless,
|
|
7
8
|
'fixed inset-0 z-10 bg-fd-450/80': !headless,
|
|
@@ -11,14 +12,14 @@
|
|
|
11
12
|
</template>
|
|
12
13
|
|
|
13
14
|
<script>
|
|
14
|
-
import FadeInOut from
|
|
15
|
+
import FadeInOut from "../Transitions/FadeInOut.vue";
|
|
15
16
|
|
|
16
17
|
export default {
|
|
17
18
|
components: {
|
|
18
19
|
FadeInOut,
|
|
19
20
|
},
|
|
20
21
|
|
|
21
|
-
inject: [
|
|
22
|
+
inject: ["api"],
|
|
22
23
|
|
|
23
24
|
data() {
|
|
24
25
|
return {
|
|
@@ -34,6 +35,10 @@ export default {
|
|
|
34
35
|
headless() {
|
|
35
36
|
return this.api().isHeadless;
|
|
36
37
|
},
|
|
38
|
+
|
|
39
|
+
id() {
|
|
40
|
+
return `${this.api().id}-overlay`;
|
|
41
|
+
},
|
|
37
42
|
},
|
|
38
43
|
|
|
39
44
|
mounted() {
|