@kuzntsv/uikit 1.0.76 → 1.0.79
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.
|
@@ -2734,6 +2734,20 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2734
2734
|
}]
|
|
2735
2735
|
}
|
|
2736
2736
|
});
|
|
2737
|
+
function cleanFilterParams(filters) {
|
|
2738
|
+
const cleanParams = {};
|
|
2739
|
+
Object.keys(filters).forEach((key) => {
|
|
2740
|
+
const value = filters[key];
|
|
2741
|
+
if (isEmptyFilterValue(value)) return;
|
|
2742
|
+
cleanParams[key] = value;
|
|
2743
|
+
});
|
|
2744
|
+
return cleanParams;
|
|
2745
|
+
}
|
|
2746
|
+
function isEmptyFilterValue(value) {
|
|
2747
|
+
if (value === null || value === void 0 || value === "" || value === "-1" || value === 0) return true;
|
|
2748
|
+
if (Array.isArray(value) && value.length === 0) return true;
|
|
2749
|
+
return false;
|
|
2750
|
+
}
|
|
2737
2751
|
var BaseSignalPageClass = class BaseSignalPageClass {
|
|
2738
2752
|
dialog = inject(MatDialog);
|
|
2739
2753
|
injector = inject(Injector);
|
|
@@ -2879,13 +2893,12 @@ var BaseSignalPageClass = class BaseSignalPageClass {
|
|
|
2879
2893
|
this.subscription.unsubscribe();
|
|
2880
2894
|
}
|
|
2881
2895
|
setFilter(key, value) {
|
|
2882
|
-
const storageKey = `${this.
|
|
2896
|
+
const storageKey = `${this.storagePrefix}${String(key)}`;
|
|
2883
2897
|
this.tableState.update((prev) => ({
|
|
2884
2898
|
...prev,
|
|
2885
2899
|
pageIndex: 0
|
|
2886
2900
|
}));
|
|
2887
|
-
|
|
2888
|
-
if (Array.isArray(value) && value.length === 0) isValueEmpty = true;
|
|
2901
|
+
const isValueEmpty = isEmptyFilterValue(value);
|
|
2889
2902
|
if (isValueEmpty) this.localStorageService.removeData(storageKey);
|
|
2890
2903
|
else this.localStorageService.saveData(storageKey, JSON.stringify(value));
|
|
2891
2904
|
this.filters.update((prev) => {
|
|
@@ -2900,6 +2913,27 @@ var BaseSignalPageClass = class BaseSignalPageClass {
|
|
|
2900
2913
|
};
|
|
2901
2914
|
});
|
|
2902
2915
|
}
|
|
2916
|
+
setFilters(fields) {
|
|
2917
|
+
this.tableState.update((prev) => ({
|
|
2918
|
+
...prev,
|
|
2919
|
+
pageIndex: 0
|
|
2920
|
+
}));
|
|
2921
|
+
this.filters.update((prev) => {
|
|
2922
|
+
const next = { ...prev };
|
|
2923
|
+
Object.keys(fields).forEach((key) => {
|
|
2924
|
+
const value = fields[key];
|
|
2925
|
+
const storageKey = `${this.constructor.name}_Filter_${String(key)}`;
|
|
2926
|
+
if (isEmptyFilterValue(value)) {
|
|
2927
|
+
this.localStorageService.removeData(storageKey);
|
|
2928
|
+
delete next[key];
|
|
2929
|
+
} else {
|
|
2930
|
+
this.localStorageService.saveData(storageKey, JSON.stringify(value));
|
|
2931
|
+
next[key] = value;
|
|
2932
|
+
}
|
|
2933
|
+
});
|
|
2934
|
+
return next;
|
|
2935
|
+
});
|
|
2936
|
+
}
|
|
2903
2937
|
onPageChange(pageState) {
|
|
2904
2938
|
this.localStorageService.saveData(this.constructor.name + "PageIndex", pageState.pageIndex.toString());
|
|
2905
2939
|
this.localStorageService.saveData(this.constructor.name + "PageSize", pageState.pageSize.toString());
|
|
@@ -3116,16 +3150,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
3116
3150
|
decorators: [{ type: Directive }],
|
|
3117
3151
|
ctorParameters: () => []
|
|
3118
3152
|
});
|
|
3119
|
-
function cleanFilterParams(filters) {
|
|
3120
|
-
const cleanParams = {};
|
|
3121
|
-
Object.keys(filters).forEach((key) => {
|
|
3122
|
-
const value = filters[key];
|
|
3123
|
-
if (value === null || value === void 0 || value === "" || value === 0) return;
|
|
3124
|
-
if (Array.isArray(value) && value.length === 0) return;
|
|
3125
|
-
cleanParams[key] = value;
|
|
3126
|
-
});
|
|
3127
|
-
return cleanParams;
|
|
3128
|
-
}
|
|
3129
3153
|
var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
3130
3154
|
schemaDTO;
|
|
3131
3155
|
countRoute = "count";
|