@itfin/components 1.4.26 → 1.4.28

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.
@@ -0,0 +1,43 @@
1
+ const PanelsSettings = {
2
+ pathType: 'path', // 'hash' | 'path'
3
+ rootPanelList: null, // This will be set to the root panel list when the app is initialized
4
+ };
5
+
6
+ export function getPanelsSettings() {
7
+ return PanelsSettings;
8
+ }
9
+
10
+ export function getRootPanelList() {
11
+ return PanelsSettings.rootPanelList;
12
+ }
13
+
14
+ export function isPathType() {
15
+ return PanelsSettings.pathType === 'path';
16
+ }
17
+
18
+ export function setPanelsPathType(settings: any) {
19
+ PanelsSettings.pathType = settings.pathType ?? 'path';
20
+ }
21
+
22
+ export function setRootPanelList(rootPanelList: any) {
23
+ PanelsSettings.rootPanelList = rootPanelList;
24
+ }
25
+
26
+ export function emitGlobalEvent(eventName: string, data: any) {
27
+ const event = new CustomEvent(`panel:${eventName}`, { detail: data });
28
+ window.dispatchEvent(event);
29
+ }
30
+
31
+ export function onGlobalEvent(eventName: string|string[], callback: (event: CustomEvent) => void) {
32
+ const eventNames = Array.isArray(eventName) ? eventName : [eventName];
33
+ for (const name of eventNames) {
34
+ window.addEventListener(`panel:${name}`, callback);
35
+ }
36
+ }
37
+
38
+ export function offGlobalEvent(eventName: string|string[], callback: (event: CustomEvent) => void) {
39
+ const eventNames = Array.isArray(eventName) ? eventName : [eventName];
40
+ for (const name of eventNames) {
41
+ window.removeEventListener(`panel:${name}`, callback);
42
+ }
43
+ }
@@ -7,9 +7,11 @@
7
7
  'permanent-checkboxes': selectedIds.length
8
8
  }" :style="{ '--indicator-area-width': `${indicatorType === 'none' ? 1 : indicatorWidth}px`, '--shadow-area-width': `${shadowWidth}px` }">
9
9
  <itf-notice-popout :visible="showGroupOperations" class="rounded-3 bg-black text-white">
10
- <div class="d-flex gap-2 ps-3 align-items-center small itf-table2_mass-operations">
11
- <div>{{$tc('components.table.selectedItems', selectedIds.length, { n: selectedIds.length })}}</div>
12
- <div class="opacity-50">•</div>
10
+ <div class="d-flex gap-2 ps-2 align-items-center small itf-table2_mass-operations">
11
+ <slot name="group-operations-count">
12
+ <div>{{$tc('components.table.selectedItems', selectedIds.length, { n: selectedIds.length })}}</div>
13
+ <div class="opacity-50">•</div>
14
+ </slot>
13
15
  <a href="" class="me-3 opacity-50 text-white text-decoration-none" @click.stop.prevent="selectedIds = []">{{$t('components.table.cancelSelected')}}</a>
14
16
  <div>
15
17
  <slot name="group-operations"></slot>
@@ -17,64 +19,61 @@
17
19
  </div>
18
20
  </itf-notice-popout>
19
21
  <div class="scrollable scrollable-x">
