@itfin/components 1.3.57 → 1.3.59
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/components/pagination/Pagination.vue +42 -34
- package/src/components/table/Table2.vue +4 -1
- package/src/components/table/TableGroup.vue +2 -0
- package/src/components/table/TableHeader.vue +11 -5
- package/src/components/table/TableRows.vue +1 -1
- package/src/components/table/table2.scss +15 -5
- package/src/locales/en.js +5 -0
- package/src/locales/uk.js +5 -0
package/package.json
CHANGED
|
@@ -1,49 +1,57 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
<nav aria-label="Page navigation example" class="d-flex">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
3
|
+
<nav aria-label="Page navigation example" class="d-flex justify-content-between align-items-center">
|
|
4
|
+
<div class="d-flex gap-2 align-items-center">
|
|
5
|
+
<ul class="pagination itf-pagination ps-3 mb-0">
|
|
6
|
+
<li
|
|
6
7
|
v-for="(page, n) in pagesArr"
|
|
7
8
|
:key="n"
|
|
8
9
|
class="page-item"
|
|
9
10
|
:class="{'active': page.current, 'disabled': !page.active && !page.current }"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
>
|
|
12
|
+
<a v-if="page.type === 'prev'" href="" class="page-link" :aria-label="$t('components.pagination.previous')" @click.prevent="onPage(page.number)">
|
|
13
|
+
<itf-icon name="chevron_left" aria-hidden="true" />
|
|
14
|
+
<span class="sr-only">{{$t('components.pagination.previous')}}</span>
|
|
15
|
+
</a>
|
|
16
|
+
<a v-else-if="page.type === 'first'" class="page-link" href="" @click.prevent="onPage(page.number)">{{page.number}}</a>
|
|
17
|
+
<a v-else-if="page.type === 'page'" class="page-link" href="" @click.prevent="onPage(page.number)">{{page.number}}</a>
|
|
18
|
+
<a v-else-if="page.type === 'last'" class="page-link" href="" @click.prevent="onPage(page.number)">{{page.number}}</a>
|
|
19
|
+
<span v-else-if="page.type === 'more'" class="page-link">…</span>
|
|
20
|
+
<a v-if="page.type === 'next'" href="" class="page-link" :aria-label="$t('components.pagination.previous')" @click.prevent="onPage(page.number)">
|
|
21
|
+
<span class="sr-only">{{$t('components.pagination.next')}}</span>
|
|
22
|
+
<itf-icon name="chevron_right" aria-hidden="true" />
|
|
23
|
+
</a>
|
|
24
|
+
</li>
|
|
25
|
+
</ul>
|
|
26
|
+
<!--div>
|
|
27
|
+
1-25 of {{length}} items
|
|
28
|
+
</div-->
|
|
29
|
+
</div>
|
|
25
30
|
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
<div class="d-flex gap-2 align-items-center">
|
|
32
|
+
<span>{{$t('components.pagination.itemsPerPage')}}</span>
|
|
33
|
+
<itf-dropdown
|
|
34
|
+
toggle
|
|
35
|
+
:button-options="{ secondary: true, small: true }"
|
|
36
|
+
v-if="showSize"
|
|
37
|
+
class="itf-pagination-select"
|
|
38
|
+
:value="size"
|
|
39
|
+
>
|
|
40
|
+
<template #button>
|
|
41
|
+
<span>{{size}}</span>
|
|
42
|
+
</template>
|
|
43
|
+
<div class="dropdown-item" v-for="option in perPageOptions" :key="option.value" @click="onPerPage(option.value)">
|
|
44
|
+
{{option.title}}
|
|
45
|
+
</div>
|
|
46
|
+
</itf-dropdown>
|
|
47
|
+
</div>
|
|
36
48
|
</nav>
|
|
37
49
|
|
|
38
50
|
</template>
|
|
39
|
-
<style lang="scss" scoped>
|
|
40
|
-
.itf-pagination-select
|
|
41
|
-
{}
|
|
42
|
-
</style>
|
|
43
51
|
<script>
|
|
44
52
|
import { Vue, Component, Model, Prop } from 'vue-property-decorator';
|
|
45
53
|
import itfIcon from '../icon/Icon.vue';
|
|
46
|
-
import
|
|
54
|
+
import itfDropdown from "../dropdown/Dropdown.vue";
|
|
47
55
|
|
|
48
56
|
const MIN_PAGES_BLOCKS = 2;
|
|
49
57
|
const MAX_PAGES_BLOCKS = 6;
|
|
@@ -56,7 +64,7 @@ const PER_PAGE_OPTIONS = [
|
|
|
56
64
|
export default @Component({
|
|
57
65
|
name: 'itfPagination',
|
|
58
66
|
components: {
|
|
59
|
-
|
|
67
|
+
itfDropdown,
|
|
60
68
|
itfIcon
|
|
61
69
|
}
|
|
62
70
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
|
-
<div class="itf-table2 scrollable scrollable-x" :class="{'permanent-checkboxes': selectedIds.length}" :style="{ '--indicator-area-width': `${indicatorType === 'none' ? 1 : indicatorWidth}px` }">
|
|
3
|
+
<div class="itf-table2 scrollable scrollable-x" :class="{'table-striped': striped, 'table-absolute': absolute, 'permanent-checkboxes': selectedIds.length}" :style="{ '--indicator-area-width': `${indicatorType === 'none' ? 1 : indicatorWidth}px` }">
|
|
4
4
|
<itf-checkbox-group v-model="selectedIds">
|
|
5
5
|
<template v-for="(group, index) in groups">
|
|
6
6
|
<div class="table-view-body">
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
:striped="striped"
|
|
35
35
|
:expanded-ids="expandedIds"
|
|
36
36
|
:css-property="cssProperty"
|
|
37
|
+
:sorting.sync="_sorting"
|
|
37
38
|
@update:expanded-ids="$emit('update:expanded-ids', $event)"
|
|
38
39
|
@new="$emit('new', $event)"
|
|
39
40
|
@add-column="$emit('add-column', $event)"
|
|
@@ -85,6 +86,7 @@ class itfTable2 extends Vue {
|
|
|
85
86
|
@Prop({ type: String, default: null }) stateName; // save state to storage
|
|
86
87
|
@Prop({ type: Object, default: () => ({}) }) schema;
|
|
87
88
|
@ModelSync('value', 'input', { type: Array, default: () => ([]) }) selectedIds;
|
|
89
|
+
@PropSync('sorting', { type: Object, default: () => ({}) }) _sorting;
|
|
88
90
|
@Prop({ type: Array, default: () => [] }) expandedIds;
|
|
89
91
|
@Prop() currency;
|
|
90
92
|
@Prop() currencies;
|
|
@@ -100,6 +102,7 @@ class itfTable2 extends Vue {
|
|
|
100
102
|
@Prop(Boolean) editable;
|
|
101
103
|
@Prop(Boolean) expandedAll;
|
|
102
104
|
@Prop(Boolean) striped;
|
|
105
|
+
@Prop(Boolean) absolute;
|
|
103
106
|
|
|
104
107
|
state = {
|
|
105
108
|
selectedIds: [],
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
:no-select-all="noSelectAll"
|
|
45
45
|
:selected-ids="selectedIds"
|
|
46
46
|
:indicatorType="indicatorType"
|
|
47
|
+
:sorting.sync="_sorting"
|
|
47
48
|
@update:selectedIds="$emit('update:selectedIds', $event)"
|
|
48
49
|
@update:columns="$emit('update:columns', $event)"
|
|
49
50
|
@add-column="$emit('add-column', $event)"
|
|
@@ -347,6 +348,7 @@ class itfTableGroup extends Vue {
|
|
|
347
348
|
@Prop(Boolean) striped;
|
|
348
349
|
@Prop() indicatorWidth;
|
|
349
350
|
@Prop() cssProperty;
|
|
351
|
+
@PropSync('sorting', { type: Object, default: () => ({}) }) _sorting;
|
|
350
352
|
@Prop({ type: String, default: null }) indicatorType;
|
|
351
353
|
@Prop({type: String, default: function() { return this.$t('components.table.new'); } }) newLabel;
|
|
352
354
|
@Prop({type: Object, default: () => ({})}) schema;
|
|
@@ -33,24 +33,24 @@
|
|
|
33
33
|
v-draggable="{ handle: true, payload: { index: n, item: column }, mirror: {yAxis:false} }">
|
|
34
34
|
<itf-dropdown text append-to-body shadow ref="dropdown" class="w-100" :disabled="noColumnMenu">
|
|
35
35
|
<template #button>
|
|
36
|
-
<span class="itf-table2__header-title" :title="column.title[locale] || column.title['en_US']">
|
|
36
|
+
<span class="itf-table2__header-title text-truncate" :title="column.title[locale] || column.title['en_US']" :class="{'ms-auto': column.align === 'end'}">
|
|
37
37
|
<span v-if="column.icon" :class="column.icon"></span>
|
|
38
38
|
{{column.title[locale] || column.title['en_US']}}
|
|
39
39
|
<div v-if="column.prefix" class="itf-table2__subtitle" v-text="column.prefix" />
|
|
40
40
|
</span>
|
|
41
|
-
|
|
41
|
+
<itf-icon v-if="_sorting[column.property]" :name="_sorting[column.property] === 'asc' ? 'arrow_up' : 'arrow_down'" :size="16" class="ms-1" />
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<div v-if="column.sortable">
|
|
45
|
-
<a class="dropdown-item d-flex align-items-center" href="javascript:;">
|
|
45
|
+
<a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="sortBy(column, 'asc')">
|
|
46
46
|
<itf-icon name="arrow_up" :size="16" class="me-1" />
|
|
47
47
|
{{$t('components.table.sortAscending')}}
|
|
48
48
|
</a>
|
|
49
49
|
</div>
|
|
50
50
|
<div v-if="column.sortable">
|
|
51
|
-
<a class="dropdown-item d-flex align-items-center" href="javascript:;">
|
|
51
|
+
<a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="sortBy(column, 'desc')">
|
|
52
52
|
<itf-icon name="arrow_down" :size="16" class="me-1" />
|
|
53
|
-
{{$t('components.table.
|
|
53
|
+
{{$t('components.table.sortDescending')}}
|
|
54
54
|
</a>
|
|
55
55
|
</div>
|
|
56
56
|
<div v-if="column.groupable">
|
|
@@ -159,6 +159,7 @@ class itfTableHeader extends Vue {
|
|
|
159
159
|
@Inject() tableEl;
|
|
160
160
|
|
|
161
161
|
@PropSync('columns', { type: Array, default: () => ([]) }) sortedColumns;
|
|
162
|
+
@PropSync('sorting', { type: Object, default: () => ({}) }) _sorting;
|
|
162
163
|
@Prop({ type: Array, default: () => ([]) }) rows;
|
|
163
164
|
@Prop({ type: Array, default: () => ([]) }) selectedIds;
|
|
164
165
|
@Prop({ type: Object, default: () => ({}) }) schema;
|
|
@@ -335,5 +336,10 @@ class itfTableHeader extends Vue {
|
|
|
335
336
|
onSortColumns(items) {
|
|
336
337
|
this.$emit('update:columns', items);
|
|
337
338
|
}
|
|
339
|
+
|
|
340
|
+
sortBy(column, order) {
|
|
341
|
+
console.info({ [column.property]: order });
|
|
342
|
+
this.$emit('update:sorting', { [column.property]: order });
|
|
343
|
+
}
|
|
338
344
|
}
|
|
339
345
|
</script>
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
v-if="column.visible !== false"
|
|
52
52
|
:data-column="k"
|
|
53
53
|
:style="`width: ${column.width}px; max-width: ${column.width}px; left: ${column.left}px;`"
|
|
54
|
-
:class="{'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'flex-grow-1': column.grow, 'px-2': !(column.editable && editable), 'editable': column.editable && editable}"
|
|
54
|
+
:class="{'justify-content-end': column.align === 'end', 'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'flex-grow-1': column.grow, 'px-2': !(column.editable && editable), 'editable': column.editable && editable}"
|
|
55
55
|
class="table-view-item-value d-flex h-100">
|
|
56
56
|
<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
57
|
<template v-if="column.editable && editable">
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
--itf-table-border-color: #e1e1e1;
|
|
3
3
|
--itf-table-header-bg: #f8f8f8;
|
|
4
4
|
--itf-table-selected-bg: #f0f0f0;
|
|
5
|
+
--itf-table-alt-bg: #f9f9f9;
|
|
5
6
|
//--itf-table-border-color: #e1e1e1;
|
|
6
7
|
//--itf-table-header-bg: #f9faf5;
|
|
7
8
|
//--itf-table-selected-bg: #cbd6f4;
|
|
@@ -42,6 +43,18 @@ body[data-theme="dark"] {
|
|
|
42
43
|
overflow-x: scroll;
|
|
43
44
|
padding-right: 4px;
|
|
44
45
|
}
|
|
46
|
+
&.table-absolute {
|
|
47
|
+
position: absolute;
|
|
48
|
+
left: 0;
|
|
49
|
+
top: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
}
|
|
53
|
+
&.table-striped {
|
|
54
|
+
.table-view-item:nth-child(even) {
|
|
55
|
+
--itf-table2-row-bg: var(--itf-table-alt-bg);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
45
58
|
|
|
46
59
|
&__header {
|
|
47
60
|
background-color: var(--itf-table-header-bg);
|
|
@@ -207,11 +220,8 @@ body[data-theme="dark"] {
|
|
|
207
220
|
|
|
208
221
|
background-color: var(--itf-table2-row-bg);
|
|
209
222
|
|
|
210
|
-
&.selected {
|
|
211
|
-
--itf-table2-row-bg: var(--itf-table-selected-bg);
|
|
212
|
-
}
|
|
213
|
-
&:hover {
|
|
214
|
-
--itf-table2-row-bg: var(--itf-table-selected-bg);
|
|
223
|
+
&.selected, &:hover {
|
|
224
|
+
--itf-table2-row-bg: var(--itf-table-selected-bg) !important;
|
|
215
225
|
}
|
|
216
226
|
|
|
217
227
|
.indicator {
|
package/src/locales/en.js
CHANGED
|
@@ -120,5 +120,10 @@ module.exports = {
|
|
|
120
120
|
calculateCountNotEmpty: 'Count not empty',
|
|
121
121
|
calculatePercentEmpty: 'Percent empty',
|
|
122
122
|
calculatePercentNotEmpty: 'Percent not empty',
|
|
123
|
+
},
|
|
124
|
+
pagination: {
|
|
125
|
+
itemsPerPage: 'Items per page',
|
|
126
|
+
previous: 'Previous',
|
|
127
|
+
next: 'Next'
|
|
123
128
|
}
|
|
124
129
|
};
|
package/src/locales/uk.js
CHANGED
|
@@ -97,6 +97,11 @@ module.exports = {
|
|
|
97
97
|
copyToClipboard: {
|
|
98
98
|
copyingToClipboardWasSuccessful: 'Скопійовано в буфер',
|
|
99
99
|
},
|
|
100
|
+
pagination: {
|
|
101
|
+
itemsPerPage: 'К-ть на сторінці',
|
|
102
|
+
previous: 'Попередня',
|
|
103
|
+
next: 'Наступна',
|
|
104
|
+
},
|
|
100
105
|
table: {
|
|
101
106
|
new: 'Додати',
|
|
102
107
|
noResults: 'Немає записів',
|