@itfin/components 1.0.78 → 1.0.82

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.78",
3
+ "version": "1.0.82",
4
4
  "main": "dist/itfin-components.umd.js",
5
5
  "unpkg": "dist/itfin-components.common.js",
6
6
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
@@ -7,7 +7,9 @@
7
7
  >
8
8
  <div class="modal-content itf-append-context" ref="content">
9
9
  <div class="modal-header">
10
- <h5 class="modal-title" :id="modalId">{{title}}</h5>
10
+ <slot name="title">
11
+ <h5 class="modal-title" :id="modalId">{{title}}</h5>
12
+ </slot>
11
13
  <itf-button icon data-bs-dismiss="modal" aria-label="Close" class="btn-close"></itf-button>
12
14
  </div>
13
15
  <div class="modal-body" v-if="value">
@@ -96,7 +98,7 @@ class itfModal extends Vue {
96
98
  setTimeout(() => {
97
99
  this.modalEl.show();
98
100
  modalStack.push(this);
99
- }, 500);
101
+ }, modalStack.length ? 500 : 0);
100
102
  } else {
101
103
  this.modalEl.hide();
102
104
  modalStack.pop();
@@ -104,7 +106,7 @@ class itfModal extends Vue {
104
106
  setTimeout(() => {
105
107
  modalStack[modalStack.length - 1].show();
106
108
  modalStack[modalStack.length - 1].bindEvents();
107
- }, 500);
109
+ }, modalStack.length ? 500 : 0);
108
110
  }
109
111
  }
110
112
  }
