@itfin/components 1.3.41 → 1.3.43
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 +3 -2
- package/src/components/table/Table2.vue +5 -0
- package/src/components/table/TableBody.vue +19 -4
- package/src/components/table/TableGroup.vue +5 -2
- package/src/components/text-field/MoneyField.vue +7 -1
- package/src/helpers/formatters.js +5 -2
- package/src/helpers/formatters.spec.js +17 -0
- package/src/components/table/table.js +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itfin/components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.43",
|
|
4
4
|
"author": "Vitalii Savchuk <esvit666@gmail.com>",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
39
39
|
"@shopify/draggable": "^1.0.0-beta.8",
|
|
40
40
|
"@vue/composition-api": "^1.7.1",
|
|
41
|
+
"@vue/vue2-jest": "^27.0.0",
|
|
41
42
|
"@vue/web-component-wrapper": "^1.3.0",
|
|
42
43
|
"air-datepicker": "^3.3.5",
|
|
43
44
|
"bootstrap": "^5.3.x",
|
|
@@ -56,7 +57,6 @@
|
|
|
56
57
|
"vue-virtual-scroller": "^1.1.2"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@vue/cli-service": "^5.0.1",
|
|
60
60
|
"@babel/eslint-parser": "^7.19.1",
|
|
61
61
|
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
|
|
62
62
|
"@babel/plugin-syntax-numeric-separator": "^7.10.4",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@vue/cli-plugin-babel": "^5.0.8",
|
|
68
68
|
"@vue/cli-plugin-eslint": "^5.0.8",
|
|
69
69
|
"@vue/cli-plugin-unit-jest": "^5.0.8",
|
|
70
|
+
"@vue/cli-service": "^5.0.1",
|
|
70
71
|
"@vue/eslint-config-airbnb": "^7.0.0",
|
|
71
72
|
"@vue/test-utils": "^1.1.1",
|
|
72
73
|
"babel-eslint": "^10.1.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
:style="`width: ${column.width}px; max-width: ${column.width}px; left: ${column.left}px;`"
|
|
39
39
|
:class="{'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'flex-grow-1': column.grow, 'px-2': !(column.editable && editable), 'editable': column.editable && editable}"
|
|
40
40
|
class="table-view-item-value d-flex h-100">
|
|
41
|
-
<slot :name="`column.${column.property}`" :item="item" :column="column">
|
|
41
|
+
<slot :name="`column.${column.property}`" :editable="column.editable && editable" :item="item" :column="column" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)">
|
|
42
42
|
<template v-if="column.editable && editable">
|
|
43
43
|
<slot :name="`edit.${column.type}`" :update="(val) => updateValue(item, val, n, column)" :value="getValue(item, column)" :item="item" :column="column">
|
|
44
44
|
<itf-text-field class="w-100" v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
@@ -49,11 +49,12 @@
|
|
|
49
49
|
:hours="getValue(item, column)"
|
|
50
50
|
@update:hours="updateValue(item, $event, n, column)"
|
|
51
51
|
/>
|
|
52
|
-
<itf-textarea class="w-100" :rows="
|
|
52
|
+
<itf-textarea class="w-100" :rows="1" autogrow v-else-if="column.type === 'textarea'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" />
|
|
53
53
|
<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)" />
|
|
54
|
+
<itf-select class="w-100" v-else-if="column.type === 'select'" :value="getValue(item, column)" @input="updateValue(item, $event, n, column)" :options="column.options"></itf-select>
|
|
54
55
|
</slot>
|
|
55
56
|
</template>
|
|
56
|
-
<div v-else>
|
|
57
|
+
<div v-else class="h-100 align-items-center d-flex w-100">
|
|
57
58
|
<slot :name="`format.${column.type}`" :value="getValue(item, column)" :update="(value) => updateValue(item, value, n, column)" :item="item" :column="column">
|
|
58
59
|
{{getValue(item, column)}}
|
|
59
60
|
</slot>
|
|
@@ -76,15 +77,21 @@
|
|
|
76
77
|
<div class="shadow-area"></div>
|
|
77
78
|
<div class="indicator sticky"></div>
|
|
78
79
|
<div class="table-item-inner">
|
|
79
|
-
<div class="table-view-item-value w-100 align-items-center p-3">
|
|
80
|
+
<div class="table-view-item-value w-100 align-items-center p-3 no-results">
|
|
80
81
|
{{$t('components.table.noResults')}}
|
|
81
82
|
</div>
|
|
83
|
+
<div class="boundary right"></div>
|
|
82
84
|
</div>
|
|
83
85
|
</div>
|
|
84
86
|
</div>
|
|
85
87
|
</div>
|
|
86
88
|
</template>
|
|
87
89
|
<style lang="scss">
|
|
90
|
+
.no-results {
|
|
91
|
+
text-align: center;
|
|
92
|
+
margin-left: -22px;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
}
|
|
88
95
|
.table-row-template {
|
|
89
96
|
display: flex;
|
|
90
97
|
height: 100%;
|
|
@@ -97,6 +104,12 @@
|
|
|
97
104
|
flex-direction: row;
|
|
98
105
|
}
|
|
99
106
|
|
|
107
|
+
.scroller > .table-view-item:last-child {
|
|
108
|
+
.table-item-inner, .indicator {
|
|
109
|
+
border-bottom: 1px solid var(--itf-table-border-color);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
.table-item-inner .extra {
|
|
101
114
|
flex-grow: 1;
|
|
102
115
|
border-color: var(--bs-border-color);
|
|
@@ -203,6 +216,7 @@ import itfTextField from '../text-field/TextField.vue';
|
|
|
203
216
|
import itfMoneyField from '../text-field/MoneyField.vue';
|
|
204
217
|
import itfTextarea from '../text-field/Textarea.vue';
|
|
205
218
|
import itfHoursField from '../text-field/HoursField.vue';
|
|
219
|
+
import itfSelect from '../select/Select.vue';
|
|
206
220
|
// import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
|
207
221
|
|
|
208
222
|
export default @Component({
|
|
@@ -213,6 +227,7 @@ export default @Component({
|
|
|
213
227
|
itfHoursField,
|
|
214
228
|
itfTextarea,
|
|
215
229
|
itfTextField,
|
|
230
|
+
itfSelect,
|
|
216
231
|
// RecycleScroller
|
|
217
232
|
}
|
|
218
233
|
})
|
|
@@ -105,7 +105,9 @@
|
|
|
105
105
|
</span>
|
|
106
106
|
<span v-else>
|
|
107
107
|
<span class="summary-text text-uppercase pe-2">{{getCalculateMethodTitle(column.calculate)}}</span>
|
|
108
|
-
<
|
|
108
|
+
<slot :name="`summary.${column.property}`" :value="getCalculateMethodValue(column.calculate, column)" :raw="!column.calculate.includes('count') && !column.calculate.includes('percent')">
|
|
109
|
+
<span>{{getCalculateMethodValue(column.calculate, column)}}</span>
|
|
110
|
+
</slot>
|
|
109
111
|
</span>
|
|
110
112
|
</span>
|
|
111
113
|
</template>
|
|
@@ -290,7 +292,7 @@
|
|
|
290
292
|
import get from 'lodash/get';
|
|
291
293
|
import sortBy from 'lodash/sortBy';
|
|
292
294
|
import uniq from "lodash/uniq";
|
|
293
|
-
import round from "
|
|
295
|
+
import { round } from "../../helpers/formatters";
|
|
294
296
|
import {Vue, Component, Prop, Watch} from 'vue-property-decorator';
|
|
295
297
|
import itfDropdown from '../dropdown/Dropdown.vue';
|
|
296
298
|
import itfButton from '../button/Button.vue';
|
|
@@ -350,6 +352,7 @@ class itfTableGroup extends Vue {
|
|
|
350
352
|
item.lastPinned = index === pinned.length - 1;
|
|
351
353
|
return item
|
|
352
354
|
});
|
|
355
|
+
console.info(list);
|
|
353
356
|
return list;
|
|
354
357
|
}
|
|
355
358
|
|
|
@@ -50,11 +50,17 @@
|
|
|
50
50
|
position: absolute;
|
|
51
51
|
left: .75rem;
|
|
52
52
|
top: .5rem;
|
|
53
|
+
bottom: .5rem;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
53
56
|
}
|
|
54
57
|
&__currency {
|
|
55
58
|
position: absolute;
|
|
56
59
|
right: .75rem;
|
|
57
|
-
top:
|
|
60
|
+
top: 0;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
58
64
|
.is-invalid &, .is-valid & {
|
|
59
65
|
right: 1.75rem;
|
|
60
66
|
}
|
|
@@ -14,11 +14,11 @@ export function parseHours (str, { hoursInDay } = { hoursInDay: 8 }) {
|
|
|
14
14
|
return isNegative * Math.round(parseFloat(source.replace(',', '.')) * MINUTES_IN_HOUR * SECONDS_IN_MINUTE);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const match = source.match(/^((\d+)d)?\s*((\d+)h)?\s*((\d+)m)?$/);
|
|
17
|
+
const match = source.match(/^((\d+)d)?\s*((\d+)h)?\s*((\d+)m)?\s*((\d+)s)?$/);
|
|
18
18
|
if (!match) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
const [,, days,, hours,, minutes] = match;
|
|
21
|
+
const [,, days,, hours,, minutes,,secs] = match;
|
|
22
22
|
|
|
23
23
|
let seconds = 0;
|
|
24
24
|
if (days) {
|
|
@@ -30,6 +30,9 @@ export function parseHours (str, { hoursInDay } = { hoursInDay: 8 }) {
|
|
|
30
30
|
if (minutes) {
|
|
31
31
|
seconds += Number(minutes) * SECONDS_IN_MINUTE;
|
|
32
32
|
}
|
|
33
|
+
if (secs) {
|
|
34
|
+
seconds += Number(secs);
|
|
35
|
+
}
|
|
33
36
|
return isNegative * seconds;
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseHours
|
|
3
|
+
} from './formatters';
|
|
4
|
+
|
|
5
|
+
describe('Formatters', () => {
|
|
6
|
+
const $t = (str) => str;
|
|
7
|
+
|
|
8
|
+
test('parseHours', () => {
|
|
9
|
+
expect(parseHours('10s')).toEqual(10);
|
|
10
|
+
expect(parseHours('12h')).toEqual(12 * 60 * 60);
|
|
11
|
+
expect(parseHours('10m')).toEqual(10 * 60);
|
|
12
|
+
expect(parseHours('12h 10m')).toEqual(12 * 60 * 60 + 10 * 60);
|
|
13
|
+
expect(parseHours('12h 10s')).toEqual(12 * 60 * 60 + 10);
|
|
14
|
+
expect(parseHours('12h 10m 10s')).toEqual(12 * 60 * 60 + 10 * 60 + 10);
|
|
15
|
+
expect(parseHours('1d 12h 10m 10s')).toEqual(8 * 60 * 60 + 12 * 60 * 60 + 10 * 60 + 10);
|
|
16
|
+
});
|
|
17
|
+
});
|