/
Dermatology.ts
101 lines (86 loc) · 2.8 KB
/
Dermatology.ts
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { OnOff } from "@hpcc-js/form";
import { Border, Toolbar } from "@hpcc-js/layout";
import { PropertyEditor } from "@hpcc-js/other";
import "../src/Dermatology.css";
export class Dermatology extends Border {
_toolbar;
_propEditor;
_showProperties;
_propsButton;
_prevWidget;
constructor() {
super();
this._toolbar = new Toolbar()
.title("Dermatology")
;
this._propEditor = new PropertyEditor()
.show_settings(true)
;
}
showProperties(_?) {
if (!arguments.length) return this._showProperties;
this._showProperties = _;
this
.rightPercentage(0)
.rightSize(this._showProperties ? 360 : 0)
.setContent("right", this._showProperties ? this._propEditor : null)
;
const widget = this.widget();
if (widget && widget.designMode) {
widget.designMode(this._showProperties);
}
return this;
}
toggleProperties() {
return this.showProperties(!this.showProperties());
}
enter(domNode, element) {
super.enter(domNode, element);
this
.topPercentage(0)
.topSize(0)
.setContent("top", this._toolbar)
;
this.getCell("top").surfaceShadow(true);
const context = this;
this._propsButton = new OnOff()
.id(this.id() + "_props")
.value("Properties")
.on("click", function () {
context
.toggleProperties()
.render()
;
})
;
this._toolbar.widgets([this._propsButton]);
}
update(domNode, element) {
this
.topPercentage(0)
.topSize(this.showToolbar() ? 32 : 0)
;
super.update(domNode, element);
const widget = this.widget();
element.style("background-color", widget && widget.surfaceShadow ? null : "white");
}
render(callback) {
const widget = this.widget();
if (widget !== this._prevWidget) {
if (widget && widget.surfaceShadow) {
widget.surfaceBackgroundColor_default("white");
}
this.setContent("center", widget);
this._propEditor.widget(widget);
this._prevWidget = widget;
}
return super.render(callback);
}
showToolbar: { (): boolean; (_: boolean): Dermatology };
showToolbar_exists: () => boolean;
widget: { (): any; (_: any): Dermatology };
widget_exists: () => boolean;
}
Dermatology.prototype._class += " composite_Dermatology";
Dermatology.prototype.publish("showToolbar", true, "boolean", "Show Toolbar");
Dermatology.prototype.publish("widget", null, "widget", "Widget");