@recursyve/nice-data-filter-kit 13.1.2 → 13.1.5
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/esm2020/lib/api/filter.api.mjs +3 -3
- package/esm2020/lib/components/base-list/base-list.component.mjs +24 -4
- package/esm2020/lib/components/base-list/providers/base-filter.service.mjs +3 -3
- package/esm2020/lib/components/base-list/store/base-list.service.mjs +18 -13
- package/esm2020/lib/components/base-list/store/base-list.store.mjs +3 -2
- package/esm2020/lib/components/multi-state-list/multi-state-list.component.mjs +2 -2
- package/fesm2015/recursyve-nice-data-filter-kit.mjs +48 -22
- package/fesm2015/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/fesm2020/recursyve-nice-data-filter-kit.mjs +47 -21
- package/fesm2020/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/lib/api/filter.api.d.ts +13 -2
- package/lib/components/base-list/base-list.component.d.ts +4 -2
- package/lib/components/base-list/providers/base-filter.service.d.ts +2 -2
- package/lib/components/base-list/store/base-list.service.d.ts +2 -1
- package/lib/components/base-list/store/base-list.store.d.ts +1 -0
- package/package.json +1 -1
|
@@ -125,8 +125,8 @@ class NiceFilterApi {
|
|
|
125
125
|
this.path = path;
|
|
126
126
|
this.http = http;
|
|
127
127
|
}
|
|
128
|
-
filter(queryModel) {
|
|
129
|
-
return this.http.post(this.url("filter"), queryModel);
|
|
128
|
+
filter(queryModel, option = {}) {
|
|
129
|
+
return this.http.post(this.url("filter"), queryModel, option);
|
|
130
130
|
}
|
|
131
131
|
filterCount(queryModel) {
|
|
132
132
|
return this.http.post(this.url("filter-count"), queryModel);
|
|
@@ -525,8 +525,8 @@ class NiceFilterService {
|
|
|
525
525
|
constructor(api) {
|
|
526
526
|
this.api = api;
|
|
527
527
|
}
|
|
528
|
-
filter(params) {
|
|
529
|
-
return this.api?.filter(FilterUtils.parametersToRequest(params));
|
|
528
|
+
filter(params, option = {}) {
|
|
529
|
+
return this.api?.filter(FilterUtils.parametersToRequest(params), option);
|
|
530
530
|
}
|
|
531
531
|
getFile(type, parameters) {
|
|
532
532
|
return this.api?.downloadData(type, FilterUtils.parametersToRequest(parameters));
|
|
@@ -651,7 +651,8 @@ const initialBaseListState = {
|
|
|
651
651
|
},
|
|
652
652
|
filterConfig: [],
|
|
653
653
|
showQueryBuilder: false,
|
|
654
|
-
defaultRules: []
|
|
654
|
+
defaultRules: [],
|
|
655
|
+
queryParams: {}
|
|
655
656
|
};
|
|
656
657
|
let NiceBaseListStore = class NiceBaseListStore extends Store {
|
|
657
658
|
constructor(parameters, defaultRules) {
|
|
@@ -935,6 +936,9 @@ class NiceBaseListService {
|
|
|
935
936
|
mergePageResults: mode === "infinite-scroll"
|
|
936
937
|
});
|
|
937
938
|
}
|
|
939
|
+
setQueryParams(queryParams) {
|
|
940
|
+
this.store.update({ queryParams });
|
|
941
|
+
}
|
|
938
942
|
loadQueryParams(autoLoad) {
|
|
939
943
|
this.activatedRoute?.queryParams
|
|
940
944
|
.pipe(takeUntil(this.unsubscribeAll$), map((params) => {
|
|
@@ -963,7 +967,7 @@ class NiceBaseListService {
|
|
|
963
967
|
return this.loadData(parameters, updateQueryParams, true);
|
|
964
968
|
}
|
|
965
969
|
async loadData(parameters, updateQueryParams = true, reset = false) {
|
|
966
|
-
const { disabled } = this.store.getValue();
|
|
970
|
+
const { disabled, queryParams } = this.store.getValue();
|
|
967
971
|
try {
|
|
968
972
|
const filterParameters = this.mergeParameters(parameters);
|
|
969
973
|
if (filterParameters) {
|
|
@@ -972,7 +976,9 @@ class NiceBaseListService {
|
|
|
972
976
|
if (!disabled) {
|
|
973
977
|
this.store.setLoading(true);
|
|
974
978
|
this.loadingData = true;
|
|
975
|
-
const result = await firstValueFrom(this.filterService.filter(this.getParameters(filterParameters)
|
|
979
|
+
const result = await firstValueFrom(this.filterService.filter(this.getParameters(filterParameters), {
|
|
980
|
+
params: queryParams
|
|
981
|
+
}));
|
|
976
982
|
this.store.setResult(result, reset);
|
|
977
983
|
}
|
|
978
984
|
}
|
|
@@ -1166,16 +1172,6 @@ class NiceBaseListService {
|
|
|
1166
1172
|
}
|
|
1167
1173
|
});
|
|
1168
1174
|
}
|
|
1169
|
-
async updateQueryParams(queryParams) {
|
|
1170
|
-
if (!this.activatedRoute) {
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
await this.router.navigate([], {
|
|
1174
|
-
relativeTo: this.activatedRoute,
|
|
1175
|
-
queryParams,
|
|
1176
|
-
queryParamsHandling: "merge"
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
1175
|
getParameters(filterParameters) {
|
|
1180
1176
|
const { defaultRules } = this.store.getValue();
|
|
1181
1177
|
const parameters = {
|
|
@@ -1190,6 +1186,16 @@ class NiceBaseListService {
|
|
|
1190
1186
|
}
|
|
1191
1187
|
return parameters;
|
|
1192
1188
|
}
|
|
1189
|
+
async updateQueryParams(queryParams) {
|
|
1190
|
+
if (!this.activatedRoute) {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
await this.router.navigate([], {
|
|
1194
|
+
relativeTo: this.activatedRoute,
|
|
1195
|
+
queryParams,
|
|
1196
|
+
queryParamsHandling: "merge"
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1193
1199
|
mergeParameters(parameters) {
|
|
1194
1200
|
const { filterParameters } = this.store.getValue();
|
|
1195
1201
|
if (!parameters) {
|
|
@@ -1770,6 +1776,7 @@ class NiceBaseListComponent {
|
|
|
1770
1776
|
this.canExport = true;
|
|
1771
1777
|
this.disableRouting = false;
|
|
1772
1778
|
this.customExport = [];
|
|
1779
|
+
this.queryParams = {};
|
|
1773
1780
|
this.newPage = new EventEmitter();
|
|
1774
1781
|
this.defaultPageSizeOptions = [10, 25, 50, 100];
|
|
1775
1782
|
this.columnNames = [];
|
|
@@ -1802,7 +1809,7 @@ class NiceBaseListComponent {
|
|
|
1802
1809
|
|| xl && !this.listLayout.xl;
|
|
1803
1810
|
}));
|
|
1804
1811
|
this.searchText$ = new Subject();
|
|
1805
|
-
this.
|
|
1812
|
+
this.setColumns(columns);
|
|
1806
1813
|
}
|
|
1807
1814
|
get prefixButtons() {
|
|
1808
1815
|
return this.buttons?.find(x => x.position === "prefix")?.template;
|
|
@@ -1841,6 +1848,9 @@ class NiceBaseListComponent {
|
|
|
1841
1848
|
if ("mode" in changes) {
|
|
1842
1849
|
this.service.setMode(changes.mode.currentValue);
|
|
1843
1850
|
}
|
|
1851
|
+
if ("queryParams" in changes) {
|
|
1852
|
+
this.service.setQueryParams(changes.queryParams.currentValue);
|
|
1853
|
+
}
|
|
1844
1854
|
}
|
|
1845
1855
|
setLoading(loading) {
|
|
1846
1856
|
this.service.setLoading(loading);
|
|
@@ -1937,13 +1947,27 @@ class NiceBaseListComponent {
|
|
|
1937
1947
|
clickPdf() {
|
|
1938
1948
|
this.service.downloadData("pdf");
|
|
1939
1949
|
}
|
|
1940
|
-
|
|
1950
|
+
setColumns(columns) {
|
|
1941
1951
|
this.columns = columns;
|
|
1942
1952
|
this.columnNames = columns.map(x => x.id);
|
|
1943
1953
|
}
|
|
1954
|
+
addColumns(columns, prepend = false) {
|
|
1955
|
+
if (prepend) {
|
|
1956
|
+
this.setColumns([
|
|
1957
|
+
...columns,
|
|
1958
|
+
...this.columns
|
|
1959
|
+
]);
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
this.setColumns([
|
|
1963
|
+
...this.columns,
|
|
1964
|
+
...columns
|
|
1965
|
+
]);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1944
1968
|
}
|
|
1945
1969
|
NiceBaseListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceBaseListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: TABLE_COLUMNS }, { token: EXPORTS_SETTINGS }, { token: NiceBaseListQuery }, { token: NiceBaseListService }, { token: i2.ActivatedRoute }, { token: i4$1.MatBottomSheet }, { token: i2.Router }, { token: i5.NiceMediaWatcherService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1946
|
-
NiceBaseListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListComponent, selector: "nice-base-list", inputs: { mode: "mode", layout: "layout", layoutContent: "layoutContent", autoChangeLayout: "autoChangeLayout", baseRoute: "baseRoute", routeFn: "routeFn", navigateFn: "navigateFn", autoLoad: "autoLoad", pageTitle: "pageTitle", canExport: "canExport", disableRouting: "disableRouting", customExport: "customExport" }, outputs: { newPage: "newPage" }, providers: [
|
|
1970
|
+
NiceBaseListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: NiceBaseListComponent, selector: "nice-base-list", inputs: { mode: "mode", layout: "layout", layoutContent: "layoutContent", autoChangeLayout: "autoChangeLayout", baseRoute: "baseRoute", routeFn: "routeFn", navigateFn: "navigateFn", autoLoad: "autoLoad", pageTitle: "pageTitle", canExport: "canExport", disableRouting: "disableRouting", customExport: "customExport", queryParams: "queryParams" }, outputs: { newPage: "newPage" }, providers: [
|
|
1947
1971
|
NiceBaseListQuery,
|
|
1948
1972
|
NiceBaseListService,
|
|
1949
1973
|
NiceBaseListStore
|
|
@@ -2017,6 +2041,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
|
|
|
2017
2041
|
type: Input
|
|
2018
2042
|
}], customExport: [{
|
|
2019
2043
|
type: Input
|
|
2044
|
+
}], queryParams: [{
|
|
2045
|
+
type: Input
|
|
2020
2046
|
}], newPage: [{
|
|
2021
2047
|
type: Output
|
|
2022
2048
|
}] } });
|
|
@@ -2403,7 +2429,7 @@ class NiceMultiStateListComponent extends NiceBaseListComponent {
|
|
|
2403
2429
|
}
|
|
2404
2430
|
switchState(state) {
|
|
2405
2431
|
const columns = this.multiStateListService.switchState(state);
|
|
2406
|
-
this.
|
|
2432
|
+
this.setColumns(columns);
|
|
2407
2433
|
}
|
|
2408
2434
|
}
|
|
2409
2435
|
NiceMultiStateListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: NiceMultiStateListComponent, deps: [{ token: ENABLE_QUERY_BUILDER, optional: true }, { token: BASE_LIST_ICONS }, { token: BASE_LIST_LAYOUT }, { token: EXPORTS_SETTINGS }, { token: NiceMultiStateListQuery }, { token: i2.ActivatedRoute }, { token: i4$1.MatBottomSheet }, { token: i2.Router }, { token: i5.NiceMediaWatcherService }, { token: NiceMultiStateListService }], target: i0.ɵɵFactoryTarget.Component });
|