@owdproject/core 3.1.3 → 3.1.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/CHANGELOG.md +25 -0
- package/README.md +6 -7
- package/bin/owd.js +14 -14
- package/index.ts +5 -2
- package/module.ts +78 -61
- package/package.json +19 -17
- package/project.json +4 -0
- package/runtime/components/Core/Application/CoreApplicationRender.vue +6 -5
- package/runtime/components/Core/Application/CoreApplicationWindowsRender.vue +8 -8
- package/runtime/components/Core/Background/CoreBackground.vue +1 -1
- package/runtime/components/Core/Desktop/CoreDesktop.vue +31 -24
- package/runtime/components/Core/Explorer/CoreExplorerFile.vue +47 -38
- package/runtime/components/Core/Explorer/CoreExplorerFolder.vue +0 -1
- package/runtime/components/Core/Time/CoreTime.vue +10 -7
- package/runtime/components/Core/Window/CoreWindow.vue +49 -35
- package/runtime/components/Core/Window/CoreWindowContent.vue +3 -5
- package/runtime/components/Core/Window/CoreWindowNav.vue +12 -7
- package/runtime/composables/useApplicationEntries.ts +51 -0
- package/runtime/composables/useApplicationManager.ts +278 -5
- package/runtime/composables/useDesktopManager.ts +22 -4
- package/runtime/composables/useTerminalManager.ts +63 -4
- package/runtime/core/controllers/ApplicationController.ts +203 -192
- package/runtime/core/controllers/WindowController.ts +342 -334
- package/runtime/plugins/resize.client.ts +4 -4
- package/runtime/stores/storeApplication.ts +236 -0
- package/runtime/stores/storeApplicationMeta.ts +12 -8
- package/runtime/stores/storeApplicationWindows.ts +16 -12
- package/runtime/stores/storeDesktop.ts +35 -29
- package/runtime/stores/storeDesktopDefaultApps.ts +53 -0
- package/runtime/stores/storeDesktopVolume.ts +12 -12
- package/runtime/stores/storeDesktopWindow.ts +13 -13
- package/runtime/stores/storeDesktopWorkspace.ts +35 -31
- package/runtime/utils/utilApp.ts +27 -22
- package/runtime/utils/utilCommon.ts +43 -43
- package/runtime/utils/utilDebug.ts +17 -17
- package/runtime/utils/utilDesktop.ts +4 -4
- package/runtime/utils/utilTerminal.ts +6 -5
- package/runtime/utils/utilWindow.ts +11 -11
- package/test/fixtures/basic/app.vue +1 -2
- package/test/fixtures/basic/nuxt.config.ts +1 -3
- package/tsconfig.app.json +1 -1
- package/tsconfig.json +1 -1
- package/types/index.d.ts +235 -207
- package/vitest.config.ts +3 -3
- package/eslint.config.mjs +0 -30
- package/runtime/composables/useAppEntries.ts +0 -36
- package/runtime/composables/useClipboardFs.ts +0 -25
- package/runtime/core/managers/ApplicationManager.ts +0 -237
- package/runtime/core/managers/DesktopManager.ts +0 -37
- package/runtime/core/managers/TerminalManager.ts +0 -44
|
@@ -5,455 +5,463 @@ import { markRaw } from '@vue/reactivity'
|
|
|
5
5
|
import { defineAsyncComponent } from 'vue'
|
|
6
6
|
|
|
7
7
|
export class WindowController implements IWindowController {
|
|
8
|
-
|
|
8
|
+
public readonly application: IApplicationController
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
public readonly instanced: boolean = true
|
|
11
|
+
public readonly model: string
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
public config: WindowConfig = {
|
|
14
|
+
title: '',
|
|
15
|
+
category: '',
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
component: undefined,
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
// position
|
|
20
|
+
position: {
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
z: 0,
|
|
24
|
+
},
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
// sizes
|
|
27
|
+
size: {
|
|
28
|
+
width: undefined,
|
|
29
|
+
height: undefined,
|
|
30
|
+
},
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// minimize
|
|
33
|
+
minimizable: true,
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
// maximize
|
|
36
|
+
maximized: false,
|
|
37
|
+
maximizable: false,
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// destroy
|
|
40
|
+
destroyable: true,
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// draggable
|
|
43
|
+
draggable: true,
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
// resizable
|
|
46
|
+
resizable: true,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public override: WindowOverride = {}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
private storedState: WindowStoredState
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
constructor(
|
|
54
|
+
application: IApplicationController,
|
|
55
|
+
model: string,
|
|
56
|
+
windowConfig: WindowConfig,
|
|
57
|
+
windowStoredState: WindowStoredState,
|
|
58
|
+
) {
|
|
59
|
+
this.application = application
|
|
60
|
+
this.model = model
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
application: IApplicationController,
|
|
55
|
-
model: string,
|
|
56
|
-
windowConfig: WindowConfig,
|
|
57
|
-
windowStoredState: WindowStoredState,
|
|
58
|
-
) {
|
|
59
|
-
this.application = application
|
|
60
|
-
this.model = model
|
|
62
|
+
this.storedState = windowStoredState
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
this.setConfig(windowConfig)
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
this.restoreState()
|
|
67
|
+
}
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
private setConfig(config: WindowConfig) {
|
|
70
|
+
// component
|
|
71
|
+
if (config.component) {
|
|
72
|
+
this.config.component = markRaw(defineAsyncComponent(config.component))
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.config.component = markRaw(
|
|
73
|
-
defineAsyncComponent(config.component),
|
|
74
|
-
)
|
|
75
|
-
}
|
|
75
|
+
// title
|
|
76
|
+
if (config.title) this.config.title = config.title
|
|
77
|
+
if (config.icon) this.config.icon = config.icon
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!this.config.position) this.config.position = { x: 0, y: 0, z: 0 }
|
|
83
|
-
if (config.position?.x) this.config.position.x = config.position.x
|
|
84
|
-
if (config.position?.y) this.config.position.y = config.position.y
|
|
85
|
-
if (config.position?.z) this.config.position.z = config.position.z
|
|
86
|
-
|
|
87
|
-
// sizes
|
|
88
|
-
if (config.size?.width) this.config.size.width = config.size.width
|
|
89
|
-
if (config.size?.height) this.config.size.height = config.size.height
|
|
90
|
-
if (config.size?.minWidth)
|
|
91
|
-
this.config.size.minWidth = config.size.minWidth
|
|
92
|
-
if (config.size?.minHeight)
|
|
93
|
-
this.config.size.minHeight = config.size.minHeight
|
|
94
|
-
if (config.size?.maxWidth)
|
|
95
|
-
this.config.size.maxWidth = config.size.maxWidth
|
|
96
|
-
if (config.size?.maxHeight)
|
|
97
|
-
this.config.size.maxHeight = config.size.maxHeight
|
|
98
|
-
|
|
99
|
-
// minimize
|
|
100
|
-
if (typeof config.minimizable !== 'undefined') {
|
|
101
|
-
this.config.minimizable = config.minimizable
|
|
102
|
-
}
|
|
103
|
-
if (typeof config.maximizable !== 'undefined') {
|
|
104
|
-
this.config.maximizable = config.maximizable
|
|
105
|
-
}
|
|
79
|
+
// position
|
|
80
|
+
if (!this.config.position) this.config.position = { x: 0, y: 0, z: 0 }
|
|
81
|
+
if (config.position?.x) this.config.position.x = config.position.x
|
|
82
|
+
if (config.position?.y) this.config.position.y = config.position.y
|
|
83
|
+
if (config.position?.z) this.config.position.z = config.position.z
|
|
106
84
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
85
|
+
// sizes
|
|
86
|
+
if (config.size?.width) this.config.size.width = config.size.width
|
|
87
|
+
if (config.size?.height) this.config.size.height = config.size.height
|
|
88
|
+
if (config.size?.minWidth) this.config.size.minWidth = config.size.minWidth
|
|
89
|
+
if (config.size?.minHeight)
|
|
90
|
+
this.config.size.minHeight = config.size.minHeight
|
|
91
|
+
if (config.size?.maxWidth) this.config.size.maxWidth = config.size.maxWidth
|
|
92
|
+
if (config.size?.maxHeight)
|
|
93
|
+
this.config.size.maxHeight = config.size.maxHeight
|
|
111
94
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
// minimize
|
|
96
|
+
if (typeof config.minimizable !== 'undefined') {
|
|
97
|
+
this.config.minimizable = config.minimizable
|
|
98
|
+
}
|
|
99
|
+
if (typeof config.maximizable !== 'undefined') {
|
|
100
|
+
this.config.maximizable = config.maximizable
|
|
101
|
+
}
|
|
116
102
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
103
|
+
// maximize
|
|
104
|
+
if (typeof config.maximized !== 'undefined') {
|
|
105
|
+
this.config.maximized = config.maximized
|
|
106
|
+
}
|
|
121
107
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
// draggable
|
|
109
|
+
if (typeof config.draggable !== 'undefined') {
|
|
110
|
+
this.config.draggable = config.draggable
|
|
111
|
+
}
|
|
126
112
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
size: false,
|
|
132
|
-
maximized: false,
|
|
133
|
-
destroyable: false,
|
|
134
|
-
minimizable: false,
|
|
135
|
-
maximizable: false,
|
|
136
|
-
}
|
|
113
|
+
// resizable
|
|
114
|
+
if (typeof config.resizable !== 'undefined') {
|
|
115
|
+
this.config.resizable = config.resizable
|
|
116
|
+
}
|
|
137
117
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
// destroy
|
|
119
|
+
if (typeof config.destroyable !== 'undefined') {
|
|
120
|
+
this.config.destroyable = config.destroyable
|
|
121
|
+
}
|
|
141
122
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
123
|
+
const DEFAULT_OVERRIDABLE = {
|
|
124
|
+
draggable: true,
|
|
125
|
+
resizable: false,
|
|
126
|
+
position: false,
|
|
127
|
+
size: false,
|
|
128
|
+
maximized: false,
|
|
129
|
+
destroyable: false,
|
|
130
|
+
minimizable: false,
|
|
131
|
+
maximizable: false,
|
|
146
132
|
}
|
|
147
133
|
|
|
148
|
-
|
|
134
|
+
DEFAULT_OVERRIDABLE.position = DEFAULT_OVERRIDABLE.draggable
|
|
135
|
+
DEFAULT_OVERRIDABLE.size = DEFAULT_OVERRIDABLE.resizable
|
|
136
|
+
DEFAULT_OVERRIDABLE.maximized = DEFAULT_OVERRIDABLE.maximizable
|
|
149
137
|
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
this.config.overridable = {
|
|
139
|
+
...DEFAULT_OVERRIDABLE,
|
|
140
|
+
...(config.overridable || {}),
|
|
152
141
|
}
|
|
142
|
+
}
|
|
153
143
|
|
|
154
|
-
|
|
155
|
-
const overridable = this.config.overridable || {}
|
|
144
|
+
// state
|
|
156
145
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
get state() {
|
|
147
|
+
return this.storedState.state
|
|
148
|
+
}
|
|
160
149
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.state[stateKey] = deepClone(this.config[stateKey])
|
|
164
|
-
} else {
|
|
165
|
-
this.state[stateKey] = !!this.config[stateKey]
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
150
|
+
private restoreState() {
|
|
151
|
+
const overridable = this.config.overridable || {}
|
|
171
152
|
|
|
172
|
-
|
|
153
|
+
for (const key in overridable) {
|
|
154
|
+
if (overridable[key as keyof typeof overridable]) {
|
|
155
|
+
const stateKey = key as keyof WindowState
|
|
173
156
|
|
|
174
|
-
|
|
175
|
-
|
|
157
|
+
if (typeof this.state[stateKey] === 'undefined') {
|
|
158
|
+
if (typeof this.config[stateKey] === 'object') {
|
|
159
|
+
this.state[stateKey] = deepClone(this.config[stateKey])
|
|
160
|
+
} else {
|
|
161
|
+
this.state[stateKey] = !!this.config[stateKey]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
176
165
|
}
|
|
166
|
+
}
|
|
177
167
|
|
|
178
|
-
|
|
168
|
+
private setState(state: WindowState) {
|
|
169
|
+
this.storedState.state = state
|
|
170
|
+
}
|
|
179
171
|
|
|
180
|
-
|
|
181
|
-
if (!this.state.position) {
|
|
182
|
-
this.state.position = { x: 0, y: 0 }
|
|
183
|
-
}
|
|
172
|
+
// meta
|
|
184
173
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
174
|
+
get meta() {
|
|
175
|
+
return this.storedState.meta
|
|
176
|
+
}
|
|
188
177
|
|
|
189
|
-
|
|
190
|
-
this.state.active = value
|
|
191
|
-
}
|
|
178
|
+
// position
|
|
192
179
|
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
public setPosition(data: { x: number; y: number }) {
|
|
181
|
+
if (!this.state.position) {
|
|
182
|
+
this.state.position = { x: 0, y: 0 }
|
|
195
183
|
}
|
|
196
184
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
this.state.position.x = data.x
|
|
186
|
+
this.state.position.y = data.y
|
|
187
|
+
}
|
|
200
188
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
public setActive(value: boolean) {
|
|
190
|
+
this.state.active = value
|
|
191
|
+
}
|
|
204
192
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
193
|
+
public setFocus(value: boolean) {
|
|
194
|
+
this.state.focused = value
|
|
195
|
+
}
|
|
209
196
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
197
|
+
public focus() {
|
|
198
|
+
const applicationManager = useApplicationManager()
|
|
199
|
+
const desktopWindowStore = useDesktopWindowStore()
|
|
214
200
|
|
|
215
|
-
|
|
201
|
+
if (!this.state.position) {
|
|
202
|
+
this.state.position = { x: 0, y: 0, z: 0 }
|
|
203
|
+
}
|
|
216
204
|
|
|
217
|
-
|
|
205
|
+
// already focused
|
|
206
|
+
if (this.state.focused) {
|
|
207
|
+
return
|
|
218
208
|
}
|
|
219
209
|
|
|
220
|
-
//
|
|
210
|
+
// set focus false on all other windows
|
|
211
|
+
for (const [windowId, window] of applicationManager.windowsOpened.value) {
|
|
212
|
+
window.actions.setFocus(false)
|
|
213
|
+
}
|
|
221
214
|
|
|
222
|
-
|
|
223
|
-
if (typeof this.override.title !== 'undefined') {
|
|
224
|
-
return this.override.title
|
|
225
|
-
}
|
|
215
|
+
this.setFocus(true)
|
|
226
216
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
this.state.position.z = desktopWindowStore.incrementPositionZ()
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// common
|
|
230
221
|
|
|
231
|
-
|
|
222
|
+
get title(): string {
|
|
223
|
+
if (typeof this.override.title !== 'undefined') {
|
|
224
|
+
return this.override.title
|
|
232
225
|
}
|
|
233
226
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
227
|
+
if (this.config.title) {
|
|
228
|
+
return this.config.title
|
|
229
|
+
}
|
|
238
230
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
231
|
+
return this.application.config.title
|
|
232
|
+
}
|
|
242
233
|
|
|
243
|
-
|
|
234
|
+
get icon() {
|
|
235
|
+
if (typeof this.override.icon !== 'undefined') {
|
|
236
|
+
return this.override.icon
|
|
244
237
|
}
|
|
245
238
|
|
|
246
|
-
|
|
239
|
+
if (this.config.icon) {
|
|
240
|
+
return this.config.icon
|
|
241
|
+
}
|
|
247
242
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
return this.application.config.icon
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// position
|
|
252
247
|
|
|
253
|
-
|
|
248
|
+
get position() {
|
|
249
|
+
if (typeof this.state.position === 'undefined') {
|
|
250
|
+
return this.config.position
|
|
254
251
|
}
|
|
255
252
|
|
|
256
|
-
|
|
253
|
+
return this.state.position
|
|
254
|
+
}
|
|
257
255
|
|
|
258
|
-
|
|
259
|
-
const stateSize = this.state.size || {}
|
|
260
|
-
const configSize = this.config.size || {}
|
|
261
|
-
|
|
262
|
-
return {
|
|
263
|
-
width:
|
|
264
|
-
typeof stateSize.width !== 'undefined'
|
|
265
|
-
? stateSize.width
|
|
266
|
-
: configSize.width,
|
|
267
|
-
height:
|
|
268
|
-
typeof stateSize.height !== 'undefined'
|
|
269
|
-
? stateSize.height
|
|
270
|
-
: configSize.height,
|
|
271
|
-
minWidth:
|
|
272
|
-
typeof stateSize.minWidth !== 'undefined'
|
|
273
|
-
? stateSize.minWidth
|
|
274
|
-
: configSize.minWidth,
|
|
275
|
-
maxWidth:
|
|
276
|
-
typeof stateSize.maxWidth !== 'undefined'
|
|
277
|
-
? stateSize.maxWidth
|
|
278
|
-
: configSize.maxWidth,
|
|
279
|
-
minHeight:
|
|
280
|
-
typeof stateSize.minHeight !== 'undefined'
|
|
281
|
-
? stateSize.minHeight
|
|
282
|
-
: configSize.minHeight,
|
|
283
|
-
maxHeight:
|
|
284
|
-
typeof stateSize.maxHeight !== 'undefined'
|
|
285
|
-
? stateSize.maxHeight
|
|
286
|
-
: (configSize.maxHeight ?? 600),
|
|
287
|
-
}
|
|
288
|
-
}
|
|
256
|
+
// sizes
|
|
289
257
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
258
|
+
get size() {
|
|
259
|
+
const stateSize = this.state.size || {}
|
|
260
|
+
const configSize = this.config.size || {}
|
|
294
261
|
|
|
295
|
-
|
|
296
|
-
|
|
262
|
+
return {
|
|
263
|
+
width:
|
|
264
|
+
typeof stateSize.width !== 'undefined'
|
|
265
|
+
? stateSize.width
|
|
266
|
+
: configSize.width,
|
|
267
|
+
height:
|
|
268
|
+
typeof stateSize.height !== 'undefined'
|
|
269
|
+
? stateSize.height
|
|
270
|
+
: configSize.height,
|
|
271
|
+
minWidth:
|
|
272
|
+
typeof stateSize.minWidth !== 'undefined'
|
|
273
|
+
? stateSize.minWidth
|
|
274
|
+
: configSize.minWidth,
|
|
275
|
+
maxWidth:
|
|
276
|
+
typeof stateSize.maxWidth !== 'undefined'
|
|
277
|
+
? stateSize.maxWidth
|
|
278
|
+
: configSize.maxWidth,
|
|
279
|
+
minHeight:
|
|
280
|
+
typeof stateSize.minHeight !== 'undefined'
|
|
281
|
+
? stateSize.minHeight
|
|
282
|
+
: configSize.minHeight,
|
|
283
|
+
maxHeight:
|
|
284
|
+
typeof stateSize.maxHeight !== 'undefined'
|
|
285
|
+
? stateSize.maxHeight
|
|
286
|
+
: configSize.maxHeight,
|
|
297
287
|
}
|
|
288
|
+
}
|
|
298
289
|
|
|
299
|
-
|
|
290
|
+
public setSize(data: { width: number; height: number }) {
|
|
291
|
+
if (!this.state.size) {
|
|
292
|
+
this.state.size = { width: undefined, height: undefined }
|
|
293
|
+
}
|
|
300
294
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
295
|
+
this.state.size.width = data.width
|
|
296
|
+
this.state.size.height = data.height
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// minimize
|
|
305
300
|
|
|
306
|
-
|
|
301
|
+
get isMinimizable() {
|
|
302
|
+
if (this.config.overridable?.minimizable) {
|
|
303
|
+
return !!this.state.minimizable
|
|
307
304
|
}
|
|
308
305
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
return false
|
|
312
|
-
}
|
|
306
|
+
return !!this.config.minimizable
|
|
307
|
+
}
|
|
313
308
|
|
|
314
|
-
|
|
315
|
-
|
|
309
|
+
public minimize() {
|
|
310
|
+
if (!this.isMinimizable) {
|
|
311
|
+
return false
|
|
316
312
|
}
|
|
317
313
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
314
|
+
this.state.active = false
|
|
315
|
+
return true
|
|
316
|
+
}
|
|
322
317
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
318
|
+
public unminimize() {
|
|
319
|
+
this.state.active = true
|
|
320
|
+
return true
|
|
321
|
+
}
|
|
327
322
|
|
|
328
|
-
|
|
323
|
+
public toggleMinimize() {
|
|
324
|
+
this.state.active = !this.state.active
|
|
325
|
+
this.focus()
|
|
326
|
+
}
|
|
329
327
|
|
|
330
|
-
|
|
331
|
-
if (typeof this.state.maximizable === 'undefined') {
|
|
332
|
-
return !!this.config.maximizable
|
|
333
|
-
}
|
|
328
|
+
// maximize
|
|
334
329
|
|
|
335
|
-
|
|
330
|
+
get isMaximizable() {
|
|
331
|
+
if (typeof this.state.maximizable === 'undefined') {
|
|
332
|
+
return !!this.config.maximizable
|
|
336
333
|
}
|
|
337
334
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return !!this.state.maximized
|
|
341
|
-
}
|
|
335
|
+
return this.state.maximizable
|
|
336
|
+
}
|
|
342
337
|
|
|
343
|
-
|
|
338
|
+
get isMaximized() {
|
|
339
|
+
if (this.config.overridable?.maximized) {
|
|
340
|
+
return !!this.state.maximized
|
|
344
341
|
}
|
|
345
342
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return false
|
|
349
|
-
}
|
|
343
|
+
return !!this.config.maximized
|
|
344
|
+
}
|
|
350
345
|
|
|
351
|
-
|
|
352
|
-
|
|
346
|
+
public toggleMaximize() {
|
|
347
|
+
if (!this.isMaximizable) {
|
|
348
|
+
return false
|
|
353
349
|
}
|
|
354
350
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
351
|
+
this.state.maximized = !this.state.maximized
|
|
352
|
+
return true
|
|
353
|
+
}
|
|
359
354
|
|
|
360
|
-
|
|
361
|
-
|
|
355
|
+
public maximize() {
|
|
356
|
+
if (!this.isMaximizable) {
|
|
357
|
+
return false
|
|
362
358
|
}
|
|
363
359
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
360
|
+
this.state.maximized = true
|
|
361
|
+
return true
|
|
362
|
+
}
|
|
368
363
|
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
public unmaximize() {
|
|
365
|
+
if (!this.isMaximizable) {
|
|
366
|
+
return false
|
|
371
367
|
}
|
|
372
368
|
|
|
373
|
-
|
|
369
|
+
this.state.maximized = false
|
|
370
|
+
return true
|
|
371
|
+
}
|
|
374
372
|
|
|
375
|
-
|
|
376
|
-
if (this.config.overridable?.destroyable) {
|
|
377
|
-
return !!this.state.destroyable
|
|
378
|
-
}
|
|
373
|
+
// destroy
|
|
379
374
|
|
|
380
|
-
|
|
375
|
+
get isDestroyable() {
|
|
376
|
+
if (this.config.overridable?.destroyable) {
|
|
377
|
+
return !!this.state.destroyable
|
|
381
378
|
}
|
|
382
379
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
return false
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
this.application.closeWindow(this.state.id)
|
|
380
|
+
return !!this.config.destroyable
|
|
381
|
+
}
|
|
389
382
|
|
|
390
|
-
|
|
383
|
+
public destroy() {
|
|
384
|
+
if (!this.isDestroyable) {
|
|
385
|
+
return false
|
|
391
386
|
}
|
|
392
387
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
388
|
+
this.application.closeWindow(this.state.id)
|
|
389
|
+
|
|
390
|
+
return true
|
|
391
|
+
}
|
|
398
392
|
|
|
399
|
-
|
|
393
|
+
// draggable
|
|
394
|
+
get isDraggable() {
|
|
395
|
+
if (this.config.overridable?.draggable) {
|
|
396
|
+
return !!this.state.draggable
|
|
400
397
|
}
|
|
401
398
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (this.config.overridable?.resizable) {
|
|
405
|
-
return !!this.state.resizable
|
|
406
|
-
}
|
|
399
|
+
return !!this.config.draggable
|
|
400
|
+
}
|
|
407
401
|
|
|
408
|
-
|
|
402
|
+
// resizable
|
|
403
|
+
get isResizable() {
|
|
404
|
+
if (this.config.overridable?.resizable) {
|
|
405
|
+
return !!this.state.resizable
|
|
409
406
|
}
|
|
410
407
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
this.state.workspace = workspaceId
|
|
414
|
-
}
|
|
408
|
+
return !!this.config.resizable
|
|
409
|
+
}
|
|
415
410
|
|
|
416
|
-
|
|
411
|
+
// workspace
|
|
412
|
+
public setWorkspace(workspaceId: string) {
|
|
413
|
+
this.state.workspace = workspaceId
|
|
414
|
+
}
|
|
417
415
|
|
|
418
|
-
|
|
419
|
-
this.override.title = value
|
|
420
|
-
}
|
|
416
|
+
// override
|
|
421
417
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
418
|
+
public setTitleOverride(value: undefined | string) {
|
|
419
|
+
this.override.title = value
|
|
420
|
+
}
|
|
425
421
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
// position
|
|
430
|
-
setActive: this.setActive.bind(this),
|
|
431
|
-
setFocus: this.setFocus.bind(this),
|
|
432
|
-
bringToFront: this.focus.bind(this),
|
|
433
|
-
focus: this.focus.bind(this),
|
|
434
|
-
setPosition: this.setPosition.bind(this),
|
|
422
|
+
public resetTitleOverride() {
|
|
423
|
+
this.override.title = undefined
|
|
424
|
+
}
|
|
435
425
|
|
|
436
|
-
|
|
437
|
-
setSize: this.setSize.bind(this),
|
|
426
|
+
// menu
|
|
438
427
|
|
|
439
|
-
|
|
440
|
-
minimize: this.minimize.bind(this),
|
|
441
|
-
toggleMinimize: this.toggleMinimize.bind(this),
|
|
428
|
+
public menu: any[] = []
|
|
442
429
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
unmaximize: this.unmaximize.bind(this),
|
|
430
|
+
public setMenu(menu: any[]) {
|
|
431
|
+
this.menu = menu
|
|
432
|
+
}
|
|
447
433
|
|
|
448
|
-
|
|
449
|
-
|
|
434
|
+
// deprecated ?
|
|
435
|
+
get actions() {
|
|
436
|
+
return {
|
|
437
|
+
// position
|
|
438
|
+
setActive: this.setActive.bind(this),
|
|
439
|
+
setFocus: this.setFocus.bind(this),
|
|
440
|
+
bringToFront: this.focus.bind(this),
|
|
441
|
+
focus: this.focus.bind(this),
|
|
442
|
+
setPosition: this.setPosition.bind(this),
|
|
450
443
|
|
|
451
|
-
|
|
452
|
-
|
|
444
|
+
// size
|
|
445
|
+
setSize: this.setSize.bind(this),
|
|
453
446
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
447
|
+
// minimize
|
|
448
|
+
minimize: this.minimize.bind(this),
|
|
449
|
+
toggleMinimize: this.toggleMinimize.bind(this),
|
|
450
|
+
|
|
451
|
+
// maximize
|
|
452
|
+
toggleMaximize: this.toggleMaximize.bind(this),
|
|
453
|
+
maximize: this.maximize.bind(this),
|
|
454
|
+
unmaximize: this.unmaximize.bind(this),
|
|
455
|
+
|
|
456
|
+
// destroy
|
|
457
|
+
destroy: this.destroy.bind(this),
|
|
458
|
+
|
|
459
|
+
// workspace
|
|
460
|
+
setWorkspace: this.setWorkspace.bind(this),
|
|
461
|
+
|
|
462
|
+
// override
|
|
463
|
+
setTitleOverride: this.setTitleOverride.bind(this),
|
|
464
|
+
resetTitleOverride: this.resetTitleOverride.bind(this),
|
|
458
465
|
}
|
|
466
|
+
}
|
|
459
467
|
}
|