-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloWorldItem.js
54 lines (52 loc) · 1.55 KB
/
HelloWorldItem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// #region imports
import { CustomItemViewer, ResourceManager } from 'devexpress-dashboard/common'
import { CustomItem } from 'devexpress-dashboard/model'
// #endregion
// #region svgIcon
var svgIcon = '<svg id="helloWorldItemIcon" viewBox="0 0 24 24"><path stroke="#42f48f" fill="#42f48f" d="M12 2 L2 22 L22 22 Z" /></svg>';
// #endregion
// #region metadata
var helloWorldItemMetaData = {
customProperties: [{
ownerType: CustomItem,
propertyName: 'customProperty',
valueType: 'string',
defaultValue: 'Hello World!'
}],
optionsPanelSections: [{
title: 'Custom Properties',
items: [{
dataField: 'customProperty',
label: {
text: 'Item Text'
},
editorType: 'dxTextBox',
editorOptions: {
placeholder: "Enter text to display"
}
}]
}],
icon: 'helloWorldItemIcon',
title: 'Hello World Item'
};
// #endregion
// #region viewer
class HelloWorldItemViewer extends CustomItemViewer {
renderContent(element, changeExisting) {
element.innerText = this.getPropertyValue('customProperty');
};
}
// #endregion
// #region createItem
class HelloWorldItem {
constructor(dashboardControl) {
ResourceManager.registerIcon(svgIcon);
this.name = "helloWorldItem";
this.metaData = helloWorldItemMetaData;
}
createViewerItem(model, $element, content) {
return new HelloWorldItemViewer(model, $element, content);
}
}
export default HelloWorldItem;
// #endregion