@eherve/angular-material-datatable 22.2.3 → 22.2.5

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/README.md CHANGED
@@ -97,8 +97,8 @@ This also applies to multiple selections; the open menu keeps all option labels
97
97
  Searchable `select` columns accept `panelWidth`, forwarded to Angular Material's public
98
98
  `MatSelect.panelWidth` input:
99
99
 
100
- - omitted or `'auto'`: match the form field width;
101
- - `null` or `''`: size the menu to its option content, within the viewport;
100
+ - omitted, `null` or `''`: size the menu to its option content, within the viewport (default);
101
+ - `'auto'`: match the form field width;
102
102
  - a number (pixels) or CSS width string: use an explicit menu width.
103
103
 
104
104
  ```ts
@@ -2949,8 +2949,6 @@ var HeaderSelectFilterComponent = class HeaderSelectFilterComponent {
2949
2949
  }));
2950
2950
  if (Array.isArray(this.column.options)) this.buildOptions(this.column.options);
2951
2951
  else this.subsink.add(this.selectOptionsCache.resolve(this.column.options).subscribe((data) => {
2952
- this.options = [];
2953
- this.groups = [];
2954
2952
  this.buildOptions(data);
2955
2953
  }));
2956
2954
  this.changeDetectorRef.detectChanges();
@@ -2959,8 +2957,9 @@ var HeaderSelectFilterComponent = class HeaderSelectFilterComponent {
2959
2957
  this.subsink.unsubscribe();
2960
2958
  }
2961
2959
  buildOptions(data) {
2962
- data.forEach((d) => {
2963
- this.options.push(d);
2960
+ this.options = [...data];
2961
+ this.groups = [];
2962
+ this.options.forEach((d) => {
2964
2963
  const name = d.group ?? "";
2965
2964
  const group = this.groups.find((g) => g.name === name);
2966
2965
  if (!group) this.groups.push({
@@ -2969,6 +2968,7 @@ var HeaderSelectFilterComponent = class HeaderSelectFilterComponent {
2969
2968
  });
2970
2969
  else group.options.push(d);
2971
2970
  });
2971
+ this.changeDetectorRef.markForCheck();
2972
2972
  }
2973
2973
  isEmptyValue(value) {
2974
2974
  return value === null || value === void 0 || value === "" || Array.isArray(value) && !value.length;
@@ -2994,7 +2994,7 @@ var HeaderSelectFilterComponent = class HeaderSelectFilterComponent {
2994
2994
  useExisting: forwardRef(() => HeaderSelectFilterComponent)
2995
2995
  }],
2996
2996
  ngImport: i0,
2997
- template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n appearance=\"fill\"\n [class.label-resting]=\"!filterSelect.shouldLabelFloat\"\n >\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <mat-select\n #filterSelect=\"matSelect\"\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n [multiple]=\"column.multiple\"\n [panelWidth]=\"column.panelWidth === undefined ? 'auto' : column.panelWidth\"\n (closed)=\"onTouched()\"\n >\n <mat-select-trigger>\n @if (column.multiple && selectControl.value | isArray) {\n <div class=\"options\">\n @for (v of selectControl.value; track v) {\n @let option = v | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"v | safeHtml\"></mat-label>\n }\n }\n </div>\n } @else {\n @let option = selectControl.value | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"selectControl.value | safeHtml\"></mat-label>\n }\n }\n </mat-select-trigger>\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n }\n </mat-select>\n\n @if (\n selectControl.value !== null &&\n selectControl.value !== undefined &&\n selectControl.value !== \"\"\n ) {\n <button\n mat-icon-button\n matSuffix\n size=\"small\"\n [attr.aria-label]=\"datatableIntl.clearFilterLabel\"\n (click)=\"selectControl.setValue(undefined)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n}\n\n<ng-template #selectOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case (\"svg\") {\n <mat-icon\n [svgIcon]=\"option.icon\"\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n ></mat-icon>\n }\n @default {\n <mat-icon\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n >\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label\n [style.color]=\"option.color\"\n [innerHTML]=\"option.name | safeHtml\"\n ></mat-label>\n </div>\n</ng-template>\n",
2997
+ template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n appearance=\"fill\"\n [class.label-resting]=\"!filterSelect.shouldLabelFloat\"\n >\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <mat-select\n #filterSelect=\"matSelect\"\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n [multiple]=\"column.multiple\"\n [panelWidth]=\"column.panelWidth ?? null\"\n (closed)=\"onTouched()\"\n >\n <mat-select-trigger>\n @if (column.multiple && selectControl.value | isArray) {\n <div class=\"options\">\n @for (v of selectControl.value; track v) {\n @let option = v | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"v | safeHtml\"></mat-label>\n }\n }\n </div>\n } @else {\n @let option = selectControl.value | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"selectControl.value | safeHtml\"></mat-label>\n }\n }\n </mat-select-trigger>\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n }\n </mat-select>\n\n @if (\n selectControl.value !== null &&\n selectControl.value !== undefined &&\n selectControl.value !== \"\"\n ) {\n <button\n mat-icon-button\n matSuffix\n size=\"small\"\n [attr.aria-label]=\"datatableIntl.clearFilterLabel\"\n (click)=\"selectControl.setValue(undefined)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n}\n\n<ng-template #selectOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case (\"svg\") {\n <mat-icon\n [svgIcon]=\"option.icon\"\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n ></mat-icon>\n }\n @default {\n <mat-icon\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n >\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label\n [style.color]=\"option.color\"\n [innerHTML]=\"option.name | safeHtml\"\n ></mat-label>\n </div>\n</ng-template>\n",
2998
2998
  styles: [":host{display:flex;flex:1 1 100%}mat-form-field{--mat-form-field-filled-focus-active-indicator-color: var(--datatable-accent);--mat-form-field-filled-focus-label-text-color: var(--datatable-accent);--mat-form-field-outlined-focus-outline-color: var(--datatable-accent);--mat-form-field-outlined-focus-label-text-color: var(--datatable-accent);--mat-form-field-focus-select-arrow-color: var(--datatable-accent);--mat-select-arrow-transform: none}mat-form-field.label-resting{--mat-select-arrow-transform: translateY(-.5lh)}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mat-form-field-filled-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mat-form-field-filled-container-shape: 0;--mat-form-field-filled-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.options{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;flex-wrap:wrap}.options .option:not(:last-child){margin-right:8px}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}mat-select{display:flex}mat-select mat-select-trigger{display:block;padding:0;overflow:hidden}mat-select mat-select-trigger .options{flex-wrap:nowrap;overflow:hidden}mat-select mat-select-trigger .option{min-width:0;flex:0 1 auto;overflow:hidden}mat-select mat-select-trigger mat-icon{width:18px;height:18px;min-width:18px;min-height:18px;line-height:18px;font-size:18px;flex:0 0 18px}mat-select mat-select-trigger mat-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"],
2999
2999
  dependencies: [
3000
3000
  {
@@ -3201,7 +3201,7 @@ i0.ɵɵngDeclareClassMetadata({
3201
3201
  multi: true,
3202
3202
  useExisting: forwardRef(() => HeaderSelectFilterComponent)
3203
3203
  }],
3204
- template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n appearance=\"fill\"\n [class.label-resting]=\"!filterSelect.shouldLabelFloat\"\n >\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <mat-select\n #filterSelect=\"matSelect\"\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n [multiple]=\"column.multiple\"\n [panelWidth]=\"column.panelWidth === undefined ? 'auto' : column.panelWidth\"\n (closed)=\"onTouched()\"\n >\n <mat-select-trigger>\n @if (column.multiple && selectControl.value | isArray) {\n <div class=\"options\">\n @for (v of selectControl.value; track v) {\n @let option = v | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"v | safeHtml\"></mat-label>\n }\n }\n </div>\n } @else {\n @let option = selectControl.value | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"selectControl.value | safeHtml\"></mat-label>\n }\n }\n </mat-select-trigger>\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n }\n </mat-select>\n\n @if (\n selectControl.value !== null &&\n selectControl.value !== undefined &&\n selectControl.value !== \"\"\n ) {\n <button\n mat-icon-button\n matSuffix\n size=\"small\"\n [attr.aria-label]=\"datatableIntl.clearFilterLabel\"\n (click)=\"selectControl.setValue(undefined)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n}\n\n<ng-template #selectOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case (\"svg\") {\n <mat-icon\n [svgIcon]=\"option.icon\"\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n ></mat-icon>\n }\n @default {\n <mat-icon\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n >\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label\n [style.color]=\"option.color\"\n [innerHTML]=\"option.name | safeHtml\"\n ></mat-label>\n </div>\n</ng-template>\n",
3204
+ template: "<!-- @format -->\n\n@if (selectControl) {\n <mat-form-field\n appearance=\"fill\"\n [class.label-resting]=\"!filterSelect.shouldLabelFloat\"\n >\n <mat-label [innerHTML]=\"column.header | safeHtml\"></mat-label>\n <mat-select\n #filterSelect=\"matSelect\"\n [formControl]=\"selectControl\"\n [placeholder]=\"column.placeholder!\"\n [multiple]=\"column.multiple\"\n [panelWidth]=\"column.panelWidth ?? null\"\n (closed)=\"onTouched()\"\n >\n <mat-select-trigger>\n @if (column.multiple && selectControl.value | isArray) {\n <div class=\"options\">\n @for (v of selectControl.value; track v) {\n @let option = v | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"v | safeHtml\"></mat-label>\n }\n }\n </div>\n } @else {\n @let option = selectControl.value | selectOption: options;\n @if (option) {\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n } @else {\n <mat-label [innerHTML]=\"selectControl.value | safeHtml\"></mat-label>\n }\n }\n </mat-select-trigger>\n @if (column.hasGroup) {\n @for (group of groups; track group) {\n <mat-optgroup>\n <mat-label [innerHTML]=\"group.name | safeHtml\"></mat-label>\n @for (option of group.options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n }\n } @else {\n @for (option of options; track option) {\n <mat-option [value]=\"option.value\">\n <ng-container\n *ngTemplateOutlet=\"selectOption; context: { option }\"\n ></ng-container>\n </mat-option>\n }\n }\n </mat-select>\n\n @if (\n selectControl.value !== null &&\n selectControl.value !== undefined &&\n selectControl.value !== \"\"\n ) {\n <button\n mat-icon-button\n matSuffix\n size=\"small\"\n [attr.aria-label]=\"datatableIntl.clearFilterLabel\"\n (click)=\"selectControl.setValue(undefined)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n}\n\n<ng-template #selectOption let-option=\"option\">\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case (\"svg\") {\n <mat-icon\n [svgIcon]=\"option.icon\"\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n ></mat-icon>\n }\n @default {\n <mat-icon\n [style.color]=\"option.iconColor ?? option.color\"\n [style.margin-right.px]=\"8\"\n >\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label\n [style.color]=\"option.color\"\n [innerHTML]=\"option.name | safeHtml\"\n ></mat-label>\n </div>\n</ng-template>\n",
3205
3205
  styles: [":host{display:flex;flex:1 1 100%}mat-form-field{--mat-form-field-filled-focus-active-indicator-color: var(--datatable-accent);--mat-form-field-filled-focus-label-text-color: var(--datatable-accent);--mat-form-field-outlined-focus-outline-color: var(--datatable-accent);--mat-form-field-outlined-focus-label-text-color: var(--datatable-accent);--mat-form-field-focus-select-arrow-color: var(--datatable-accent);--mat-select-arrow-transform: none}mat-form-field.label-resting{--mat-select-arrow-transform: translateY(-.5lh)}mat-form-field{min-width:auto;flex:1 1 100%;margin:6px 0;--mat-form-field-filled-active-indicator-color: #999;--mat-form-field-hover-state-layer-opacity: 0;--mat-form-field-filled-container-shape: 0;--mat-form-field-filled-container-color: var(--datatable-background)}mat-form-field ::ng-deep .mat-mdc-form-field-bottom-align{display:none}mat-form-field ::ng-deep .mat-mdc-text-field-wrapper{padding:0}.options{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;flex-wrap:wrap}.options .option:not(:last-child){margin-right:8px}.option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row}mat-select{display:flex}mat-select mat-select-trigger{display:block;padding:0;overflow:hidden}mat-select mat-select-trigger .options{flex-wrap:nowrap;overflow:hidden}mat-select mat-select-trigger .option{min-width:0;flex:0 1 auto;overflow:hidden}mat-select mat-select-trigger mat-icon{width:18px;height:18px;min-width:18px;min-height:18px;line-height:18px;font-size:18px;flex:0 0 18px}mat-select mat-select-trigger mat-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"]
3206
3206
  }]
3207
3207
  }],