20
- <itf-checkbox-group v-model="selectedIds">
21
- <template v-for="(group, index) in groups">
22
- <div class="table-view-body">
23
- <itf-table-group
24
- :key="index"
25
- @update="$emit('update', { ...$event, group, groupIndex: index })"
26
- @row-click="$emit('row-click', $event)"
27
- :id-property="idProperty"
28
- :columns="columns"
29
- @update:columns="onColumnsUpdate"
30
- :rows="group.rows"
31
- :title="group.name"
32
- :selected-ids.sync="selectedIds"
33
- :add-new-rows="addNewRows"
34
- :shadow-width="shadowWidth"
35
- :column-sorting="columnSorting"
36
- :column-resizing="columnResizing"
37
- :show-grouping="showGrouping"
38
- :show-summary="showSummary"
39
- :show-add-column="showAddColumn"
40
- :show-actions="showActions"
41
- :show-header="!noHeader"
42
- :schema="schema"
43
- :editable="editable"
44
- :no-column-menu="noColumnMenu"
45
- :no-select-all="noSelectAll"
46
- :currencies="currencies"
47
- :currency="currency"
48
- :subrows-property="subrowsProperty"
49
- :async-subrows-property="asyncSubrowsProperty"
50
- :divider-property="dividerProperty"
51
- :indicator-type="indicatorType"
52
- :expanded-all="expandedAll"
53
- :indicatorWidth="indicatorWidth"
54
- :striped="striped"
55
- :expanded-ids="expandedIds"
56
- :css-property="cssProperty"
57
- :sticky-header="stickyHeader"
58
- :editable-property="editableProperty"
59
- :sorting.sync="_sorting"
60
- :sort-as-string="sortAsString"
61
- :active="active"
62
- @loadChildren="$emit('loadChildren', $event)"
63
- @update:expanded-ids="$emit('update:expanded-ids', $event)"
64
- @new="$emit('new', $event)"
65
- @filter="$emit('filter', $event)"
66
- @add-column="$emit('add-column', $event)"
67
- >
68
- <template v-for="(_, name) in $slots" #[name]="slotData">
69
- <slot :name="name" v-bind="slotData || {}" />
70
- </template>
71
- <template v-for="(_, name) in $scopedSlots" #[name]="slotData">
72
- <slot :name="name" v-bind="slotData || {}" />
73
- </template>
74
- </itf-table-group>
75
- </div>
76
- </template>
77
- </itf-checkbox-group>
22
+ <itf-checkbox-group v-model="selectedIds">
23
+ <template v-for="(group, index) in groups">
24
+ <div class="table-view-body">
25
+ <itf-table-group
26
+ :key="index"
27
+ @update="$emit('update', { ...$event, group, groupIndex: index })"
28
+ @row-click="$emit('row-click', $event)"
29
+ :id-property="idProperty"
30
+ :columns="columns"
31
+ @update:columns="onColumnsUpdate"
32
+ :rows="group.rows"
33
+ :title="group.name"
34
+ :selected-ids.sync="selectedIds"
35
+ :add-new-rows="addNewRows"
36
+ :shadow-width="shadowWidth"
37
+ :column-sorting="columnSorting"
38
+ :column-resizing="columnResizing"
39
+ :show-grouping="showGrouping"
40
+ :show-summary="showSummary"
41
+ :show-add-column="showAddColumn"
42
+ :show-actions="showActions"
43
+ :show-header="!noHeader"
44
+ :schema="schema"
45
+ :editable="editable"
46
+ :no-column-menu="noColumnMenu"
47
+ :no-select-all="noSelectAll"
48
+ :currencies="currencies"
49
+ :currency="currency"
50
+ :subrows-property="subrowsProperty"
51
+ :divider-property="dividerProperty"
52
+ :indicator-type="indicatorType"
53
+ :expanded-all="expandedAll"
54
+ :indicatorWidth="indicatorWidth"
55
+ :striped="striped"
56
+ :expanded-ids="expandedIds"
57
+ :css-property="cssProperty"
58
+ :sticky-header="stickyHeader"
59
+ :editable-property="editableProperty"
60
+ :sorting.sync="_sorting"
61
+ :active="active"
62
+ @update:expanded-ids="$emit('update:expanded-ids', $event)"
63
+ @new="$emit('new', $event)"
64
+ @filter="$emit('filter', $event)"
65
+ @add-column="$emit('add-column', $event)"
66
+ >
67
+ <template v-for="(_, name) in $slots" #[name]="slotData">
68
+ <slot :name="name" v-bind="slotData || {}" />
69
+ </template>
70
+ <template v-for="(_, name) in $scopedSlots" #[name]="slotData">
71
+ <slot :name="name" v-bind="slotData || {}" />
72
+ </template>
73
+ </itf-table-group>
74
+ </div>
75
+ </template>
76
+ </itf-checkbox-group>
78
77
  </div>
79
78
  </div>
80
79
 
@@ -105,13 +104,11 @@ export default @Component({
105
104
  })
