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