Skip to content

Commit 3402bdc

Browse files
committed
Bug fix + improvements
1 parent 18ad30b commit 3402bdc

File tree

10 files changed

+1825
-29
lines changed

10 files changed

+1825
-29
lines changed

dist/vuejs-dialog.min.js

Lines changed: 782 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/app.main.css

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
*{-webkit-box-sizing:border-box;box-sizing:border-box}body{margin:0;padding:0;font-family:Noto Sans,sans-serif}.centered{margin-right:auto;margin-left:auto}.title-case{text-transform:capitalize}header{background-color:#41b883;color:#fefefe;display:block}header .lang-btn{margin:5px 12px;color:#fefefe;text-decoration:none}header .lang-btn:hover{text-decoration:underline}header .header-cont{width:94%;padding:5px;max-width:800px;display:block;text-align:center}header .title{margin:175px auto}@media (max-width:600px){header .title{margin:25px auto}}
1+
/* reset */
2+
* {
3+
-webkit-box-sizing: border-box;
4+
box-sizing: border-box; }
5+
6+
body {
7+
margin: 0;
8+
padding: 0;
9+
font-family: 'Noto Sans', sans-serif; }
10+
11+
.centered {
12+
margin-right: auto;
13+
margin-left: auto; }
14+
15+
.title-case {
16+
text-transform: capitalize; }
17+
18+
/* header */
19+
header {
20+
background-color: #41B883;
21+
color: #fefefe;
22+
display: block; }
23+
header .lang-btn {
24+
margin: 5px 12px;
25+
color: #fefefe;
26+
text-decoration: none; }
27+
header .lang-btn:hover {
28+
text-decoration: underline; }
29+
header .header-cont {
30+
width: 94%;
31+
padding: 5px;
32+
max-width: 800px;
33+
display: block;
34+
text-align: center; }
35+
header .title {
36+
margin: 175px auto; }
37+
38+
@media all and (max-width: 600px) {
39+
header .title {
40+
margin: 25px auto; } }

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<title>VueJs Plugin usage example</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="css/app.main.css?a4a359c14680a1adcc68" rel="stylesheet"></head>
7+
<link href="css/app.main.css?06df0649f688632b3128" rel="stylesheet"></head>
88
<body>
99

1010
<div id="app"></div>
@@ -21,5 +21,5 @@
2121
ga('send', 'pageview');
2222

2323
</script>
24-
<script type="text/javascript" src="js/app.main.js?a4a359c14680a1adcc68"></script></body>
24+
<script type="text/javascript" src="js/app.main.js?06df0649f688632b3128"></script></body>
2525
</html>

docs/js/app.main.js

Lines changed: 182 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/vuejs-dialog.min.js

Lines changed: 782 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/docs/js/translations/en.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
descriptions: {
2222
confirmation_types: {
2323
1: "Sometimes, you may want to be more strict by making sure a user really wants to proceed.",
24-
2: "The SOFT and HARD confirmation dialogs helps with that."
24+
2: "The SOFT and HARD confirmation dialogsOBJ helps with that."
2525
},
2626
},
2727
examples: {

src/docs/js/translations/es.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
descriptions: {
2222
confirmation_types: {
2323
1: "Sometimes, you may want to be more strict by making sure a user really wants to proceed.",
24-
2: "The SOFT and HARD confirmation dialogs helps with that."
24+
2: "The SOFT and HARD confirmation dialogsOBJ helps with that."
2525
},
2626
},
2727
examples: {

src/plugin/components/dialog-window.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
22
<div>
3+
<transition name="dg-backdrop" appear="" @after-leave="anmiationEnded" @after-enter="show = true">
4+
<div v-if="backdrop" class="dg-backdrop"></div>
5+
</transition>
6+
37
<transition :name="animation" appear="" @after-leave="backdrop = false">
48
<div v-if="show" ref="container" :class="['dg-container', {'dg-container--has-input': (isHardConfirm || isPrompt)}]">
59
<div class="dg-content-cont dg-content-cont--floating">
@@ -41,10 +45,6 @@
4145
</div>
4246
</div>
4347
</transition>
44-
45-
<transition name="dg-backdrop" appear="" @after-leave="anmiationEnded" @after-enter="show = true">
46-
<div v-if="backdrop" class="dg-backdrop"></div>
47-
</transition>
4848
</div>
4949
</template>
5050

@@ -152,7 +152,8 @@
152152
if (this.canceled){
153153
this.options.promiseRejecter(false)
154154
}
155-
this.$emit('close')
155+
console.log('emit close: ', this.options.id)
156+
this.$emit('close', this.options.id)
156157
},
157158
escapeKeyListener(e) {
158159
if (e.keyCode === 27) {
@@ -161,10 +162,10 @@
161162
}
162163
},
163164
created() {
164-
document.addEventListener('keydown', this.escapeKeyListener);
165+
document.addEventListener('keydown', this.escapeKeyListener)
165166
},
166167
destroyed() {
167-
document.removeEventListener('keydown', this.escapeKeyListener);
168+
document.removeEventListener('keydown', this.escapeKeyListener)
168169
},
169170
components: {CancelBtn, OkBtn}
170171
}

src/plugin/components/dialog.vue

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,46 @@
11
<template>
2-
<div v-if="dialogs.length > 0">
3-
<dialog-window v-for="(dialog, idx) in dialogs"
4-
:options="dialog.options"
5-
@close="closeDialog(idx)">
2+
<div>
3+
<dialog-window v-for="dialog in dialogs"
4+
:options="dialog"
5+
:key="dialog.id"
6+
@close="closeDialog">
67
</dialog-window>
78
</div>
89
</template>
910

1011
<script>
12+
import Vue from 'vue'
1113
import DialogWindow from './dialog-window.vue'
1214
1315
export default {
1416
data: function () {
1517
return {
16-
dialogs: []
18+
dialogsOBJ: {}
19+
}
20+
},
21+
computed: {
22+
dialogs(){
23+
let ret = []
24+
for(let dialog in this.dialogsOBJ){
25+
if(this.dialogsOBJ.hasOwnProperty(dialog)){
26+
console.log("Computed: ", dialog, this.dialogsOBJ[dialog])
27+
ret.push(this.dialogsOBJ[dialog])
28+
}
29+
}
30+
return ret
1731
}
1832
},
1933
methods: {
2034
commit(data){
21-
this.dialogs.push({
22-
options: data
23-
})
35+
this.$set(this.dialogsOBJ, data.id, data)
2436
},
25-
closeDialog(idx){
26-
this.dialogs.splice(idx, 1)
37+
closeDialog(id){
38+
console.log(id)
39+
40+
this.$delete(this.dialogsOBJ, id)
41+
42+
console.log(this.dialogs.length, this.dialogs)
43+
2744
}
2845
},
2946
components: {DialogWindow}

src/plugin/styles/_default.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
left: 0;
1717
width: 100%;
1818
height: 100%;
19-
z-index: 50000
2019
}
2120

2221
.dg-container {
@@ -25,7 +24,6 @@
2524
position: fixed;
2625
top: 0;
2726
left: 0;
28-
z-index: 50001;
2927
}
3028

3129
.dg-content-cont {

0 commit comments

Comments
 (0)