@hpcc-js/other 3.5.1 → 3.5.4

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.
package/src/MorphText.css CHANGED
@@ -1,11 +1,11 @@
1
- .other_MorphText .enter {
2
- fill: green;
3
- }
4
-
5
- .other_MorphText .update {
6
- fill: #333;
7
- }
8
-
9
- .other_MorphText .exit {
10
- fill: brown;
1
+ .other_MorphText .enter {
2
+ fill: green;
3
+ }
4
+
5
+ .other_MorphText .update {
6
+ fill: #333;
7
+ }
8
+
9
+ .other_MorphText .exit {
10
+ fill: brown;
11
11
  }
package/src/MorphText.ts CHANGED
@@ -1,109 +1,109 @@
1
- import { SVGWidget } from "@hpcc-js/common";
2
-
3
- import "../src/MorphText.css";
4
-
5
- export class MorphText extends SVGWidget {
6
- _fontWidth;
7
- _textElement;
8
-
9
- constructor() {
10
- super();
11
- }
12
-
13
- enter(domNode, element) {
14
- if (!this.fontSize()) {
15
- const style = window.getComputedStyle(domNode, null);
16
- this.fontSize(parseInt(style.fontSize));
17
- }
18
- this._fontWidth = this.fontSize() * 32 / 48;
19
- this._textElement = element.append("g")
20
- ;
21
- }
22
-
23
- dateTime() {
24
- const d = new Date();
25
- const seconds = d.getSeconds().toString().length === 1 ? "0" + d.getSeconds() : d.getSeconds();
26
- const minutes = d.getMinutes().toString().length === 1 ? "0" + d.getMinutes() : d.getMinutes();
27
- const hours = d.getHours().toString().length === 1 ? "0" + d.getHours() : d.getHours();
28
- const ampm = d.getHours() >= 12 ? "pm" : "am";
29
- const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
30
- const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
31
- return days[d.getDay()] + " " + months[d.getMonth()] + " " + d.getDate() + " " + d.getFullYear() + " " + hours + ":" + minutes + ":" + seconds + ampm;
32
- }
33
-
34
- update(domNode, element) {
35
- const context = this;
36
- const text = this._textElement.selectAll("text")
37
- .data(this.data(), function (d) { return d.id; })
38
- ;
39
- text
40
- .attr("class", "update")
41
- ;
42
- this.transition.apply(text)
43
- .attr("x", function (d, i) { return (-context.data().length / 2 + i) * context._fontWidth + context._fontWidth / 2; })
44
- ;
45
-
46
- const newText = text.enter().append("text")
47
- .attr("class", "enter")
48
- .attr("font-size", this.fontSize())
49
- .attr("dy", ".35em")
50
- .attr("y", (this.reverse() ? +1 : -1) * this._fontWidth * 2)
51
- .attr("x", function (d, i) { return (-context.data().length / 2 + i) * context._fontWidth + context._fontWidth / 2; })
52
- .style("fill-opacity", 1e-6)
53
- .style("text-anchor", this.anchor())
54
- .text(function (d) { return d.text; })
55
- ;
56
- this.transition.apply(newText)
57
- .attr("y", 0)
58
- .style("fill-opacity", 1)
59
- ;
60
-
61
- text.exit()
62
- .attr("class", "exit")
63
- ;
64
- this.transition.apply(text.exit())
65
- .attr("y", (this.reverse() ? -1 : +1) * this._fontWidth * 2)
66
- .style("fill-opacity", 1e-6)
67
- .remove()
68
- ;
69
- }
70
- }
71
- MorphText.prototype._class += " other_MorphText";
72
-
73
- export interface MorphText {
74
- anchor(): string;
75
- anchor(_: string): this;
76
- anchor_exists(): boolean;
77
- fontSize(): number;
78
- fontSize(_: number): this;
79
- fontSize_exists(): boolean;
80
- reverse(): boolean;
81
- reverse(_: boolean): this;
82
- reverse_exists(): boolean;
83
- text(): string;
84
- text(_: string): this;
85
- text_exists(): boolean;
86
- }
87
-
88
- MorphText.prototype.publish("anchor", "middle", "set", "Sets anchor point", ["middle"], { tags: ["Basic"] });
89
- MorphText.prototype.publish("fontSize", 14, "number", "Sets fontsize", null, { tags: ["Basic"] });
90
- MorphText.prototype.publish("reverse", false, "boolean", "Reverse Animation", null, { tags: ["Basic"] });
91
- MorphText.prototype.publish("text", "", "string", "Sets text/data of widget", null, { tags: ["Basic"] });
92
-
93
- const _origText = MorphText.prototype.text;
94
- MorphText.prototype.text = function (_?: string) {
95
- const retVal = _origText.apply(this, arguments);
96
- if (arguments.length) {
97
- const usedChars = {};
98
- const chars = _.split("");
99
- this.data(chars.map(function (d) {
100
- const id = "_" + d;
101
- if (usedChars[id] === undefined) {
102
- usedChars[id] = 0;
103
- }
104
- usedChars[id]++;
105
- return { text: d, id: d.charCodeAt(0) + (1024 * usedChars[id]) };
106
- }));
107
- }
108
- return retVal;
109
- };
1
+ import { SVGWidget } from "@hpcc-js/common";
2
+
3
+ import "../src/MorphText.css";
4
+
5
+ export class MorphText extends SVGWidget {
6
+ _fontWidth;
7
+ _textElement;
8
+
9
+ constructor() {
10
+ super();
11
+ }
12
+
13
+ enter(domNode, element) {
14
+ if (!this.fontSize()) {
15
+ const style = window.getComputedStyle(domNode, null);
16
+ this.fontSize(parseInt(style.fontSize));
17
+ }
18
+ this._fontWidth = this.fontSize() * 32 / 48;
19
+ this._textElement = element.append("g")
20
+ ;
21
+ }
22
+
23
+ dateTime() {
24
+ const d = new Date();
25
+ const seconds = d.getSeconds().toString().length === 1 ? "0" + d.getSeconds() : d.getSeconds();
26
+ const minutes = d.getMinutes().toString().length === 1 ? "0" + d.getMinutes() : d.getMinutes();
27
+ const hours = d.getHours().toString().length === 1 ? "0" + d.getHours() : d.getHours();
28
+ const ampm = d.getHours() >= 12 ? "pm" : "am";
29
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
30
+ const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
31
+ return days[d.getDay()] + " " + months[d.getMonth()] + " " + d.getDate() + " " + d.getFullYear() + " " + hours + ":" + minutes + ":" + seconds + ampm;
32
+ }
33
+
34
+ update(domNode, element) {
35
+ const context = this;
36
+ const text = this._textElement.selectAll("text")
37
+ .data(this.data(), function (d) { return d.id; })
38
+ ;
39
+ text
40
+ .attr("class", "update")
41
+ ;
42
+ this.transition.apply(text)
43
+ .attr("x", function (d, i) { return (-context.data().length / 2 + i) * context._fontWidth + context._fontWidth / 2; })
44
+ ;
45
+
46
+ const newText = text.enter().append("text")
47
+ .attr("class", "enter")
48
+ .attr("font-size", this.fontSize())
49
+ .attr("dy", ".35em")
50
+ .attr("y", (this.reverse() ? +1 : -1) * this._fontWidth * 2)
51
+ .attr("x", function (d, i) { return (-context.data().length / 2 + i) * context._fontWidth + context._fontWidth / 2; })
52
+ .style("fill-opacity", 1e-6)
53
+ .style("text-anchor", this.anchor())
54
+ .text(function (d) { return d.text; })
55
+ ;
56
+ this.transition.apply(newText)
57
+ .attr("y", 0)
58
+ .style("fill-opacity", 1)
59
+ ;
60
+
61
+ text.exit()
62
+ .attr("class", "exit")
63
+ ;
64
+ this.transition.apply(text.exit())
65
+ .attr("y", (this.reverse() ? -1 : +1) * this._fontWidth * 2)
66
+ .style("fill-opacity", 1e-6)
67
+ .remove()
68
+ ;
69
+ }
70
+ }
71
+ MorphText.prototype._class += " other_MorphText";
72
+
73
+ export interface MorphText {
74
+ anchor(): string;
75
+ anchor(_: string): this;
76
+ anchor_exists(): boolean;
77
+ fontSize(): number;
78
+ fontSize(_: number): this;
79
+ fontSize_exists(): boolean;
80
+ reverse(): boolean;
81
+ reverse(_: boolean): this;
82
+ reverse_exists(): boolean;
83
+ text(): string;
84
+ text(_: string): this;
85
+ text_exists(): boolean;
86
+ }
87
+
88
+ MorphText.prototype.publish("anchor", "middle", "set", "Sets anchor point", ["middle"], { tags: ["Basic"] });
89
+ MorphText.prototype.publish("fontSize", 14, "number", "Sets fontsize", null, { tags: ["Basic"] });
90
+ MorphText.prototype.publish("reverse", false, "boolean", "Reverse Animation", null, { tags: ["Basic"] });
91
+ MorphText.prototype.publish("text", "", "string", "Sets text/data of widget", null, { tags: ["Basic"] });
92
+
93
+ const _origText = MorphText.prototype.text;
94
+ MorphText.prototype.text = function (_?: string) {
95
+ const retVal = _origText.apply(this, arguments);
96
+ if (arguments.length) {
97
+ const usedChars = {};
98
+ const chars = _.split("");
99
+ this.data(chars.map(function (d) {
100
+ const id = "_" + d;
101
+ if (usedChars[id] === undefined) {
102
+ usedChars[id] = 0;
103
+ }
104
+ usedChars[id]++;
105
+ return { text: d, id: d.charCodeAt(0) + (1024 * usedChars[id]) };
106
+ }));
107
+ }
108
+ return retVal;
109
+ };
@@ -1,51 +1,51 @@
1
- import { Table } from "./Table.ts";
2
-
3
- export class NestedTable extends Table {
4
- constructor() {
5
- super();
6
- this.minWidgetHeight(240);
7
- this.minWidgetWidth(360);
8
- }
9
- }
10
- NestedTable.prototype._class += " other_NestedTable";
11
-
12
- const origColumns = NestedTable.prototype.columns;
13
- NestedTable.prototype.columns = function (_?) {
14
- if (arguments.length) {
15
- this._columns = _;
16
- return origColumns.call(this, _.map(function (col) {
17
- if (typeof col === "object") {
18
- return col.label;
19
- }
20
- return col;
21
- }));
22
- }
23
- return origColumns.apply(this, arguments);
24
- };
25
-
26
- const origData = NestedTable.prototype.data;
27
- NestedTable.prototype.data = function (_?: any): NestedTable | any {
28
- if (arguments.length) {
29
- const context = this;
30
- return origData.call(this, _.map(function (row) {
31
- return row.map(function (cell, idx) {
32
- if (cell instanceof Array) {
33
- let columns = [];
34
- if (typeof context._columns[idx] === "object" && context._columns[idx].columns) {
35
- columns = context._columns[idx].columns;
36
- } else {
37
- for (let i = 0; i < cell.length; ++i) {
38
- columns.push(context._columns[idx] + "." + i);
39
- }
40
- }
41
- return new Table()
42
- .columns(columns)
43
- .data(cell)
44
- ;
45
- }
46
- return cell;
47
- });
48
- }));
49
- }
50
- return origData.apply(this, arguments);
51
- };
1
+ import { Table } from "./Table.ts";
2
+
3
+ export class NestedTable extends Table {
4
+ constructor() {
5
+ super();
6
+ this.minWidgetHeight(240);
7
+ this.minWidgetWidth(360);
8
+ }
9
+ }
10
+ NestedTable.prototype._class += " other_NestedTable";
11
+
12
+ const origColumns = NestedTable.prototype.columns;
13
+ NestedTable.prototype.columns = function (_?) {
14
+ if (arguments.length) {
15
+ this._columns = _;
16
+ return origColumns.call(this, _.map(function (col) {
17
+ if (typeof col === "object") {
18
+ return col.label;
19
+ }
20
+ return col;
21
+ }));
22
+ }
23
+ return origColumns.apply(this, arguments);
24
+ };
25
+
26
+ const origData = NestedTable.prototype.data;
27
+ NestedTable.prototype.data = function (_?: any): NestedTable | any {
28
+ if (arguments.length) {
29
+ const context = this;
30
+ return origData.call(this, _.map(function (row) {
31
+ return row.map(function (cell, idx) {
32
+ if (cell instanceof Array) {
33
+ let columns = [];
34
+ if (typeof context._columns[idx] === "object" && context._columns[idx].columns) {
35
+ columns = context._columns[idx].columns;
36
+ } else {
37
+ for (let i = 0; i < cell.length; ++i) {
38
+ columns.push(context._columns[idx] + "." + i);
39
+ }
40
+ }
41
+ return new Table()
42
+ .columns(columns)
43
+ .data(cell)
44
+ ;
45
+ }
46
+ return cell;
47
+ });
48
+ }));
49
+ }
50
+ return origData.apply(this, arguments);
51
+ };
@@ -1,82 +1,82 @@
1
- .graph_Opportunity {
2
- transform: translate(20px, 20px)scale(1) !important;
3
- }
4
-
5
- .graph_Opportunity .group {
6
- stroke-width: 1.0;
7
- stroke: #555;
8
- fill: #FEFEFE;
9
- }
10
-
11
- .graph_Opportunity .group_headings {
12
- font-family: "Helvetica", "Arial", sans-serif;
13
- font-size: 14px;
14
- font-weight: 700;
15
- line-height: 20px;
16
- }
17
-
18
- .graph_Opportunity .node_prev_rect {
19
- fill: white;
20
- stroke-width: 2;
21
- stroke: #000;
22
- stroke-dasharray: 3, 3;
23
- opacity: 0.6;
24
- }
25
-
26
- .graph_Opportunity .node_rev_change {
27
- fill: white;
28
- }
29
-
30
- .graph_Opportunity .node_rev_change_text {
31
- font-size: 18px;
32
- font-family: Arial;
33
- color: black;
34
- font-weight: bold;
35
- }
36
-
37
- .graph_Opportunity .node_date_change {
38
- fill: white;
39
- }
40
-
41
- .graph_Opportunity .node_date_change_text {
42
- font-size: 18px;
43
- font-family: Arial;
44
- color: black;
45
- font-weight: bold;
46
- }
47
-
48
- .graph_Opportunity .node_prev_text {
49
- font-size: 9px;
50
- font-family: Arial;
51
- opacity: 0.6;
52
- }
53
-
54
- .graph_Opportunity .node_cur_rect {
55
- stroke-width: 2;
56
- stroke: #000;
57
- }
58
-
59
- .graph_Opportunity .node_cur_text {
60
- font-size: 9px;
61
- font-family: Arial;
62
- text-decoration: underline;
63
- }
64
-
65
- .graph_Opportunity .arrowhead {
66
- refX: 6;
67
- }
68
-
69
- .graph_Opportunity-tooltip.tooltip {
70
- position: absolute;
71
- text-align: left;
72
- width: 350px;
73
- height: 135px;
74
- padding: 10px;
75
- padding-top: 15px;
76
- font: 14px arial;
77
- background: #BDBDBD;
78
- border: 0px;
79
- border-radius: 8px;
80
- pointer-events: none;
81
- z-index: 1;
1
+ .graph_Opportunity {
2
+ transform: translate(20px, 20px)scale(1) !important;
3
+ }
4
+
5
+ .graph_Opportunity .group {
6
+ stroke-width: 1.0;
7
+ stroke: #555;
8
+ fill: #FEFEFE;
9
+ }
10
+
11
+ .graph_Opportunity .group_headings {
12
+ font-family: "Helvetica", "Arial", sans-serif;
13
+ font-size: 14px;
14
+ font-weight: 700;
15
+ line-height: 20px;
16
+ }
17
+
18
+ .graph_Opportunity .node_prev_rect {
19
+ fill: white;
20
+ stroke-width: 2;
21
+ stroke: #000;
22
+ stroke-dasharray: 3, 3;
23
+ opacity: 0.6;
24
+ }
25
+
26
+ .graph_Opportunity .node_rev_change {
27
+ fill: white;
28
+ }
29
+
30
+ .graph_Opportunity .node_rev_change_text {
31
+ font-size: 18px;
32
+ font-family: Arial;
33
+ color: black;
34
+ font-weight: bold;
35
+ }
36
+
37
+ .graph_Opportunity .node_date_change {
38
+ fill: white;
39
+ }
40
+
41
+ .graph_Opportunity .node_date_change_text {
42
+ font-size: 18px;
43
+ font-family: Arial;
44
+ color: black;
45
+ font-weight: bold;
46
+ }
47
+
48
+ .graph_Opportunity .node_prev_text {
49
+ font-size: 9px;
50
+ font-family: Arial;
51
+ opacity: 0.6;
52
+ }
53
+
54
+ .graph_Opportunity .node_cur_rect {
55
+ stroke-width: 2;
56
+ stroke: #000;
57
+ }
58
+
59
+ .graph_Opportunity .node_cur_text {
60
+ font-size: 9px;
61
+ font-family: Arial;
62
+ text-decoration: underline;
63
+ }
64
+
65
+ .graph_Opportunity .arrowhead {
66
+ refX: 6;
67
+ }
68
+
69
+ .graph_Opportunity-tooltip.tooltip {
70
+ position: absolute;
71
+ text-align: left;
72
+ width: 350px;
73
+ height: 135px;
74
+ padding: 10px;
75
+ padding-top: 15px;
76
+ font: 14px arial;
77
+ background: #BDBDBD;
78
+ border: 0px;
79
+ border-radius: 8px;
80
+ pointer-events: none;
81
+ z-index: 1;
82
82
  }