@afeefa/vue-app 0.0.79 → 0.0.81

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.79
1
+ 0.0.81
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.79",
3
+ "version": "0.0.81",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -7,15 +7,16 @@
7
7
  min-width="auto"
8
8
  >
9
9
  <template #activator="{ on, attrs }">
10
- <v-combobox
10
+ <v-text-field
11
11
  ref="input"
12
12
  :value="formattedDate"
13
13
  :label="label"
14
14
  :style="cwm_widthStyle"
15
- readonly
16
15
  v-bind="{...$attrs, ...attrs}"
17
16
  :rules="validationRules"
17
+ :readonly="type === 'month'"
18
18
  v-on="on"
19
+ @input="dateInputChanged"
19
20
  @click:clear="clearDate"
20
21
  @click.native="on.click"
21
22
  />
@@ -56,6 +57,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
56
57
  if (this.validator) {
57
58
  this.$refs.input.validate(true)
58
59
  }
60
+ this.$refs.input.validate(true)
59
61
  }
60
62
 
61
63
  @Watch('value')
@@ -78,9 +80,22 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
78
80
  this.$emit('input', this.value_)
79
81
  }
80
82
 
83
+ isDate (value) {
84
+ return value && value.match(/^(3[01]|[12][0-9]|0?[1-9]).(1[012]|0?[1-9]).((?:19|20)\d{2})$/)
85
+ }
86
+
87
+ dateInputChanged (value) {
88
+ if (!value) {
89
+ this.dateChanged(null)
90
+ } else if (this.isDate(value)) {
91
+ const [day, month, year] = value.split('.')
92
+ this.dateChanged(new Date(year + '-' + month + '-' + day))
93
+ }
94
+ }
95
+
81
96
  dateChanged (date) {
82
97
  this.menu = false
83
- this.value_ = new Date(date)
98
+ this.value_ = date ? new Date(date) : null
84
99
  this.$emit('input', this.value_)
85
100
  }
86
101
 
@@ -97,7 +112,23 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
97
112
  }
98
113
 
99
114
  get validationRules () {
100
- return (this.validator && this.validator.getRules(this.label)) || []
115
+ const dateFormat = v => {
116
+ if (v && !this.isDate(v)) {
117
+ return 'Das Datum sollte das Format TT.MM.JJJJ haben.'
118
+ }
119
+ return true
120
+ }
121
+
122
+ let rules = []
123
+ if (this.validator) {
124
+ rules = this.validator.getRules(this.label)
125
+ }
126
+
127
+ if (this.type !== 'month') {
128
+ rules.push(dateFormat)
129
+ }
130
+
131
+ return rules
101
132
  }
102
133
  }
103
134
  </script>
@@ -23,10 +23,24 @@
23
23
  {{ title }}
24
24
  </v-card-title>
25
25
 
26
- <v-card-text v-if="message">
26
+ <v-card-text
27
+ v-if="message"
28
+ >
27
29
  <span v-html="message" />
28
30
  </v-card-text>
29
31
 
32
+ <v-card-text
33
+ v-if="info"
34
+ class="dialogInfo"
35
+ >
36
+ <v-alert
37
+ dense
38
+ type="info"
39
+ >
40
+ {{ info }}
41
+ </v-alert>
42
+ </v-card-text>
43
+
30
44
  <v-card-text v-if="$slots.default">
31
45
  <slot :props="props" />
32
46
  </v-card-text>
@@ -70,6 +84,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
70
84
 
71
85
  title = null
72
86
  message = null
87
+ info = null
73
88
  yesButton = null
74
89
  yesColor = null
75
90
  cancelButton = null
@@ -103,6 +118,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
103
118
 
104
119
  this.title = this.payload.title
105
120
  this.message = this.payload.message
121
+ this.info = this.payload.info
106
122
  this.yesButton = this.payload.yesButton
107
123
  this.yesColor = this.payload.yesColor
108
124
  this.cancelButton = this.payload.cancelButton
@@ -178,6 +194,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
178
194
 
179
195
  this.title = dialogEvent.payload.title
180
196
  this.message = dialogEvent.payload.message
197
+ this.info = dialogEvent.payload.info
181
198
  this.yesButton = dialogEvent.payload.yesButton
182
199
  this.yesColor = dialogEvent.payload.yesColor
183
200
  this.cancelButton = dialogEvent.payload.cancelButton
@@ -234,4 +251,9 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
234
251
  }
235
252
  }
236
253
  }
254
+
255
+ .dialogInfo {
256
+ padding-top: 0 !important;
257
+ padding-bottom: 0 !important;
258
+ }
237
259
  </style>
@@ -41,7 +41,7 @@ import { DialogEvent } from '@a-vue/events'
41
41
  import { randomCssClass } from '@a-vue/utils/random'
42
42
 
43
43
  @Component({
44
- props: ['title', 'itemTitle', 'protect']
44
+ props: ['title', 'message', 'info', 'itemTitle', 'protect']
45
45
  })
46
46
  export default class EditPage extends Vue {
47
47
  dialogId = randomCssClass(10)
@@ -56,7 +56,8 @@ export default class EditPage extends Vue {
56
56
  const result = await this.$events.dispatch(new DialogEvent(DialogEvent.SHOW, {
57
57
  id: this.dialogId,
58
58
  title: this.itemTitle + ' löschen?',
59
- message: 'Soll ' + this.itemTitle + ' gelöscht werden?',
59
+ message: ['Soll ' + this.itemTitle + ' gelöscht werden?', this.message].filter(m => m).join('<br><br>'),
60
+ info: this.info,
60
61
  yesButton: 'Löschen',
61
62
  yesColor: 'red white--text'
62
63
  }))