@c10t/nice-component-library 0.0.4-beta → 0.0.5-beta
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.
|
@@ -27,15 +27,15 @@ export declare class BaseSearchComponent extends BaseTableComponent implements O
|
|
|
27
27
|
protected activatedRoute: ActivatedRoute;
|
|
28
28
|
protected authoritiesService: AuthoritiesService;
|
|
29
29
|
protected formGroup: FormGroup;
|
|
30
|
-
protected moduleName: string;
|
|
31
|
-
protected unsubscribe$: Subject<void>;
|
|
32
|
-
protected isResetPaging: boolean;
|
|
33
30
|
isAdvancedSearch: boolean;
|
|
34
31
|
searchForm: FormGroup;
|
|
35
32
|
paging: TablePagingRequestModel;
|
|
36
33
|
results: MatTableDataSource<BaseModel>;
|
|
37
34
|
columns: ColumnModel[];
|
|
38
35
|
config: NiceComponentLibraryConfig;
|
|
36
|
+
protected moduleName: string;
|
|
37
|
+
protected unsubscribe$: Subject<void>;
|
|
38
|
+
protected isResetPaging: boolean;
|
|
39
39
|
constructor(router: Router, apiService: ApiService, utilsService: UtilsService, formStateService: FormStateService, translateService: TranslateService, injector: Injector, activatedRoute: ActivatedRoute, authoritiesService: AuthoritiesService, formGroup: FormGroup);
|
|
40
40
|
ngOnInit(): void;
|
|
41
41
|
ngAfterViewInit(): void;
|
|
@@ -43,9 +43,6 @@ export declare class BaseSearchComponent extends BaseTableComponent implements O
|
|
|
43
43
|
onSubmit(): void;
|
|
44
44
|
search(): void;
|
|
45
45
|
afterSearch: (data: TablePagingResponseModel) => void;
|
|
46
|
-
private afterFillData;
|
|
47
|
-
private removeEmptyParams;
|
|
48
|
-
private updateHttpParams;
|
|
49
46
|
_fillData(nativeUrl: string, params: HttpParams, baseUrl?: string): void;
|
|
50
47
|
_fillDataByPostMethod(nativeUrl: string, obj: any, options: {
|
|
51
48
|
headers?: HttpHeaders;
|
|
@@ -57,6 +54,9 @@ export declare class BaseSearchComponent extends BaseTableComponent implements O
|
|
|
57
54
|
resetSearchFormValue(): void;
|
|
58
55
|
toggleAdvancedSearch(): void;
|
|
59
56
|
params2Object(params: HttpParams): Object;
|
|
57
|
+
private afterFillData;
|
|
58
|
+
private removeEmptyParams;
|
|
59
|
+
private updateHttpParams;
|
|
60
60
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseSearchComponent, never>;
|
|
61
61
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseSearchComponent, "BaseSearchComponent", never, {}, {}, never, never, false, never>;
|
|
62
62
|
}
|
|
@@ -241,9 +241,12 @@ class Authority {
|
|
|
241
241
|
|
|
242
242
|
class TablePagingResponseModel {
|
|
243
243
|
content = [];
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
page = {
|
|
245
|
+
size: null,
|
|
246
|
+
number: null,
|
|
247
|
+
totalElements: null,
|
|
248
|
+
totalPages: null,
|
|
249
|
+
};
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
class TablePagingRequestModel {
|
|
@@ -1139,15 +1142,15 @@ class BaseSearchComponent extends BaseTableComponent {
|
|
|
1139
1142
|
activatedRoute;
|
|
1140
1143
|
authoritiesService;
|
|
1141
1144
|
formGroup;
|
|
1142
|
-
moduleName = '';
|
|
1143
|
-
unsubscribe$ = new Subject();
|
|
1144
|
-
isResetPaging = true;
|
|
1145
1145
|
isAdvancedSearch = false;
|
|
1146
1146
|
searchForm;
|
|
1147
1147
|
paging;
|
|
1148
1148
|
results = new MatTableDataSource([]);
|
|
1149
1149
|
columns = [];
|
|
1150
1150
|
config;
|
|
1151
|
+
moduleName = '';
|
|
1152
|
+
unsubscribe$ = new Subject();
|
|
1153
|
+
isResetPaging = true;
|
|
1151
1154
|
constructor(router, apiService, utilsService, formStateService, translateService, injector, activatedRoute, authoritiesService, formGroup) {
|
|
1152
1155
|
super(activatedRoute, authoritiesService);
|
|
1153
1156
|
this.router = router;
|
|
@@ -1223,41 +1226,6 @@ class BaseSearchComponent extends BaseTableComponent {
|
|
|
1223
1226
|
afterSearch = (data) => {
|
|
1224
1227
|
// Form extends will be override custom by business
|
|
1225
1228
|
};
|
|
1226
|
-
afterFillData = (data) => {
|
|
1227
|
-
this.isResetPaging = false;
|
|
1228
|
-
if (data.content && data.content.length > 0) {
|
|
1229
|
-
this.columns.forEach((column) => {
|
|
1230
|
-
column.isShowHeader = false;
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
this.afterSearch(data);
|
|
1234
|
-
this.results = new MatTableDataSource(data.content);
|
|
1235
|
-
this.paging = new TablePagingRequestModel();
|
|
1236
|
-
this.paging.pageSize = data.size ? data.size : 0;
|
|
1237
|
-
this.paging.pageNumber = (data.number ? data.number : 0) + 1;
|
|
1238
|
-
this.paging.totalElements = data.totalElements ? data.totalElements : 0;
|
|
1239
|
-
};
|
|
1240
|
-
removeEmptyParams(params) {
|
|
1241
|
-
params.keys().forEach(key => {
|
|
1242
|
-
const value = params.get(key) ? params.get(key) + '' : '';
|
|
1243
|
-
if (value) {
|
|
1244
|
-
params = params.set(key, value.trim());
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
const emptyValuesKey = params.keys().filter(key => !params.get(key));
|
|
1248
|
-
emptyValuesKey.forEach(key => {
|
|
1249
|
-
params = params.delete(key);
|
|
1250
|
-
});
|
|
1251
|
-
return params;
|
|
1252
|
-
}
|
|
1253
|
-
updateHttpParams(params) {
|
|
1254
|
-
params = this.removeEmptyParams(params);
|
|
1255
|
-
if (!params.keys().includes('pageNumber')) {
|
|
1256
|
-
params = params.append('pageNumber', this.isResetPaging ? '1' : (this.paging ? this.paging.pageNumber.toString() : '1'))
|
|
1257
|
-
.append('pageSize', this.paging ? this.paging.pageSize.toString() : this.config.PAGE_SIZE.toString());
|
|
1258
|
-
}
|
|
1259
|
-
return params;
|
|
1260
|
-
}
|
|
1261
1229
|
_fillData(nativeUrl, params, baseUrl) {
|
|
1262
1230
|
params = this.updateHttpParams(params);
|
|
1263
1231
|
this.apiService.get(nativeUrl, params, baseUrl).subscribe(this.afterFillData);
|
|
@@ -1307,6 +1275,41 @@ class BaseSearchComponent extends BaseTableComponent {
|
|
|
1307
1275
|
});
|
|
1308
1276
|
return result;
|
|
1309
1277
|
}
|
|
1278
|
+
afterFillData = (data) => {
|
|
1279
|
+
this.isResetPaging = false;
|
|
1280
|
+
if (data.content && data.content.length > 0) {
|
|
1281
|
+
this.columns.forEach((column) => {
|
|
1282
|
+
column.isShowHeader = false;
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
this.afterSearch(data);
|
|
1286
|
+
this.results = new MatTableDataSource(data.content);
|
|
1287
|
+
this.paging = new TablePagingRequestModel();
|
|
1288
|
+
this.paging.pageSize = data.page.size ? data.page.size : 0;
|
|
1289
|
+
this.paging.pageNumber = (data.page.number ? data.page.number : 0) + 1;
|
|
1290
|
+
this.paging.totalElements = data.page.totalElements ? data.page.totalElements : 0;
|
|
1291
|
+
};
|
|
1292
|
+
removeEmptyParams(params) {
|
|
1293
|
+
params.keys().forEach(key => {
|
|
1294
|
+
const value = params.get(key) ? params.get(key) + '' : '';
|
|
1295
|
+
if (value) {
|
|
1296
|
+
params = params.set(key, value.trim());
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
const emptyValuesKey = params.keys().filter(key => !params.get(key));
|
|
1300
|
+
emptyValuesKey.forEach(key => {
|
|
1301
|
+
params = params.delete(key);
|
|
1302
|
+
});
|
|
1303
|
+
return params;
|
|
1304
|
+
}
|
|
1305
|
+
updateHttpParams(params) {
|
|
1306
|
+
params = this.removeEmptyParams(params);
|
|
1307
|
+
if (!params.keys().includes('pageNumber')) {
|
|
1308
|
+
params = params.append('pageNumber', this.isResetPaging ? '1' : (this.paging ? this.paging.pageNumber.toString() : '1'))
|
|
1309
|
+
.append('pageSize', this.paging ? this.paging.pageSize.toString() : this.config.PAGE_SIZE.toString());
|
|
1310
|
+
}
|
|
1311
|
+
return params;
|
|
1312
|
+
}
|
|
1310
1313
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: BaseSearchComponent, deps: [{ token: i1$4.Router }, { token: ApiService }, { token: UtilsService }, { token: FormStateService }, { token: i1.TranslateService }, { token: i0.Injector }, { token: i1$4.ActivatedRoute }, { token: AuthoritiesService }, { token: i1$2.FormGroup }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1311
1314
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: BaseSearchComponent, isStandalone: false, selector: "BaseSearchComponent", usesInheritance: true, ngImport: i0 });
|
|
1312
1315
|
}
|