@hpcc-js/phosphor 2.20.2 → 2.20.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/phosphor",
3
- "version": "2.20.2",
3
+ "version": "2.20.4",
4
4
  "description": "hpcc-js - Viz Phosphor",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es6",
@@ -38,10 +38,10 @@
38
38
  "update": "npx --yes npm-check-updates -u -t minor"
39
39
  },
40
40
  "dependencies": {
41
- "@hpcc-js/common": "^2.73.1",
42
- "@hpcc-js/other": "^2.17.1",
43
- "@hpcc-js/phosphor-shim": "^2.16.0",
44
- "@hpcc-js/util": "^2.53.1"
41
+ "@hpcc-js/common": "^2.73.3",
42
+ "@hpcc-js/other": "^2.17.3",
43
+ "@hpcc-js/phosphor-shim": "^2.17.1",
44
+ "@hpcc-js/util": "^2.53.3"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@hpcc-js/bundle": "^2.12.0",
@@ -59,5 +59,5 @@
59
59
  "url": "https://github.com/hpcc-systems/Visualization/issues"
60
60
  },
61
61
  "homepage": "https://github.com/hpcc-systems/Visualization",
62
- "gitHead": "9f7febd34d32c62d1785e7863334773e1967d738"
62
+ "gitHead": "0907b8d15d369c89483954a1d96e2247ba020cb6"
63
63
  }
