novo-elements 5.7.0 → 5.8.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/bundles/novo-elements.umd.js +298 -215
- package/bundles/novo-elements.umd.js.map +1 -1
- package/bundles/novo-elements.umd.min.js +1 -1
- package/bundles/novo-elements.umd.min.js.map +1 -1
- package/elements/data-table/cell-headers/data-table-checkbox-header-cell.component.d.ts +5 -1
- package/elements/data-table/cells/data-table-checkbox-cell.component.d.ts +3 -0
- package/elements/data-table/data-table-clear-button.component.d.ts +2 -0
- package/elements/data-table/data-table.component.d.ts +3 -1
- package/elements/data-table/data-table.component.scss +3 -0
- package/elements/data-table/interfaces.d.ts +3 -0
- package/elements/data-table/state/data-table-state.service.d.ts +6 -2
- package/esm2015/elements/data-table/cell-headers/data-table-checkbox-header-cell.component.js +26 -6
- package/esm2015/elements/data-table/cells/data-table-checkbox-cell.component.js +16 -5
- package/esm2015/elements/data-table/data-table-clear-button.component.js +9 -1
- package/esm2015/elements/data-table/data-table.component.js +8 -3
- package/esm2015/elements/data-table/data-table.source.js +5 -2
- package/esm2015/elements/data-table/interfaces.js +1 -1
- package/esm2015/elements/data-table/pagination/data-table-pagination.component.js +4 -1
- package/esm2015/elements/data-table/sort-filter/sort-filter.directive.js +3 -1
- package/esm2015/elements/data-table/state/data-table-state.service.js +31 -7
- package/esm2015/index.js +1 -1
- package/esm2015/services/novo-label-service.js +2 -1
- package/fesm2015/novo-elements.js +290 -214
- package/fesm2015/novo-elements.js.map +1 -1
- package/index.d.ts +1 -1
- package/novo-elements.metadata.json +1 -1
- package/package.json +1 -1
- package/services/novo-label-service.d.ts +1 -0
|
@@ -2971,6 +2971,7 @@ class NovoLabelService {
|
|
|
2971
2971
|
this.clearAllNormalCase = 'Clear All';
|
|
2972
2972
|
this.clearSort = 'Clear Sort';
|
|
2973
2973
|
this.clearFilter = 'Clear Filter';
|
|
2974
|
+
this.clearSelected = 'Clear Selected';
|
|
2974
2975
|
this.today = 'Today';
|
|
2975
2976
|
this.now = 'Now';
|
|
2976
2977
|
this.isRequired = 'is required';
|
|
@@ -7199,6 +7200,7 @@ class DataTableState {
|
|
|
7199
7200
|
this.expandedRows = new Set();
|
|
7200
7201
|
this.isForceRefresh = false;
|
|
7201
7202
|
this.updates = new EventEmitter();
|
|
7203
|
+
this.retainSelected = false;
|
|
7202
7204
|
}
|
|
7203
7205
|
get userFiltered() {
|
|
7204
7206
|
return !!(this.filter || this.sort || this.globalSearch || this.outsideFilter);
|
|
@@ -7216,9 +7218,12 @@ class DataTableState {
|
|
|
7216
7218
|
this.filter = undefined;
|
|
7217
7219
|
}
|
|
7218
7220
|
this.page = 0;
|
|
7219
|
-
this.
|
|
7220
|
-
|
|
7221
|
+
if (!this.retainSelected) {
|
|
7222
|
+
this.selectedRows.clear();
|
|
7223
|
+
this.resetSource.next();
|
|
7224
|
+
}
|
|
7221
7225
|
this.onSortFilterChange();
|
|
7226
|
+
this.retainSelected = false;
|
|
7222
7227
|
if (fireUpdate) {
|
|
7223
7228
|
this.updates.emit({
|
|
7224
7229
|
sort: this.sort,
|
|
@@ -7230,8 +7235,8 @@ class DataTableState {
|
|
|
7230
7235
|
clearSort(fireUpdate = true) {
|
|
7231
7236
|
this.sort = undefined;
|
|
7232
7237
|
this.page = 0;
|
|
7233
|
-
this.
|
|
7234
|
-
this.
|
|
7238
|
+
this.checkRetainment('sort');
|
|
7239
|
+
this.reset(fireUpdate, true);
|
|
7235
7240
|
this.onSortFilterChange();
|
|
7236
7241
|
if (fireUpdate) {
|
|
7237
7242
|
this.updates.emit({
|
|
@@ -7245,8 +7250,8 @@ class DataTableState {
|
|
|
7245
7250
|
this.filter = undefined;
|
|
7246
7251
|
this.globalSearch = undefined;
|
|
7247
7252
|
this.page = 0;
|
|
7248
|
-
this.
|
|
7249
|
-
this.
|
|
7253
|
+
this.checkRetainment('filter');
|
|
7254
|
+
this.reset(fireUpdate, true);
|
|
7250
7255
|
this.onSortFilterChange();
|
|
7251
7256
|
if (fireUpdate) {
|
|
7252
7257
|
this.updates.emit({
|
|
@@ -7256,6 +7261,19 @@ class DataTableState {
|
|
|
7256
7261
|
});
|
|
7257
7262
|
}
|
|
7258
7263
|
}
|
|
7264
|
+
clearSelected(fireUpdate = true) {
|
|
7265
|
+
this.globalSearch = undefined;
|
|
7266
|
+
this.page = 0;
|
|
7267
|
+
this.reset(fireUpdate, true);
|
|
7268
|
+
this.onSelectionChange();
|
|
7269
|
+
if (fireUpdate) {
|
|
7270
|
+
this.updates.emit({
|
|
7271
|
+
sort: this.sort,
|
|
7272
|
+
filter: this.filter,
|
|
7273
|
+
globalSearch: this.globalSearch,
|
|
7274
|
+
});
|
|
7275
|
+
}
|
|
7276
|
+
}
|
|
7259
7277
|
onSelectionChange() {
|
|
7260
7278
|
this.selectionSource.next();
|
|
7261
7279
|
}
|
|
@@ -7263,9 +7281,12 @@ class DataTableState {
|
|
|
7263
7281
|
this.expandSource.next(targetId);
|
|
7264
7282
|
}
|
|
7265
7283
|
onPaginationChange(isPageSizeChange, pageSize) {
|
|
7284
|
+
this.checkRetainment('page');
|
|
7266
7285
|
this.paginationSource.next({ isPageSizeChange, pageSize });
|
|
7267
7286
|
}
|
|
7268
7287
|
onSortFilterChange() {
|
|
7288
|
+
this.checkRetainment('sort');
|
|
7289
|
+
this.checkRetainment('filter');
|
|
7269
7290
|
this.sortFilterSource.next({
|
|
7270
7291
|
sort: this.sort,
|
|
7271
7292
|
filter: this.filter,
|
|
@@ -7289,6 +7310,10 @@ class DataTableState {
|
|
|
7289
7310
|
}
|
|
7290
7311
|
}
|
|
7291
7312
|
}
|
|
7313
|
+
checkRetainment(caller) {
|
|
7314
|
+
var _a;
|
|
7315
|
+
this.retainSelected = ((_a = this.selectionOptions) === null || _a === void 0 ? void 0 : _a.some(option => option.label === caller)) || this.retainSelected;
|
|
7316
|
+
}
|
|
7292
7317
|
}
|
|
7293
7318
|
DataTableState.decorators = [
|
|
7294
7319
|
{ type: Injectable }
|
|
@@ -7299,6 +7324,7 @@ class NovoDataTableClearButton {
|
|
|
7299
7324
|
this.state = state;
|
|
7300
7325
|
this.ref = ref;
|
|
7301
7326
|
this.labels = labels;
|
|
7327
|
+
this.selectedClear = new EventEmitter();
|
|
7302
7328
|
this.sortClear = new EventEmitter();
|
|
7303
7329
|
this.filterClear = new EventEmitter();
|
|
7304
7330
|
this.allClear = new EventEmitter();
|
|
@@ -7311,9 +7337,14 @@ class NovoDataTableClearButton {
|
|
|
7311
7337
|
this.state.clearFilter();
|
|
7312
7338
|
this.filterClear.emit(true);
|
|
7313
7339
|
}
|
|
7340
|
+
clearSelected() {
|
|
7341
|
+
this.state.clearSelected();
|
|
7342
|
+
this.selectedClear.emit(true);
|
|
7343
|
+
}
|
|
7314
7344
|
clearAll() {
|
|
7315
7345
|
this.state.reset();
|
|
7316
7346
|
this.allClear.emit(true);
|
|
7347
|
+
this.selectedClear.emit(true);
|
|
7317
7348
|
this.sortClear.emit(true);
|
|
7318
7349
|
this.filterClear.emit(true);
|
|
7319
7350
|
}
|
|
@@ -7325,6 +7356,7 @@ NovoDataTableClearButton.decorators = [
|
|
|
7325
7356
|
<novo-dropdown side="bottom-right" class="novo-data-table-clear-button" data-automation-id="novo-data-table-clear-dropdown">
|
|
7326
7357
|
<button type="button" theme="primary" color="negative" icon="collapse" data-automation-id="novo-data-table-clear-dropdown-btn">{{ labels.clear }}</button>
|
|
7327
7358
|
<list>
|
|
7359
|
+
<item *ngIf="state.selected.length > 0" (click)="clearSelected()" data-automation-id="novo-data-table-clear-dropdown-clear-selected">{{ labels.clearSelected }}</item>
|
|
7328
7360
|
<item *ngIf="state.sort" (click)="clearSort()" data-automation-id="novo-data-table-clear-dropdown-clear-sort">{{ labels.clearSort }}</item>
|
|
7329
7361
|
<item *ngIf="state.filter" (click)="clearFilter()" data-automation-id="novo-data-table-clear-dropdown-clear-filter">{{ labels.clearFilter }}</item>
|
|
7330
7362
|
<item *ngIf="state.sort && state.filter" (click)="clearAll()" data-automation-id="novo-data-table-clear-dropdown-clear-all">{{ labels.clearAllNormalCase }}</item>
|
|
@@ -7340,6 +7372,7 @@ NovoDataTableClearButton.ctorParameters = () => [
|
|
|
7340
7372
|
{ type: NovoLabelService }
|
|
7341
7373
|
];
|
|
7342
7374
|
NovoDataTableClearButton.propDecorators = {
|
|
7375
|
+
selectedClear: [{ type: Output }],
|
|
7343
7376
|
sortClear: [{ type: Output }],
|
|
7344
7377
|
filterClear: [{ type: Output }],
|
|
7345
7378
|
allClear: [{ type: Output }]
|
|
@@ -7383,7 +7416,10 @@ class DataTableSource extends DataSource {
|
|
|
7383
7416
|
this.current = data.results.length;
|
|
7384
7417
|
this.data = data.results;
|
|
7385
7418
|
// Clear selection
|
|
7386
|
-
this.state.
|
|
7419
|
+
if (!this.state.retainSelected) {
|
|
7420
|
+
this.state.selectedRows.clear();
|
|
7421
|
+
}
|
|
7422
|
+
this.state.retainSelected = false;
|
|
7387
7423
|
this.state.onSelectionChange();
|
|
7388
7424
|
// Mark changes
|
|
7389
7425
|
setTimeout(() => {
|
|
@@ -7746,6 +7782,7 @@ class NovoDataTableSortFilter {
|
|
|
7746
7782
|
}
|
|
7747
7783
|
}
|
|
7748
7784
|
this.state.filter = filter;
|
|
7785
|
+
this.state.checkRetainment('filter');
|
|
7749
7786
|
this.state.reset(false, true);
|
|
7750
7787
|
this.state.updates.next({ filter, sort: this.state.sort });
|
|
7751
7788
|
this.state.onSortFilterChange();
|
|
@@ -7753,6 +7790,7 @@ class NovoDataTableSortFilter {
|
|
|
7753
7790
|
sort(id, value, transform) {
|
|
7754
7791
|
const sort = { id, value, transform };
|
|
7755
7792
|
this.state.sort = sort;
|
|
7793
|
+
this.state.checkRetainment('sort');
|
|
7756
7794
|
this.state.reset(false, true);
|
|
7757
7795
|
this.state.updates.next({ sort, filter: this.state.filter });
|
|
7758
7796
|
this.state.onSortFilterChange();
|
|
@@ -8288,6 +8326,7 @@ class NovoDataTable {
|
|
|
8288
8326
|
this.trackByFn = (index, item) => item.id;
|
|
8289
8327
|
this.templates = {};
|
|
8290
8328
|
this.fixedHeader = false;
|
|
8329
|
+
this.maxSelected = undefined;
|
|
8291
8330
|
this._hideGlobalSearch = true;
|
|
8292
8331
|
this.preferencesChanged = new EventEmitter();
|
|
8293
8332
|
this.loading = true;
|
|
@@ -8459,6 +8498,7 @@ class NovoDataTable {
|
|
|
8459
8498
|
}
|
|
8460
8499
|
}
|
|
8461
8500
|
ngAfterContentInit() {
|
|
8501
|
+
var _a;
|
|
8462
8502
|
if (this.displayedColumns && this.displayedColumns.length) {
|
|
8463
8503
|
this.expandable = this.displayedColumns.includes('expand');
|
|
8464
8504
|
}
|
|
@@ -8488,6 +8528,7 @@ class NovoDataTable {
|
|
|
8488
8528
|
}
|
|
8489
8529
|
this.state.page = this.paginationOptions ? this.paginationOptions.page : undefined;
|
|
8490
8530
|
this.state.pageSize = this.paginationOptions ? this.paginationOptions.pageSize : undefined;
|
|
8531
|
+
this.state.selectionOptions = (_a = this.selectionOptions) !== null && _a !== void 0 ? _a : undefined;
|
|
8491
8532
|
// Scrolling inside table
|
|
8492
8533
|
this.novoDataTableContainer.nativeElement.addEventListener('scroll', this.scrollListenerHandler);
|
|
8493
8534
|
this.initialized = true;
|
|
@@ -8732,8 +8773,8 @@ NovoDataTable.decorators = [
|
|
|
8732
8773
|
[hidden]="dataSource?.totallyEmpty && !state.userFiltered"
|
|
8733
8774
|
>
|
|
8734
8775
|
<ng-container cdkColumnDef="selection">
|
|
8735
|
-
<novo-data-table-checkbox-header-cell *cdkHeaderCellDef></novo-data-table-checkbox-header-cell>
|
|
8736
|
-
<novo-data-table-checkbox-cell *cdkCellDef="let row; let i = index" [row]="row"></novo-data-table-checkbox-cell>
|
|
8776
|
+
<novo-data-table-checkbox-header-cell *cdkHeaderCellDef [maxSelected]="maxSelected"></novo-data-table-checkbox-header-cell>
|
|
8777
|
+
<novo-data-table-checkbox-cell *cdkCellDef="let row; let i = index" [row]="row" [maxSelected]="maxSelected"></novo-data-table-checkbox-cell>
|
|
8737
8778
|
</ng-container>
|
|
8738
8779
|
<ng-container cdkColumnDef="expand">
|
|
8739
8780
|
<novo-data-table-expand-header-cell *cdkHeaderCellDef></novo-data-table-expand-header-cell>
|
|
@@ -8904,6 +8945,7 @@ NovoDataTable.propDecorators = {
|
|
|
8904
8945
|
displayedColumns: [{ type: Input }],
|
|
8905
8946
|
paginationOptions: [{ type: Input }],
|
|
8906
8947
|
searchOptions: [{ type: Input }],
|
|
8948
|
+
selectionOptions: [{ type: Input }],
|
|
8907
8949
|
defaultSort: [{ type: Input }],
|
|
8908
8950
|
name: [{ type: Input }],
|
|
8909
8951
|
allowMultipleFilters: [{ type: Input }],
|
|
@@ -8913,6 +8955,7 @@ NovoDataTable.propDecorators = {
|
|
|
8913
8955
|
templates: [{ type: Input }],
|
|
8914
8956
|
fixedHeader: [{ type: Input }],
|
|
8915
8957
|
paginatorDataFeatureId: [{ type: Input }],
|
|
8958
|
+
maxSelected: [{ type: Input }],
|
|
8916
8959
|
dataTableService: [{ type: Input }],
|
|
8917
8960
|
rows: [{ type: Input }],
|
|
8918
8961
|
outsideFilter: [{ type: Input }],
|
|
@@ -29442,6 +29485,7 @@ class NovoDataTableCheckboxCell extends CdkCell {
|
|
|
29442
29485
|
this.dataTable = dataTable;
|
|
29443
29486
|
this.ref = ref;
|
|
29444
29487
|
this.role = 'gridcell';
|
|
29488
|
+
this.maxSelected = undefined;
|
|
29445
29489
|
this.checked = false;
|
|
29446
29490
|
renderer.setAttribute(elementRef.nativeElement, 'data-automation-id', `novo-checkbox-column-${columnDef.cssClassFriendlyName}`);
|
|
29447
29491
|
renderer.addClass(elementRef.nativeElement, `novo-checkbox-column-${columnDef.cssClassFriendlyName}`);
|
|
@@ -29455,11 +29499,19 @@ class NovoDataTableCheckboxCell extends CdkCell {
|
|
|
29455
29499
|
this.ref.markForCheck();
|
|
29456
29500
|
});
|
|
29457
29501
|
}
|
|
29502
|
+
get isAtLimit() {
|
|
29503
|
+
return this.maxSelected && this.dataTable.state.selectedRows.size >= this.maxSelected && !this.checked;
|
|
29504
|
+
}
|
|
29458
29505
|
ngOnInit() {
|
|
29459
29506
|
this.checked = this.dataTable.isSelected(this.row);
|
|
29460
29507
|
}
|
|
29461
29508
|
onClick() {
|
|
29462
|
-
|
|
29509
|
+
if (!this.isAtLimit) {
|
|
29510
|
+
this.dataTable.selectRow(this.row);
|
|
29511
|
+
}
|
|
29512
|
+
}
|
|
29513
|
+
getTooltip() {
|
|
29514
|
+
return (this.isAtLimit) ? 'More than ' + this.maxSelected + ' items are not able to be selected at one time' : '';
|
|
29463
29515
|
}
|
|
29464
29516
|
ngOnDestroy() {
|
|
29465
29517
|
if (this.selectionSubscription) {
|
|
@@ -29474,10 +29526,11 @@ NovoDataTableCheckboxCell.decorators = [
|
|
|
29474
29526
|
{ type: Component, args: [{
|
|
29475
29527
|
selector: 'novo-data-table-checkbox-cell',
|
|
29476
29528
|
template: `
|
|
29477
|
-
<div class="data-table-checkbox" (click)="onClick()">
|
|
29529
|
+
<div class="data-table-checkbox" (click)="onClick()" [tooltip]="getTooltip()" tooltipPosition="right">
|
|
29478
29530
|
<input type="checkbox" [checked]="checked">
|
|
29479
29531
|
<label>
|
|
29480
|
-
<i [class.bhi-checkbox-
|
|
29532
|
+
<i [class.bhi-checkbox-disabled]="isAtLimit"
|
|
29533
|
+
[class.bhi-checkbox-empty]="!checked"
|
|
29481
29534
|
[class.bhi-checkbox-filled]="checked"></i>
|
|
29482
29535
|
</label>
|
|
29483
29536
|
</div>
|
|
@@ -29494,7 +29547,8 @@ NovoDataTableCheckboxCell.ctorParameters = () => [
|
|
|
29494
29547
|
];
|
|
29495
29548
|
NovoDataTableCheckboxCell.propDecorators = {
|
|
29496
29549
|
role: [{ type: HostBinding, args: ['attr.role',] }],
|
|
29497
|
-
row: [{ type: Input }]
|
|
29550
|
+
row: [{ type: Input }],
|
|
29551
|
+
maxSelected: [{ type: Input }]
|
|
29498
29552
|
};
|
|
29499
29553
|
|
|
29500
29554
|
class NovoDataTableExpandCell extends CdkCell {
|
|
@@ -29632,12 +29686,211 @@ NovoDataTableExpandHeaderCell.propDecorators = {
|
|
|
29632
29686
|
role: [{ type: HostBinding, args: ['attr.role',] }]
|
|
29633
29687
|
};
|
|
29634
29688
|
|
|
29689
|
+
// NG2
|
|
29690
|
+
class NovoToastElement {
|
|
29691
|
+
constructor(sanitizer) {
|
|
29692
|
+
this.sanitizer = sanitizer;
|
|
29693
|
+
this.theme = 'danger';
|
|
29694
|
+
this.icon = 'caution';
|
|
29695
|
+
this.hasDialogue = false;
|
|
29696
|
+
this.isCloseable = false;
|
|
29697
|
+
this.closed = new EventEmitter();
|
|
29698
|
+
this.show = false;
|
|
29699
|
+
this.animate = false;
|
|
29700
|
+
this.parent = null;
|
|
29701
|
+
this.launched = false;
|
|
29702
|
+
}
|
|
29703
|
+
set message(m) {
|
|
29704
|
+
this._message = this.sanitizer.bypassSecurityTrustHtml(m);
|
|
29705
|
+
}
|
|
29706
|
+
ngOnInit() {
|
|
29707
|
+
if (!this.launched) {
|
|
29708
|
+
// clear position and time
|
|
29709
|
+
this.position = null;
|
|
29710
|
+
this.time = null;
|
|
29711
|
+
// set icon and styling
|
|
29712
|
+
this.iconClass = `bhi-${this.icon}`;
|
|
29713
|
+
this.alertTheme = `${this.theme} toast-container embedded`;
|
|
29714
|
+
if (this.hasDialogue) {
|
|
29715
|
+
this.alertTheme += ' dialogue';
|
|
29716
|
+
}
|
|
29717
|
+
}
|
|
29718
|
+
}
|
|
29719
|
+
ngOnChanges(changes) {
|
|
29720
|
+
// set icon and styling
|
|
29721
|
+
this.iconClass = `bhi-${this.icon}`;
|
|
29722
|
+
this.alertTheme = `${this.theme} toast-container embedded`;
|
|
29723
|
+
if (this.hasDialogue) {
|
|
29724
|
+
this.alertTheme += ' dialogue';
|
|
29725
|
+
}
|
|
29726
|
+
}
|
|
29727
|
+
clickHandler(event) {
|
|
29728
|
+
if (!this.isCloseable) {
|
|
29729
|
+
if (event) {
|
|
29730
|
+
event.stopPropagation();
|
|
29731
|
+
event.preventDefault();
|
|
29732
|
+
}
|
|
29733
|
+
if (this.parent) {
|
|
29734
|
+
this.parent.hide(this);
|
|
29735
|
+
}
|
|
29736
|
+
else {
|
|
29737
|
+
this.closed.emit({ closed: true });
|
|
29738
|
+
}
|
|
29739
|
+
}
|
|
29740
|
+
}
|
|
29741
|
+
close(event) {
|
|
29742
|
+
if (event) {
|
|
29743
|
+
event.stopPropagation();
|
|
29744
|
+
event.preventDefault();
|
|
29745
|
+
}
|
|
29746
|
+
if (this.parent) {
|
|
29747
|
+
this.parent.hide(this);
|
|
29748
|
+
}
|
|
29749
|
+
else {
|
|
29750
|
+
this.closed.emit({ closed: true });
|
|
29751
|
+
}
|
|
29752
|
+
}
|
|
29753
|
+
}
|
|
29754
|
+
NovoToastElement.decorators = [
|
|
29755
|
+
{ type: Component, args: [{
|
|
29756
|
+
selector: 'novo-toast',
|
|
29757
|
+
host: {
|
|
29758
|
+
'[class]': 'alertTheme',
|
|
29759
|
+
'[class.show]': 'show',
|
|
29760
|
+
'[class.animate]': 'animate',
|
|
29761
|
+
'[class.embedded]': 'embedded',
|
|
29762
|
+
'(click)': '!isCloseable && clickHandler($event)',
|
|
29763
|
+
},
|
|
29764
|
+
template: `
|
|
29765
|
+
<div class="toast-icon">
|
|
29766
|
+
<i [ngClass]="iconClass"></i>
|
|
29767
|
+
</div>
|
|
29768
|
+
<div class="toast-content">
|
|
29769
|
+
<h5 *ngIf="title">{{title}}</h5>
|
|
29770
|
+
<p *ngIf="_message" [class.message-only]="!title" [innerHtml]="_message"></p>
|
|
29771
|
+
<div *ngIf="link" class="link-generated">
|
|
29772
|
+
<input type="text" [value]="link" onfocus="this.select();"/>
|
|
29773
|
+
</div>
|
|
29774
|
+
<div class="dialogue">
|
|
29775
|
+
<ng-content></ng-content>
|
|
29776
|
+
</div>
|
|
29777
|
+
</div>
|
|
29778
|
+
<div class="close-icon" *ngIf="isCloseable" (click)="close($event)">
|
|
29779
|
+
<i class="bhi-times"></i>
|
|
29780
|
+
</div>
|
|
29781
|
+
`
|
|
29782
|
+
},] }
|
|
29783
|
+
];
|
|
29784
|
+
NovoToastElement.ctorParameters = () => [
|
|
29785
|
+
{ type: DomSanitizer }
|
|
29786
|
+
];
|
|
29787
|
+
NovoToastElement.propDecorators = {
|
|
29788
|
+
theme: [{ type: Input }],
|
|
29789
|
+
icon: [{ type: Input }],
|
|
29790
|
+
title: [{ type: Input }],
|
|
29791
|
+
hasDialogue: [{ type: Input }],
|
|
29792
|
+
link: [{ type: Input }],
|
|
29793
|
+
isCloseable: [{ type: Input }],
|
|
29794
|
+
message: [{ type: Input }],
|
|
29795
|
+
closed: [{ type: Output }]
|
|
29796
|
+
};
|
|
29797
|
+
|
|
29798
|
+
// NG2
|
|
29799
|
+
class NovoToastService {
|
|
29800
|
+
constructor(componentUtils) {
|
|
29801
|
+
this.componentUtils = componentUtils;
|
|
29802
|
+
this.references = [];
|
|
29803
|
+
this.icons = { default: 'bell', success: 'check', info: 'info', warning: 'warning', danger: 'remove' };
|
|
29804
|
+
this.defaults = { hideDelay: 3500, position: 'growlTopRight', theme: 'default' };
|
|
29805
|
+
}
|
|
29806
|
+
set parentViewContainer(view) {
|
|
29807
|
+
this._parentViewContainer = view;
|
|
29808
|
+
}
|
|
29809
|
+
alert(options, toastElement = NovoToastElement) {
|
|
29810
|
+
return new Promise((resolve) => {
|
|
29811
|
+
if (!this._parentViewContainer) {
|
|
29812
|
+
console.error('No parent view container specified for the ToastService. Set it inside your main application. \nthis.toastService.parentViewContainer = view (ViewContainerRef)');
|
|
29813
|
+
return;
|
|
29814
|
+
}
|
|
29815
|
+
const toast = this.componentUtils.append(toastElement, this._parentViewContainer);
|
|
29816
|
+
this.references.push(toast);
|
|
29817
|
+
this.handleAlert(toast.instance, options);
|
|
29818
|
+
resolve(toast);
|
|
29819
|
+
});
|
|
29820
|
+
}
|
|
29821
|
+
isVisible(toast) {
|
|
29822
|
+
return toast.show;
|
|
29823
|
+
}
|
|
29824
|
+
hide(toast) {
|
|
29825
|
+
toast.animate = false;
|
|
29826
|
+
setTimeout(() => {
|
|
29827
|
+
toast.show = false;
|
|
29828
|
+
const REF = this.references.filter((x) => x.instance === toast)[0];
|
|
29829
|
+
if (REF) {
|
|
29830
|
+
this.references.splice(this.references.indexOf(REF), 1);
|
|
29831
|
+
REF.destroy();
|
|
29832
|
+
}
|
|
29833
|
+
}, 300);
|
|
29834
|
+
}
|
|
29835
|
+
handleAlert(toast, options) {
|
|
29836
|
+
this.setToastOnSession(toast, options);
|
|
29837
|
+
setTimeout(() => {
|
|
29838
|
+
this.show(toast);
|
|
29839
|
+
}, 20);
|
|
29840
|
+
if (!toast.isCloseable) {
|
|
29841
|
+
this.toastTimer(toast);
|
|
29842
|
+
}
|
|
29843
|
+
}
|
|
29844
|
+
setToastOnSession(toast, opts) {
|
|
29845
|
+
const OPTIONS = typeof opts === 'object' ? opts : {};
|
|
29846
|
+
toast.parent = this;
|
|
29847
|
+
toast.title = OPTIONS.title || '';
|
|
29848
|
+
toast.message = OPTIONS.message || '';
|
|
29849
|
+
toast.hideDelay = OPTIONS.hideDelay || this.defaults.hideDelay;
|
|
29850
|
+
toast.link = OPTIONS.link || '';
|
|
29851
|
+
toast.isCloseable = OPTIONS.isCloseable || false;
|
|
29852
|
+
const CUSTOM_CLASS = OPTIONS.customClass || '';
|
|
29853
|
+
const ALERT_STYLE = OPTIONS.theme || this.defaults.theme;
|
|
29854
|
+
const ALERT_POSITION = OPTIONS.position || this.defaults.position;
|
|
29855
|
+
const ALERT_ICON = OPTIONS.icon || this.icons.default;
|
|
29856
|
+
toast.iconClass = `bhi-${ALERT_ICON}`;
|
|
29857
|
+
toast.launched = true;
|
|
29858
|
+
toast.alertTheme = `${ALERT_STYLE} ${ALERT_POSITION} ${CUSTOM_CLASS} toast-container launched`;
|
|
29859
|
+
}
|
|
29860
|
+
show(toast) {
|
|
29861
|
+
toast.show = true;
|
|
29862
|
+
setTimeout(addClass, 25);
|
|
29863
|
+
/**
|
|
29864
|
+
* Adds animate class to be called after a timeout
|
|
29865
|
+
**/
|
|
29866
|
+
function addClass() {
|
|
29867
|
+
toast.animate = true;
|
|
29868
|
+
}
|
|
29869
|
+
}
|
|
29870
|
+
toastTimer(toast) {
|
|
29871
|
+
if (toast.hideDelay < 0) {
|
|
29872
|
+
return;
|
|
29873
|
+
}
|
|
29874
|
+
setTimeout(() => {
|
|
29875
|
+
this.hide(toast);
|
|
29876
|
+
}, toast.hideDelay);
|
|
29877
|
+
}
|
|
29878
|
+
}
|
|
29879
|
+
NovoToastService.decorators = [
|
|
29880
|
+
{ type: Injectable }
|
|
29881
|
+
];
|
|
29882
|
+
NovoToastService.ctorParameters = () => [
|
|
29883
|
+
{ type: ComponentUtils }
|
|
29884
|
+
];
|
|
29885
|
+
|
|
29635
29886
|
class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
|
|
29636
|
-
constructor(columnDef, elementRef, renderer, dataTable, ref) {
|
|
29887
|
+
constructor(columnDef, elementRef, renderer, dataTable, ref, toaster) {
|
|
29637
29888
|
super(columnDef, elementRef);
|
|
29638
29889
|
this.dataTable = dataTable;
|
|
29639
29890
|
this.ref = ref;
|
|
29891
|
+
this.toaster = toaster;
|
|
29640
29892
|
this.role = 'columnheader';
|
|
29893
|
+
this.maxSelected = undefined;
|
|
29641
29894
|
this.checked = false;
|
|
29642
29895
|
renderer.setAttribute(elementRef.nativeElement, 'data-automation-id', `novo-checkbox-column-header-${columnDef.cssClassFriendlyName}`);
|
|
29643
29896
|
renderer.addClass(elementRef.nativeElement, `novo-checkbox-column-${columnDef.cssClassFriendlyName}`);
|
|
@@ -29650,6 +29903,8 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
|
|
|
29650
29903
|
if (event.isPageSizeChange) {
|
|
29651
29904
|
this.checked = false;
|
|
29652
29905
|
this.dataTable.selectRows(false);
|
|
29906
|
+
this.dataTable.state.checkRetainment('pageSize');
|
|
29907
|
+
this.dataTable.state.reset(false, true);
|
|
29653
29908
|
}
|
|
29654
29909
|
else {
|
|
29655
29910
|
this.checked = this.dataTable.allCurrentRowsSelected();
|
|
@@ -29661,6 +29916,9 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
|
|
|
29661
29916
|
this.ref.markForCheck();
|
|
29662
29917
|
});
|
|
29663
29918
|
}
|
|
29919
|
+
get isAtLimit() {
|
|
29920
|
+
return this.maxSelected && this.dataTable.state.selectedRows.size + this.dataTable.dataSource.data.length > this.maxSelected && !this.checked;
|
|
29921
|
+
}
|
|
29664
29922
|
ngOnDestroy() {
|
|
29665
29923
|
if (this.selectionSubscription) {
|
|
29666
29924
|
this.selectionSubscription.unsubscribe();
|
|
@@ -29673,7 +29931,17 @@ class NovoDataTableCheckboxHeaderCell extends CdkHeaderCell {
|
|
|
29673
29931
|
}
|
|
29674
29932
|
}
|
|
29675
29933
|
onClick() {
|
|
29676
|
-
|
|
29934
|
+
if (this.isAtLimit) {
|
|
29935
|
+
this.toaster.alert({
|
|
29936
|
+
theme: 'danger',
|
|
29937
|
+
position: 'fixedTop',
|
|
29938
|
+
message: 'Error, more than 500 items are not able to be selected at one time',
|
|
29939
|
+
icon: 'caution',
|
|
29940
|
+
});
|
|
29941
|
+
}
|
|
29942
|
+
else {
|
|
29943
|
+
this.dataTable.selectRows(!this.checked);
|
|
29944
|
+
}
|
|
29677
29945
|
}
|
|
29678
29946
|
}
|
|
29679
29947
|
NovoDataTableCheckboxHeaderCell.decorators = [
|
|
@@ -29696,10 +29964,12 @@ NovoDataTableCheckboxHeaderCell.ctorParameters = () => [
|
|
|
29696
29964
|
{ type: ElementRef },
|
|
29697
29965
|
{ type: Renderer2 },
|
|
29698
29966
|
{ type: NovoDataTable },
|
|
29699
|
-
{ type: ChangeDetectorRef }
|
|
29967
|
+
{ type: ChangeDetectorRef },
|
|
29968
|
+
{ type: NovoToastService }
|
|
29700
29969
|
];
|
|
29701
29970
|
NovoDataTableCheckboxHeaderCell.propDecorators = {
|
|
29702
|
-
role: [{ type: HostBinding, args: ['attr.role',] }]
|
|
29971
|
+
role: [{ type: HostBinding, args: ['attr.role',] }],
|
|
29972
|
+
maxSelected: [{ type: Input }]
|
|
29703
29973
|
};
|
|
29704
29974
|
|
|
29705
29975
|
class NovoDataTableHeaderCell extends CdkHeaderCell {
|
|
@@ -29795,10 +30065,12 @@ class NovoDataTablePagination {
|
|
|
29795
30065
|
this.resetSubscription.unsubscribe();
|
|
29796
30066
|
}
|
|
29797
30067
|
selectPage(page) {
|
|
30068
|
+
this.state.checkRetainment('page');
|
|
29798
30069
|
this.page = page;
|
|
29799
30070
|
this.emitPageEvent();
|
|
29800
30071
|
}
|
|
29801
30072
|
nextPage() {
|
|
30073
|
+
this.state.checkRetainment('page');
|
|
29802
30074
|
if (!this.hasNextPage()) {
|
|
29803
30075
|
return;
|
|
29804
30076
|
}
|
|
@@ -29807,6 +30079,7 @@ class NovoDataTablePagination {
|
|
|
29807
30079
|
this.emitPageEvent();
|
|
29808
30080
|
}
|
|
29809
30081
|
previousPage() {
|
|
30082
|
+
this.state.checkRetainment('page');
|
|
29810
30083
|
if (!this.hasPreviousPage()) {
|
|
29811
30084
|
return;
|
|
29812
30085
|
}
|
|
@@ -33009,203 +33282,6 @@ NovoModalService.ctorParameters = () => [
|
|
|
33009
33282
|
{ type: ComponentUtils }
|
|
33010
33283
|
];
|
|
33011
33284
|
|
|
33012
|
-
// NG2
|
|
33013
|
-
class NovoToastElement {
|
|
33014
|
-
constructor(sanitizer) {
|
|
33015
|
-
this.sanitizer = sanitizer;
|
|
33016
|
-
this.theme = 'danger';
|
|
33017
|
-
this.icon = 'caution';
|
|
33018
|
-
this.hasDialogue = false;
|
|
33019
|
-
this.isCloseable = false;
|
|
33020
|
-
this.closed = new EventEmitter();
|
|
33021
|
-
this.show = false;
|
|
33022
|
-
this.animate = false;
|
|
33023
|
-
this.parent = null;
|
|
33024
|
-
this.launched = false;
|
|
33025
|
-
}
|
|
33026
|
-
set message(m) {
|
|
33027
|
-
this._message = this.sanitizer.bypassSecurityTrustHtml(m);
|
|
33028
|
-
}
|
|
33029
|
-
ngOnInit() {
|
|
33030
|
-
if (!this.launched) {
|
|
33031
|
-
// clear position and time
|
|
33032
|
-
this.position = null;
|
|
33033
|
-
this.time = null;
|
|
33034
|
-
// set icon and styling
|
|
33035
|
-
this.iconClass = `bhi-${this.icon}`;
|
|
33036
|
-
this.alertTheme = `${this.theme} toast-container embedded`;
|
|
33037
|
-
if (this.hasDialogue) {
|
|
33038
|
-
this.alertTheme += ' dialogue';
|
|
33039
|
-
}
|
|
33040
|
-
}
|
|
33041
|
-
}
|
|
33042
|
-
ngOnChanges(changes) {
|
|
33043
|
-
// set icon and styling
|
|
33044
|
-
this.iconClass = `bhi-${this.icon}`;
|
|
33045
|
-
this.alertTheme = `${this.theme} toast-container embedded`;
|
|
33046
|
-
if (this.hasDialogue) {
|
|
33047
|
-
this.alertTheme += ' dialogue';
|
|
33048
|
-
}
|
|
33049
|
-
}
|
|
33050
|
-
clickHandler(event) {
|
|
33051
|
-
if (!this.isCloseable) {
|
|
33052
|
-
if (event) {
|
|
33053
|
-
event.stopPropagation();
|
|
33054
|
-
event.preventDefault();
|
|
33055
|
-
}
|
|
33056
|
-
if (this.parent) {
|
|
33057
|
-
this.parent.hide(this);
|
|
33058
|
-
}
|
|
33059
|
-
else {
|
|
33060
|
-
this.closed.emit({ closed: true });
|
|
33061
|
-
}
|
|
33062
|
-
}
|
|
33063
|
-
}
|
|
33064
|
-
close(event) {
|
|
33065
|
-
if (event) {
|
|
33066
|
-
event.stopPropagation();
|
|
33067
|
-
event.preventDefault();
|
|
33068
|
-
}
|
|
33069
|
-
if (this.parent) {
|
|
33070
|
-
this.parent.hide(this);
|
|
33071
|
-
}
|
|
33072
|
-
else {
|
|
33073
|
-
this.closed.emit({ closed: true });
|
|
33074
|
-
}
|
|
33075
|
-
}
|
|
33076
|
-
}
|
|
33077
|
-
NovoToastElement.decorators = [
|
|
33078
|
-
{ type: Component, args: [{
|
|
33079
|
-
selector: 'novo-toast',
|
|
33080
|
-
host: {
|
|
33081
|
-
'[class]': 'alertTheme',
|
|
33082
|
-
'[class.show]': 'show',
|
|
33083
|
-
'[class.animate]': 'animate',
|
|
33084
|
-
'[class.embedded]': 'embedded',
|
|
33085
|
-
'(click)': '!isCloseable && clickHandler($event)',
|
|
33086
|
-
},
|
|
33087
|
-
template: `
|
|
33088
|
-
<div class="toast-icon">
|
|
33089
|
-
<i [ngClass]="iconClass"></i>
|
|
33090
|
-
</div>
|
|
33091
|
-
<div class="toast-content">
|
|
33092
|
-
<h5 *ngIf="title">{{title}}</h5>
|
|
33093
|
-
<p *ngIf="_message" [class.message-only]="!title" [innerHtml]="_message"></p>
|
|
33094
|
-
<div *ngIf="link" class="link-generated">
|
|
33095
|
-
<input type="text" [value]="link" onfocus="this.select();"/>
|
|
33096
|
-
</div>
|
|
33097
|
-
<div class="dialogue">
|
|
33098
|
-
<ng-content></ng-content>
|
|
33099
|
-
</div>
|
|
33100
|
-
</div>
|
|
33101
|
-
<div class="close-icon" *ngIf="isCloseable" (click)="close($event)">
|
|
33102
|
-
<i class="bhi-times"></i>
|
|
33103
|
-
</div>
|
|
33104
|
-
`
|
|
33105
|
-
},] }
|
|
33106
|
-
];
|
|
33107
|
-
NovoToastElement.ctorParameters = () => [
|
|
33108
|
-
{ type: DomSanitizer }
|
|
33109
|
-
];
|
|
33110
|
-
NovoToastElement.propDecorators = {
|
|
33111
|
-
theme: [{ type: Input }],
|
|
33112
|
-
icon: [{ type: Input }],
|
|
33113
|
-
title: [{ type: Input }],
|
|
33114
|
-
hasDialogue: [{ type: Input }],
|
|
33115
|
-
link: [{ type: Input }],
|
|
33116
|
-
isCloseable: [{ type: Input }],
|
|
33117
|
-
message: [{ type: Input }],
|
|
33118
|
-
closed: [{ type: Output }]
|
|
33119
|
-
};
|
|
33120
|
-
|
|
33121
|
-
// NG2
|
|
33122
|
-
class NovoToastService {
|
|
33123
|
-
constructor(componentUtils) {
|
|
33124
|
-
this.componentUtils = componentUtils;
|
|
33125
|
-
this.references = [];
|
|
33126
|
-
this.icons = { default: 'bell', success: 'check', info: 'info', warning: 'warning', danger: 'remove' };
|
|
33127
|
-
this.defaults = { hideDelay: 3500, position: 'growlTopRight', theme: 'default' };
|
|
33128
|
-
}
|
|
33129
|
-
set parentViewContainer(view) {
|
|
33130
|
-
this._parentViewContainer = view;
|
|
33131
|
-
}
|
|
33132
|
-
alert(options, toastElement = NovoToastElement) {
|
|
33133
|
-
return new Promise((resolve) => {
|
|
33134
|
-
if (!this._parentViewContainer) {
|
|
33135
|
-
console.error('No parent view container specified for the ToastService. Set it inside your main application. \nthis.toastService.parentViewContainer = view (ViewContainerRef)');
|
|
33136
|
-
return;
|
|
33137
|
-
}
|
|
33138
|
-
const toast = this.componentUtils.append(toastElement, this._parentViewContainer);
|
|
33139
|
-
this.references.push(toast);
|
|
33140
|
-
this.handleAlert(toast.instance, options);
|
|
33141
|
-
resolve(toast);
|
|
33142
|
-
});
|
|
33143
|
-
}
|
|
33144
|
-
isVisible(toast) {
|
|
33145
|
-
return toast.show;
|
|
33146
|
-
}
|
|
33147
|
-
hide(toast) {
|
|
33148
|
-
toast.animate = false;
|
|
33149
|
-
setTimeout(() => {
|
|
33150
|
-
toast.show = false;
|
|
33151
|
-
const REF = this.references.filter((x) => x.instance === toast)[0];
|
|
33152
|
-
if (REF) {
|
|
33153
|
-
this.references.splice(this.references.indexOf(REF), 1);
|
|
33154
|
-
REF.destroy();
|
|
33155
|
-
}
|
|
33156
|
-
}, 300);
|
|
33157
|
-
}
|
|
33158
|
-
handleAlert(toast, options) {
|
|
33159
|
-
this.setToastOnSession(toast, options);
|
|
33160
|
-
setTimeout(() => {
|
|
33161
|
-
this.show(toast);
|
|
33162
|
-
}, 20);
|
|
33163
|
-
if (!toast.isCloseable) {
|
|
33164
|
-
this.toastTimer(toast);
|
|
33165
|
-
}
|
|
33166
|
-
}
|
|
33167
|
-
setToastOnSession(toast, opts) {
|
|
33168
|
-
const OPTIONS = typeof opts === 'object' ? opts : {};
|
|
33169
|
-
toast.parent = this;
|
|
33170
|
-
toast.title = OPTIONS.title || '';
|
|
33171
|
-
toast.message = OPTIONS.message || '';
|
|
33172
|
-
toast.hideDelay = OPTIONS.hideDelay || this.defaults.hideDelay;
|
|
33173
|
-
toast.link = OPTIONS.link || '';
|
|
33174
|
-
toast.isCloseable = OPTIONS.isCloseable || false;
|
|
33175
|
-
const CUSTOM_CLASS = OPTIONS.customClass || '';
|
|
33176
|
-
const ALERT_STYLE = OPTIONS.theme || this.defaults.theme;
|
|
33177
|
-
const ALERT_POSITION = OPTIONS.position || this.defaults.position;
|
|
33178
|
-
const ALERT_ICON = OPTIONS.icon || this.icons.default;
|
|
33179
|
-
toast.iconClass = `bhi-${ALERT_ICON}`;
|
|
33180
|
-
toast.launched = true;
|
|
33181
|
-
toast.alertTheme = `${ALERT_STYLE} ${ALERT_POSITION} ${CUSTOM_CLASS} toast-container launched`;
|
|
33182
|
-
}
|
|
33183
|
-
show(toast) {
|
|
33184
|
-
toast.show = true;
|
|
33185
|
-
setTimeout(addClass, 25);
|
|
33186
|
-
/**
|
|
33187
|
-
* Adds animate class to be called after a timeout
|
|
33188
|
-
**/
|
|
33189
|
-
function addClass() {
|
|
33190
|
-
toast.animate = true;
|
|
33191
|
-
}
|
|
33192
|
-
}
|
|
33193
|
-
toastTimer(toast) {
|
|
33194
|
-
if (toast.hideDelay < 0) {
|
|
33195
|
-
return;
|
|
33196
|
-
}
|
|
33197
|
-
setTimeout(() => {
|
|
33198
|
-
this.hide(toast);
|
|
33199
|
-
}, toast.hideDelay);
|
|
33200
|
-
}
|
|
33201
|
-
}
|
|
33202
|
-
NovoToastService.decorators = [
|
|
33203
|
-
{ type: Injectable }
|
|
33204
|
-
];
|
|
33205
|
-
NovoToastService.ctorParameters = () => [
|
|
33206
|
-
{ type: ComponentUtils }
|
|
33207
|
-
];
|
|
33208
|
-
|
|
33209
33285
|
// NG2
|
|
33210
33286
|
class ControlConfirmModal {
|
|
33211
33287
|
constructor(modalRef, params, labels) {
|