@itfin/components 1.3.93 → 1.3.95

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.3.93",
3
+ "version": "1.3.95",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <div class="notice p-2" ref="notice">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+ <style scoped lang="scss">
7
+ .notice {
8
+ position: absolute;
9
+ bottom: 10px;
10
+ left: 50%;
11
+ max-width: 740px;
12
+ z-index: 10;
13
+ opacity: 0;
14
+ transition: all 0.3s ease;
15
+ transform: translateX(-50%) translateY(100%) translateZ(0px);
16
+ background: var(--bs-body-bg);
17
+ box-shadow: 0 2px 10px 0 hsl(0 calc(1 * 0%) 0% /.1);
18
+ overflow: hidden;
19
+ border-radius: 5px;
20
+ pointer-events: none;
21
+
22
+ &.show {
23
+ opacity: 1;
24
+ pointer-events: all;
25
+ transform: translate3d(-50%, 0%, 0px);
26
+ }
27
+ }
28
+ </style>
29
+ <script>
30
+ import { Vue, Prop, Watch, Component } from 'vue-property-decorator';
31
+
32
+ export default @Component({
33
+ components: {
34
+ }
35
+ })
36
+ class NoticePopout extends Vue {
37
+ @Prop(Boolean) visible;
38
+
39
+ @Watch('visible')
40
+ toggle(show = true) {
41
+ if (show) {
42
+ this.$refs.notice.classList.add('show');
43
+ } else {
44
+ this.$refs.notice.classList.remove('show');
45
+ }
46
+ }
47
+ }
48
+ </script>
@@ -1,11 +1,20 @@
1
1
  <template>
2
2
 
3
- <div class="itf-table2 scrollable scrollable-x" :class="{
3
+ <div class="itf-table2" :class="{
4
4
  'table-striped': striped,
5
5
  'table-absolute': absolute,
6
6
  'table-clickable': clickable,
7
7
  'permanent-checkboxes': selectedIds.length
8
8
  }" :style="{ '--indicator-area-width': `${indicatorType === 'none' ? 1 : indicatorWidth}px` }">
9
+ <itf-notice-popout :visible="showGroupOperations" class="rounded-pill bg-dark text-light">
10
+ <div class="d-flex gap-3 px-3 align-items-center">
11
+ <div><strong>{{selectedIds.length}}</strong> selected</div>
12
+ <div>
13
+ <slot name="group-operations"></slot>
14
+ </div>
15
+ </div>
16
+ </itf-notice-popout>
17
+ <div class="scrollable scrollable-x">
9
18
  <itf-checkbox-group v-model="selectedIds">
10
19
  <template v-for="(group, index) in groups">
11
20
  <div class="table-view-body">
@@ -58,6 +67,7 @@
58
67
  </div>
59
68
  </template>
60
69
  </itf-checkbox-group>
70
+ </div>
61
71
  </div>
62
72
 
63
73
  </template>
@@ -68,6 +78,7 @@ import itfButton from '../button/Button.vue';
68
78
  import itfIcon from '../icon/Icon.vue';
69
79
  import itfTableGroup from './TableGroup.vue';
70
80
  import itfTableHeader from './TableHeader.vue';
81
+ import itfNoticePopout from '../popover/NoticePopout.vue';
71
82
  import './table2.scss';
72
83
 
