@afeefa/vue-app 0.0.150 → 0.0.151

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.
@@ -1 +1 @@
1
- 0.0.150
1
+ 0.0.151
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.150",
3
+ "version": "0.0.151",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <v-hover v-slot="{ hover }">
4
4
  <v-btn
5
- :class="'a-btn-standard removeButton-' + dialogId"
5
+ :class="'a-btn-standard removeButton-' + removeButtonId"
6
6
  fab
7
7
  :color="(hover ? 'red' : 'grey lighten-3')"
8
8
  :title="title"
@@ -18,67 +18,36 @@
18
18
  </v-btn>
19
19
  </v-hover>
20
20
 
21
- <a-dialog
22
- :id="dialogId"
23
- :anchor="'.removeButton-' + dialogId"
24
- :active="protect ? removeKey === removeConfirmed : true"
25
- >
26
- <template v-if="protect">
27
- <div>Bitte folgenden Key eingeben: <strong class="removeKey">{{ removeKey }}</strong></div>
28
-
29
- <a-text-field
30
- v-model="removeConfirmed"
31
- label="Key"
32
- :focus="true"
33
- width="100"
34
- />
35
- </template>
36
- </a-dialog>
21
+ <remove-dialog
22
+ ref="dialog"
23
+ :anchor="'.removeButton-' + removeButtonId"
24
+ v-bind="$attrs"
25
+ v-on="$listeners"
26
+ />
37
27
  </div>
38
28
  </template>
39
29
 
40
30
 
41
31
  <script>
42
32
  import { Component, Vue } from '@a-vue'
43
- import { DialogEvent } from '@a-vue/events'
44
33
  import { randomCssClass } from '@a-vue/utils/random'
45
34
 
46
35
  @Component({
47
- props: ['iconSize', 'title', 'message', 'info', 'itemTitle', 'protect']
36
+ props: ['iconSize']
48
37
  })
49
- export default class EditPage extends Vue {
50
- dialogId = randomCssClass(10)
51
- removeKey = null
52
- removeConfirmed = null
38
+ export default class RemoveButton extends Vue {
39
+ removeButtonId = randomCssClass(10)
53
40
 
54
41
  get isSmall () {
55
42
  return Object.keys(this.$attrs).filter(k => k.match(/x-small|default|large|x-large/)).length === 0
56
43
  }
57
44
 
58
45
  async remove () {
59
- if (this.protect) {
60
- this.removeKey = [...Array(6)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')
61
- }
62
-
63
- const result = await this.$events.dispatch(new DialogEvent(DialogEvent.SHOW, {
64
- id: this.dialogId,
65
- title: this.itemTitle + ' löschen?',
66
- message: ['Soll ' + this.itemTitle + ' gelöscht werden?', this.message].filter(m => m).join('<br><br>'),
67
- info: this.info,
68
- yesButton: 'Löschen',
69
- yesColor: 'red white--text'
70
- }))
46
+ this.$refs.dialog.remove()
47
+ }
71
48
 
72
- if (result === DialogEvent.RESULT_YES) {
73
- this.$emit('remove')
74
- }
49
+ get title () {
50
+ return this.$attrs.title || 'Löschen'
75
51
  }
76
52
  }
77
53
  </script>
78
-
79
-
80
- <style lang="scss" scoped>
81
- .removeKey {
82
- user-select: none;
83
- }
84
- </style>
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <a-dialog
3
+ :id="dialogId"
4
+ :anchor="anchor"
5
+ :active="protect ? removeKey === removeConfirmed : true"
6
+ >
7
+ <template v-if="protect">
8
+ <div>Bitte folgenden Key eingeben: <strong class="removeKey">{{ removeKey }}</strong></div>
9
+
10
+ <a-text-field
11
+ v-model="removeConfirmed"
12
+ label="Key"
13
+ :focus="true"
14
+ width="100"
15
+ />
16
+ </template>
17
+ </a-dialog>
18
+ </template>
19
+
20
+
21
+ <script>
22
+ import { Component, Vue } from '@a-vue'
23
+ import { DialogEvent } from '@a-vue/events'
24
+ import { randomCssClass } from '@a-vue/utils/random'
25
+
26
+ @Component({
27
+ props: ['anchor', 'title', 'message', 'info', 'itemTitle', {protect: false, dialog: true}]
28
+ })
29
+ export default class RemoveDialog extends Vue {
30
+ dialogId = randomCssClass(10)
31
+ removeKey = null
32
+ removeConfirmed = null
33
+
34
+ get isSmall () {
35
+ return Object.keys(this.$attrs).filter(k => k.match(/x-small|default|large|x-large/)).length === 0
36
+ }
37
+
38
+ async remove () {
39
+ if (!this.dialog) {
40
+ this.$emit('remove')
41
+ return
42
+ }
43
+
44
+ if (this.protect) {
45
+ this.removeKey = [...Array(6)].map(() => Math.floor(Math.random() * 16).toString(16)).join('')
46
+ }
47
+
48
+ const result = await this.$events.dispatch(new DialogEvent(DialogEvent.SHOW, {
49
+ id: this.dialogId,
50
+ title: this.itemTitle + ' löschen?',
51
+ message: ['Soll ' + this.itemTitle + ' gelöscht werden?', this.message].filter(m => m).join('<br><br>'),
52
+ info: this.info,
53
+ yesButton: 'Löschen',
54
+ yesColor: 'red white--text'
55
+ }))
56
+
57
+ if (result === DialogEvent.RESULT_YES) {
58
+ this.$emit('remove')
59
+ } else {
60
+ this.$emit('cancel')
61
+ }
62
+ }
63
+ }
64
+ </script>
65
+
66
+
67
+ <style lang="scss" scoped>
68
+ .removeKey {
69
+ user-select: none;
70
+ }
71
+ </style>
@@ -10,6 +10,7 @@ import DetailTitle from './detail/DetailTitle'
10
10
  import FlyingContext from './FlyingContext.vue'
11
11
  import EditFormButtons from './form/EditFormButtons'
12
12
  import RemoveButton from './form/RemoveButton'
13
+ import RemoveDialog from './form/RemoveDialog'
13
14
  import ListCard from './list/ListCard'
14
15
  import ListColumnHeader from './list/ListColumnHeader'
15
16
  import ListContent from './list/ListContent'
@@ -33,6 +34,7 @@ Vue.component('ListView', ListView)
33
34
  Vue.component('EditPage', EditPage)
34
35
  Vue.component('EditFormButtons', EditFormButtons)
35
36
  Vue.component('RemoveButton', RemoveButton)
37
+ Vue.component('RemoveDialog', RemoveDialog)
36
38
 
37
39
  Vue.component('ModelCount', ModelCount)
38
40
  Vue.component('ModelIcon', ModelIcon)