@c8y/ngx-components 1023.62.2 → 1023.63.0

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.
@@ -1,36 +1,40 @@
1
1
  import { NgTemplateOutlet, AsyncPipe, CommonModule as CommonModule$1, NgClass } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { Component, runInInjectionContext, inject, computed, ChangeDetectionStrategy, Injectable, EventEmitter, ViewChild, Output, Input } from '@angular/core';
3
+ import { Component, runInInjectionContext, inject, computed, ChangeDetectionStrategy, Injectable, EventEmitter, ViewChild, Output, Input, DestroyRef } from '@angular/core';
4
4
  import * as i2$2 from '@angular/forms';
5
5
  import { FormGroup, FormBuilder, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
6
  import * as i1$1 from '@c8y/client';
7
7
  import { OperationService, InventoryService, QueriesUtil } from '@c8y/client';
8
8
  import * as i1 from '@c8y/ngx-components';
9
- import { DatePipe, BaseColumn, CustomColumn, IconDirective, AlertService, CellRendererContext, CommonModule, IntervalBasedReload, DEFAULT_INTERVAL_VALUES, WIDGET_TYPE_VALUES, CoreModule, CountdownIntervalComponent, ManagedObjectRealtimeService, WidgetGlobalAutoRefreshService, globalAutoRefreshLoading, ModalModule, SelectModule, DateTimePickerModule, C8yTranslateModule, DropdownFocusTrapDirective, EmptyStateComponent, ListGroupModule, C8yTranslatePipe, HumanizePipe } from '@c8y/ngx-components';
9
+ import { DatePipe, BaseColumn, CustomColumn, IconDirective, AlertService, CellRendererContext, CommonModule, IntervalBasedReload, DEFAULT_INTERVAL_VALUES, WIDGET_TYPE_VALUES, CoreModule, CountdownIntervalComponent, ManagedObjectRealtimeService, WidgetGlobalAutoRefreshService, globalAutoRefreshLoading, ModalModule, SelectModule, DateTimePickerModule, C8yTranslateModule, BottomDrawerService, DropdownFocusTrapDirective, EmptyStateComponent, ListGroupModule, C8yTranslatePipe, HumanizePipe } from '@c8y/ngx-components';
10
10
  import { AssetSelectorModule } from '@c8y/ngx-components/assets-navigator';
11
11
  import { WidgetConfigService, ContextDashboardService } from '@c8y/ngx-components/context-dashboard';
12
12
  import { from, switchMap, isObservable, of, map, tap, BehaviorSubject, Subject, merge, startWith, scan, distinctUntilChanged, shareReplay, takeUntil, skip } from 'rxjs';
13
13
  import { transform, identity, get, assign } from 'lodash';
14
14
  import * as i2 from '@c8y/ngx-components/device-grid';
15
- import { AlarmsDeviceGridColumn, StatusDeviceGridColumn } from '@c8y/ngx-components/device-grid';
15
+ import { AlarmsDeviceGridColumn } from '@c8y/ngx-components/device-grid';
16
16
  import { gettext } from '@c8y/ngx-components/gettext';
17
17
  import * as i2$1 from '@c8y/ngx-components/asset-properties';
18
- import { AssetPropertyListComponent } from '@c8y/ngx-components/asset-properties';
18
+ import { AssetPropertySelectorDrawerComponent } from '@c8y/ngx-components/asset-properties';
19
19
  import * as i1$2 from '@ngx-translate/core';
20
20
  import { TranslateService } from '@ngx-translate/core';
21
+ import { AssetTypeGridColumn } from '@c8y/ngx-components/data-grid-columns';
21
22
  import * as i3 from 'ngx-bootstrap/tooltip';
22
23
  import { TooltipModule } from 'ngx-bootstrap/tooltip';
23
24
  import { isEqual } from 'lodash-es';
24
- import { RouterModule } from '@angular/router';
25
+ import * as i3$1 from 'ngx-bootstrap/popover';
25
26
  import { PopoverModule } from 'ngx-bootstrap/popover';
27
+ import { RouterModule } from '@angular/router';
26
28
  import { moveItemInArray, CdkDropList, CdkDrag } from '@angular/cdk/drag-drop';
27
- import * as i3$2 from 'ngx-bootstrap/dropdown';
29
+ import * as i3$3 from 'ngx-bootstrap/dropdown';
28
30
  import { BsDropdownModule, BsDropdownDirective } from 'ngx-bootstrap/dropdown';
29
31
  import * as i4 from '@ngx-formly/core';
30
32
  import { FormlyModule } from '@ngx-formly/core';
31
33
  import { BsModalService } from 'ngx-bootstrap/modal';
32
- import * as i3$1 from '@c8y/ngx-components/icon-selector';
34
+ import * as i3$2 from '@c8y/ngx-components/icon-selector';
33
35
  import { IconSelectorModule } from '@c8y/ngx-components/icon-selector';
36
+ import { DeviceShellService } from '@c8y/ngx-components/device-shell';
37
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
34
38
 
35
39
  class DateCellRendererComponent {
36
40
  constructor(context, columnUtilService) {
@@ -501,7 +505,8 @@ class ComputedCellRendererComponent {
501
505
  this.computedValue = this.getCallbackComputedPropertyValue(this.context.property, this.context.item).pipe(map(value => (typeof value === 'object' && value !== null ? JSON.stringify(value) : value)));
502
506
  }
503
507
  getCallbackComputedPropertyValue(property, context) {
504
- return from(this.computedPropertyService.getByName(property.name)).pipe(switchMap(definition => {
508
+ const propertyName = property.computedConfig?.__propertyName || property.name;
509
+ return from(this.computedPropertyService.getByName(propertyName)).pipe(switchMap(definition => {
505
510
  let value = '-';
506
511
  runInInjectionContext(definition.injector, () => {
507
512
  if (this.context?.property.computedConfig?.dp?.length > 0) {
@@ -611,9 +616,11 @@ class AssetTableService {
611
616
  const opColumns = this.buildOperationColumns(operationColumns);
612
617
  let allColumns = [...propertyColumns, ...opColumns];
613
618
  if (config?.showStatusIcon) {
614
- const statusCol = new StatusDeviceGridColumn();
619
+ const statusCol = new AssetTypeGridColumn();
620
+ statusCol.name = '__status';
615
621
  statusCol.__origin = 'status';
616
622
  statusCol.__id = 'status';
623
+ statusCol.header = gettext('Status');
617
624
  allColumns = [statusCol, ...allColumns];
618
625
  }
619
626
  return this.applySortingAndOrdering(allColumns, config);
@@ -672,10 +679,14 @@ class AssetTableService {
672
679
  withTotalPages: true
673
680
  });
674
681
  }
675
- migrateLegacyProperties(config) {
682
+ async migrateLegacyProperties(config) {
676
683
  if (!config?.options?.properties) {
677
684
  return config;
678
685
  }
686
+ if (config.device) {
687
+ config.device = { ...(await this.inventoryService.detail(config.device.id)).data };
688
+ config.isDeviceAssetSelected = 'c8y_IsDevice' in config.device;
689
+ }
679
690
  const selectedProperties = [];
680
691
  const operationColumns = [];
681
692
  for (const prop of config.options.properties) {
@@ -880,8 +891,15 @@ class AssetTableService {
880
891
  ? config.showAsLink
881
892
  : false;
882
893
  const column = this.createPropertyColumn(prop, columnType, isLink, config);
894
+ const uniqueName = prop.instanceId || prop.name || prop.title;
895
+ if (prop.instanceId) {
896
+ column.name = uniqueName;
897
+ if (column.computedConfig) {
898
+ column.computedConfig.__propertyName = prop.name;
899
+ }
900
+ }
883
901
  column.__origin = 'selectedProperties';
884
- column.__id = prop.name || prop.title;
902
+ column.__id = uniqueName;
885
903
  return column;
886
904
  });
887
905
  }
@@ -890,13 +908,13 @@ class AssetTableService {
890
908
  case 'alarm':
891
909
  return new AlarmsDeviceGridColumnExtended({
892
910
  name: prop.name || prop.title,
893
- header: prop.label || prop.title,
911
+ header: prop.columnLabel || prop.label || prop.title,
894
912
  visible: prop.visible ?? true
895
913
  });
896
914
  case 'date':
897
915
  return new DateAssetTableGridColumn({
898
916
  name: prop.name || prop.title,
899
- header: prop.label || prop.title,
917
+ header: prop.columnLabel || prop.label || prop.title,
900
918
  visible: prop.visible ?? true,
901
919
  path: prop.name || prop.keyPath,
902
920
  sortOrder: prop.sortOrder ?? null
@@ -905,7 +923,7 @@ class AssetTableService {
905
923
  return new IconAssetTableGridColumn({
906
924
  name: prop.name || prop.title,
907
925
  path: prop.keyPath || prop.name,
908
- header: prop.label || prop.title,
926
+ header: prop.columnLabel || prop.label || prop.title,
909
927
  iconConfig: prop.iconConfig || {},
910
928
  computedConfig: prop.computed ? prop.config || {} : null,
911
929
  showIconAndValue: config?.showIconAndValue,
@@ -914,7 +932,7 @@ class AssetTableService {
914
932
  case 'computed':
915
933
  return new ComputedAssetTableGridColumn({
916
934
  name: prop.name || prop.title,
917
- header: prop.label || prop.title,
935
+ header: prop.columnLabel || prop.label || prop.title,
918
936
  computedConfig: prop.config || {},
919
937
  visible: prop.visible ?? true,
920
938
  sortOrder: prop.sortOrder ?? null
@@ -923,7 +941,7 @@ class AssetTableService {
923
941
  default:
924
942
  return new DefaultAssetTableGridColumn({
925
943
  name: prop.name || prop.title,
926
- header: prop.label || prop.title,
944
+ header: prop.columnLabel || prop.label || prop.title,
927
945
  custom: true,
928
946
  isLink,
929
947
  type: 'default',
@@ -1273,6 +1291,8 @@ class AssetTableWidgetConfigComponent {
1273
1291
  * Current isLoading state. Based on it next countdown cycle is being started.
1274
1292
  */
1275
1293
  this.isLoading$ = new BehaviorSubject(false);
1294
+ this.includeDescendantsTooltip = gettext('When enabled, all assets in the hierarchy under the selected asset will be included. When disabled, only the direct child assets will be included.');
1295
+ this.initializedContext = false; // used to track when context was removed on purpose to show all assets.
1276
1296
  this.destroy$ = new Subject();
1277
1297
  this.formBuilder = inject(FormBuilder);
1278
1298
  this.assetTableService = inject(AssetTableService);
@@ -1289,8 +1309,21 @@ class AssetTableWidgetConfigComponent {
1289
1309
  this.setupGridHeaderFilterDependency();
1290
1310
  const mergedConfig$ = merge(this.widgetConfigService.currentConfig$, this.formGroup.valueChanges).pipe(startWith(this.formGroup.getRawValue()), scan((acc, value) => ({ ...acc, ...value }), {}), distinctUntilChanged((a, b) => isEqual(a, b)), shareReplay(1));
1291
1311
  mergedConfig$.pipe(takeUntil(this.destroy$)).subscribe(config => {
1292
- if (!config.device && config.settings?.context) {
1293
- config.device = { ...config.settings.context };
1312
+ if (!config.device && config.settings?.context && !this.initializedContext) {
1313
+ const updatedDevice = { ...config.settings.context };
1314
+ this.initializedContext = true;
1315
+ this.widgetConfigService.updateConfig({
1316
+ device: updatedDevice
1317
+ });
1318
+ config = { ...config, device: updatedDevice };
1319
+ }
1320
+ else if (config.device) {
1321
+ this.initializedContext = true;
1322
+ }
1323
+ if (config.showStatusIcon !== this.config?.showStatusIcon) {
1324
+ this.widgetConfigService.updateConfig({
1325
+ showStatusIcon: config.showStatusIcon
1326
+ });
1294
1327
  }
1295
1328
  this.config = config;
1296
1329
  this.columns = this.getColumns(config);
@@ -1426,12 +1459,12 @@ class AssetTableWidgetConfigComponent {
1426
1459
  filterPredicate: [],
1427
1460
  showIconAndValue: [true],
1428
1461
  showAsLink: [false],
1429
- includeDescendants: [true],
1462
+ includeDescendants: [false],
1430
1463
  showStatusIcon: [true]
1431
1464
  });
1432
1465
  }
1433
1466
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTableWidgetConfigComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1434
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AssetTableWidgetConfigComponent, isStandalone: true, selector: "c8y-asset-table-widget-config", providers: [ManagedObjectRealtimeService], viewQueries: [{ propertyName: "previewMapSet", first: true, predicate: ["assetTablePreview"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"formGroup\">\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Date' | translate }}</legend>\n <div class=\"row tight-grid\">\n <c8y-form-group class=\"m-b-16 form-group-sm\">\n <div class=\"d-flex gap-8 a-i-center\">\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n title=\"{{ 'Refresh options`options for refreshing a view`' | translate }}\"\n [(ngModel)]=\"refreshOption\"\n [ngModelOptions]=\"{ standalone: true }\"\n (change)=\"updateRefreshOption()\"\n >\n <option\n [title]=\"'Refreshing after the given interval' | translate\"\n value=\"interval\"\n >\n {{ 'Use refresh interval' | translate }}\n </option>\n <option\n [title]=\"'Refreshing after the given interval, synchronized globally' | translate\"\n value=\"global-interval\"\n >\n {{ 'Use global refresh interval' | translate }}\n </option>\n </select>\n </div>\n @if (formGroup?.controls?.refreshOption?.value !== GLOBAL_INTERVAL_OPTION) {\n <div\n class=\"c8y-select-wrapper grow flex-no-shrink\"\n title=\" {{ 'Interval' | translate }}\"\n >\n <select\n class=\"form-control text-12\"\n [title]=\"'Refresh interval in seconds' | translate\"\n id=\"refreshInterval\"\n formControlName=\"refreshInterval\"\n data-cy=\"c8y-alarm-list-widget-config--interval-selector\"\n >\n @for (refreshInterval of REFRESH_INTERVAL_IN_MILLISECONDS; track refreshInterval) {\n <option [value]=\"refreshInterval\">\n {{ '{{ seconds }}s' | translate: { seconds: refreshInterval / 1000 } }}\n </option>\n }\n </select>\n </div>\n }\n </div>\n </c8y-form-group>\n </div>\n </fieldset>\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Display options' | translate }}</legend>\n <div formGroupName=\"displayOptions\">\n <!-- Data options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Data' | translate }}</legend>\n <c8y-form-group\n class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- hierarchical data -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Show assets and all descendants' | translate\"\n >\n <input\n name=\"includeDescendants\"\n type=\"checkbox\"\n formControlName=\"includeDescendants\"\n />\n <span></span>\n <span translate>Include descendants</span>\n </label>\n <!-- Status icon -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show status icon column' | translate\"\n >\n <input\n name=\"showStatusIcon\"\n type=\"checkbox\"\n formControlName=\"showStatusIcon\"\n />\n <span></span>\n <span translate>Show status icon column</span>\n </label>\n </c8y-form-group>\n </fieldset>\n <!-- Header options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Header' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\">\n <!-- grid header -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Display the data grid header' | translate\"\n >\n <input\n name=\"gridHeader\"\n type=\"checkbox\"\n formControlName=\"gridHeader\"\n />\n <span></span>\n <span translate>Table header</span>\n </label>\n <!-- show filter label -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display applied filters in the header' | translate\"\n >\n <input\n name=\"filter\"\n type=\"checkbox\"\n formControlName=\"filter\"\n />\n <span></span>\n <span translate>Active filters</span>\n </label>\n <!-- enable configurable columns -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display columns configuration button' | translate\"\n >\n <input\n name=\"configurableColumnsEnabled\"\n type=\"checkbox\"\n formControlName=\"configurableColumnsEnabled\"\n />\n <span></span>\n <span translate>Configure columns</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Row options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Row' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 d-flex-md gap-16 flex-wrap form-group-sm\">\n <!-- zebra stripes -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Alternate row background for readability' | translate\"\n >\n <input\n name=\"striped\"\n type=\"checkbox\"\n formControlName=\"striped\"\n />\n <span></span>\n <span translate>Striped rows</span>\n </label>\n <!-- hover effect -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Change row background color on hover' | translate\"\n >\n <input\n name=\"hover\"\n type=\"checkbox\"\n formControlName=\"hover\"\n />\n <span></span>\n <span translate>Hover highlight</span>\n </label>\n <!-- show loading indicator -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show a spinner while data loads' | translate\"\n >\n <input\n name=\"showLoadingIndicator\"\n type=\"checkbox\"\n formControlName=\"showLoadingIndicator\"\n />\n <span></span>\n <span translate>Loading indicator</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Cell options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Cell' | translate }}</legend>\n <div class=\"d-flex-md gap-16 flex-wrap m-b-8\">\n <!-- cell borders (inside displayOptions) -->\n <c8y-form-group class=\"m-b-0 form-group-sm\">\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Draw borders around table cells' | translate\"\n >\n <input\n name=\"bordered\"\n type=\"checkbox\"\n formControlName=\"bordered\"\n />\n <span></span>\n <span translate>Cell borders</span>\n </label>\n </c8y-form-group>\n <!-- Cell content options (outside displayOptions formGroup, at root form level) -->\n <c8y-form-group\n class=\"m-b-0 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- show icon and value -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'When cell rendering is set to icon, show both icon and value' | translate\"\n >\n <input\n name=\"showIconAndValue\"\n type=\"checkbox\"\n formControlName=\"showIconAndValue\"\n />\n <span></span>\n <span translate>Icon with value</span>\n </label>\n <!-- show as link -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"\n 'Render the first column (excluding computed and alarm types) as a link to the asset details.'\n | translate\n \"\n >\n <input\n name=\"showAsLink\"\n type=\"checkbox\"\n formControlName=\"showAsLink\"\n />\n <span></span>\n <span translate>First column link</span>\n </label>\n </c8y-form-group>\n </div>\n </fieldset>\n </div>\n </fieldset>\n</form>\n\n<ng-template #assetTablePreview>\n @if (\n !formGroup ||\n columns?.length === 0 ||\n ((config.selectedProperties?.length === 0 || config.selectedProperties === null) &&\n (config.operationColumns?.length === 0 || config.operationColumns === null))\n ) {\n <c8y-ui-empty-state\n class=\"d-block m-t-24\"\n [icon]=\"'search'\"\n [title]=\"'No asset table' | translate\"\n [subtitle]=\"'Add property' | translate\"\n ></c8y-ui-empty-state>\n } @else {\n @if (!formGroup.controls.widgetInstanceGlobalTimeContext.value) {\n <c8y-asset-table-auto-refresh\n class=\"d-contents\"\n [isIntervalRefresh]=\"!!formGroup.controls.refreshInterval.value\"\n [refreshInterval]=\"formGroup.controls.refreshInterval.value\"\n [config]=\"formGroup.value\"\n [isRefreshDisabled]=\"false\"\n [isLoading]=\"isLoading$\"\n (onCountdownEnded)=\"updateSelectedAssets()\"\n ></c8y-asset-table-auto-refresh>\n }\n <c8y-data-grid\n class=\"content-fullpage d-flex d-col border-top border-bottom\"\n [title]=\"title\"\n [displayOptions]=\"formGroup.controls.displayOptions.value\"\n [columns]=\"columns\"\n [serverSideDataCallback]=\"serverSideDataCallback\"\n [configureColumnsEnabled]=\"formGroup.get('displayOptions.configurableColumnsEnabled')?.value\"\n [refresh]=\"refresh\"\n >\n <c8y-ui-empty-state\n [icon]=\"'search'\"\n [title]=\"'No results to display.' | translate\"\n [subtitle]=\"'Refine your search terms or check your spelling.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </c8y-data-grid>\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule$1 }, { kind: "ngmodule", type: CoreModule }, { kind: "component", type: i1.EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "component", type: i1.DataGridComponent, selector: "c8y-data-grid", inputs: ["title", "loadMoreItemsLabel", "loadingItemsLabel", "showSearch", "refresh", "loading", "columns", "rows", "pagination", "childNodePagination", "infiniteScroll", "serverSideDataCallback", "selectable", "singleSelection", "selectionPrimaryKey", "displayOptions", "actionControls", "bulkActionControls", "headerActionControls", "searchText", "configureColumnsEnabled", "showCounterWarning", "activeClassName", "expandableRows", "treeGrid", "hideReload", "childNodesProperty", "parentNodeLabelProperty"], outputs: ["rowMouseOver", "rowMouseLeave", "rowClick", "onConfigChange", "onBeforeFilter", "onBeforeSearch", "onFilter", "itemsSelect", "onReload", "onAddCustomColumn", "onRemoveCustomColumn", "onColumnFilterReset", "onSort", "onPageSizeChange", "onColumnReordered", "onColumnVisibilityChange"] }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: AssetSelectorModule }, { kind: "component", type: AssetTableAutoRefreshComponent, selector: "c8y-asset-table-auto-refresh", inputs: ["config", "isIntervalRefresh", "refreshInterval", "isLoading", "isScrolling", "isRefreshDisabled"], outputs: ["onCountdownEnded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
1467
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AssetTableWidgetConfigComponent, isStandalone: true, selector: "c8y-asset-table-widget-config", providers: [ManagedObjectRealtimeService], viewQueries: [{ propertyName: "previewMapSet", first: true, predicate: ["assetTablePreview"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"formGroup\">\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Date' | translate }}</legend>\n <div class=\"row tight-grid\">\n <c8y-form-group class=\"m-b-16 form-group-sm\">\n <div class=\"d-flex gap-8 a-i-center\">\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n title=\"{{ 'Refresh options`options for refreshing a view`' | translate }}\"\n [(ngModel)]=\"refreshOption\"\n [ngModelOptions]=\"{ standalone: true }\"\n (change)=\"updateRefreshOption()\"\n >\n <option\n [title]=\"'Refreshing after the given interval' | translate\"\n value=\"interval\"\n >\n {{ 'Use refresh interval' | translate }}\n </option>\n <option\n [title]=\"'Refreshing after the given interval, synchronized globally' | translate\"\n value=\"global-interval\"\n >\n {{ 'Use global refresh interval' | translate }}\n </option>\n </select>\n </div>\n @if (formGroup?.controls?.refreshOption?.value !== GLOBAL_INTERVAL_OPTION) {\n <div\n class=\"c8y-select-wrapper grow flex-no-shrink\"\n title=\" {{ 'Interval' | translate }}\"\n >\n <select\n class=\"form-control text-12\"\n [title]=\"'Refresh interval in seconds' | translate\"\n id=\"refreshInterval\"\n formControlName=\"refreshInterval\"\n data-cy=\"c8y-alarm-list-widget-config--interval-selector\"\n >\n @for (refreshInterval of REFRESH_INTERVAL_IN_MILLISECONDS; track refreshInterval) {\n <option [value]=\"refreshInterval\">\n {{ '{{ seconds }}s' | translate: { seconds: refreshInterval / 1000 } }}\n </option>\n }\n </select>\n </div>\n }\n </div>\n </c8y-form-group>\n </div>\n </fieldset>\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Display options' | translate }}</legend>\n <div formGroupName=\"displayOptions\">\n <!-- Data options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Data' | translate }}</legend>\n <c8y-form-group\n class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- hierarchical data -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Show assets and all descendants' | translate\"\n >\n <input\n name=\"includeDescendants\"\n type=\"checkbox\"\n formControlName=\"includeDescendants\"\n />\n <span></span>\n <span translate>Include descendants</span>\n <button\n class=\"btn-help m-l-8\"\n [attr.aria-label]=\"includeDescendantsTooltip | translate\"\n [popover]=\"includeDescendantsTooltip | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n (click)=\"$event.stopPropagation()\"\n ></button>\n </label>\n <!-- Status icon -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show status icon column' | translate\"\n >\n <input\n name=\"showStatusIcon\"\n type=\"checkbox\"\n formControlName=\"showStatusIcon\"\n />\n <span></span>\n <span translate>Show status icon column</span>\n </label>\n </c8y-form-group>\n </fieldset>\n <!-- Header options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Header' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\">\n <!-- grid header -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Display the data grid header' | translate\"\n >\n <input\n name=\"gridHeader\"\n type=\"checkbox\"\n formControlName=\"gridHeader\"\n />\n <span></span>\n <span translate>Table header</span>\n </label>\n <!-- show filter label -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display applied filters in the header' | translate\"\n >\n <input\n name=\"filter\"\n type=\"checkbox\"\n formControlName=\"filter\"\n />\n <span></span>\n <span translate>Active filters</span>\n </label>\n <!-- enable configurable columns -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display columns configuration button' | translate\"\n >\n <input\n name=\"configurableColumnsEnabled\"\n type=\"checkbox\"\n formControlName=\"configurableColumnsEnabled\"\n />\n <span></span>\n <span translate>Configure columns</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Row options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Row' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 d-flex-md gap-16 flex-wrap form-group-sm\">\n <!-- zebra stripes -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Alternate row background for readability' | translate\"\n >\n <input\n name=\"striped\"\n type=\"checkbox\"\n formControlName=\"striped\"\n />\n <span></span>\n <span translate>Striped rows</span>\n </label>\n <!-- hover effect -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Change row background color on hover' | translate\"\n >\n <input\n name=\"hover\"\n type=\"checkbox\"\n formControlName=\"hover\"\n />\n <span></span>\n <span translate>Hover highlight</span>\n </label>\n <!-- show loading indicator -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show a spinner while data loads' | translate\"\n >\n <input\n name=\"showLoadingIndicator\"\n type=\"checkbox\"\n formControlName=\"showLoadingIndicator\"\n />\n <span></span>\n <span translate>Loading indicator</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Cell options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Cell' | translate }}</legend>\n <div class=\"d-flex-md gap-16 flex-wrap m-b-8\">\n <!-- cell borders (inside displayOptions) -->\n <c8y-form-group class=\"m-b-0 form-group-sm\">\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Draw borders around table cells' | translate\"\n >\n <input\n name=\"bordered\"\n type=\"checkbox\"\n formControlName=\"bordered\"\n />\n <span></span>\n <span translate>Cell borders</span>\n </label>\n </c8y-form-group>\n <!-- Cell content options (outside displayOptions formGroup, at root form level) -->\n <c8y-form-group\n class=\"m-b-0 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- show icon and value -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'When cell rendering is set to icon, show both icon and value' | translate\"\n >\n <input\n name=\"showIconAndValue\"\n type=\"checkbox\"\n formControlName=\"showIconAndValue\"\n />\n <span></span>\n <span translate>Icon with value</span>\n </label>\n <!-- show as link -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"\n 'Render the first column (excluding computed and alarm types) as a link to the asset details.'\n | translate\n \"\n >\n <input\n name=\"showAsLink\"\n type=\"checkbox\"\n formControlName=\"showAsLink\"\n />\n <span></span>\n <span translate>First column link</span>\n </label>\n </c8y-form-group>\n </div>\n </fieldset>\n </div>\n </fieldset>\n</form>\n\n<ng-template #assetTablePreview>\n @if (\n !formGroup ||\n columns?.length === 0 ||\n ((config.selectedProperties?.length === 0 || config.selectedProperties === null) &&\n (config.operationColumns?.length === 0 || config.operationColumns === null))\n ) {\n <c8y-ui-empty-state\n class=\"d-block m-t-24\"\n [icon]=\"'search'\"\n [title]=\"'No data to display' | translate\"\n [subtitle]=\"'Start by selecting the properties' | translate\"\n ></c8y-ui-empty-state>\n } @else {\n @if (!formGroup.controls.widgetInstanceGlobalTimeContext.value) {\n <c8y-asset-table-auto-refresh\n class=\"d-contents\"\n [isIntervalRefresh]=\"!!formGroup.controls.refreshInterval.value\"\n [refreshInterval]=\"formGroup.controls.refreshInterval.value\"\n [config]=\"formGroup.value\"\n [isRefreshDisabled]=\"false\"\n [isLoading]=\"isLoading$\"\n (onCountdownEnded)=\"updateSelectedAssets()\"\n ></c8y-asset-table-auto-refresh>\n }\n <c8y-data-grid\n class=\"content-fullpage d-flex d-col border-top border-bottom\"\n [title]=\"title\"\n [displayOptions]=\"formGroup.controls.displayOptions.value\"\n [columns]=\"columns\"\n [serverSideDataCallback]=\"serverSideDataCallback\"\n [configureColumnsEnabled]=\"formGroup.get('displayOptions.configurableColumnsEnabled')?.value\"\n [refresh]=\"refresh\"\n >\n <c8y-ui-empty-state\n [icon]=\"'search'\"\n [title]=\"'No results to display.' | translate\"\n [subtitle]=\"'Refine your search terms or check your spelling.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </c8y-data-grid>\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule$1 }, { kind: "ngmodule", type: CoreModule }, { kind: "component", type: i1.EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "component", type: i1.DataGridComponent, selector: "c8y-data-grid", inputs: ["title", "loadMoreItemsLabel", "loadingItemsLabel", "showSearch", "refresh", "loading", "columns", "rows", "pagination", "childNodePagination", "infiniteScroll", "serverSideDataCallback", "selectable", "singleSelection", "selectionPrimaryKey", "displayOptions", "actionControls", "bulkActionControls", "headerActionControls", "searchText", "configureColumnsEnabled", "showCounterWarning", "activeClassName", "expandableRows", "treeGrid", "hideReload", "childNodesProperty", "parentNodeLabelProperty"], outputs: ["rowMouseOver", "rowMouseLeave", "rowClick", "onConfigChange", "onBeforeFilter", "onBeforeSearch", "onFilter", "itemsSelect", "onReload", "onAddCustomColumn", "onRemoveCustomColumn", "onColumnFilterReset", "onSort", "onPageSizeChange", "onColumnReordered", "onColumnVisibilityChange"] }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: AssetSelectorModule }, { kind: "component", type: AssetTableAutoRefreshComponent, selector: "c8y-asset-table-auto-refresh", inputs: ["config", "isIntervalRefresh", "refreshInterval", "isLoading", "isScrolling", "isRefreshDisabled"], outputs: ["onCountdownEnded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "ngmodule", type: PopoverModule }, { kind: "directive", type: i3$1.PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
1435
1468
  }
1436
1469
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTableWidgetConfigComponent, decorators: [{
1437
1470
  type: Component,
@@ -1440,8 +1473,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
1440
1473
  CoreModule,
1441
1474
  AssetSelectorModule,
1442
1475
  AssetTableAutoRefreshComponent,
1443
- TooltipModule
1444
- ], providers: [ManagedObjectRealtimeService], template: "<form [formGroup]=\"formGroup\">\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Date' | translate }}</legend>\n <div class=\"row tight-grid\">\n <c8y-form-group class=\"m-b-16 form-group-sm\">\n <div class=\"d-flex gap-8 a-i-center\">\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n title=\"{{ 'Refresh options`options for refreshing a view`' | translate }}\"\n [(ngModel)]=\"refreshOption\"\n [ngModelOptions]=\"{ standalone: true }\"\n (change)=\"updateRefreshOption()\"\n >\n <option\n [title]=\"'Refreshing after the given interval' | translate\"\n value=\"interval\"\n >\n {{ 'Use refresh interval' | translate }}\n </option>\n <option\n [title]=\"'Refreshing after the given interval, synchronized globally' | translate\"\n value=\"global-interval\"\n >\n {{ 'Use global refresh interval' | translate }}\n </option>\n </select>\n </div>\n @if (formGroup?.controls?.refreshOption?.value !== GLOBAL_INTERVAL_OPTION) {\n <div\n class=\"c8y-select-wrapper grow flex-no-shrink\"\n title=\" {{ 'Interval' | translate }}\"\n >\n <select\n class=\"form-control text-12\"\n [title]=\"'Refresh interval in seconds' | translate\"\n id=\"refreshInterval\"\n formControlName=\"refreshInterval\"\n data-cy=\"c8y-alarm-list-widget-config--interval-selector\"\n >\n @for (refreshInterval of REFRESH_INTERVAL_IN_MILLISECONDS; track refreshInterval) {\n <option [value]=\"refreshInterval\">\n {{ '{{ seconds }}s' | translate: { seconds: refreshInterval / 1000 } }}\n </option>\n }\n </select>\n </div>\n }\n </div>\n </c8y-form-group>\n </div>\n </fieldset>\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Display options' | translate }}</legend>\n <div formGroupName=\"displayOptions\">\n <!-- Data options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Data' | translate }}</legend>\n <c8y-form-group\n class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- hierarchical data -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Show assets and all descendants' | translate\"\n >\n <input\n name=\"includeDescendants\"\n type=\"checkbox\"\n formControlName=\"includeDescendants\"\n />\n <span></span>\n <span translate>Include descendants</span>\n </label>\n <!-- Status icon -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show status icon column' | translate\"\n >\n <input\n name=\"showStatusIcon\"\n type=\"checkbox\"\n formControlName=\"showStatusIcon\"\n />\n <span></span>\n <span translate>Show status icon column</span>\n </label>\n </c8y-form-group>\n </fieldset>\n <!-- Header options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Header' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\">\n <!-- grid header -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Display the data grid header' | translate\"\n >\n <input\n name=\"gridHeader\"\n type=\"checkbox\"\n formControlName=\"gridHeader\"\n />\n <span></span>\n <span translate>Table header</span>\n </label>\n <!-- show filter label -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display applied filters in the header' | translate\"\n >\n <input\n name=\"filter\"\n type=\"checkbox\"\n formControlName=\"filter\"\n />\n <span></span>\n <span translate>Active filters</span>\n </label>\n <!-- enable configurable columns -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display columns configuration button' | translate\"\n >\n <input\n name=\"configurableColumnsEnabled\"\n type=\"checkbox\"\n formControlName=\"configurableColumnsEnabled\"\n />\n <span></span>\n <span translate>Configure columns</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Row options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Row' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 d-flex-md gap-16 flex-wrap form-group-sm\">\n <!-- zebra stripes -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Alternate row background for readability' | translate\"\n >\n <input\n name=\"striped\"\n type=\"checkbox\"\n formControlName=\"striped\"\n />\n <span></span>\n <span translate>Striped rows</span>\n </label>\n <!-- hover effect -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Change row background color on hover' | translate\"\n >\n <input\n name=\"hover\"\n type=\"checkbox\"\n formControlName=\"hover\"\n />\n <span></span>\n <span translate>Hover highlight</span>\n </label>\n <!-- show loading indicator -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show a spinner while data loads' | translate\"\n >\n <input\n name=\"showLoadingIndicator\"\n type=\"checkbox\"\n formControlName=\"showLoadingIndicator\"\n />\n <span></span>\n <span translate>Loading indicator</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Cell options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Cell' | translate }}</legend>\n <div class=\"d-flex-md gap-16 flex-wrap m-b-8\">\n <!-- cell borders (inside displayOptions) -->\n <c8y-form-group class=\"m-b-0 form-group-sm\">\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Draw borders around table cells' | translate\"\n >\n <input\n name=\"bordered\"\n type=\"checkbox\"\n formControlName=\"bordered\"\n />\n <span></span>\n <span translate>Cell borders</span>\n </label>\n </c8y-form-group>\n <!-- Cell content options (outside displayOptions formGroup, at root form level) -->\n <c8y-form-group\n class=\"m-b-0 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- show icon and value -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'When cell rendering is set to icon, show both icon and value' | translate\"\n >\n <input\n name=\"showIconAndValue\"\n type=\"checkbox\"\n formControlName=\"showIconAndValue\"\n />\n <span></span>\n <span translate>Icon with value</span>\n </label>\n <!-- show as link -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"\n 'Render the first column (excluding computed and alarm types) as a link to the asset details.'\n | translate\n \"\n >\n <input\n name=\"showAsLink\"\n type=\"checkbox\"\n formControlName=\"showAsLink\"\n />\n <span></span>\n <span translate>First column link</span>\n </label>\n </c8y-form-group>\n </div>\n </fieldset>\n </div>\n </fieldset>\n</form>\n\n<ng-template #assetTablePreview>\n @if (\n !formGroup ||\n columns?.length === 0 ||\n ((config.selectedProperties?.length === 0 || config.selectedProperties === null) &&\n (config.operationColumns?.length === 0 || config.operationColumns === null))\n ) {\n <c8y-ui-empty-state\n class=\"d-block m-t-24\"\n [icon]=\"'search'\"\n [title]=\"'No asset table' | translate\"\n [subtitle]=\"'Add property' | translate\"\n ></c8y-ui-empty-state>\n } @else {\n @if (!formGroup.controls.widgetInstanceGlobalTimeContext.value) {\n <c8y-asset-table-auto-refresh\n class=\"d-contents\"\n [isIntervalRefresh]=\"!!formGroup.controls.refreshInterval.value\"\n [refreshInterval]=\"formGroup.controls.refreshInterval.value\"\n [config]=\"formGroup.value\"\n [isRefreshDisabled]=\"false\"\n [isLoading]=\"isLoading$\"\n (onCountdownEnded)=\"updateSelectedAssets()\"\n ></c8y-asset-table-auto-refresh>\n }\n <c8y-data-grid\n class=\"content-fullpage d-flex d-col border-top border-bottom\"\n [title]=\"title\"\n [displayOptions]=\"formGroup.controls.displayOptions.value\"\n [columns]=\"columns\"\n [serverSideDataCallback]=\"serverSideDataCallback\"\n [configureColumnsEnabled]=\"formGroup.get('displayOptions.configurableColumnsEnabled')?.value\"\n [refresh]=\"refresh\"\n >\n <c8y-ui-empty-state\n [icon]=\"'search'\"\n [title]=\"'No results to display.' | translate\"\n [subtitle]=\"'Refine your search terms or check your spelling.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </c8y-data-grid>\n }\n</ng-template>\n" }]
1476
+ TooltipModule,
1477
+ PopoverModule
1478
+ ], providers: [ManagedObjectRealtimeService], template: "<form [formGroup]=\"formGroup\">\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Date' | translate }}</legend>\n <div class=\"row tight-grid\">\n <c8y-form-group class=\"m-b-16 form-group-sm\">\n <div class=\"d-flex gap-8 a-i-center\">\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n title=\"{{ 'Refresh options`options for refreshing a view`' | translate }}\"\n [(ngModel)]=\"refreshOption\"\n [ngModelOptions]=\"{ standalone: true }\"\n (change)=\"updateRefreshOption()\"\n >\n <option\n [title]=\"'Refreshing after the given interval' | translate\"\n value=\"interval\"\n >\n {{ 'Use refresh interval' | translate }}\n </option>\n <option\n [title]=\"'Refreshing after the given interval, synchronized globally' | translate\"\n value=\"global-interval\"\n >\n {{ 'Use global refresh interval' | translate }}\n </option>\n </select>\n </div>\n @if (formGroup?.controls?.refreshOption?.value !== GLOBAL_INTERVAL_OPTION) {\n <div\n class=\"c8y-select-wrapper grow flex-no-shrink\"\n title=\" {{ 'Interval' | translate }}\"\n >\n <select\n class=\"form-control text-12\"\n [title]=\"'Refresh interval in seconds' | translate\"\n id=\"refreshInterval\"\n formControlName=\"refreshInterval\"\n data-cy=\"c8y-alarm-list-widget-config--interval-selector\"\n >\n @for (refreshInterval of REFRESH_INTERVAL_IN_MILLISECONDS; track refreshInterval) {\n <option [value]=\"refreshInterval\">\n {{ '{{ seconds }}s' | translate: { seconds: refreshInterval / 1000 } }}\n </option>\n }\n </select>\n </div>\n }\n </div>\n </c8y-form-group>\n </div>\n </fieldset>\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Display options' | translate }}</legend>\n <div formGroupName=\"displayOptions\">\n <!-- Data options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Data' | translate }}</legend>\n <c8y-form-group\n class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- hierarchical data -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Show assets and all descendants' | translate\"\n >\n <input\n name=\"includeDescendants\"\n type=\"checkbox\"\n formControlName=\"includeDescendants\"\n />\n <span></span>\n <span translate>Include descendants</span>\n <button\n class=\"btn-help m-l-8\"\n [attr.aria-label]=\"includeDescendantsTooltip | translate\"\n [popover]=\"includeDescendantsTooltip | translate\"\n placement=\"top\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n (click)=\"$event.stopPropagation()\"\n ></button>\n </label>\n <!-- Status icon -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show status icon column' | translate\"\n >\n <input\n name=\"showStatusIcon\"\n type=\"checkbox\"\n formControlName=\"showStatusIcon\"\n />\n <span></span>\n <span translate>Show status icon column</span>\n </label>\n </c8y-form-group>\n </fieldset>\n <!-- Header options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Header' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 form-group-sm d-flex-md flex-wrap gap-16\">\n <!-- grid header -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Display the data grid header' | translate\"\n >\n <input\n name=\"gridHeader\"\n type=\"checkbox\"\n formControlName=\"gridHeader\"\n />\n <span></span>\n <span translate>Table header</span>\n </label>\n <!-- show filter label -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display applied filters in the header' | translate\"\n >\n <input\n name=\"filter\"\n type=\"checkbox\"\n formControlName=\"filter\"\n />\n <span></span>\n <span translate>Active filters</span>\n </label>\n <!-- enable configurable columns -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Display columns configuration button' | translate\"\n >\n <input\n name=\"configurableColumnsEnabled\"\n type=\"checkbox\"\n formControlName=\"configurableColumnsEnabled\"\n />\n <span></span>\n <span translate>Configure columns</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Row options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Row' | translate }}</legend>\n <c8y-form-group class=\"m-b-8 d-flex-md gap-16 flex-wrap form-group-sm\">\n <!-- zebra stripes -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Alternate row background for readability' | translate\"\n >\n <input\n name=\"striped\"\n type=\"checkbox\"\n formControlName=\"striped\"\n />\n <span></span>\n <span translate>Striped rows</span>\n </label>\n <!-- hover effect -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Change row background color on hover' | translate\"\n >\n <input\n name=\"hover\"\n type=\"checkbox\"\n formControlName=\"hover\"\n />\n <span></span>\n <span translate>Hover highlight</span>\n </label>\n <!-- show loading indicator -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"'Show a spinner while data loads' | translate\"\n >\n <input\n name=\"showLoadingIndicator\"\n type=\"checkbox\"\n formControlName=\"showLoadingIndicator\"\n />\n <span></span>\n <span translate>Loading indicator</span>\n </label>\n </c8y-form-group>\n </fieldset>\n\n <!-- Cell options -->\n <fieldset class=\"c8y-fieldset\">\n <legend>{{ 'Cell' | translate }}</legend>\n <div class=\"d-flex-md gap-16 flex-wrap m-b-8\">\n <!-- cell borders (inside displayOptions) -->\n <c8y-form-group class=\"m-b-0 form-group-sm\">\n <label\n class=\"c8y-checkbox\"\n [title]=\"'Draw borders around table cells' | translate\"\n >\n <input\n name=\"bordered\"\n type=\"checkbox\"\n formControlName=\"bordered\"\n />\n <span></span>\n <span translate>Cell borders</span>\n </label>\n </c8y-form-group>\n <!-- Cell content options (outside displayOptions formGroup, at root form level) -->\n <c8y-form-group\n class=\"m-b-0 form-group-sm d-flex-md flex-wrap gap-16\"\n [formGroup]=\"formGroup\"\n >\n <!-- show icon and value -->\n <label\n class=\"c8y-checkbox\"\n [title]=\"'When cell rendering is set to icon, show both icon and value' | translate\"\n >\n <input\n name=\"showIconAndValue\"\n type=\"checkbox\"\n formControlName=\"showIconAndValue\"\n />\n <span></span>\n <span translate>Icon with value</span>\n </label>\n <!-- show as link -->\n <label\n class=\"c8y-checkbox m-t-0\"\n [title]=\"\n 'Render the first column (excluding computed and alarm types) as a link to the asset details.'\n | translate\n \"\n >\n <input\n name=\"showAsLink\"\n type=\"checkbox\"\n formControlName=\"showAsLink\"\n />\n <span></span>\n <span translate>First column link</span>\n </label>\n </c8y-form-group>\n </div>\n </fieldset>\n </div>\n </fieldset>\n</form>\n\n<ng-template #assetTablePreview>\n @if (\n !formGroup ||\n columns?.length === 0 ||\n ((config.selectedProperties?.length === 0 || config.selectedProperties === null) &&\n (config.operationColumns?.length === 0 || config.operationColumns === null))\n ) {\n <c8y-ui-empty-state\n class=\"d-block m-t-24\"\n [icon]=\"'search'\"\n [title]=\"'No data to display' | translate\"\n [subtitle]=\"'Start by selecting the properties' | translate\"\n ></c8y-ui-empty-state>\n } @else {\n @if (!formGroup.controls.widgetInstanceGlobalTimeContext.value) {\n <c8y-asset-table-auto-refresh\n class=\"d-contents\"\n [isIntervalRefresh]=\"!!formGroup.controls.refreshInterval.value\"\n [refreshInterval]=\"formGroup.controls.refreshInterval.value\"\n [config]=\"formGroup.value\"\n [isRefreshDisabled]=\"false\"\n [isLoading]=\"isLoading$\"\n (onCountdownEnded)=\"updateSelectedAssets()\"\n ></c8y-asset-table-auto-refresh>\n }\n <c8y-data-grid\n class=\"content-fullpage d-flex d-col border-top border-bottom\"\n [title]=\"title\"\n [displayOptions]=\"formGroup.controls.displayOptions.value\"\n [columns]=\"columns\"\n [serverSideDataCallback]=\"serverSideDataCallback\"\n [configureColumnsEnabled]=\"formGroup.get('displayOptions.configurableColumnsEnabled')?.value\"\n [refresh]=\"refresh\"\n >\n <c8y-ui-empty-state\n [icon]=\"'search'\"\n [title]=\"'No results to display.' | translate\"\n [subtitle]=\"'Refine your search terms or check your spelling.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n </c8y-data-grid>\n }\n</ng-template>\n" }]
1445
1479
  }], ctorParameters: () => [], propDecorators: { previewMapSet: [{
1446
1480
  type: ViewChild,
1447
1481
  args: ['assetTablePreview']
@@ -1466,9 +1500,9 @@ class AssetTableWidgetViewComponent {
1466
1500
  this.alertService = inject(AlertService);
1467
1501
  this.serverSideDataCallback = this.onDataSourceModifier.bind(this);
1468
1502
  }
1469
- ngOnInit() {
1503
+ async ngOnInit() {
1470
1504
  if (this.assetTableService.isMigrationNeeded(this.config)) {
1471
- this.config = this.assetTableService.migrateLegacyProperties(this.config);
1505
+ this.config = await this.assetTableService.migrateLegacyProperties(this.config);
1472
1506
  }
1473
1507
  this.columns = this.assetTableService.getColumns(this.config?.selectedProperties, this.config?.operationColumns, this.config);
1474
1508
  if (this.config.widgetInstanceGlobalAutoRefreshContext) {
@@ -1590,7 +1624,7 @@ class IconRenderTypeModalComponent {
1590
1624
  });
1591
1625
  }
1592
1626
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: IconRenderTypeModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1593
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: IconRenderTypeModalComponent, isStandalone: true, selector: "c8y-icon-render-type-modal", ngImport: i0, template: "<c8y-modal\n title=\"{{ 'Configure icon conditions' | translate }}\"\n (onClose)=\"onClose($event)\"\n (onDismiss)=\"onDismiss($event)\"\n [labels]=\"labels\"\n [disabled]=\"isAnyFormInvalid()\"\n [headerClasses]=\"'dialog-header'\"\n>\n <ng-container c8y-modal-title>\n <span c8yIcon=\"c8y-circle-star\"></span>\n </ng-container>\n <form class=\"p-24 p-t-0\">\n @for (form of forms; track form; let i = $index) {\n <fieldset\n class=\"c8y-fieldset\"\n [formGroup]=\"form\"\n >\n <legend>\n {{ 'If condition' | translate }}\n @if (forms.length > 1) {\n <button\n class=\"btn-dot btn-dot--danger\"\n title=\"{{ 'Remove condition' | translate }}\"\n type=\"button\"\n (click)=\"removeCondition(i)\"\n >\n <i c8yIcon=\"minus-circle\"></i>\n </button>\n }\n </legend>\n <!-- Data type selection -->\n <div class=\"row tight-grid\">\n <div class=\"col-md-4 col-12\">\n <label\n for=\"dataType-{{ i }}\"\n translate\n >\n Data type\n </label>\n <c8y-select\n aria-label=\"{{ 'Data type select' | translate }}\"\n id=\"dataType-{{ i }}\"\n [items]=\"dataTypes\"\n [placeholder]=\"'Select data type\u2026' | translate\"\n formControlName=\"dataType\"\n ></c8y-select>\n </div>\n\n <!-- Comparison dropdown -->\n <div class=\"col-md-4 col-12\">\n <label\n for=\"comparison-{{ i }}\"\n translate\n >\n Comparison\n </label>\n <c8y-select\n aria-label=\"{{ 'Comparison select' | translate }}\"\n id=\"comparison-{{ i }}\"\n [items]=\"comparisonOptions[form.get('dataType')?.value?.value] || []\"\n formControlName=\"comparison\"\n [placeholder]=\"'Select comparison type\u2026' | translate\"\n labelProp=\"label\"\n valueProp=\"value\"\n ></c8y-select>\n </div>\n <!-- Value input based on type -->\n <div class=\"col-md-4 col-12\">\n <label\n for=\"value-{{ i }}\"\n translate\n >\n Value\n </label>\n @switch (form.get('dataType')?.value?.value) {\n @case ('number') {\n <input\n class=\"form-control\"\n id=\"value-{{ i }}\"\n type=\"number\"\n formControlName=\"value\"\n />\n }\n @case ('date') {\n <c8y-date-time-picker\n aria-label=\"{{ 'Date and time picker' | translate }}\"\n placeholder=\"{{ 'Select date\u2026' | translate }}\"\n formControlName=\"value\"\n size=\"sm\"\n (onDateSelected)=\"onDateSelected($event, i)\"\n ></c8y-date-time-picker>\n }\n @case ('string') {\n <input\n class=\"form-control\"\n id=\"value-{{ i }}\"\n type=\"text\"\n formControlName=\"value\"\n />\n }\n @case ('boolean') {\n <c8y-select\n aria-label=\"{{ 'Boolean select' | translate }}\"\n [items]=\"booleanOptions\"\n [placeholder]=\"'Select value\u2026' | translate\"\n formControlName=\"value\"\n labelProp=\"label\"\n valueProp=\"value\"\n ></c8y-select>\n }\n }\n </div>\n </div>\n <div class=\"d-flex gap-16 m-t-8 m-b-8\">\n <!-- Icon field -->\n <div class=\"d-flex a-i-center\">\n <label\n class=\"m-b-0 m-r-4\"\n for=\"icon-{{ i }}\"\n translate\n >\n Icon\n </label>\n <c8y-icon-selector-wrapper\n [selectedIcon]=\"form.get('icon')?.value || 'c8y-cockpit'\"\n [iconSize]=\"24\"\n (onSelect)=\"iconSelectionChange($event, i)\"\n ></c8y-icon-selector-wrapper>\n </div>\n\n <!-- Color field -->\n <div class=\"d-flex a-i-center m-l-8\">\n <label\n class=\"m-b-0 m-r-4 text-nowrap\"\n for=\"color-{{ i }}\"\n translate\n >\n Icon color\n </label>\n <input\n class=\"form-control\"\n style=\"width: 100%; min-width: 40px\"\n id=\"color-{{ i }}\"\n type=\"color\"\n formControlName=\"color\"\n />\n </div>\n </div>\n </fieldset>\n }\n <button\n class=\"btn btn-default m-t-16\"\n title=\"{{ 'Add condition' | translate }}\"\n type=\"button\"\n (click)=\"addCondition()\"\n >\n <i c8yIcon=\"plus-circle\"></i>\n {{ 'Add condition' | translate }}\n </button>\n </form>\n</c8y-modal>\n", dependencies: [{ kind: "ngmodule", type: ModalModule }, { kind: "component", type: i1.ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i1.SelectComponent, selector: "c8y-select", inputs: ["placeholder", "items", "selected", "container", "multi", "canSelectWithSpace", "disabled", "autoClose", "insideClick", "required", "canDeselect", "name", "icon", "filterItems"], outputs: ["onSelect", "onDeselect", "onIconClick"] }, { kind: "ngmodule", type: IconSelectorModule }, { kind: "component", type: i3$1.IconSelectorWrapperComponent, selector: "c8y-icon-selector-wrapper", inputs: ["canRemoveIcon", "selectedIcon", "iconSize"], outputs: ["onSelect"] }, { kind: "ngmodule", type: DateTimePickerModule }, { kind: "component", type: i1.DateTimePickerComponent, selector: "c8y-date-time-picker", inputs: ["minDate", "maxDate", "placeholder", "dateInputFormat", "adaptivePosition", "size", "dateType", "config"], outputs: ["onDateSelected"] }, { kind: "ngmodule", type: C8yTranslateModule }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
1627
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: IconRenderTypeModalComponent, isStandalone: true, selector: "c8y-icon-render-type-modal", ngImport: i0, template: "<c8y-modal\n title=\"{{ 'Configure icon conditions' | translate }}\"\n (onClose)=\"onClose($event)\"\n (onDismiss)=\"onDismiss($event)\"\n [labels]=\"labels\"\n [disabled]=\"isAnyFormInvalid()\"\n [headerClasses]=\"'dialog-header'\"\n>\n <ng-container c8y-modal-title>\n <span c8yIcon=\"c8y-circle-star\"></span>\n </ng-container>\n <form class=\"p-24 p-t-0\">\n @for (form of forms; track form; let i = $index) {\n <fieldset\n class=\"c8y-fieldset\"\n [formGroup]=\"form\"\n >\n <legend>\n {{ 'If condition' | translate }}\n @if (forms.length > 1) {\n <button\n class=\"btn-dot btn-dot--danger\"\n title=\"{{ 'Remove condition' | translate }}\"\n type=\"button\"\n (click)=\"removeCondition(i)\"\n >\n <i c8yIcon=\"minus-circle\"></i>\n </button>\n }\n </legend>\n <!-- Data type selection -->\n <div class=\"row tight-grid\">\n <div class=\"col-md-4 col-12\">\n <label\n for=\"dataType-{{ i }}\"\n translate\n >\n Data type\n </label>\n <c8y-select\n aria-label=\"{{ 'Data type select' | translate }}\"\n id=\"dataType-{{ i }}\"\n [items]=\"dataTypes\"\n [placeholder]=\"'Select data type\u2026' | translate\"\n formControlName=\"dataType\"\n ></c8y-select>\n </div>\n\n <!-- Comparison dropdown -->\n <div class=\"col-md-4 col-12\">\n <label\n for=\"comparison-{{ i }}\"\n translate\n >\n Comparison\n </label>\n <c8y-select\n aria-label=\"{{ 'Comparison select' | translate }}\"\n id=\"comparison-{{ i }}\"\n [items]=\"comparisonOptions[form.get('dataType')?.value?.value] || []\"\n formControlName=\"comparison\"\n [placeholder]=\"'Select comparison type\u2026' | translate\"\n labelProp=\"label\"\n valueProp=\"value\"\n ></c8y-select>\n </div>\n <!-- Value input based on type -->\n <div class=\"col-md-4 col-12\">\n <label\n for=\"value-{{ i }}\"\n translate\n >\n Value\n </label>\n @switch (form.get('dataType')?.value?.value) {\n @case ('number') {\n <input\n class=\"form-control\"\n id=\"value-{{ i }}\"\n type=\"number\"\n formControlName=\"value\"\n />\n }\n @case ('date') {\n <c8y-date-time-picker\n aria-label=\"{{ 'Date and time picker' | translate }}\"\n placeholder=\"{{ 'Select date\u2026' | translate }}\"\n formControlName=\"value\"\n size=\"sm\"\n (onDateSelected)=\"onDateSelected($event, i)\"\n ></c8y-date-time-picker>\n }\n @case ('string') {\n <input\n class=\"form-control\"\n id=\"value-{{ i }}\"\n type=\"text\"\n formControlName=\"value\"\n />\n }\n @case ('boolean') {\n <c8y-select\n aria-label=\"{{ 'Boolean select' | translate }}\"\n [items]=\"booleanOptions\"\n [placeholder]=\"'Select value\u2026' | translate\"\n formControlName=\"value\"\n labelProp=\"label\"\n valueProp=\"value\"\n ></c8y-select>\n }\n }\n </div>\n </div>\n <div class=\"d-flex gap-16 m-t-8 m-b-8\">\n <!-- Icon field -->\n <div class=\"d-flex a-i-center\">\n <label\n class=\"m-b-0 m-r-4\"\n for=\"icon-{{ i }}\"\n translate\n >\n Icon\n </label>\n <c8y-icon-selector-wrapper\n [selectedIcon]=\"form.get('icon')?.value || 'c8y-cockpit'\"\n [iconSize]=\"24\"\n (onSelect)=\"iconSelectionChange($event, i)\"\n ></c8y-icon-selector-wrapper>\n </div>\n\n <!-- Color field -->\n <div class=\"d-flex a-i-center m-l-8\">\n <label\n class=\"m-b-0 m-r-4 text-nowrap\"\n for=\"color-{{ i }}\"\n translate\n >\n Icon color\n </label>\n <input\n class=\"form-control\"\n style=\"width: 100%; min-width: 40px\"\n id=\"color-{{ i }}\"\n type=\"color\"\n formControlName=\"color\"\n />\n </div>\n </div>\n </fieldset>\n }\n <button\n class=\"btn btn-default m-t-16\"\n title=\"{{ 'Add condition' | translate }}\"\n type=\"button\"\n (click)=\"addCondition()\"\n >\n <i c8yIcon=\"plus-circle\"></i>\n {{ 'Add condition' | translate }}\n </button>\n </form>\n</c8y-modal>\n", dependencies: [{ kind: "ngmodule", type: ModalModule }, { kind: "component", type: i1.ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i1.SelectComponent, selector: "c8y-select", inputs: ["placeholder", "items", "selected", "container", "multi", "canSelectWithSpace", "disabled", "autoClose", "insideClick", "required", "canDeselect", "name", "icon", "filterItems"], outputs: ["onSelect", "onDeselect", "onIconClick"] }, { kind: "ngmodule", type: IconSelectorModule }, { kind: "component", type: i3$2.IconSelectorWrapperComponent, selector: "c8y-icon-selector-wrapper", inputs: ["canRemoveIcon", "selectedIcon", "iconSize"], outputs: ["onSelect"] }, { kind: "ngmodule", type: DateTimePickerModule }, { kind: "component", type: i1.DateTimePickerComponent, selector: "c8y-date-time-picker", inputs: ["minDate", "maxDate", "placeholder", "dateInputFormat", "adaptivePosition", "size", "dateType", "config"], outputs: ["onDateSelected"] }, { kind: "ngmodule", type: C8yTranslateModule }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
1594
1628
  }
1595
1629
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: IconRenderTypeModalComponent, decorators: [{
1596
1630
  type: Component,
@@ -1610,18 +1644,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
1610
1644
  class OperationRenderTypeModalComponent {
1611
1645
  constructor() {
1612
1646
  this.showButtonLabelOnly = false;
1613
- this.labels = { ok: gettext('Save'), cancel: gettext('Cancel') };
1614
- this.operationList = [
1615
- { label: gettext('Restart device'), value: 'restart' },
1616
- { label: gettext('Firmware update'), value: 'firmwareUpdate' },
1617
- { label: gettext('Send command'), value: 'sendCommand' }
1647
+ this.deviceTypes = [];
1648
+ this.templates = [];
1649
+ this.predefinedOperations = [
1650
+ {
1651
+ name: gettext('Restart device'),
1652
+ command: { description: gettext('Restart device'), c8y_Restart: {} }
1653
+ },
1654
+ {
1655
+ name: gettext('Change relay status to OPEN'),
1656
+ command: {
1657
+ description: gettext('Change relay status to OPEN.'),
1658
+ c8y_Relay: { relayState: 'OPEN' }
1659
+ }
1660
+ },
1661
+ {
1662
+ name: gettext('Change relay status to CLOSED'),
1663
+ command: {
1664
+ description: gettext('Change relay status to CLOSED.'),
1665
+ c8y_Relay: { relayState: 'CLOSED' }
1666
+ }
1667
+ }
1618
1668
  ];
1669
+ this.labels = { ok: gettext('Save'), cancel: gettext('Cancel') };
1619
1670
  this.result = new Promise((resolve, reject) => {
1620
1671
  this._save = resolve;
1621
1672
  this._cancel = reject;
1622
1673
  });
1623
1674
  this.fb = inject(FormBuilder);
1624
1675
  this.translate = inject(TranslateService);
1676
+ this.deviceShellService = inject(DeviceShellService);
1677
+ this.destroyRef = inject(DestroyRef);
1625
1678
  }
1626
1679
  get modalTitle() {
1627
1680
  if (this.showButtonLabelOnly) {
@@ -1632,13 +1685,8 @@ class OperationRenderTypeModalComponent {
1632
1685
  ? this.translate.instant(gettext('Edit operation'))
1633
1686
  : this.translate.instant(gettext('Create operation'));
1634
1687
  }
1635
- ngOnInit() {
1636
- const defaultCommand = JSON.stringify({
1637
- description: 'Command description',
1638
- c8y_Command: {
1639
- text: '<command>'
1640
- }
1641
- }, null, 2);
1688
+ async ngOnInit() {
1689
+ const defaultCommand = JSON.stringify({ description: 'Command description', c8y_Command: { text: '<command>' } }, null, 2);
1642
1690
  this.form = this.fb.group({
1643
1691
  buttonLabel: new FormControl(this.initialConfig?.buttonLabel ?? '', {
1644
1692
  validators: [Validators.required]
@@ -1648,6 +1696,29 @@ class OperationRenderTypeModalComponent {
1648
1696
  validators: [Validators.required]
1649
1697
  })
1650
1698
  });
1699
+ if (this.deviceTypes?.length) {
1700
+ const loadedTemplates = await this.deviceShellService.getCommandTemplatesForDeviceType(this.deviceTypes);
1701
+ this.templates = loadedTemplates.map(t => ({
1702
+ name: t.name,
1703
+ text: t.text,
1704
+ category: t.category
1705
+ }));
1706
+ }
1707
+ this.form
1708
+ .get('operation')
1709
+ ?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef))
1710
+ .subscribe(selectedName => {
1711
+ const predefined = this.predefinedOperations.find(p => p.name === selectedName);
1712
+ if (predefined) {
1713
+ this.form.get('command')?.setValue(JSON.stringify(predefined.command, null, 2));
1714
+ return;
1715
+ }
1716
+ const template = this.templates.find(t => t.name === selectedName);
1717
+ if (template) {
1718
+ const cmd = JSON.stringify({ description: template.name, c8y_Command: { text: template.text } }, null, 2);
1719
+ this.form.get('command')?.setValue(cmd);
1720
+ }
1721
+ });
1651
1722
  }
1652
1723
  onClose(_) {
1653
1724
  if (this.form.valid) {
@@ -1658,7 +1729,7 @@ class OperationRenderTypeModalComponent {
1658
1729
  this._cancel();
1659
1730
  }
1660
1731
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OperationRenderTypeModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1661
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: OperationRenderTypeModalComponent, isStandalone: true, selector: "c8y-operation-render-type-modal", ngImport: i0, template: "<c8y-modal\n [title]=\"modalTitle\"\n (onClose)=\"onClose($event)\"\n (onDismiss)=\"onDismiss($event)\"\n [labels]=\"labels\"\n [disabled]=\"form?.invalid\"\n [headerClasses]=\"'dialog-header'\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'cog'\"></span>\n </ng-container>\n <form\n class=\"p-24\"\n [formGroup]=\"form\"\n >\n <c8y-form-group>\n <label\n for=\"buttonLabel\"\n translate\n >\n Button label\n </label>\n <input\n class=\"form-control\"\n id=\"buttonLabel\"\n placeholder=\"{{ 'e.g. Execute operation' | translate }}\"\n type=\"text\"\n formControlName=\"buttonLabel\"\n />\n <c8y-messages></c8y-messages>\n </c8y-form-group>\n\n @if (!showButtonLabelOnly) {\n <div class=\"form-group\">\n <label\n for=\"operation\"\n translate\n >\n Operation\n </label>\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n id=\"operation\"\n formControlName=\"operation\"\n >\n @for (op of operationList; track op) {\n <option [ngValue]=\"op.value\">\n {{ op.label | translate }}\n </option>\n }\n </select>\n </div>\n </div>\n <div class=\"form-group\">\n <label\n for=\"command\"\n translate\n >\n Command\n </label>\n <textarea\n class=\"form-control no-resize inner-scroll\"\n style=\"max-height: 300px\"\n id=\"command\"\n c8y-textarea-autoresize\n formControlName=\"command\"\n maxlength=\"900\"\n ></textarea>\n </div>\n }\n </form>\n</c8y-modal>\n", dependencies: [{ kind: "ngmodule", type: ModalModule }, { kind: "component", type: i1.ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: C8yTranslateModule }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i1.TextareaAutoresizeDirective, selector: "[c8y-textarea-autoresize]" }, { kind: "ngmodule", type: CoreModule }, { kind: "component", type: i1.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "component", type: i1.MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
1732
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: OperationRenderTypeModalComponent, isStandalone: true, selector: "c8y-operation-render-type-modal", providers: [DeviceShellService], ngImport: i0, template: "<c8y-modal\n [title]=\"modalTitle\"\n (onClose)=\"onClose($event)\"\n (onDismiss)=\"onDismiss($event)\"\n [labels]=\"labels\"\n [disabled]=\"form?.invalid\"\n [headerClasses]=\"'dialog-header'\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'cog'\"></span>\n </ng-container>\n <form\n class=\"p-24\"\n [formGroup]=\"form\"\n >\n <c8y-form-group>\n <label\n for=\"buttonLabel\"\n translate\n >\n Button label\n </label>\n <input\n class=\"form-control\"\n id=\"buttonLabel\"\n placeholder=\"{{ 'e.g. Execute operation' | translate }}\"\n type=\"text\"\n formControlName=\"buttonLabel\"\n />\n <c8y-messages></c8y-messages>\n </c8y-form-group>\n\n @if (!showButtonLabelOnly) {\n <div class=\"form-group\">\n <label\n for=\"operation\"\n translate\n >\n Operation\n </label>\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n id=\"operation\"\n formControlName=\"operation\"\n >\n <optgroup label=\"{{ 'Predefined' | translate }}\">\n @for (op of predefinedOperations; track op.name) {\n <option [ngValue]=\"op.name\">{{ op.name | translate }}</option>\n }\n </optgroup>\n @if (templates.length) {\n <optgroup label=\"{{ 'Device templates' | translate }}\">\n @for (op of templates; track op.name) {\n <option [ngValue]=\"op.name\">{{ op.name | translate }}</option>\n }\n </optgroup>\n }\n </select>\n </div>\n </div>\n <div class=\"form-group\">\n <label\n for=\"command\"\n translate\n >\n Command\n </label>\n <textarea\n class=\"form-control no-resize inner-scroll\"\n style=\"max-height: 300px\"\n id=\"command\"\n c8y-textarea-autoresize\n formControlName=\"command\"\n maxlength=\"900\"\n ></textarea>\n </div>\n }\n </form>\n</c8y-modal>\n", dependencies: [{ kind: "ngmodule", type: ModalModule }, { kind: "component", type: i1.ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: C8yTranslateModule }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i1.TextareaAutoresizeDirective, selector: "[c8y-textarea-autoresize]" }, { kind: "ngmodule", type: CoreModule }, { kind: "component", type: i1.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "component", type: i1.MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
1662
1733
  }
1663
1734
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OperationRenderTypeModalComponent, decorators: [{
1664
1735
  type: Component,
@@ -1669,13 +1740,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
1669
1740
  C8yTranslateModule,
1670
1741
  CommonModule,
1671
1742
  CoreModule
1672
- ], template: "<c8y-modal\n [title]=\"modalTitle\"\n (onClose)=\"onClose($event)\"\n (onDismiss)=\"onDismiss($event)\"\n [labels]=\"labels\"\n [disabled]=\"form?.invalid\"\n [headerClasses]=\"'dialog-header'\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'cog'\"></span>\n </ng-container>\n <form\n class=\"p-24\"\n [formGroup]=\"form\"\n >\n <c8y-form-group>\n <label\n for=\"buttonLabel\"\n translate\n >\n Button label\n </label>\n <input\n class=\"form-control\"\n id=\"buttonLabel\"\n placeholder=\"{{ 'e.g. Execute operation' | translate }}\"\n type=\"text\"\n formControlName=\"buttonLabel\"\n />\n <c8y-messages></c8y-messages>\n </c8y-form-group>\n\n @if (!showButtonLabelOnly) {\n <div class=\"form-group\">\n <label\n for=\"operation\"\n translate\n >\n Operation\n </label>\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n id=\"operation\"\n formControlName=\"operation\"\n >\n @for (op of operationList; track op) {\n <option [ngValue]=\"op.value\">\n {{ op.label | translate }}\n </option>\n }\n </select>\n </div>\n </div>\n <div class=\"form-group\">\n <label\n for=\"command\"\n translate\n >\n Command\n </label>\n <textarea\n class=\"form-control no-resize inner-scroll\"\n style=\"max-height: 300px\"\n id=\"command\"\n c8y-textarea-autoresize\n formControlName=\"command\"\n maxlength=\"900\"\n ></textarea>\n </div>\n }\n </form>\n</c8y-modal>\n" }]
1743
+ ], providers: [DeviceShellService], template: "<c8y-modal\n [title]=\"modalTitle\"\n (onClose)=\"onClose($event)\"\n (onDismiss)=\"onDismiss($event)\"\n [labels]=\"labels\"\n [disabled]=\"form?.invalid\"\n [headerClasses]=\"'dialog-header'\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'cog'\"></span>\n </ng-container>\n <form\n class=\"p-24\"\n [formGroup]=\"form\"\n >\n <c8y-form-group>\n <label\n for=\"buttonLabel\"\n translate\n >\n Button label\n </label>\n <input\n class=\"form-control\"\n id=\"buttonLabel\"\n placeholder=\"{{ 'e.g. Execute operation' | translate }}\"\n type=\"text\"\n formControlName=\"buttonLabel\"\n />\n <c8y-messages></c8y-messages>\n </c8y-form-group>\n\n @if (!showButtonLabelOnly) {\n <div class=\"form-group\">\n <label\n for=\"operation\"\n translate\n >\n Operation\n </label>\n <div class=\"c8y-select-wrapper\">\n <select\n class=\"form-control\"\n id=\"operation\"\n formControlName=\"operation\"\n >\n <optgroup label=\"{{ 'Predefined' | translate }}\">\n @for (op of predefinedOperations; track op.name) {\n <option [ngValue]=\"op.name\">{{ op.name | translate }}</option>\n }\n </optgroup>\n @if (templates.length) {\n <optgroup label=\"{{ 'Device templates' | translate }}\">\n @for (op of templates; track op.name) {\n <option [ngValue]=\"op.name\">{{ op.name | translate }}</option>\n }\n </optgroup>\n }\n </select>\n </div>\n </div>\n <div class=\"form-group\">\n <label\n for=\"command\"\n translate\n >\n Command\n </label>\n <textarea\n class=\"form-control no-resize inner-scroll\"\n style=\"max-height: 300px\"\n id=\"command\"\n c8y-textarea-autoresize\n formControlName=\"command\"\n maxlength=\"900\"\n ></textarea>\n </div>\n }\n </form>\n</c8y-modal>\n" }]
1673
1744
  }] });
1674
1745
 
1675
1746
  class AssetTableGridSettingsComponent {
1676
1747
  constructor() {
1677
1748
  this.columns = [];
1678
1749
  this.selectedProperties = [];
1750
+ this.extraProperties = [];
1679
1751
  this.operationColumns = [];
1680
1752
  this.text = '';
1681
1753
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1685,16 +1757,24 @@ class AssetTableGridSettingsComponent {
1685
1757
  this.customLabel = gettext('(custom`column`)');
1686
1758
  this.widgetConfigService = inject(WidgetConfigService);
1687
1759
  this.assetTableService = inject(AssetTableService);
1760
+ this.bottomDrawerService = inject(BottomDrawerService);
1761
+ this.inventoryService = inject(InventoryService);
1688
1762
  this.modalService = inject(BsModalService);
1689
1763
  this.destroy$ = new Subject();
1690
1764
  }
1691
1765
  ngOnInit() {
1692
- this.widgetConfigService.currentConfig$.pipe(takeUntil(this.destroy$)).subscribe(config => {
1766
+ this.widgetConfigService.currentConfig$
1767
+ .pipe(takeUntil(this.destroy$))
1768
+ .subscribe(async (config) => {
1693
1769
  this.selectedProperties = config?.selectedProperties || [];
1770
+ this.extraProperties = this.selectedProperties.filter(prop => prop?.computed);
1694
1771
  this.operationColumns = config?.operationColumns || [];
1695
1772
  this.existingColumnFilter = config?.filterPredicate || {};
1696
1773
  this.customHeaderNames = config?.customHeaderNames || {};
1697
1774
  this.columns = this.getColumns(config);
1775
+ if (config.device && Object.keys(config.device).length > 0) {
1776
+ this.contextAsset = (await this.inventoryService.detail(config.device)).data;
1777
+ }
1698
1778
  this.applyCustomHeaderNames();
1699
1779
  this.columns.forEach(column => {
1700
1780
  column.header = this.customHeaderNames[column.name] || column.header;
@@ -1716,7 +1796,7 @@ class AssetTableGridSettingsComponent {
1716
1796
  if (type === 'icon') {
1717
1797
  const currentIconConfig = this.selectedProperties.find(
1718
1798
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1719
- (prop) => prop.name === column.name)?.iconConfig;
1799
+ (prop) => (prop.instanceId || prop.name) === column.name)?.iconConfig;
1720
1800
  const modal = this.modalService.show(IconRenderTypeModalComponent, {
1721
1801
  class: 'modal-md',
1722
1802
  ariaDescribedby: 'modal-body',
@@ -1728,7 +1808,7 @@ class AssetTableGridSettingsComponent {
1728
1808
  }).content;
1729
1809
  try {
1730
1810
  const result = await modal.result;
1731
- this.selectedProperties = this.selectedProperties.map(prop => prop.name === column.name || prop.title === column.name
1811
+ this.selectedProperties = this.selectedProperties.map(prop => (prop.instanceId || prop.name) === column.name || prop.title === column.name
1732
1812
  ? { ...prop, iconConfig: result, columnType: 'icon' }
1733
1813
  : prop);
1734
1814
  }
@@ -1737,7 +1817,7 @@ class AssetTableGridSettingsComponent {
1737
1817
  }
1738
1818
  }
1739
1819
  else {
1740
- this.selectedProperties = this.selectedProperties.map(prop => prop.name === column.name ? { ...prop, columnType: type } : prop);
1820
+ this.selectedProperties = this.selectedProperties.map(prop => (prop.instanceId || prop.name) === column.name ? { ...prop, columnType: type } : prop);
1741
1821
  }
1742
1822
  this.widgetConfigService.updateConfig({ selectedProperties: [...this.selectedProperties] });
1743
1823
  }
@@ -1745,13 +1825,19 @@ class AssetTableGridSettingsComponent {
1745
1825
  moveItemInArray(this.columns, event.previousIndex, event.currentIndex);
1746
1826
  const newOrder = this.columns.map((column) => ({
1747
1827
  __origin: column.__origin,
1748
- __id: column.name
1828
+ __id: column.__id || column.name
1749
1829
  }));
1750
1830
  this.widgetConfigService.updateConfig({ columnOrder: newOrder });
1751
1831
  }
1752
1832
  toggleColumnVisibility(column) {
1753
- this.selectedProperties = this.selectedProperties.map(prop => prop.name === column.name ? { ...prop, visible: column.visible } : prop);
1754
- this.widgetConfigService.updateConfig({ selectedProperties: [...this.selectedProperties] });
1833
+ if (column.isOperation) {
1834
+ this.operationColumns = this.operationColumns.map(op => op.buttonLabel === column.name ? { ...op, visible: column.visible } : op);
1835
+ this.widgetConfigService.updateConfig({ operationColumns: [...this.operationColumns] });
1836
+ }
1837
+ else {
1838
+ this.selectedProperties = this.selectedProperties.map(prop => (prop.instanceId || prop.name) === column.name ? { ...prop, visible: column.visible } : prop);
1839
+ this.widgetConfigService.updateConfig({ selectedProperties: [...this.selectedProperties] });
1840
+ }
1755
1841
  }
1756
1842
  applyFilter(column, dropdown) {
1757
1843
  const formGroup = column.filteringConfig?.formGroup;
@@ -1798,7 +1884,7 @@ class AssetTableGridSettingsComponent {
1798
1884
  }
1799
1885
  column.sortOrder = nextOrder || null;
1800
1886
  this.selectedProperties = this.selectedProperties.map(prop => {
1801
- if (prop.name === column.name) {
1887
+ if ((prop.instanceId || prop.name) === column.name) {
1802
1888
  if (nextOrder) {
1803
1889
  prop.sortOrder = nextOrder;
1804
1890
  }
@@ -1820,7 +1906,7 @@ class AssetTableGridSettingsComponent {
1820
1906
  });
1821
1907
  }
1822
1908
  async onCreateOperation() {
1823
- const modal = this.operationModal(false);
1909
+ const modal = await this.operationModal(false);
1824
1910
  const result = (await modal.result);
1825
1911
  result.operationType = 'operation';
1826
1912
  result.header = gettext('Create operation');
@@ -1828,7 +1914,7 @@ class AssetTableGridSettingsComponent {
1828
1914
  this.widgetConfigService.updateConfig({ operationColumns: this.operationColumns });
1829
1915
  }
1830
1916
  async onToggleMaintenanceMode() {
1831
- const modal = this.operationModal(true);
1917
+ const modal = await this.operationModal(true);
1832
1918
  const result = (await modal.result);
1833
1919
  result.operationType = 'maintenance';
1834
1920
  result.header = gettext('Toggle maintenance mode');
@@ -1837,7 +1923,7 @@ class AssetTableGridSettingsComponent {
1837
1923
  }
1838
1924
  async editOperationColumn(column) {
1839
1925
  const currentOpConfig = this.operationColumns.find(op => op.buttonLabel === column.name);
1840
- const modal = this.operationModal(currentOpConfig.operationType === 'maintenance', currentOpConfig);
1926
+ const modal = await this.operationModal(currentOpConfig.operationType === 'maintenance', currentOpConfig);
1841
1927
  const result = await modal.result;
1842
1928
  this.operationColumns = this.operationColumns.map(op => op.buttonLabel === column.name ? result : op);
1843
1929
  this.widgetConfigService.updateConfig({ operationColumns: this.operationColumns });
@@ -1852,12 +1938,56 @@ class AssetTableGridSettingsComponent {
1852
1938
  trackByColumnName(_index, column) {
1853
1939
  return `${column.name}-${_index}`;
1854
1940
  }
1941
+ async selectAssetAndProperty() {
1942
+ const drawer = this.bottomDrawerService.openDrawer(AssetPropertySelectorDrawerComponent, {
1943
+ disableClickOutside: true,
1944
+ initialState: {
1945
+ allowChangingContext: true,
1946
+ hideSelection: false,
1947
+ contextAsset: this.contextAsset,
1948
+ config: {
1949
+ selectMode: 'plus',
1950
+ expansionMode: 'collapsedByDefault',
1951
+ showValue: true,
1952
+ showKey: true,
1953
+ selectedProperties: this.selectedProperties.map(({ columnLabel: _columnLabel, ...prop }) => prop),
1954
+ allowAddingCustomProperties: true
1955
+ }
1956
+ }
1957
+ });
1958
+ try {
1959
+ const properties = await drawer.instance.result;
1960
+ const uniqueProperties = properties.filter((prop, index, self) => index ===
1961
+ self.findIndex(p => p.name === prop.name && (!p.instanceId || p.instanceId === prop.instanceId)));
1962
+ this.selectProperties(uniqueProperties);
1963
+ }
1964
+ catch (ex) {
1965
+ // cancel clicked
1966
+ }
1967
+ }
1968
+ selectProperties(selectedProperties) {
1969
+ // if the selected properties name matches and the existing one has iconConfig, retain it
1970
+ const updatedProperties = selectedProperties.map(prop => {
1971
+ const existingProp = this.selectedProperties.find(p => p.name === prop.name);
1972
+ if (existingProp?.iconConfig || existingProp?.columnType || existingProp?.columnLabel) {
1973
+ return {
1974
+ ...prop,
1975
+ iconConfig: existingProp.iconConfig,
1976
+ columnType: existingProp.columnType,
1977
+ columnLabel: existingProp.columnLabel
1978
+ };
1979
+ }
1980
+ return prop;
1981
+ });
1982
+ this.widgetConfigService.updateConfig({ selectedProperties: updatedProperties });
1983
+ }
1855
1984
  applyCustomHeaderNames() {
1856
1985
  // Update selected properties and operation columns based on custom header names
1857
1986
  this.selectedProperties = this.selectedProperties.map(prop => {
1858
- const newLabel = this.customHeaderNames[prop.name];
1987
+ const nameKey = prop.instanceId || prop.name;
1988
+ const newLabel = this.customHeaderNames[nameKey];
1859
1989
  if (newLabel) {
1860
- prop.label = newLabel;
1990
+ prop.columnLabel = newLabel;
1861
1991
  }
1862
1992
  return prop;
1863
1993
  });
@@ -1869,7 +1999,11 @@ class AssetTableGridSettingsComponent {
1869
1999
  return opCol;
1870
2000
  });
1871
2001
  }
1872
- operationModal(showButtonLabelOnly, operationConfig) {
2002
+ async operationModal(showButtonLabelOnly, operationConfig) {
2003
+ // we have to filter unique device types from the child assets
2004
+ const deviceTypes = await this.inventoryService
2005
+ .childAssetsList(this.contextAsset.id)
2006
+ .then(assets => Array.from(new Set(assets.data.map(asset => asset.type).filter(Boolean))));
1873
2007
  return this.modalService.show(OperationRenderTypeModalComponent, {
1874
2008
  class: 'modal-sm',
1875
2009
  ariaDescribedby: 'modal-body',
@@ -1877,7 +2011,8 @@ class AssetTableGridSettingsComponent {
1877
2011
  ignoreBackdropClick: true,
1878
2012
  initialState: {
1879
2013
  initialConfig: operationConfig || {},
1880
- showButtonLabelOnly
2014
+ showButtonLabelOnly,
2015
+ deviceTypes: [this.contextAsset?.type, ...deviceTypes]
1881
2016
  }
1882
2017
  }).content;
1883
2018
  }
@@ -1885,7 +2020,7 @@ class AssetTableGridSettingsComponent {
1885
2020
  return this.assetTableService.getColumns(this.selectedProperties, this.operationColumns, config);
1886
2021
  }
1887
2022
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTableGridSettingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1888
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AssetTableGridSettingsComponent, isStandalone: true, selector: "c8y-asset-table-column-settings", host: { classAttribute: "bg-level-1" }, providers: [BsDropdownDirective], ngImport: i0, template: "<c8y-list-group\n class=\"inner-scroll bg-inherit d-block no-border-last separator-top\"\n style=\"max-height: 300px\"\n role=\"list\"\n cdkDropList\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n>\n @for (column of columns; track trackByColumnName($index, column)) {\n @if (!column.positionFixed) {\n <c8y-li\n role=\"listitem\"\n cdkDrag\n cdkDragLockAxis=\"y\"\n >\n <c8y-li-drag-handle\n title=\"{{ 'Drag to reorder' | translate }}\"\n [attr.aria-label]=\"'Drag to reorder' | translate\"\n cdkDragHandle\n >\n <i\n c8yIcon=\"drag-reorder\"\n style=\"font-size: 0.7em\"\n ></i>\n </c8y-li-drag-handle>\n @if (column.__origin !== 'status') {\n <c8y-li-checkbox\n class=\"a-s-stretch\"\n title=\"{{ (column.header | translate) || column.name }} {{\n column.custom ? (customLabel | translate) : ''\n }}\"\n [attr.aria-label]=\"'Show/hide column' | translate\"\n [(ngModel)]=\"column.visible\"\n (ngModelChange)=\"toggleColumnVisibility(column)\"\n c8yProductExperience\n [attr.data-cy]=\"'data-grid--custom-column-header-' + column.header\"\n ></c8y-li-checkbox>\n } @else {\n <c8y-li-checkbox class=\"a-s-stretch no-pointer invisible\"></c8y-li-checkbox>\n }\n <div class=\"content-flex-32 p-t-4 p-b-4\">\n <div class=\"col-6\">\n @if (column.__origin !== 'status') {\n <label class=\"editable\">\n <input\n class=\"form-control input-sm\"\n [attr.aria-label]=\"'Column header' | translate\"\n placeholder=\"{{ 'Column header' | translate }}\"\n type=\"text\"\n autocomplete=\"off\"\n required\n [(ngModel)]=\"column.header\"\n (keydown.enter)=\"updateColumnNames(column); $event.target.blur()\"\n (blur)=\"updateColumnNames(column)\"\n />\n </label>\n } @else {\n <p class=\"text-12 p-t-4 p-b-4\">{{ column.header | translate }}</p>\n }\n </div>\n <div class=\"col-6\">\n <div class=\"d-flex a-i-center gap-8 p-t-4 p-b-4\">\n <!-- Filters button -->\n @if (column.filteringConfig) {\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n [insideClick]=\"true\"\n c8yDropdownFocusTrap\n #gridHeaderDropdown=\"bs-dropdown\"\n >\n <button\n class=\"dropdown-toggle btn btn-icon btn-default btn-xs c8y-dropdown\"\n [attr.aria-label]=\"'Filter' | translate\"\n tooltip=\"{{ 'Filter' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"gridHeaderDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n [ngClass]=\"{ active: isColumnFiltered(column) }\"\n dropdownToggle\n >\n <i c8yIcon=\"filter\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n (click)=\"$event.stopPropagation()\"\n *dropdownMenu\n >\n <formly-form\n class=\"p-16 d-block\"\n style=\"min-width: 250px\"\n [form]=\"column.filteringConfig.formGroup\"\n [fields]=\"column.filteringConfig.fields\"\n [model]=\"column.filteringConfig.model\"\n ></formly-form>\n <div class=\"p-16 fit-w d-flex separator-top\">\n <button\n class=\"btn btn-default btn-sm m-r-8 grow\"\n title=\"{{ 'Reset' | translate }}\"\n (click)=\"resetFilter(column, gridHeaderDropdown)\"\n translate\n >\n Reset\n </button>\n <button\n class=\"btn btn-primary btn-sm grow\"\n title=\"{{ 'Apply' | translate }}\"\n (click)=\"applyFilter(column, gridHeaderDropdown)\"\n translate\n >\n Apply\n </button>\n </div>\n </div>\n </div>\n </div>\n }\n <!-- Sort button -->\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <button\n class=\"btn btn-icon btn-default btn-xs\"\n [attr.aria-label]=\"'Sort order' | translate\"\n tooltip=\"{{ 'Sort order' | translate }}\"\n placement=\"top\"\n type=\"button\"\n [delay]=\"500\"\n (click)=\"changeSortOrder(column)\"\n >\n @if (column.sortOrder === 'asc') {\n <i c8yIcon=\"long-arrow-up\"></i>\n } @else if (column.sortOrder === 'desc') {\n <i c8yIcon=\"long-arrow-down\"></i>\n } @else {\n <i\n c8yIcon=\"exchange\"\n style=\"transform: rotate(90deg)\"\n ></i>\n }\n </button>\n </div>\n <!-- Column type dropdown -->\n @if (!column.isOperation && column.__origin !== 'status') {\n <div\n class=\"d-flex a-i-center gap-4 flex-no-shrink\"\n [ngClass]=\"{ 'no-pointer invisible': column.__origin === 'status' }\"\n >\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n c8yDropdownFocusTrap\n #columnTypeDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-xs dropdown-toggle c8y-dropdown\"\n [attr.aria-label]=\"'Select render type' | translate\"\n tooltip=\"{{ 'Render type' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"columnTypeDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n dropdownToggle\n >\n {{ column.type | translate | humanize }}\n <i c8yIcon=\"caret-down\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <c8y-list-group role=\"list\">\n @if (column.type === 'computed' || column.computedConfig) {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (keydown.enter)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (click)=\"applyColumnType('computed', column)\"\n [active]=\"column.type === 'computed'\"\n >\n {{ 'Computed' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'icon'\"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n } @else {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('default', column)\"\n (keydown.enter)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'default'\"\n >\n {{ 'Default' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('date', column)\"\n (keydown.enter)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'date'\"\n >\n {{ 'Date' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n [active]=\"column.type === 'icon'\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n }\n </c8y-list-group>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n @if (column.isOperation) {\n <ng-container>\n @if (true) {\n <c8y-li-action\n icon=\"edit1\"\n [attr.aria-label]=\"'Edit' | translate\"\n label=\"Edit\"\n (click)=\"editOperationColumn(column)\"\n ></c8y-li-action>\n }\n @if (true) {\n <c8y-li-action\n icon=\"delete\"\n [attr.aria-label]=\"'Delete' | translate\"\n label=\"Delete\"\n (click)=\"deleteColumn(column)\"\n ></c8y-li-action>\n }\n </ng-container>\n }\n </c8y-li>\n }\n }\n @if (columns.length === 0) {\n <c8y-ui-empty-state\n [icon]=\"'list'\"\n [title]=\"'No properties selected.' | translate\"\n [subtitle]=\"'Select from the list which columns to display.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n }\n</c8y-list-group>\n<div class=\"m-b-16 p-t-16 p-l-24 p-r-16 fit-w separator-top\">\n <div\n class=\"dropdown\"\n container=\"body\"\n dropdown\n [insideClick]=\"true\"\n c8yDropdownFocusTrap\n #customActionsDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-sm dropdown-toggle c8y-dropdown\"\n [title]=\"'Add action' | translate\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"customActionsDropdown.isOpen\"\n type=\"button\"\n dropdownToggle\n >\n <i c8yIcon=\"cog\"></i>\n <span>{{ 'Add action' | translate }}</span>\n <span class=\"caret\"></span>\n </button>\n <ul\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onCreateOperation()\"\n >\n {{ 'Create operation' | translate }}\n </button>\n </li>\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onToggleMaintenanceMode()\"\n [disabled]=\"hasMaintenanceColumn\"\n >\n {{ 'Toggle maintenance mode' | translate }}\n </button>\n </li>\n </ul>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "ngmodule", type: BsDropdownModule }, { kind: "directive", type: i3$2.BsDropdownMenuDirective, selector: "[bsDropdownMenu],[dropdownMenu]", exportAs: ["bs-dropdown-menu"] }, { kind: "directive", type: i3$2.BsDropdownToggleDirective, selector: "[bsDropdownToggle],[dropdownToggle]", exportAs: ["bs-dropdown-toggle"] }, { kind: "directive", type: i3$2.BsDropdownDirective, selector: "[bsDropdown], [dropdown]", inputs: ["placement", "triggers", "container", "dropup", "autoClose", "isAnimated", "insideClick", "isDisabled", "isOpen"], outputs: ["isOpenChange", "onShown", "onHidden"], exportAs: ["bs-dropdown"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: DropdownFocusTrapDirective, selector: "[c8yDropdownFocusTrap]" }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "component", type: EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "ngmodule", type: ListGroupModule }, { kind: "component", type: i1.ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: i1.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: i1.ListItemActionComponent, selector: "c8y-list-item-action, c8y-li-action", inputs: ["label", "icon", "disabled"], outputs: ["click"] }, { kind: "component", type: i1.ListItemCheckboxComponent, selector: "c8y-list-item-checkbox, c8y-li-checkbox", inputs: ["selected", "indeterminate", "disabled", "displayAsSwitch"], outputs: ["onSelect"] }, { kind: "component", type: i1.ListItemDragHandleComponent, selector: "c8y-list-item-drag-handle, c8y-li-drag-handle" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: HumanizePipe, name: "humanize" }] }); }
2023
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AssetTableGridSettingsComponent, isStandalone: true, selector: "c8y-asset-table-column-settings", host: { classAttribute: "bg-level-1" }, providers: [BsDropdownDirective], ngImport: i0, template: "<fieldset class=\"c8y-fieldset bg-level-1 overflow-hidden p-0\">\n <legend class=\"m-l-16\">{{ 'Properties column settings (drag to reorder)' | translate }}</legend>\n <c8y-list-group\n class=\"inner-scroll bg-inherit d-block no-border-last separator-top\"\n style=\"max-height: 300px\"\n role=\"list\"\n cdkDropList\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n >\n @for (column of columns; track trackByColumnName($index, column)) {\n @if (!column.positionFixed) {\n <c8y-li\n role=\"listitem\"\n cdkDrag\n cdkDragLockAxis=\"y\"\n [ngClass]=\"{ 'empty-actions': !column.isOperation }\"\n >\n <c8y-li-drag-handle\n title=\"{{ 'Drag to reorder' | translate }}\"\n [attr.aria-label]=\"'Drag to reorder' | translate\"\n cdkDragHandle\n >\n <i\n c8yIcon=\"drag-reorder\"\n style=\"font-size: 0.7em\"\n ></i>\n </c8y-li-drag-handle>\n @if (column.__origin !== 'status') {\n <c8y-li-checkbox\n class=\"a-s-stretch\"\n title=\"{{ (column.header | translate) || column.name }} {{\n column.custom ? (customLabel | translate) : ''\n }}\"\n [attr.aria-label]=\"'Show/hide column' | translate\"\n [(ngModel)]=\"column.visible\"\n (ngModelChange)=\"toggleColumnVisibility(column)\"\n c8yProductExperience\n [attr.data-cy]=\"'data-grid--custom-column-header-' + column.header\"\n ></c8y-li-checkbox>\n } @else {\n <c8y-li-checkbox class=\"a-s-stretch no-pointer invisible\"></c8y-li-checkbox>\n }\n <div class=\"content-flex-32 p-t-4 p-b-4\">\n <div class=\"col-6\">\n @if (column.__origin !== 'status') {\n <label class=\"editable\">\n <input\n class=\"form-control input-sm\"\n [attr.aria-label]=\"'Column header' | translate\"\n placeholder=\"{{ 'Column header' | translate }}\"\n type=\"text\"\n autocomplete=\"off\"\n required\n [(ngModel)]=\"column.header\"\n (keydown.enter)=\"updateColumnNames(column); $event.target.blur()\"\n (blur)=\"updateColumnNames(column)\"\n />\n </label>\n } @else {\n <p class=\"text-12 p-t-4 p-b-4\">{{ column.header | translate }}</p>\n }\n </div>\n <div class=\"col-6\">\n <div class=\"d-flex a-i-center gap-8 p-t-4 p-b-4\">\n <!-- Filters button -->\n @if (column.filteringConfig) {\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n [insideClick]=\"true\"\n c8yDropdownFocusTrap\n #gridHeaderDropdown=\"bs-dropdown\"\n >\n <button\n class=\"dropdown-toggle btn btn-icon btn-default btn-xs c8y-dropdown\"\n [attr.aria-label]=\"'Filter' | translate\"\n tooltip=\"{{ 'Filter' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"gridHeaderDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n [ngClass]=\"{ active: isColumnFiltered(column) }\"\n dropdownToggle\n >\n <i c8yIcon=\"filter\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n (click)=\"$event.stopPropagation()\"\n *dropdownMenu\n >\n <formly-form\n class=\"p-16 d-block\"\n style=\"min-width: 250px\"\n [form]=\"column.filteringConfig.formGroup\"\n [fields]=\"column.filteringConfig.fields\"\n [model]=\"column.filteringConfig.model\"\n ></formly-form>\n <div class=\"p-16 fit-w d-flex separator-top\">\n <button\n class=\"btn btn-default btn-sm m-r-8 grow\"\n title=\"{{ 'Reset' | translate }}\"\n (click)=\"resetFilter(column, gridHeaderDropdown)\"\n translate\n >\n Reset\n </button>\n <button\n class=\"btn btn-primary btn-sm grow\"\n title=\"{{ 'Apply' | translate }}\"\n (click)=\"applyFilter(column, gridHeaderDropdown)\"\n translate\n >\n Apply\n </button>\n </div>\n </div>\n </div>\n </div>\n }\n <!-- Sort button -->\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <button\n class=\"btn btn-icon btn-default btn-xs\"\n [attr.aria-label]=\"'Sort order' | translate\"\n tooltip=\"{{ 'Sort order' | translate }}\"\n placement=\"top\"\n type=\"button\"\n [delay]=\"500\"\n (click)=\"changeSortOrder(column)\"\n >\n @if (column.sortOrder === 'asc') {\n <i c8yIcon=\"long-arrow-up\"></i>\n } @else if (column.sortOrder === 'desc') {\n <i c8yIcon=\"long-arrow-down\"></i>\n } @else {\n <i\n c8yIcon=\"exchange\"\n style=\"transform: rotate(90deg)\"\n ></i>\n }\n </button>\n </div>\n <!-- Column type dropdown -->\n @if (!column.isOperation && column.__origin !== 'status') {\n <div\n class=\"d-flex a-i-center gap-4 flex-no-shrink\"\n [ngClass]=\"{ 'no-pointer invisible': column.__origin === 'status' }\"\n >\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n c8yDropdownFocusTrap\n #columnTypeDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-xs dropdown-toggle c8y-dropdown\"\n [attr.aria-label]=\"'Select render type' | translate\"\n tooltip=\"{{ 'Render type' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"columnTypeDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n dropdownToggle\n >\n {{ column.type | translate | humanize }}\n <i c8yIcon=\"caret-down\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <c8y-list-group role=\"list\">\n @if (column.type === 'computed' || column.computedConfig) {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (keydown.enter)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (click)=\"applyColumnType('computed', column)\"\n [active]=\"column.type === 'computed'\"\n >\n {{ 'Computed' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'icon'\"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n } @else {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('default', column)\"\n (keydown.enter)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'default'\"\n >\n {{ 'Default' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('date', column)\"\n (keydown.enter)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'date'\"\n >\n {{ 'Date' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n [active]=\"column.type === 'icon'\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n }\n </c8y-list-group>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n @if (column.isOperation) {\n <ng-container>\n @if (true) {\n <c8y-li-action\n icon=\"edit1\"\n [attr.aria-label]=\"'Edit' | translate\"\n label=\"Edit\"\n (click)=\"editOperationColumn(column)\"\n ></c8y-li-action>\n }\n @if (true) {\n <c8y-li-action\n icon=\"delete\"\n [attr.aria-label]=\"'Delete' | translate\"\n label=\"Delete\"\n (click)=\"deleteColumn(column)\"\n ></c8y-li-action>\n }\n </ng-container>\n }\n </c8y-li>\n }\n }\n @if (columns.length === 0) {\n <c8y-ui-empty-state\n [icon]=\"'list'\"\n [title]=\"'No properties selected.' | translate\"\n [subtitle]=\"'Select from the list which columns to display.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n }\n </c8y-list-group>\n <div class=\"m-b-16 p-t-16 p-l-24 p-r-16 fit-w separator-top\">\n <button\n class=\"btn btn-default btn-sm m-r-8\"\n type=\"button\"\n (click)=\"selectAssetAndProperty()\"\n >\n {{ 'Select properties' | translate }}\n </button>\n <div\n class=\"dropdown\"\n container=\"body\"\n dropdown\n c8yDropdownFocusTrap\n #customActionsDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-sm dropdown-toggle c8y-dropdown\"\n [title]=\"'Add action' | translate\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"customActionsDropdown.isOpen\"\n type=\"button\"\n dropdownToggle\n >\n <i c8yIcon=\"cog\"></i>\n <span>{{ 'Add action' | translate }}</span>\n <span class=\"caret\"></span>\n </button>\n <ul\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onCreateOperation()\"\n >\n {{ 'Create operation' | translate }}\n </button>\n </li>\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onToggleMaintenanceMode()\"\n [disabled]=\"hasMaintenanceColumn\"\n >\n {{ 'Toggle maintenance mode' | translate }}\n </button>\n </li>\n </ul>\n </div>\n </div>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "ngmodule", type: BsDropdownModule }, { kind: "directive", type: i3$3.BsDropdownMenuDirective, selector: "[bsDropdownMenu],[dropdownMenu]", exportAs: ["bs-dropdown-menu"] }, { kind: "directive", type: i3$3.BsDropdownToggleDirective, selector: "[bsDropdownToggle],[dropdownToggle]", exportAs: ["bs-dropdown-toggle"] }, { kind: "directive", type: i3$3.BsDropdownDirective, selector: "[bsDropdown], [dropdown]", inputs: ["placement", "triggers", "container", "dropup", "autoClose", "isAnimated", "insideClick", "isDisabled", "isOpen"], outputs: ["isOpenChange", "onShown", "onHidden"], exportAs: ["bs-dropdown"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: DropdownFocusTrapDirective, selector: "[c8yDropdownFocusTrap]" }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "component", type: EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "ngmodule", type: ListGroupModule }, { kind: "component", type: i1.ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: i1.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: i1.ListItemActionComponent, selector: "c8y-list-item-action, c8y-li-action", inputs: ["label", "icon", "disabled"], outputs: ["click"] }, { kind: "component", type: i1.ListItemCheckboxComponent, selector: "c8y-list-item-checkbox, c8y-li-checkbox", inputs: ["selected", "indeterminate", "disabled", "displayAsSwitch"], outputs: ["onSelect"] }, { kind: "component", type: i1.ListItemDragHandleComponent, selector: "c8y-list-item-drag-handle, c8y-li-drag-handle" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: HumanizePipe, name: "humanize" }] }); }
1889
2024
  }
1890
2025
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTableGridSettingsComponent, decorators: [{
1891
2026
  type: Component,
@@ -1905,55 +2040,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
1905
2040
  EmptyStateComponent,
1906
2041
  ListGroupModule,
1907
2042
  NgClass
1908
- ], providers: [BsDropdownDirective], template: "<c8y-list-group\n class=\"inner-scroll bg-inherit d-block no-border-last separator-top\"\n style=\"max-height: 300px\"\n role=\"list\"\n cdkDropList\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n>\n @for (column of columns; track trackByColumnName($index, column)) {\n @if (!column.positionFixed) {\n <c8y-li\n role=\"listitem\"\n cdkDrag\n cdkDragLockAxis=\"y\"\n >\n <c8y-li-drag-handle\n title=\"{{ 'Drag to reorder' | translate }}\"\n [attr.aria-label]=\"'Drag to reorder' | translate\"\n cdkDragHandle\n >\n <i\n c8yIcon=\"drag-reorder\"\n style=\"font-size: 0.7em\"\n ></i>\n </c8y-li-drag-handle>\n @if (column.__origin !== 'status') {\n <c8y-li-checkbox\n class=\"a-s-stretch\"\n title=\"{{ (column.header | translate) || column.name }} {{\n column.custom ? (customLabel | translate) : ''\n }}\"\n [attr.aria-label]=\"'Show/hide column' | translate\"\n [(ngModel)]=\"column.visible\"\n (ngModelChange)=\"toggleColumnVisibility(column)\"\n c8yProductExperience\n [attr.data-cy]=\"'data-grid--custom-column-header-' + column.header\"\n ></c8y-li-checkbox>\n } @else {\n <c8y-li-checkbox class=\"a-s-stretch no-pointer invisible\"></c8y-li-checkbox>\n }\n <div class=\"content-flex-32 p-t-4 p-b-4\">\n <div class=\"col-6\">\n @if (column.__origin !== 'status') {\n <label class=\"editable\">\n <input\n class=\"form-control input-sm\"\n [attr.aria-label]=\"'Column header' | translate\"\n placeholder=\"{{ 'Column header' | translate }}\"\n type=\"text\"\n autocomplete=\"off\"\n required\n [(ngModel)]=\"column.header\"\n (keydown.enter)=\"updateColumnNames(column); $event.target.blur()\"\n (blur)=\"updateColumnNames(column)\"\n />\n </label>\n } @else {\n <p class=\"text-12 p-t-4 p-b-4\">{{ column.header | translate }}</p>\n }\n </div>\n <div class=\"col-6\">\n <div class=\"d-flex a-i-center gap-8 p-t-4 p-b-4\">\n <!-- Filters button -->\n @if (column.filteringConfig) {\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n [insideClick]=\"true\"\n c8yDropdownFocusTrap\n #gridHeaderDropdown=\"bs-dropdown\"\n >\n <button\n class=\"dropdown-toggle btn btn-icon btn-default btn-xs c8y-dropdown\"\n [attr.aria-label]=\"'Filter' | translate\"\n tooltip=\"{{ 'Filter' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"gridHeaderDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n [ngClass]=\"{ active: isColumnFiltered(column) }\"\n dropdownToggle\n >\n <i c8yIcon=\"filter\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n (click)=\"$event.stopPropagation()\"\n *dropdownMenu\n >\n <formly-form\n class=\"p-16 d-block\"\n style=\"min-width: 250px\"\n [form]=\"column.filteringConfig.formGroup\"\n [fields]=\"column.filteringConfig.fields\"\n [model]=\"column.filteringConfig.model\"\n ></formly-form>\n <div class=\"p-16 fit-w d-flex separator-top\">\n <button\n class=\"btn btn-default btn-sm m-r-8 grow\"\n title=\"{{ 'Reset' | translate }}\"\n (click)=\"resetFilter(column, gridHeaderDropdown)\"\n translate\n >\n Reset\n </button>\n <button\n class=\"btn btn-primary btn-sm grow\"\n title=\"{{ 'Apply' | translate }}\"\n (click)=\"applyFilter(column, gridHeaderDropdown)\"\n translate\n >\n Apply\n </button>\n </div>\n </div>\n </div>\n </div>\n }\n <!-- Sort button -->\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <button\n class=\"btn btn-icon btn-default btn-xs\"\n [attr.aria-label]=\"'Sort order' | translate\"\n tooltip=\"{{ 'Sort order' | translate }}\"\n placement=\"top\"\n type=\"button\"\n [delay]=\"500\"\n (click)=\"changeSortOrder(column)\"\n >\n @if (column.sortOrder === 'asc') {\n <i c8yIcon=\"long-arrow-up\"></i>\n } @else if (column.sortOrder === 'desc') {\n <i c8yIcon=\"long-arrow-down\"></i>\n } @else {\n <i\n c8yIcon=\"exchange\"\n style=\"transform: rotate(90deg)\"\n ></i>\n }\n </button>\n </div>\n <!-- Column type dropdown -->\n @if (!column.isOperation && column.__origin !== 'status') {\n <div\n class=\"d-flex a-i-center gap-4 flex-no-shrink\"\n [ngClass]=\"{ 'no-pointer invisible': column.__origin === 'status' }\"\n >\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n c8yDropdownFocusTrap\n #columnTypeDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-xs dropdown-toggle c8y-dropdown\"\n [attr.aria-label]=\"'Select render type' | translate\"\n tooltip=\"{{ 'Render type' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"columnTypeDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n dropdownToggle\n >\n {{ column.type | translate | humanize }}\n <i c8yIcon=\"caret-down\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <c8y-list-group role=\"list\">\n @if (column.type === 'computed' || column.computedConfig) {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (keydown.enter)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (click)=\"applyColumnType('computed', column)\"\n [active]=\"column.type === 'computed'\"\n >\n {{ 'Computed' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'icon'\"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n } @else {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('default', column)\"\n (keydown.enter)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'default'\"\n >\n {{ 'Default' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('date', column)\"\n (keydown.enter)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'date'\"\n >\n {{ 'Date' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n [active]=\"column.type === 'icon'\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n }\n </c8y-list-group>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n @if (column.isOperation) {\n <ng-container>\n @if (true) {\n <c8y-li-action\n icon=\"edit1\"\n [attr.aria-label]=\"'Edit' | translate\"\n label=\"Edit\"\n (click)=\"editOperationColumn(column)\"\n ></c8y-li-action>\n }\n @if (true) {\n <c8y-li-action\n icon=\"delete\"\n [attr.aria-label]=\"'Delete' | translate\"\n label=\"Delete\"\n (click)=\"deleteColumn(column)\"\n ></c8y-li-action>\n }\n </ng-container>\n }\n </c8y-li>\n }\n }\n @if (columns.length === 0) {\n <c8y-ui-empty-state\n [icon]=\"'list'\"\n [title]=\"'No properties selected.' | translate\"\n [subtitle]=\"'Select from the list which columns to display.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n }\n</c8y-list-group>\n<div class=\"m-b-16 p-t-16 p-l-24 p-r-16 fit-w separator-top\">\n <div\n class=\"dropdown\"\n container=\"body\"\n dropdown\n [insideClick]=\"true\"\n c8yDropdownFocusTrap\n #customActionsDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-sm dropdown-toggle c8y-dropdown\"\n [title]=\"'Add action' | translate\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"customActionsDropdown.isOpen\"\n type=\"button\"\n dropdownToggle\n >\n <i c8yIcon=\"cog\"></i>\n <span>{{ 'Add action' | translate }}</span>\n <span class=\"caret\"></span>\n </button>\n <ul\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onCreateOperation()\"\n >\n {{ 'Create operation' | translate }}\n </button>\n </li>\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onToggleMaintenanceMode()\"\n [disabled]=\"hasMaintenanceColumn\"\n >\n {{ 'Toggle maintenance mode' | translate }}\n </button>\n </li>\n </ul>\n </div>\n</div>\n" }]
1909
- }] });
1910
-
1911
- class AssetTablePropertiesSelectorComponent {
1912
- constructor() {
1913
- this.widgetConfigService = inject(WidgetConfigService);
1914
- this.selectedProperties = [];
1915
- this.extraProperties = [];
1916
- this.inventoryService = inject(InventoryService);
1917
- }
1918
- async ngOnInit() {
1919
- this.asset = (await this.inventoryService.detail(this.widgetConfigService.currentConfig.device?.id)).data;
1920
- this.selectedProperties = this.widgetConfigService.currentConfig?.selectedProperties || [];
1921
- this.extraProperties = this.selectedProperties.filter(prop => prop?.computed);
1922
- }
1923
- selectProperties(selectedProperties) {
1924
- // if the selected properties name matches and the existing one has iconConfig, retain it
1925
- const updatedProperties = selectedProperties.map(prop => {
1926
- const existingProp = this.selectedProperties.find(p => p.name === prop.name);
1927
- if (existingProp?.iconConfig || existingProp?.columnType) {
1928
- return {
1929
- ...prop,
1930
- iconConfig: existingProp.iconConfig,
1931
- columnType: existingProp.columnType
1932
- };
1933
- }
1934
- return prop;
1935
- });
1936
- this.widgetConfigService.updateConfig({ selectedProperties: updatedProperties });
1937
- }
1938
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTablePropertiesSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1939
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: AssetTablePropertiesSelectorComponent, isStandalone: true, selector: "c8y-asset-table-properties-selector", host: { classAttribute: "bg-level-1" }, ngImport: i0, template: "<fieldset class=\"c8y-fieldset bg-level-1 p-0 overflow-hidden m-t-0\">\n <legend class=\"m-l-16\">{{ 'Select properties' | translate }}</legend>\n <c8y-asset-property-list\n class=\"inner-scroll bg-inherit d-block\"\n style=\"max-height: 300px\"\n [asset]=\"asset\"\n [config]=\"{\n selectMode: 'multi',\n expansionMode: 'expandedByDefault',\n allowAddingCustomProperties: true,\n showValue: false,\n showKey: false,\n selectedProperties: selectedProperties\n }\"\n [extraProperties]=\"extraProperties\"\n (selectedProperties)=\"selectProperties($event)\"\n ></c8y-asset-property-list>\n</fieldset>\n<fieldset class=\"c8y-fieldset bg-level-1 overflow-hidden p-0\">\n <legend class=\"m-l-16\">{{ 'Properties column settings (drag to reorder)' | translate }}</legend>\n <c8y-asset-table-column-settings></c8y-asset-table-column-settings>\n</fieldset>\n", dependencies: [{ kind: "component", type: AssetPropertyListComponent, selector: "c8y-asset-property-list", inputs: ["config", "asset", "extraProperties"], outputs: ["selectedProperties"] }, { kind: "ngmodule", type: PopoverModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "component", type: AssetTableGridSettingsComponent, selector: "c8y-asset-table-column-settings" }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }] }); }
1940
- }
1941
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTablePropertiesSelectorComponent, decorators: [{
1942
- type: Component,
1943
- args: [{ selector: 'c8y-asset-table-properties-selector', host: {
1944
- class: 'bg-level-1'
1945
- }, standalone: true, imports: [
1946
- AssetPropertyListComponent,
1947
- PopoverModule,
1948
- TooltipModule,
1949
- AssetTableGridSettingsComponent,
1950
- C8yTranslatePipe
1951
- ], template: "<fieldset class=\"c8y-fieldset bg-level-1 p-0 overflow-hidden m-t-0\">\n <legend class=\"m-l-16\">{{ 'Select properties' | translate }}</legend>\n <c8y-asset-property-list\n class=\"inner-scroll bg-inherit d-block\"\n style=\"max-height: 300px\"\n [asset]=\"asset\"\n [config]=\"{\n selectMode: 'multi',\n expansionMode: 'expandedByDefault',\n allowAddingCustomProperties: true,\n showValue: false,\n showKey: false,\n selectedProperties: selectedProperties\n }\"\n [extraProperties]=\"extraProperties\"\n (selectedProperties)=\"selectProperties($event)\"\n ></c8y-asset-property-list>\n</fieldset>\n<fieldset class=\"c8y-fieldset bg-level-1 overflow-hidden p-0\">\n <legend class=\"m-l-16\">{{ 'Properties column settings (drag to reorder)' | translate }}</legend>\n <c8y-asset-table-column-settings></c8y-asset-table-column-settings>\n</fieldset>\n" }]
2043
+ ], providers: [BsDropdownDirective], template: "<fieldset class=\"c8y-fieldset bg-level-1 overflow-hidden p-0\">\n <legend class=\"m-l-16\">{{ 'Properties column settings (drag to reorder)' | translate }}</legend>\n <c8y-list-group\n class=\"inner-scroll bg-inherit d-block no-border-last separator-top\"\n style=\"max-height: 300px\"\n role=\"list\"\n cdkDropList\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n >\n @for (column of columns; track trackByColumnName($index, column)) {\n @if (!column.positionFixed) {\n <c8y-li\n role=\"listitem\"\n cdkDrag\n cdkDragLockAxis=\"y\"\n [ngClass]=\"{ 'empty-actions': !column.isOperation }\"\n >\n <c8y-li-drag-handle\n title=\"{{ 'Drag to reorder' | translate }}\"\n [attr.aria-label]=\"'Drag to reorder' | translate\"\n cdkDragHandle\n >\n <i\n c8yIcon=\"drag-reorder\"\n style=\"font-size: 0.7em\"\n ></i>\n </c8y-li-drag-handle>\n @if (column.__origin !== 'status') {\n <c8y-li-checkbox\n class=\"a-s-stretch\"\n title=\"{{ (column.header | translate) || column.name }} {{\n column.custom ? (customLabel | translate) : ''\n }}\"\n [attr.aria-label]=\"'Show/hide column' | translate\"\n [(ngModel)]=\"column.visible\"\n (ngModelChange)=\"toggleColumnVisibility(column)\"\n c8yProductExperience\n [attr.data-cy]=\"'data-grid--custom-column-header-' + column.header\"\n ></c8y-li-checkbox>\n } @else {\n <c8y-li-checkbox class=\"a-s-stretch no-pointer invisible\"></c8y-li-checkbox>\n }\n <div class=\"content-flex-32 p-t-4 p-b-4\">\n <div class=\"col-6\">\n @if (column.__origin !== 'status') {\n <label class=\"editable\">\n <input\n class=\"form-control input-sm\"\n [attr.aria-label]=\"'Column header' | translate\"\n placeholder=\"{{ 'Column header' | translate }}\"\n type=\"text\"\n autocomplete=\"off\"\n required\n [(ngModel)]=\"column.header\"\n (keydown.enter)=\"updateColumnNames(column); $event.target.blur()\"\n (blur)=\"updateColumnNames(column)\"\n />\n </label>\n } @else {\n <p class=\"text-12 p-t-4 p-b-4\">{{ column.header | translate }}</p>\n }\n </div>\n <div class=\"col-6\">\n <div class=\"d-flex a-i-center gap-8 p-t-4 p-b-4\">\n <!-- Filters button -->\n @if (column.filteringConfig) {\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n [insideClick]=\"true\"\n c8yDropdownFocusTrap\n #gridHeaderDropdown=\"bs-dropdown\"\n >\n <button\n class=\"dropdown-toggle btn btn-icon btn-default btn-xs c8y-dropdown\"\n [attr.aria-label]=\"'Filter' | translate\"\n tooltip=\"{{ 'Filter' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"gridHeaderDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n [ngClass]=\"{ active: isColumnFiltered(column) }\"\n dropdownToggle\n >\n <i c8yIcon=\"filter\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n (click)=\"$event.stopPropagation()\"\n *dropdownMenu\n >\n <formly-form\n class=\"p-16 d-block\"\n style=\"min-width: 250px\"\n [form]=\"column.filteringConfig.formGroup\"\n [fields]=\"column.filteringConfig.fields\"\n [model]=\"column.filteringConfig.model\"\n ></formly-form>\n <div class=\"p-16 fit-w d-flex separator-top\">\n <button\n class=\"btn btn-default btn-sm m-r-8 grow\"\n title=\"{{ 'Reset' | translate }}\"\n (click)=\"resetFilter(column, gridHeaderDropdown)\"\n translate\n >\n Reset\n </button>\n <button\n class=\"btn btn-primary btn-sm grow\"\n title=\"{{ 'Apply' | translate }}\"\n (click)=\"applyFilter(column, gridHeaderDropdown)\"\n translate\n >\n Apply\n </button>\n </div>\n </div>\n </div>\n </div>\n }\n <!-- Sort button -->\n <div class=\"d-flex a-i-center gap-4 flex-no-shrink\">\n <button\n class=\"btn btn-icon btn-default btn-xs\"\n [attr.aria-label]=\"'Sort order' | translate\"\n tooltip=\"{{ 'Sort order' | translate }}\"\n placement=\"top\"\n type=\"button\"\n [delay]=\"500\"\n (click)=\"changeSortOrder(column)\"\n >\n @if (column.sortOrder === 'asc') {\n <i c8yIcon=\"long-arrow-up\"></i>\n } @else if (column.sortOrder === 'desc') {\n <i c8yIcon=\"long-arrow-down\"></i>\n } @else {\n <i\n c8yIcon=\"exchange\"\n style=\"transform: rotate(90deg)\"\n ></i>\n }\n </button>\n </div>\n <!-- Column type dropdown -->\n @if (!column.isOperation && column.__origin !== 'status') {\n <div\n class=\"d-flex a-i-center gap-4 flex-no-shrink\"\n [ngClass]=\"{ 'no-pointer invisible': column.__origin === 'status' }\"\n >\n <div\n class=\"dropdown d-flex\"\n container=\"body\"\n dropdown\n c8yDropdownFocusTrap\n #columnTypeDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-xs dropdown-toggle c8y-dropdown\"\n [attr.aria-label]=\"'Select render type' | translate\"\n tooltip=\"{{ 'Render type' | translate }}\"\n placement=\"top\"\n container=\"body\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"columnTypeDropdown.isOpen\"\n type=\"button\"\n [delay]=\"500\"\n dropdownToggle\n >\n {{ column.type | translate | humanize }}\n <i c8yIcon=\"caret-down\"></i>\n </button>\n <div\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <c8y-list-group role=\"list\">\n @if (column.type === 'computed' || column.computedConfig) {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (keydown.enter)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('computed', column); $event.preventDefault()\n \"\n (click)=\"applyColumnType('computed', column)\"\n [active]=\"column.type === 'computed'\"\n >\n {{ 'Computed' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'icon'\"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n } @else {\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('default', column)\"\n (keydown.enter)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('default', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'default'\"\n >\n {{ 'Default' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('date', column)\"\n (keydown.enter)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('date', column); $event.preventDefault()\n \"\n [active]=\"column.type === 'date'\"\n >\n {{ 'Date' | translate }}\n </c8y-li>\n <c8y-li\n tabindex=\"0\"\n role=\"listitem\"\n (click)=\"applyColumnType('icon', column)\"\n [active]=\"column.type === 'icon'\"\n (keydown.enter)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n (keydown.space)=\"\n applyColumnType('icon', column); $event.preventDefault()\n \"\n >\n {{ 'Icon' | translate }}\n </c8y-li>\n }\n </c8y-list-group>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n @if (column.isOperation) {\n <ng-container>\n @if (true) {\n <c8y-li-action\n icon=\"edit1\"\n [attr.aria-label]=\"'Edit' | translate\"\n label=\"Edit\"\n (click)=\"editOperationColumn(column)\"\n ></c8y-li-action>\n }\n @if (true) {\n <c8y-li-action\n icon=\"delete\"\n [attr.aria-label]=\"'Delete' | translate\"\n label=\"Delete\"\n (click)=\"deleteColumn(column)\"\n ></c8y-li-action>\n }\n </ng-container>\n }\n </c8y-li>\n }\n }\n @if (columns.length === 0) {\n <c8y-ui-empty-state\n [icon]=\"'list'\"\n [title]=\"'No properties selected.' | translate\"\n [subtitle]=\"'Select from the list which columns to display.' | translate\"\n [horizontal]=\"true\"\n ></c8y-ui-empty-state>\n }\n </c8y-list-group>\n <div class=\"m-b-16 p-t-16 p-l-24 p-r-16 fit-w separator-top\">\n <button\n class=\"btn btn-default btn-sm m-r-8\"\n type=\"button\"\n (click)=\"selectAssetAndProperty()\"\n >\n {{ 'Select properties' | translate }}\n </button>\n <div\n class=\"dropdown\"\n container=\"body\"\n dropdown\n c8yDropdownFocusTrap\n #customActionsDropdown=\"bs-dropdown\"\n >\n <button\n class=\"btn btn-default btn-sm dropdown-toggle c8y-dropdown\"\n [title]=\"'Add action' | translate\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-expanded]=\"customActionsDropdown.isOpen\"\n type=\"button\"\n dropdownToggle\n >\n <i c8yIcon=\"cog\"></i>\n <span>{{ 'Add action' | translate }}</span>\n <span class=\"caret\"></span>\n </button>\n <ul\n class=\"dropdown-menu\"\n *dropdownMenu\n >\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onCreateOperation()\"\n >\n {{ 'Create operation' | translate }}\n </button>\n </li>\n <li>\n <button\n class=\"dropdown-item\"\n type=\"button\"\n (click)=\"onToggleMaintenanceMode()\"\n [disabled]=\"hasMaintenanceColumn\"\n >\n {{ 'Toggle maintenance mode' | translate }}\n </button>\n </li>\n </ul>\n </div>\n </div>\n</fieldset>\n" }]
1952
2044
  }] });
1953
2045
 
1954
2046
  /**
1955
2047
  * Generated bundle index. Do not edit.
1956
2048
  */
1957
2049
 
1958
- export { AssetTableGridSettingsComponent, AssetTablePropertiesSelectorComponent, AssetTableWidgetConfigComponent, AssetTableWidgetViewComponent };
2050
+ export { AssetTableGridSettingsComponent, AssetTableWidgetConfigComponent, AssetTableWidgetViewComponent };
1959
2051
  //# sourceMappingURL=c8y-ngx-components-widgets-implementations-asset-table.mjs.map