@itfin/components 1.3.90 → 1.3.93
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/filter/FilterAmountRange.vue +1 -0
- package/src/components/filter/FilterPanel.vue +15 -6
- package/src/components/panels/Panel.vue +1 -2
- package/src/components/table/Table2.vue +1 -1
- package/src/components/table/TableGroup.vue +1 -1
- package/src/components/table/TableHeader.vue +12 -3
- package/src/components/text-field/MoneyField.vue +1 -1
- package/src/helpers/formatters.js +1 -1
- package/src/helpers/validators.js +1 -1
package/package.json
CHANGED
|
@@ -81,11 +81,12 @@ class FilterPanel extends Vue {
|
|
|
81
81
|
const filter = {};
|
|
82
82
|
const filterValue = {};
|
|
83
83
|
for (const item of this.filters) {
|
|
84
|
-
filter[item.name] = payload[item.name] ? this.formatValue(item, { value: payload[item.name] }) : { isDefault: true, ...item.options.defaultValue };
|
|
85
84
|
if (item.type === 'period') {
|
|
85
|
+
filter[item.name] = payload.from ? this.formatValue(item, { value: [payload.from, payload.to] }) : { isDefault: true, ...item.options.defaultValue };
|
|
86
86
|
filterValue.from = payload.from;
|
|
87
87
|
filterValue.to = payload.to;
|
|
88
88
|
} else {
|
|
89
|
+
filter[item.name] = payload[item.name] ? this.formatValue(item, { value: payload[item.name] }) : { isDefault: true, ...item.options.defaultValue };
|
|
89
90
|
filterValue[item.name] = payload[item.name];
|
|
90
91
|
}
|
|
91
92
|
}
|
|
@@ -97,6 +98,14 @@ class FilterPanel extends Vue {
|
|
|
97
98
|
this.$emit('input', this.filterValue);
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
setFilter(field, value) {
|
|
102
|
+
const facet = this.filters.find(facet => facet.name === field);
|
|
103
|
+
if (!facet) {
|
|
104
|
+
throw new Error(`Facet ${field} not found`);
|
|
105
|
+
}
|
|
106
|
+
this.onFilterChange(facet, { value });
|
|
107
|
+
}
|
|
108
|
+
|
|
100
109
|
onFilterChange(facet, value) {
|
|
101
110
|
this.filter[facet.name] = this.formatValue(facet, value);
|
|
102
111
|
if (facet.type === 'period') {
|
|
@@ -128,11 +137,11 @@ class FilterPanel extends Vue {
|
|
|
128
137
|
formatValue(facet, value) {
|
|
129
138
|
if (facet.type === 'period') {
|
|
130
139
|
if (value.value) {
|
|
131
|
-
let from = DateTime.
|
|
132
|
-
let to = DateTime.
|
|
140
|
+
let from = DateTime.fromFormat(value.value[0], 'yyyy-MM-dd');
|
|
141
|
+
let to = DateTime.fromFormat(value.value[1], 'yyyy-MM-dd');
|
|
133
142
|
if (!from.isValid || !to.isValid) {
|
|
134
|
-
from = DateTime.
|
|
135
|
-
to = DateTime.
|
|
143
|
+
from = DateTime.fromFormat(facet.options.defaultValue.value[0], 'yyyy-MM-dd');
|
|
144
|
+
to = DateTime.fromFormat(facet.options.defaultValue.value[1], 'yyyy-MM-dd');
|
|
136
145
|
}
|
|
137
146
|
const namedItem = this.daysList.find(item => {
|
|
138
147
|
const [start, end] = item.date();
|
|
@@ -141,7 +150,7 @@ class FilterPanel extends Vue {
|
|
|
141
150
|
if (namedItem) {
|
|
142
151
|
value.label = namedItem.title;
|
|
143
152
|
} else {
|
|
144
|
-
value.label = formatRangeDates(from, to);
|
|
153
|
+
value.label = formatRangeDates(from.toJSDate(), to.toJSDate());
|
|
145
154
|
}
|
|
146
155
|
}
|
|
147
156
|
if (facet.options.defaultValue?.value) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<div class="b-panel__expand_text" v-text="title"></div>
|
|
11
11
|
</a>
|
|
12
12
|
</div>
|
|
13
|
-
<div v-if="!nocard" v-show="!collapsed" class="b-panel-header
|
|
13
|
+
<div v-if="!nocard" v-show="!collapsed" class="b-panel-header px-3 pt-3">
|
|
14
14
|
<slot name="header">
|
|
15
15
|
<div>
|
|
16
16
|
<slot name="title">
|
|
@@ -112,7 +112,6 @@
|
|
|
112
112
|
justify-content: space-between;
|
|
113
113
|
min-height: 45px;
|
|
114
114
|
min-width: 0;
|
|
115
|
-
padding: 8px;
|
|
116
115
|
position: sticky;
|
|
117
116
|
top: 0;
|
|
118
117
|
z-index: 10;
|
|
@@ -97,7 +97,7 @@ class itfTable2 extends Vue {
|
|
|
97
97
|
@Prop({ type: String, default: null }) stateName; // save state to storage
|
|
98
98
|
@Prop({ type: Object, default: () => ({}) }) schema;
|
|
99
99
|
@ModelSync('value', 'input', { type: Array, default: () => ([]) }) selectedIds;
|
|
100
|
-
@PropSync('sorting'
|
|
100
|
+
@PropSync('sorting') _sorting;
|
|
101
101
|
@Prop({ type: Array, default: () => [] }) expandedIds;
|
|
102
102
|
@Prop() currency;
|
|
103
103
|
@Prop() currencies;
|
|
@@ -362,7 +362,7 @@ class itfTableGroup extends Vue {
|
|
|
362
362
|
@Prop(Boolean) stickyHeader;
|
|
363
363
|
@Prop() indicatorWidth;
|
|
364
364
|
@Prop() cssProperty;
|
|
365
|
-
@PropSync('sorting'
|
|
365
|
+
@PropSync('sorting') _sorting;
|
|
366
366
|
@Prop({ type: String, default: null }) indicatorType;
|
|
367
367
|
@Prop({type: String, default: function() { return this.$t('components.table.new'); } }) newLabel;
|
|
368
368
|
@Prop({type: Object, default: () => ({})}) schema;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{{getTitle(column.title)}}
|
|
39
39
|
<div v-if="column.prefix" class="itf-table2__subtitle" v-text="column.prefix" />
|
|
40
40
|
</span>
|
|
41
|
-
<itf-icon v-if="
|
|
41
|
+
<itf-icon v-if="sortColumnParams[column.property]" :name="sortColumnParams[column.property] === 'asc' ? 'arrow_up' : 'arrow_down'" :size="16" class="ms-1" />
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<div v-if="column.sortable">
|
|
@@ -186,6 +186,14 @@ class itfTableHeader extends Vue {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
get sortColumnParams() {
|
|
190
|
+
if (typeof this._sorting === 'string'){
|
|
191
|
+
return this._sorting[0] === '-' ? {[this._sorting.substring(1)]: 'desc'} : {[this._sorting]: 'asc'};
|
|
192
|
+
} else {
|
|
193
|
+
return this._sorting;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
189
197
|
getTitle(title) {
|
|
190
198
|
if (typeof title === 'string') {
|
|
191
199
|
return title;
|
|
@@ -350,8 +358,9 @@ class itfTableHeader extends Vue {
|
|
|
350
358
|
}
|
|
351
359
|
|
|
352
360
|
sortBy(column, order) {
|
|
353
|
-
|
|
354
|
-
|
|
361
|
+
let sort = order === 'desc' ? `-${column.property}` : column.property;
|
|
362
|
+
console.info(sort);
|
|
363
|
+
this.$emit('update:sorting', sort);
|
|
355
364
|
}
|
|
356
365
|
}
|
|
357
366
|
</script>
|
|
@@ -51,7 +51,7 @@ export function formatMoney (val, symbol = '', digits = null) {
|
|
|
51
51
|
symbolStr = symbol;
|
|
52
52
|
}
|
|
53
53
|
if (digits === null) {
|
|
54
|
-
digits = symbol
|
|
54
|
+
digits = symbol?.precision ?? symbol?.Precision ?? 2;
|
|
55
55
|
}
|
|
56
56
|
const value = parseFloat(val.toString()).toFixed(digits)
|
|
57
57
|
.replace(/\d(?=(\d{3})+\.)/g, '$&' + thousandSeparator)
|
|
@@ -8,7 +8,7 @@ const LINKED_IN_REGEXP = /(http(s)?:\/\/)?([\w]+\.)?linkedin\.com\/(pub|in|profi
|
|
|
8
8
|
const SPECIAL_CHARS_REGEXP = /^[\w_\-+~,/\\:'"().&*|[\]?# ]+$/i;
|
|
9
9
|
const GREETINGS_REGEXP = /\b(dr|mr|mister|mrs|ms|miss|sir|hello|hi)\b/i;
|
|
10
10
|
const PHONE_REGEXP = /(\+?\(?\+?[0-9]{1,3}\)?[-. ]+([0-9]{2,4})[-. ]?([0-9]{3,5}))|\+?[0-9]{7,}/gi;
|
|
11
|
-
const DOUBLE_REGEXP = /^-?\d{0,11}(\.\d{0,
|
|
11
|
+
const DOUBLE_REGEXP = /^-?\d{0,11}(\.\d{0,8}){0,1}$/;
|
|
12
12
|
const EMAIL_REGEXP = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/g;
|
|
13
13
|
const EMAIL_LIST_REGEXP = /^(\w+((-\w+)|(\.\w+))*@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}\s*?,?\s*?)+$/g;
|
|
14
14
|
const HEX_REGEXP = /[0-9A-Fa-f]{6}/;
|