@afeefa/vue-app 0.0.167 → 0.0.169

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.167
1
+ 0.0.169
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.167",
3
+ "version": "0.0.169",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@ import { PositionConfig } from '../services/PositionService'
52
52
  import { randomCssClass } from '../utils/random'
53
53
 
54
54
  @Component({
55
- props: ['value', 'validator', 'type', {dense: true, outlined: true}]
55
+ props: ['value', 'validator', 'type', {dense: true, outlined: true, focus: false}]
56
56
  })
57
57
  export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositionServiceMixin, CancelOnEscMixin) {
58
58
  value_ = null
@@ -65,6 +65,8 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
65
65
  }
66
66
 
67
67
  mounted () {
68
+ this.setFocus()
69
+
68
70
  this.validate()
69
71
  }
70
72
 
@@ -74,6 +76,11 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
74
76
  this.validate()
75
77
  }
76
78
 
79
+ @Watch('focus')
80
+ focusChanged () {
81
+ this.setFocus()
82
+ }
83
+
77
84
  get clearable () {
78
85
  if (this.validator && this.validator.getParam('filled')) {
79
86
  return false
@@ -292,6 +299,17 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
292
299
  }
293
300
  return []
294
301
  }
302
+
303
+ setFocus (force = false) {
304
+ const focus = this.focus || force // set focus if this.focus or else if forced from outside
305
+ if (focus) {
306
+ // if run in a v-dialog, the dialog background would
307
+ // steal the focus without requestAnimationFrame
308
+ requestAnimationFrame(() => {
309
+ this.$el.querySelector('input').focus()
310
+ })
311
+ }
312
+ }
295
313
  }
296
314
  </script>
297
315
 
@@ -10,18 +10,25 @@
10
10
 
11
11
 
12
12
  <script>
13
- import { Component, Vue } from '@a-vue'
13
+ import { Component, Vue, Watch } from '@a-vue'
14
14
 
15
15
  @Component({
16
- props: ['validator', {dense: true, outlined: true}]
16
+ props: ['validator', {dense: true, outlined: true, focus: false}]
17
17
  })
18
18
  export default class ATextArea extends Vue {
19
19
  mounted () {
20
+ this.setFocus()
21
+
20
22
  if (this.validator) {
21
23
  this.$refs.input.validate(true)
22
24
  }
23
25
  }
24
26
 
27
+ @Watch('focus')
28
+ focusChanged () {
29
+ this.setFocus()
30
+ }
31
+
25
32
  get validationRules () {
26
33
  const label = this.$attrs.label
27
34
  return (this.validator && this.validator.getRules(label)) || []
@@ -33,6 +40,17 @@ export default class ATextArea extends Vue {
33
40
  }
34
41
  return this.validator.getParam('max') || false
35
42
  }
43
+
44
+ setFocus (force = false) {
45
+ const focus = this.focus || force // set focus if this.focus or else if forced from outside
46
+ if (focus) {
47
+ // if run in a v-dialog, the dialog background would
48
+ // steal the focus without requestAnimationFrame
49
+ requestAnimationFrame(() => {
50
+ this.$el.querySelector('textarea').focus()
51
+ })
52
+ }
53
+ }
36
54
  }
37
55
  </script>
38
56
 
@@ -3,7 +3,7 @@
3
3
  <div class="header">
4
4
  <v-avatar
5
5
  v-if="_icon"
6
- color="#EEEEEE"
6
+ color="#F4F4F4"
7
7
  size="2.5rem"
8
8
  >
9
9
  <v-icon
@@ -14,14 +14,19 @@
14
14
  </v-icon>
15
15
  </v-avatar>
16
16
 
17
- <label :class="['label', {'label--withIcon': !!_icon}]">{{ label }}</label>
17
+ <div
18
+ v-else
19
+ class="iconPlaceholder"
20
+ />
21
+
22
+ <label class="label">{{ label }}</label>
18
23
 
19
24
  <div class="pl-2">
20
25
  <slot name="actionButton" />
21
26
  </div>
22
27
  </div>
23
28
 
24
- <div :class="['content', {'content--withIcon': !!_icon}]">
29
+ <div class="content">
25
30
  <a-row
26
31
  vertical
27
32
  gap="6"
@@ -57,32 +62,34 @@ export default class DetailProperty extends Vue {
57
62
  <style lang="scss" scoped>
58
63
  .detailProperty {
59
64
  width: 100%;
65
+
60
66
  .header {
61
67
  display: flex;
62
68
  flex-wrap: nowrap;
63
69
  align-items: center;
64
70
  height: 40px;
71
+ margin-bottom: .5rem;
65
72
 
66
73
  .v-avatar {
67
74
  flex: 0 0 40px;
68
75
  margin-right: 15px;
69
76
  }
70
77
 
78
+ .iconPlaceholder {
79
+ width: 55px;
80
+ }
81
+
71
82
  .label {
72
83
  display: block;
73
84
  text-transform: uppercase;
74
- letter-spacing: 2px;
75
- padding-left: 55px;
76
- &--withIcon {
77
- padding-left: 0;
78
- }
85
+ letter-spacing: 3px;
86
+ border-bottom: 5px solid #CCCCCC;
87
+ color: #666666;
79
88
  }
80
89
  }
90
+
81
91
  .content {
82
92
  padding-left: 55px;
83
- &--withIcon {
84
- padding-left: 55px;
85
- }
86
93
  }
87
94
  }
88
95
  </style>