package/src/DockPanel.css CHANGED
@@ -1,94 +1,94 @@
1
- .p-DockPanel-overlay {
2
- background: rgba(255, 255, 255, 0.6);
3
- border: 1px dashed black;
4
- transition-property: top, left, right, bottom;
5
- transition-duration: 150ms;
6
- transition-timing-function: ease;
7
- }
8
-
9
- .p-TabBar {
10
- min-height: 24px;
11
- max-height: 24px;
12
- }
13
-
14
- .p-TabBar-content {
15
- min-width: 0;
16
- min-height: 0;
17
- align-items: flex-end;
18
- }
19
-
20
- .p-TabPanel-tabBar .p-TabBar-content {
21
- border-bottom: 1px solid #C0C0C0;
22
- }
23
-
24
- .p-TabBar-tab {
25
- padding: 0px 10px;
26
- background: #E5E5E5;
27
- border: 1px solid #C0C0C0;
28
- border-bottom: none;
29
- font: 12px Helvetica, Arial, sans-serif;
30
- flex: 0 1 125px;
31
- min-height: 20px;
32
- max-height: 20px;
33
- min-width: 35px;
34
- margin-left: -1px;
35
- line-height: 20px;
36
- }
37
-
38
- .p-TabBar-tab.p-mod-current {
39
- background: white;
40
- }
41
-
42
-
43
- .p-TabBar-tab:hover:not(.p-mod-current) {
44
- background: #F0F0F0;
45
- }
46
-
47
-
48
- .p-TabBar-tab:first-child {
49
- margin-left: 0;
50
- }
51
-
52
-
53
- .p-TabBar-tab.p-mod-current {
54
- min-height: 23px;
55
- max-height: 23px;
56
- transform: translateY(1px);
57
- }
58
-
59
-
60
- .p-TabBar-tabIcon,
61
- .p-TabBar-tabLabel,
62
- .p-TabBar-tabCloseIcon {
63
- display: inline-block;
64
- }
65
-
66
-
67
- .p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon {
68
- margin-left: 4px;
69
- }
70
-
71
-
72
- .p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon:before {
73
- content: '\f00d';
74
- font-family: FontAwesome;
75
- }
76
-
77
-
78
- .p-TabBar-tab.p-mod-drag-image {
79
- min-height: 23px;
80
- max-height: 23px;
81
- min-width: 125px;
82
- border: none;
83
- box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
84
- transform: translateX(-40%) translateY(-58%);
85
- }
86
-
87
- .p-Widget.p-TabBar.p-DockPanel-tabBar.hide {
88
- min-height: 1px !important;
89
- max-height: 1px !important;
90
- }
91
-
92
- .p-Widget.p-TabBar.p-DockPanel-tabBar.hide .p-TabBar-tab.p-mod-current {
93
- display: none;
94
- }
1
+ .p-DockPanel-overlay {
2
+ background: rgba(255, 255, 255, 0.6);
3
+ border: 1px dashed black;
4
+ transition-property: top, left, right, bottom;
5
+ transition-duration: 150ms;
6
+ transition-timing-function: ease;
7
+ }
8
+
9
+ .p-TabBar {
10
+ min-height: 24px;
11
+ max-height: 24px;
12
+ }
13
+
14
+ .p-TabBar-content {
15
+ min-width: 0;
16
+ min-height: 0;
17
+ align-items: flex-end;
18
+ }
19
+
20
+ .p-TabPanel-tabBar .p-TabBar-content {
21
+ border-bottom: 1px solid #C0C0C0;
22
+ }
23
+
24
+ .p-TabBar-tab {
25
+ padding: 0px 10px;
26
+ background: #E5E5E5;
27
+ border: 1px solid #C0C0C0;
28
+ border-bottom: none;
29
+ font: 12px Helvetica, Arial, sans-serif;
30
+ flex: 0 1 125px;
31
+ min-height: 20px;
32
+ max-height: 20px;
33
+ min-width: 35px;
34
+ margin-left: -1px;
35
+ line-height: 20px;
36
+ }
37
+
38
+ .p-TabBar-tab.p-mod-current {
39
+ background: white;
40
+ }
41
+
42
+
43
+ .p-TabBar-tab:hover:not(.p-mod-current) {
44
+ background: #F0F0F0;
45
+ }
46
+
47
+
48
+ .p-TabBar-tab:first-child {
49
+ margin-left: 0;
50
+ }
51
+
52
+
53
+ .p-TabBar-tab.p-mod-current {
54
+ min-height: 23px;
55
+ max-height: 23px;
56
+ transform: translateY(1px);
57
+ }
58
+
59
+
60
+ .p-TabBar-tabIcon,
61
+ .p-TabBar-tabLabel,
62
+ .p-TabBar-tabCloseIcon {
63
+ display: inline-block;
64
+ }
65
+
66
+
67
+ .p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon {
68
+ margin-left: 4px;
69
+ }
70
+
71
+
72
+ .p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon:before {
73
+ content: '\f00d';
74
+ font-family: FontAwesome;
75
+ }
76
+
77
+
78
+ .p-TabBar-tab.p-mod-drag-image {
79
+ min-height: 23px;
80
+ max-height: 23px;
81
+ min-width: 125px;
82
+ border: none;
83
+ box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
84
+ transform: translateX(-40%) translateY(-58%);
85
+ }
86
+
87
+ .p-Widget.p-TabBar.p-DockPanel-tabBar.hide {
88
+ min-height: 1px !important;
89
+ max-height: 1px !important;
90
+ }
91
+
92
+ .p-Widget.p-TabBar.p-DockPanel-tabBar.hide .p-TabBar-tab.p-mod-current {
93
+ display: none;
94
+ }
package/src/DockPanel.ts CHANGED
@@ -1,187 +1,187 @@
1
- import { HTMLWidget, Widget, Utility } from "@hpcc-js/common";
2
- import { DockPanel as PhosphorDockPanel, IMessageHandler, IMessageHook, Message, MessageLoop, Widget as PWidget } from "@hpcc-js/phosphor-shim";
3
- import { select as d3Select } from "d3-selection";
4
- import { PDockPanel } from "./PDockPanel";
5
- import { IClosable, Msg, WidgetAdapter } from "./WidgetAdapter";
6
-
7
- import "../src/DockPanel.css";
8
-
9
- export class DockPanel extends HTMLWidget implements IMessageHandler, IMessageHook {
10
- private _dock = new PDockPanel({ mode: "multiple-document" });
11
-
12
- constructor() {
13
- super();
14
- this._tag = "div";
15
- this._dock.id = "p" + this.id();
16
- MessageLoop.installMessageHook(this, this);
17
- }
18
-
19
- protected getWidgetAdapter(widget: Widget): WidgetAdapter | null {
20
- let retVal = null;
21
- this._dock.content().some(wa => {
22
- if (wa.widget === widget) {
23
- retVal = wa;
24
- return true;
25
- }
26
- return false;
27
- });
28
- return retVal;
29
- }
30
-
31
- addWidget(widget: Widget, title: string, location: PhosphorDockPanel.InsertMode = "split-right", refWidget?: Widget, closable?: boolean | IClosable, padding: number = 8) {
32
- const addMode: PhosphorDockPanel.IAddOptions = { mode: location, ref: this.getWidgetAdapter(refWidget) };
33
- const wa = new WidgetAdapter(this, widget, {}, closable);
34
- wa.title.label = title;
35
- wa.padding = padding;
36
- this._dock.addWidget(wa, addMode);
37
- this._dock.appendContent(wa);
38
- this._dock.tabsMovable = true;
39
- return this;
40
- }
41
-
42
- removeWidget(widget: Widget) {
43
- const wa = this.getWidgetAdapter(widget);
44
- if (wa) {
45
- widget.target(null);
46
- this._dock.removeContent(wa);
47
- }
48
- return this;
49
- }
50
-
51
- isVisible(widget: Widget) {
52
- return this.getWidgetAdapter(widget).isVisible;
53
- }
54
-
55
- widgetAdapters(): WidgetAdapter[] {
56
- return this._dock.content();
57
- }
58
-
59
- widgets(): Widget[] {
60
- return this._dock.content().map(wa => wa.widget);
61
- }
62
-
63
- layout(): object;
64
- layout(_: object): this;
65
- layout(_?: object): object | this {
66
- if (!arguments.length) return this._dock.saveLayout();
67
- this._dock.restoreLayout(_ as any);
68
- return this;
69
- }
70
-
71
- // Used to delay load a layout during render...
72
- private _layoutObj: object = null;
73
- layoutObj(_: object | null): this {
74
- this._layoutObj = _;
75
- return this;
76
- }
77
-
78
- private _pPlaceholder;
79
- enter(domNode, element) {
80
- super.enter(domNode, element);
81
- this._pPlaceholder = element.append("div");
82
- PWidget.attach(this._dock, this._pPlaceholder.node());
83
- }
84
-
85
- _prevHideSingleTabs;
86
- update(domNode, element) {
87
- super.update(domNode, element);
88
-
89
- this._pPlaceholder
90
- .style("width", this.width() + "px")
91
- .style("height", this.height() + "px")
92
- .style("overflow", "hidden")
93
- ;
94
-
95
- element.select(".p-Widget")
96
- .style("width", this._pPlaceholder.node().clientWidth + "px")
97
- .style("height", this.height() + "px")
98
- ;
99
-
100
- this.widgets().forEach(w => w.render());
101
- }
102
-
103
- exit(domNode, element) {
104
- [...this.widgets()].forEach(w => this.removeWidget(w));
105
- super.exit(domNode, element);
106
- }
107
-
108
- render(callback?: (w: Widget) => void): this {
109
- const context = this;
110
- if (this._layoutObj !== null) {
111
- this.layout(this._layoutObj);
112
- this.layoutObj(null);
113
- }
114
- return super.render((w) => {
115
- this._dock.content().watchRendered(this, callback);
116
- this._dock.update();
117
- setTimeout(() => {
118
- const tabBars = this.element().selectAll(".p-Widget.p-TabBar.p-DockPanel-tabBar");
119
- let refit = false;
120
- tabBars.each(function () {
121
- const tabBar = d3Select(this);
122
- const tabsCount = (tabBar.node() as HTMLElement).childNodes[0].childNodes.length;
123
- const hide = context.hideSingleTabs() && tabsCount === 1;
124
- if (hide !== tabBar.classed("hide")) {
125
- tabBar.classed("hide", hide);
126
- refit = true;
127
- }
128
- });
129
- if (refit) {
130
- this._dock.fit();
131
- }
132
- }, 0);
133
- });
134
- }
135
-
136
- refit() {
137
- this._dock.fit();
138
- }
139
-
140
- // Phosphor Messaging ---
141
- messageHook(handler: IMessageHandler, msg: Message): boolean {
142
- if (handler === this) {
143
- this.processMessage(msg);
144
- }
145
- return true;
146
- }
147
-
148
- private _lazyLayoutChanged = Utility.debounce(async () => {
149
- this.layoutChanged();
150
- }, 1000);
151
-
152
- _prevActive: Widget;
153
- processMessage(msg: Message): void {
154
- switch (msg.type) {
155
- case Msg.WAActivateRequest.type:
156
- const wa = (msg as Msg.WAActivateRequest).wa;
157
- const widget = wa.widget;
158
- if (this._prevActive !== widget) {
159
- this._prevActive = widget;
160
- this.childActivation(widget, wa);
161
- }
162
- break;
163
- case Msg.WALayoutChanged.type:
164
- this._lazyLayoutChanged();
165
- break;
166
- }
167
- }
168
-
169
- active(): Widget {
170
- return this._prevActive;
171
- }
172
-
173
- // Events ---
174
- childActivation(w: Widget, wa: WidgetAdapter) {
175
- }
176
-
177
- layoutChanged() {
178
- }
179
- }
180
- DockPanel.prototype._class += " phosphor_DockPanel";
181
-
182
- export interface DockPanel {
183
- hideSingleTabs(): boolean;
184
- hideSingleTabs(_: boolean): this;
185
- }
186
-
187
- DockPanel.prototype.publish("hideSingleTabs", false, "boolean");
1
+ import { HTMLWidget, Widget, Utility } from "@hpcc-js/common";
2
+ import { DockPanel as PhosphorDockPanel, IMessageHandler, IMessageHook, Message, MessageLoop, Widget as PWidget } from "@hpcc-js/phosphor-shim";
3
+ import { select as d3Select } from "d3-selection";
4
+ import { PDockPanel } from "./PDockPanel";
5
+ import { IClosable, Msg, WidgetAdapter } from "./WidgetAdapter";
6
+
7
+ import "../src/DockPanel.css";
8
+
9
+ export class DockPanel extends HTMLWidget implements IMessageHandler, IMessageHook {
10
+ private _dock = new PDockPanel({ mode: "multiple-document" });
11
+
12
+ constructor() {
13
+ super();
14
+ this._tag = "div";
15
+ this._dock.id = "p" + this.id();
16
+ MessageLoop.installMessageHook(this, this);
17
+ }
18
+
19
+ protected getWidgetAdapter(widget: Widget): WidgetAdapter | null {
20
+ let retVal = null;
21
+ this._dock.content().some(wa => {
22
+ if (wa.widget === widget) {
23
+ retVal = wa;
24
+ return true;
25
+ }
26
+ return false;
27
+ });
28
+ return retVal;
29
+ }
30
+
31
+ addWidget(widget: Widget, title: string, location: PhosphorDockPanel.InsertMode = "split-right", refWidget?: Widget, closable?: boolean | IClosable, padding: number = 8) {
32
+ const addMode: PhosphorDockPanel.IAddOptions = { mode: location, ref: this.getWidgetAdapter(refWidget) };
33
+ const wa = new WidgetAdapter(this, widget, {}, closable);
34
+ wa.title.label = title;
35
+ wa.padding = padding;
36
+ this._dock.addWidget(wa, addMode);
37
+ this._dock.appendContent(wa);
38
+ this._dock.tabsMovable = true;
39
+ return this;
40
+ }
41
+
42
+ removeWidget(widget: Widget) {
43
+ const wa = this.getWidgetAdapter(widget);
44
+ if (wa) {
45
+ widget.target(null);
46
+ this._dock.removeContent(wa);
47
+ }
48
+ return this;
49
+ }
50
+
51
+ isVisible(widget: Widget) {
52
+ return this.getWidgetAdapter(widget).isVisible;
53
+ }
54
+
55
+ widgetAdapters(): WidgetAdapter[] {
56
+ return this._dock.content();
57
+ }
58
+
59
+ widgets(): Widget[] {
60
+ return this._dock.content().map(wa => wa.widget);
61
+ }
62
+
63
+ layout(): object;
64
+ layout(_: object): this;
65
+ layout(_?: object): object | this {
66
+ if (!arguments.length) return this._dock.saveLayout();
67
+ this._dock.restoreLayout(_ as any);
68
+ return this;
69
+ }
70
+
71
+ // Used to delay load a layout during render...
72
+ private _layoutObj: object = null;
73
+ layoutObj(_: object | null): this {
74
+ this._layoutObj = _;
75
+ return this;
76
+ }
77
+
78
+ private _pPlaceholder;
79
+ enter(domNode, element) {
80
+ super.enter(domNode, element);
81
+ this._pPlaceholder = element.append("div");
82
+ PWidget.attach(this._dock, this._pPlaceholder.node());
83
+ }
84
+
85
+ _prevHideSingleTabs;
86
+ update(domNode, element) {
87
+ super.update(domNode, element);
88
+
89
+ this._pPlaceholder
90
+ .style("width", this.width() + "px")
91
+ .style("height", this.height() + "px")
92
+ .style("overflow", "hidden")
93
+ ;
94
+
95
+ element.select(".p-Widget")
96
+ .style("width", this._pPlaceholder.node().clientWidth + "px")
97
+ .style("height", this.height() + "px")
98
+ ;
99
+
100
+ this.widgets().forEach(w => w.render());
101
+ }
102
+
103
+ exit(domNode, element) {
104
+ [...this.widgets()].forEach(w => this.removeWidget(w));
105
+ super.exit(domNode, element);
106
+ }
107
+
108
+ render(callback?: (w: Widget) => void): this {
109
+ const context = this;
110
+ if (this._layoutObj !== null) {
111
+ this.layout(this._layoutObj);
112
+ this.layoutObj(null);
113
+ }
114
+ return super.render((w) => {
115
+ this._dock.content().watchRendered(this, callback);
116
+ this._dock.update();
117
+ setTimeout(() => {
118
+ const tabBars = this.element().selectAll(".p-Widget.p-TabBar.p-DockPanel-tabBar");
119
+ let refit = false;
120
+ tabBars.each(function () {
121
+ const tabBar = d3Select(this);
122
+ const tabsCount = (tabBar.node() as HTMLElement).childNodes[0].childNodes.length;
123
+ const hide = context.hideSingleTabs() && tabsCount === 1;
124
+ if (hide !== tabBar.classed("hide")) {
125
+ tabBar.classed("hide", hide);
126
+ refit = true;
127
+ }
128
+ });
129
+ if (refit) {
130
+ this._dock.fit();
131
+ }
132
+ }, 0);
133
+ });
134
+ }
135
+
136
+ refit() {
137
+ this._dock.fit();
138
+ }
139
+
140
+ // Phosphor Messaging ---
141
+ messageHook(handler: IMessageHandler, msg: Message): boolean {
142
+ if (handler === this) {
143
+ this.processMessage(msg);
144
+ }
145
+ return true;
146
+ }
147
+
148
+ private _lazyLayoutChanged = Utility.debounce(async () => {
149
+ this.layoutChanged();
150
+ }, 1000);
151
+
152
+ _prevActive: Widget;
153
+ processMessage(msg: Message): void {
154
+ switch (msg.type) {
155
+ case Msg.WAActivateRequest.type:
156
+ const wa = (msg as Msg.WAActivateRequest).wa;
157
+ const widget = wa.widget;
158
+ if (this._prevActive !== widget) {
159
+ this._prevActive = widget;
160
+ this.childActivation(widget, wa);
161
+ }
162
+ break;
163
+ case Msg.WALayoutChanged.type:
164
+ this._lazyLayoutChanged();
165
+ break;
166
+ }
167
+ }
168
+
169
+ active(): Widget {
170
+ return this._prevActive;
171
+ }
172
+
173
+ // Events ---
174
+ childActivation(w: Widget, wa: WidgetAdapter) {
175
+ }
176
+
177
+ layoutChanged() {
178
+ }
179
+ }
180
+ DockPanel.prototype._class += " phosphor_DockPanel";
181
+
182
+ export interface DockPanel {
183
+ hideSingleTabs(): boolean;
184
+ hideSingleTabs(_: boolean): this;
185
+ }
186
+
187
+ DockPanel.prototype.publish("hideSingleTabs", false, "boolean");