@everchron/ec-shards 6.1.4 → 6.1.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everchron/ec-shards",
3
- "version": "6.1.4",
3
+ "version": "6.1.6",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -53,36 +53,45 @@
53
53
  },
54
54
 
55
55
  watch: {
56
- show(){
56
+ show() {
57
57
  this.isShown = this.show
58
58
 
59
- if(this.isShown){
59
+ if (this.isShown) {
60
60
  this.lazyLoad = true
61
61
  this.$nextTick(() => {
62
- if(this.showInPlace)
62
+ if (this.showInPlace)
63
63
  this.$refs.dialog.show()
64
64
  else
65
65
  this.$refs.dialog.showModal()
66
+
67
+ document.addEventListener('keyup', this.keyUpHandler)
66
68
  })
67
69
  } else {
68
70
  this.$refs.dialog.close()
69
71
  this.$nextTick(() => {
70
72
  this.lazyLoad = false
71
73
  })
74
+
75
+ document.removeEventListener('keyup', this.keyUpHandler)
76
+ }
77
+ },
78
+
79
+ lazyLoad() {
80
+ if (this.lazyLoad) {
81
+ this.$nextTick(() => {
82
+ this.$refs.dialog.addEventListener('cancel', (event) => {
83
+ event.preventDefault();
84
+ });
85
+ })
72
86
  }
73
87
  }
74
88
  },
75
89
 
76
90
  mounted(){
77
- const that = this
78
- document.onkeyup = function(e) {
79
- if (that.isShown){
80
- if (e.key == "Escape"){
81
- that.$emit('cancel')
82
- }
83
- else if (e.key == "Enter"){
84
- that.$emit('confirm')
85
- }
91
+ this.keyUpHandler = (e) => {
92
+ if (this.isShown && e.key === 'Escape') {
93
+ e.preventDefault()
94
+ this.$emit('cancel')
86
95
  }
87
96
  }
88
97
  }
@@ -15,12 +15,12 @@ export const dialogPrompt = () => ({
15
15
  }
16
16
  },
17
17
  template: `<div>
18
- <button @click="showdialog = !showdialog">Open</button>
19
- <ecs-dialog id="example" :show="showdialog">
18
+ <button @click="showdialog = true">Open</button>
19
+ <ecs-dialog @cancel="showdialog = false" :show="showdialog">
20
20
  <ecs-dialog-header icon="document">Send Documents</ecs-dialog-header>
21
21
  <p>Are you sure you want to delete the selected documents?</p>
22
22
  <template slot="actions">
23
- <ecs-button-dialog @click="showdialog = !showdialog">Cancel</ecs-button-dialog>
23
+ <ecs-button-dialog @click="showdialog = false">Cancel</ecs-button-dialog>
24
24
  <ecs-button-dialog type="confirm" icon="download">Confirm</ecs-button-dialog>
25
25
  </template>
26
26
  </ecs-dialog>
@@ -37,12 +37,12 @@ export const dialogSizes = () => ({
37
37
  }
38
38
  },
39
39
  template: `<div>
40
- <button @click="showdialogSmall = !showdialogSmall">Open Small</button>
41
- <ecs-dialog size="sml" :show="showdialogSmall">
40
+ <button @click="showdialogSmall = true">Open Small</button>
41
+ <ecs-dialog size="sml" :show="showdialogSmall" @cancel="showdialogSmall = false">
42
42
  <ecs-dialog-header>Choose Attachment</ecs-dialog-header>
43
43
  <p>Select documents to attach to.</p>
44
44
  <template slot="actions">
45
- <ecs-button-dialog @click="showdialogSmall = !showdialogSmall">Cancel</ecs-button-dialog>
45
+ <ecs-button-dialog @click="showdialogSmall = false">Cancel</ecs-button-dialog>
46
46
  <ecs-button-dialog type="confirm" icon="download">Confirm</ecs-button-dialog>
47
47
  </template>
48
48
  </ecs-dialog>