@rxap/material-table-system 13.0.0-next.0 → 13.0.0-next.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.
@@ -26,6 +26,7 @@ import { pipeDataSource } from '@rxap/data-source';
26
26
  import * as i1$3 from '@angular/material/paginator';
27
27
  import { FormDirective } from '@rxap/forms';
28
28
  import { ControlContainer } from '@angular/forms';
29
+ import * as i1$4 from '@angular/router';
29
30
  import * as i3 from '@angular/material/menu';
30
31
  import { MatMenuModule } from '@angular/material/menu';
31
32
  import * as i6 from '@rxap/directives';
@@ -818,8 +819,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
818
819
  }] });
819
820
 
820
821
  class TableColumnOptionComponent {
821
- constructor(_element) {
822
+ constructor(_element, router) {
822
823
  this._element = _element;
824
+ this.router = router;
823
825
  this.active = true;
824
826
  this._hidden = false;
825
827
  }
@@ -842,17 +844,32 @@ class TableColumnOptionComponent {
842
844
  set show(value) {
843
845
  this._hidden = !value;
844
846
  }
847
+ get cacheId() {
848
+ return this.router.url + '--' + this.name;
849
+ }
850
+ ngOnInit() {
851
+ const cachedValue = localStorage.getItem(this.cacheId);
852
+ if (cachedValue === 'true') {
853
+ this.active = true;
854
+ }
855
+ if (cachedValue === 'false') {
856
+ this.active = false;
857
+ }
858
+ }
845
859
  toggle() {
846
860
  this.active = !this.active;
861
+ localStorage.setItem(this.cacheId, this.active ? 'true' : 'false');
847
862
  }
848
863
  activate() {
849
864
  this.active = true;
865
+ localStorage.setItem(this.cacheId, 'true');
850
866
  }
851
867
  deactivate() {
852
868
  this.active = false;
869
+ localStorage.setItem(this.cacheId, 'false');
853
870
  }
854
871
  }
855
- TableColumnOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableColumnOptionComponent, deps: [{ token: ElementRef }], target: i0.ɵɵFactoryTarget.Component });
872
+ TableColumnOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableColumnOptionComponent, deps: [{ token: ElementRef }, { token: i1$4.Router }], target: i0.ɵɵFactoryTarget.Component });
856
873
  TableColumnOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: TableColumnOptionComponent, selector: "rxap-table-column-option", inputs: { name: "name", active: "active", inactive: "inactive", hidden: "hidden", show: "show" }, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""] });
857
874
  __decorate([
858
875
  Required,
@@ -864,7 +881,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
864
881
  }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
865
882
  type: Inject,
866
883
  args: [ElementRef]
867
- }] }]; }, propDecorators: { name: [{
884
+ }] }, { type: i1$4.Router }]; }, propDecorators: { name: [{
868
885
  type: Input
869
886
  }], active: [{
870
887
  type: Input
@@ -1577,12 +1594,17 @@ class OptionsCellComponent {
1577
1594
  constructor(renderer) {
1578
1595
  this.renderer = renderer;
1579
1596
  this._subscription = new Subscription();
1597
+ this._initialised = false;
1580
1598
  this.defaultViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.unknown:unknown`;
1581
1599
  this.emptyViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.empty:empty`;
1582
1600
  }
1583
1601
  ngAfterContentInit() {
1584
1602
  // Hide the mat-option elements
1585
1603
  this._subscription.add(this.options.changes.pipe(startWith(null), tap(() => this.options.forEach(option => this.renderer.setStyle(option._getHostElement(), 'display', 'none')))).subscribe());
1604
+ this.setViewValue();
1605
+ this._initialised = true;
1606
+ }
1607
+ setViewValue() {
1586
1608
  if (this.value === undefined || this.value === null) {
1587
1609
  this.viewValue = this.emptyViewValue;
1588
1610
  }
@@ -1597,6 +1619,13 @@ class OptionsCellComponent {
1597
1619
  }
1598
1620
  }
1599
1621
  }
1622
+ ngOnChanges(changes) {
1623
+ if (this._initialised) {
1624
+ if (changes['value']) {
1625
+ this.setViewValue();
1626
+ }
1627
+ }
1628
+ }
1600
1629
  getViewValue() {
1601
1630
  return (this.options.find((option) => option.value === this.value)?.viewValue ??
1602
1631
  this.defaultViewValue);
@@ -1606,7 +1635,7 @@ class OptionsCellComponent {
1606
1635
  }
1607
1636
  }
1608
1637
  OptionsCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OptionsCellComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1609
- OptionsCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: OptionsCellComponent, selector: "td[rxap-options-cell]", inputs: { value: ["rxap-options-cell", "value"], defaultViewValue: ["default", "defaultViewValue"], emptyViewValue: ["empty", "emptyViewValue"] }, host: { classAttribute: "rxap-options-cell" }, queries: [{ propertyName: "options", predicate: MatOption, descendants: true }], ngImport: i0, template: "{{viewValue}}\n<ng-content></ng-content>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1638
+ OptionsCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: OptionsCellComponent, selector: "td[rxap-options-cell]", inputs: { value: ["rxap-options-cell", "value"], defaultViewValue: ["default", "defaultViewValue"], emptyViewValue: ["empty", "emptyViewValue"] }, host: { classAttribute: "rxap-options-cell" }, queries: [{ propertyName: "options", predicate: MatOption, descendants: true }], usesOnChanges: true, ngImport: i0, template: "{{viewValue}}\n<ng-content></ng-content>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1610
1639
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OptionsCellComponent, decorators: [{
1611
1640
  type: Component,
1612
1641
  args: [{ selector: 'td[rxap-options-cell]', changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'rxap-options-cell' }, template: "{{viewValue}}\n<ng-content></ng-content>\n", styles: [""] }]