@highcharts/dashboards
Version:
Highcharts Dashboards framework
62 lines (61 loc) • 1.61 kB
JavaScript
/* *
*
* (c) 2009-2025 Highsoft AS
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* Authors:
* - Sebastian Bochan
* - Wojciech Chmiel
* - Gøran Slettemark
* - Sophie Bremer
*
* */
class EditableOptions {
constructor(component, bindings = EditableOptions.defaultBindings) {
this.component = component;
this.bindings = bindings;
}
getOptions() {
const options = this.component.options.editableOptions;
if (!options) {
return [];
}
for (let i = 0, iEnd = options.length; i < iEnd; i++) {
const option = options[i];
if (option.propertyPath?.some((path) => path === 'connector')) {
const board = this.component.board;
const selectOptions = !board ?
[] :
board.dataPool
.getConnectorIds()
.map((name) => ({ name }));
option.selectOptions = selectOptions;
}
}
return options;
}
}
EditableOptions.defaultBindings = {
keyMap: {
color: 'colorPicker',
title: 'text',
caption: 'text',
style: 'textarea'
},
typeMap: {
'string': 'text',
'number': 'input',
'boolean': 'toggle'
},
skipRedraw: []
};
// Bindings of basic types to "editor components"
EditableOptions.defaultTypeMap = {
'string': 'text',
'number': 'input',
'boolean': 'toggle'
};
export default EditableOptions;