@interopio/workspaces-api 3.2.2 → 3.3.0
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/dist/workspaces.es.js +1 -1
- package/dist/workspaces.umd.js +1 -1
- package/dist/workspaces.umd.min.js +1 -1
- package/package.json +3 -3
- package/rollup.config.js +0 -54
- package/src/builders/baseBuilder.ts +0 -50
- package/src/builders/parentBuilder.ts +0 -62
- package/src/builders/workspaceBuilder.ts +0 -102
- package/src/communication/bridge.ts +0 -263
- package/src/communication/constants.ts +0 -202
- package/src/communication/interop-transport.ts +0 -175
- package/src/controllers/base.ts +0 -487
- package/src/controllers/main.ts +0 -541
- package/src/controllers/shortcuts.ts +0 -28
- package/src/index.ts +0 -23
- package/src/main.ts +0 -415
- package/src/models/base/base.ts +0 -397
- package/src/models/column.ts +0 -187
- package/src/models/frame.ts +0 -368
- package/src/models/group.ts +0 -237
- package/src/models/row.ts +0 -188
- package/src/models/window.ts +0 -309
- package/src/models/workspace.ts +0 -717
- package/src/shared/decoders.ts +0 -940
- package/src/shared/ioc.ts +0 -227
- package/src/shared/privateDataManager.ts +0 -93
- package/src/shared/promisePlus.ts +0 -34
- package/src/shared/promiseWrapper.ts +0 -11
- package/src/types/builders.ts +0 -10
- package/src/types/controller.ts +0 -79
- package/src/types/glue.ts +0 -37
- package/src/types/ioc.ts +0 -33
- package/src/types/privateData.ts +0 -92
- package/src/types/protocol.ts +0 -453
- package/src/types/subscription.ts +0 -31
- package/temp.d.ts +0 -49
- package/tsconfig.json +0 -10
package/src/models/frame.ts
DELETED
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
import { checkThrowCallback, nonEmptyStringDecoder, restoreWorkspaceConfigDecoder, workspaceDefinitionDecoder, workspaceBuilderCreateConfigDecoder, resizeConfigDecoder, moveConfigDecoder, frameInitConfigDecoder } from "../shared/decoders";
|
|
2
|
-
import { SubscriptionConfig } from "../types/subscription";
|
|
3
|
-
import { PrivateDataManager } from "../shared/privateDataManager";
|
|
4
|
-
import { FrameStreamData, WorkspaceStreamData, WindowStreamData } from "../types/protocol";
|
|
5
|
-
import { IOConnectWorkspaces } from "../../workspaces.d";
|
|
6
|
-
import { FramePrivateData } from "../types/privateData";
|
|
7
|
-
import { UnsubscribeFunction } from "callback-registry";
|
|
8
|
-
|
|
9
|
-
interface PrivateData {
|
|
10
|
-
manager: PrivateDataManager;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const data = new WeakMap<Frame, PrivateData>();
|
|
14
|
-
|
|
15
|
-
const getData = (model: Frame): FramePrivateData => {
|
|
16
|
-
return data.get(model).manager.getFrameData(model);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export class Frame implements IOConnectWorkspaces.Frame {
|
|
20
|
-
|
|
21
|
-
constructor(dataManager: PrivateDataManager) {
|
|
22
|
-
data.set(this, { manager: dataManager });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public async registerShortcut(shortcut: string, callback: () => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
26
|
-
nonEmptyStringDecoder.runWithException(shortcut);
|
|
27
|
-
checkThrowCallback(callback);
|
|
28
|
-
const myId = getData(this).summary.id;
|
|
29
|
-
const unsubscribe = await getData(this).controller.registerShortcut(shortcut, myId, callback);
|
|
30
|
-
return unsubscribe;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public get id(): string {
|
|
34
|
-
return getData(this).summary.id;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public get isInitialized(): boolean {
|
|
38
|
-
return getData(this).summary.isInitialized;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public getBounds(): Promise<IOConnectWorkspaces.FrameBounds> {
|
|
42
|
-
const myId = getData(this).summary.id;
|
|
43
|
-
|
|
44
|
-
return getData(this).controller.getFrameBounds(myId);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public async resize(config: IOConnectWorkspaces.ResizeConfig): Promise<void> {
|
|
48
|
-
const validatedConfig = resizeConfigDecoder.runWithException(config);
|
|
49
|
-
const myId = getData(this).summary.id;
|
|
50
|
-
|
|
51
|
-
return getData(this).controller.resizeItem(myId, validatedConfig);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public async move(config: IOConnectWorkspaces.MoveConfig): Promise<void> {
|
|
55
|
-
const validatedConfig = moveConfigDecoder.runWithException(config);
|
|
56
|
-
|
|
57
|
-
const myId = getData(this).summary.id;
|
|
58
|
-
return getData(this).controller.moveFrame(myId, validatedConfig);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public focus(): Promise<void> {
|
|
62
|
-
const myId = getData(this).summary.id;
|
|
63
|
-
return getData(this).controller.focusItem(myId);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public async state(): Promise<IOConnectWorkspaces.FrameState> {
|
|
67
|
-
const desktopGlobal = (window as any).glue42gd || (window as any).iodesktop;
|
|
68
|
-
|
|
69
|
-
if (!desktopGlobal) {
|
|
70
|
-
throw new Error("State operations are not supported in IO Connect Browser");
|
|
71
|
-
}
|
|
72
|
-
const myId = getData(this).summary.id;
|
|
73
|
-
return getData(this).controller.getFrameState(myId);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public async minimize(): Promise<void> {
|
|
77
|
-
const desktopGlobal = (window as any).glue42gd || (window as any).iodesktop;
|
|
78
|
-
|
|
79
|
-
if (!desktopGlobal) {
|
|
80
|
-
throw new Error("State operations are not supported in IO Connect Browser");
|
|
81
|
-
}
|
|
82
|
-
const myId = getData(this).summary.id;
|
|
83
|
-
return getData(this).controller.changeFrameState(myId, "minimized");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public async maximize(): Promise<void> {
|
|
87
|
-
const desktopGlobal = (window as any).glue42gd || (window as any).iodesktop;
|
|
88
|
-
|
|
89
|
-
if (!desktopGlobal) {
|
|
90
|
-
throw new Error("State operations are not supported in IO Connect Browser");
|
|
91
|
-
}
|
|
92
|
-
const myId = getData(this).summary.id;
|
|
93
|
-
return getData(this).controller.changeFrameState(myId, "maximized");
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public async restore(): Promise<void> {
|
|
97
|
-
const desktopGlobal = (window as any).glue42gd || (window as any).iodesktop;
|
|
98
|
-
|
|
99
|
-
if (!desktopGlobal) {
|
|
100
|
-
throw new Error("State operations are not supported in IO Connect Browser");
|
|
101
|
-
}
|
|
102
|
-
const myId = getData(this).summary.id;
|
|
103
|
-
return getData(this).controller.changeFrameState(myId, "normal");
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public close(): Promise<void> {
|
|
107
|
-
const myId = getData(this).summary.id;
|
|
108
|
-
return getData(this).controller.closeItem(myId);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public snapshot(): Promise<IOConnectWorkspaces.FrameSnapshot> {
|
|
112
|
-
const myId = getData(this).summary.id;
|
|
113
|
-
return getData(this).controller.getSnapshot(myId, "frame") as Promise<IOConnectWorkspaces.FrameSnapshot>;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public async workspaces(): Promise<IOConnectWorkspaces.Workspace[]> {
|
|
117
|
-
const controller = getData(this).controller;
|
|
118
|
-
return controller.getWorkspacesByFrameId(this.id);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public async getConstraints(): Promise<IOConnectWorkspaces.FrameConstraints> {
|
|
122
|
-
const controller = getData(this).controller;
|
|
123
|
-
const myId = getData(this).summary.id;
|
|
124
|
-
|
|
125
|
-
return controller.getFrameConstraints(myId);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public async restoreWorkspace(name: string, options?: IOConnectWorkspaces.RestoreWorkspaceConfig): Promise<IOConnectWorkspaces.Workspace> {
|
|
129
|
-
nonEmptyStringDecoder.runWithException(name);
|
|
130
|
-
const validatedOptions = restoreWorkspaceConfigDecoder.runWithException(options);
|
|
131
|
-
|
|
132
|
-
return getData(this).controller.restoreWorkspace(name, validatedOptions);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
public createWorkspace(definition: IOConnectWorkspaces.WorkspaceDefinition, config?: IOConnectWorkspaces.WorkspaceCreateConfig): Promise<IOConnectWorkspaces.Workspace> {
|
|
136
|
-
const validatedDefinition = workspaceDefinitionDecoder.runWithException(definition);
|
|
137
|
-
const validatedConfig = workspaceBuilderCreateConfigDecoder.runWithException(config);
|
|
138
|
-
|
|
139
|
-
return getData(this).controller.createWorkspace(validatedDefinition, validatedConfig);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
public async init(config: IOConnectWorkspaces.FrameInitializationConfig): Promise<void> {
|
|
143
|
-
frameInitConfigDecoder.runWithException(config);
|
|
144
|
-
|
|
145
|
-
if (getData(this).summary.isInitialized) {
|
|
146
|
-
throw new Error("The frame has already been initialized");
|
|
147
|
-
}
|
|
148
|
-
return getData(this).controller.initFrame(this.id, config);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public async onClosed(callback: (closed: IOConnectWorkspaces.FrameClosedData) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
152
|
-
checkThrowCallback(callback);
|
|
153
|
-
const myId = getData(this).summary.id;
|
|
154
|
-
|
|
155
|
-
const wrappedCallback = (payload: FrameStreamData): void => {
|
|
156
|
-
callback({ frameId: payload.frameSummary.id, frameBounds: payload.frameBounds });
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const config: SubscriptionConfig = {
|
|
160
|
-
callback: wrappedCallback,
|
|
161
|
-
action: "closed",
|
|
162
|
-
eventType: "frame",
|
|
163
|
-
scope: "frame"
|
|
164
|
-
};
|
|
165
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
166
|
-
return unsubscribe;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
public async onMaximized(callback: () => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
170
|
-
checkThrowCallback(callback);
|
|
171
|
-
const myId = getData(this).summary.id;
|
|
172
|
-
|
|
173
|
-
const wrappedCallback = (): void => {
|
|
174
|
-
callback();
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const config: SubscriptionConfig = {
|
|
178
|
-
callback: wrappedCallback,
|
|
179
|
-
action: "maximized",
|
|
180
|
-
eventType: "frame",
|
|
181
|
-
scope: "frame"
|
|
182
|
-
};
|
|
183
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
184
|
-
return unsubscribe;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
public async onMinimized(callback: () => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
188
|
-
checkThrowCallback(callback);
|
|
189
|
-
const myId = getData(this).summary.id;
|
|
190
|
-
|
|
191
|
-
const wrappedCallback = (): void => {
|
|
192
|
-
callback();
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const config: SubscriptionConfig = {
|
|
196
|
-
callback: wrappedCallback,
|
|
197
|
-
action: "minimized",
|
|
198
|
-
eventType: "frame",
|
|
199
|
-
scope: "frame"
|
|
200
|
-
};
|
|
201
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
202
|
-
return unsubscribe;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
public async onNormal(callback: () => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
206
|
-
checkThrowCallback(callback);
|
|
207
|
-
const myId = getData(this).summary.id;
|
|
208
|
-
|
|
209
|
-
const wrappedCallback = (): void => {
|
|
210
|
-
callback();
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
const config: SubscriptionConfig = {
|
|
214
|
-
callback: wrappedCallback,
|
|
215
|
-
action: "normal",
|
|
216
|
-
eventType: "frame",
|
|
217
|
-
scope: "frame"
|
|
218
|
-
};
|
|
219
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
220
|
-
return unsubscribe;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
public async onWorkspaceOpened(callback: (workspace: IOConnectWorkspaces.Workspace) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
224
|
-
checkThrowCallback(callback);
|
|
225
|
-
const myId = getData(this).summary.id;
|
|
226
|
-
|
|
227
|
-
const wrappedCallback = async (payload: WorkspaceStreamData): Promise<void> => {
|
|
228
|
-
const workspace = await getData(this).controller.transformStreamPayloadToWorkspace(payload);
|
|
229
|
-
callback(workspace);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const config: SubscriptionConfig = {
|
|
233
|
-
callback: wrappedCallback,
|
|
234
|
-
action: "opened",
|
|
235
|
-
eventType: "workspace",
|
|
236
|
-
scope: "frame"
|
|
237
|
-
};
|
|
238
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
239
|
-
return unsubscribe;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
public async onWorkspaceSelected(callback: (workspace: IOConnectWorkspaces.Workspace) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
243
|
-
checkThrowCallback(callback);
|
|
244
|
-
const myId = getData(this).summary.id;
|
|
245
|
-
|
|
246
|
-
const wrappedCallback = async (payload: WorkspaceStreamData): Promise<void> => {
|
|
247
|
-
const workspace = await getData(this).controller.getWorkspaceById(payload.workspaceSummary.id);
|
|
248
|
-
callback(workspace);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const config: SubscriptionConfig = {
|
|
252
|
-
callback: wrappedCallback,
|
|
253
|
-
action: "selected",
|
|
254
|
-
eventType: "workspace",
|
|
255
|
-
scope: "frame"
|
|
256
|
-
};
|
|
257
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
258
|
-
return unsubscribe;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
public async onWorkspaceClosed(callback: (closed: IOConnectWorkspaces.WorkspaceClosedData) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
262
|
-
checkThrowCallback(callback);
|
|
263
|
-
const myId = getData(this).summary.id;
|
|
264
|
-
|
|
265
|
-
const wrappedCallback = (payload: WorkspaceStreamData): void => {
|
|
266
|
-
callback({ frameId: payload.frameSummary.id, workspaceId: payload.workspaceSummary.id, frameBounds: payload.frameBounds });
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const config: SubscriptionConfig = {
|
|
270
|
-
callback: wrappedCallback,
|
|
271
|
-
action: "closed",
|
|
272
|
-
eventType: "workspace",
|
|
273
|
-
scope: "frame"
|
|
274
|
-
};
|
|
275
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
276
|
-
return unsubscribe;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
public async onWindowAdded(callback: (window: IOConnectWorkspaces.WorkspaceWindow) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
280
|
-
checkThrowCallback(callback);
|
|
281
|
-
const myId = getData(this).summary.id;
|
|
282
|
-
|
|
283
|
-
const wrappedCallback = async (payload: WindowStreamData): Promise<void> => {
|
|
284
|
-
const foundParent = await getData(this).controller.getParent((parent) => parent.id === payload.windowSummary.parentId);
|
|
285
|
-
const foundWindow = foundParent.children.find((child) => child.type === "window" && child.positionIndex === payload.windowSummary.config.positionIndex);
|
|
286
|
-
callback(foundWindow as IOConnectWorkspaces.WorkspaceWindow);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const config: SubscriptionConfig = {
|
|
290
|
-
callback: wrappedCallback,
|
|
291
|
-
action: "added",
|
|
292
|
-
eventType: "window",
|
|
293
|
-
scope: "frame"
|
|
294
|
-
};
|
|
295
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
296
|
-
return unsubscribe;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
public async onWindowRemoved(callback: (removed: { windowId?: string; workspaceId: string; frameId: string }) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
300
|
-
checkThrowCallback(callback);
|
|
301
|
-
const myId = getData(this).summary.id;
|
|
302
|
-
|
|
303
|
-
const wrappedCallback = (payload: WindowStreamData): void => {
|
|
304
|
-
const { windowId, workspaceId, frameId } = payload.windowSummary.config;
|
|
305
|
-
callback({ windowId, workspaceId, frameId });
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
const config: SubscriptionConfig = {
|
|
309
|
-
callback: wrappedCallback,
|
|
310
|
-
action: "removed",
|
|
311
|
-
eventType: "window",
|
|
312
|
-
scope: "frame"
|
|
313
|
-
};
|
|
314
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
315
|
-
return unsubscribe;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
public async onWindowLoaded(callback: (window: IOConnectWorkspaces.WorkspaceWindow) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
319
|
-
checkThrowCallback(callback);
|
|
320
|
-
const myId = getData(this).summary.id;
|
|
321
|
-
|
|
322
|
-
const wrappedCallback = async (payload: WindowStreamData): Promise<void> => {
|
|
323
|
-
const foundParent = await getData(this).controller.getParent((parent) => {
|
|
324
|
-
return parent.id === payload.windowSummary.parentId;
|
|
325
|
-
});
|
|
326
|
-
const foundWindow = foundParent.children.find((child) => child.type === "window" && child.positionIndex === payload.windowSummary.config.positionIndex);
|
|
327
|
-
callback(foundWindow as IOConnectWorkspaces.WorkspaceWindow);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const config: SubscriptionConfig = {
|
|
331
|
-
callback: wrappedCallback,
|
|
332
|
-
action: "loaded",
|
|
333
|
-
eventType: "window",
|
|
334
|
-
scope: "frame"
|
|
335
|
-
};
|
|
336
|
-
const unsubscribe = await getData(this).controller.processLocalSubscription(config, myId);
|
|
337
|
-
return unsubscribe;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
public async onInitializationRequested(callback: (context?: IOConnectWorkspaces.FrameInitializationContext) => void): Promise<UnsubscribeFunction> {
|
|
341
|
-
checkThrowCallback(callback);
|
|
342
|
-
|
|
343
|
-
if (!this.isInitialized) {
|
|
344
|
-
callback(getData(this).summary.initializationContext);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
return () => {};
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
public async onFocusChanged(callback: (data: IOConnectWorkspaces.FrameFocusChangedData) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
351
|
-
checkThrowCallback(callback);
|
|
352
|
-
const myData = getData(this);
|
|
353
|
-
const { id } = myData.summary;
|
|
354
|
-
|
|
355
|
-
const wrappedCallback = (args: FrameStreamData): void => {
|
|
356
|
-
callback({ isFocused: args.frameSummary.isFocused });
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
const config: SubscriptionConfig = {
|
|
360
|
-
callback: wrappedCallback,
|
|
361
|
-
action: "focus",
|
|
362
|
-
eventType: "frame",
|
|
363
|
-
scope: "frame"
|
|
364
|
-
};
|
|
365
|
-
const unsubscribe = await myData.controller.processLocalSubscription(config, id);
|
|
366
|
-
return unsubscribe;
|
|
367
|
-
}
|
|
368
|
-
}
|
package/src/models/group.ts
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { Base } from "./base/base";
|
|
2
|
-
import { IOConnectWorkspaces } from "../../workspaces.d";
|
|
3
|
-
import { checkThrowCallback, elementResizeConfigDecoder, groupLockConfigDecoder } from "../shared/decoders";
|
|
4
|
-
import { SubscriptionConfig } from "../types/subscription";
|
|
5
|
-
|
|
6
|
-
interface PrivateData {
|
|
7
|
-
base: Base;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const privateData = new WeakMap<Group, PrivateData>();
|
|
11
|
-
|
|
12
|
-
const getBase = (model: Group): Base => {
|
|
13
|
-
return privateData.get(model).base;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export class Group implements IOConnectWorkspaces.Group {
|
|
17
|
-
|
|
18
|
-
constructor(base: Base) {
|
|
19
|
-
privateData.set(this, { base });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public get type(): "group" {
|
|
23
|
-
return "group";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public get id(): string {
|
|
27
|
-
return getBase(this).getId(this);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public get frameId(): string {
|
|
31
|
-
return getBase(this).getFrameId(this);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public get workspaceId(): string {
|
|
35
|
-
return getBase(this).getWorkspaceId(this);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public get positionIndex(): number {
|
|
39
|
-
return getBase(this).getPositionIndex(this);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public get children(): IOConnectWorkspaces.WorkspaceElement[] {
|
|
43
|
-
return getBase(this).getAllChildren(this);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public get parent(): IOConnectWorkspaces.Workspace | IOConnectWorkspaces.WorkspaceBox {
|
|
47
|
-
return getBase(this).getMyParent(this);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public get frame(): IOConnectWorkspaces.Frame {
|
|
51
|
-
return getBase(this).getMyFrame(this);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public get workspace(): IOConnectWorkspaces.Workspace {
|
|
55
|
-
return getBase(this).getMyWorkspace(this);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public get allowExtract(): boolean {
|
|
59
|
-
return getBase(this).getAllowExtract(this);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public get allowReorder(): boolean {
|
|
63
|
-
return getBase(this).getAllowReorder(this);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public get allowDropLeft(): boolean {
|
|
67
|
-
return getBase(this).getAllowDropLeft(this);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public get allowDropRight(): boolean {
|
|
71
|
-
return getBase(this).getAllowDropRight(this);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public get allowDropTop(): boolean {
|
|
75
|
-
return getBase(this).getAllowDropTop(this);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public get allowDropBottom(): boolean {
|
|
79
|
-
return getBase(this).getAllowDropBottom(this);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public get allowDropHeader(): boolean {
|
|
83
|
-
return getBase(this).getAllowDropHeader(this);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public get allowDrop(): boolean {
|
|
87
|
-
return getBase(this).getAllowDrop(this);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public get showMaximizeButton(): boolean {
|
|
91
|
-
return getBase(this).getShowMaximizeButton(this);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public get showEjectButton(): boolean {
|
|
95
|
-
return getBase(this).getShowEjectButton(this);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public get showAddWindowButton(): boolean {
|
|
99
|
-
return getBase(this).getShowAddWindowButton(this);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public get minWidth(): number {
|
|
103
|
-
return getBase(this).getMinWidth(this);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public get minHeight(): number {
|
|
107
|
-
return getBase(this).getMinHeight(this);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public get maxWidth(): number {
|
|
111
|
-
return getBase(this).getMaxWidth(this);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public get maxHeight(): number {
|
|
115
|
-
return getBase(this).getMaxHeight(this);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public get width(): number {
|
|
119
|
-
return getBase(this).getWidthInPx(this);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public get height(): number {
|
|
123
|
-
return getBase(this).getHeightInPx(this);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public get isMaximized(): boolean {
|
|
127
|
-
return getBase(this).getIsMaximized(this);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public addWindow(definition: IOConnectWorkspaces.WorkspaceWindowDefinition): Promise<IOConnectWorkspaces.WorkspaceWindow> {
|
|
131
|
-
return getBase(this).addWindow(this, definition, "group");
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public async addGroup(): Promise<Group> {
|
|
135
|
-
throw new Error("Adding groups as group child is not supported");
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
public async addColumn(): Promise<IOConnectWorkspaces.Column> {
|
|
139
|
-
throw new Error("Adding columns as group child is not supported");
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
public async addRow(): Promise<IOConnectWorkspaces.Row> {
|
|
143
|
-
throw new Error("Adding rows as group child is not supported");
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public removeChild(predicate: (child: IOConnectWorkspaces.WorkspaceElement) => boolean): Promise<void> {
|
|
147
|
-
return getBase(this).removeChild(this, predicate);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
public maximize(): Promise<void> {
|
|
151
|
-
return getBase(this).maximize(this);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public restore(): Promise<void> {
|
|
155
|
-
return getBase(this).restore(this);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
public close(): Promise<void> {
|
|
159
|
-
return getBase(this).close(this);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
public lock(config?: IOConnectWorkspaces.GroupLockConfig | ((config: IOConnectWorkspaces.GroupLockConfig) => IOConnectWorkspaces.GroupLockConfig)): Promise<void> {
|
|
163
|
-
let lockConfigResult = undefined;
|
|
164
|
-
|
|
165
|
-
if (typeof config === "function") {
|
|
166
|
-
const currentLockConfig = {
|
|
167
|
-
allowDrop: this.allowDrop,
|
|
168
|
-
allowDropHeader: this.allowDropHeader,
|
|
169
|
-
allowDropLeft: this.allowDropLeft,
|
|
170
|
-
allowDropRight: this.allowDropRight,
|
|
171
|
-
allowDropTop: this.allowDropTop,
|
|
172
|
-
allowDropBottom: this.allowDropBottom,
|
|
173
|
-
allowExtract: this.allowExtract,
|
|
174
|
-
allowReorder: this.allowReorder,
|
|
175
|
-
showAddWindowButton: this.showAddWindowButton,
|
|
176
|
-
showEjectButton: this.showEjectButton,
|
|
177
|
-
showMaximizeButton: this.showMaximizeButton
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
lockConfigResult = config(currentLockConfig);
|
|
181
|
-
} else {
|
|
182
|
-
lockConfigResult = config;
|
|
183
|
-
}
|
|
184
|
-
const verifiedConfig = lockConfigResult === undefined ? undefined : groupLockConfigDecoder.runWithException(lockConfigResult);
|
|
185
|
-
return getBase(this).lockContainer(this, verifiedConfig);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public async setSize(config: IOConnectWorkspaces.ElementResizeConfig): Promise<void> {
|
|
189
|
-
const verifiedConfig = elementResizeConfigDecoder.runWithException(config);
|
|
190
|
-
|
|
191
|
-
if (!verifiedConfig.width && !verifiedConfig.height) {
|
|
192
|
-
throw new Error("Expected either width or height to be passed.");
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return getBase(this).setSize(this, config.width, config.height);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
public async bundleToRow(): Promise<void> {
|
|
200
|
-
await getBase(this).bundleTo(this, "row");
|
|
201
|
-
await this.workspace.refreshReference();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
public async bundleToColumn(): Promise<void> {
|
|
205
|
-
await getBase(this).bundleTo(this, "column");
|
|
206
|
-
await this.workspace.refreshReference();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public async onLockConfigurationChanged(callback: (config: IOConnectWorkspaces.GroupLockConfig) => void): Promise<IOConnectWorkspaces.Unsubscribe> {
|
|
210
|
-
checkThrowCallback(callback);
|
|
211
|
-
const wrappedCallback = async (): Promise<void> => {
|
|
212
|
-
await this.workspace.refreshReference();
|
|
213
|
-
callback({
|
|
214
|
-
allowDrop: this.allowDrop,
|
|
215
|
-
allowDropHeader: this.allowDropHeader,
|
|
216
|
-
allowDropLeft: this.allowDropLeft,
|
|
217
|
-
allowDropTop: this.allowDropTop,
|
|
218
|
-
allowDropRight: this.allowDropRight,
|
|
219
|
-
allowDropBottom: this.allowDropBottom,
|
|
220
|
-
allowExtract: this.allowExtract,
|
|
221
|
-
allowReorder: this.allowReorder,
|
|
222
|
-
showAddWindowButton: this.showAddWindowButton,
|
|
223
|
-
showEjectButton: this.showEjectButton,
|
|
224
|
-
showMaximizeButton: this.showMaximizeButton
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
const config: SubscriptionConfig = {
|
|
228
|
-
callback: wrappedCallback,
|
|
229
|
-
action: "lock-configuration-changed",
|
|
230
|
-
eventType: "container",
|
|
231
|
-
scope: "container"
|
|
232
|
-
};
|
|
233
|
-
const unsubscribe = await getBase(this).processLocalSubscription(this, config);
|
|
234
|
-
return unsubscribe;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
}
|