73
84
  export default @Component({
@@ -80,7 +91,8 @@ export default @Component({
80
91
  itfTableHeader,
81
92
  itfButton,
82
93
  itfIcon,
83
- itfTableGroup
94
+ itfTableGroup,
95
+ itfNoticePopout
84
96
  }
85
97
  })
86
98
  class itfTable2 extends Vue {
@@ -123,6 +135,10 @@ class itfTable2 extends Vue {
123
135
  columns: []
124
136
  };
125
137
 
138
+ get showGroupOperations() {
139
+ return !!this.$slots['group-operations'] && this.selectedIds.length > 0;
140
+ }
141
+
126
142
  getTableState() {
127
143
  const list = this.schema?.properties || [];
128
144
  let state = this.stateName ? JSON.parse(localStorage.getItem(this.stateKey) || 'null') : null;
@@ -163,6 +179,7 @@ class itfTable2 extends Vue {
163
179
  }
164
180
 
165
181
  mounted() {
182
+ console.info(this.$scopedSlots)
166
183
  this.onSchemaUpdate();
167
184
  }
168
185
 
@@ -114,6 +114,7 @@
114
114
  }
115
115
 
116
116
  .on-hover {
117
+ opacity: 1;
117
118
  display: block;
118
119
  }
119
120
  }
@@ -38,6 +38,7 @@
38
38
  :column-sorting="columnSorting"
39
39
  :show-add-column="showAddColumn"
40
40
  :show-actions="showActions"
41
+ :id-property="idProperty"
41
42
  :rows="rows"
42
43
  :schema="schema"
43
44
  :editable="editable"
@@ -174,6 +174,7 @@ class itfTableHeader extends Vue {
174
174
  @Prop(Boolean) noColumnMenu;
175
175
  @Prop(Boolean) noSelectAll;
176
176
  @Prop(Boolean) editable;
177
+ @Prop() idProperty;
177
178
  @Prop() indicatorType;
178
179
 
179
180
  @Watch('selectedIds')
@@ -211,7 +212,7 @@ class itfTableHeader extends Vue {
211
212
 
212
213
  set selectAll(val) {
213
214
  if (val) {
214
- this.$emit('update:selectedIds', this.rows.map(r => r.Id));
215
+ this.$emit('update:selectedIds', this.rows.map(r => r[this.idProperty]));
215
216
  } else {
216
217
  this.$emit('update:selectedIds', []);
217
218
  }
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  </div>
23
23
  <div v-if="indicatorType !== 'none'" class="indicator sticky">
24
- <div class="fill table-view-row-count" :class="{'on-rest': !noSelectAll}">
24
+ <div class="fill table-view-row-count" :class="{'on-rest': indicatorType !== 'checkbox'}">
25
25
  <span v-if="indicatorType === 'order'">{{ (n + 1) }}</span>
26
26
  <span v-else-if="indicatorType === 'property'">{{ item[idProperty] }}</span>
27
27
  <a href="" @click.prevent.stop="$emit('toggle', item)" v-else-if="indicatorType === 'toggle'">
@@ -41,7 +41,7 @@
41
41
  </template>
42
42
  </a>
43
43
  </div>
44
- <div v-if="!noSelectAll" class="fill on-hover">
44
+ <div class="fill" :class="{'on-hover': indicatorType !== 'checkbox'}">
45
45
  <itf-checkbox :value="item[idProperty]" />
46
46
  </div>
47
47
  </div>
@@ -42,11 +42,12 @@ body[data-theme="dark"] {
42
42
  .itf-table2 {
43
43
  font-size: var(--itf-table-font-size);
44
44
 
45
- &.scrollable {
45
+ .scrollable {
46
46
  -webkit-overflow-scrolling: touch;
47
47
  overflow: hidden scroll;
48
+ height: 100%;
48
49
  }
49
- &.scrollable-x {
50
+ .scrollable-x {
50
51
  overflow-x: scroll;
51
52
  padding-right: 4px;
52
53
  }
@@ -365,4 +366,19 @@ body[data-theme="dark"] {
365
366
  bottom: 0;
366
367
  }
367
368
  }
369
+
370
+ .table-group-operations {
371
+ background: red;
372
+ position: absolute;
373
+ bottom: 1rem;
374
+ left: 1rem;
375
+ right: 1rem;
376
+ height: 2rem;
377
+ transform: rotateX(90deg);
378
+ transition: transform 0.3s;
379
+
380
+ &.visible {
381
+ transform: rotateX(0deg);
382
+ }
383
+ }
368
384
  }