@rxap/material-table-system 12.5.6 → 12.5.7

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.
@@ -7,12 +7,17 @@ export class OptionsCellComponent {
7
7
  constructor(renderer) {
8
8
  this.renderer = renderer;
9
9
  this._subscription = new Subscription();
10
+ this._initialised = false;
10
11
  this.defaultViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.unknown:unknown`;
11
12
  this.emptyViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.empty:empty`;
12
13
  }
13
14
  ngAfterContentInit() {
14
15
  // Hide the mat-option elements
15
16
  this._subscription.add(this.options.changes.pipe(startWith(null), tap(() => this.options.forEach(option => this.renderer.setStyle(option._getHostElement(), 'display', 'none')))).subscribe());
17
+ this.setViewValue();
18
+ this._initialised = true;
19
+ }
20
+ setViewValue() {
16
21
  if (this.value === undefined || this.value === null) {
17
22
  this.viewValue = this.emptyViewValue;
18
23
  }
@@ -27,6 +32,13 @@ export class OptionsCellComponent {
27
32
  }
28
33
  }
29
34
  }
35
+ ngOnChanges(changes) {
36
+ if (this._initialised) {
37
+ if (changes['value']) {
38
+ this.setViewValue();
39
+ }
40
+ }
41
+ }
30
42
  getViewValue() {
31
43
  var _a, _b;
32
44
  return ((_b = (_a = this.options.find((option) => option.value === this.value)) === null || _a === void 0 ? void 0 : _a.viewValue) !== null && _b !== void 0 ? _b : this.defaultViewValue);
@@ -37,7 +49,7 @@ export class OptionsCellComponent {
37
49
  }
38
50
  }
39
51
  OptionsCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionsCellComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
