Merge pull request from ChantsovaEkaterina/widget-type-info-bundles
Widget bundles info added to widget types list
This commit is contained in:
		
						commit
						9a6a9057ba
					
				@ -192,7 +192,8 @@
 | 
			
		||||
                       (click)="$event.stopPropagation();"></a>
 | 
			
		||||
                  </ng-template>
 | 
			
		||||
                  <ng-template [ngSwitchCase]="'entityChips'">
 | 
			
		||||
                    <tb-entity-chips [entity]="entity" [key]="column.key"></tb-entity-chips>
 | 
			
		||||
                    <tb-entity-chips [entity]="entity" [key]="column.key"
 | 
			
		||||
                                     [detailsPagePrefixUrl]="column.entityURL ? column.entityURL(entity) : ''"></tb-entity-chips>
 | 
			
		||||
                  </ng-template>
 | 
			
		||||
                  <ng-template #defaultContent ngSwitchDefault>
 | 
			
		||||
                    <span [innerHTML]="cellContent(entity, column, row)"></span>
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@ import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
 | 
			
		||||
import { BaseData } from '@shared/models/base-data';
 | 
			
		||||
import { EntityId } from '@shared/models/id/entity-id';
 | 
			
		||||
import { baseDetailsPageByEntityType, EntityType } from '@app/shared/public-api';
 | 
			
		||||
import { isEqual, isObject } from '@core/utils';
 | 
			
		||||
import { isEqual, isNotEmptyStr, isObject } from '@core/utils';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'tb-entity-chips',
 | 
			
		||||
@ -33,6 +33,9 @@ export class EntityChipsComponent implements OnChanges {
 | 
			
		||||
  @Input()
 | 
			
		||||
  key: string;
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  detailsPagePrefixUrl: string;
 | 
			
		||||
 | 
			
		||||
  entityDetailsPrefixUrl: string;
 | 
			
		||||
 | 
			
		||||
  subEntities: Array<BaseData<EntityId>> = [];
 | 
			
		||||
@ -52,7 +55,9 @@ export class EntityChipsComponent implements OnChanges {
 | 
			
		||||
      if (isObject(entitiesList) && !Array.isArray(entitiesList)) {
 | 
			
		||||
        entitiesList = [entitiesList];
 | 
			
		||||
      }
 | 
			
		||||
      if (Array.isArray(entitiesList)) {
 | 
			
		||||
      if (isNotEmptyStr(this.detailsPagePrefixUrl)) {
 | 
			
		||||
        this.entityDetailsPrefixUrl = this.detailsPagePrefixUrl;
 | 
			
		||||
      } else if (Array.isArray(entitiesList)) {
 | 
			
		||||
        if (entitiesList.length) {
 | 
			
		||||
          this.entityDetailsPrefixUrl = baseDetailsPageByEntityType.get(entitiesList[0].id.entityType as EntityType);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -144,7 +144,8 @@ export class DateEntityTableColumn<T extends BaseData<HasId>> extends EntityTabl
 | 
			
		||||
export class EntityChipsEntityTableColumn<T extends BaseData<HasId>> extends BaseEntityTableColumn<T> {
 | 
			
		||||
  constructor(public key: string,
 | 
			
		||||
              public title: string,
 | 
			
		||||
              public width: string = '0px') {
 | 
			
		||||
              public width: string = '0px',
 | 
			
		||||
              public entityURL?: (entity) => string) {
 | 
			
		||||
    super('entityChips', key, title, width, false);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ import { Router } from '@angular/router';
 | 
			
		||||
import {
 | 
			
		||||
  checkBoxCell,
 | 
			
		||||
  DateEntityTableColumn,
 | 
			
		||||
  EntityChipsEntityTableColumn,
 | 
			
		||||
  EntityTableColumn,
 | 
			
		||||
  EntityTableConfig
 | 
			
		||||
} from '@home/models/entity/entities-table-config.models';
 | 
			
		||||
@ -75,7 +76,9 @@ export class WidgetTypesTableConfigResolver  {
 | 
			
		||||
 | 
			
		||||
    this.config.columns.push(
 | 
			
		||||
      new DateEntityTableColumn<WidgetTypeInfo>('createdTime', 'common.created-time', this.datePipe, '150px'),
 | 
			
		||||
      new EntityTableColumn<WidgetTypeInfo>('name', 'widget.title', '100%'),
 | 
			
		||||
      new EntityTableColumn<WidgetTypeInfo>('name', 'widget.title', '60%'),
 | 
			
		||||
      new EntityChipsEntityTableColumn<WidgetTypeInfo>( 'bundles', 'entity.type-widgets-bundles', '40%',
 | 
			
		||||
          () => '/resources/widgets-library/widgets-bundles'),
 | 
			
		||||
      new EntityTableColumn<WidgetTypeInfo>('widgetType', 'widget.type', '150px', entity =>
 | 
			
		||||
        entity?.widgetType ? this.translate.instant(widgetTypesData.get(entity.widgetType).name) : '', undefined, false),
 | 
			
		||||
      new EntityTableColumn<WidgetTypeInfo>('tenantId', 'widget.system', '60px',
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ import { isNotEmptyStr, mergeDeepIgnoreArray } from '@core/utils';
 | 
			
		||||
import { WidgetConfigComponentData } from '@home/models/widget-component.models';
 | 
			
		||||
import { ComponentStyle, Font, TimewindowStyle } from '@shared/models/widget-settings.models';
 | 
			
		||||
import { NULL_UUID } from '@shared/models/id/has-uuid';
 | 
			
		||||
import { HasTenantId, HasVersion } from '@shared/models/entity.models';
 | 
			
		||||
import { EntityInfoData, HasTenantId, HasVersion } from '@shared/models/entity.models';
 | 
			
		||||
import { DataKeysCallbacks, DataKeySettingsFunction } from '@home/components/widget/config/data-keys.component.models';
 | 
			
		||||
import { WidgetConfigCallbacks } from '@home/components/widget/config/widget-config.component.models';
 | 
			
		||||
import { TbFunction } from '@shared/models/js-function.models';
 | 
			
		||||
@ -270,6 +270,7 @@ export interface WidgetTypeInfo extends BaseWidgetType {
 | 
			
		||||
  description: string;
 | 
			
		||||
  tags: string[];
 | 
			
		||||
  widgetType: widgetType;
 | 
			
		||||
  bundles?: EntityInfoData[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface WidgetTypeDetails extends WidgetType, ExportableEntity<WidgetTypeId> {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user