@itfin/components 2.0.38 → 2.0.40

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": "2.0.38",
3
+ "version": "2.0.40",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -171,7 +171,20 @@ class FilterFacetsList extends Vue {
171
171
  }
172
172
 
173
173
  groupSelected(value, items) {
174
- const newVal = value ? items.map(item => `${item.value}`) : [];
174
+ let newVal = this.value ? [...Array.isArray(this.value) ? this.value : [this.value]] : [];
175
+ if (value) {
176
+ items.forEach((item) => {
177
+ const itemValue = `${item.value}`;
178
+ if (!newVal.includes(itemValue)) {
179
+ newVal.push(itemValue);
180
+ }
181
+ });
182
+ } else {
183
+ items.forEach((item) => {
184
+ const itemValue = `${item.value}`;
185
+ newVal = newVal.filter(val => val !== itemValue);
186
+ });
187
+ }
175
188
  this.$emit('input', this.multiple ? newVal : (newVal.length > 0 ? newVal[0] : null));
176
189
  }
177
190
 
@@ -1,3 +1,6 @@
1
- <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10.0003 15.8337C13.222 15.8337 15.8337 13.222 15.8337 10.0003C15.8337 6.77866 13.222 4.16699 10.0003 4.16699C6.77866 4.16699 4.16699 6.77866 4.16699 10.0003C4.16699 13.222 6.77866 15.8337 10.0003 15.8337ZM7.91697 10.0003C7.91697 8.84973 8.84971 7.91699 10.0003 7.91699C11.1509 7.91699 12.0836 8.84973 12.0836 10.0003C12.0836 11.1509 11.1509 12.0837 10.0003 12.0837C8.84971 12.0837 7.91697 11.1509 7.91697 10.0003ZM10.0003 6.25032C7.92924 6.25032 6.25031 7.92925 6.25031 10.0003C6.25031 12.0714 7.92924 13.7503 10.0003 13.7503C12.0714 13.7503 13.7503 12.0714 13.7503 10.0003C13.7503 7.92925 12.0714 6.25032 10.0003 6.25032Z" fill="currentColor"/>
1
+ <svg width="24" height="24" viewBox="-2 -2 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_24391_35934)">
3
+ <path d="M8.4 13v-1H2.808v5H17.2v-5h-5.6v1H8.4ZM18 6.111h-4.8V4.556L11.6 3H8.4L6.8 4.556V6.11H2V11h6.4v-1h3.2v1H18V6.111Zm-6.4 0H8.4V4.556h3.2V6.11Z"
4
+ fill="currentColor"></path>
5
+ </g>
3
6
  </svg>
@@ -36,34 +36,34 @@
36
36
  :class="{'justify-content-end': column.align === 'end', 'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'editable': column.editable && editable}"
37
37
  class="table-view-item-value d-flex h-100">
38
38
  <div class="table-view-item-value-content" :class="{'px-2': !(column.editable && editable)}">
39
- <slot
40
- :name="`column.${column.property}`"
41
- :toggle="() => $emit('toggle', item)"
42
- :hasSubitems="!!(subrowsProperty && item[subrowsProperty] && item[subrowsProperty].length)"
43
- :isExpanded="!!(item[subrowsProperty] && item[subrowsProperty].length && !isExpanded(item))"
44
- :level="level" :editable="column.editable && editable" :item="item" :column="column" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)">
45
- <template v-if="column.editable && editable && (!editableProperty || item[editableProperty])">
46
- <slot :name="`edit.${column.type}`" :level="level" :toggle="() => $emit('toggle', item)" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)" :item="item" :column="column">
47
- <itf-text-field class="w-100 h-100" v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
48
- <itf-text-field class="w-100 h-100" v-if="column.type === 'number'" type="number" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
49
- <itf-hours-field
50
- class="w-100 h-100"
51
- placeholder="00h 00m"
52
- v-else-if="column.type === 'time'"
53
- :hours="getValue(item, column)"
54
- @update:hours="updateValue(item, $event, n, column)"
55
- />
56
- <itf-textarea class="w-100 h-100" :rows="1" autogrow v-else-if="column.type === 'textarea'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
57
- <itf-money-field class="w-100 h-100" currency-disabled :currency="currency" :currencies="currencies" v-else-if="column.type === 'money'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
58
- <itf-select class="w-100 h-100" v-else-if="column.type === 'select'" :reduce="(item) => item.value" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" :options="column.options"></itf-select>
59
- </slot>
60
- </template>
61
- <div v-else class="h-100 align-items-center d-flex w-100">
62
- <slot :name="`format.${column.type}`" :toggle="() => $emit('toggle', item)" :level="level" :value="getValue(item, column)" :update="(value) => updateValue(item, value, n, column)" :item="item" :column="column">
63
- {{getValue(item, column)}}
64
- </slot>
65
- </div>
66
- </slot>
39
+ <slot
40
+ :name="`column.${column.property}`"
41
+ :toggle="() => $emit('toggle', item)"
42
+ :hasSubitems="!!(subrowsProperty && item[subrowsProperty] && item[subrowsProperty].length)"
43
+ :isExpanded="!!(item[subrowsProperty] && item[subrowsProperty].length && !isExpanded(item))"
44
+ :level="level" :editable="column.editable && editable" :item="item" :column="column" :updateFields="(val) => updateValues(item, val, n, column)" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)">
45
+ <template v-if="column.editable && editable && (!editableProperty || item[editableProperty])">
46
+ <slot :name="`edit.${column.type}`" :level="level" :toggle="() => $emit('toggle', item)" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)" :item="item" :column="column">
47
+ <itf-text-field class="w-100 h-100" v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
48
+ <itf-text-field class="w-100 h-100" v-if="column.type === 'number'" type="number" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
49
+ <itf-hours-field
50
+ class="w-100 h-100"
51
+ placeholder="00h 00m"
52
+ v-else-if="column.type === 'time'"
53
+ :hours="getValue(item, column)"
54
+ @update:hours="updateValue(item, $event, n, column)"
55
+ />
56
+ <itf-textarea class="w-100 h-100" :rows="1" autogrow v-else-if="column.type === 'textarea'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
57
+ <itf-money-field class="w-100 h-100" currency-disabled :currency="currency" :currencies="currencies" v-else-if="column.type === 'money'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
58
+ <itf-select class="w-100 h-100" v-else-if="column.type === 'select'" :reduce="(item) => item.value" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" :options="column.options"></itf-select>
59
+ </slot>
60
+ </template>
61
+ <div v-else class="h-100 align-items-center d-flex w-100">
62
+ <slot :name="`format.${column.type}`" :toggle="() => $emit('toggle', item)" :level="level" :value="getValue(item, column)" :update="(value) => updateValue(item, value, n, column)" :item="item" :column="column">
63
+ {{getValue(item, column)}}
64
+ </slot>
65
+ </div>
66
+ </slot>
67
67
  </div>
68
68
  </div>
69
69
  </template>
@@ -188,6 +188,18 @@ class itfTableRows extends Vue {
188
188
  }
189
189
  }
190
190
 
191
+ updateValues(item, values, index, column) {
192
+ const newItem = { ...item };
193
+ Object.assign(newItem, values);
194
+ this.$emit('update', {
195
+ index,
196
+ item,
197
+ inputValue: values,
198
+ value: newItem,
199
+ column
200
+ });
201
+ }
202
+
191
203
  isActive(id) {
192
204
  if (!this.idProperty) {
193
205
  return false;