40
- OptionsCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 });
52
+ OptionsCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 });
41
53
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionsCellComponent, decorators: [{
42
54
  type: Component,
43
55
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"options-cell.component.js","sourceRoot":"","sources":["../../../../../../../../libs/material/table-system/src/lib/cells/options-cell/options-cell.component.ts","../../../../../../../../libs/material/table-system/src/lib/cells/options-cell/options-cell.component.html"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,KAAK,EACL,eAAe,EAEf,SAAS,EAET,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,GAAG,EACH,SAAS,EACV,MAAM,gBAAgB,CAAC;;AASxB,MAAM,OAAO,oBAAoB;IAc/B,YAA6B,QAAmB;QAAnB,aAAQ,GAAR,QAAQ,CAAW;QAF/B,kBAAa,GAAG,IAAI,YAAY,EAAE,CAAC;QAGlD,IAAI,CAAC,gBAAgB,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tB,CAAC;IACJ,CAAC;IAEM,WAAW;;QAChB,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW,EAAE,CAAC;IACpC,CAAC;;kHArDU,oBAAoB;sGAApB,oBAAoB,uRAmBd,SAAS,gDC5C5B,4CAEA;4FDuBa,oBAAoB;kBAPhC,SAAS;mBAAC;oBACT,QAAQ,EAAS,uBAAuB;oBACxC,WAAW,EAAM,+BAA+B;oBAChD,SAAS,EAAQ,CAAE,+BAA+B,CAAE;oBACpD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAa,EAAE,KAAK,EAAE,mBAAmB,EAAE;iBAChD;gGAGQ,KAAK;sBADX,KAAK;uBAAC,mBAAmB;gBAInB,gBAAgB;sBADtB,KAAK;uBAAC,SAAS;gBAIT,cAAc;sBADpB,KAAK;uBAAC,OAAO;gBAaP,OAAO;sBADb,eAAe;uBAAC,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE","sourcesContent":["import type { QueryList } from '@angular/core';\nimport {\n Component,\n ChangeDetectionStrategy,\n Input,\n ContentChildren,\n AfterContentInit,\n isDevMode,\n OnDestroy,\n Renderer2\n} from '@angular/core';\nimport { MatOption } from '@angular/material/core';\nimport { Subscription } from 'rxjs';\nimport {\n tap,\n startWith\n} from 'rxjs/operators';\n\n@Component({\n selector: 'td[rxap-options-cell]',\n templateUrl: './options-cell.component.html',\n styleUrls: [ './options-cell.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-options-cell' }\n})\nexport class OptionsCellComponent implements AfterContentInit, OnDestroy {\n @Input('rxap-options-cell')\n public value: any;\n\n @Input('default')\n public defaultViewValue!: string;\n\n @Input('empty')\n public emptyViewValue!: string;\n\n public viewValue!: string;\n\n private readonly _subscription = new Subscription();\n\n constructor(private readonly renderer: Renderer2) {\n this.defaultViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.unknown:unknown`;\n this.emptyViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.empty:empty`;\n }\n\n @ContentChildren(MatOption, { descendants: true })\n public options!: QueryList<MatOption>;\n\n public ngAfterContentInit() {\n // Hide the mat-option elements\n this._subscription.add(this.options.changes.pipe(\n startWith(null),\n tap(() => this.options.forEach(option => this.renderer.setStyle(option._getHostElement(), 'display', 'none')))\n ).subscribe());\n if (this.value === undefined || this.value === null) {\n this.viewValue = this.emptyViewValue;\n } else {\n if (this.options) {\n this._subscription.add(this.options.changes\n .pipe(\n startWith(null),\n tap(() => (this.viewValue = this.getViewValue()))\n )\n .subscribe());\n } else if (isDevMode()) {\n console.log('Could not load any option');\n }\n }\n }\n\n public getViewValue(): string {\n return (\n this.options.find((option) => option.value === this.value)?.viewValue ??\n this.defaultViewValue\n );\n }\n\n public ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n}\n","{{viewValue}}\n<ng-content></ng-content>\n"]}
1
+ {"version":3,"file":"options-cell.component.js","sourceRoot":"","sources":["../../../../../../../../libs/material/table-system/src/lib/cells/options-cell/options-cell.component.ts","../../../../../../../../libs/material/table-system/src/lib/cells/options-cell/options-cell.component.html"],"names":[],"mappings":"AAKA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,KAAK,EACL,eAAe,EAEf,SAAS,EAET,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,GAAG,EACH,SAAS,EACV,MAAM,gBAAgB,CAAC;;AASxB,MAAM,OAAO,oBAAoB;IAgB/B,YAA6B,QAAmB;QAAnB,aAAQ,GAAR,QAAQ,CAAW;QAJ/B,kBAAa,GAAG,IAAI,YAAY,EAAE,CAAC;QAE5C,iBAAY,GAAG,KAAK,CAAC;QAG3B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,yEAAyE;QACrG,IAAI,CAAC,cAAc,GAAK,EAAE,CAAC,CAAC,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ACjB,OAAO,CACL,MAAA,MAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,0CAAE,SAAS,mCACrE,IAAI,CAAC,gBAAgB,CACtB,CAAC;IACJ,CAAC;IAEM,WAAW;;QAChB,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW,EAAE,CAAC;IACpC,CAAC;;kHApEU,oBAAoB;sGAApB,oBAAoB,uRAqBd,SAAS,qEClD5B,4CAEA;4FD2Ba,oBAAoB;kBAPhC,SAAS;mBAAC;oBACT,QAAQ,EAAS,uBAAuB;oBACxC,WAAW,EAAM,+BAA+B;oBAChD,SAAS,EAAQ,CAAE,+BAA+B,CAAE;oBACpD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAa,EAAE,KAAK,EAAE,mBAAmB,EAAE;iBAChD;gGAGQ,KAAK;sBADX,KAAK;uBAAC,mBAAmB;gBAInB,gBAAgB;sBADtB,KAAK;uBAAC,SAAS;gBAIT,cAAc;sBADpB,KAAK;uBAAC,OAAO;gBAeP,OAAO;sBADb,eAAe;uBAAC,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE","sourcesContent":["import type {\n QueryList,\n OnChanges,\n SimpleChanges\n} from '@angular/core';\nimport {\n Component,\n ChangeDetectionStrategy,\n Input,\n ContentChildren,\n AfterContentInit,\n isDevMode,\n OnDestroy,\n Renderer2\n} from '@angular/core';\nimport { MatOption } from '@angular/material/core';\nimport { Subscription } from 'rxjs';\nimport {\n tap,\n startWith\n} from 'rxjs/operators';\n\n@Component({\n selector: 'td[rxap-options-cell]',\n templateUrl: './options-cell.component.html',\n styleUrls: [ './options-cell.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-options-cell' }\n})\nexport class OptionsCellComponent implements AfterContentInit, OnDestroy, OnChanges {\n @Input('rxap-options-cell')\n public value: any;\n\n @Input('default')\n public defaultViewValue!: string;\n\n @Input('empty')\n public emptyViewValue!: string;\n\n public viewValue!: string;\n\n private readonly _subscription = new Subscription();\n\n private _initialised = false;\n\n constructor(private readonly renderer: Renderer2) {\n this.defaultViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.unknown:unknown`;\n this.emptyViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.empty:empty`;\n }\n\n @ContentChildren(MatOption, { descendants: true })\n public options!: QueryList<MatOption>;\n\n public ngAfterContentInit() {\n // Hide the mat-option elements\n this._subscription.add(this.options.changes.pipe(\n startWith(null),\n tap(() => this.options.forEach(option => this.renderer.setStyle(option._getHostElement(), 'display', 'none')))\n ).subscribe());\n this.setViewValue();\n this._initialised = true;\n }\n\n public setViewValue() {\n if (this.value === undefined || this.value === null) {\n this.viewValue = this.emptyViewValue;\n } else {\n if (this.options) {\n this._subscription.add(this.options.changes\n .pipe(\n startWith(null),\n tap(() => (this.viewValue = this.getViewValue()))\n )\n .subscribe());\n } else if (isDevMode()) {\n console.log('Could not load any option');\n }\n }\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n if (this._initialised) {\n if (changes['value']) {\n this.setViewValue();\n }\n }\n }\n\n public getViewValue(): string {\n return (\n this.options.find((option) => option.value === this.value)?.viewValue ??\n this.defaultViewValue\n );\n }\n\n public ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n}\n","{{viewValue}}\n<ng-content></ng-content>\n"]}
@@ -1722,12 +1722,17 @@ class OptionsCellComponent {
1722
1722
  constructor(renderer) {
1723
1723
  this.renderer = renderer;
1724
1724
  this._subscription = new Subscription();
1725
+ this._initialised = false;
1725
1726
  this.defaultViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.unknown:unknown`;
1726
1727
  this.emptyViewValue = ''; // $localize`:@@rxap-material.table-system.options-cell.empty:empty`;
1727
1728
  }
1728
1729
  ngAfterContentInit() {
1729
1730
  // Hide the mat-option elements
1730
1731
  this._subscription.add(this.options.changes.pipe(startWith(null), tap(() => this.options.forEach(option => this.renderer.setStyle(option._getHostElement(), 'display', 'none')))).subscribe());
1732
+ this.setViewValue();
1733
+ this._initialised = true;
1734
+ }
1735
+ setViewValue() {
1731
1736
  if (this.value === undefined || this.value === null) {
1732
1737
  this.viewValue = this.emptyViewValue;
1733
1738
  }
@@ -1742,6 +1747,13 @@ class OptionsCellComponent {
1742
1747
  }
1743
1748
  }
1744
1749
  }
1750
+ ngOnChanges(changes) {
1751
+ if (this._initialised) {
1752
+ if (changes['value']) {
1753
+ this.setViewValue();
1754
+ }
1755
+ }
1756
+ }
1745
1757
  getViewValue() {
1746
1758
  var _a, _b;
1747
1759
  return ((_b = (_a = this.options.find((option) => option.value === this.value)) === null || _a === void 0 ? void 0 : _a.viewValue) !== null && _b !== void 0 ? _b : this.defaultViewValue);
@@ -1752,7 +1764,7 @@ class OptionsCellComponent {
1752
1764
  }
1753
1765
  }
1754
1766
  OptionsCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionsCellComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1755
- OptionsCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 });
1767
+ OptionsCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 });
1756
1768
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionsCellComponent, decorators: [{
1757
1769
  type: Component,
1758
1770
  args: [{