106
105
  class itfTable2 extends Vue {
107
106
  // @Prop({ required: true, type: Array }) columns;
108
- @Prop(Boolean) sortAsString;
109
107
  @Prop({ required: true, type: Array }) rows;
110
108
  @Prop({ type: String, default: null }) groupBy;
111
109
  @Prop({ type: String, default: null }) idProperty;
112
110
  @Prop({ type: String, default: null }) cssProperty;
113
111
  @Prop({ type: String, default: null }) subrowsProperty;
114
- @Prop({ type: String, default: null }) asyncSubrowsProperty;
115
112
  @Prop({ type: String, default: null }) dividerProperty;
116
113
  @Prop({ type: String, default: null }) editableProperty;
117
114
  @Prop({ default: null }) active;
@@ -247,8 +244,7 @@ class itfTable2 extends Vue {
247
244
  @Watch('selectedIds')
248
245
  onSelectedIdsUpdate(selectedIds) {
249
246
  this.state.selectedIds = selectedIds;
250
- // метод saveTableState не зберігає selectedIds в localStorage, не впевнений що він тут треба
251
- // this.saveTableState();
247
+ this.saveTableState();
252
248
  }
253
249
 
254
250
  onColumnsUpdate(columns) {
@@ -7,7 +7,6 @@
7
7
  :columns="columns"
8
8
  :id-property="idProperty"
9
9
  :subrows-property="subrowsProperty"
10
- :async-subrows-property="asyncSubrowsProperty"
11
10
  :divider-property="dividerProperty"
12
11
  :show-add-column="showAddColumn"
13
12
  :show-actions="showActions"
@@ -145,7 +144,6 @@ class itfTableBody extends Vue {
145
144
  @Prop() rows;
146
145
  @Prop() idProperty;
147
146
  @Prop() subrowsProperty;
148
- @Prop() asyncSubrowsProperty;
149
147
  @Prop() dividerProperty;
150
148
  @Prop() active;
151
149
  @Prop(Boolean) showAddColumn;
@@ -166,10 +164,6 @@ class itfTableBody extends Vue {
166
164
  this.$emit('update:expanded-ids', this.expandedIds.includes(item[this.idProperty])
167
165
  ? this.expandedIds.filter((id) => id !== item[this.idProperty])
168
166
  : [...this.expandedIds, item[this.idProperty]]);
169
-
170
- if (this.asyncSubrowsProperty && item[this.asyncSubrowsProperty] && item[this.asyncSubrowsProperty]) {
171
- this.$emit('loadChildren', item);
172
- }
173
167
  }
174
168
  }
175
169
  </script>
@@ -17,7 +17,7 @@
17
17
  <div class="shadow-area"></div>
18
18
  <div class="header-wrapper" :class="{'header-additional-column': showAddColumn}" @click.prevent="toggleGroup">
19
19
  <a class="header-content position-sticky d-flex align-items-center">
20
- <itf-button icon small secondary class="collapse-arrow">
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"
@@ -39,7 +39,6 @@
39
39
  :show-add-column="showAddColumn"
40
40
  :show-actions="showActions"
41
41
  :id-property="idProperty"
42
- :sort-as-string="sortAsString"
43
42
  :rows="rows"
44
43
  :schema="schema"
45
44
  :editable="editable"
@@ -62,13 +61,11 @@
62
61
  @row-click="$emit('row-click', $event)"
63
62
  :id-property="idProperty"
64
63
  :subrows-property="subrowsProperty"
65
- :async-subrows-property="asyncSubrowsProperty"
66
64
  :divider-property="dividerProperty"
67
65
  :rows="rows"
68
66
  :editable="editable"
69
67
  :currency="currency"
70
68
  :currencies="currencies"
71
- :sort-as-string="sortAsString"
72
69
  :columns="visibleColumns"
73
70
  :no-select-all="noSelectAll"
74
71
  :selected-ids="selectedIds"
@@ -81,7 +78,6 @@
81
78
  :css-property="cssProperty"
82
79
  :editable-property="editableProperty"
83
80
  :active="active"
84
- @loadChildren="$emit('loadChildren', $event)"
85
81
  @update:expanded-ids="$emit('update:expanded-ids', $event)"
86
82
  >
87
83
  <template v-for="(_, name) in $slots" #[name]="slotData">
@@ -95,11 +91,11 @@
95
91
 
96
92
  <!-- Лінія додати нову -->
97
93
  <div v-if="isShowTable && addNewRows"
98
- class="table-row-template table-row-template__new-row d-flex align-items-stretch">
94
+ class="table-row-template d-flex align-items-stretch">
99
95
  <div class="shadow-area"></div>
100
96
  <a href="" @click.prevent="$emit('new', title)" data-test="table-add-new-item"
101
97
  class="d-flex align-items-center flex-grow-1 table-add-new-item text-decoration-none">
102
- <span class="d-sticky d-flex align-items-center py-1 px-2 small">
98
+ <span class="d-sticky d-flex align-items-center py-1">
103
99
  <itf-icon name="plus"/>
104
100
  <span>{{ newLabel }}</span>
105
101
  </span>
@@ -268,11 +264,7 @@
268
264
  min-height: var(--table-small-row-size);
269
265
  }
270
266
 
271
- .table-row-template.table-row-template__new-row {
272
- min-height: 2rem;
273
- }
274
267
  .table-add-new-item {
275
- background-color: var(--itf-table-header-bg);
276
268
  border-right:var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
277
269
  border-left:var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
278
270
  border-bottom: var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
@@ -281,7 +273,7 @@
281
273
  border-bottom-right-radius: var(--itf-table-table-border-radius);
282
274
 
283
275
  & > span {
284
- left: calc(var(--shadow-area-width) + 4px);
276
+ left: var(--shadow-area-width);
285
277
  position: sticky;
286
278
  padding-left: var(--shadow-area-width);
287
279
  //border-left: var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
@@ -367,7 +359,6 @@ class itfTableGroup extends Vue {
367
359
  @Prop() title;
368
360
  @Prop() idProperty;
369
361
  @Prop() subrowsProperty;
370
- @Prop() asyncSubrowsProperty;
371
362
  @Prop() dividerProperty;
372
363
  @Prop() currency;
373
364
  @Prop() currencies;
@@ -387,7 +378,6 @@ class itfTableGroup extends Vue {
387
378
  @Prop(Boolean) expandedAll;
388
379
  @Prop(Boolean) striped;
389
380
  @Prop(Boolean) stickyHeader;
390
- @Prop(Boolean) sortAsString;
391
381
  @Prop() indicatorWidth;
392
382
  @Prop() shadowWidth;
393
383
  @Prop() cssProperty;
@@ -4,8 +4,8 @@
4
4
  <div ref="container" class="table-row-template">
5
5
  <div accept-group="items" class="table-view-body-space" v-dropzone="{ payload: 0 }"></div>
6
6
  <div class="shadow-area"></div>
7
- <div v-if="indicatorType !== 'none'" class="table-view-header-value reserved sticky">
8
- <itf-checkbox v-if="indicatorType !== 'none' && visibleHeader && !noSelectAll" ungrouped value="all" v-model="selectAll" ref="selectAll" />
7
+ <div class="table-view-header-value reserved sticky">
8
+ <itf-checkbox v-if="indicatorType === 'checkbox' && visibleHeader && !noSelectAll" ungrouped value="all" v-model="selectAll" ref="selectAll" />
9
9
  </div>
10
10
 
11
11
  <template v-for="(column, n) in visibleAttributes">
@@ -29,16 +29,14 @@
29
29
  <div v-if="visibleHeader" group="tablecolumns"
30
30
  class="table-header"
31
31
  @drop="reorderColumns"
32
- v-draggable="{ dragHandleClass: null, handle: true, payload: { index: n, item: column }, mirror: {yAxis:false} }">
32
+ v-draggable="{ handle: true, payload: { index: n, item: column }, mirror: {yAxis:false} }">
33
33
  <itf-dropdown text append-to-body shadow ref="dropdown" class="w-100" :disabled="noColumnMenu">
34
34
  <template #button>
35
35
  <div class="itf-table2__header-title d-flex w-100 align-items-center" :title="getTitle(column.title)">
36
36
  <itf-icon class="itf-table2__header-icon" new v-if="column.icon" :name="column.icon"></itf-icon>
37
37
  <div class="flex-grow-1 w-100 itf-table2__title-container d-flex align-items-center" :class="{'justify-content-end': column.align === 'end'}">
38
- <div class="itf-table2__title text-truncate">
39
- {{getTitle(column.title)}}
40
- <div v-if="column.prefix" class="itf-table2__subtitle text-truncate" :class="{'text-end': column.align === 'end'}" v-text="column.prefix" />
41
- </div>
38
+ <div class="itf-table2__title text-truncate">{{getTitle(column.title)}}</div>
39
+ <div v-if="column.prefix" class="itf-table2__subtitle text-truncate" v-text="column.prefix" />
42
40
  </div>
43
41
  </div>
44
42
  <itf-icon v-if="sortColumnParams[column.property]" :name="sortColumnParams[column.property] === 'asc' ? 'sort-asc' : 'sort-desc'" new :size="20" class="ms-1" />
@@ -196,7 +194,6 @@ class itfTableHeader extends Vue {
196
194
  @Prop(Boolean) noColumnMenu;
197
195
  @Prop(Boolean) noSelectAll;
198
196
  @Prop(Boolean) editable;
199
- @Prop(Boolean) sortAsString;
200
197
  @Prop() idProperty;
201
198
  @Prop() indicatorType;
202
199
 
@@ -414,10 +411,8 @@ class itfTableHeader extends Vue {
414
411
  }
415
412
 
416
413
  sortBy(column, order) {
417
- let sort = { [column.property]: order };
418
- if (this.sortAsString) {
419
- sort = order === 'desc' ? `-${column.property}` : column.property;
420
- }
414
+ let sort = order === 'desc' ? `-${column.property}` : column.property;
415
+ console.info(sort);
421
416
  this.$emit('update:sorting', sort);
422
417
  }
423
418
  }
@@ -2,10 +2,7 @@
2
2
  <div>
3
3
  <div @click.prevent.stop="toggle" class="d-flex align-items-center flex-nowrap" :class="{'active-toggle': visible}">
4
4
  <div class="item-toggle text-muted">
5
- <template v-if="visible && loading">
6
- <div class="itf-spinner"></div>
7
- </template>
8
- <template v-else-if="visible && expanded">
5
+ <template v-if="visible && expanded">
9
6
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
10
7
  width="16" height="16" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
11
8
  <path d="M184.7,413.1l2.1-1.8l156.5-136c5.3-4.6,8.6-11.5,8.6-19.2c0-7.7-3.4-14.6-8.6-19.2L187.1,101l-2.6-2.3
@@ -26,10 +23,6 @@
26
23
  </div>
27
24
  </template>
28
25
  <style lang="scss" scoped>
29
- .itf-spinner {
30
- width: 1rem;
31
- height: 1rem;
32
- }
33
26
  .active-toggle {
34
27
  cursor: pointer;
35
28
  }
@@ -50,7 +43,6 @@ export default @Component({
50
43
  class itfTableRowToggle extends Vue {
51
44
  @Prop(Boolean) expanded;
52
45
  @Prop(Boolean) visible;
53
- @Prop(Boolean) loading;
54
46
 
55
47
  toggle() {
56
48
  this.$emit('toggle');
@@ -25,22 +25,6 @@
25
25
  <span v-if="indicatorType === 'order'">{{ (n + 1) }}</span>
26
26
  <span v-else-if="indicatorType === 'property'">{{ item[idProperty] }}</span>
27
27
  <span v-else-if="indicatorType === 'checkbox'"><itf-checkbox :value="item[idProperty]" /></span>
28
- <a href="" @click.prevent.stop="$emit('toggle', item)" v-else-if="indicatorType === 'toggle'">
29
- <template v-if="subrowsProperty && item[subrowsProperty] && item[subrowsProperty].length">
30
- <template v-if="item[subrowsProperty] && item[subrowsProperty].length && !isExpanded(item)">
31
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square" viewBox="0 0 16 16">
32
- <path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>
33
- <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>
34
- </svg>
35
- </template>
36
- <template v-else>
37
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-dash-square" viewBox="0 0 16 16">
38
- <path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>
39
- <path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/>
40
- </svg>
41
- </template>
42
- </template>
43
- </a>
44
28
  </div>
45
29
  </div>
46
30
  <div accept-group="items" class="table-item-inner" @click="$emit('row-click', item)">
@@ -49,37 +33,37 @@
49
33
  v-if="column.visible !== false"
50
34
  :data-column="k"
51
35
  :style="`width: ${column.width}px; max-width: ${column.width}px; left: ${column.left}px;`"
52
- :class="{'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'editable': column.editable && editable}"
36
+ :class="{'justify-content-end': column.align === 'end', 'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'editable': column.editable && editable}"
53
37
  class="table-view-item-value d-flex h-100">
54
- <div class="table-view-item-value-content align-items-center" :class="{'justify-content-end': column.align === 'end', 'px-2': !(column.editable && editable)}">
55
- <slot
56
- :name="`column.${column.property}`"
57
- :toggle="() => $emit('toggle', item)"
58
- :hasSubitems="hasSubitems(item)"
59
- :isExpanded="!!(hasSubitems(item) && !isExpanded(item))"
60
- :level="level" :editable="column.editable && editable" :item="item" :column="column" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)">
61
- <template v-if="column.editable && editable && (!editableProperty || item[editableProperty])">
62
- <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">
63
- <itf-text-field class="w-100 h-100" v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
64
- <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)" />
65
- <itf-hours-field
66
- class="w-100 h-100"
67
- placeholder="00h 00m"
68
- v-else-if="column.type === 'time'"
69
- :hours="getValue(item, column)"
70
- @update:hours="updateValue(item, $event, n, column)"
71
- />
72
- <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)" />
73
- <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)" />
74
- <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>
75
- </slot>
76
- </template>
77
- <span v-else class="text-truncate">
78
- <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">
79
- {{getValue(item, column)}}
80
- </slot>
81
- </span>
82
- </slot>
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" :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>
83
67
  </div>
84
68
  </div>
85
69
  </template>
@@ -102,7 +86,6 @@
102
86
  :columns="columns"
103
87
  :id-property="idProperty"
104
88
  :subrows-property="subrowsProperty"
105
- :async-subrows-property="asyncSubrowsProperty"
106
89
  :show-add-column="showAddColumn"
107
90
  :show-actions="showActions"
108
91
  :no-select-all="noSelectAll"
@@ -162,7 +145,6 @@ class itfTableRows extends Vue {
162
145
  @Prop() rows;
163
146
  @Prop() idProperty;
164
147
  @Prop() subrowsProperty;
165
- @Prop() asyncSubrowsProperty;
166
148
  @Prop() dividerProperty;
167
149
  @Prop() active;
168
150
  @Prop(Boolean) showAddColumn;
@@ -192,12 +174,6 @@ class itfTableRows extends Vue {
192
174
  return this.columns.findIndex((column) => column.lastPinned);
193
175
  }
194
176
 
195
- hasSubitems(item) {
196
- const hasFactItems = this.subrowsProperty && item[this.subrowsProperty] && item[this.subrowsProperty].length;
197
- const hasPlanItems = this.asyncSubrowsProperty && item[this.asyncSubrowsProperty] && item[this.asyncSubrowsProperty];
198
- return !!(hasFactItems || hasPlanItems);
199
- }
200
-
201
177
  updateValue(item, value, index, column) {
202
178
  const newItem = { ...item };
203
179
  if (newItem[column.property] !== value) {
@@ -212,8 +188,20 @@ class itfTableRows extends Vue {
212
188
  }
213
189
  }
214
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
+
215
203
  isActive(id) {
216
- if (!this.idProperty || !this.active) {
204
+ if (!this.idProperty) {
217
205
  return false;
218
206
  }
219
207
  if (Array.isArray(this.active)) {
@@ -7,10 +7,10 @@
7
7
  --itf-table-alt-bg: #F9FAFB;
8
8
  --itf-table-alt-selected-bg: #eff1f3;
9
9
  --itf-table-header-bg: #f5f7f8;
10
- --itf-table-header-color: #575b63;
10
+ --itf-table-header-color: #7A818EA5;
11
11
  --itf-table-mirror-bg: #F2F4F7;
12
12
  --itf-table-border-color: transparent; //var(--itf-table-header-bg);
13
- --itf-table-header-border-color: #8E97A533;
13
+ --itf-table-header-border-color: #7A818E33;
14
14
  --itf-table-border-base-color: var(--itf-table-header-bg); // кольори границь таблиці без внутрішніх рядків
15
15
  --itf-table-border-base-width: 2px;
16
16
  --itf-table-hover-header-bg: #dfe5ef;
@@ -23,8 +23,6 @@
23
23
  --itf-table-summary-text: var(--bs-tertiary-color);
24
24
  --itf-table-table-border-radius: 1rem;
25
25
  --itf-table-header-height: 2.25rem;
26
- --itf-table-divider-bg: #F7F8FA;
27
- --itf-table-divider-border: rgba(238, 238, 238, 1);
28
26
 
29
27
  --group-title-height: 40px;
30
28
  --table-row-height: none;
@@ -45,9 +43,6 @@ body[data-theme="dark"] {
45
43
  --itf-table-selected-bg: #011534;
46
44
  --itf-table-active-bg: #022e72;
47
45
  --itf-table-summary-text: #82909d80;
48
- --itf-table-border-base-color: var(--itf-table-header-bg);
49
- --itf-table-divider-bg: #0f0f0f;
50
- --itf-table-divider-border: rgb(100, 100, 100, .1);
51
46
  }
52
47
  .itf-table2 {
53
48
  font-size: var(--itf-table-content-font-size, var(--itf-table-font-size));
@@ -65,7 +60,7 @@ body[data-theme="dark"] {
65
60
  height: 100%;
66
61
  }
67
62
  .scroller {
68
- //margin-bottom: .5rem;
63
+ margin-bottom: 12px;
69
64
  }
70
65
  .scrollable-x {
71
66
  overflow-x: scroll;
@@ -102,18 +97,34 @@ body[data-theme="dark"] {
102
97
  position: sticky;
103
98
  top: 0;
104
99
  bottom: 0;
105
- right: -5px;
100
+ right: -.5rem;
106
101
  z-index: 8;
107
- padding-right: 5px;
108
- padding-left: 5px;
109
102
  display: flex;
110
103
  align-items: center;
104
+
105
+ @media (max-width: 768px) {
106
+ position: relative;
107
+ opacity: 1;
108
+ }
111
109
  }
112
110
  .on-hover {
113
111
  opacity: 0;
112
+ width: 0;
113
+ padding: 4px .5rem;
114
+ overflow: hidden;
114
115
  pointer-events: none;
116
+ position: absolute;
117
+ right: 0;
118
+ background: linear-gradient(90deg, transparent 0, var(--itf-table2-row-bg) 10px);
119
+
120
+ @media (max-width: 768px) {
121
+ width: max-content;
122
+ opacity: 1;
123
+ position: relative;
124
+ }
115
125
  }
116
126
  .table-row-template:hover .on-hover {
127
+ width: max-content;
117
128
  opacity: 1;
118
129
  pointer-events: all;
119
130
  }
@@ -440,11 +451,11 @@ body[data-theme="dark"] {
440
451
  }
441
452
 
442
453
  &__row-divider {
443
- background-color: var(--itf-table-divider-bg);
454
+ background-color: #F7F8FA;
444
455
  height: 5px;
445
456
  padding: 0;
446
- border-top: 1px solid var(--itf-table-divider-border);
447
- border-bottom: 1px solid var(--itf-table-divider-border);
457
+ border-top: 1px solid rgba(238, 238, 238, 1);
458
+ border-bottom: 1px solid rgba(238, 238, 238, 1);
448
459
  }
449
460
  //&:hover, &.permanent-editable-border {
450
461
  // .table-view-item-value.editable {
@@ -457,7 +468,6 @@ body[data-theme="dark"] {
457
468
  position: relative;
458
469
  z-index: 2;
459
470
  width: 100%;
460
- display: flex;
461
471
  height: 100%;
462
472
  background: var(--itf-table2-row-bg)
463
473
  }