@itfin/components 1.0.40 → 1.0.44

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": "@itfin/components",
3
- "version": "1.0.40",
3
+ "version": "1.0.44",
4
4
 
5
5
  "main": "dist/itfin-components.umd.js",
6
6
  "unpkg": "dist/itfin-components.common.js",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
 
3
3
  <div class="itf-radio form-check" :class="{ 'itf-radio__large': large, 'itf-radio__medium': medium }">
4
- <input class="form-check-input" :id="id" type="radio" :name="name" v-model="isChecked" :disabled="disabled" />
4
+ <input class="form-check-input" :id="id" type="radio" :name="radioName" v-model="isChecked" :value="true" :disabled="disabled" />
5
5
  <label :for="id" slot="label" class="form-check-label">
6
6
  {{label}}
7
7
  <slot name="icon"></slot>
@@ -49,17 +49,17 @@ import { Vue, Component, Prop, Model, Inject } from 'vue-property-decorator';
49
49
  let globalRadioId = 0;
50
50
 
51
51
  export default @Component({
52
- name: 'itfCheckbox',
52
+ name: 'itfRadio',
53
53
  components: {
54
54
  }
55
55
  })
56
- class itfCheckbox extends Vue {
57
- @Inject({ default: null }) checkboxGroup;
56
+ class itfRadio extends Vue {
57
+ @Inject({ default: null }) radioGroup;
58
58
 
59
59
  @Model('input') checked;
60
60
  @Prop(String) label;
61
61
  @Prop() value;
62
- @Prop({ type: String, required: true }) name;
62
+ @Prop({ type: String }) name;
63
63
 
64
64
  @Prop(Boolean) disabled;
65
65
  @Prop(Boolean) medium;
@@ -72,11 +72,27 @@ class itfCheckbox extends Vue {
72
72
  this.id = `radio${globalRadioId}`;
73
73
  }
74
74
 
75
+ get radioName() {
76
+ if (this.radioGroup) {
77
+ return this.radioGroup.getGroupName();
78
+ }
79
+ if (!this.name) {
80
+ throw new Error('Name for radio should be not empty');
81
+ }
82
+ return this.name;
83
+ }
84
+
75
85
  set isChecked(val) {
86
+ if (this.radioGroup) {
87
+ this.radioGroup.onToggleOption(this.value, val);
88
+ }
76
89
  this.$emit('input', this.value);
77
90
  }
78
91
 
79
92
  get isChecked() {
93
+ if (this.radioGroup) {
94
+ return this.radioGroup.isChecked(this.value);
95
+ }
80
96
  if (this.itemKey) {
81
97
  if (!this.checked || !this.value) {
82
98
  return false;
@@ -0,0 +1,51 @@
1
+ <template>
2
+
3
+ <fieldset>
4
+ <slot />
5
+ </fieldset>
6
+
7
+ </template>
8
+ <style>
9
+
10
+ </style>
11
+ <script>
12
+ import { Vue, Component, Prop, Model, Provide } from 'vue-property-decorator';
13
+
14
+ let globalRadioGroupId = 0;
15
+
16
+ export default @Component({
17
+ name: 'itfRadioGroup'
18
+ })
19
+ class itfRadioGroup extends Vue {
20
+ @Provide() radioGroup = this;
21
+
22
+ @Model('input', { default: null }) value;
23
+
24
+ @Prop(Boolean) disabled;
25
+
26
+ @Prop(String) itemKey;
27
+
28
+ @Prop(Number) max;
29
+
30
+ created() {
31
+ globalRadioGroupId += 1;
32
+ this.id = `radio-group-${globalRadioGroupId}`;
33
+ }
34
+
35
+ getGroupName() {
36
+ return this.id;
37
+ }
38
+
39
+ onToggleOption(value, isChecked) {
40
+ this.$emit('input', value);
41
+ }
42
+
43
+ isChecked(value) {
44
+ return this.value === value;
45
+ }
46
+
47
+ isDisabled() {
48
+ return this.disabled;
49
+ }
50
+ }
51
+ </script>
@@ -124,7 +124,7 @@ class itfModal extends Vue {
124
124
  }
125
125
  if (this.appendToBody && this.$el instanceof Node && this.$el.parentNode) {
126
126
  this.$el.parentNode.removeChild(this.$el);
127
- const elContext = (this.globalApp && this.globalApp.$el) || document.body;
127
+ const elContext = document.getElementById('app') || document.body; // @todo getElementById remove when cleanup vuetify
128
128
  elContext.appendChild(this.$el);
129
129
  }
130
130
  const { default: Modal } = await import('bootstrap/js/src/modal.js');
@@ -132,7 +132,8 @@ class itfPopover extends Vue {
132
132
 
133
133
  hide() {
134
134
  if (this.modalEl) {
135
- this.modalEl.hide();
135
+ // треба затримка щоб попав не показався знову через отримання фокусу
136
+ setTimeout(() => this.modalEl.hide(), 10);
136
137
  }
137
138
  }
138
139
  }
@@ -93,7 +93,7 @@
93
93
  ref="dropdownMenu"
94
94
  :key="`vs${uid}__listbox`"
95
95
  v-append-to-body
96
- class="dropdown-menu vs__dropdown-menu"
96
+ class="dropdown-menu vs__dropdown-menu itf-select__dropdown-menu"
97
97
  role="listbox"
98
98
  tabindex="-1"
99
99
  @mousedown.prevent="onMousedown"
@@ -193,7 +193,7 @@
193
193
  background: $dark-input-focus-border-color;
194
194
  }
195
195
  }
196
- .dropdown-menu {
196
+ &__dropdown-menu {
197
197
  background-color: $body-bg;
198
198
  border: 2px solid $input-focus-border;
199
199
  padding-left: 0.125rem;
@@ -668,7 +668,7 @@ export default {
668
668
  */
669
669
  appendToBody: {
670
670
  type: Boolean,
671
- default: false,
671
+ default: true,
672
672
  },
673
673
  /**
674
674
  * When `appendToBody` is true, this function is responsible for
@@ -2,7 +2,14 @@ import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
2
2
  import { deepEqual } from '../helpers/deepEqual';
3
3
 
4
4
  export default
5
- @Component({ name: 'ValidatableMixin' })
5
+ @Component({
6
+ name: 'ValidatableMixin',
7
+ methods: {
8
+ validate(force = false, value) {
9
+ return this.doValidation(force, value);
10
+ }
11
+ }
12
+ })
6
13
  class ValidatableMixin extends Vue {
7
14
  @Prop(Boolean) manualValidation;
8
15
  @Prop(Boolean) disabled;