@hpcc-js/common 2.73.3 → 2.73.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.es6.js +2 -2
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.min.js.map +1 -1
  9. package/package.json +3 -3
  10. package/src/CanvasWidget.ts +31 -31
  11. package/src/Class.ts +67 -67
  12. package/src/Database.ts +856 -856
  13. package/src/Entity.ts +235 -235
  14. package/src/EntityCard.ts +66 -66
  15. package/src/EntityPin.ts +103 -103
  16. package/src/EntityRect.css +15 -15
  17. package/src/EntityRect.ts +236 -236
  18. package/src/EntityVertex.ts +86 -86
  19. package/src/FAChar.css +2 -2
  20. package/src/FAChar.ts +82 -82
  21. package/src/HTMLWidget.ts +191 -191
  22. package/src/IList.ts +4 -4
  23. package/src/IMenu.ts +5 -5
  24. package/src/Icon.css +9 -9
  25. package/src/Icon.ts +164 -164
  26. package/src/Image.ts +95 -95
  27. package/src/List.css +13 -13
  28. package/src/List.ts +99 -99
  29. package/src/Menu.css +23 -23
  30. package/src/Menu.ts +134 -134
  31. package/src/Palette.ts +341 -341
  32. package/src/Platform.ts +125 -125
  33. package/src/ProgressBar.ts +105 -105
  34. package/src/PropertyExt.ts +793 -793
  35. package/src/ResizeSurface.css +39 -39
  36. package/src/ResizeSurface.ts +221 -221
  37. package/src/SVGWidget.ts +567 -567
  38. package/src/SVGZoomWidget.css +12 -12
  39. package/src/SVGZoomWidget.ts +426 -426
  40. package/src/Shape.css +3 -3
  41. package/src/Shape.ts +186 -186
  42. package/src/Surface.css +35 -35
  43. package/src/Surface.ts +349 -349
  44. package/src/Text.css +4 -4
  45. package/src/Text.ts +131 -131
  46. package/src/TextBox.css +4 -4
  47. package/src/TextBox.ts +168 -168
  48. package/src/TitleBar.css +99 -99
  49. package/src/TitleBar.ts +401 -401
  50. package/src/Transition.ts +45 -45
  51. package/src/Utility.ts +839 -839
  52. package/src/Widget.css +8 -8
  53. package/src/Widget.ts +730 -730
  54. package/src/WidgetArray.ts +13 -13
  55. package/src/__package__.ts +3 -3
  56. package/src/index.ts +55 -55
  57. package/types/__package__.d.ts +2 -2
  58. package/types/__package__.d.ts.map +1 -1
  59. package/types-3.4/__package__.d.ts +2 -2
