Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions www/ftui/components/chart/chart-data.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class FtuiChartData extends FtuiElement {
color: primaryColor,
borderColor: '',
borderWidth: 1.2,
borderDash: [],
pointRadius: 2,
title: '-',
log: '-',
Expand Down
17 changes: 17 additions & 0 deletions www/ftui/components/element.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ export class FtuiElement extends HTMLElement {
} else if (typeof properties[name] === 'number') {
this.defineNumberProperty(name, attr);
this.initAttribute(attr, defaultValue);
} else if (typeof properties[name] === 'object' && Array.isArray(properties[name])) {
this.defineArrayProperty(name, attr);
this.initAttribute(attr, defaultValue);
} else {
this.defineStringProperty(name, attr);
this.initAttribute(attr, defaultValue);
Expand Down Expand Up @@ -179,4 +182,18 @@ export class FtuiElement extends HTMLElement {
set(value) { this.setAttribute(attr, value); },
});
}

defineArrayProperty(name, attr) {
Object.defineProperty(this, name, {
get() {
var attrValue = this.getAttribute(attr);
if(attrValue.match(/^\[.*\]$/)) {
return JSON.parse(attrValue);
}
return [];
},
set(value) { this.setAttribute(attr, JSON.stringify(value)); },
});
}

}