@bcgov/nr-ngx-component-lib 0.0.58 → 0.0.60
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/components/schedule/schedule.component.d.ts +5 -7
- package/directives/pagination.base.d.ts +8 -0
- package/directives/row-list.base.d.ts +2 -0
- package/esm2022/components/schedule/schedule.component.mjs +18 -13
- package/esm2022/components/tabs/tab-group/tab-group.component.mjs +1 -2
- package/esm2022/directives/pagination.base.mjs +11 -1
- package/esm2022/directives/row-list.base.mjs +60 -13
- package/esm2022/utils/row-list.util.mjs +26 -1
- package/fesm2022/bcgov-nr-ngx-component-lib.mjs +112 -26
- package/fesm2022/bcgov-nr-ngx-component-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/row-list.util.d.ts +9 -0
|
@@ -1322,6 +1322,31 @@ class ObservableAborter {
|
|
|
1322
1322
|
return this._promise;
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
+
class ObservableAborterGroup {
|
|
1326
|
+
constructor(delay = 500) {
|
|
1327
|
+
this.delay = delay;
|
|
1328
|
+
this._group = [];
|
|
1329
|
+
this._aborted = false;
|
|
1330
|
+
}
|
|
1331
|
+
add(observable) {
|
|
1332
|
+
if (this._aborted)
|
|
1333
|
+
throw Error('already aborted');
|
|
1334
|
+
let oa = new ObservableAborter(observable, this.delay);
|
|
1335
|
+
this._group.push(oa);
|
|
1336
|
+
return oa.promise;
|
|
1337
|
+
}
|
|
1338
|
+
abort() {
|
|
1339
|
+
if (this._aborted)
|
|
1340
|
+
return;
|
|
1341
|
+
this._group.forEach(oa => {
|
|
1342
|
+
oa.abort();
|
|
1343
|
+
});
|
|
1344
|
+
this._aborted = true;
|
|
1345
|
+
}
|
|
1346
|
+
get allCompleted() {
|
|
1347
|
+
return Promise.all(this._group.map(oa => oa.promise.then(res => { }, err => { }))).then(res => { });
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1325
1350
|
|
|
1326
1351
|
class PaginationBase extends NrclBase {
|
|
1327
1352
|
constructor() {
|
|
@@ -1348,6 +1373,7 @@ class PaginationBase extends NrclBase {
|
|
|
1348
1373
|
this._filter = this.clone(f);
|
|
1349
1374
|
}
|
|
1350
1375
|
ngAfterViewInit() {
|
|
1376
|
+
// console.log('PaginationBase.ngAfterViewInit')
|
|
1351
1377
|
this.loadPageState();
|
|
1352
1378
|
}
|
|
1353
1379
|
clone(obj) {
|
|
@@ -1400,6 +1426,15 @@ class PaginationBase extends NrclBase {
|
|
|
1400
1426
|
totalItems: this._totalRowCount
|
|
1401
1427
|
};
|
|
1402
1428
|
}
|
|
1429
|
+
getPagingInfoRequest(query) {
|
|
1430
|
+
return {
|
|
1431
|
+
query,
|
|
1432
|
+
pageNumber: this._pageConfig.pageNumber,
|
|
1433
|
+
pageRowCount: this._pageConfig.pageSize,
|
|
1434
|
+
sortColumn: this.sortActive,
|
|
1435
|
+
sortDirection: this.sortDirection
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1403
1438
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PaginationBase, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1404
1439
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: PaginationBase, usesInheritance: true, ngImport: i0 }); }
|
|
1405
1440
|
}
|
|
@@ -1415,6 +1450,7 @@ class RowListBase extends PaginationBase {
|
|
|
1415
1450
|
this.isLoadingChange = new EventEmitter();
|
|
1416
1451
|
this._isLoading = false;
|
|
1417
1452
|
this._rows = [];
|
|
1453
|
+
this._inProgress = new InProgress();
|
|
1418
1454
|
}
|
|
1419
1455
|
get isLoading() { return this._isLoading; }
|
|
1420
1456
|
set isLoading(v) {
|
|
@@ -1425,15 +1461,47 @@ class RowListBase extends PaginationBase {
|
|
|
1425
1461
|
}
|
|
1426
1462
|
get rows() { return this._rows; }
|
|
1427
1463
|
ngAfterViewInit() {
|
|
1464
|
+
// console.log('RowListBase.ngAfterViewInit')
|
|
1428
1465
|
super.ngAfterViewInit();
|
|
1429
1466
|
this.refreshRowList();
|
|
1430
1467
|
}
|
|
1431
1468
|
refreshRowList() {
|
|
1432
|
-
|
|
1433
|
-
}
|
|
1434
|
-
loadRowList() {
|
|
1469
|
+
// console.warn('RowListBase.refreshRowList')
|
|
1435
1470
|
this.isLoading = true;
|
|
1436
1471
|
this.changeDetectorRef.detectChanges();
|
|
1472
|
+
if (!this._inProgress.isCompleted)
|
|
1473
|
+
this._inProgress.cancel();
|
|
1474
|
+
let inProgress = this._inProgress = new InProgress();
|
|
1475
|
+
return Promise.resolve()
|
|
1476
|
+
.then(() => {
|
|
1477
|
+
return this.loadRowList();
|
|
1478
|
+
})
|
|
1479
|
+
.then((res) => {
|
|
1480
|
+
if (!res)
|
|
1481
|
+
return;
|
|
1482
|
+
if (inProgress.isCancelled)
|
|
1483
|
+
return;
|
|
1484
|
+
return this.parseRowList(res);
|
|
1485
|
+
})
|
|
1486
|
+
.then(res => {
|
|
1487
|
+
if (inProgress.isCancelled)
|
|
1488
|
+
return;
|
|
1489
|
+
return this.completedRowListPage();
|
|
1490
|
+
})
|
|
1491
|
+
.catch((err) => {
|
|
1492
|
+
if (err instanceof Aborted)
|
|
1493
|
+
return;
|
|
1494
|
+
this.loadRowListPageFailed(err);
|
|
1495
|
+
})
|
|
1496
|
+
.finally(() => {
|
|
1497
|
+
if (inProgress.isCancelled)
|
|
1498
|
+
return;
|
|
1499
|
+
inProgress.complete();
|
|
1500
|
+
this.isLoading = false;
|
|
1501
|
+
this.changeDetectorRef.detectChanges();
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
loadRowList() {
|
|
1437
1505
|
if (this._loadRowListRequest)
|
|
1438
1506
|
this._loadRowListRequest.abort();
|
|
1439
1507
|
this._loadRowListRequest = new ObservableAborter(() => {
|
|
@@ -1446,15 +1514,6 @@ class RowListBase extends PaginationBase {
|
|
|
1446
1514
|
.then(res => {
|
|
1447
1515
|
this._totalRowCount = this.parseTotalRowCount(res);
|
|
1448
1516
|
this._rows = this.parseRows(res);
|
|
1449
|
-
})
|
|
1450
|
-
.catch((e) => {
|
|
1451
|
-
if (e instanceof Aborted)
|
|
1452
|
-
return;
|
|
1453
|
-
this.loadRowListPageFailed(e);
|
|
1454
|
-
})
|
|
1455
|
-
.finally(() => {
|
|
1456
|
-
this.isLoading = false;
|
|
1457
|
-
this.changeDetectorRef.detectChanges();
|
|
1458
1517
|
});
|
|
1459
1518
|
}
|
|
1460
1519
|
parseTotalRowCount(res) {
|
|
@@ -1462,6 +1521,7 @@ class RowListBase extends PaginationBase {
|
|
|
1462
1521
|
return res['totalRowCount'];
|
|
1463
1522
|
throw 'Missing res.totalRowCount, might need to override RowListBase.parseTotalRowCount';
|
|
1464
1523
|
}
|
|
1524
|
+
completedRowListPage() { }
|
|
1465
1525
|
loadRowListPageFailed(error) {
|
|
1466
1526
|
console.warn(error);
|
|
1467
1527
|
this._rows = [];
|
|
@@ -1482,6 +1542,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
1482
1542
|
}], propDecorators: { isLoadingChange: [{
|
|
1483
1543
|
type: Output
|
|
1484
1544
|
}] } });
|
|
1545
|
+
class InProgress {
|
|
1546
|
+
constructor() {
|
|
1547
|
+
this._completed = false;
|
|
1548
|
+
this._cancelled = false;
|
|
1549
|
+
}
|
|
1550
|
+
complete() {
|
|
1551
|
+
if (this.isCancelled)
|
|
1552
|
+
return;
|
|
1553
|
+
this._completed = true;
|
|
1554
|
+
}
|
|
1555
|
+
cancel() {
|
|
1556
|
+
if (this.isCompleted)
|
|
1557
|
+
return;
|
|
1558
|
+
this._cancelled = true;
|
|
1559
|
+
}
|
|
1560
|
+
get isCompleted() {
|
|
1561
|
+
return this._completed;
|
|
1562
|
+
}
|
|
1563
|
+
get isCancelled() {
|
|
1564
|
+
return this._cancelled;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1485
1567
|
|
|
1486
1568
|
class RowListDesktopComponent extends NrclBase {
|
|
1487
1569
|
constructor() {
|
|
@@ -2210,7 +2292,6 @@ class TabGroupComponent extends NrclBase {
|
|
|
2210
2292
|
this.isClassic = false;
|
|
2211
2293
|
}
|
|
2212
2294
|
ngOnChanges(changes) {
|
|
2213
|
-
console.log(changes);
|
|
2214
2295
|
this.updateState();
|
|
2215
2296
|
}
|
|
2216
2297
|
ngAfterViewInit() {
|
|
@@ -2331,36 +2412,41 @@ class ScheduleComponent extends RowListBase {
|
|
|
2331
2412
|
this._templates = [];
|
|
2332
2413
|
}
|
|
2333
2414
|
ngOnChanges(changes) {
|
|
2334
|
-
this.refreshRowList()
|
|
2415
|
+
// this.refreshRowList()
|
|
2335
2416
|
}
|
|
2336
2417
|
ngAfterViewInit() {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2418
|
+
// console.log('ScheduleComponent.ngAfterViewInit')
|
|
2419
|
+
super.ngAfterViewInit();
|
|
2420
|
+
}
|
|
2421
|
+
loadRowList() {
|
|
2422
|
+
if (!this.provider?.startloadSchedule)
|
|
2423
|
+
throw Error('ScheduleComponent.provider.startloadSchedule not set');
|
|
2424
|
+
return this.provider.startloadSchedule(super.loadRowList);
|
|
2340
2425
|
}
|
|
2341
2426
|
fetchRowListPage() {
|
|
2342
2427
|
if (!this.provider?.fetchSchedule)
|
|
2343
2428
|
throw Error('ScheduleComponent.provider.fetchSchedule not set');
|
|
2344
|
-
return this.provider.fetchSchedule(
|
|
2345
|
-
pageNumber: this.pageNumber,
|
|
2346
|
-
pageSize: this.pageSize,
|
|
2347
|
-
sortActive: this.sortActive,
|
|
2348
|
-
sortDirection: this.sortDirection,
|
|
2349
|
-
});
|
|
2429
|
+
return this.provider.fetchSchedule();
|
|
2350
2430
|
}
|
|
2351
2431
|
parseRows(res) {
|
|
2352
2432
|
if (!this.provider?.parseSchedule)
|
|
2353
|
-
throw Error('
|
|
2433
|
+
throw Error('ScheduleComponent.provider.parseSchedule not set');
|
|
2354
2434
|
let rows = this.provider.parseSchedule(res);
|
|
2355
2435
|
return this.makeRows(rows);
|
|
2356
2436
|
}
|
|
2357
2437
|
getInitialPageState() {
|
|
2358
2438
|
if (!this.provider?.getInitialPageState)
|
|
2359
|
-
throw Error('
|
|
2439
|
+
throw Error('ScheduleComponent.provider.getInitialPageState not set');
|
|
2360
2440
|
return this.provider.getInitialPageState();
|
|
2361
2441
|
}
|
|
2442
|
+
completedRowListPage() {
|
|
2443
|
+
if (!this.provider?.completedLoadSchedule)
|
|
2444
|
+
throw Error('ScheduleComponent.provider.completedRowListPage not set');
|
|
2445
|
+
return this.provider.completedLoadSchedule(super.completedRowListPage);
|
|
2446
|
+
}
|
|
2362
2447
|
onSamePageFilterChange(ev) {
|
|
2363
2448
|
this.filter = ev;
|
|
2449
|
+
this.refreshRowList();
|
|
2364
2450
|
}
|
|
2365
2451
|
makeRows(schedule) {
|
|
2366
2452
|
let start = moment(this.startDate);
|
|
@@ -2894,5 +2980,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2894
2980
|
* Generated bundle index. Do not edit.
|
|
2895
2981
|
*/
|
|
2896
2982
|
|
|
2897
|
-
export { Aborted, ButtonComponent, CellContentComponent, CodeTable, ConfigurationService, ConfigurationSubscriberBase, DATE_FORMATS, DesktopViewDirective, DeviceViewComponent, DialogBase, DialogComponent, DialogConfirmComponent, DialogService, ExpansionPanelComponent, ExpansionPanelFooterComponent, ExpansionPanelHeaderComponent, ExpansionPanelSectionComponent, FilterContainerComponent, FilterDateComponent, FilterSearchComponent, FilterSelectComponent, FiltersPanelComponent, FormFieldComponent, FormLayoutComponent, GapComponent, IconComponent, IndicatorComponent, IndicatorSelectComponent, ListAttachmentsComponent, ListEventHistoryComponent, ListSelectComponent, LoadingStatusComponent, MobileViewDirective, NrNgxComponentLibModule, NrclBase, ObservableAborter, PageContainerComponent, PageHeaderComponent, PageStateService, PaginationBase, ResourceScheduleComponent, ResourceScheduleRowHeadingDirective, RowListBase, RowListDesktopComponent, RowListMobileComponent, RowListPaginationComponent, RowListSortingComponent, ScheduleComponent, ScheduleItemDirective, ScheduleRowHeadingDirective, SnackbarComponent, SnackbarUtilService, TabComponent, TabContentDirective, TabGroupComponent, TabLabelDirective, TagListComponent, mapToCodeDescription, unwrapFilterValue, wrapFilterValue };
|
|
2983
|
+
export { Aborted, ButtonComponent, CellContentComponent, CodeTable, ConfigurationService, ConfigurationSubscriberBase, DATE_FORMATS, DesktopViewDirective, DeviceViewComponent, DialogBase, DialogComponent, DialogConfirmComponent, DialogService, ExpansionPanelComponent, ExpansionPanelFooterComponent, ExpansionPanelHeaderComponent, ExpansionPanelSectionComponent, FilterContainerComponent, FilterDateComponent, FilterSearchComponent, FilterSelectComponent, FiltersPanelComponent, FormFieldComponent, FormLayoutComponent, GapComponent, IconComponent, IndicatorComponent, IndicatorSelectComponent, ListAttachmentsComponent, ListEventHistoryComponent, ListSelectComponent, LoadingStatusComponent, MobileViewDirective, NrNgxComponentLibModule, NrclBase, ObservableAborter, ObservableAborterGroup, PageContainerComponent, PageHeaderComponent, PageStateService, PaginationBase, ResourceScheduleComponent, ResourceScheduleRowHeadingDirective, RowListBase, RowListDesktopComponent, RowListMobileComponent, RowListPaginationComponent, RowListSortingComponent, ScheduleComponent, ScheduleItemDirective, ScheduleRowHeadingDirective, SnackbarComponent, SnackbarUtilService, TabComponent, TabContentDirective, TabGroupComponent, TabLabelDirective, TagListComponent, mapToCodeDescription, unwrapFilterValue, wrapFilterValue };
|
|
2898
2984
|
//# sourceMappingURL=bcgov-nr-ngx-component-lib.mjs.map
|