@itfin/components 2.0.16 → 2.0.18
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/datepicker/DateGranularityPicker.vue +2 -1
- package/src/components/datepicker/PeriodPicker.vue +39 -182
- package/src/components/datepicker/PeriodPickerInline.vue +187 -0
- package/src/components/datepicker/index.stories.js +4 -0
- package/src/components/filter/FilterBadge.vue +22 -3
- package/src/components/filter/FilterFacetsList.vue +14 -5
- package/src/components/filter/FilterPanel.vue +155 -41
- package/src/components/icon/components/nomi-export.vue +4 -0
- package/src/components/icon/components/nomi-lock.vue +4 -0
- package/src/components/icon/icons.js +292 -292
package/package.json
CHANGED
|
@@ -129,7 +129,7 @@ class itfDateGranularityPicker extends Vue {
|
|
|
129
129
|
@Prop({ type: [String, Date], default: ''}) maxDate;
|
|
130
130
|
@Prop(Boolean) disabled;
|
|
131
131
|
|
|
132
|
-
granularity = '
|
|
132
|
+
granularity = 'monthly';
|
|
133
133
|
|
|
134
134
|
get granularities() {
|
|
135
135
|
return [
|
|
@@ -137,6 +137,7 @@ class itfDateGranularityPicker extends Vue {
|
|
|
137
137
|
{ title: 'Quarterly', value: 'quarterly' },
|
|
138
138
|
{ title: 'Monthly', value: 'monthly' },
|
|
139
139
|
{ title: 'Weekly', value: 'weekly' },
|
|
140
|
+
{ title: 'Daily', value: 'daily' },
|
|
140
141
|
{ title: 'Custom', value: 'manual' },
|
|
141
142
|
];
|
|
142
143
|
}
|
|
@@ -11,85 +11,27 @@
|
|
|
11
11
|
:placeholder="placeholder"
|
|
12
12
|
/>
|
|
13
13
|
<div style="display: none">
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<div class="col">
|
|
22
|
-
<itf-button block @click="setYear(prevYear)">
|
|
23
|
-
{{prevYear}}
|
|
24
|
-
</itf-button>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="col">
|
|
27
|
-
<itf-button color="outline-primary" block>
|
|
28
|
-
{{year}}
|
|
29
|
-
</itf-button>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="col">
|
|
32
|
-
<itf-button block @click="setYear(nextYear)">
|
|
33
|
-
{{nextYear}}
|
|
34
|
-
</itf-button>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="col text-end">
|
|
37
|
-
<itf-button @click="setYear(nextYear)">
|
|
38
|
-
<itf-icon name="chevron_right" />
|
|
39
|
-
</itf-button>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<itf-button block class="mb-3" :class="{'btn-whole': !isCurrentYear()}" :primary="isCurrentYear()" @click="onYearSelect(year)">
|
|
44
|
-
{{ $t('components.wholeYear') }}
|
|
45
|
-
</itf-button>
|
|
46
|
-
|
|
47
|
-
<div class="itf-periodpicker__quarters">
|
|
48
|
-
<div
|
|
49
|
-
v-for="quarter of quarters"
|
|
50
|
-
:key="quarter.Number"
|
|
51
|
-
class="itf-periodpicker__quarter"
|
|
52
|
-
:class="{ 'active': isOnlyQuarter(quarter.Number), 'active-inside': isCurrentQuarter(quarter.Number) }">
|
|
53
|
-
<div class="px-3 pt-2" @click="onQuarterSelect([quarter.Months[0], quarter.Months[2]])">
|
|
54
|
-
<small><b>QUARTER</b></small><br>
|
|
55
|
-
<span class="quarter-number">{{ quarter.Number }}</span>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<div class="itf-periodpicker__months">
|
|
59
|
-
<itf-button
|
|
60
|
-
class="itf-periodpicker__month px-1"
|
|
61
|
-
v-for="month of quarter.Months"
|
|
62
|
-
:key="month"
|
|
63
|
-
:primary="isCurrentMonth(month)"
|
|
64
|
-
@click="onMonthSelect(month)"
|
|
65
|
-
>
|
|
66
|
-
{{ month | formatMonth }}
|
|
67
|
-
</itf-button>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
14
|
+
<itf-period-picker-inline
|
|
15
|
+
ref="dropdown"
|
|
16
|
+
class="itf-periodpicker__dropdown"
|
|
17
|
+
v-model="value"
|
|
18
|
+
:value-format="valueFormat"
|
|
19
|
+
@input="onInput"
|
|
20
|
+
/>
|
|
72
21
|
</div>
|
|
73
22
|
</div>
|
|
74
23
|
</template>
|
|
75
24
|
<script>
|
|
76
25
|
import { Vue, Component, Prop, Inject } from 'vue-property-decorator';
|
|
77
|
-
import { DateTime } from 'luxon';
|
|
78
26
|
import tippy from 'tippy.js';
|
|
79
|
-
import
|
|
80
|
-
import
|
|
27
|
+
import itfPeriodPickerInline from "./PeriodPickerInline.vue";
|
|
28
|
+
import {DateTime} from "luxon";
|
|
81
29
|
import ITFSettings from '../../ITFSettings';
|
|
82
30
|
|
|
83
31
|
export default @Component({
|
|
84
32
|
name: 'itfPeriodPicker',
|
|
85
33
|
components: {
|
|
86
|
-
|
|
87
|
-
itfButton
|
|
88
|
-
},
|
|
89
|
-
filters: {
|
|
90
|
-
formatMonth(month) {
|
|
91
|
-
return DateTime.local().set({ month }).toFormat('MMM');
|
|
92
|
-
}
|
|
34
|
+
itfPeriodPickerInline
|
|
93
35
|
}
|
|
94
36
|
})
|
|
95
37
|
class itfPeriodPicker extends Vue {
|
|
@@ -97,51 +39,12 @@ class itfPeriodPicker extends Vue {
|
|
|
97
39
|
|
|
98
40
|
@Prop({ type: Array }) value;
|
|
99
41
|
@Prop({ type: String, default: 'ISO' }) valueFormat;
|
|
100
|
-
@Prop({ type: String }) displayFormat;
|
|
101
42
|
@Prop({ type: String, default: 'bottom-start' }) placement;
|
|
102
|
-
@Prop({ type: String, default: 'days', validator: (value) => ['days', 'months', 'years'].includes(value) }) startView;
|
|
103
|
-
@Prop({ type: Boolean, default: false }) onlyCalendar;
|
|
104
43
|
@Prop({ type: String, default: '' }) placeholder;
|
|
105
|
-
|
|
106
|
-
year = null;
|
|
44
|
+
@Prop({ type: String }) displayFormat;
|
|
107
45
|
|
|
108
46
|
focused = false;
|
|
109
47
|
|
|
110
|
-
tooltip = null;
|
|
111
|
-
|
|
112
|
-
get quarters() {
|
|
113
|
-
return [
|
|
114
|
-
{ Name: `${this.$t('components.quarter')} 1`, Months: [1, 2, 3], Number: 1 },
|
|
115
|
-
{ Name: `${this.$t('components.quarter')} 2`, Months: [4, 5, 6], Number: 2 },
|
|
116
|
-
{ Name: `${this.$t('components.quarter')} 3`, Months: [7, 8, 9], Number: 3 },
|
|
117
|
-
{ Name: `${this.$t('components.quarter')} 4`, Months: [10, 11, 12], Number: 4 },
|
|
118
|
-
];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get dateFormat() {
|
|
122
|
-
return this.displayFormat || ITFSettings.defaultDisplayDateFormat;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
get nextYear() {
|
|
126
|
-
return this.year + 1;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get prevYear() {
|
|
130
|
-
return this.year - 1;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
setYear(year) {
|
|
134
|
-
this.year = year;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
isInvalid() {
|
|
138
|
-
return this.itemLabel && this.itemLabel.isHasError();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
isSuccess() {
|
|
142
|
-
return this.itemLabel && this.itemLabel.isHasSuccess();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
48
|
mounted() {
|
|
146
49
|
const context = this.$el.closest('.itf-append-context') || document.body;
|
|
147
50
|
this.tooltip = tippy(this.$refs.input, {
|
|
@@ -149,30 +52,17 @@ class itfPeriodPicker extends Vue {
|
|
|
149
52
|
interactiveDebounce: 75,
|
|
150
53
|
animation: 'scale',
|
|
151
54
|
arrow: true,
|
|
152
|
-
content: this.$refs.dropdown,
|
|
55
|
+
content: this.$refs.dropdown.$el,
|
|
153
56
|
allowHTML: true,
|
|
154
57
|
trigger: 'click',
|
|
155
58
|
interactive: true,
|
|
156
59
|
placement: this.placement,
|
|
157
60
|
appendTo: context,
|
|
158
61
|
});
|
|
159
|
-
this.year = (this.value && this.value[0]) ? this.valueAsLuxon[0].year : DateTime.local().year;
|
|
160
62
|
}
|
|
161
63
|
|
|
162
|
-
get
|
|
163
|
-
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
if (this.valueFormat === 'ISO') {
|
|
167
|
-
return [
|
|
168
|
-
DateTime.fromISO(this.value[0]),
|
|
169
|
-
DateTime.fromISO(this.value[1]),
|
|
170
|
-
];
|
|
171
|
-
}
|
|
172
|
-
return [
|
|
173
|
-
DateTime.fromFormat(this.value[0], this.valueFormat),
|
|
174
|
-
DateTime.fromFormat(this.value[1], this.valueFormat),
|
|
175
|
-
];
|
|
64
|
+
get dateFormat() {
|
|
65
|
+
return this.displayFormat || ITFSettings.defaultDisplayDateFormat;
|
|
176
66
|
}
|
|
177
67
|
|
|
178
68
|
get displayText() {
|
|
@@ -183,12 +73,29 @@ class itfPeriodPicker extends Vue {
|
|
|
183
73
|
if (!this.valueAsLuxon || this.valueAsLuxon.length < 2) {
|
|
184
74
|
return [];
|
|
185
75
|
}
|
|
76
|
+
console.info(this.valueAsLuxon);
|
|
186
77
|
return [
|
|
187
78
|
this.valueAsLuxon[0].toFormat(this.dateFormat),
|
|
188
79
|
this.valueAsLuxon[1].toFormat(this.dateFormat)
|
|
189
80
|
];
|
|
190
81
|
}
|
|
191
82
|
|
|
83
|
+
get valueAsLuxon() {
|
|
84
|
+
if (!this.value || this.value.length < 2) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (this.valueFormat === 'ISO') {
|
|
88
|
+
return [
|
|
89
|
+
DateTime.fromISO(this.value[0]),
|
|
90
|
+
DateTime.fromISO(this.value[1]),
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
return [
|
|
94
|
+
DateTime.fromFormat(this.value[0], this.valueFormat),
|
|
95
|
+
DateTime.fromFormat(this.value[1], this.valueFormat),
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
|
|
192
99
|
onFocus() {
|
|
193
100
|
this.focused = true;
|
|
194
101
|
}
|
|
@@ -197,71 +104,21 @@ class itfPeriodPicker extends Vue {
|
|
|
197
104
|
this.focused = false;
|
|
198
105
|
}
|
|
199
106
|
|
|
200
|
-
|
|
201
|
-
this
|
|
202
|
-
this.tooltip.hide();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
isCurrentMonth(month) {
|
|
206
|
-
if (!this.valueAsLuxon) {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
return Number(this.valueAsLuxon[0].toFormat('M')) === month && Number(this.valueAsLuxon[1].toFormat('M')) === month;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
isOnlyQuarter(quarter) {
|
|
213
|
-
if (!this.valueAsLuxon) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
return this.isCurrentQuarter(quarter) && this.valueAsLuxon[0].month !== this.valueAsLuxon[1].month;
|
|
107
|
+
isInvalid() {
|
|
108
|
+
return this.itemLabel && this.itemLabel.isHasError();
|
|
217
109
|
}
|
|
218
110
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
return this.valueAsLuxon[0].quarter === quarter && this.valueAsLuxon[1].quarter === quarter;
|
|
111
|
+
isSuccess() {
|
|
112
|
+
return this.itemLabel && this.itemLabel.isHasSuccess();
|
|
224
113
|
}
|
|
225
114
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
return this.valueAsLuxon[0].hasSame(this.valueAsLuxon[0].startOf('year'), 'day')
|
|
231
|
-
&& this.valueAsLuxon[1].hasSame(this.valueAsLuxon[0].endOf('year'), 'day');
|
|
115
|
+
selectInlineDate(date) {
|
|
116
|
+
this.$emit('input', date);
|
|
232
117
|
}
|
|
233
118
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
this.$emit('input', []);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
this.$emit('input', [
|
|
240
|
-
(this.valueFormat === 'ISO') ? start.toISO() : start.toFormat(this.valueFormat),
|
|
241
|
-
(this.valueFormat === 'ISO') ? end.toISO() : end.toFormat(this.valueFormat),
|
|
242
|
-
]);
|
|
119
|
+
onInput(val) {
|
|
120
|
+
this.$emit('input', val);
|
|
243
121
|
this.tooltip.hide();
|
|
244
122
|
}
|
|
245
|
-
|
|
246
|
-
onYearSelect(year) {
|
|
247
|
-
this.updateValue(
|
|
248
|
-
DateTime.local().set({ year }).startOf('year'),
|
|
249
|
-
DateTime.local().set({ year }).endOf('year'),
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
onMonthSelect(month) {
|
|
254
|
-
this.updateValue(
|
|
255
|
-
DateTime.local().set({ month, year: this.year }).startOf('month'),
|
|
256
|
-
DateTime.local().set({ month, year: this.year }).endOf('month'),
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
onQuarterSelect([startMonth, endMonth]) {
|
|
261
|
-
this.updateValue(
|
|
262
|
-
DateTime.local().set({ month: startMonth, year: this.year }).startOf('quarter'),
|
|
263
|
-
DateTime.local().set({ month: endMonth, year: this.year }).endOf('quarter'),
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
123
|
}
|
|
267
124
|
</script>
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="row mb-3">
|
|
4
|
+
<div class="col">
|
|
5
|
+
<itf-button icon @click="setYear(prevYear)">
|
|
6
|
+
<itf-icon name="chevron_left" />
|
|
7
|
+
</itf-button>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="col">
|
|
10
|
+
<itf-button block @click="setYear(prevYear)">
|
|
11
|
+
{{prevYear}}
|
|
12
|
+
</itf-button>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="col">
|
|
15
|
+
<itf-button color="outline-primary" block>
|
|
16
|
+
{{year}}
|
|
17
|
+
</itf-button>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="col">
|
|
20
|
+
<itf-button block @click="setYear(nextYear)">
|
|
21
|
+
{{nextYear}}
|
|
22
|
+
</itf-button>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="col text-end">
|
|
25
|
+
<itf-button icon @click="setYear(nextYear)">
|
|
26
|
+
<itf-icon name="chevron_right" />
|
|
27
|
+
</itf-button>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<itf-button block class="mb-3" :class="{'btn-whole': !isCurrentYear()}" :primary="isCurrentYear()" @click="onYearSelect(year)">
|
|
32
|
+
{{ $t('components.wholeYear') }}
|
|
33
|
+
</itf-button>
|
|
34
|
+
|
|
35
|
+
<div class="itf-periodpicker__quarters">
|
|
36
|
+
<div
|
|
37
|
+
v-for="quarter of quarters"
|
|
38
|
+
:key="quarter.Number"
|
|
39
|
+
class="itf-periodpicker__quarter"
|
|
40
|
+
:class="{ 'active': isOnlyQuarter(quarter.Number), 'active-inside': isCurrentQuarter(quarter.Number) }">
|
|
41
|
+
<div class="px-3 pt-2" @click="onQuarterSelect([quarter.Months[0], quarter.Months[2]])">
|
|
42
|
+
<small><b>{{ $t('components.quarter') }}</b></small><br>
|
|
43
|
+
<span class="quarter-number">{{ quarter.Number }}</span>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="itf-periodpicker__months">
|
|
47
|
+
<itf-button
|
|
48
|
+
class="itf-periodpicker__month px-1"
|
|
49
|
+
v-for="month of quarter.Months"
|
|
50
|
+
:key="month"
|
|
51
|
+
:primary="isCurrentMonth(month)"
|
|
52
|
+
@click="onMonthSelect(month)"
|
|
53
|
+
>
|
|
54
|
+
{{ month | formatMonth }}
|
|
55
|
+
</itf-button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<script>
|
|
62
|
+
import { Vue, Component, Prop } from 'vue-property-decorator';
|
|
63
|
+
import { DateTime } from 'luxon';
|
|
64
|
+
import itfIcon from '../icon/Icon';
|
|
65
|
+
import itfButton from '../button/Button';
|
|
66
|
+
|
|
67
|
+
export default @Component({
|
|
68
|
+
name: 'itfPeriodPickerInline',
|
|
69
|
+
components: {
|
|
70
|
+
itfIcon,
|
|
71
|
+
itfButton
|
|
72
|
+
},
|
|
73
|
+
filters: {
|
|
74
|
+
formatMonth(month) {
|
|
75
|
+
return DateTime.local().set({ month }).toFormat('MMM');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
class itfPeriodPickerInline extends Vue {
|
|
80
|
+
@Prop({ type: Array }) value;
|
|
81
|
+
@Prop({ type: String, default: 'ISO' }) valueFormat;
|
|
82
|
+
|
|
83
|
+
year = null;
|
|
84
|
+
|
|
85
|
+
get quarters() {
|
|
86
|
+
return [
|
|
87
|
+
{ Name: `${this.$t('components.quarter')} 1`, Months: [1, 2, 3], Number: 1 },
|
|
88
|
+
{ Name: `${this.$t('components.quarter')} 2`, Months: [4, 5, 6], Number: 2 },
|
|
89
|
+
{ Name: `${this.$t('components.quarter')} 3`, Months: [7, 8, 9], Number: 3 },
|
|
90
|
+
{ Name: `${this.$t('components.quarter')} 4`, Months: [10, 11, 12], Number: 4 },
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get nextYear() {
|
|
95
|
+
return this.year + 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get prevYear() {
|
|
99
|
+
return this.year - 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setYear(year) {
|
|
103
|
+
this.year = year;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
mounted() {
|
|
107
|
+
this.year = (this.value && this.value[0]) ? this.valueAsLuxon[0].year : DateTime.local().year;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get valueAsLuxon() {
|
|
111
|
+
if (!this.value || this.value.length < 2) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
if (this.valueFormat === 'ISO') {
|
|
115
|
+
return [
|
|
116
|
+
DateTime.fromISO(this.value[0]),
|
|
117
|
+
DateTime.fromISO(this.value[1]),
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
return [
|
|
121
|
+
DateTime.fromFormat(this.value[0], this.valueFormat),
|
|
122
|
+
DateTime.fromFormat(this.value[1], this.valueFormat),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
isCurrentMonth(month) {
|
|
127
|
+
if (!this.valueAsLuxon) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return Number(this.valueAsLuxon[0].toFormat('M')) === month && Number(this.valueAsLuxon[1].toFormat('M')) === month;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
isOnlyQuarter(quarter) {
|
|
134
|
+
if (!this.valueAsLuxon) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
return this.isCurrentQuarter(quarter) && this.valueAsLuxon[0].month !== this.valueAsLuxon[1].month;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
isCurrentQuarter(quarter) {
|
|
141
|
+
if (!this.valueAsLuxon) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return this.valueAsLuxon[0].quarter === quarter && this.valueAsLuxon[1].quarter === quarter;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
isCurrentYear() {
|
|
148
|
+
if (!this.valueAsLuxon) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
return this.valueAsLuxon[0].hasSame(this.valueAsLuxon[0].startOf('year'), 'day')
|
|
152
|
+
&& this.valueAsLuxon[1].hasSame(this.valueAsLuxon[0].endOf('year'), 'day');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
updateValue(start, end) {
|
|
156
|
+
if (!start) {
|
|
157
|
+
this.$emit('input', []);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.$emit('input', [
|
|
161
|
+
(this.valueFormat === 'ISO') ? start.toISO() : start.toFormat(this.valueFormat),
|
|
162
|
+
(this.valueFormat === 'ISO') ? end.toISO() : end.toFormat(this.valueFormat),
|
|
163
|
+
]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
onYearSelect(year) {
|
|
167
|
+
this.updateValue(
|
|
168
|
+
DateTime.local().set({ year }).startOf('year'),
|
|
169
|
+
DateTime.local().set({ year }).endOf('year'),
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
onMonthSelect(month) {
|
|
174
|
+
this.updateValue(
|
|
175
|
+
DateTime.local().set({ month, year: this.year }).startOf('month'),
|
|
176
|
+
DateTime.local().set({ month, year: this.year }).endOf('month'),
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
onQuarterSelect([startMonth, endMonth]) {
|
|
181
|
+
this.updateValue(
|
|
182
|
+
DateTime.local().set({ month: startMonth, year: this.year }).startOf('quarter'),
|
|
183
|
+
DateTime.local().set({ month: endMonth, year: this.year }).endOf('quarter'),
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
@@ -2,6 +2,7 @@ import { storiesOf } from '@storybook/vue';
|
|
|
2
2
|
import itfDatePicker from './DatePicker.vue';
|
|
3
3
|
import itfMonthPicker from './MonthPicker.vue';
|
|
4
4
|
import itfPeriodPicker from './PeriodPicker';
|
|
5
|
+
import itfPeriodPickerInline from './PeriodPickerInline';
|
|
5
6
|
import itfDatePickerInline from './DatePickerInline.vue';
|
|
6
7
|
import itfDateRangePicker from './DateRangePicker.vue';
|
|
7
8
|
import itfDateRangePickerInline from './DateRangePickerInline.vue';
|
|
@@ -13,6 +14,7 @@ storiesOf('Common', module)
|
|
|
13
14
|
itfApp,
|
|
14
15
|
itfDatePicker,
|
|
15
16
|
itfPeriodPicker,
|
|
17
|
+
itfPeriodPickerInline,
|
|
16
18
|
itfMonthPicker,
|
|
17
19
|
itfDateRangePicker,
|
|
18
20
|
itfDatePickerInline,
|
|
@@ -86,6 +88,8 @@ storiesOf('Common', module)
|
|
|
86
88
|
<h2>Period</h2>
|
|
87
89
|
|
|
88
90
|
<itf-period-picker :value="dateRange" v-model.lazy="dateRange"></itf-period-picker>
|
|
91
|
+
|
|
92
|
+
<itf-period-picker-inline :value="dateRange" v-model.lazy="dateRange"></itf-period-picker-inline>
|
|
89
93
|
</itf-app>
|
|
90
94
|
</div>`,
|
|
91
95
|
}));
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
<div>
|
|
15
|
+
<div class="px-2">
|
|
16
16
|
<template v-if="type === 'list'">
|
|
17
17
|
<a
|
|
18
18
|
v-for="(item, n) in options.items"
|
|
@@ -29,6 +29,13 @@
|
|
|
29
29
|
@input="onFilterChange({ value: $event })"
|
|
30
30
|
/>
|
|
31
31
|
</template>
|
|
32
|
+
<template v-else-if="type === 'timeframe'">
|
|
33
|
+
<itf-period-picker-inline
|
|
34
|
+
:value="value.value"
|
|
35
|
+
value-format="yyyy-MM-dd"
|
|
36
|
+
@input="onFilterChange({ value: $event })"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
32
39
|
<template v-else-if="type === 'date'">
|
|
33
40
|
<itf-date-picker-inline
|
|
34
41
|
style="margin: -.5rem"
|
|
@@ -61,6 +68,7 @@
|
|
|
61
68
|
<style lang="scss">
|
|
62
69
|
:root {
|
|
63
70
|
--filter-badge__default-color: #475266;
|
|
71
|
+
--filter-badge__icon-color: #A7AFBB;
|
|
64
72
|
--filter-badge__default-border-color: #0000001A;
|
|
65
73
|
--filter-badge__default-bg-color: transparent;
|
|
66
74
|
--filter-badge__default-bg-color-hover: #1A4A970D;
|
|
@@ -75,6 +83,10 @@
|
|
|
75
83
|
--filter-badge__padding-y: .5rem;
|
|
76
84
|
--filter-badge__padding-x: .75rem;
|
|
77
85
|
}
|
|
86
|
+
body[data-theme="dark"] {
|
|
87
|
+
--filter-badge__default-border-color: #FFFFFF1A;
|
|
88
|
+
--filter-badge__selected-color: #efd877;
|
|
89
|
+
}
|
|
78
90
|
.filter-pill {
|
|
79
91
|
align-items: center;
|
|
80
92
|
font-size: 14px;
|
|
@@ -87,6 +99,7 @@
|
|
|
87
99
|
|
|
88
100
|
.icon {
|
|
89
101
|
margin: -2px;
|
|
102
|
+
color: var(--filter-badge__icon-color);
|
|
90
103
|
}
|
|
91
104
|
&:hover {
|
|
92
105
|
background-color: var(--filter-badge__default-bg-color-hover);
|
|
@@ -95,16 +108,20 @@
|
|
|
95
108
|
&.filter-not-default-pill {
|
|
96
109
|
background-color: var(--filter-badge__selected-bg-color);
|
|
97
110
|
outline: 1px solid var(--filter-badge__selected-color);
|
|
111
|
+
|
|
112
|
+
.icon { color: var(--filter-badge__selected-color) }
|
|
98
113
|
}
|
|
99
114
|
&.filter-invalid-pill {
|
|
100
115
|
background-color: var(--filter-badge__invalid-bg-color);
|
|
116
|
+
|
|
117
|
+
.icon { color: var(--filter-badge__invalid-color) }
|
|
101
118
|
}
|
|
102
119
|
&.filter-pill__default-value {
|
|
103
120
|
padding: var(--filter-badge__padding-y) var(--filter-badge__padding-x);
|
|
104
121
|
}
|
|
105
122
|
}
|
|
106
123
|
.filter-pill__label {
|
|
107
|
-
color: var(--filter-badge__default-color);
|
|
124
|
+
//color: var(--filter-badge__default-color);
|
|
108
125
|
padding: var(--filter-badge__padding-y) 0 var(--filter-badge__padding-y) var(--filter-badge__padding-x);
|
|
109
126
|
max-width: 330px;
|
|
110
127
|
text-overflow: ellipsis;
|
|
@@ -129,7 +146,7 @@
|
|
|
129
146
|
padding: 0 calc(var(--filter-badge__padding-x) / 2) 0 calc(var(--filter-badge__padding-x) / 4);
|
|
130
147
|
|
|
131
148
|
svg {
|
|
132
|
-
color: var(--filter-badge__default-color);
|
|
149
|
+
//color: var(--filter-badge__default-color);
|
|
133
150
|
}
|
|
134
151
|
&.filter-pill__icon-invalid svg {
|
|
135
152
|
color: var(--filter-badge__invalid-color);
|
|
@@ -146,6 +163,7 @@ import itfButton from '../button/Button';
|
|
|
146
163
|
import itfDropdown from '../dropdown/Dropdown.vue';
|
|
147
164
|
import itfDatePickerInline from '../datepicker/DatePickerInline.vue';
|
|
148
165
|
import itfDateRangePickerInline from '../datepicker/DateRangePickerInline.vue';
|
|
166
|
+
import itfPeriodPickerInline from '../datepicker/PeriodPickerInline.vue'
|
|
149
167
|
import itfTextField from '../text-field/TextField.vue';
|
|
150
168
|
import FilterFacetsList from './FilterFacetsList';
|
|
151
169
|
import FilterAmountRange from './FilterAmountRange.vue';
|
|
@@ -157,6 +175,7 @@ export default @Component({
|
|
|
157
175
|
itfDropdown,
|
|
158
176
|
itfDatePickerInline,
|
|
159
177
|
itfDateRangePickerInline,
|
|
178
|
+
itfPeriodPickerInline,
|
|
160
179
|
itfTextField,
|
|
161
180
|
FilterFacetsList,
|
|
162
181
|
FilterAmountRange
|
|
@@ -19,16 +19,18 @@
|
|
|
19
19
|
<div class="text-muted text-center py-4">{{ $t('components.filter.noResults') }}</div>
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
|
-
<div
|
|
22
|
+
<div class="facets-list">
|
|
23
|
+
<div v-for="(val, n) of mappedValues" :key="n" class="dropdown-item px-2" :class="{'active': val.isSelected}" @click="onFilterClick(val)">
|
|
23
24
|
<span class="facet-name text-dark d-flex align-items-center">
|
|
24
25
|
<itf-checkbox ungrouped :value="val.isSelected" class="m-0" />
|
|
25
|
-
<div class="w-100 text-truncate">{{ val.label }}</div>
|
|
26
|
+
<div class="w-100 text-truncate">{{ val.label }} <span v-if="val.description" class="small"><br/>{{ val.description }}</span></div>
|
|
26
27
|
</span>
|
|
27
|
-
<span class="facet-stat
|
|
28
|
+
<span v-if="val.count" class="facet-stat">
|
|
28
29
|
{{ val.count }}
|
|
29
30
|
<span class="facet-bar"><span :style="{'--bar-width': `${getPercent(val)}%`}" class="facet-bar-progress" /></span>
|
|
30
31
|
</span>
|
|
31
32
|
</div>
|
|
33
|
+
</div>
|
|
32
34
|
|
|
33
35
|
<itf-button default class="mt-1" v-if="hasMore" small block @click="toggleMore">
|
|
34
36
|
<span v-if="showMore">{{ $t('components.filter.hideMore', { count: visibleList.length }) }}</span>
|
|
@@ -43,7 +45,13 @@
|
|
|
43
45
|
padding: 0 0.75rem .5rem;
|
|
44
46
|
margin: 0 -.75rem .75rem;
|
|
45
47
|
}
|
|
48
|
+
.facets-list {
|
|
49
|
+
max-height: 50vh;
|
|
50
|
+
overflow: auto;
|
|
51
|
+
}
|
|
46
52
|
.dropdown-item {
|
|
53
|
+
--bs-dropdown-link-active-bg: rgba(var(--bs-primary-rgb), .25);
|
|
54
|
+
|
|
47
55
|
cursor: pointer;
|
|
48
56
|
display: inline-flex;
|
|
49
57
|
-webkit-box-align: center;
|
|
@@ -52,7 +60,7 @@
|
|
|
52
60
|
justify-content: space-between;
|
|
53
61
|
position: relative;
|
|
54
62
|
box-sizing: border-box;
|
|
55
|
-
height: 1.75rem;
|
|
63
|
+
min-height: 1.75rem;
|
|
56
64
|
width: 100%;
|
|
57
65
|
font-size: 0.875rem;
|
|
58
66
|
line-height: 1.25rem;
|
|
@@ -74,10 +82,11 @@
|
|
|
74
82
|
.facet-name {
|
|
75
83
|
min-width: 0;
|
|
76
84
|
text-align: left;
|
|
85
|
+
line-height: 100%;
|
|
77
86
|
white-space: nowrap;
|
|
78
87
|
|
|
79
88
|
.itf-checkbox {
|
|
80
|
-
min-height:
|
|
89
|
+
min-height: 1.25rem;
|
|
81
90
|
}
|
|
82
91
|
}
|
|
83
92
|
.facet-stat {
|