@itfin/components 1.3.96 → 2.0.2
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 +1 -1
- package/src/assets/scss/_css_variables.scss +2 -2
- package/src/assets/scss/_variables.scss +31 -9
- package/src/assets/scss/components/_button.scss +10 -0
- package/src/assets/scss/components/_datepicker.scss +3 -3
- package/src/assets/scss/components/_pagination.scss +4 -1
- package/src/assets/scss/components/_select.scss +4 -6
- package/src/assets/scss/components/_text-field.scss +19 -11
- package/src/assets/scss/main.scss +41 -2
- package/src/components/app/message.js +1 -1
- package/src/components/button/Button.vue +4 -2
- package/src/components/filter/FilterAmountRange.vue +50 -42
- package/src/components/filter/FilterBadge.vue +27 -22
- package/src/components/filter/FilterFacetsList.vue +20 -17
- package/src/components/filter/FilterPanel.vue +82 -27
- package/src/components/filter/index.stories.js +0 -2
- package/src/components/icon/Icon.vue +4 -2
- package/src/components/icon/components/fi_fingerprint.vue +4 -0
- package/src/components/icon/components/nomi-arrow-down.vue +4 -0
- package/src/components/icon/components/nomi-arrow-right-top.vue +4 -0
- package/src/components/icon/components/nomi-arrow-up.vue +4 -0
- package/src/components/icon/components/nomi-arrows.vue +7 -0
- package/src/components/icon/components/nomi-calendar-alt.vue +4 -0
- package/src/components/icon/components/nomi-calendar.vue +11 -0
- package/src/components/icon/components/nomi-card.vue +4 -0
- package/src/components/icon/components/nomi-clear.vue +4 -0
- package/src/components/icon/components/nomi-close.vue +5 -0
- package/src/components/icon/components/nomi-eye-close.vue +4 -0
- package/src/components/icon/components/nomi-eye-open.vue +4 -0
- package/src/components/icon/components/nomi-filter.vue +4 -0
- package/src/components/icon/components/nomi-hide.vue +4 -0
- package/src/components/icon/components/nomi-money.vue +4 -0
- package/src/components/icon/components/nomi-move-left.vue +4 -0
- package/src/components/icon/components/nomi-move-right.vue +4 -0
- package/src/components/icon/components/nomi-person.vue +5 -0
- package/src/components/icon/components/nomi-pin.vue +7 -0
- package/src/components/icon/components/nomi-scissors.vue +4 -0
- package/src/components/icon/components/nomi-sort-asc.vue +7 -0
- package/src/components/icon/components/nomi-sort-desc.vue +7 -0
- package/src/components/icon/components/nomi-table-view.vue +4 -0
- package/src/components/icon/components/nomi-tag.vue +4 -0
- package/src/components/icon/components/nomi-target.vue +4 -0
- package/src/components/icon/components/nomi-text.vue +6 -0
- package/src/components/icon/components/nomi-unpin.vue +7 -0
- package/src/components/icon/convert-icons.js +11 -0
- package/src/components/icon/icons.js +311 -284
- package/src/components/icon/new-icons/arrow-down.svg +3 -0
- package/src/components/icon/new-icons/arrow-right-top.svg +3 -0
- package/src/components/icon/new-icons/arrow-up.svg +3 -0
- package/src/components/icon/new-icons/arrows.svg +6 -0
- package/src/components/icon/new-icons/calendar-alt.svg +3 -0
- package/src/components/icon/new-icons/calendar.svg +10 -0
- package/src/components/icon/new-icons/card.svg +3 -0
- package/src/components/icon/new-icons/clear.svg +3 -0
- package/src/components/icon/new-icons/close.svg +4 -0
- package/src/components/icon/new-icons/eye-close.svg +3 -0
- package/src/components/icon/new-icons/eye-open.svg +3 -0
- package/src/components/icon/new-icons/filter.svg +3 -0
- package/src/components/icon/new-icons/hide.svg +3 -0
- package/src/components/icon/new-icons/money.svg +3 -0
- package/src/components/icon/new-icons/move-left.svg +3 -0
- package/src/components/icon/new-icons/move-right.svg +3 -0
- package/src/components/icon/new-icons/person.svg +4 -0
- package/src/components/icon/new-icons/pin.svg +6 -0
- package/src/components/icon/new-icons/scissors.svg +3 -0
- package/src/components/icon/new-icons/sort-asc.svg +6 -0
- package/src/components/icon/new-icons/sort-desc.svg +6 -0
- package/src/components/icon/new-icons/table-view.svg +3 -0
- package/src/components/icon/new-icons/tag.svg +3 -0
- package/src/components/icon/new-icons/target.svg +3 -0
- package/src/components/icon/new-icons/text.svg +5 -0
- package/src/components/icon/new-icons/unpin.svg +6 -0
- package/src/components/modal/DeleteConfirmModal.vue +0 -2
- package/src/components/modal/ItemEditor.vue +1 -5
- package/src/components/pagination/Pagination.vue +3 -2
- package/src/components/pagination/Pagination2.vue +176 -0
- package/src/components/panels/Panel.vue +1 -1
- package/src/components/popover/NoticePopout.vue +1 -1
- package/src/components/sortable/draggable.js +2 -1
- package/src/components/table/Table2.vue +24 -1
- package/src/components/table/TableBody.vue +7 -2
- package/src/components/table/TableGroup.vue +25 -10
- package/src/components/table/TableHeader.vue +101 -61
- package/src/components/table/TableRows.vue +9 -7
- package/src/components/table/index.stories.js +22 -200
- package/src/components/table/table2.scss +203 -65
- package/src/components/text-field/MoneyField.vue +9 -52
- package/src/components/text-field/TextField.vue +12 -8
- package/src/components/view/View.vue +154 -0
- package/src/components/view/index.stories.js +588 -0
- package/src/helpers/formatters.js +14 -1
- package/src/locales/en.js +13 -0
- package/src/locales/uk.js +11 -0
- package/src/components/table/TableRow.vue +0 -221
|
@@ -17,10 +17,10 @@
|
|
|
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
|
-
<
|
|
20
|
+
<itf-button squircle icon small secondary class="collapse-arrow">
|
|
21
21
|
<itf-icon :name="isShowTable ? 'chevron_down' : 'chevron_right'"/>
|
|
22
|
-
</
|
|
23
|
-
<span class="d-flex align-items-center line-overflow group-header-value"
|
|
22
|
+
</itf-button>
|
|
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
25
|
<slot name="group-title" :rows="rows" :title="title">{{ title }}</slot>
|
|
26
26
|
</span>
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
:sorting.sync="_sorting"
|
|
50
50
|
@update:selectedIds="$emit('update:selectedIds', $event)"
|
|
51
51
|
@update:columns="$emit('update:columns', $event)"
|
|
52
|
+
@filter="$emit('filter', $event)"
|
|
52
53
|
@add-column="$emit('add-column', $event)"
|
|
53
54
|
/>
|
|
54
55
|
</div>
|
|
@@ -153,7 +154,7 @@
|
|
|
153
154
|
|
|
154
155
|
&.no-indicator {
|
|
155
156
|
.shadow-area + .table-view-header-value, .table-item-inner {
|
|
156
|
-
border-left:
|
|
157
|
+
border-left: var(--itf-table-border-base-width) solid var(--itf-table-border-color);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
|
@@ -229,7 +230,7 @@
|
|
|
229
230
|
border-radius: 0;
|
|
230
231
|
}
|
|
231
232
|
&:hover {
|
|
232
|
-
background: var(--itf-table-hover-bg);
|
|
233
|
+
//background: var(--itf-table-hover-bg); // видно, що група не на всю ширину коли є нижній скролінг
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
|
|
@@ -238,7 +239,7 @@
|
|
|
238
239
|
}
|
|
239
240
|
.header-content:not(.draggable-mirror *) {
|
|
240
241
|
left: var(--shadow-area-width);
|
|
241
|
-
padding-left: 0.75rem;
|
|
242
|
+
//padding-left: 0.75rem;
|
|
242
243
|
padding-right: 0.75rem;
|
|
243
244
|
gap: 1rem;
|
|
244
245
|
align-items: center;
|
|
@@ -263,15 +264,18 @@
|
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
.table-add-new-item {
|
|
266
|
-
border-right:
|
|
267
|
-
border-
|
|
267
|
+
border-right:var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
|
|
268
|
+
border-left:var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
|
|
269
|
+
border-bottom: var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
|
|
268
270
|
outline: none;
|
|
271
|
+
border-bottom-left-radius: var(--itf-table-table-border-radius);
|
|
272
|
+
border-bottom-right-radius: var(--itf-table-table-border-radius);
|
|
269
273
|
|
|
270
274
|
& > span {
|
|
271
275
|
left: var(--shadow-area-width);
|
|
272
276
|
position: sticky;
|
|
273
277
|
padding-left: var(--shadow-area-width);
|
|
274
|
-
border-left:
|
|
278
|
+
//border-left: var(--itf-table-border-base-width) solid var(--itf-table-border-base-color);
|
|
275
279
|
height: 100%;
|
|
276
280
|
}
|
|
277
281
|
&:hover, &:active {
|
|
@@ -280,9 +284,20 @@
|
|
|
280
284
|
}
|
|
281
285
|
|
|
282
286
|
.sticky-group {
|
|
287
|
+
top: -10px;
|
|
283
288
|
position: sticky;
|
|
284
|
-
top: 0;
|
|
285
289
|
z-index: 10;
|
|
290
|
+
|
|
291
|
+
& > .draggable-item {
|
|
292
|
+
margin-bottom: 8px;
|
|
293
|
+
}
|
|
294
|
+
.collapse-arrow {
|
|
295
|
+
padding: 0;
|
|
296
|
+
|
|
297
|
+
&:after {
|
|
298
|
+
display: none;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
286
301
|
}
|
|
287
302
|
.table-summary {
|
|
288
303
|
.shadow-area {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
data-test="table-header-column"
|
|
16
16
|
:data-column="n"
|
|
17
17
|
:data-id="column.Id"
|
|
18
|
-
:class="{'sticky': column.pinned, 'last-sticky-column': n === lastPinnedIndex, 'flex-grow-1': column.grow, [`justify-content-${column.align || 'start'}`]: true}"
|
|
18
|
+
:class="{'sticky': column.pinned, 'active': sortColumnParams[column.property], 'last-sticky-column': n === lastPinnedIndex, 'flex-grow-1': column.grow, [`justify-content-${column.align || 'start'}`]: true}"
|
|
19
19
|
class="table-view-header-value"
|
|
20
20
|
:style="column.grow ? `left: ${column.left}px; flex-grow: 1` : `width: ${column.width}px; max-width: ${column.width}px; left: ${column.left}px;`">
|
|
21
21
|
<!-- Не треба видаляти колонки, бо вони потрібні для збереження ширини -->
|
|
@@ -29,30 +29,22 @@
|
|
|
29
29
|
<div v-if="visibleHeader" group="tablecolumns"
|
|
30
30
|
class="table-header"
|
|
31
31
|
@drop="reorderColumns"
|
|
32
|
-
v-drag-handle
|
|
33
32
|
v-draggable="{ handle: true, payload: { index: n, item: column }, mirror: {yAxis:false} }">
|
|
34
33
|
<itf-dropdown text append-to-body shadow ref="dropdown" class="w-100" :disabled="noColumnMenu">
|
|
35
34
|
<template #button>
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
<div class="itf-table2__header-title d-flex w-100 align-items-start" :title="getTitle(column.title)" :class="{'ms-auto': column.align === 'end'}">
|
|
36
|
+
<itf-icon class="itf-table2__header-icon" new v-if="column.icon" :name="column.icon"></itf-icon>
|
|
37
|
+
<div class="flex-grow-1 w-100 itf-table2__title-container">
|
|
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" />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<itf-icon v-if="sortColumnParams[column.property]" :name="sortColumnParams[column.property] === 'asc' ? 'sort-asc' : 'sort-desc'" new :size="20" class="ms-1" />
|
|
42
43
|
</template>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="sortBy(column, 'asc')">
|
|
46
|
-
<itf-icon name="arrow_up" :size="16" class="me-1" />
|
|
47
|
-
{{$t('components.table.sortAscending')}}
|
|
48
|
-
</a>
|
|
49
|
-
</div>
|
|
50
|
-
<div v-if="column.sortable">
|
|
51
|
-
<a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="sortBy(column, 'desc')">
|
|
52
|
-
<itf-icon name="arrow_down" :size="16" class="me-1" />
|
|
53
|
-
{{$t('components.table.sortDescending')}}
|
|
54
|
-
</a>
|
|
44
|
+
<div class="dropdown-header">
|
|
45
|
+
{{$t('components.table.actions')}}
|
|
55
46
|
</div>
|
|
47
|
+
|
|
56
48
|
<div v-if="column.groupable">
|
|
57
49
|
<a class="dropdown-item d-flex align-items-center" href="javascript:;">
|
|
58
50
|
<itf-icon name="episodes" :size="16" class="me-1" />
|
|
@@ -60,19 +52,84 @@
|
|
|
60
52
|
</a>
|
|
61
53
|
</div>
|
|
62
54
|
<div>
|
|
63
|
-
<a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="togglePinned(n)">
|
|
64
|
-
<itf-icon
|
|
55
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="togglePinned(n)">
|
|
56
|
+
<itf-icon v-if="column.pinned" name="pin" new />
|
|
57
|
+
<itf-icon v-else name="pin" new />
|
|
58
|
+
|
|
65
59
|
<span v-if="column.pinned">{{$t('components.table.unfreezeColumn')}}</span>
|
|
66
60
|
<span v-else>{{$t('components.table.freezeColumn')}}</span>
|
|
67
61
|
</a>
|
|
68
62
|
</div>
|
|
69
63
|
<div v-if="showAddColumn">
|
|
70
|
-
<a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="hideColumn(n)">
|
|
71
|
-
<itf-icon name="
|
|
64
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="hideColumn(n)">
|
|
65
|
+
<itf-icon name="hide" new />
|
|
66
|
+
|
|
72
67
|
{{$t('components.table.hideColumn')}}
|
|
73
68
|
</a>
|
|
74
69
|
</div>
|
|
70
|
+
<div v-if="column.filtrable">
|
|
71
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="$emit('filter', column)">
|
|
72
|
+
<itf-icon name="filter" new />
|
|
73
|
+
|
|
74
|
+
{{$t('components.table.filter')}}
|
|
75
|
+
</a>
|
|
76
|
+
</div>
|
|
77
|
+
<div v-if="canMoveColumn(1, column)">
|
|
78
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="moveColumn(1, column)">
|
|
79
|
+
<itf-icon name="move-right" new />
|
|
80
|
+
|
|
81
|
+
{{$t('components.table.moveRight')}}
|
|
82
|
+
</a>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div v-if="canMoveColumn(-1, column)">
|
|
86
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="moveColumn(-1, column)">
|
|
87
|
+
<itf-icon name="move-left" new />
|
|
88
|
+
|
|
89
|
+
{{$t('components.table.moveLeft')}}
|
|
90
|
+
</a>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<template v-if="column.sortable">
|
|
94
|
+
<div class="dropdown-header">
|
|
95
|
+
{{$t('components.table.sorting')}}
|
|
96
|
+
</div>
|
|
97
|
+
<div>
|
|
98
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="sortBy(column, 'asc')">
|
|
99
|
+
<itf-icon name="sort-asc" new />
|
|
100
|
+
{{$t('components.table.sortAscending')}}
|
|
101
|
+
</a>
|
|
102
|
+
</div>
|
|
103
|
+
<div>
|
|
104
|
+
<a class="dropdown-item d-flex align-items-center gap-1" href="javascript:;" @click="sortBy(column, 'desc')">
|
|
105
|
+
<itf-icon name="sort-desc" new />
|
|
106
|
+
{{$t('components.table.sortDescending')}}
|
|
107
|
+
</a>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
75
110
|
</itf-dropdown>
|
|
111
|
+
<div v-if="columnSorting" v-drag-handle class="itf-table2__drag-column">
|
|
112
|
+
<svg width="35" height="23" viewBox="0 0 35 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
113
|
+
<g filter="url(#filter0_d_1081_25763)">
|
|
114
|
+
<rect x="4" y="2" width="27" height="15" rx="4" fill="#1A4A97"/>
|
|
115
|
+
<circle cx="23.5" cy="9.5" r="1.5" fill="white"/>
|
|
116
|
+
<circle cx="17.5" cy="9.5" r="1.5" fill="white"/>
|
|
117
|
+
<circle cx="11.5" cy="9.5" r="1.5" fill="white"/>
|
|
118
|
+
</g>
|
|
119
|
+
<defs>
|
|
120
|
+
<filter id="filter0_d_1081_25763" x="0" y="0" width="35" height="23" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
121
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
122
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
123
|
+
<feOffset dy="2"/>
|
|
124
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
125
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
126
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
|
|
127
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1081_25763"/>
|
|
128
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1081_25763" result="shape"/>
|
|
129
|
+
</filter>
|
|
130
|
+
</defs>
|
|
131
|
+
</svg>
|
|
132
|
+
</div>
|
|
76
133
|
</div>
|
|
77
134
|
<div v-if="visibleHeader && n === sortedColumns.length - 1"
|
|
78
135
|
@enter="columnHighlightLast('enter')"
|
|
@@ -86,43 +143,6 @@
|
|
|
86
143
|
</div>
|
|
87
144
|
</template>
|
|
88
145
|
<div class="table-view-item-value extra flex-grow-1"></div>
|
|
89
|
-
<itf-dropdown v-if="showAddColumn && visibleHeader" ref="newDd" text append-to-context shadow autoclose="outside" class="table-header-add-column table-view-item-actions" data-test="table-header-add-column">
|
|
90
|
-
<template #button>
|
|
91
|
-
<itf-button icon small><span class="nom-gear"></span></itf-button>
|
|
92
|
-
</template>
|
|
93
|
-
|
|
94
|
-
<itf-sortable :value="sortedColumns" @input="onSortColumns">
|
|
95
|
-
<template v-for="(column, k) in sortedColumns">
|
|
96
|
-
<div :key="`column${k}`" class="d-flex align-items-center justify-content-between" :class="{'px-2 py-1': column.visible !== false}">
|
|
97
|
-
<template v-if="column.visible !== false">
|
|
98
|
-
<div class="d-flex justify-content-between flex-grow-1">
|
|
99
|
-
<div>
|
|
100
|
-
<span class="nom-grip-vertical"></span>
|
|
101
|
-
<span v-if="column.icon" :class="column.icon"></span>
|
|
102
|
-
{{getTitle(column.title)}}
|
|
103
|
-
</div>
|
|
104
|
-
<span v-if="column.pinned" class="nom-pin-fill"></span>
|
|
105
|
-
</div>
|
|
106
|
-
<a sortable-skip href="" class="text-decoration-none" @click.prevent="hideColumn(k)">
|
|
107
|
-
<span class="nom-trash"></span>
|
|
108
|
-
</a>
|
|
109
|
-
</template>
|
|
110
|
-
</div>
|
|
111
|
-
</template>
|
|
112
|
-
</itf-sortable>
|
|
113
|
-
|
|
114
|
-
<div v-if="invisibleColumns.length">
|
|
115
|
-
<div class="dropdown-header">{{$t('components.table.addColumn')}}</div>
|
|
116
|
-
<template v-for="(column, k) in invisibleColumns">
|
|
117
|
-
<a href="" @click.prevent="addColumn(column)" :key="`inv-column${k}`" class="dropdown-item d-flex align-items-center justify-content-between px-2 py-1">
|
|
118
|
-
<div>
|
|
119
|
-
<span class="nom-plus"></span>
|
|
120
|
-
{{getTitle(column.title)}}
|
|
121
|
-
</div>
|
|
122
|
-
</a>
|
|
123
|
-
</template>
|
|
124
|
-
</div>
|
|
125
|
-
</itf-dropdown>
|
|
126
146
|
|
|
127
147
|
<div class="boundary top"></div>
|
|
128
148
|
<div class="boundary right"></div>
|
|
@@ -238,6 +258,26 @@ class itfTableHeader extends Vue {
|
|
|
238
258
|
return this.sortedColumns.findIndex((column) => column.lastPinned);
|
|
239
259
|
}
|
|
240
260
|
|
|
261
|
+
canMoveColumn(direction, column) {
|
|
262
|
+
if (!this.columnSorting) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
const index = this.sortedColumns.findIndex((c) => c === column);
|
|
266
|
+
return (index + direction >= 0 && index + direction < this.sortedColumns.length);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
moveColumn(direction, column) {
|
|
270
|
+
const index = this.sortedColumns.findIndex((c) => c === column);
|
|
271
|
+
const newIndex = index + direction;
|
|
272
|
+
if (newIndex < 0 || newIndex >= this.sortedColumns.length) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const newValue = [...this.sortedColumns];
|
|
276
|
+
newValue.splice(index, 1);
|
|
277
|
+
newValue.splice(newIndex, 0, column);
|
|
278
|
+
this.$emit('update:columns', newValue);
|
|
279
|
+
}
|
|
280
|
+
|
|
241
281
|
reorderColumns({ detail }) {
|
|
242
282
|
const { index: fromIndex } = detail.draggablePayload;
|
|
243
283
|
const { index: toIndex, last } = detail.dropzonePayload;
|
|
@@ -51,23 +51,24 @@
|
|
|
51
51
|
v-if="column.visible !== false"
|
|
52
52
|
:data-column="k"
|
|
53
53
|
:style="column.grow ? `left: ${column.left}px; flex-grow: 1` : `width: ${column.width}px; max-width: ${column.width}px; left: ${column.left}px;`"
|
|
54
|
-
:class="{'justify-content-end': column.align === 'end', 'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'flex-grow-1': column.grow, '
|
|
54
|
+
:class="{'justify-content-end': column.align === 'end', 'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'flex-grow-1': column.grow, 'editable': column.editable && editable}"
|
|
55
55
|
class="table-view-item-value d-flex h-100">
|
|
56
|
+
<div class="table-view-item-value-content" :class="{'px-2': !(column.editable && editable)}">
|
|
56
57
|
<slot :name="`column.${column.property}`" :toggle="() => $emit('toggle', item)" :level="level" :editable="column.editable && editable" :item="item" :column="column" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)">
|
|
57
58
|
<template v-if="column.editable && editable && (!editableProperty || item[editableProperty])">
|
|
58
59
|
<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">
|
|
59
|
-
<itf-text-field class="w-100" v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
60
|
-
<itf-text-field class="w-100" v-if="column.type === 'number'" type="number" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
60
|
+
<itf-text-field class="w-100 h-100" v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
61
|
+
<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)" />
|
|
61
62
|
<itf-hours-field
|
|
62
|
-
class="w-100"
|
|
63
|
+
class="w-100 h-100"
|
|
63
64
|
placeholder="00h 00m"
|
|
64
65
|
v-else-if="column.type === 'time'"
|
|
65
66
|
:hours="getValue(item, column)"
|
|
66
67
|
@update:hours="updateValue(item, $event, n, column)"
|
|
67
68
|
/>
|
|
68
|
-
<itf-textarea class="w-100" :rows="1" autogrow v-else-if="column.type === 'textarea'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
69
|
-
<itf-money-field class="w-100" currency-disabled :currency="currency" :currencies="currencies" v-else-if="column.type === 'money'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
70
|
-
<itf-select class="w-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>
|
|
69
|
+
<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)" />
|
|
70
|
+
<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)" />
|
|
71
|
+
<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>
|
|
71
72
|
</slot>
|
|
72
73
|
</template>
|
|
73
74
|
<div v-else class="h-100 align-items-center d-flex w-100">
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
</slot>
|
|
77
78
|
</div>
|
|
78
79
|
</slot>
|
|
80
|
+
</div>
|
|
79
81
|
</div>
|
|
80
82
|
</template>
|
|
81
83
|
<div class="table-view-item-value extra"></div>
|
|
@@ -2,8 +2,7 @@ import { storiesOf } from '@storybook/vue';
|
|
|
2
2
|
import ITFSettings from '../../ITFSettings';
|
|
3
3
|
import itfApp from '../app/App.vue';
|
|
4
4
|
import itfButton from '../button/Button.vue';
|
|
5
|
-
import itfTable from './
|
|
6
|
-
import itfTable2 from './Table2.vue';
|
|
5
|
+
import itfTable from './Table2.vue';
|
|
7
6
|
import itfSelect from '../select/Select.vue';
|
|
8
7
|
|
|
9
8
|
const exampleData = [{
|
|
@@ -79,15 +78,16 @@ ITFSettings.currencies = [
|
|
|
79
78
|
];
|
|
80
79
|
|
|
81
80
|
storiesOf('Common', module)
|
|
82
|
-
.add('
|
|
81
|
+
.add('Table', () => ({
|
|
83
82
|
components: {
|
|
84
|
-
itfTable,
|
|
85
83
|
itfButton,
|
|
86
|
-
|
|
84
|
+
itfTable,
|
|
87
85
|
itfSelect
|
|
88
86
|
},
|
|
89
87
|
data() {
|
|
90
88
|
return {
|
|
89
|
+
selectedIds: [],
|
|
90
|
+
sorting: 'Description',
|
|
91
91
|
list: Array.from({length: 20}).map((_, i) => ({
|
|
92
92
|
Id: i,
|
|
93
93
|
text: `Рахунок ✅`,
|
|
@@ -140,7 +140,9 @@ storiesOf('Common', module)
|
|
|
140
140
|
"title": { "en_US": "Description", "uk_UA": "Прізвище" },
|
|
141
141
|
"type": "text",
|
|
142
142
|
"editable": true,
|
|
143
|
-
"sortable":
|
|
143
|
+
"sortable": true,
|
|
144
|
+
"filtrable": true,
|
|
145
|
+
icon: 'money',
|
|
144
146
|
width: 200,
|
|
145
147
|
minWidth: 100,
|
|
146
148
|
maxWidth: 300
|
|
@@ -153,7 +155,7 @@ storiesOf('Common', module)
|
|
|
153
155
|
"copy": true,
|
|
154
156
|
"editable": true,
|
|
155
157
|
"sortable": false,
|
|
156
|
-
icon: '
|
|
158
|
+
icon: 'card',
|
|
157
159
|
width: 200,
|
|
158
160
|
minWidth: 100,
|
|
159
161
|
maxWidth: 300
|
|
@@ -164,6 +166,7 @@ storiesOf('Common', module)
|
|
|
164
166
|
"type": "money",
|
|
165
167
|
"editable": true,
|
|
166
168
|
"sortable": false,
|
|
169
|
+
icon: 'calendar',
|
|
167
170
|
width: 200,
|
|
168
171
|
minWidth: 100,
|
|
169
172
|
maxWidth: 300
|
|
@@ -174,6 +177,7 @@ storiesOf('Common', module)
|
|
|
174
177
|
"type": "time",
|
|
175
178
|
"editable": true,
|
|
176
179
|
"sortable": false,
|
|
180
|
+
icon: 'person',
|
|
177
181
|
width: 200,
|
|
178
182
|
minWidth: 100,
|
|
179
183
|
maxWidth: 300
|
|
@@ -182,6 +186,7 @@ storiesOf('Common', module)
|
|
|
182
186
|
"property": "Amount",
|
|
183
187
|
"title": { "en_US": "Amount", "uk_UA": "Прізвище" },
|
|
184
188
|
"type": "money",
|
|
189
|
+
icon: 'text',
|
|
185
190
|
"sortable": false,
|
|
186
191
|
width: 200,
|
|
187
192
|
minWidth: 100,
|
|
@@ -327,13 +332,18 @@ storiesOf('Common', module)
|
|
|
327
332
|
}
|
|
328
333
|
</pre>
|
|
329
334
|
<h3>Example</h3>
|
|
330
|
-
|
|
335
|
+
|
|
336
|
+
<itf-table
|
|
331
337
|
add-new-rows
|
|
338
|
+
striped
|
|
332
339
|
@new="onAdd"
|
|
333
340
|
state-name="test"
|
|
334
341
|
:schema="schema"
|
|
335
342
|
:columns.sync="columns2" :rows="list2"
|
|
343
|
+
v-model="selectedIds"
|
|
336
344
|
show-summary
|
|
345
|
+
id-property="Id"
|
|
346
|
+
:sorting.sync="sorting"
|
|
337
347
|
column-sorting column-resizing show-add-column show-grouping @add-column="onAdd">
|
|
338
348
|
<template #format.employee="{ item }">
|
|
339
349
|
{{item.EmployeeId}}
|
|
@@ -346,14 +356,15 @@ storiesOf('Common', module)
|
|
|
346
356
|
:get-option-label="item => item.Name"
|
|
347
357
|
:options="[{ Id: 1, Name: 'Vitalii Savchuk' }]" />
|
|
348
358
|
</template>
|
|
349
|
-
</itf-
|
|
359
|
+
</itf-table>
|
|
350
360
|
|
|
351
|
-
<itf-
|
|
361
|
+
<itf-table
|
|
352
362
|
editable
|
|
353
363
|
add-new-rows
|
|
354
364
|
@new="onAdd"
|
|
355
365
|
state-name="test"
|
|
356
366
|
:schema="schema"
|
|
367
|
+
v-model="selectedIds"
|
|
357
368
|
:columns.sync="columns2" :rows="list2"
|
|
358
369
|
show-summary
|
|
359
370
|
column-sorting column-resizing show-add-column show-grouping @add-column="onAdd">
|
|
@@ -368,7 +379,7 @@ storiesOf('Common', module)
|
|
|
368
379
|
:get-option-label="item => item.Name"
|
|
369
380
|
:options="[{ Id: 1, Name: 'Vitalii Savchuk' }]" />
|
|
370
381
|
</template>
|
|
371
|
-
</itf-
|
|
382
|
+
</itf-table>
|
|
372
383
|
|
|
373
384
|
<br />
|
|
374
385
|
<br />
|
|
@@ -396,192 +407,3 @@ storiesOf('Common', module)
|
|
|
396
407
|
|
|
397
408
|
</div>`,
|
|
398
409
|
}))
|
|
399
|
-
|
|
400
|
-
.add('Table', () => ({
|
|
401
|
-
components: {
|
|
402
|
-
itfApp,
|
|
403
|
-
itfTable,
|
|
404
|
-
itfButton
|
|
405
|
-
},
|
|
406
|
-
data() {
|
|
407
|
-
return {
|
|
408
|
-
from: '2021-01-16',
|
|
409
|
-
to: null,
|
|
410
|
-
dates: [],
|
|
411
|
-
customDays: {
|
|
412
|
-
'2021-10-21': { text: '🎉', class: 'test' }
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
sorting: {},
|
|
416
|
-
columns: [{
|
|
417
|
-
text: 'Employee',
|
|
418
|
-
name: 'Employee',
|
|
419
|
-
min: 250,
|
|
420
|
-
max: 250
|
|
421
|
-
}, {
|
|
422
|
-
text: 'Total',
|
|
423
|
-
name: 'Total',
|
|
424
|
-
min: 150,
|
|
425
|
-
max: 150
|
|
426
|
-
}, {
|
|
427
|
-
text: 'FTE',
|
|
428
|
-
name: 'FTE',
|
|
429
|
-
min: 100,
|
|
430
|
-
max: 100
|
|
431
|
-
}, {
|
|
432
|
-
text: 'Position',
|
|
433
|
-
name: 'Position',
|
|
434
|
-
min: 200,
|
|
435
|
-
max: 200
|
|
436
|
-
}, {
|
|
437
|
-
text: 'Office',
|
|
438
|
-
name: 'Office',
|
|
439
|
-
min: 150,
|
|
440
|
-
max: 150
|
|
441
|
-
}, {
|
|
442
|
-
text: 'Internal',
|
|
443
|
-
name: 'MinutesInternal',
|
|
444
|
-
min: 150,
|
|
445
|
-
max: 150,
|
|
446
|
-
sortable: true
|
|
447
|
-
}, {
|
|
448
|
-
text: 'External',
|
|
449
|
-
name: 'MinutesExternal',
|
|
450
|
-
min: 150,
|
|
451
|
-
max: 150,
|
|
452
|
-
sortable: true
|
|
453
|
-
}, {
|
|
454
|
-
text: 'Compensation (Internal)',
|
|
455
|
-
name: 'AmountInternal',
|
|
456
|
-
min: 200,
|
|
457
|
-
max: 200
|
|
458
|
-
}, {
|
|
459
|
-
text: 'Compensation (External)',
|
|
460
|
-
name: 'AmountExternal',
|
|
461
|
-
min: 150,
|
|
462
|
-
max: 150
|
|
463
|
-
}, {
|
|
464
|
-
text: 'Bonus/Commission',
|
|
465
|
-
name: 'AmountShare',
|
|
466
|
-
min: 150,
|
|
467
|
-
max: 150
|
|
468
|
-
}, {
|
|
469
|
-
text: 'Actions',
|
|
470
|
-
name: 'Notes',
|
|
471
|
-
min: 80,
|
|
472
|
-
max: 80
|
|
473
|
-
}],
|
|
474
|
-
list2: [
|
|
475
|
-
{
|
|
476
|
-
summary: true,
|
|
477
|
-
Employee: 'Total asda das dasd ada dad adaddas',
|
|
478
|
-
Total: 100,
|
|
479
|
-
FTE: 1.0,
|
|
480
|
-
Position: 'Developer',
|
|
481
|
-
MinutesInternal: '10h 20m',
|
|
482
|
-
MinutesExternal: '10h 20m',
|
|
483
|
-
AmountInternal: 1000,
|
|
484
|
-
AmountExternal: 2000,
|
|
485
|
-
AmountShare: 200,
|
|
486
|
-
Notes: 'Test'
|
|
487
|
-
}
|
|
488
|
-
],
|
|
489
|
-
list: [
|
|
490
|
-
{
|
|
491
|
-
summary: true,
|
|
492
|
-
Employee: 'Total',
|
|
493
|
-
Total: 100,
|
|
494
|
-
FTE: 1.0,
|
|
495
|
-
Position: 'Developer',
|
|
496
|
-
MinutesInternal: '10h 20m',
|
|
497
|
-
MinutesExternal: '10h 20m',
|
|
498
|
-
AmountInternal: 1000,
|
|
499
|
-
AmountExternal: 2000,
|
|
500
|
-
AmountShare: 200,
|
|
501
|
-
Notes: 'Test'
|
|
502
|
-
},
|
|
503
|
-
...exampleData,
|
|
504
|
-
{
|
|
505
|
-
summary: true,
|
|
506
|
-
Employee: 'Subtotal',
|
|
507
|
-
Total: 100,
|
|
508
|
-
FTE: 1.0,
|
|
509
|
-
Position: 'Developer',
|
|
510
|
-
MinutesInternal: '10h 20m',
|
|
511
|
-
MinutesExternal: '10h 20m',
|
|
512
|
-
AmountInternal: 1000,
|
|
513
|
-
AmountExternal: 2000,
|
|
514
|
-
AmountShare: 200,
|
|
515
|
-
Notes: 'Test'
|
|
516
|
-
},
|
|
517
|
-
...exampleData,
|
|
518
|
-
{
|
|
519
|
-
summary: true,
|
|
520
|
-
Employee: 'Subtotal',
|
|
521
|
-
Total: 100,
|
|
522
|
-
FTE: 1.0,
|
|
523
|
-
Position: 'Developer',
|
|
524
|
-
MinutesInternal: '10h 20m',
|
|
525
|
-
MinutesExternal: '10h 20m',
|
|
526
|
-
AmountInternal: 1000,
|
|
527
|
-
AmountExternal: 2000,
|
|
528
|
-
AmountShare: 200,
|
|
529
|
-
Notes: 'Test'
|
|
530
|
-
},
|
|
531
|
-
...exampleData
|
|
532
|
-
]
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
methods: {
|
|
536
|
-
submit() {
|
|
537
|
-
this.$refs.form.doValidation();
|
|
538
|
-
},
|
|
539
|
-
reset() {
|
|
540
|
-
this.$refs.form.resetValidation();
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
template: `<div>
|
|
544
|
-
<p>You need wrap whole application with this tag</p>
|
|
545
|
-
|
|
546
|
-
<h2>Usage</h2>
|
|
547
|
-
|
|
548
|
-
<pre>
|
|
549
|
-
|
|
550
|
-
<itf-datepicker></itf-datepicker>
|
|
551
|
-
|
|
552
|
-
<button @click="$showSuccess('Success')">Show success</button>
|
|
553
|
-
<button @click="$showError('Error')">Show error</button>
|
|
554
|
-
<button @click="$try(() => { throw new Error('Invalid function'); })">Try function with error</button>
|
|
555
|
-
</pre>
|
|
556
|
-
|
|
557
|
-
<h2>With Scroll</h2>
|
|
558
|
-
|
|
559
|
-
{{sorting}}
|
|
560
|
-
|
|
561
|
-
<itf-button secondary>
|
|
562
|
-
<svg height="21" viewBox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" transform="translate(2 5)"><path d="m8.5 11c3.1296136 0 5.9629469-1.83333333 8.5-5.5-2.5370531-3.66666667-5.3703864-5.5-8.5-5.5-3.12961358 0-5.96294692 1.83333333-8.5 5.5 2.53705308 3.66666667 5.37038642 5.5 8.5 5.5z"/><path d="m8.5 2c.18463928 0 .36593924.01429736.54285316.04184538-.02850842.148891-.04285316.30184762-.04285316.45815462 0 1.38071187 1.1192881 2.5 2.5 2.5.156307 0 .3092636-.01434474.4576252-.04178957.0280774.17585033.0423748.35715029.0423748.54178957 0 1.93299662-1.5670034 3.5-3.5 3.5-1.93299662 0-3.5-1.56700338-3.5-3.5s1.56700338-3.5 3.5-3.5z"/></g></svg>
|
|
563
|
-
Export
|
|
564
|
-
</itf-button>
|
|
565
|
-
|
|
566
|
-
<itf-table
|
|
567
|
-
small
|
|
568
|
-
:sorting.sync="sorting"
|
|
569
|
-
sticky-header
|
|
570
|
-
sticky-column
|
|
571
|
-
sticky-last-column
|
|
572
|
-
:columns="columns"
|
|
573
|
-
:rows="list"
|
|
574
|
-
hoverable
|
|
575
|
-
striped
|
|
576
|
-
>
|
|
577
|
-
<template #column.Employee="{ item }">
|
|
578
|
-
{{item.Employee}}
|
|
579
|
-
</template>
|
|
580
|
-
<template #column.Total.summary="{ item }">
|
|
581
|
-
<strong>12</strong><br/>
|
|
582
|
-
<small>50% від загальної кількості</small>
|
|
583
|
-
</template>
|
|
584
|
-
</itf-table>
|
|
585
|
-
|
|
586
|
-
</div>`,
|
|
587
|
-
}));
|