@itfin/components 2.0.75 → 2.0.76

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.75",
3
+ "version": "2.0.76",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -19,7 +19,7 @@
19
19
  </div>
20
20
  </itf-notice-popout>
21
21
  <div class="scrollable scrollable-x">
22
- <itf-checkbox-group v-model="selectedIds">
22
+ <itf-checkbox-group v-model="selectedIds" class="d-flex flex-column" style="min-width: 100%; width: max-content">
23
23
  <template v-for="(group, index) in groups">
24
24
  <div class="table-view-body">
25
25
  <itf-table-group
@@ -60,7 +60,9 @@
60
60
  :sorting.sync="_sorting"
61
61
  :active="active"
62
62
  :new-label="newLabel"
63
+ :collapsed-group-ids="collapsedGroupIds"
63
64
  @update:expanded-ids="$emit('update:expanded-ids', $event)"
65
+ @update:collapsed-group-ids="$emit('update:collapsed-group-ids', $event)"
64
66
  @new="$emit('new', $event)"
65
67
  @filter="$emit('filter', $event)"
66
68
  @add-column="$emit('add-column', $event)"
@@ -121,6 +123,7 @@ class itfTable2 extends Vue {
121
123
  @ModelSync('value', 'input', { type: Array, default: () => ([]) }) selectedIds;
122
124
  @PropSync('sorting') _sorting;
123
125
  @Prop({ type: Array, default: () => [] }) expandedIds;
126
+ @Prop({ type: Array }) collapsedGroupIds;
124
127
  @Prop() currency;
125
128
  @Prop() currencies;
126
129
  @Prop(Boolean) stickyHeader;
@@ -15,14 +15,14 @@
15
15
  <div class="table-row-template d-flex align-items-stretch"
16
16
  style="min-height: var(--group-title-height)">
17
17
  <div class="shadow-area"></div>
18
- <div class="header-wrapper" :class="{'header-additional-column': showAddColumn}" @click.prevent="toggleGroup">
18
+ <div class="header-wrapper" :class="{'header-additional-column': showAddColumn}" @click.prevent="() => toggleGroup(!isShowTable)">
19
19
  <a class="header-content position-sticky d-flex align-items-center">
20
20
  <itf-button squircle icon small secondary class="collapse-arrow">
21
21
  <itf-icon :name="isShowTable ? 'chevron_down' : 'chevron_right'"/>
22
22
  </itf-button>
23
23
  <span class="d-flex align-items-center line-overflow group-header-value text-primary"
24
24
  data-test="group-value-group-label-value">
25
- <slot name="group-title" :rows="rows" :title="title">{{ title }}</slot>
25
+ <slot name="group-title" :rows="rows" :title="title" :collapsed="!isShowTable">{{ title }}</slot>
26
26
  </span>
27
27
  </a>
28
28
  </div>
@@ -392,10 +392,14 @@ class itfTableGroup extends Vue {
392
392
  @Prop({type: String, default: function() { return this.$t('components.table.new'); } }) newLabel;
393
393
  @Prop({type: Object, default: () => ({})}) schema;
394
394
  @Prop() expandedIds;
395
+ @Prop() collapsedGroupIds;
395
396
 
396
- isShowTable = true;
397
397
  persistSummary = false;
398
398
 
399
+ get isShowTable() {
400
+ return typeof this.collapsedGroupIds !== 'undefined' ? !this.collapsedGroupIds.includes(this.title) : true;
401
+ }
402
+
399
403
  get visibleColumns() {
400
404
  let list = this.columns;
401
405
  list = sortBy(list, (column) => column.index);
@@ -416,8 +420,17 @@ class itfTableGroup extends Vue {
416
420
  this.$emit('update:columns', columns);
417
421
  }
418
422
 
419
- toggleGroup() {
420
- this.isShowTable = !this.isShowTable;
423
+ toggleGroup(val) {
424
+ let expanded = this.collapsedGroupIds ? [...this.collapsedGroupIds] : [];
425
+ if (!val) {
426
+ if (!expanded.includes(this.title)) {
427
+ expanded.push(this.title);
428
+ }
429
+ } else {
430
+ expanded = expanded.filter(id => id !== this.title);
431
+ }
432
+ console.info(expanded, this.title, val);
433
+ this.$emit('update:collapsed-group-ids', expanded);
421
434
  }
422
435
 
423
436
  get stickyId() {