@hpcc-js/layout 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/FlexGrid.css CHANGED
@@ -1,8 +1,8 @@
1
- .layout_FlexGrid{
2
- display: flex;
3
- }
4
- .FlexGrid-list-item{
5
- overflow: hidden;
6
- border-style: solid;
7
- flex-grow: 1;
1
+ .layout_FlexGrid{
2
+ display: flex;
3
+ }
4
+ .FlexGrid-list-item{
5
+ overflow: hidden;
6
+ border-style: solid;
7
+ flex-grow: 1;
8
8
  }
package/src/FlexGrid.ts CHANGED
@@ -1,140 +1,140 @@
1
- import { HTMLWidget } from "@hpcc-js/common";
2
- import { select as d3Select } from "d3-selection";
3
-
4
- import "../src/FlexGrid.css";
5
-
6
- export class FlexGrid extends HTMLWidget {
7
- constructor() {
8
- super();
9
- }
10
- enter(domNode, element) {
11
- super.enter(domNode, element);
12
- d3Select(domNode.parentNode)
13
- .style("height", "100%")
14
- .style("width", "100%")
15
- ;
16
- }
17
- update(domNode, element) {
18
- super.update(domNode, element);
19
- const context = this;
20
-
21
- const cachedSizes = [];
22
- this.updateFlexParent(element);
23
- const listItems = element.selectAll(".FlexGrid-list-item").data(this.widgets(), w => w.id());
24
- listItems.enter()
25
- .append("div")
26
- .classed("FlexGrid-list-item", true)
27
- .each(function (w) {
28
- w.target(this);
29
- })
30
- .merge(listItems)
31
- .style("min-height", this.itemMinHeight() + "px")
32
- .style("min-width", this.itemMinWidth() + "px")
33
- .style("flex-basis", (n, i) => {
34
- const flexBasis = this.widgetsFlexBasis()[i];
35
- return typeof flexBasis !== "undefined" ? flexBasis : this.flexBasis();
36
- })
37
- .style("flex-grow", (n, i) => {
38
- const flexGrow = this.widgetsFlexGrow()[i];
39
- return typeof flexGrow !== "undefined" ? flexGrow : this.flexGrow();
40
- })
41
- .style("border-width", this.borderWidth() + "px")
42
- .style("border-color", this.itemBorderColor())
43
- .each(function () {
44
- this.firstChild.style.display = "none";
45
- })
46
- .each(function () {
47
- const rect = this.getBoundingClientRect();
48
- cachedSizes.push([
49
- rect.width,
50
- rect.height
51
- ]);
52
- })
53
- .each(function (w, i) {
54
- this.firstChild.style.display = "block";
55
- w.resize({
56
- width: cachedSizes[i][0] - (2 * context.borderWidth()),
57
- height: cachedSizes[i][1] - (2 * context.borderWidth())
58
- });
59
- })
60
- ;
61
- listItems.exit().remove();
62
- }
63
- exit(domNode, element) {
64
- super.exit(domNode, element);
65
- }
66
- updateFlexParent(element) {
67
- element
68
- .style("height", "100%")
69
- .style("flex-direction", this.orientation() === "horizontal" ? "row" : "column")
70
- .style("flex-wrap", this.flexWrap())
71
- .style("align-items", this.alignItems())
72
- .style("align-content", this.alignContent())
73
- .style("overflow-x", () => {
74
- if (this.forceXScroll() || (this.orientation() === "horizontal" && this.flexWrap() === "nowrap" && !this.disableScroll())) {
75
- return "scroll";
76
- }
77
- return "hidden";
78
- })
79
- .style("overflow-y", () => {
80
- if (this.forceYScroll() || (this.orientation() === "vertical" && this.flexWrap() === "nowrap" && !this.disableScroll())) {
81
- return "scroll";
82
- }
83
- return "hidden";
84
- })
85
- ;
86
- }
87
- }
88
- FlexGrid.prototype._class += " layout_FlexGrid";
89
-
90
- export interface FlexGrid {
91
- widgets(): any;
92
- widgets(_: any): this;
93
- orientation(): "horizontal" | "vertical";
94
- orientation(_: "horizontal" | "vertical"): this;
95
- flexWrap(): "nowrap" | "wrap" | "wrap-reverse";
96
- flexWrap(_: "nowrap" | "wrap" | "wrap-reverse"): this;
97
- itemMinHeight(): number;
98
- itemMinHeight(_: number): this;
99
- itemMinWidth(): number;
100
- itemMinWidth(_: number): this;
101
- alignItems(): "flex-start" | "center" | "flex-end" | "stretch";
102
- alignItems(_: "flex-start" | "center" | "flex-end" | "stretch"): this;
103
- alignContent(): "flex-start" | "center" | "flex-end" | "stretch" | "space-between" | "space-around";
104
- alignContent(_: "flex-start" | "center" | "flex-end" | "stretch" | "space-between" | "space-around"): this;
105
- itemBorderColor(): string;
106
- itemBorderColor(_: string): this;
107
- borderWidth(): number;
108
- borderWidth(_: number): this;
109
- flexGrow(): number;
110
- flexGrow(_: number): this;
111
- widgetsFlexGrow(): number[];
112
- widgetsFlexGrow(_: number[]): this;
113
- flexBasis(): string;
114
- flexBasis(_: string): this;
115
- widgetsFlexBasis(): string[];
116
- widgetsFlexBasis(_: string[]): this;
117
- disableScroll(): boolean;
118
- disableScroll(_: boolean): this;
119
- forceXScroll(): boolean;
120
- forceXScroll(_: boolean): this;
121
- forceYScroll(): boolean;
122
- forceYScroll(_: boolean): this;
123
- }
124
-
125
- FlexGrid.prototype.publish("itemBorderColor", "transparent", "html-color", "Color of list item borders");
126
- FlexGrid.prototype.publish("borderWidth", 0, "number", "Width of list item borders (pixels)");
127
- FlexGrid.prototype.publish("orientation", "horizontal", "set", "Controls the flex-direction of the list items", ["horizontal", "vertical"]);
128
- FlexGrid.prototype.publish("flexWrap", "wrap", "set", "Controls the line wrap when overflow occurs", ["nowrap", "wrap", "wrap-reverse"]);
129
- FlexGrid.prototype.publish("disableScroll", false, "boolean", "If false, scrollbar will show (when flexWrap is set to 'nowrap')", null, { disable: (w: any) => w.flexWrap() !== "nowrap" });
130
- FlexGrid.prototype.publish("forceXScroll", false, "boolean", "If true, horzontal scrollbar will show");
131
- FlexGrid.prototype.publish("forceYScroll", false, "boolean", "If true, vertical scrollbar will show");
132
- FlexGrid.prototype.publish("itemMinHeight", 64, "number", "Minimum height of a list item (pixels)");
133
- FlexGrid.prototype.publish("itemMinWidth", 64, "number", "Minimum width of a list item (pixels)");
134
- FlexGrid.prototype.publish("alignItems", "stretch", "set", "Controls normal alignment of items", ["flex-start", "center", "flex-end", "stretch"]);
135
- FlexGrid.prototype.publish("alignContent", "stretch", "set", "Controls normal alignment of item rows", ["flex-start", "center", "flex-end", "stretch", "space-between", "space-around"]);
136
- FlexGrid.prototype.publish("flexGrow", 1, "number", "Default flex-grow style for all list items");
137
- FlexGrid.prototype.publish("flexBasis", "10%", "string", "Default flex-basis style for all list items");
138
- FlexGrid.prototype.publish("widgetsFlexGrow", [], "array", "Array of flex-grow values keyed on the widgets array");
139
- FlexGrid.prototype.publish("widgetsFlexBasis", [], "array", "Array of flex-basis values keyed on the widgets array");
140
- FlexGrid.prototype.publish("widgets", [], "widgetArray", "Array of widgets to be rendered as list items");
1
+ import { HTMLWidget } from "@hpcc-js/common";
2
+ import { select as d3Select } from "d3-selection";
3
+
4
+ import "../src/FlexGrid.css";
5
+
6
+ export class FlexGrid extends HTMLWidget {
7
+ constructor() {
8
+ super();
9
+ }
10
+ enter(domNode, element) {
11
+ super.enter(domNode, element);
12
+ d3Select(domNode.parentNode)
13
+ .style("height", "100%")
14
+ .style("width", "100%")
15
+ ;
16
+ }
17
+ update(domNode, element) {
18
+ super.update(domNode, element);
19
+ const context = this;
20
+
21
+ const cachedSizes = [];
22
+ this.updateFlexParent(element);
23
+ const listItems = element.selectAll(".FlexGrid-list-item").data(this.widgets(), w => w.id());
24
+ listItems.enter()
25
+ .append("div")
26
+ .classed("FlexGrid-list-item", true)
27
+ .each(function (w) {
28
+ w.target(this);
29
+ })
30
+ .merge(listItems)
31
+ .style("min-height", this.itemMinHeight() + "px")
32
+ .style("min-width", this.itemMinWidth() + "px")
33
+ .style("flex-basis", (n, i) => {
34
+ const flexBasis = this.widgetsFlexBasis()[i];
35
+ return typeof flexBasis !== "undefined" ? flexBasis : this.flexBasis();
36
+ })
37
+ .style("flex-grow", (n, i) => {
38
+ const flexGrow = this.widgetsFlexGrow()[i];
39
+ return typeof flexGrow !== "undefined" ? flexGrow : this.flexGrow();
40
+ })
41
+ .style("border-width", this.borderWidth() + "px")
42
+ .style("border-color", this.itemBorderColor())
43
+ .each(function () {
44
+ this.firstChild.style.display = "none";
45
+ })
46
+ .each(function () {
47
+ const rect = this.getBoundingClientRect();
48
+ cachedSizes.push([
49
+ rect.width,
50
+ rect.height
51
+ ]);
52
+ })
53
+ .each(function (w, i) {
54
+ this.firstChild.style.display = "block";
55
+ w.resize({
56
+ width: cachedSizes[i][0] - (2 * context.borderWidth()),
57
+ height: cachedSizes[i][1] - (2 * context.borderWidth())
58
+ });
59
+ })
60
+ ;
61
+ listItems.exit().remove();
62
+ }
63
+ exit(domNode, element) {
64
+ super.exit(domNode, element);
65
+ }
66
+ updateFlexParent(element) {
67
+ element
68
+ .style("height", "100%")
69
+ .style("flex-direction", this.orientation() === "horizontal" ? "row" : "column")
70
+ .style("flex-wrap", this.flexWrap())
71
+ .style("align-items", this.alignItems())
72
+ .style("align-content", this.alignContent())
73
+ .style("overflow-x", () => {
74
+ if (this.forceXScroll() || (this.orientation() === "horizontal" && this.flexWrap() === "nowrap" && !this.disableScroll())) {
75
+ return "scroll";
76
+ }
77
+ return "hidden";
78
+ })
79
+ .style("overflow-y", () => {
80
+ if (this.forceYScroll() || (this.orientation() === "vertical" && this.flexWrap() === "nowrap" && !this.disableScroll())) {
81
+ return "scroll";
82
+ }
83
+ return "hidden";
84
+ })
85
+ ;
86
+ }
87
+ }
88
+ FlexGrid.prototype._class += " layout_FlexGrid";
89
+
90
+ export interface FlexGrid {
91
+ widgets(): any;
92
+ widgets(_: any): this;
93
+ orientation(): "horizontal" | "vertical";
94
+ orientation(_: "horizontal" | "vertical"): this;
95
+ flexWrap(): "nowrap" | "wrap" | "wrap-reverse";
96
+ flexWrap(_: "nowrap" | "wrap" | "wrap-reverse"): this;
97
+ itemMinHeight(): number;
98
+ itemMinHeight(_: number): this;
99
+ itemMinWidth(): number;
100
+ itemMinWidth(_: number): this;
101
+ alignItems(): "flex-start" | "center" | "flex-end" | "stretch";
102
+ alignItems(_: "flex-start" | "center" | "flex-end" | "stretch"): this;
103
+ alignContent(): "flex-start" | "center" | "flex-end" | "stretch" | "space-between" | "space-around";
104
+ alignContent(_: "flex-start" | "center" | "flex-end" | "stretch" | "space-between" | "space-around"): this;
105
+ itemBorderColor(): string;
106
+ itemBorderColor(_: string): this;
107
+ borderWidth(): number;
108
+ borderWidth(_: number): this;
109
+ flexGrow(): number;
110
+ flexGrow(_: number): this;
111
+ widgetsFlexGrow(): number[];
112
+ widgetsFlexGrow(_: number[]): this;
113
+ flexBasis(): string;
114
+ flexBasis(_: string): this;
115
+ widgetsFlexBasis(): string[];
116
+ widgetsFlexBasis(_: string[]): this;
117
+ disableScroll(): boolean;
118
+ disableScroll(_: boolean): this;
119
+ forceXScroll(): boolean;
120
+ forceXScroll(_: boolean): this;
121
+ forceYScroll(): boolean;
122
+ forceYScroll(_: boolean): this;
123
+ }
124
+
125
+ FlexGrid.prototype.publish("itemBorderColor", "transparent", "html-color", "Color of list item borders");
126
+ FlexGrid.prototype.publish("borderWidth", 0, "number", "Width of list item borders (pixels)");
127
+ FlexGrid.prototype.publish("orientation", "horizontal", "set", "Controls the flex-direction of the list items", ["horizontal", "vertical"]);
128
+ FlexGrid.prototype.publish("flexWrap", "wrap", "set", "Controls the line wrap when overflow occurs", ["nowrap", "wrap", "wrap-reverse"]);
129
+ FlexGrid.prototype.publish("disableScroll", false, "boolean", "If false, scrollbar will show (when flexWrap is set to 'nowrap')", null, { disable: (w: any) => w.flexWrap() !== "nowrap" });
130
+ FlexGrid.prototype.publish("forceXScroll", false, "boolean", "If true, horzontal scrollbar will show");
131
+ FlexGrid.prototype.publish("forceYScroll", false, "boolean", "If true, vertical scrollbar will show");
132
+ FlexGrid.prototype.publish("itemMinHeight", 64, "number", "Minimum height of a list item (pixels)");
133
+ FlexGrid.prototype.publish("itemMinWidth", 64, "number", "Minimum width of a list item (pixels)");
134
+ FlexGrid.prototype.publish("alignItems", "stretch", "set", "Controls normal alignment of items", ["flex-start", "center", "flex-end", "stretch"]);
135
+ FlexGrid.prototype.publish("alignContent", "stretch", "set", "Controls normal alignment of item rows", ["flex-start", "center", "flex-end", "stretch", "space-between", "space-around"]);
136
+ FlexGrid.prototype.publish("flexGrow", 1, "number", "Default flex-grow style for all list items");
137
+ FlexGrid.prototype.publish("flexBasis", "10%", "string", "Default flex-basis style for all list items");
138
+ FlexGrid.prototype.publish("widgetsFlexGrow", [], "array", "Array of flex-grow values keyed on the widgets array");
139
+ FlexGrid.prototype.publish("widgetsFlexBasis", [], "array", "Array of flex-basis values keyed on the widgets array");
140
+ FlexGrid.prototype.publish("widgets", [], "widgetArray", "Array of widgets to be rendered as list items");
package/src/Grid.css CHANGED
@@ -1,90 +1,90 @@
1
- .layout_Grid > .ddCell {
2
- position: absolute;
3
- }
4
-
5
- .layout_Grid > .laneBackground {
6
- position: absolute;
7
- border-style: solid;
8
- border-width: 1px;
9
- background: whitesmoke;
10
- }
11
-
12
- .layout_Grid > .lane {
13
- position: absolute;
14
- border-style: none;
15
- opacity: 0.25;
16
- border-radius: 0px;
17
- pointer-events: none;
18
- }
19
-
20
- .layout_Grid > .ddCell.draggable {
21
- border-style: solid;
22
- border-width: 1px;
23
- background-color: ghostwhite;
24
- border-radius: 0px;
25
- cursor:move;
26
- }
27
-
28
- .layout_Grid > .ddCell.draggable > .resizeHandle {
29
- bottom: 0px;
30
- right: 0px;
31
- width: 8px;
32
- height: 8px;
33
- border-style: none;
34
- position: absolute;
35
- cursor:nwse-resize;
36
- }
37
-
38
- .layout_Grid > .ddCell.draggable .resizeHandleDisplay {
39
- bottom: 2px;
40
- right: 2px;
41
- width: 4px;
42
- height: 4px;
43
- border-style: solid;
44
- border-left-width: 0px;
45
- border-top-width: 0px;
46
- border-right-width: 2px;
47
- border-bottom-width: 2px;
48
- border-color: darkGray;
49
- background-color:none;
50
- position: absolute;
51
- }
52
-
53
- .layout_Grid > .ddCell.draggable .resizeHandleDisplay:hover {
54
- border-color: orange;
55
- }
56
-
57
- .layout_Grid > .dragging {
58
- border-style: solid;
59
- border-width: 1px;
60
- border-color: gray;
61
- border-radius: 0px;
62
- position: absolute;
63
- background: repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 4px, rgba(100, 100, 100, 0.1) 4px, rgba(100, 100, 100, 0.1) 8px );
64
- }
65
-
66
- .layout_Grid > .resizing {
67
- border-style: solid;
68
- border-width: 1px;
69
- border-color: gray;
70
- background-color: orange;
71
- border-radius: 0px;
72
- position: absolute;
73
- opacity:0.3;
74
- background: repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 4px, orange 4px, orange 8px );
75
- }
76
-
77
- .layout_Grid > .ddCell.draggable .common_Widget.selected {
78
- border-style: solid;
79
- border-width: 1px;
80
- border-color: red;
81
- background-color: gray;
82
- border-radius: 0px;
83
- position: absolute;
84
- background: repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 4px, rgba(100, 0, 0, 0.1) 4px, rgba(100, 0, 0, 0.1) 8px );
85
- }
86
-
87
- .layout_Grid #drag-me::before {
88
- content: "#" attr(id);
89
- font-weight: bold;
90
- }
1
+ .layout_Grid > .ddCell {
2
+ position: absolute;
3
+ }
4
+
5
+ .layout_Grid > .laneBackground {
6
+ position: absolute;
7
+ border-style: solid;
8
+ border-width: 1px;
9
+ background: whitesmoke;
10
+ }
11
+
12
+ .layout_Grid > .lane {
13
+ position: absolute;
14
+ border-style: none;
15
+ opacity: 0.25;
16
+ border-radius: 0px;
17
+ pointer-events: none;
18
+ }
19
+
20
+ .layout_Grid > .ddCell.draggable {
21
+ border-style: solid;
22
+ border-width: 1px;
23
+ background-color: ghostwhite;
24
+ border-radius: 0px;
25
+ cursor:move;
26
+ }
27
+
28
+ .layout_Grid > .ddCell.draggable > .resizeHandle {
29
+ bottom: 0px;
30
+ right: 0px;
31
+ width: 8px;
32
+ height: 8px;
33
+ border-style: none;
34
+ position: absolute;
35
+ cursor:nwse-resize;
36
+ }
37
+
38
+ .layout_Grid > .ddCell.draggable .resizeHandleDisplay {
39
+ bottom: 2px;
40
+ right: 2px;
41
+ width: 4px;
42
+ height: 4px;
43
+ border-style: solid;
44
+ border-left-width: 0px;
45
+ border-top-width: 0px;
46
+ border-right-width: 2px;
47
+ border-bottom-width: 2px;
48
+ border-color: darkGray;
49
+ background-color:none;
50
+ position: absolute;
51
+ }
52
+
53
+ .layout_Grid > .ddCell.draggable .resizeHandleDisplay:hover {
54
+ border-color: orange;
55
+ }
56
+
57
+ .layout_Grid > .dragging {
58
+ border-style: solid;
59
+ border-width: 1px;
60
+ border-color: gray;
61
+ border-radius: 0px;
62
+ position: absolute;
63
+ background: repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 4px, rgba(100, 100, 100, 0.1) 4px, rgba(100, 100, 100, 0.1) 8px );
64
+ }
65
+
66
+ .layout_Grid > .resizing {
67
+ border-style: solid;
68
+ border-width: 1px;
69
+ border-color: gray;
70
+ background-color: orange;
71
+ border-radius: 0px;
72
+ position: absolute;
73
+ opacity:0.3;
74
+ background: repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 4px, orange 4px, orange 8px );
75
+ }
76
+
77
+ .layout_Grid > .ddCell.draggable .common_Widget.selected {
78
+ border-style: solid;
79
+ border-width: 1px;
80
+ border-color: red;
81
+ background-color: gray;
82
+ border-radius: 0px;
83
+ position: absolute;
84
+ background: repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 4px, rgba(100, 0, 0, 0.1) 4px, rgba(100, 0, 0, 0.1) 8px );
85
+ }
86
+
87
+ .layout_Grid #drag-me::before {
88
+ content: "#" attr(id);
89
+ font-weight: bold;
90
+ }