package/src/EntityRect.ts CHANGED
@@ -1,236 +1,236 @@
1
- import { local as d3Local, select as d3Select } from "d3-selection";
2
- import { Entity } from "./Entity";
3
- import { HTMLWidget } from "./HTMLWidget";
4
- import { publish } from "./PropertyExt";
5
- import * as Utility from "./Utility";
6
- import { InputField } from "./Widget";
7
-
8
- import "../src/EntityRect.css";
9
-
10
- export class EntityRect extends Entity {
11
- protected _element_textbox;
12
- constructor() {
13
- super();
14
- }
15
- enter(domNode, element) {
16
- super.enter(domNode, element);
17
- }
18
- update(domNode, element) {
19
- this._desc_widget.text("");
20
- super.update(domNode, element);
21
- }
22
- render(callback?: (w: EntityRect) => void) {
23
- return super.render((w: EntityRect) => {
24
- const icon_bbox = w.icon() === "" ? { width: 0, height: 0 } : this._icon_widget.getBBox(true);
25
- const title_bbox = this._title_widget.getBBox(true);
26
- const annotations_bbox = this.getAnnotationsBBox();
27
-
28
- let width = this.fixedWidth();
29
- if (!width) {
30
- width = icon_bbox.width + title_bbox.width + annotations_bbox.width + this.padding() * 4;
31
- }
32
-
33
- let height = this.fixedHeight();
34
- if (!height) {
35
- height = Math.max(icon_bbox.height, title_bbox.height, annotations_bbox.height) + this.padding() * 2;
36
- }
37
-
38
- this._background_widget
39
- .width(width)
40
- .height(height)
41
- .render()
42
- ;
43
-
44
- this._icon_widget.move({
45
- x: -(width / 2) + (icon_bbox.width),
46
- y: 0
47
- });
48
-
49
- this.moveAnnotations(width / 2, -annotations_bbox.height / 2);
50
- const iconWidth = icon_bbox.width > 0 ? icon_bbox.width + this.padding() : 0;
51
- const titleX = -(width / 2) + iconWidth + this.padding();
52
- const annoWidth = this.padding() / 2 + annotations_bbox.width + this.padding();
53
- const titleW = width - iconWidth - annoWidth;
54
-
55
- this._title_widget
56
- .move({
57
- x: titleX,
58
- y: 0
59
- })
60
- .anchor("start")
61
- .width(titleW)
62
- .render()
63
- ;
64
-
65
- if (callback) {
66
- callback(w);
67
- }
68
- });
69
- }
70
- }
71
- EntityRect.prototype._class += " common_EntityRect";
72
-
73
- export interface EntityRect {
74
- fixedWidth(): number;
75
- fixedWidth(_: number): this;
76
- fixedHeight(): number;
77
- fixedHeight(_: number): this;
78
- }
79
-
80
- EntityRect.prototype.publish("fixedWidth", null, "number", "fixedWidth");
81
- EntityRect.prototype.publish("fixedHeight", null, "number", "fixedHeight");
82
-
83
- export class EntityRectList extends HTMLWidget {
84
- static __inputs: InputField[] = [{
85
- id: "borderColor",
86
- type: "string"
87
- }, {
88
- id: "icon",
89
- type: "string"
90
- }, {
91
- id: "iconColor",
92
- type: "string"
93
- }, {
94
- id: "title",
95
- type: "string"
96
- }];
97
-
98
- @publish(64, "number", "fixedHeight")
99
- fixedHeight: publish<this, number>;
100
- @publish("#f8f8f8", "string", "Default Background Color", null, { inputType: "html-color" })
101
- backgroundColor: publish<this, string>;
102
- @publish(null, "set", "Background Color Column", function () { return this.columns(); }, { optional: true })
103
- backgroundColorColumn: publish<this, string>;
104
- @publish("black", "string", "Default Border Color", null, { inputType: "html-color" })
105
- borderColor: publish<this, string>;
106
- @publish(null, "set", "Border Color Column", function () { return this.columns(); }, { optional: true })
107
- borderColorColumn: publish<this, string>;
108
- @publish("", "string", "Icon")
109
- icon: publish<this, string>;
110
- @publish(null, "set", "Icon Column", function () { return this.columns(); }, { optional: true })
111
- iconColumn: publish<this, string>;
112
- @publish("red", "string", "Default Icon Color", null, { inputType: "html-color" })
113
- iconColor: publish<this, string>;
114
- @publish(null, "set", "Icon Color Column ", function () { return this.columns(); }, { optional: true })
115
- iconColorColumn: publish<this, string>;
116
- @publish(null, "set", "Title Column", function () { return this.columns(); }, { optional: true })
117
- titleColumn: publish<this, string>;
118
- @publish("black", "string", "Default Title Color", null, { inputType: "html-color" })
119
- titleColor: publish<this, string>;
120
- @publish(null, "set", "Title Color Column ", function () { return this.columns(); }, { optional: true })
121
- titleColorColumn: publish<this, string>;
122
- @publish(null, "set", "Description Column", function () { return this.columns(); }, { optional: true })
123
- descriptionColumn: publish<this, string>;
124
- @publish("black", "string", "Default Description Color", null, { inputType: "html-color" })
125
- descriptionColor: publish<this, string>;
126
- @publish(null, "set", "Description Color Column ", function () { return this.columns(); }, { optional: true })
127
- descriptionColorColumn: publish<this, string>;
128
-
129
- private _enityRectLocal = d3Local<EntityRect>();
130
-
131
- constructor() {
132
- super();
133
- Utility.SimpleSelectionMixin.call(this, true);
134
- }
135
-
136
- entityRectData() {
137
- const columns = this.columns();
138
- const idxColumns = [
139
- "backgroundColor",
140
- "borderColor",
141
- "icon",
142
- "iconColor",
143
- "title",
144
- "titleColor",
145
- "description",
146
- "descriptionColor"
147
- ];
148
- const idxs = idxColumns.map(idxColumn => columns.indexOf(this[`${idxColumn}Column`]()));
149
- return this.data().map(row => {
150
- const retVal = {
151
- origRow: row
152
- };
153
- for (let i = 0; i < idxColumns.length; ++i) {
154
- retVal[idxColumns[i]] = idxs[i] >= 0 ? row[idxs[i]] : typeof this[`${idxColumns[i]}`] === "function" ? this[`${idxColumns[i]}`]() : "";
155
- }
156
- return retVal;
157
- }, this);
158
- }
159
-
160
- enter(domNode, element) {
161
- super.enter(domNode, element);
162
- d3Select(domNode.parentNode)
163
- .style("overflow-x", "hidden")
164
- .style("overflow-y", "scroll")
165
- ;
166
- this._selection.widgetElement(element);
167
- }
168
-
169
- update(domNode, element) {
170
- super.update(domNode, element);
171
- const context = this;
172
-
173
- const margin = { left: 8, top: 8, right: 8, bottom: 8 };
174
- const width = this.width() - margin.left - margin.right - 20; // -20 for VScroll (could do better)
175
- const height = this.fixedHeight() - margin.top - margin.bottom;
176
-
177
- const svg = element.selectAll("svg").data(this.entityRectData());
178
- svg.enter().append("svg")
179
- .attr("class", "entityRectItem")
180
- .call(this._selection.enter.bind(this._selection))
181
- .on("click", function (d) {
182
- context.click(context.rowToObj(d.origRow), context.titleColumn(), context._selection.selected(this));
183
- })
184
- .on("dblclick", function (d) {
185
- context.dblclick(context.rowToObj(d.origRow), context.titleColumn(), context._selection.selected(this));
186
- })
187
- .each(function () {
188
- const entityRect = new EntityRect()
189
- .target(this)
190
- ;
191
- context._enityRectLocal.set(this, entityRect);
192
- })
193
- .merge(svg)
194
- .style("border-color", d => d.borderColor)
195
- .each(function (d) {
196
- context._enityRectLocal.get(this)
197
- .pos({ x: width / 2, y: height / 2 })
198
- .resize({ width, height })
199
- .fixedWidth(width)
200
- .fixedHeight(height)
201
- .backgroundShape("rect")
202
- .backgroundColorFill(d.backgroundColor)
203
- .backgroundColorStroke("none")
204
- .icon(d.icon)
205
- .iconColor(d.iconColor)
206
- .iconDiameter(height / 2.6666)
207
- .iconPaddingPercent(0)
208
- .title(d.title)
209
- .titleFontSize(height / 2.6666)
210
- .titleColor(d.titleColor)
211
- .description(d.description)
212
- .descriptionColor(d.descriptionColor)
213
- .render()
214
- ;
215
- })
216
- ;
217
- svg.exit().remove();
218
- }
219
-
220
- exit(domNode, element) {
221
- super.exit(domNode, element);
222
- }
223
-
224
- // Events ---
225
- click(row, column, selected) {
226
- // console.log("Click: " + JSON.stringify(row) + ", " + column + "," + selected);
227
- }
228
-
229
- dblclick(row, column, selected) {
230
- // console.log("Double click: " + JSON.stringify(row) + ", " + column + "," + selected);
231
- }
232
-
233
- // SimpleSelectionMixin
234
- _selection;
235
- }
236
- EntityRectList.prototype._class += " common_EntityRectList";
1
+ import { local as d3Local, select as d3Select } from "d3-selection";
2
+ import { Entity } from "./Entity";
3
+ import { HTMLWidget } from "./HTMLWidget";
4
+ import { publish } from "./PropertyExt";
5
+ import * as Utility from "./Utility";
6
+ import { InputField } from "./Widget";
7
+
8
+ import "../src/EntityRect.css";
9
+
10
+ export class EntityRect extends Entity {
11
+ protected _element_textbox;
12
+ constructor() {
13
+ super();
14
+ }
15
+ enter(domNode, element) {
16
+ super.enter(domNode, element);
17
+ }
18
+ update(domNode, element) {
19
+ this._desc_widget.text("");
20
+ super.update(domNode, element);
21
+ }
22
+ render(callback?: (w: EntityRect) => void) {
23
+ return super.render((w: EntityRect) => {
24
+ const icon_bbox = w.icon() === "" ? { width: 0, height: 0 } : this._icon_widget.getBBox(true);
25
+ const title_bbox = this._title_widget.getBBox(true);
26
+ const annotations_bbox = this.getAnnotationsBBox();
27
+
28
+ let width = this.fixedWidth();
29
+ if (!width) {
30
+ width = icon_bbox.width + title_bbox.width + annotations_bbox.width + this.padding() * 4;
31
+ }
32
+
33
+ let height = this.fixedHeight();
34
+ if (!height) {
35
+ height = Math.max(icon_bbox.height, title_bbox.height, annotations_bbox.height) + this.padding() * 2;
36
+ }
37
+
38
+ this._background_widget
39
+ .width(width)
40
+ .height(height)
41
+ .render()
42
+ ;
43
+
44
+ this._icon_widget.move({
45
+ x: -(width / 2) + (icon_bbox.width),
46
+ y: 0
47
+ });
48
+
49
+ this.moveAnnotations(width / 2, -annotations_bbox.height / 2);
50
+ const iconWidth = icon_bbox.width > 0 ? icon_bbox.width + this.padding() : 0;
51
+ const titleX = -(width / 2) + iconWidth + this.padding();
52
+ const annoWidth = this.padding() / 2 + annotations_bbox.width + this.padding();
53
+ const titleW = width - iconWidth - annoWidth;
54
+
55
+ this._title_widget
56
+ .move({
57
+ x: titleX,
58
+ y: 0
59
+ })
60
+ .anchor("start")
61
+ .width(titleW)
62
+ .render()
63
+ ;
64
+
65
+ if (callback) {
66
+ callback(w);
67
+ }
68
+ });
69
+ }
70
+ }
71
+ EntityRect.prototype._class += " common_EntityRect";
72
+
73
+ export interface EntityRect {
74
+ fixedWidth(): number;
75
+ fixedWidth(_: number): this;
76
+ fixedHeight(): number;
77
+ fixedHeight(_: number): this;
78
+ }
79
+
80
+ EntityRect.prototype.publish("fixedWidth", null, "number", "fixedWidth");
81
+ EntityRect.prototype.publish("fixedHeight", null, "number", "fixedHeight");
82
+
83
+ export class EntityRectList extends HTMLWidget {
84
+ static __inputs: InputField[] = [{
85
+ id: "borderColor",
86
+ type: "string"
87
+ }, {
88
+ id: "icon",
89
+ type: "string"
90
+ }, {
91
+ id: "iconColor",
92
+ type: "string"
93
+ }, {
94
+ id: "title",
95
+ type: "string"
96
+ }];
97
+
98
+ @publish(64, "number", "fixedHeight")
99
+ fixedHeight: publish<this, number>;
100
+ @publish("#f8f8f8", "string", "Default Background Color", null, { inputType: "html-color" })
101
+ backgroundColor: publish<this, string>;
102
+ @publish(null, "set", "Background Color Column", function () { return this.columns(); }, { optional: true })
103
+ backgroundColorColumn: publish<this, string>;
104
+ @publish("black", "string", "Default Border Color", null, { inputType: "html-color" })
105
+ borderColor: publish<this, string>;
106
+ @publish(null, "set", "Border Color Column", function () { return this.columns(); }, { optional: true })
107
+ borderColorColumn: publish<this, string>;
108
+ @publish("", "string", "Icon")
109
+ icon: publish<this, string>;
110
+ @publish(null, "set", "Icon Column", function () { return this.columns(); }, { optional: true })
111
+ iconColumn: publish<this, string>;
112
+ @publish("red", "string", "Default Icon Color", null, { inputType: "html-color" })
113
+ iconColor: publish<this, string>;
114
+ @publish(null, "set", "Icon Color Column ", function () { return this.columns(); }, { optional: true })
115
+ iconColorColumn: publish<this, string>;
116
+ @publish(null, "set", "Title Column", function () { return this.columns(); }, { optional: true })
117
+ titleColumn: publish<this, string>;
118
+ @publish("black", "string", "Default Title Color", null, { inputType: "html-color" })
119
+ titleColor: publish<this, string>;
120
+ @publish(null, "set", "Title Color Column ", function () { return this.columns(); }, { optional: true })
121
+ titleColorColumn: publish<this, string>;
122
+ @publish(null, "set", "Description Column", function () { return this.columns(); }, { optional: true })
123
+ descriptionColumn: publish<this, string>;
124
+ @publish("black", "string", "Default Description Color", null, { inputType: "html-color" })
125
+ descriptionColor: publish<this, string>;
126
+ @publish(null, "set", "Description Color Column ", function () { return this.columns(); }, { optional: true })
127
+ descriptionColorColumn: publish<this, string>;
128
+
129
+ private _enityRectLocal = d3Local<EntityRect>();
130
+
131
+ constructor() {
132
+ super();
133
+ Utility.SimpleSelectionMixin.call(this, true);
134
+ }
135
+
136
+ entityRectData() {
137
+ const columns = this.columns();
138
+ const idxColumns = [
139
+ "backgroundColor",
140
+ "borderColor",
141
+ "icon",
142
+ "iconColor",
143
+ "title",
144
+ "titleColor",
145
+ "description",
146
+ "descriptionColor"
147
+ ];
148
+ const idxs = idxColumns.map(idxColumn => columns.indexOf(this[`${idxColumn}Column`]()));
149
+ return this.data().map(row => {
150
+ const retVal = {
151
+ origRow: row
152
+ };
153
+ for (let i = 0; i < idxColumns.length; ++i) {
154
+ retVal[idxColumns[i]] = idxs[i] >= 0 ? row[idxs[i]] : typeof this[`${idxColumns[i]}`] === "function" ? this[`${idxColumns[i]}`]() : "";
155
+ }
156
+ return retVal;
157
+ }, this);
158
+ }
159
+
160
+ enter(domNode, element) {
161
+ super.enter(domNode, element);
162
+ d3Select(domNode.parentNode)
163
+ .style("overflow-x", "hidden")
164
+ .style("overflow-y", "scroll")
165
+ ;
166
+ this._selection.widgetElement(element);
167
+ }
168
+
169
+ update(domNode, element) {
170
+ super.update(domNode, element);
171
+ const context = this;
172
+
173
+ const margin = { left: 8, top: 8, right: 8, bottom: 8 };
174
+ const width = this.width() - margin.left - margin.right - 20; // -20 for VScroll (could do better)
175
+ const height = this.fixedHeight() - margin.top - margin.bottom;
176
+
177
+ const svg = element.selectAll("svg").data(this.entityRectData());
178
+ svg.enter().append("svg")
179
+ .attr("class", "entityRectItem")
180
+ .call(this._selection.enter.bind(this._selection))
181
+ .on("click", function (d) {
182
+ context.click(context.rowToObj(d.origRow), context.titleColumn(), context._selection.selected(this));
183
+ })
184
+ .on("dblclick", function (d) {
185
+ context.dblclick(context.rowToObj(d.origRow), context.titleColumn(), context._selection.selected(this));
186
+ })
187
+ .each(function () {
188
+ const entityRect = new EntityRect()
189
+ .target(this)
190
+ ;
191
+ context._enityRectLocal.set(this, entityRect);
192
+ })
193
+ .merge(svg)
194
+ .style("border-color", d => d.borderColor)
195
+ .each(function (d) {
196
+ context._enityRectLocal.get(this)
197
+ .pos({ x: width / 2, y: height / 2 })
198
+ .resize({ width, height })
199
+ .fixedWidth(width)
200
+ .fixedHeight(height)
201
+ .backgroundShape("rect")
202
+ .backgroundColorFill(d.backgroundColor)
203
+ .backgroundColorStroke("none")
204
+ .icon(d.icon)
205
+ .iconColor(d.iconColor)
206
+ .iconDiameter(height / 2.6666)
207
+ .iconPaddingPercent(0)
208
+ .title(d.title)
209
+ .titleFontSize(height / 2.6666)
210
+ .titleColor(d.titleColor)
211
+ .description(d.description)
212
+ .descriptionColor(d.descriptionColor)
213
+ .render()
214
+ ;
215
+ })
216
+ ;
217
+ svg.exit().remove();
218
+ }
219
+
220
+ exit(domNode, element) {
221
+ super.exit(domNode, element);
222
+ }
223
+
224
+ // Events ---
225
+ click(row, column, selected) {
226
+ // console.log("Click: " + JSON.stringify(row) + ", " + column + "," + selected);
227
+ }
228
+
229
+ dblclick(row, column, selected) {
230
+ // console.log("Double click: " + JSON.stringify(row) + ", " + column + "," + selected);
231
+ }
232
+
233
+ // SimpleSelectionMixin
234
+ _selection;
235
+ }
236
+ EntityRectList.prototype._class += " common_EntityRectList";
@@ -1,86 +1,86 @@
1
- import { Entity } from "./Entity";
2
- import { TextBox } from "./TextBox";
3
-
4
- export class EntityVertex extends Entity {
5
- protected _textbox_widget: TextBox;
6
- protected _element_textbox;
7
- constructor() {
8
- super();
9
- this._textbox_widget = new TextBox();
10
- }
11
- enter(domNode, element) {
12
- this._element_textbox = element.append("g").attr("class", "entity_textbox");
13
- super.enter(domNode, element);
14
- this._textbox_widget.target(this._element_textbox.node());
15
- }
16
- update() {
17
- super.update.apply(this, arguments);
18
- this._textbox_widget
19
- .text(this._title_widget.text());
20
- this._icon_widget
21
- .shape_colorFill(this.iconColorFill())
22
- .shape_colorStroke(this.iconColorStroke());
23
- this._background_widget
24
- .colorFill("none")
25
- .colorStroke("none");
26
-
27
- this._icon_widget.render();
28
- this._textbox_widget.render();
29
- const icon_bbox = this._icon_widget.getBBox(true);
30
- const text_bbox = this._textbox_widget.getBBox(true);
31
- let _icon_x = 0;
32
- let _icon_y = -(text_bbox.height / 2) - (icon_bbox.height / 3);
33
- switch (this.iconAnchor()) {
34
- case "start":
35
- _icon_x = -(text_bbox.width / 2) + (icon_bbox.width / 3);
36
- break;
37
- case "end":
38
- _icon_x = (text_bbox.width / 2) - (icon_bbox.width / 3);
39
- break;
40
- case "left":
41
- _icon_x = -(text_bbox.width / 2) - (icon_bbox.width / 2);
42
- _icon_y = 0;
43
- break;
44
- }
45
- this._icon_widget.move({
46
- x: _icon_x,
47
- y: _icon_y
48
- });
49
- this.moveAnnotations(text_bbox.width / 2, text_bbox.height / 2);
50
- }
51
- exit(domNode, element) {
52
- this._textbox_widget.target(null);
53
- super.exit(domNode, element);
54
- }
55
- }
56
- EntityVertex.prototype._class += " common_EntityVertex";
57
-
58
- export interface EntityVertex {
59
- iconAnchor(): string;
60
- iconAnchor(_: string): this;
61
- iconColorFill(): string;
62
- iconColorFill(_: string): this;
63
- iconColorStroke(): string;
64
- iconColorStroke(_: string): this;
65
- shape_colorStroke(): string;
66
- shape_colorStroke(_: string): this;
67
- shape_colorFill(): string;
68
- shape_colorFill(_: string): this;
69
- text_colorFill(): string;
70
- text_colorFill(_: string): this;
71
-
72
- textboxColorStroke(): string;
73
- textboxColorStroke(_: string): this;
74
- textboxColorFill(): string;
75
- textboxColorFill(_: string): this;
76
- textboxFontColor(): string;
77
- textboxFontColor(_: string): this;
78
- }
79
-
80
- EntityVertex.prototype.publish("iconAnchor", "start", "set", "Horizontal anchor position of icon", ["", "start", "middle", "end", "left"]);
81
- EntityVertex.prototype.publish("iconColorFill", null, "html-color", "iconColorFill");
82
- EntityVertex.prototype.publish("iconColorStroke", null, "html-color", "iconColorStroke");
83
-
84
- EntityVertex.prototype.publishProxy("textboxColorStroke", "_textbox_widget", "shape_colorStroke");
85
- EntityVertex.prototype.publishProxy("textboxColorFill", "_textbox_widget", "shape_colorFill");
86
- EntityVertex.prototype.publishProxy("textboxFontColor", "_textbox_widget", "text_colorFill");
1
+ import { Entity } from "./Entity";
2
+ import { TextBox } from "./TextBox";
3
+
4
+ export class EntityVertex extends Entity {
5
+ protected _textbox_widget: TextBox;
6
+ protected _element_textbox;
7
+ constructor() {
8
+ super();
9
+ this._textbox_widget = new TextBox();
10
+ }
11
+ enter(domNode, element) {
12
+ this._element_textbox = element.append("g").attr("class", "entity_textbox");
13
+ super.enter(domNode, element);
14
+ this._textbox_widget.target(this._element_textbox.node());
15
+ }
16
+ update() {
17
+ super.update.apply(this, arguments);
18
+ this._textbox_widget
19
+ .text(this._title_widget.text());
20
+ this._icon_widget
21
+ .shape_colorFill(this.iconColorFill())
22
+ .shape_colorStroke(this.iconColorStroke());
23
+ this._background_widget
24
+ .colorFill("none")
25
+ .colorStroke("none");
26
+
27
+ this._icon_widget.render();
28
+ this._textbox_widget.render();
29
+ const icon_bbox = this._icon_widget.getBBox(true);
30
+ const text_bbox = this._textbox_widget.getBBox(true);
31
+ let _icon_x = 0;
32
+ let _icon_y = -(text_bbox.height / 2) - (icon_bbox.height / 3);
33
+ switch (this.iconAnchor()) {
34
+ case "start":
35
+ _icon_x = -(text_bbox.width / 2) + (icon_bbox.width / 3);
36
+ break;
37
+ case "end":
38
+ _icon_x = (text_bbox.width / 2) - (icon_bbox.width / 3);
39
+ break;
40
+ case "left":
41
+ _icon_x = -(text_bbox.width / 2) - (icon_bbox.width / 2);
42
+ _icon_y = 0;
43
+ break;
44
+ }
45
+ this._icon_widget.move({
46
+ x: _icon_x,
47
+ y: _icon_y
48
+ });
49
+ this.moveAnnotations(text_bbox.width / 2, text_bbox.height / 2);
50
+ }
51
+ exit(domNode, element) {
52
+ this._textbox_widget.target(null);
53
+ super.exit(domNode, element);
54
+ }
55
+ }
56
+ EntityVertex.prototype._class += " common_EntityVertex";
57
+
58
+ export interface EntityVertex {
59
+ iconAnchor(): string;
60
+ iconAnchor(_: string): this;
61
+ iconColorFill(): string;
62
+ iconColorFill(_: string): this;
63
+ iconColorStroke(): string;
64
+ iconColorStroke(_: string): this;
65
+ shape_colorStroke(): string;
66
+ shape_colorStroke(_: string): this;
67
+ shape_colorFill(): string;
68
+ shape_colorFill(_: string): this;
69
+ text_colorFill(): string;
70
+ text_colorFill(_: string): this;
71
+
72
+ textboxColorStroke(): string;
73
+ textboxColorStroke(_: string): this;
74
+ textboxColorFill(): string;
75
+ textboxColorFill(_: string): this;
76
+ textboxFontColor(): string;
77
+ textboxFontColor(_: string): this;
78
+ }
79
+
80
+ EntityVertex.prototype.publish("iconAnchor", "start", "set", "Horizontal anchor position of icon", ["", "start", "middle", "end", "left"]);
81
+ EntityVertex.prototype.publish("iconColorFill", null, "html-color", "iconColorFill");
82
+ EntityVertex.prototype.publish("iconColorStroke", null, "html-color", "iconColorStroke");
83
+
84
+ EntityVertex.prototype.publishProxy("textboxColorStroke", "_textbox_widget", "shape_colorStroke");
85
+ EntityVertex.prototype.publishProxy("textboxColorFill", "_textbox_widget", "shape_colorFill");
86
+ EntityVertex.prototype.publishProxy("textboxFontColor", "_textbox_widget", "text_colorFill");
package/src/FAChar.css CHANGED
@@ -1,3 +1,3 @@
1
- .common_FAChar .common_Text {
2
- font-size: 14px;
1
+ .common_FAChar .common_Text {
2
+ font-size: 14px;
3
3
  }