@itfin/components 1.3.86 → 1.3.87

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.
@@ -1,423 +0,0 @@
1
- <template>
2
- <div>
3
- <template v-if="type === 'string'">
4
- <itf-text-field
5
- delay-input="300"
6
- :prepend-icon="prependIcon"
7
- :clearable="filterClearable"
8
- :placeholder="filter.label"
9
- :value="plainValue"
10
- @input="updateValue(filter.id, $event)"
11
- />
12
- </template>
13
- <template v-if="type === 'range'">
14
- <div class="row">
15
- <div class="col">
16
- <itf-text-field
17
- delay-input="300"
18
- clearable
19
- :placeholder="`${filter.label} (${$t('from')})`"
20
- :value="value[filter.fields[0]]"
21
- @input="updateValue(filter.fields[0], $event)"
22
- />
23
- </div>
24
- <div class="col">
25
- <itf-text-field
26
- delay-input="300"
27
- clearable
28
- :placeholder="`(${$t('to')})`"
29
- :value="value[filter.fields[1]]"
30
- @input="updateValue(filter.fields[1], $event)"
31
- />
32
- </div>
33
- </div>
34
- </template>
35
- <template v-else-if="type === 'list'">
36
- <itf-select
37
- :options="filter.items"
38
- :clearable="filterClearable"
39
- :reduce="(item) => item.value"
40
- :get-option-label="(item) => item.title"
41
- :selectable="(filter.selectable || (() => true))"
42
- :value="plainValue"
43
- :placeholder="filter.label"
44
- :disabled="filter.disable"
45
- @input="updateValue(filter.id, $event)"
46
- >
47
- <template #option="{ option }">
48
- <div>
49
- <span v-if="option.icon">{{ option.icon }}</span>
50
- {{ option.title }}
51
- </div>
52
- </template>
53
- <template #selected-option="{ option }">
54
- <div>
55
- <span v-if="option.icon">{{ option.icon }}</span>
56
- {{ option.title }}
57
- </div>
58
- </template>
59
- </itf-select>
60
- </template>
61
- <template v-else-if="type === 'tree'">
62
- <itf-select
63
- multiple
64
- :clearable="filterClearable"
65
- :placeholder="filter.label"
66
- :value="plainValue"
67
- :options="filter.items"
68
- :reduce="(item) => item.id"
69
- :selectable="(item) => !(item.type && item.type === 'group')"
70
- @input="updateValue(filter.id, $event)"
71
- >
72
- <template #selected-option="{ option }">
73
- <div v-if="option && option.label" class="d-flex align-items-center">
74
- <div>
75
- {{ option.label }}
76
- </div>
77
- </div>
78
- </template>
79
- <template #option="{ option }">
80
- <div v-if="option" class="d-flex align-items-start">
81
- <div :style="{ 'padding-left': `${option.type && option.type === 'group' ? 0 : 20}px` }">
82
- {{ option.label }}
83
- </div>
84
- </div>
85
- </template>
86
- </itf-select>
87
- </template>
88
- <template v-else-if="type === 'project' && hasProjectsAccess">
89
- <project-selector
90
- :placeholder="filter.label"
91
- :rules="[]"
92
- :clearable="filterClearable"
93
- :value="{ Id: plainValue }"
94
- @input="updateValue(filter.id, $event && $event.Id)"
95
- />
96
- </template>
97
- <template v-else-if="type === 'cashflowLine'">
98
- <cashflow-line-selector
99
- class="mb-3"
100
- :value="{ Id: plainValue }"
101
- :rules="[]"
102
- :placeholder="filter.label"
103
- :clearable="filterClearable"
104
- @input="updateValue(filter.id, $event && $event.Id)"
105
- />
106
- </template>
107
- <template v-else-if="(type === 'client' || type === 'counterparty') && isAllowClients">
108
- <client-selector
109
- :type="type === 'counterparty' ? 'vendors' : null"
110
- :placeholder="filter.label"
111
- :rules="[]"
112
- :clearable="filterClearable"
113
- :value="{ Id: plainValue }"
114
- @input="updateValue(filter.id, $event && $event.Id)"
115
- />
116
- </template>
117
- <template v-else-if="(type === 'counterparty2') && isAllowClients">
118
- <counterparty-selector
119
- :placeholder="filter.label"
120
- :rules="[]"
121
- :clearable="filterClearable"
122
- :value="{ Id: plainValue }"
123
- @input="updateValue(filter.id, $event && $event.Id)"
124
- />
125
- </template>
126
- <template v-else-if="type === 'employee' && isCanSeeEmployees">
127
- <employee-selector
128
- :placeholder="filter.label"
129
- :clearable="filterClearable"
130
- :value="{ Id: plainValue }"
131
- @input="updateValue(filter.id, $event && $event.Id)"
132
- />
133
- </template>
134
- <template v-else-if="type === 'businessUnit'">
135
- <business-unit-selector
136
- :placeholder="filter.label"
137
- :clearable="filterClearable"
138
- :value="{ Id: plainValue }"
139
- @input="updateValue(filter.id, $event && $event.Id)"
140
- />
141
- </template>
142
- <template v-else-if="type === 'currency'">
143
- <currency-selector
144
- :placeholder="filter.label"
145
- :clearable="filterClearable"
146
- :value="{ Id: plainValue }"
147
- @input="updateValue(filter.id, $event && $event.Id)"
148
- />
149
- </template>
150
- <template v-else-if="type === 'office'">
151
- <office-selector
152
- :placeholder="filter.label"
153
- :clearable="filterClearable"
154
- :value="{ Id: plainValue }"
155
- @input="updateValue(filter.id, $event && $event.Id)"
156
- />
157
- </template>
158
- <template v-else-if="type === 'account'">
159
- <account-selector
160
- :placeholder="filter.label"
161
- :clearable="filterClearable"
162
- :value="{ Id: plainValue }"
163
- @input="updateValue(filter.id, $event && $event.Id)"
164
- />
165
- </template>
166
- <template v-else-if="type === 'vacancy'">
167
- <vacancy-selector
168
- :placeholder="filter.label"
169
- :clearable="filterClearable"
170
- :value="{ Id: plainValue }"
171
- @input="updateValue(filter.id, $event && $event.Id)"
172
- />
173
- </template>
174
- <template v-else-if="type === 'country'">
175
- <country-selector
176
- :placeholder="filter.label"
177
- :clearable="filterClearable"
178
- :value="plainValue ? { Name: plainValue } : null"
179
- @input="updateValue(filter.id, $event && $event.Name)"
180
- />
181
- </template>
182
- <template v-else-if="type === 'profile' && isProfileAvailable">
183
- <profile-selector
184
- :placeholder="filter.label"
185
- :clearable="filterClearable"
186
- :value="{ Id: plainValue }"
187
- @input="updateValue(filter.id, $event && $event.Id)"
188
- />
189
- </template>
190
- <template v-else-if="type === 'skills'">
191
- <other-skills-selector
192
- :taggable="false"
193
- :placeholder="filter.label"
194
- :clearable="filterClearable"
195
- :value="plainValue"
196
- @input="updateValue(filter.id, $event)"
197
- />
198
- </template>
199
- <template v-else-if="type === 'label'">
200
- <itf-select
201
- :loading="loadingLabels"
202
- :value="plainValue"
203
- :placeholder="filter.label"
204
- :options="prepareLabels"
205
- multiple
206
- :reduce="(item) => item.Id"
207
- :get-option-label="(item) => item.LabelText"
208
- @input="updateValue(filter.id, $event)"
209
- >
210
- <div v-if="filter.conditions" slot="list-header" class="px-2 pb-2">
211
- <itf-segmented-control
212
- class="text-uppercase segmented-control"
213
- :value="value[filter.conditions] || 'and'"
214
- :items="[{Id: 'and', Name: $t('and')}, {Id: 'or', Name: $t('or')}, {Id: 'not', Name: $t('not')}]"
215
- @input="updateValue(filter.conditions, $event)"
216
- />
217
- </div>
218
- </itf-select>
219
- </template>
220
- <template v-else-if="type === 'button'">
221
- <itf-button block secondary :to="{ name: filter.to }">
222
- {{ filter.label }}
223
- </itf-button>
224
- </template>
225
- <template v-else-if="type === 'switch'">
226
- <itf-checkbox
227
- switch
228
- :label="filter.label"
229
- :value="plainValue"
230
- @input="updateValue(filter.id, $event)"
231
- />
232
- </template>
233
- <template v-else-if="type === 'date'">
234
- <itf-date-range-picker
235
- placement="bottom-end"
236
- :value="dateRangeValue"
237
- :placeholder="filter.label"
238
- :clearable="filterClearable"
239
- :disabled="filter.disable"
240
- value-format="yyyy-MM-dd"
241
- @input="updateDateValue($event, filter.fields)"
242
- />
243
- </template>
244
- <template v-else-if="type === 'team'">
245
- <team-selector
246
- :clearable="filterClearable"
247
- :value="{ Id: plainValue }"
248
- @input="updateValue(filter.id, ($event && $event.Id) || null)"
249
- />
250
- </template>
251
- <div v-else-if="type === 'dates'" class="d-flex gap-1">
252
- <div>
253
- <itf-date-picker
254
- placement="bottom-end"
255
- :value="dateRangeValue[0]"
256
- :placeholder="`${filter.label} (From)`"
257
- :clearable="filterClearable"
258
- value-format="yyyy-MM-dd"
259
- @input="updateDateValue([$event, dateRangeValue[1]], filter.fields)"
260
- />
261
- </div>
262
- <div>
263
- <itf-date-picker
264
- placement="bottom-end"
265
- :value="dateRangeValue[1]"
266
- :placeholder="`${filter.label} (To)`"
267
- :clearable="filterClearable"
268
- value-format="yyyy-MM-dd"
269
- @input="updateDateValue([dateRangeValue[0], $event], filter.fields)"
270
- />
271
- </div>
272
- </div>
273
- <template v-else-if="type === 'date-period'">
274
- <itf-period-picker
275
- placement="bottom-end"
276
- :value="dateRangeValue"
277
- value-format="yyyy-MM-dd"
278
- :placeholder="filter.label"
279
- :clearable="filterClearable"
280
- @input="updateDateValue($event, filter.fields)"
281
- />
282
- </template>
283
- </div>
284
- </template>
285
- <style lang="scss" scoped>
286
- .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
287
- z-index: 3 !important;
288
- }
289
- </style>
290
- <script>
291
- import { Component, Model, Prop, Vue } from 'vue-property-decorator';
292
- import itfButton from '@itfin/components/src/components/button/Button';
293
- import itfTextField from '@itfin/components/src/components/text-field/TextField';
294
- import itfSelect from '@itfin/components/src/components/select/Select';
295
- import itfDateRangePicker from '@itfin/components/src/components/datepicker/DateRangePicker';
296
- import itfDatePicker from '@itfin/components/src/components/datepicker/DatePicker';
297
- import itfPeriodPicker from '@itfin/components/src/components/datepicker/PeriodPicker';
298
- import itfCheckbox from '@itfin/components/src/components/checkbox/Checkbox';
299
- import itfSegmentedControl from '@itfin/components/src/components/segmented-control/SegmentedControl';
300
- import ProfileSelector from '~/components/Common/Selectors/ProfileSelector';
301
- import ClientSelector from '~/components/Common/Selectors/ClientSelector';
302
- import CurrencySelector from '~/components/Common/Selectors/CurrencySelector.vue';
303
- import BusinessUnitSelector from '~/components/Common/Selectors/BusinessUnitSelector.vue';
304
- import ProjectSelector from '~/components/Common/Selectors/ProjectSelector';
305
- import EmployeeSelector from '~/components/Common/Selectors/EmployeeSelector';
306
- import CounterpartySelector from '~/components/Common/Selectors/CounterpartySelector.vue';
307
- import OfficeSelector from '~/components/Common/Selectors/OfficeSelector';
308
- import OtherSkillsSelector from '~/components/Skills/OtherSkillsSelector';
309
- import AccountSelector from '~/components/Common/Selectors/AccountSelector';
310
- import VacancySelector from '~/components/Common/Selectors/VacancySelector';
311
- import CountrySelector from '~/components/Common/Selectors/CountrySelector.vue';
312
- import TeamSelector from '~/components/Common/Selectors/TeamSelector.vue';
313
- import CashflowLineSelector from '~/components/Common/Selectors/CashflowLineSelector.vue';
314
-
315
- import {
316
- CLIENTS_VIEW_CLIENTS,
317
- CLIENTS_VIEW_OWN_CLIENTS,
318
- EMPLOYEES_LIST,
319
- PROFILES_CAN_CHANGE_PROFILES,
320
- PROFILES_SEE_PROFILES,
321
- PROJECTS_LIST
322
- } from '~/scopes';
323
-
324
- export default @Component({
325
- name: 'FilterItem',
326
- components: {
327
- BusinessUnitSelector,
328
- CurrencySelector,
329
- itfButton,
330
- itfSelect,
331
- itfCheckbox,
332
- itfTextField,
333
- itfSegmentedControl,
334
- itfDatePicker,
335
- itfDateRangePicker,
336
- itfPeriodPicker,
337
- ProjectSelector,
338
- ProfileSelector,
339
- ClientSelector,
340
- OfficeSelector,
341
- EmployeeSelector,
342
- AccountSelector,
343
- VacancySelector,
344
- OtherSkillsSelector,
345
- CountrySelector,
346
- TeamSelector,
347
- CounterpartySelector,
348
- CashflowLineSelector,
349
- }
350
- })
351
- class FilterItem extends Vue {
352
- @Model('input') value;
353
- @Prop(String) type;
354
- @Prop() filter;
355
- @Prop() labels;
356
- @Prop() loadingLabels;
357
- @Prop() prependIcon;
358
-
359
- get isCanSeeEmployees () {
360
- return this.$scope(EMPLOYEES_LIST);
361
- }
362
-
363
- get isProfileAvailable () {
364
- return this.$scope(PROFILES_CAN_CHANGE_PROFILES, PROFILES_SEE_PROFILES);
365
- }
366
-
367
- get isAllowClients () {
368
- return this.$scope(CLIENTS_VIEW_CLIENTS, CLIENTS_VIEW_OWN_CLIENTS);
369
- }
370
-
371
- get hasProjectsAccess() {
372
- return this.$scope(PROJECTS_LIST);
373
- }
374
-
375
- get plainValue () {
376
- return this.value[this.filter.id];
377
- }
378
-
379
- get dateRangeValue () {
380
- return this.isCustomFilter
381
- ? [
382
- this.value[this.filter.id] && this.value[this.filter.id].from,
383
- this.value[this.filter.id] && this.value[this.filter.id].to
384
- ]
385
- : [
386
- this.value[(this.filter.fields || {})[0] || 'from'],
387
- this.value[(this.filter.fields || {})[1] || 'to']
388
- ];
389
- }
390
-
391
- get prepareLabels () {
392
- return this.labels.map(label => ({ ...label, Color: `#${label.Color}` }));
393
- }
394
-
395
- get filterClearable () {
396
- return typeof this.filter.clearable !== 'undefined' ? this.filter.clearable : true;
397
- }
398
-
399
- get isCustomFilter () {
400
- return this.filter.id.toLowerCase().includes('customfield_');
401
- }
402
-
403
- updateValue (key, value, fields = {}) {
404
- const filter = { ...this.value };
405
- filter[key] = value;
406
- this.$emit('input', filter);
407
- }
408
-
409
- updateDateValue (value, fields = {}) {
410
- const filter = { ...this.value };
411
-
412
- if (this.isCustomFilter) {
413
- const key = this.filter.id;
414
- filter[key] = value[0] && value[1] ? { from: value[0], to: value[1] } : null;
415
- } else {
416
- filter[fields[0] || 'from'] = value[0];
417
- filter[fields[1] || 'to'] = value[1];
418
- }
419
-
420
- this.$emit('input', filter);
421
- }
422
- }
423
- </script>
@@ -1,20 +0,0 @@
1
-
2
-
3
- export function getOperatorsByType(type) {
4
- const operations = [
5
- {
6
- type: 'string',
7
- operators: [
8
- { id: 'eq', title: 'equal', sign: '=' },
9
- { id: 'notEq', title: 'not equal', sign: '≠' },
10
- { id: 'contains', title: 'contains', sign: '∋' },
11
- { id: 'noContains', title: 'not contains', sign: '∌' },
12
- { id: 'startsWith', title: 'starts with', sign: 'A…' },
13
- { id: 'endsWith', title: 'ends with', sign: '…Z' },
14
- // { id: 'exists', title: 'exists', sign: '∃' }
15
- ]
16
- }
17
- ];
18
-
19
- return operations.find((operation) => operation.type === type).operators;
20
- }