@@ -131,12 +133,16 @@ class itfModal extends Vue {
131
133
 
132
134
  bindEvents() {
133
135
  this.preventEvents = false;
134
- this.$refs.modal.addEventListener('hidden.bs.modal', this.onClose);
136
+ if (this.$refs.modal) {
137
+ this.$refs.modal.addEventListener('hidden.bs.modal', this.onClose);
138
+ }
135
139
  }
136
140
 
137
141
  unbindEvents() {
138
142
  this.preventEvents = true;
139
- this.$refs.modal.removeEventListener('hidden.bs.modal', this.onClose);
143
+ if (this.$refs.modal) {
144
+ this.$refs.modal.removeEventListener('hidden.bs.modal', this.onClose);
145
+ }
140
146
  }
141
147
 
142
148
  show() {
@@ -165,6 +165,8 @@ class itfSegmentedControl extends Vue {
165
165
  @Prop({ type: Boolean, default: false }) returnObject;
166
166
  @Prop({ type: Boolean, default: false }) disabled;
167
167
 
168
+ timers = [];
169
+
168
170
  get name () {
169
171
  return `sc${this._uid}`;
170
172
  }
@@ -210,20 +212,25 @@ class itfSegmentedControl extends Vue {
210
212
  updatePillPosition(this);
211
213
 
212
214
  function updatePillPosition (component) {
215
+ component.timers.forEach((timer) => {
216
+ clearTimeout(timer);
217
+ });
218
+ component.timers = [];
213
219
  component.$refs.input.forEach((elem, index) => {
214
220
  if (elem.checked) {
215
221
  component.$nextTick(() => moveBackgroundPillToElement(component, elem, index));
216
- setTimeout(() => moveBackgroundPillToElement(component, elem, index), 500);
217
- setTimeout(() => moveBackgroundPillToElement(component, elem, index), 750);
218
- setTimeout(() => moveBackgroundPillToElement(component, elem, index), 1500);
219
- setTimeout(() => moveBackgroundPillToElement(component, elem, index), 3000);
222
+ component.timers = [
223
+ setTimeout(() => moveBackgroundPillToElement(component, elem, index), 500),
224
+ setTimeout(() => moveBackgroundPillToElement(component, elem, index), 750),
225
+ setTimeout(() => moveBackgroundPillToElement(component, elem, index), 1500),
226
+ setTimeout(() => moveBackgroundPillToElement(component, elem, index), 3000)
227
+ ];
220
228
  }
221
229
  })
222
230
  }
223
231
 
224
232
  function moveBackgroundPillToElement (component, elem, index) {
225
233
  const slider = component.$refs.slider;
226
- console.info('init 2', slider);
227
234
  if (slider) {
228
235
  slider.style.transform = 'translateX(' + (elem.offsetWidth * index) + 'px)';
229
236
  }
@@ -14,7 +14,7 @@
14
14
 
15
15
  <slot
16
16
  v-if="!isValueEmpty && !multiple && customRender"
17
- v-bind="getOption(localValue)"
17
+ :option="getOption(localValue)"
18
18
  />
19
19
  <template v-else>
20
20
  {{ getOptionLabel(localValue) }}
@@ -28,11 +28,9 @@
28
28
  >
29
29
  <slot
30
30
  v-if="customRender"
31
- v-bind="{
32
- ...getOption(optionValue),
33
- optionValue,
34
- remove: removeOptionValue
35
- }"
31
+ :option="getOption(optionValue)"
32
+ :value="optionValue"
33
+ :remove="removeOptionValue"
36
34
  />
37
35
  <div v-else class="valueMultiItem text-textDarkest" :style="getOptionColor(optionValue) ? `background-color: #${getOptionColor(optionValue)}; color: #fff` : ''">
38
36
  <div class="valueMultiItemLabel">
@@ -68,11 +66,11 @@
68
66
  </div>
69
67
  </div>
70
68
 
71
- <j-icon
69
+ <icon
72
70
  v-if="(!multiple || isValueEmpty) && variant !== 'empty'"
73
71
  class="ml-auto mr-1"
74
- name="chevron-down"
75
- ></j-icon>
72
+ name="chevron_down"
73
+ ></icon>
76
74
  </div>
77
75
 
78
76
  <Dropdown
@@ -92,9 +90,9 @@
92
90
  @change="handleChange"
93
91
  @searchValueChange="handleSearchValueChange"
94
92
  >
95
- <template v-slot:option="props">
96
- <slot v-if="customRenderOption" name="option" v-bind="props" />
97
- <slot v-else v-bind="props" />
93
+ <template #option="{ option }">
94
+ <slot v-if="customRenderOption" name="option" :option="option" />
95
+ <slot v-else :option="option" />
98
96
  </template>
99
97
  </Dropdown>
100
98
  </div>
@@ -103,6 +101,7 @@
103
101
  <script>
104
102
  import { Component, Model, Prop, Ref } from 'vue-property-decorator';
105
103
  import Vue from 'vue';
104
+ import Icon from '../icon/Icon.vue';
106
105
  import Dropdown from './Dropdown.vue';
107
106
  import { useOutsideClick } from './useOutsideClick';
108
107
 
@@ -110,7 +109,7 @@ const { bind, unbind } = useOutsideClick();
110
109
 
111
110
  export default @Component({
112
111
  name: 'itfAirSelect',
113
- components: { Dropdown },
112
+ components: { Dropdown, Icon },
114
113
  })
115
114
  class itfAirSelect extends Vue {
116
115
  @Model('input', { type: [Array, String, Number], default: undefined }) value;
@@ -139,6 +138,9 @@ class itfAirSelect extends Vue {
139
138
 
140
139
  @Prop({ type: Boolean, default: false }) withClearValue;
141
140
 
141
+ @Prop({ type: Boolean, default: false }) customRender;
142
+ @Prop({ type: Boolean, default: false }) customRenderOption;
143
+
142
144
  @Ref('selectRef') selectRef;
143
145
 
144
146
  @Ref('dropdownRef') dropdownRef;
@@ -147,14 +149,6 @@ class itfAirSelect extends Vue {
147
149
 
148
150
  searchValue = '';
149
151
 
150
- get customRender() {
151
- return !!this.$slots.default;
152
- }
153
-
154
- get customRenderOption() {
155
- return !!this.$slots.option;
156
- }
157
-
158
152
  data() {
159
153
  return {
160
154
  stateValue: this.defaultValue || (this.multiple ? [] : null),
@@ -170,7 +164,6 @@ class itfAirSelect extends Vue {
170
164
  }
171
165
 
172
166
  getOptionColor(optionValue) {
173
- console.info((this.getOption(optionValue) || { [this.itemColor]: '' })[this.itemColor])
174
167
  return (this.getOption(optionValue) || { [this.itemColor]: '' })[this.itemColor];
175
168
  }
176
169
 
@@ -267,6 +260,7 @@ class itfAirSelect extends Vue {
267
260
  align-items: center;
268
261
  width: 100%;
269
262
  min-height: 32px;
263
+ justify-content: space-between;
270
264
  }
271
265
  .placeholder {
272
266
  color: #8993a4;
@@ -20,7 +20,7 @@
20
20
  @mouseenter="handleOptionMouseEnter"
21
21
  @click="selectOptionValue(option[itemKey])"
22
22
  >
23
- <slot name="option" v-bind="option">{{ option[itemText] }}</slot>
23
+ <slot name="option" :option="option">{{ option[itemText] }}</slot>
24
24
  </div>
25
25
 
26
26
  <div