Custom display types
Front-end
Display type specification
sample-display-type.specification.ts
sample-display-type.specification.tsimport {DisplayTypeSpecification} from '@valtimo/dashboard';
import {SampleConfigurationComponent} from './components/sample-configuration/sample-configuration.component';
import {SampleDisplayComponent} from './components/sample-display/sample-display.component';
const sampleDisplayTypeSpecification: DisplayTypeSpecification = {
// The display type key. This needs to be the same as the id received from the back-end.
displayTypeKey: 'sample-display-type',
// A component of the interface DisplayTypeConfigurationComponent, used to configure the display type
configurationComponent: SampleConfigurationComponent,
// A component of the interface DisplayComponent, used to configure the display type
displayComponent: SampleDisplayComponent,
// the width in squares the display type component will take up on the dashboard
width: 1,
// the height in squares the display type component will take up on the dashboard
height: 1,
/*
each data source specifies what kind of data features it provides. Here you define what data features your
display type requires, so that your display type can only be selected when a compatible data source is selected.
*/
requiredDataFeatures: ['number'],
/*
For each language key an implementation supports, translation keys with a translation are provided below.
These can then be used in configuration components using the widgetTranslate pipe or the WidgetTranslationService.
At a minumum, the key 'title' needs to be defined.
*/
translations: {
nl: {
title: 'Weergave',
...
},
en: {
title: 'Display',
...
},
de: {
title: 'Anzeige',
...
},
},
};
export {sampleDisplayTypeSpecification};Display type configuration component
configuration.model.ts
configuration.model.tsTyping display type configuration data
sample.model.ts
sample.model.tsImplementing the display type configuration component
sample-display-type-configuration.component.ts
sample-display-type-configuration.component.tssample-display-type-configuration.component.html
sample-display-type-configuration.component.htmlImplementing the display component
sample-display.component.ts
sample-display.component.tssample-display.component.html
sample-display.component.htmlTranslation
Display type module
sample-display-type.module.ts
sample-display-type.module.tsLast updated