@firestitch/filter 12.11.7 → 12.12.1
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/app/helpers/create-filter-item.d.ts +1 -1
- package/app/interfaces/items/base.interface.d.ts +1 -0
- package/app/models/items/base-item.d.ts +3 -2
- package/app/services/external-params-controller.service.d.ts +3 -3
- package/app/services/items-store.service.d.ts +4 -4
- package/bundles/firestitch-filter.umd.js +140 -131
- package/bundles/firestitch-filter.umd.js.map +1 -1
- package/esm2015/app/components/filter/filter.component.js +4 -4
- package/esm2015/app/components/filter-chip/filter-chip.component.js +2 -2
- package/esm2015/app/components/filter-drawer/filter-drawer.component.js +2 -2
- package/esm2015/app/components/filters-item/autocomplete/autocomplete.component.js +2 -2
- package/esm2015/app/components/filters-item/autocompletechips/autocompletechips.component.js +2 -2
- package/esm2015/app/components/filters-item/date/date.component.js +2 -2
- package/esm2015/app/components/filters-item/date-range/date-range.component.js +2 -2
- package/esm2015/app/components/filters-item/week/week.component.js +2 -2
- package/esm2015/app/interfaces/items/base.interface.js +1 -1
- package/esm2015/app/models/items/base-item.js +4 -4
- package/esm2015/app/services/external-params-controller.service.js +4 -4
- package/esm2015/app/services/items-store.service.js +16 -8
- package/fesm2015/firestitch-filter.js +653 -645
- package/fesm2015/firestitch-filter.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,12 +2,8 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, Optional, Component, ChangeDetectionStrategy, Inject, InjectionToken, Input, Directive, Self, Pipe, ViewChild, EventEmitter, Output, HostListener, TemplateRef, ViewEncapsulation, ContentChild, HostBinding, NgModule } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, Subject, isObservable, forkJoin, of, fromEvent, merge, timer, combineLatest } from 'rxjs';
|
|
4
4
|
import { tap, finalize, take, takeUntil, debounceTime, filter as filter$1, distinctUntilChanged, switchMap, skip, delay, mapTo, startWith, map } from 'rxjs/operators';
|
|
5
|
+
import { filter, isArrayEqual, list, isEmpty, getNormalizedPath, remove, FsCommonModule } from '@firestitch/common';
|
|
5
6
|
import { isFunction, isObject, clone, isString, toString, pickBy } from 'lodash-es';
|
|
6
|
-
import { filter, isArrayEqual, isEmpty, getNormalizedPath, list, remove, FsCommonModule } from '@firestitch/common';
|
|
7
|
-
import { simpleFormat, format } from '@firestitch/date';
|
|
8
|
-
import { parseISO, isValid, isDate } from 'date-fns';
|
|
9
|
-
import * as i3$3 from '@firestitch/datepicker';
|
|
10
|
-
import { formatPeriodObject, FsDatePickerModule } from '@firestitch/datepicker';
|
|
11
7
|
import * as i3 from '@angular/common';
|
|
12
8
|
import { CommonModule } from '@angular/common';
|
|
13
9
|
import * as i1$1 from '@angular/router';
|
|
@@ -17,6 +13,10 @@ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
|
17
13
|
import * as i6 from '@firestitch/drawer';
|
|
18
14
|
import * as i1 from '@firestitch/store';
|
|
19
15
|
import { FsPersistanceStore, FsStoreModule, FsStore } from '@firestitch/store';
|
|
16
|
+
import { simpleFormat, format } from '@firestitch/date';
|
|
17
|
+
import { parseISO, isValid, isDate } from 'date-fns';
|
|
18
|
+
import * as i3$3 from '@firestitch/datepicker';
|
|
19
|
+
import { formatPeriodObject, FsDatePickerModule } from '@firestitch/datepicker';
|
|
20
20
|
import * as i1$3 from '@angular/material/form-field';
|
|
21
21
|
import * as i2 from '@angular/material/select';
|
|
22
22
|
import { MatSelectModule } from '@angular/material/select';
|
|
@@ -57,6 +57,16 @@ import * as i1$5 from '@angular/cdk/layout';
|
|
|
57
57
|
import * as i1$7 from '@angular/cdk/overlay';
|
|
58
58
|
import { OverlayConfig } from '@angular/cdk/overlay';
|
|
59
59
|
|
|
60
|
+
const QUERY_PARAM_DELIMITER = ':';
|
|
61
|
+
|
|
62
|
+
function filterToQueryParam(value, name) {
|
|
63
|
+
return `${encodeURIComponent(value)}${QUERY_PARAM_DELIMITER}${encodeURIComponent(name)}`;
|
|
64
|
+
}
|
|
65
|
+
function filterFromQueryParam(param) {
|
|
66
|
+
const parts = param.split(QUERY_PARAM_DELIMITER);
|
|
67
|
+
return [decodeURIComponent(parts[0]), decodeURIComponent(parts[1])];
|
|
68
|
+
}
|
|
69
|
+
|
|
60
70
|
var ItemType;
|
|
61
71
|
(function (ItemType) {
|
|
62
72
|
ItemType["Text"] = "text";
|
|
@@ -74,23 +84,9 @@ var ItemType;
|
|
|
74
84
|
ItemType["Keyword"] = "keyword";
|
|
75
85
|
})(ItemType || (ItemType = {}));
|
|
76
86
|
|
|
77
|
-
function findValue(values, value, children) {
|
|
78
|
-
for (let i = 0; i < values.length; i++) {
|
|
79
|
-
const val = values[i];
|
|
80
|
-
if (val[children]) {
|
|
81
|
-
return findValue(val[children], value, children);
|
|
82
|
-
}
|
|
83
|
-
if (val.value === value) {
|
|
84
|
-
return val;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
87
|
class BaseItem {
|
|
91
88
|
constructor(itemConfig, _additionalConfig) {
|
|
92
89
|
this._additionalConfig = _additionalConfig;
|
|
93
|
-
// protected _initialized = false;
|
|
94
90
|
this._pendingValues = false;
|
|
95
91
|
this._pendingDefaultValue = false;
|
|
96
92
|
this._loading$ = new BehaviorSubject(false);
|
|
@@ -296,8 +292,9 @@ class BaseItem {
|
|
|
296
292
|
this.defaultValue = item.default;
|
|
297
293
|
}
|
|
298
294
|
this.change = item.change;
|
|
295
|
+
this.init = item.init || ((item) => { });
|
|
299
296
|
this.hide = item.hide;
|
|
300
|
-
this.
|
|
297
|
+
this.showClear = (_a = item.clear) !== null && _a !== void 0 ? _a : true;
|
|
301
298
|
this.persistanceDisabled = (_b = item.disablePersist) !== null && _b !== void 0 ? _b : false;
|
|
302
299
|
this.queryParamsDisabled = (_c = item.disableQueryParams) !== null && _c !== void 0 ? _c : false;
|
|
303
300
|
if (isFunction(item.values)) {
|
|
@@ -312,7 +309,7 @@ class BaseItem {
|
|
|
312
309
|
var _a;
|
|
313
310
|
const model = (_a = this.persistedValue) !== null && _a !== void 0 ? _a : this.defaultValue;
|
|
314
311
|
if (model !== undefined) {
|
|
315
|
-
this.model
|
|
312
|
+
this._setModel(model);
|
|
316
313
|
}
|
|
317
314
|
}
|
|
318
315
|
_clearValue(defaultValue = undefined) {
|
|
@@ -353,183 +350,6 @@ class BaseSelectItem extends BaseItem {
|
|
|
353
350
|
}
|
|
354
351
|
}
|
|
355
352
|
|
|
356
|
-
class SimpleSelectItem extends BaseSelectItem {
|
|
357
|
-
constructor(itemConfig, _persistedValues) {
|
|
358
|
-
super(itemConfig, _persistedValues);
|
|
359
|
-
}
|
|
360
|
-
get value() {
|
|
361
|
-
let value = this.model;
|
|
362
|
-
if (value == '__all' || value === undefined) {
|
|
363
|
-
value = undefined;
|
|
364
|
-
}
|
|
365
|
-
return value;
|
|
366
|
-
}
|
|
367
|
-
getChipsContent(type = null) {
|
|
368
|
-
if (this.children) {
|
|
369
|
-
const itemValue = findValue(this.values, this.model, this.children);
|
|
370
|
-
return itemValue && itemValue.name;
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
const itemValue = this.values.find((val) => val.value === this.model);
|
|
374
|
-
if (itemValue) {
|
|
375
|
-
return itemValue.name;
|
|
376
|
-
}
|
|
377
|
-
else if (this.isolate) {
|
|
378
|
-
return this.isolate.label;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
get isChipVisible() {
|
|
383
|
-
return this.model !== '__all' && this.model !== undefined;
|
|
384
|
-
}
|
|
385
|
-
_init() {
|
|
386
|
-
super._init();
|
|
387
|
-
if (this.model === undefined && this.defaultValue === undefined) {
|
|
388
|
-
this._model = '__all';
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
get isolateOptionNotSelected() {
|
|
392
|
-
const modelValue = this.model;
|
|
393
|
-
const isolate = this.isolate;
|
|
394
|
-
return isolate && !isolate.enabled && (modelValue === null || modelValue === void 0 ? void 0 : modelValue.length) === 0;
|
|
395
|
-
}
|
|
396
|
-
_setModel(value) {
|
|
397
|
-
if (value) {
|
|
398
|
-
if (!isNaN(value)) {
|
|
399
|
-
value = +value;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
super._setModel(value);
|
|
403
|
-
}
|
|
404
|
-
_validateModel() {
|
|
405
|
-
const item = this.values.find(value => {
|
|
406
|
-
return value.value == this.model;
|
|
407
|
-
});
|
|
408
|
-
const value = item ? item.value : '__all';
|
|
409
|
-
if (this._model !== value) {
|
|
410
|
-
this.model = value;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
_clearValue(defaultValue = undefined) {
|
|
414
|
-
super._clearValue(defaultValue);
|
|
415
|
-
const value = Array.isArray(this.values) && this.values.some((val) => val.value === '__all')
|
|
416
|
-
? '__all'
|
|
417
|
-
: undefined;
|
|
418
|
-
this.model = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
var ActionMode;
|
|
423
|
-
(function (ActionMode) {
|
|
424
|
-
ActionMode["Button"] = "button";
|
|
425
|
-
ActionMode["Menu"] = "menu";
|
|
426
|
-
ActionMode["File"] = "file";
|
|
427
|
-
})(ActionMode || (ActionMode = {}));
|
|
428
|
-
|
|
429
|
-
var ActionType;
|
|
430
|
-
(function (ActionType) {
|
|
431
|
-
ActionType["Basic"] = "basic";
|
|
432
|
-
ActionType["Raised"] = "raised";
|
|
433
|
-
ActionType["Icon"] = "icon";
|
|
434
|
-
ActionType["Fab"] = "fab";
|
|
435
|
-
ActionType["MiniFab"] = "mini-fab";
|
|
436
|
-
ActionType["Flat"] = "flat";
|
|
437
|
-
ActionType["Stroked"] = "stroked";
|
|
438
|
-
})(ActionType || (ActionType = {}));
|
|
439
|
-
|
|
440
|
-
var ButtonStyle;
|
|
441
|
-
(function (ButtonStyle) {
|
|
442
|
-
ButtonStyle["Basic"] = "basic";
|
|
443
|
-
ButtonStyle["Raised"] = "raised";
|
|
444
|
-
ButtonStyle["Icon"] = "icon";
|
|
445
|
-
ButtonStyle["Fab"] = "fab";
|
|
446
|
-
ButtonStyle["MiniFab"] = "mini-fab";
|
|
447
|
-
ButtonStyle["Flat"] = "flat";
|
|
448
|
-
ButtonStyle["Stroked"] = "stroked";
|
|
449
|
-
})(ButtonStyle || (ButtonStyle = {}));
|
|
450
|
-
|
|
451
|
-
var ItemDateMode;
|
|
452
|
-
(function (ItemDateMode) {
|
|
453
|
-
ItemDateMode["Calendar"] = "calendar";
|
|
454
|
-
ItemDateMode["ScrollMonthYear"] = "monthyear";
|
|
455
|
-
ItemDateMode["ScrollMonthDayYear"] = "monthdayyear";
|
|
456
|
-
})(ItemDateMode || (ItemDateMode = {}));
|
|
457
|
-
|
|
458
|
-
var PickerViewType;
|
|
459
|
-
(function (PickerViewType) {
|
|
460
|
-
PickerViewType["Date"] = "date";
|
|
461
|
-
PickerViewType["DateTime"] = "datetime";
|
|
462
|
-
PickerViewType["Time"] = "time";
|
|
463
|
-
PickerViewType["Week"] = "week";
|
|
464
|
-
PickerViewType["MonthRange"] = "monthrange";
|
|
465
|
-
})(PickerViewType || (PickerViewType = {}));
|
|
466
|
-
|
|
467
|
-
const SORT_BY_FIELD = 'sortName';
|
|
468
|
-
const SORT_DIRECTION_FIELD = 'sortDirection';
|
|
469
|
-
class FsFilterConfig {
|
|
470
|
-
constructor(data = {}) {
|
|
471
|
-
this.load = true;
|
|
472
|
-
this.persist = false;
|
|
473
|
-
this.inline = false;
|
|
474
|
-
this.autofocus = false;
|
|
475
|
-
this.chips = false;
|
|
476
|
-
this.sortValues = null;
|
|
477
|
-
this.sort = null;
|
|
478
|
-
// public sortDirection = null;
|
|
479
|
-
this.queryParam = false;
|
|
480
|
-
this.case = 'camel';
|
|
481
|
-
this._init(data);
|
|
482
|
-
}
|
|
483
|
-
_init(data = {}) {
|
|
484
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
485
|
-
this.load = (_a = data.load) !== null && _a !== void 0 ? _a : true;
|
|
486
|
-
this.persist = data.persist;
|
|
487
|
-
this.savedFilters = data.savedFilters;
|
|
488
|
-
this.inline = (_b = data.inline) !== null && _b !== void 0 ? _b : false;
|
|
489
|
-
this.autofocus = (_c = data.autofocus) !== null && _c !== void 0 ? _c : false;
|
|
490
|
-
this.chips = (_d = data.chips) !== null && _d !== void 0 ? _d : false;
|
|
491
|
-
this.sortValues = data.sorts;
|
|
492
|
-
this.sort = data.sort;
|
|
493
|
-
this.queryParam = (_e = data.queryParam) !== null && _e !== void 0 ? _e : false;
|
|
494
|
-
this.init = data.init;
|
|
495
|
-
this.change = data.change;
|
|
496
|
-
this.reload = data.reload;
|
|
497
|
-
this.clear = data.clear;
|
|
498
|
-
this.sortChange = data.sortChange;
|
|
499
|
-
this.case = (_f = data.case) !== null && _f !== void 0 ? _f : 'camel';
|
|
500
|
-
this.reloadWhenConfigChanged = data.reloadWhenConfigChanged;
|
|
501
|
-
this.button = data.button;
|
|
502
|
-
this.items = data.items;
|
|
503
|
-
this.actions = data.actions;
|
|
504
|
-
this.case = (_g = data.case) !== null && _g !== void 0 ? _g : 'camel';
|
|
505
|
-
if (this.persist) {
|
|
506
|
-
if (typeof this.persist === 'object') {
|
|
507
|
-
if (this.persist.name) {
|
|
508
|
-
this.namespace = this.persist.name;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
if (!this.button) {
|
|
513
|
-
this.button = {};
|
|
514
|
-
}
|
|
515
|
-
if (this.button.label === undefined) {
|
|
516
|
-
this.button.label = 'Filters';
|
|
517
|
-
}
|
|
518
|
-
if (this.button.icon === undefined) {
|
|
519
|
-
this.button.icon = 'tune';
|
|
520
|
-
}
|
|
521
|
-
if (this.button.style === undefined) {
|
|
522
|
-
this.button.style = ButtonStyle.Raised;
|
|
523
|
-
}
|
|
524
|
-
if (this.button.color === undefined) {
|
|
525
|
-
this.button.color = 'default';
|
|
526
|
-
}
|
|
527
|
-
if (this.clear === undefined) {
|
|
528
|
-
this.clear = () => { };
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
353
|
function objectsAreEquals(obj1, obj2) {
|
|
534
354
|
const oldKeys = Object.keys(obj1);
|
|
535
355
|
const currKeys = Object.keys(obj2);
|
|
@@ -654,111 +474,45 @@ class MultipleSelectItem extends BaseSelectItem {
|
|
|
654
474
|
}
|
|
655
475
|
}
|
|
656
476
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
if (
|
|
660
|
-
|
|
477
|
+
function buildQueryParams(flattenedParams, items) {
|
|
478
|
+
items.forEach(filterItem => {
|
|
479
|
+
if (filterItem instanceof MultipleSelectItem && filterItem.isolate) {
|
|
480
|
+
if (filterItem.multiple && filterItem.value) {
|
|
481
|
+
const isolated = list(filterItem.values, 'value').sort();
|
|
482
|
+
const value = filterItem.value.sort();
|
|
483
|
+
if (arraysAreEquals(value, isolated)) {
|
|
484
|
+
flattenedParams[filterItem.name] = null;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
661
487
|
}
|
|
662
|
-
|
|
663
|
-
|
|
488
|
+
if (filterItem.isTypeAutocomplete) {
|
|
489
|
+
if (isObject(filterItem.model)) {
|
|
490
|
+
flattenedParams[filterItem.name] = filterToQueryParam(filterItem.model.value, filterItem.model.name);
|
|
491
|
+
}
|
|
664
492
|
}
|
|
665
|
-
|
|
493
|
+
else if (filterItem.isTypeAutocompleteChips || filterItem.isTypeChips) {
|
|
494
|
+
if (Array.isArray(filterItem.model) && filterItem.model.length) {
|
|
495
|
+
flattenedParams[filterItem.name] = filterItem.model.map((item) => {
|
|
496
|
+
return filterToQueryParam(item.value, item.name);
|
|
497
|
+
}).join(',');
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
return flattenedParams;
|
|
666
502
|
}
|
|
667
503
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
return
|
|
504
|
+
function getRangeName(configCase, name, range) {
|
|
505
|
+
if (configCase === 'snake') {
|
|
506
|
+
return name.concat('_').concat(range);
|
|
671
507
|
}
|
|
672
|
-
|
|
673
|
-
return
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return value;
|
|
681
|
-
}
|
|
682
|
-
get isChipVisible() {
|
|
683
|
-
return !!this.value;
|
|
684
|
-
}
|
|
685
|
-
get queryObject() {
|
|
686
|
-
const value = this.value;
|
|
687
|
-
const name = this.name;
|
|
688
|
-
return {
|
|
689
|
-
[name]: value
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
get persistanceObject() {
|
|
693
|
-
const value = this.value;
|
|
694
|
-
const name = this.name;
|
|
695
|
-
const params = {};
|
|
696
|
-
if (Array.isArray(value)) {
|
|
697
|
-
params[name] = value.join(',');
|
|
698
|
-
}
|
|
699
|
-
else {
|
|
700
|
-
params[name] = undefined;
|
|
701
|
-
}
|
|
702
|
-
return params;
|
|
703
|
-
}
|
|
704
|
-
getChipsContent() {
|
|
705
|
-
return this.model
|
|
706
|
-
.reduce((acc, i) => {
|
|
707
|
-
acc.push(i.name);
|
|
708
|
-
return acc;
|
|
709
|
-
}, [])
|
|
710
|
-
.join(', ');
|
|
711
|
-
}
|
|
712
|
-
_validateModel() { }
|
|
713
|
-
_setModel(value) {
|
|
714
|
-
if (Array.isArray(value)) {
|
|
715
|
-
value = value.map((val) => {
|
|
716
|
-
if (isNaN(val)) {
|
|
717
|
-
return val;
|
|
718
|
-
}
|
|
719
|
-
else {
|
|
720
|
-
return +val;
|
|
721
|
-
}
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
this._model = value;
|
|
725
|
-
}
|
|
726
|
-
_parseConfig(item) {
|
|
727
|
-
this.multiple = item.multiple;
|
|
728
|
-
super._parseConfig(item);
|
|
729
|
-
}
|
|
730
|
-
_init() {
|
|
731
|
-
if (!Array.isArray(this.values)) {
|
|
732
|
-
this.values = [];
|
|
733
|
-
}
|
|
734
|
-
if (this.model && Array.isArray(this.model) && this.values.length) {
|
|
735
|
-
if (Number.isInteger(this.model[0])) {
|
|
736
|
-
this._model = this.model.map((id) => {
|
|
737
|
-
return this.values.find((value) => value.value === id);
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
if (this.model === undefined) {
|
|
742
|
-
this._model = [];
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
_clearValue(defaultValue = undefined) {
|
|
746
|
-
this.model = defaultValue !== null && defaultValue !== void 0 ? defaultValue : [];
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
function getRangeName(configCase, name, range) {
|
|
751
|
-
if (configCase === 'snake') {
|
|
752
|
-
return name.concat('_').concat(range);
|
|
753
|
-
}
|
|
754
|
-
if (configCase === 'camel') {
|
|
755
|
-
return name.concat(range.charAt(0).toUpperCase()).concat(range.slice(1));
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
class RangeItem extends BaseItem {
|
|
760
|
-
static create(config, additionalConfig) {
|
|
761
|
-
return new RangeItem(config, additionalConfig);
|
|
508
|
+
if (configCase === 'camel') {
|
|
509
|
+
return name.concat(range.charAt(0).toUpperCase()).concat(range.slice(1));
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
class RangeItem extends BaseItem {
|
|
514
|
+
static create(config, additionalConfig) {
|
|
515
|
+
return new RangeItem(config, additionalConfig);
|
|
762
516
|
}
|
|
763
517
|
get value() {
|
|
764
518
|
let value = clone(this.model);
|
|
@@ -915,73 +669,477 @@ class BaseDateRangeItem extends BaseItem {
|
|
|
915
669
|
return `${format(to, formatTo)}`;
|
|
916
670
|
}
|
|
917
671
|
}
|
|
918
|
-
clearDateRange(type = null, defaultValue = undefined) {
|
|
919
|
-
if (type === 'from') {
|
|
920
|
-
delete this.model.from;
|
|
921
|
-
if (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.from) {
|
|
922
|
-
this.model.from = defaultValue.from;
|
|
923
|
-
}
|
|
924
|
-
this.model = Object.assign({}, this.model);
|
|
925
|
-
}
|
|
926
|
-
else if (type === 'to') {
|
|
927
|
-
delete this.model.to;
|
|
928
|
-
if (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.to) {
|
|
929
|
-
this.model.to = defaultValue.to;
|
|
930
|
-
}
|
|
931
|
-
this.model = Object.assign({}, this.model);
|
|
672
|
+
clearDateRange(type = null, defaultValue = undefined) {
|
|
673
|
+
if (type === 'from') {
|
|
674
|
+
delete this.model.from;
|
|
675
|
+
if (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.from) {
|
|
676
|
+
this.model.from = defaultValue.from;
|
|
677
|
+
}
|
|
678
|
+
this.model = Object.assign({}, this.model);
|
|
679
|
+
}
|
|
680
|
+
else if (type === 'to') {
|
|
681
|
+
delete this.model.to;
|
|
682
|
+
if (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.to) {
|
|
683
|
+
this.model.to = defaultValue.to;
|
|
684
|
+
}
|
|
685
|
+
this.model = Object.assign({}, this.model);
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
if (defaultValue) {
|
|
689
|
+
this.model = Object.assign({}, defaultValue);
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
this.model = {};
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
_validateModel() {
|
|
697
|
+
}
|
|
698
|
+
_setModel(value) {
|
|
699
|
+
if (value) {
|
|
700
|
+
if (value.from && (!isDate(value.from) || !isValid(value.from))) {
|
|
701
|
+
value.from = parseISO(value.from);
|
|
702
|
+
}
|
|
703
|
+
if (value.to && (!isDate(value.to) || !isValid(value.to))) {
|
|
704
|
+
value.to = parseISO(value.to);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
super._setModel(value);
|
|
708
|
+
}
|
|
709
|
+
_parseConfig(item) {
|
|
710
|
+
var _a, _b;
|
|
711
|
+
this.case = (_b = (_a = this._additionalConfig) === null || _a === void 0 ? void 0 : _a.case) !== null && _b !== void 0 ? _b : 'camel';
|
|
712
|
+
super._parseConfig(item);
|
|
713
|
+
}
|
|
714
|
+
_init() {
|
|
715
|
+
if (!this.label) {
|
|
716
|
+
this.label = ['Date From', 'Date To'];
|
|
717
|
+
}
|
|
718
|
+
if (!this.model) {
|
|
719
|
+
this.model = this.defaultValue || {};
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
_clearValue(defaultValue = undefined) {
|
|
723
|
+
var _a;
|
|
724
|
+
this.model = (_a = this.defaultValue) !== null && _a !== void 0 ? _a : {};
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
class DateRangeItem extends BaseDateRangeItem {
|
|
729
|
+
static create(config) {
|
|
730
|
+
return new DateRangeItem(config, null);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
class DateTimeRangeItem extends BaseDateRangeItem {
|
|
735
|
+
static create(config) {
|
|
736
|
+
return new DateTimeRangeItem(config, null);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
function tryConvertToNumber(val) {
|
|
741
|
+
return isNaN(val)
|
|
742
|
+
? val
|
|
743
|
+
: +val;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
function parseItemValueFromStored(item, params, paramCase) {
|
|
747
|
+
const param = params[item.name];
|
|
748
|
+
switch (item.type) {
|
|
749
|
+
case ItemType.Range: {
|
|
750
|
+
const min = params[getRangeName(paramCase, item.name, 'min')];
|
|
751
|
+
const max = params[getRangeName(paramCase, item.name, 'max')];
|
|
752
|
+
return { min: min, max: max };
|
|
753
|
+
}
|
|
754
|
+
case ItemType.DateRange:
|
|
755
|
+
case ItemType.DateTimeRange: {
|
|
756
|
+
const from = params[getRangeName(item.case, item.name, 'from')];
|
|
757
|
+
const to = params[getRangeName(item.case, item.name, 'to')];
|
|
758
|
+
return { from: from, to: to };
|
|
759
|
+
}
|
|
760
|
+
case ItemType.Week: {
|
|
761
|
+
const from = params[getRangeName('camel', item.name, 'from')];
|
|
762
|
+
const to = params[getRangeName('camel', item.name, 'to')];
|
|
763
|
+
const period = params[`${item.name}Period`];
|
|
764
|
+
return { from, to, period };
|
|
765
|
+
}
|
|
766
|
+
case ItemType.Select: {
|
|
767
|
+
if (item.multiple && !!param) {
|
|
768
|
+
const values = param.split(',');
|
|
769
|
+
if (item.isolate) {
|
|
770
|
+
const isolatedValue = Array.isArray(item.isolate.value)
|
|
771
|
+
? item.isolate.value
|
|
772
|
+
: [item.isolate.value];
|
|
773
|
+
item.isolate.enabled = arraysHaveSameElements(isolatedValue, values);
|
|
774
|
+
return item.isolate.enabled
|
|
775
|
+
? isolatedValue
|
|
776
|
+
: values;
|
|
777
|
+
}
|
|
778
|
+
return values;
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
return param;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
case ItemType.Checkbox: {
|
|
785
|
+
if (param === 'true') {
|
|
786
|
+
return true === item.checked;
|
|
787
|
+
}
|
|
788
|
+
else {
|
|
789
|
+
return param === item.checked;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
case ItemType.AutoComplete: {
|
|
793
|
+
const filterParts = filterFromQueryParam(param);
|
|
794
|
+
return {
|
|
795
|
+
name: filterParts[1],
|
|
796
|
+
value: tryConvertToNumber(filterParts[0])
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
case ItemType.AutoCompleteChips:
|
|
800
|
+
case ItemType.Chips: {
|
|
801
|
+
const filterParts = param.split(',');
|
|
802
|
+
return filterParts.reduce((arry, value) => {
|
|
803
|
+
const chipParts = filterFromQueryParam(value);
|
|
804
|
+
arry.push({
|
|
805
|
+
name: chipParts[1],
|
|
806
|
+
value: tryConvertToNumber(chipParts[0]),
|
|
807
|
+
});
|
|
808
|
+
return arry;
|
|
809
|
+
}, []);
|
|
810
|
+
}
|
|
811
|
+
default: {
|
|
812
|
+
return param;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
function arraysHaveSameElements(arr1, arr2) {
|
|
817
|
+
arr1 = [...arr1].sort();
|
|
818
|
+
arr2 = [...arr2].sort();
|
|
819
|
+
return arr1.some((item) => {
|
|
820
|
+
return arr2.includes(item);
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function parseDate(value) {
|
|
825
|
+
if (value && (!isDate(value) || !isValid(value))) {
|
|
826
|
+
return parseISO(value);
|
|
827
|
+
}
|
|
828
|
+
return value;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
class WeekItem extends BaseItem {
|
|
832
|
+
static create(config) {
|
|
833
|
+
return new WeekItem(config, null);
|
|
834
|
+
}
|
|
835
|
+
get value() {
|
|
836
|
+
let value = clone(this.model);
|
|
837
|
+
if (!isObject(this.model) ||
|
|
838
|
+
(isEmpty(this.model.from, { zero: true }) && isEmpty(this.model.to, { zero: true }))) {
|
|
839
|
+
value = undefined;
|
|
840
|
+
}
|
|
841
|
+
if (isEmpty(value, { zero: true })) {
|
|
842
|
+
return undefined;
|
|
843
|
+
}
|
|
844
|
+
let from = value.from;
|
|
845
|
+
let to = value.to;
|
|
846
|
+
const period = value.period;
|
|
847
|
+
value = {};
|
|
848
|
+
if (from) {
|
|
849
|
+
if (isString(from)) {
|
|
850
|
+
from = parseISO(from);
|
|
851
|
+
}
|
|
852
|
+
if (isValid(from) && isDate(from)) {
|
|
853
|
+
value.from = from;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (to) {
|
|
857
|
+
if (isString(to)) {
|
|
858
|
+
to = parseISO(to);
|
|
859
|
+
}
|
|
860
|
+
if (isValid(to) && isDate(to)) {
|
|
861
|
+
value.to = to;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
if (period) {
|
|
865
|
+
if (isString(period)) {
|
|
866
|
+
value.period = parseInt(period, 10);
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
value.period = period;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return value;
|
|
873
|
+
}
|
|
874
|
+
get queryObject() {
|
|
875
|
+
const value = this.value;
|
|
876
|
+
const name = this.name;
|
|
877
|
+
const paramFromName = getRangeName('camel', name, 'from');
|
|
878
|
+
const paramToName = getRangeName('camel', name, 'to');
|
|
879
|
+
const paramPeriodName = `${name}Period`;
|
|
880
|
+
return {
|
|
881
|
+
[paramFromName]: (value === null || value === void 0 ? void 0 : value.from) || undefined,
|
|
882
|
+
[paramToName]: (value === null || value === void 0 ? void 0 : value.to) || undefined,
|
|
883
|
+
[paramPeriodName]: (value === null || value === void 0 ? void 0 : value.period) || undefined,
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
get persistanceObject() {
|
|
887
|
+
const query = this.queryObject;
|
|
888
|
+
const name = this.name;
|
|
889
|
+
const paramFromName = getRangeName('camel', name, 'from');
|
|
890
|
+
const paramFromValue = query[paramFromName] && simpleFormat(query[paramFromName]) || query[paramFromName];
|
|
891
|
+
const paramToName = getRangeName('camel', name, 'to');
|
|
892
|
+
const paramToValue = query[paramToName] && simpleFormat(query[paramToName]) || query[paramToName];
|
|
893
|
+
const paramPeriodName = `${name}Period`;
|
|
894
|
+
return {
|
|
895
|
+
[paramFromName]: paramFromValue,
|
|
896
|
+
[paramToName]: paramToValue,
|
|
897
|
+
[paramPeriodName]: query[paramPeriodName],
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
getChipsContent(type = null) {
|
|
901
|
+
return formatPeriodObject(this.value);
|
|
902
|
+
}
|
|
903
|
+
_validateModel() { }
|
|
904
|
+
_setModel(value) {
|
|
905
|
+
if (value) {
|
|
906
|
+
value.from = parseDate(value.from);
|
|
907
|
+
value.to = parseDate(value.to);
|
|
908
|
+
value.period = parseInt(value.period, 10) || undefined;
|
|
909
|
+
}
|
|
910
|
+
super._setModel(value);
|
|
911
|
+
}
|
|
912
|
+
_parseConfig(item) {
|
|
913
|
+
super._parseConfig(item);
|
|
914
|
+
this.seedDate = item.seedDate;
|
|
915
|
+
}
|
|
916
|
+
_init() { }
|
|
917
|
+
_clearValue(defaultValue = undefined) {
|
|
918
|
+
this.model = defaultValue !== null && defaultValue !== void 0 ? defaultValue : undefined;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* We need this function because when we store persisted/query/remote filter values
|
|
924
|
+
* it stores with different format, ex.: Range will be stored as RangeFrom && RangeTo
|
|
925
|
+
* and in this case we don't know how to restroe those values.
|
|
926
|
+
*
|
|
927
|
+
* This function do convertation for those kinds of stored values
|
|
928
|
+
*
|
|
929
|
+
* @param params
|
|
930
|
+
* @param items
|
|
931
|
+
* @param paramsCase
|
|
932
|
+
*/
|
|
933
|
+
function restoreItems(params, items, paramsCase) {
|
|
934
|
+
const result = {};
|
|
935
|
+
Object.keys(params)
|
|
936
|
+
.forEach((name) => {
|
|
937
|
+
const item = findItemWidthName(items, name);
|
|
938
|
+
if (item) {
|
|
939
|
+
result[item.name] = parseItemValueFromStored(item, params, paramsCase);
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
return result;
|
|
943
|
+
}
|
|
944
|
+
function findItemWidthName(items, name) {
|
|
945
|
+
return items
|
|
946
|
+
.find((filterItem) => {
|
|
947
|
+
if (filterItem instanceof RangeItem) {
|
|
948
|
+
return name === getRangeName(filterItem.case, filterItem.name, 'min') ||
|
|
949
|
+
name === getRangeName(filterItem.case, filterItem.name, 'max') ||
|
|
950
|
+
name === filterItem.name;
|
|
951
|
+
}
|
|
952
|
+
else if (filterItem instanceof DateRangeItem || filterItem instanceof DateTimeRangeItem) {
|
|
953
|
+
return name === getRangeName(filterItem.case, filterItem.name, 'from') ||
|
|
954
|
+
name === getRangeName(filterItem.case, filterItem.name, 'to');
|
|
955
|
+
}
|
|
956
|
+
else if (filterItem instanceof WeekItem) {
|
|
957
|
+
return name === getRangeName('camel', filterItem.name, 'from')
|
|
958
|
+
|| name === getRangeName('camel', filterItem.name, 'to')
|
|
959
|
+
|| name === `${filterItem.name}Period`;
|
|
960
|
+
}
|
|
961
|
+
return filterItem.name === name;
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
function findValue(values, value, children) {
|
|
966
|
+
for (let i = 0; i < values.length; i++) {
|
|
967
|
+
const val = values[i];
|
|
968
|
+
if (val[children]) {
|
|
969
|
+
return findValue(val[children], value, children);
|
|
970
|
+
}
|
|
971
|
+
if (val.value === value) {
|
|
972
|
+
return val;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return undefined;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
class SimpleSelectItem extends BaseSelectItem {
|
|
979
|
+
constructor(itemConfig, _persistedValues) {
|
|
980
|
+
super(itemConfig, _persistedValues);
|
|
981
|
+
}
|
|
982
|
+
get value() {
|
|
983
|
+
let value = this.model;
|
|
984
|
+
if (value == '__all' || value === undefined) {
|
|
985
|
+
value = undefined;
|
|
986
|
+
}
|
|
987
|
+
return value;
|
|
988
|
+
}
|
|
989
|
+
getChipsContent(type = null) {
|
|
990
|
+
if (this.children) {
|
|
991
|
+
const itemValue = findValue(this.values, this.model, this.children);
|
|
992
|
+
return itemValue && itemValue.name;
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
const itemValue = this.values.find((val) => val.value === this.model);
|
|
996
|
+
if (itemValue) {
|
|
997
|
+
return itemValue.name;
|
|
998
|
+
}
|
|
999
|
+
else if (this.isolate) {
|
|
1000
|
+
return this.isolate.label;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
get isChipVisible() {
|
|
1005
|
+
return this.model !== '__all' && this.model !== undefined;
|
|
1006
|
+
}
|
|
1007
|
+
_init() {
|
|
1008
|
+
super._init();
|
|
1009
|
+
if (this.model === undefined && this.defaultValue === undefined) {
|
|
1010
|
+
this._model = '__all';
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
get isolateOptionNotSelected() {
|
|
1014
|
+
const modelValue = this.model;
|
|
1015
|
+
const isolate = this.isolate;
|
|
1016
|
+
return isolate && !isolate.enabled && (modelValue === null || modelValue === void 0 ? void 0 : modelValue.length) === 0;
|
|
1017
|
+
}
|
|
1018
|
+
_setModel(value) {
|
|
1019
|
+
if (value) {
|
|
1020
|
+
if (!isNaN(value)) {
|
|
1021
|
+
value = +value;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
super._setModel(value);
|
|
1025
|
+
}
|
|
1026
|
+
_validateModel() {
|
|
1027
|
+
const item = this.values.find(value => {
|
|
1028
|
+
return value.value == this.model;
|
|
1029
|
+
});
|
|
1030
|
+
const value = item ? item.value : '__all';
|
|
1031
|
+
if (this._model !== value) {
|
|
1032
|
+
this.model = value;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
_clearValue(defaultValue = undefined) {
|
|
1036
|
+
super._clearValue(defaultValue);
|
|
1037
|
+
const value = Array.isArray(this.values) && this.values.some((val) => val.value === '__all')
|
|
1038
|
+
? '__all'
|
|
1039
|
+
: undefined;
|
|
1040
|
+
this.model = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
class SelectItem {
|
|
1045
|
+
static create(config) {
|
|
1046
|
+
if (config.multiple) {
|
|
1047
|
+
return new MultipleSelectItem(config, null);
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
return new SimpleSelectItem(config, null);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
class ChipsItem extends BaseItem {
|
|
1056
|
+
static create(config) {
|
|
1057
|
+
return new ChipsItem(config, null);
|
|
1058
|
+
}
|
|
1059
|
+
get isTypeChips() {
|
|
1060
|
+
return true;
|
|
1061
|
+
}
|
|
1062
|
+
get value() {
|
|
1063
|
+
const value = clone(this.model);
|
|
1064
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
1065
|
+
return undefined;
|
|
1066
|
+
}
|
|
1067
|
+
return value;
|
|
1068
|
+
}
|
|
1069
|
+
get isChipVisible() {
|
|
1070
|
+
return !!this.value;
|
|
1071
|
+
}
|
|
1072
|
+
get queryObject() {
|
|
1073
|
+
const value = this.value;
|
|
1074
|
+
const name = this.name;
|
|
1075
|
+
return {
|
|
1076
|
+
[name]: value
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
get persistanceObject() {
|
|
1080
|
+
const value = this.value;
|
|
1081
|
+
const name = this.name;
|
|
1082
|
+
const params = {};
|
|
1083
|
+
if (Array.isArray(value)) {
|
|
1084
|
+
params[name] = value.join(',');
|
|
932
1085
|
}
|
|
933
1086
|
else {
|
|
934
|
-
|
|
935
|
-
this.model = Object.assign({}, defaultValue);
|
|
936
|
-
}
|
|
937
|
-
else {
|
|
938
|
-
this.model = {};
|
|
939
|
-
}
|
|
1087
|
+
params[name] = undefined;
|
|
940
1088
|
}
|
|
1089
|
+
return params;
|
|
941
1090
|
}
|
|
942
|
-
|
|
1091
|
+
getChipsContent() {
|
|
1092
|
+
return this.model
|
|
1093
|
+
.reduce((acc, i) => {
|
|
1094
|
+
acc.push(i.name);
|
|
1095
|
+
return acc;
|
|
1096
|
+
}, [])
|
|
1097
|
+
.join(', ');
|
|
943
1098
|
}
|
|
1099
|
+
_validateModel() { }
|
|
944
1100
|
_setModel(value) {
|
|
945
|
-
if (value) {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1101
|
+
if (Array.isArray(value)) {
|
|
1102
|
+
value = value.map((val) => {
|
|
1103
|
+
if (isNaN(val)) {
|
|
1104
|
+
return val;
|
|
1105
|
+
}
|
|
1106
|
+
else {
|
|
1107
|
+
return +val;
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
952
1110
|
}
|
|
953
|
-
|
|
1111
|
+
this._model = value;
|
|
954
1112
|
}
|
|
955
1113
|
_parseConfig(item) {
|
|
956
|
-
|
|
957
|
-
this.case = (_b = (_a = this._additionalConfig) === null || _a === void 0 ? void 0 : _a.case) !== null && _b !== void 0 ? _b : 'camel';
|
|
1114
|
+
this.multiple = item.multiple;
|
|
958
1115
|
super._parseConfig(item);
|
|
959
1116
|
}
|
|
960
1117
|
_init() {
|
|
961
|
-
if (!this.
|
|
962
|
-
this.
|
|
1118
|
+
if (!Array.isArray(this.values)) {
|
|
1119
|
+
this.values = [];
|
|
963
1120
|
}
|
|
964
|
-
if (
|
|
965
|
-
this.model
|
|
1121
|
+
if (this.model && Array.isArray(this.model) && this.values.length) {
|
|
1122
|
+
if (Number.isInteger(this.model[0])) {
|
|
1123
|
+
this._model = this.model.map((id) => {
|
|
1124
|
+
return this.values.find((value) => value.value === id);
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
if (this.model === undefined) {
|
|
1129
|
+
this._model = [];
|
|
966
1130
|
}
|
|
967
1131
|
}
|
|
968
1132
|
_clearValue(defaultValue = undefined) {
|
|
969
|
-
|
|
970
|
-
this.model = (_a = this.defaultValue) !== null && _a !== void 0 ? _a : {};
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
class DateRangeItem extends BaseDateRangeItem {
|
|
975
|
-
static create(config) {
|
|
976
|
-
return new DateRangeItem(config, null);
|
|
1133
|
+
this.model = defaultValue !== null && defaultValue !== void 0 ? defaultValue : [];
|
|
977
1134
|
}
|
|
978
1135
|
}
|
|
979
1136
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1137
|
+
var ItemDateMode;
|
|
1138
|
+
(function (ItemDateMode) {
|
|
1139
|
+
ItemDateMode["Calendar"] = "calendar";
|
|
1140
|
+
ItemDateMode["ScrollMonthYear"] = "monthyear";
|
|
1141
|
+
ItemDateMode["ScrollMonthDayYear"] = "monthdayyear";
|
|
1142
|
+
})(ItemDateMode || (ItemDateMode = {}));
|
|
985
1143
|
|
|
986
1144
|
class BaseDateItem extends BaseItem {
|
|
987
1145
|
get value() {
|
|
@@ -1228,142 +1386,148 @@ class TextItem extends BaseItem {
|
|
|
1228
1386
|
}
|
|
1229
1387
|
}
|
|
1230
1388
|
|
|
1231
|
-
function
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
return value;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
class WeekItem extends BaseItem {
|
|
1239
|
-
static create(config) {
|
|
1240
|
-
return new WeekItem(config, null);
|
|
1241
|
-
}
|
|
1242
|
-
get value() {
|
|
1243
|
-
let value = clone(this.model);
|
|
1244
|
-
if (!isObject(this.model) ||
|
|
1245
|
-
(isEmpty(this.model.from, { zero: true }) && isEmpty(this.model.to, { zero: true }))) {
|
|
1246
|
-
value = undefined;
|
|
1389
|
+
function createFilterItem(item, config) {
|
|
1390
|
+
switch (item.type) {
|
|
1391
|
+
case ItemType.Select: {
|
|
1392
|
+
return SelectItem.create(item);
|
|
1247
1393
|
}
|
|
1248
|
-
|
|
1249
|
-
return
|
|
1394
|
+
case ItemType.Chips: {
|
|
1395
|
+
return ChipsItem.create(item);
|
|
1250
1396
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
const period = value.period;
|
|
1254
|
-
value = {};
|
|
1255
|
-
if (from) {
|
|
1256
|
-
if (isString(from)) {
|
|
1257
|
-
from = parseISO(from);
|
|
1258
|
-
}
|
|
1259
|
-
if (isValid(from) && isDate(from)) {
|
|
1260
|
-
value.from = from;
|
|
1261
|
-
}
|
|
1397
|
+
case ItemType.Range: {
|
|
1398
|
+
return RangeItem.create(item, config);
|
|
1262
1399
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
to = parseISO(to);
|
|
1266
|
-
}
|
|
1267
|
-
if (isValid(to) && isDate(to)) {
|
|
1268
|
-
value.to = to;
|
|
1269
|
-
}
|
|
1400
|
+
case ItemType.DateRange: {
|
|
1401
|
+
return DateRangeItem.create(item);
|
|
1270
1402
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
value.period = parseInt(period, 10);
|
|
1274
|
-
}
|
|
1275
|
-
else {
|
|
1276
|
-
value.period = period;
|
|
1277
|
-
}
|
|
1403
|
+
case ItemType.DateTimeRange: {
|
|
1404
|
+
return DateTimeRangeItem.create(item);
|
|
1278
1405
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
const paramPeriodName = `${name}Period`;
|
|
1301
|
-
return {
|
|
1302
|
-
[paramFromName]: paramFromValue,
|
|
1303
|
-
[paramToName]: paramToValue,
|
|
1304
|
-
[paramPeriodName]: query[paramPeriodName],
|
|
1305
|
-
};
|
|
1306
|
-
}
|
|
1307
|
-
getChipsContent(type = null) {
|
|
1308
|
-
return formatPeriodObject(this.value);
|
|
1309
|
-
}
|
|
1310
|
-
_validateModel() { }
|
|
1311
|
-
_setModel(value) {
|
|
1312
|
-
if (value) {
|
|
1313
|
-
value.from = parseDate(value.from);
|
|
1314
|
-
value.to = parseDate(value.to);
|
|
1315
|
-
value.period = parseInt(value.period, 10) || undefined;
|
|
1406
|
+
case ItemType.Date: {
|
|
1407
|
+
return DateItem.create(item);
|
|
1408
|
+
}
|
|
1409
|
+
case ItemType.Week: {
|
|
1410
|
+
return WeekItem.create(item);
|
|
1411
|
+
}
|
|
1412
|
+
case ItemType.DateTime: {
|
|
1413
|
+
return DateTimeItem.create(item);
|
|
1414
|
+
}
|
|
1415
|
+
case ItemType.AutoComplete: {
|
|
1416
|
+
return AutocompleteItem.create(item);
|
|
1417
|
+
}
|
|
1418
|
+
case ItemType.AutoCompleteChips: {
|
|
1419
|
+
return AutocompleteChipsItem.create(item);
|
|
1420
|
+
}
|
|
1421
|
+
case ItemType.Checkbox: {
|
|
1422
|
+
return CheckboxItem.create(item);
|
|
1423
|
+
}
|
|
1424
|
+
case ItemType.Keyword:
|
|
1425
|
+
case ItemType.Text: {
|
|
1426
|
+
return TextItem.create(item);
|
|
1316
1427
|
}
|
|
1317
|
-
super._setModel(value);
|
|
1318
|
-
}
|
|
1319
|
-
_parseConfig(item) {
|
|
1320
|
-
super._parseConfig(item);
|
|
1321
|
-
this.seedDate = item.seedDate;
|
|
1322
|
-
}
|
|
1323
|
-
_init() { }
|
|
1324
|
-
_clearValue(defaultValue = undefined) {
|
|
1325
|
-
this.model = defaultValue !== null && defaultValue !== void 0 ? defaultValue : undefined;
|
|
1326
1428
|
}
|
|
1327
1429
|
}
|
|
1328
1430
|
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1431
|
+
var ActionMode;
|
|
1432
|
+
(function (ActionMode) {
|
|
1433
|
+
ActionMode["Button"] = "button";
|
|
1434
|
+
ActionMode["Menu"] = "menu";
|
|
1435
|
+
ActionMode["File"] = "file";
|
|
1436
|
+
})(ActionMode || (ActionMode = {}));
|
|
1437
|
+
|
|
1438
|
+
var ActionType;
|
|
1439
|
+
(function (ActionType) {
|
|
1440
|
+
ActionType["Basic"] = "basic";
|
|
1441
|
+
ActionType["Raised"] = "raised";
|
|
1442
|
+
ActionType["Icon"] = "icon";
|
|
1443
|
+
ActionType["Fab"] = "fab";
|
|
1444
|
+
ActionType["MiniFab"] = "mini-fab";
|
|
1445
|
+
ActionType["Flat"] = "flat";
|
|
1446
|
+
ActionType["Stroked"] = "stroked";
|
|
1447
|
+
})(ActionType || (ActionType = {}));
|
|
1448
|
+
|
|
1449
|
+
var ButtonStyle;
|
|
1450
|
+
(function (ButtonStyle) {
|
|
1451
|
+
ButtonStyle["Basic"] = "basic";
|
|
1452
|
+
ButtonStyle["Raised"] = "raised";
|
|
1453
|
+
ButtonStyle["Icon"] = "icon";
|
|
1454
|
+
ButtonStyle["Fab"] = "fab";
|
|
1455
|
+
ButtonStyle["MiniFab"] = "mini-fab";
|
|
1456
|
+
ButtonStyle["Flat"] = "flat";
|
|
1457
|
+
ButtonStyle["Stroked"] = "stroked";
|
|
1458
|
+
})(ButtonStyle || (ButtonStyle = {}));
|
|
1459
|
+
|
|
1460
|
+
var PickerViewType;
|
|
1461
|
+
(function (PickerViewType) {
|
|
1462
|
+
PickerViewType["Date"] = "date";
|
|
1463
|
+
PickerViewType["DateTime"] = "datetime";
|
|
1464
|
+
PickerViewType["Time"] = "time";
|
|
1465
|
+
PickerViewType["Week"] = "week";
|
|
1466
|
+
PickerViewType["MonthRange"] = "monthrange";
|
|
1467
|
+
})(PickerViewType || (PickerViewType = {}));
|
|
1468
|
+
|
|
1469
|
+
const SORT_BY_FIELD = 'sortName';
|
|
1470
|
+
const SORT_DIRECTION_FIELD = 'sortDirection';
|
|
1471
|
+
class FsFilterConfig {
|
|
1472
|
+
constructor(data = {}) {
|
|
1473
|
+
this.load = true;
|
|
1474
|
+
this.persist = false;
|
|
1475
|
+
this.inline = false;
|
|
1476
|
+
this.autofocus = false;
|
|
1477
|
+
this.chips = false;
|
|
1478
|
+
this.sortValues = null;
|
|
1479
|
+
this.sort = null;
|
|
1480
|
+
// public sortDirection = null;
|
|
1481
|
+
this.queryParam = false;
|
|
1482
|
+
this.case = 'camel';
|
|
1483
|
+
this._init(data);
|
|
1484
|
+
}
|
|
1485
|
+
_init(data = {}) {
|
|
1486
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1487
|
+
this.load = (_a = data.load) !== null && _a !== void 0 ? _a : true;
|
|
1488
|
+
this.persist = data.persist;
|
|
1489
|
+
this.savedFilters = data.savedFilters;
|
|
1490
|
+
this.inline = (_b = data.inline) !== null && _b !== void 0 ? _b : false;
|
|
1491
|
+
this.autofocus = (_c = data.autofocus) !== null && _c !== void 0 ? _c : false;
|
|
1492
|
+
this.chips = (_d = data.chips) !== null && _d !== void 0 ? _d : false;
|
|
1493
|
+
this.sortValues = data.sorts;
|
|
1494
|
+
this.sort = data.sort;
|
|
1495
|
+
this.queryParam = (_e = data.queryParam) !== null && _e !== void 0 ? _e : false;
|
|
1496
|
+
this.init = data.init;
|
|
1497
|
+
this.change = data.change;
|
|
1498
|
+
this.reload = data.reload;
|
|
1499
|
+
this.clear = data.clear;
|
|
1500
|
+
this.sortChange = data.sortChange;
|
|
1501
|
+
this.case = (_f = data.case) !== null && _f !== void 0 ? _f : 'camel';
|
|
1502
|
+
this.reloadWhenConfigChanged = data.reloadWhenConfigChanged;
|
|
1503
|
+
this.button = data.button;
|
|
1504
|
+
this.items = data.items;
|
|
1505
|
+
this.actions = data.actions;
|
|
1506
|
+
this.case = (_g = data.case) !== null && _g !== void 0 ? _g : 'camel';
|
|
1507
|
+
if (this.persist) {
|
|
1508
|
+
if (typeof this.persist === 'object') {
|
|
1509
|
+
if (this.persist.name) {
|
|
1510
|
+
this.namespace = this.persist.name;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1348
1513
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1514
|
+
if (!this.button) {
|
|
1515
|
+
this.button = {};
|
|
1351
1516
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1517
|
+
if (this.button.label === undefined) {
|
|
1518
|
+
this.button.label = 'Filters';
|
|
1354
1519
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1520
|
+
if (this.button.icon === undefined) {
|
|
1521
|
+
this.button.icon = 'tune';
|
|
1357
1522
|
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1523
|
+
if (this.button.style === undefined) {
|
|
1524
|
+
this.button.style = ButtonStyle.Raised;
|
|
1360
1525
|
}
|
|
1361
|
-
|
|
1362
|
-
|
|
1526
|
+
if (this.button.color === undefined) {
|
|
1527
|
+
this.button.color = 'default';
|
|
1363
1528
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
return TextItem.create(item);
|
|
1529
|
+
if (this.clear === undefined) {
|
|
1530
|
+
this.clear = () => { };
|
|
1367
1531
|
}
|
|
1368
1532
|
}
|
|
1369
1533
|
}
|
|
@@ -1541,7 +1705,15 @@ class FsFilterItemsStore {
|
|
|
1541
1705
|
}
|
|
1542
1706
|
return params;
|
|
1543
1707
|
}
|
|
1544
|
-
|
|
1708
|
+
init(p) {
|
|
1709
|
+
this._ready$
|
|
1710
|
+
.pipe(take(1), takeUntil(this._destroy$))
|
|
1711
|
+
.subscribe(() => {
|
|
1712
|
+
this.items
|
|
1713
|
+
.forEach((item) => {
|
|
1714
|
+
item.init(item);
|
|
1715
|
+
});
|
|
1716
|
+
});
|
|
1545
1717
|
this.items
|
|
1546
1718
|
.forEach((item) => {
|
|
1547
1719
|
item.initValues(p[item.name]);
|
|
@@ -1594,7 +1766,7 @@ class FsFilterItemsStore {
|
|
|
1594
1766
|
this.loadAsyncValues();
|
|
1595
1767
|
}
|
|
1596
1768
|
}
|
|
1597
|
-
|
|
1769
|
+
updateItemsVisiblity() {
|
|
1598
1770
|
this.visibleItems = this.items
|
|
1599
1771
|
.filter((item) => !item.isTypeKeyword && !item.hide);
|
|
1600
1772
|
}
|
|
@@ -1647,7 +1819,7 @@ class FsFilterItemsStore {
|
|
|
1647
1819
|
this.ready$
|
|
1648
1820
|
.pipe(filter$1((state) => state), takeUntil(this._destroy$))
|
|
1649
1821
|
.subscribe(() => {
|
|
1650
|
-
this.
|
|
1822
|
+
this.updateItemsVisiblity();
|
|
1651
1823
|
this._setKeywordItem();
|
|
1652
1824
|
});
|
|
1653
1825
|
}
|
|
@@ -1697,143 +1869,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1697
1869
|
type: Injectable
|
|
1698
1870
|
}], ctorParameters: function () { return []; } });
|
|
1699
1871
|
|
|
1700
|
-
const QUERY_PARAM_DELIMITER = ':';
|
|
1701
|
-
|
|
1702
|
-
function filterToQueryParam(value, name) {
|
|
1703
|
-
return `${encodeURIComponent(value)}${QUERY_PARAM_DELIMITER}${encodeURIComponent(name)}`;
|
|
1704
|
-
}
|
|
1705
|
-
function filterFromQueryParam(param) {
|
|
1706
|
-
const parts = param.split(QUERY_PARAM_DELIMITER);
|
|
1707
|
-
return [decodeURIComponent(parts[0]), decodeURIComponent(parts[1])];
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
function tryConvertToNumber(val) {
|
|
1711
|
-
return isNaN(val)
|
|
1712
|
-
? val
|
|
1713
|
-
: +val;
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
function parseItemValueFromStored(item, params, paramCase) {
|
|
1717
|
-
const param = params[item.name];
|
|
1718
|
-
switch (item.type) {
|
|
1719
|
-
case ItemType.Range: {
|
|
1720
|
-
const min = params[getRangeName(paramCase, item.name, 'min')];
|
|
1721
|
-
const max = params[getRangeName(paramCase, item.name, 'max')];
|
|
1722
|
-
return { min: min, max: max };
|
|
1723
|
-
}
|
|
1724
|
-
case ItemType.DateRange:
|
|
1725
|
-
case ItemType.DateTimeRange: {
|
|
1726
|
-
const from = params[getRangeName(item.case, item.name, 'from')];
|
|
1727
|
-
const to = params[getRangeName(item.case, item.name, 'to')];
|
|
1728
|
-
return { from: from, to: to };
|
|
1729
|
-
}
|
|
1730
|
-
case ItemType.Week: {
|
|
1731
|
-
const from = params[getRangeName('camel', item.name, 'from')];
|
|
1732
|
-
const to = params[getRangeName('camel', item.name, 'to')];
|
|
1733
|
-
const period = params[`${item.name}Period`];
|
|
1734
|
-
return { from, to, period };
|
|
1735
|
-
}
|
|
1736
|
-
case ItemType.Select: {
|
|
1737
|
-
if (item.multiple && !!param) {
|
|
1738
|
-
const values = param.split(',');
|
|
1739
|
-
if (item.isolate) {
|
|
1740
|
-
const isolatedValue = Array.isArray(item.isolate.value)
|
|
1741
|
-
? item.isolate.value
|
|
1742
|
-
: [item.isolate.value];
|
|
1743
|
-
item.isolate.enabled = arraysHaveSameElements(isolatedValue, values);
|
|
1744
|
-
return item.isolate.enabled
|
|
1745
|
-
? isolatedValue
|
|
1746
|
-
: values;
|
|
1747
|
-
}
|
|
1748
|
-
return values;
|
|
1749
|
-
}
|
|
1750
|
-
else {
|
|
1751
|
-
return param;
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
case ItemType.Checkbox: {
|
|
1755
|
-
if (param === 'true') {
|
|
1756
|
-
return true === item.checked;
|
|
1757
|
-
}
|
|
1758
|
-
else {
|
|
1759
|
-
return param === item.checked;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
case ItemType.AutoComplete: {
|
|
1763
|
-
const filterParts = filterFromQueryParam(param);
|
|
1764
|
-
return {
|
|
1765
|
-
name: filterParts[1],
|
|
1766
|
-
value: tryConvertToNumber(filterParts[0])
|
|
1767
|
-
};
|
|
1768
|
-
}
|
|
1769
|
-
case ItemType.AutoCompleteChips:
|
|
1770
|
-
case ItemType.Chips: {
|
|
1771
|
-
const filterParts = param.split(',');
|
|
1772
|
-
return filterParts.reduce((arry, value) => {
|
|
1773
|
-
const chipParts = filterFromQueryParam(value);
|
|
1774
|
-
arry.push({
|
|
1775
|
-
name: chipParts[1],
|
|
1776
|
-
value: tryConvertToNumber(chipParts[0]),
|
|
1777
|
-
});
|
|
1778
|
-
return arry;
|
|
1779
|
-
}, []);
|
|
1780
|
-
}
|
|
1781
|
-
default: {
|
|
1782
|
-
return param;
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
function arraysHaveSameElements(arr1, arr2) {
|
|
1787
|
-
arr1 = [...arr1].sort();
|
|
1788
|
-
arr2 = [...arr2].sort();
|
|
1789
|
-
return arr1.some((item) => {
|
|
1790
|
-
return arr2.includes(item);
|
|
1791
|
-
});
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
/**
|
|
1795
|
-
* We need this function because when we store persisted/query/remote filter values
|
|
1796
|
-
* it stores with different format, ex.: Range will be stored as RangeFrom && RangeTo
|
|
1797
|
-
* and in this case we don't know how to restroe those values.
|
|
1798
|
-
*
|
|
1799
|
-
* This function do convertation for those kinds of stored values
|
|
1800
|
-
*
|
|
1801
|
-
* @param params
|
|
1802
|
-
* @param items
|
|
1803
|
-
* @param paramsCase
|
|
1804
|
-
*/
|
|
1805
|
-
function restoreItems(params, items, paramsCase) {
|
|
1806
|
-
const result = {};
|
|
1807
|
-
Object.keys(params)
|
|
1808
|
-
.forEach((name) => {
|
|
1809
|
-
const item = findItemWidthName(items, name);
|
|
1810
|
-
if (item) {
|
|
1811
|
-
result[item.name] = parseItemValueFromStored(item, params, paramsCase);
|
|
1812
|
-
}
|
|
1813
|
-
});
|
|
1814
|
-
return result;
|
|
1815
|
-
}
|
|
1816
|
-
function findItemWidthName(items, name) {
|
|
1817
|
-
return items
|
|
1818
|
-
.find((filterItem) => {
|
|
1819
|
-
if (filterItem instanceof RangeItem) {
|
|
1820
|
-
return name === getRangeName(filterItem.case, filterItem.name, 'min') ||
|
|
1821
|
-
name === getRangeName(filterItem.case, filterItem.name, 'max') ||
|
|
1822
|
-
name === filterItem.name;
|
|
1823
|
-
}
|
|
1824
|
-
else if (filterItem instanceof DateRangeItem || filterItem instanceof DateTimeRangeItem) {
|
|
1825
|
-
return name === getRangeName(filterItem.case, filterItem.name, 'from') ||
|
|
1826
|
-
name === getRangeName(filterItem.case, filterItem.name, 'to');
|
|
1827
|
-
}
|
|
1828
|
-
else if (filterItem instanceof WeekItem) {
|
|
1829
|
-
return name === getRangeName('camel', filterItem.name, 'from')
|
|
1830
|
-
|| name === getRangeName('camel', filterItem.name, 'to')
|
|
1831
|
-
|| name === `${filterItem.name}Period`;
|
|
1832
|
-
}
|
|
1833
|
-
return filterItem.name === name;
|
|
1834
|
-
});
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
1872
|
const FILTER_STORE_KEY = 'fs-filter-persist';
|
|
1838
1873
|
class PersistanceParamsController extends FsPersistanceStore {
|
|
1839
1874
|
constructor(_store, _route, _location, _itemsStore, _dialogRef, _drawerRef) {
|
|
@@ -1974,33 +2009,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1974
2009
|
args: [MAT_DIALOG_DATA]
|
|
1975
2010
|
}] }, { type: i1$2.MatDialogRef }]; } });
|
|
1976
2011
|
|
|
1977
|
-
function buildQueryParams(flattenedParams, items) {
|
|
1978
|
-
items.forEach(filterItem => {
|
|
1979
|
-
if (filterItem instanceof MultipleSelectItem && filterItem.isolate) {
|
|
1980
|
-
if (filterItem.multiple && filterItem.value) {
|
|
1981
|
-
const isolated = list(filterItem.values, 'value').sort();
|
|
1982
|
-
const value = filterItem.value.sort();
|
|
1983
|
-
if (arraysAreEquals(value, isolated)) {
|
|
1984
|
-
flattenedParams[filterItem.name] = null;
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
if (filterItem.isTypeAutocomplete) {
|
|
1989
|
-
if (isObject(filterItem.model)) {
|
|
1990
|
-
flattenedParams[filterItem.name] = filterToQueryParam(filterItem.model.value, filterItem.model.name);
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
else if (filterItem.isTypeAutocompleteChips || filterItem.isTypeChips) {
|
|
1994
|
-
if (Array.isArray(filterItem.model) && filterItem.model.length) {
|
|
1995
|
-
flattenedParams[filterItem.name] = filterItem.model.map((item) => {
|
|
1996
|
-
return filterToQueryParam(item.value, item.name);
|
|
1997
|
-
}).join(',');
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
});
|
|
2001
|
-
return flattenedParams;
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
2012
|
class SavedFiltersController {
|
|
2005
2013
|
constructor(_itemsStore, _dialog) {
|
|
2006
2014
|
this._itemsStore = _itemsStore;
|
|
@@ -2234,7 +2242,7 @@ class ExternalParamsController {
|
|
|
2234
2242
|
this._listenItemsChange();
|
|
2235
2243
|
}
|
|
2236
2244
|
_initItemsValues() {
|
|
2237
|
-
this._itemsStore.
|
|
2245
|
+
this._itemsStore.init(this.params);
|
|
2238
2246
|
this._saveQueryParams();
|
|
2239
2247
|
this._savePersistedParams();
|
|
2240
2248
|
}
|
|
@@ -3102,7 +3110,7 @@ class AutocompleteComponent extends BaseItemComponent {
|
|
|
3102
3110
|
}
|
|
3103
3111
|
}
|
|
3104
3112
|
AutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompleteComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3105
|
-
AutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AutocompleteComponent, selector: "filter-item-autocomplete", usesInheritance: true, ngImport: i0, template: "<fs-autocomplete\n
|
|
3113
|
+
AutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AutocompleteComponent, selector: "filter-item-autocomplete", usesInheritance: true, ngImport: i0, template: "<fs-autocomplete\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [displayWith]=\"displayWith\"\n [(ngModel)]=\"item.model\"\n [placeholder]=\"label\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [showClear]=\"item.showClear\"\n name=\"item.name\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n {{data.name}}\n </ng-template>\n</fs-autocomplete>\n", components: [{ type: i4$1.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "placeholder", "displayWith", "fetchOnFocus", "readonly", "required", "disabled", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared"] }], directives: [{ type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4$1.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3106
3114
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
3107
3115
|
type: Component,
|
|
3108
3116
|
args: [{
|
|
@@ -3147,7 +3155,7 @@ class AutocompletechipsComponent extends BaseItemComponent {
|
|
|
3147
3155
|
}
|
|
3148
3156
|
}
|
|
3149
3157
|
AutocompletechipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompletechipsComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3150
|
-
AutocompletechipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AutocompletechipsComponent, selector: "filter-item-autocompletechips", usesInheritance: true, ngImport: i0, template: "<fs-autocomplete-chips\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [ngModel]=\"item.model\"\n (selected)=\"addAutocompleteChipItem($event)\"\n (removed)=\"removeAutocompleteChipItem($event)\"\n (clear)=\"clearAutocompleteChipItem()\"\n (click)=\"clicked()\"\n [allowText]=\"false\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [placeholder]=\"label\"\n [chipImage]=\"item.chipImage\"\n [chipColor]=\"chipColor\"\n [chipIconColor]=\"chipIcon\"\n [chipBackground]=\"chipBackground\"\n [chipIcon]=\"item.chipIcon\"\n [chipClass]=\"item.chipClass\"\n [allowClear]=\"item.
|
|
3158
|
+
AutocompletechipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AutocompletechipsComponent, selector: "filter-item-autocompletechips", usesInheritance: true, ngImport: i0, template: "<fs-autocomplete-chips\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [ngModel]=\"item.model\"\n (selected)=\"addAutocompleteChipItem($event)\"\n (removed)=\"removeAutocompleteChipItem($event)\"\n (clear)=\"clearAutocompleteChipItem()\"\n (click)=\"clicked()\"\n [allowText]=\"false\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [placeholder]=\"label\"\n [chipImage]=\"item.chipImage\"\n [chipColor]=\"chipColor\"\n [chipIconColor]=\"chipIcon\"\n [chipBackground]=\"chipBackground\"\n [chipIcon]=\"item.chipIcon\"\n [chipClass]=\"item.chipClass\"\n [allowClear]=\"item.showClear\"\n [removable]=\"item.showClear\"\n [compareWith]=\"compareItems\"\n [panelWidth]=\"300\"\n name=\"model\">\n <ng-template fsAutocompleteObject let-object=\"object\">\n {{ object.name }}\n </ng-template>\n</fs-autocomplete-chips>\n\n<!--<mat-form-field floatLabel=\"auto\">\n <mat-label>{{item.label}}</mat-label>\n <mat-chip-list #chipList>\n <mat-chip *ngFor=\"let item of item.model\"\n (removed)=\"removeAutocompleteChipItem(item)\">\n {{ item.name }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n\n <input #chipsInput\n type=\"text\"\n matInput\n [(ngModel)]=\"item.selectedValue\"\n (ngModelChange)=\"onAutocompleteChipsChange(chipsInput)\"\n [name]=\"item.name\"\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"autocompleteChipsInput\">\n </mat-chip-list>\n\n <mat-autocomplete #autocompleteChipsInput=\"matAutocomplete\"\n (optionSelected)=\"addAutocompleteChipItem( $event)\"\n >\n <mat-option *ngFor=\"let item of item.values$ | async\" [value]=\"item\">\n {{ item.name }}\n </mat-option>\n </mat-autocomplete>\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>-->\n", components: [{ type: i5.FsAutocompleteChipsComponent, selector: "fs-autocomplete-chips", inputs: ["fetch", "readonly", "size", "placeholder", "chipImage", "chipBackground", "chipColor", "chipIcon", "chipIconColor", "chipClass", "hint", "allowText", "allowObject", "delay", "validateText", "removable", "allowClear", "color", "background", "orderable", "limit", "initOnClick", "fetchOnFocus", "multiple", "confirm", "panelClass", "compareWith", "disabled", "panelWidth"], outputs: ["selected", "removed", "reordered", "clear"] }], directives: [{ type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5.FsAutocompleteObjectDirective, selector: "[fsAutocompleteObject],[fsAutocompleteChipsTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3151
3159
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompletechipsComponent, decorators: [{
|
|
3152
3160
|
type: Component,
|
|
3153
3161
|
args: [{
|
|
@@ -3181,7 +3189,7 @@ class DateComponent extends BaseItemComponent {
|
|
|
3181
3189
|
}
|
|
3182
3190
|
}
|
|
3183
3191
|
DateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3184
|
-
DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateComponent, selector: "filter-item-date", usesInheritance: true, ngImport: i0, template: "<mat-form-field *ngIf=\"item.mode===itemDateMode.Calendar; else elseMode\">\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDatePicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [view]=\"viewType\"\n [clear]=\"item.
|
|
3192
|
+
DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateComponent, selector: "filter-item-date", usesInheritance: true, ngImport: i0, template: "<mat-form-field *ngIf=\"item.mode===itemDateMode.Calendar; else elseMode\">\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDatePicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [view]=\"viewType\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>\n\n<ng-template #elseMode>\n <mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateScrollPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [showMonth]=\"showMonth\"\n [showDay]=\"showDay\"\n [showYear]=\"showYear\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n </mat-form-field>\n</ng-template>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3$3.FsDatePickerComponent, selector: "[fsDatePicker]", inputs: ["minYear", "maxYear", "minDate", "maxDate", "startOfDay", "view", "format", "minutes"], outputs: ["change"] }, { type: i3$3.FsDateScrollPickerComponent, selector: "[fsDateScrollPicker]", inputs: ["minYear", "maxYear", "maxDate", "showMonth", "showYear", "showDay"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1$3.MatPlaceholder, selector: "mat-placeholder" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3185
3193
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateComponent, decorators: [{
|
|
3186
3194
|
type: Component,
|
|
3187
3195
|
args: [{
|
|
@@ -3208,7 +3216,7 @@ class DateRangeComponent extends BaseItemComponent {
|
|
|
3208
3216
|
}
|
|
3209
3217
|
}
|
|
3210
3218
|
DateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3211
|
-
DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateRangeComponent, selector: "filter-item-date-range", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label[0]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n [fsDateRangeFrom]=\"item.name\"\n [(ngModel)]=\"item.model.from\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.
|
|
3219
|
+
DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateRangeComponent, selector: "filter-item-date-range", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label[0]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n [fsDateRangeFrom]=\"item.name\"\n [(ngModel)]=\"item.model.from\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.showClear\"\n [view]=\"viewType\"\n name=\"date_from\">\n</mat-form-field>\n\n<mat-form-field>\n <mat-label>{{item.label[1]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n [fsDateRangeTo]=\"item.name\"\n [(ngModel)]=\"item.model.to\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.showClear\"\n [view]=\"viewType\"\n name=\"date_to\">\n</mat-form-field>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3$3.DateRangePickerFromComponent, selector: "[fsDateRangeFrom],[fsDateRangeFromPicker]", inputs: ["fsDateRangeFrom", "fsDateRangeFromPicker"] }, { type: i3$3.DateRangePickerToComponent, selector: "[fsDateRangeTo],[fsDateRangeToPicker]", inputs: ["fsDateRangeTo", "fsDateRangeToPicker"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3212
3220
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, decorators: [{
|
|
3213
3221
|
type: Component,
|
|
3214
3222
|
args: [{
|
|
@@ -3227,7 +3235,7 @@ class WeekComponent extends BaseItemComponent {
|
|
|
3227
3235
|
ngOnInit() { }
|
|
3228
3236
|
}
|
|
3229
3237
|
WeekComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WeekComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3230
|
-
WeekComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WeekComponent, selector: "filter-item-week", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateWeekPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [seedDate]=\"item.seedDate\"\n [clear]=\"item.
|
|
3238
|
+
WeekComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WeekComponent, selector: "filter-item-week", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateWeekPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [seedDate]=\"item.seedDate\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3$3.FsDateWeekPickerComponent, selector: "[fsDateWeekPicker]", inputs: ["minYear", "maxYear", "minDate", "maxDate", "seedDate", "period", "view"], outputs: ["change"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatPlaceholder, selector: "mat-placeholder" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3231
3239
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WeekComponent, decorators: [{
|
|
3232
3240
|
type: Component,
|
|
3233
3241
|
args: [{
|
|
@@ -3399,7 +3407,7 @@ class FilterDrawerComponent {
|
|
|
3399
3407
|
}
|
|
3400
3408
|
}
|
|
3401
3409
|
FilterDrawerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterDrawerComponent, deps: [{ token: ExternalParamsController }, { token: i0.ChangeDetectorRef }, { token: FsFilterItemsStore }, { token: FILTER_DRAWER_OVERLAY }, { token: FILTER_DRAWER_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
3402
|
-
FilterDrawerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterDrawerComponent, selector: "ng-component", inputs: { inline: "inline" }, host: { listeners: { "window:resize": "updateWindowWidth()" } }, ngImport: i0, template: "<div class=\"filters\">\n <div class=\"filters-wrap\">\n\n <div class=\"filter-by\">\n <mat-icon>tune</mat-icon>\n <span class=\"text\">Filters</span>\n </div>\n\n <div class=\"overflow-shadow filter-items\">\n <div class=\"overflow-shadow-content\">\n <ng-container *fsSkeleton=\"(externalParams.pending$ | async) !== true\">\n <filter-item *ngFor=\"let filterItem of items$ | async\"\n
|
|
3410
|
+
FilterDrawerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterDrawerComponent, selector: "ng-component", inputs: { inline: "inline" }, host: { listeners: { "window:resize": "updateWindowWidth()" } }, ngImport: i0, template: "<div class=\"filters\">\n <div class=\"filters-wrap\">\n\n <div class=\"filter-by\">\n <mat-icon>tune</mat-icon>\n <span class=\"text\">Filters</span>\n </div>\n\n <div class=\"overflow-shadow filter-items\">\n <div class=\"overflow-shadow-content\">\n <ng-container *fsSkeleton=\"(externalParams.pending$ | async) !== true\">\n <filter-item \n *ngFor=\"let filterItem of items$ | async\"\n class=\"filter-group\"\n [item]=\"filterItem\">\n </filter-item>\n\n <ng-container *ngIf=\"sortItem && sortItem.values && sortItem.values.length > 0\">\n <filter-item \n class=\"filter-group sort\"\n [item]=\"sortItem\">\n </filter-item>\n <filter-item \n class=\"filter-group sort\"\n [item]=\"sortDirectionItem\">\n </filter-item>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <fs-filter-drawer-actions \n class=\"filter-actions\"\n *ngIf=\"(externalParams.pending$ | async) !== true\"\n (clear)=\"clear()\"\n (done)=\"done()\">\n </fs-filter-drawer-actions>\n </div>\n</div>\n<div class=\"backdrop\" *ngIf=\"!windowDesktop\" (click)=\"backdropClick()\"></div>\n", styles: [":host ::ng-deep mat-form-field{width:100%}.filter-by{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:20px 25px}.filter-by mat-icon{margin-right:8px}.filter-by .text{font-weight:400;font-size:19px}.filter-actions{display:block;box-sizing:border-box;padding:13px}.filter-actions button{margin-right:6px}.filter-actions button:last-child{margin-right:0}.filters{position:fixed;display:block;top:0;right:0;z-index:1002;bottom:0}.filters .filters-wrap{background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f;width:85vw;max-width:350px;display:flex;flex-direction:column;height:100%;padding-top:calc(env(safe-area-inset-top))}.filters .filters-wrap .filter-items{overflow-y:auto}.filters .filters-wrap .filter-items .overflow-shadow-content{padding:0 25px;box-sizing:border-box}.filters .filter-group{margin:10px 0 0}.filters .filter-group:first-child{margin:0}.filters .filter label{white-space:nowrap;color:#0000008a}.filters .filter .interface.interface-range input,.filters .filter .interface.interface-range .mat-input-wrapper{text-align:center}.filters .filter .interface.interface-range{text-align:center}.filters .filter .interface.interface-datetime fs-datetime.has-time .md-input{width:100%}.filters .filter .interface fs-datetime-range input{text-align:center}.filters .filter .filter-label{width:1%;white-space:nowrap;vertical-align:middle;padding-right:15px}.filters md-autocomplete-container md-input-container{margin:0}.filters .isolate{margin-top:-12px}.filters .isolate .interface{line-height:20px;padding-bottom:1.25em}.filters .isolate md-checkbox{margin:0 0 0 2px}.backdrop{position:fixed;top:0;bottom:0;left:0;right:0;z-index:900;outline:none}\n"], components: [{ type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: FilterItemComponent, selector: "filter-item", inputs: ["item"] }, { type: FsFilterDrawerActionsComponent, selector: "fs-filter-drawer-actions", outputs: ["clear", "done"] }], directives: [{ type: i6$1.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3403
3411
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterDrawerComponent, decorators: [{
|
|
3404
3412
|
type: Component,
|
|
3405
3413
|
args: [{
|
|
@@ -3747,7 +3755,7 @@ class FsFilterChipComponent {
|
|
|
3747
3755
|
}
|
|
3748
3756
|
}
|
|
3749
3757
|
FsFilterChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FocusControllerService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3750
|
-
FsFilterChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFilterChipComponent, selector: "fs-filter-chip", inputs: { item: "item" }, ngImport: i0, template: "<ng-container *ngIf=\"!item.hasPendingValues || (chipDelayedRender$ | async)\">\n <ng-container *ngIf=\"rangeItem; else defaultChip\">\n <fs-chip\n *ngIf=\"item.model?.min || item.model?.from\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.
|
|
3758
|
+
FsFilterChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFilterChipComponent, selector: "fs-filter-chip", inputs: { item: "item" }, ngImport: i0, template: "<ng-container *ngIf=\"!item.hasPendingValues || (chipDelayedRender$ | async)\">\n <ng-container *ngIf=\"rangeItem; else defaultChip\">\n <fs-chip\n *ngIf=\"item.model?.min || item.model?.from\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem('from')\"\n (removed)=\"removeItem($event, 'from')\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item, type: 'from' }\"\n ></ng-template>\n </fs-chip>\n\n <fs-chip\n *ngIf=\"item.model?.max || item.model?.to\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem('to')\"\n (removed)=\"removeItem($event, 'to')\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item, type: 'to' }\"\n ></ng-template>\n </fs-chip>\n\n </ng-container>\n\n <ng-template #defaultChip>\n <fs-chip\n *ngIf=\"itemVisible\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem()\"\n (removed)=\"removeItem($event)\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n ></ng-template>\n </fs-chip>\n </ng-template>\n\n <ng-template #chipContent let-item=\"item\" let-type=\"type\">\n <ng-container *ngIf=\"!item.hasPendingValues && !item.loading; else lodaingValues\">\n <fs-filter-chip-content [item]=\"item\" [type]=\"type\"></fs-filter-chip-content>\n </ng-container>\n\n <ng-template #lodaingValues>\n Loading...\n </ng-template>\n </ng-template>\n</ng-container>\n\n", styles: ["fs-chip{cursor:pointer;color:#6f6f6f}\n"], components: [{ type: i2$1.FsChipComponent, selector: "fs-chip", inputs: ["size", "value", "backgroundColor", "borderColor", "color", "outlined", "removable", "selectable", "selected", "image"], outputs: ["selectedToggled", "removed"] }, { type: FsFilterChipContentComponent, selector: "fs-filter-chip-content", inputs: ["item", "type"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3751
3759
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipComponent, decorators: [{
|
|
3752
3760
|
type: Component,
|
|
3753
3761
|
args: [{
|
|
@@ -4007,7 +4015,7 @@ class FilterComponent {
|
|
|
4007
4015
|
const item = this.getItem(name);
|
|
4008
4016
|
if (item) {
|
|
4009
4017
|
item.hide = false;
|
|
4010
|
-
this._filterItems.
|
|
4018
|
+
this._filterItems.updateItemsVisiblity();
|
|
4011
4019
|
}
|
|
4012
4020
|
}
|
|
4013
4021
|
hideItem(name) {
|
|
@@ -4016,7 +4024,7 @@ class FilterComponent {
|
|
|
4016
4024
|
return;
|
|
4017
4025
|
}
|
|
4018
4026
|
item.hide = true;
|
|
4019
|
-
this._filterItems.
|
|
4027
|
+
this._filterItems.updateItemsVisiblity();
|
|
4020
4028
|
}
|
|
4021
4029
|
clearItem(name) {
|
|
4022
4030
|
const item = this.getItem(name);
|
|
@@ -4033,7 +4041,7 @@ class FilterComponent {
|
|
|
4033
4041
|
}
|
|
4034
4042
|
item.label = (_a = params.label) !== null && _a !== void 0 ? _a : item.label;
|
|
4035
4043
|
item.chipLabel = (_b = params.chipLabel) !== null && _b !== void 0 ? _b : item.chipLabel;
|
|
4036
|
-
this._filterItems.
|
|
4044
|
+
this._filterItems.updateItemsVisiblity();
|
|
4037
4045
|
}
|
|
4038
4046
|
getItemValueChange$(name) {
|
|
4039
4047
|
const item = this.items.find((i) => i.name === name);
|