@owdproject/core 3.1.2 → 3.1.4-beta.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/CHANGELOG.md +25 -0
- package/README.md +9 -10
- package/bin/owd.js +14 -14
- package/index.ts +5 -2
- package/module.ts +64 -55
- 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 +23 -20
- 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 +46 -34
- 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 +3 -3
- package/runtime/composables/useClipboardFs.ts +11 -11
- package/runtime/composables/useDesktopManager.ts +2 -2
- package/runtime/composables/useTerminalManager.ts +3 -3
- package/runtime/core/controllers/ApplicationController.ts +211 -200
- package/runtime/core/controllers/WindowController.ts +349 -312
- package/runtime/core/managers/ApplicationManager.ts +240 -196
- package/runtime/core/managers/DesktopManager.ts +35 -25
- package/runtime/core/managers/TerminalManager.ts +36 -32
- package/runtime/plugins/resize.client.ts +4 -4
- package/runtime/stores/storeApplication.ts +235 -0
- package/runtime/stores/storeApplicationMeta.ts +12 -8
- package/runtime/stores/storeApplicationWindows.ts +16 -12
- package/runtime/stores/storeDesktop.ts +33 -29
- 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/.editorconfig +0 -12
- package/eslint.config.mjs +0 -30
- package/runtime/composables/useAppEntries.ts +0 -36
|
@@ -1,430 +1,467 @@
|
|
|
1
|
-
import {useApplicationManager} from '../../composables/useApplicationManager'
|
|
2
|
-
import {useDesktopWindowStore} from '../../stores/storeDesktopWindow'
|
|
3
|
-
import {deepClone} from '../../utils/utilCommon'
|
|
4
|
-
import {markRaw} from '@vue/reactivity'
|
|
5
|
-
import {defineAsyncComponent} from
|
|
1
|
+
import { useApplicationManager } from '../../composables/useApplicationManager'
|
|
2
|
+
import { useDesktopWindowStore } from '../../stores/storeDesktopWindow'
|
|
3
|
+
import { deepClone } from '../../utils/utilCommon'
|
|
4
|
+
import { markRaw } from '@vue/reactivity'
|
|
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) this.config.size.minWidth = config.size.minWidth
|
|
91
|
-
if (config.size?.minHeight) this.config.size.minHeight = config.size.minHeight
|
|
92
|
-
if (config.size?.maxWidth) this.config.size.maxWidth = config.size.maxWidth
|
|
93
|
-
if (config.size?.maxHeight) this.config.size.maxHeight = config.size.maxHeight
|
|
94
|
-
|
|
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
|
-
}
|
|
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
|
|
102
84
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
107
94
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
+
}
|
|
112
102
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
// maximize
|
|
104
|
+
if (typeof config.maximized !== 'undefined') {
|
|
105
|
+
this.config.maximized = config.maximized
|
|
106
|
+
}
|
|
117
107
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
108
|
+
// draggable
|
|
109
|
+
if (typeof config.draggable !== 'undefined') {
|
|
110
|
+
this.config.draggable = config.draggable
|
|
111
|
+
}
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
size: false,
|
|
128
|
-
maximized: false,
|
|
129
|
-
destroyable: false,
|
|
130
|
-
minimizable: false,
|
|
131
|
-
maximizable: false,
|
|
132
|
-
}
|
|
113
|
+
// resizable
|
|
114
|
+
if (typeof config.resizable !== 'undefined') {
|
|
115
|
+
this.config.resizable = config.resizable
|
|
116
|
+
}
|
|
133
117
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
118
|
+
// destroy
|
|
119
|
+
if (typeof config.destroyable !== 'undefined') {
|
|
120
|
+
this.config.destroyable = config.destroyable
|
|
121
|
+
}
|
|
137
122
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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,
|
|
142
132
|
}
|
|
143
133
|
|
|
144
|
-
|
|
134
|
+
DEFAULT_OVERRIDABLE.position = DEFAULT_OVERRIDABLE.draggable
|
|
135
|
+
DEFAULT_OVERRIDABLE.size = DEFAULT_OVERRIDABLE.resizable
|
|
136
|
+
DEFAULT_OVERRIDABLE.maximized = DEFAULT_OVERRIDABLE.maximizable
|
|
145
137
|
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
this.config.overridable = {
|
|
139
|
+
...DEFAULT_OVERRIDABLE,
|
|
140
|
+
...(config.overridable || {}),
|
|
148
141
|
}
|
|
142
|
+
}
|
|
149
143
|
|
|
150
|
-
|
|
151
|
-
const overridable = this.config.overridable || {}
|
|
144
|
+
// state
|
|
152
145
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
get state() {
|
|
147
|
+
return this.storedState.state
|
|
148
|
+
}
|
|
156
149
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.state[stateKey] = deepClone(this.config[stateKey])
|
|
160
|
-
} else {
|
|
161
|
-
this.state[stateKey] = !!this.config[stateKey]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
150
|
+
private restoreState() {
|
|
151
|
+
const overridable = this.config.overridable || {}
|
|
167
152
|
|
|
168
|
-
|
|
153
|
+
for (const key in overridable) {
|
|
154
|
+
if (overridable[key as keyof typeof overridable]) {
|
|
155
|
+
const stateKey = key as keyof WindowState
|
|
169
156
|
|
|
170
|
-
|
|
171
|
-
|
|
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
|
+
}
|
|
172
165
|
}
|
|
166
|
+
}
|
|
173
167
|
|
|
174
|
-
|
|
168
|
+
private setState(state: WindowState) {
|
|
169
|
+
this.storedState.state = state
|
|
170
|
+
}
|
|
175
171
|
|
|
176
|
-
|
|
177
|
-
if (!this.state.position) {
|
|
178
|
-
this.state.position = { x: 0, y: 0}
|
|
179
|
-
}
|
|
172
|
+
// meta
|
|
180
173
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
174
|
+
get meta() {
|
|
175
|
+
return this.storedState.meta
|
|
176
|
+
}
|
|
184
177
|
|
|
185
|
-
|
|
186
|
-
this.state.active = value
|
|
187
|
-
}
|
|
178
|
+
// position
|
|
188
179
|
|
|
189
|
-
|
|
190
|
-
|
|
180
|
+
public setPosition(data: { x: number; y: number }) {
|
|
181
|
+
if (!this.state.position) {
|
|
182
|
+
this.state.position = { x: 0, y: 0 }
|
|
191
183
|
}
|
|
192
184
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
185
|
+
this.state.position.x = data.x
|
|
186
|
+
this.state.position.y = data.y
|
|
187
|
+
}
|
|
196
188
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
189
|
+
public setActive(value: boolean) {
|
|
190
|
+
this.state.active = value
|
|
191
|
+
}
|
|
200
192
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
193
|
+
public setFocus(value: boolean) {
|
|
194
|
+
this.state.focused = value
|
|
195
|
+
}
|
|
205
196
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
197
|
+
public focus() {
|
|
198
|
+
const applicationManager = useApplicationManager()
|
|
199
|
+
const desktopWindowStore = useDesktopWindowStore()
|
|
210
200
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
this.state.position.z = desktopWindowStore.incrementPositionZ()
|
|
201
|
+
if (!this.state.position) {
|
|
202
|
+
this.state.position = { x: 0, y: 0, z: 0 }
|
|
214
203
|
}
|
|
215
204
|
|
|
216
|
-
//
|
|
205
|
+
// already focused
|
|
206
|
+
if (this.state.focused) {
|
|
207
|
+
return
|
|
208
|
+
}
|
|
217
209
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
210
|
+
// set focus false on all other windows
|
|
211
|
+
for (const [windowId, window] of applicationManager.windowsOpened) {
|
|
212
|
+
window.actions.setFocus(false)
|
|
213
|
+
}
|
|
222
214
|
|
|
223
|
-
|
|
224
|
-
return this.config.title
|
|
225
|
-
}
|
|
215
|
+
this.setFocus(true)
|
|
226
216
|
|
|
227
|
-
|
|
228
|
-
|
|
217
|
+
this.state.position.z = desktopWindowStore.incrementPositionZ()
|
|
218
|
+
}
|
|
229
219
|
|
|
230
|
-
|
|
231
|
-
if (typeof this.override.icon !== 'undefined') {
|
|
232
|
-
return this.override.icon
|
|
233
|
-
}
|
|
220
|
+
// common
|
|
234
221
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
222
|
+
get title(): string {
|
|
223
|
+
if (typeof this.override.title !== 'undefined') {
|
|
224
|
+
return this.override.title
|
|
225
|
+
}
|
|
238
226
|
|
|
239
|
-
|
|
227
|
+
if (this.config.title) {
|
|
228
|
+
return this.config.title
|
|
240
229
|
}
|
|
241
230
|
|
|
242
|
-
|
|
231
|
+
return this.application.config.title
|
|
232
|
+
}
|
|
243
233
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
234
|
+
get icon() {
|
|
235
|
+
if (typeof this.override.icon !== 'undefined') {
|
|
236
|
+
return this.override.icon
|
|
237
|
+
}
|
|
248
238
|
|
|
249
|
-
|
|
239
|
+
if (this.config.icon) {
|
|
240
|
+
return this.config.icon
|
|
250
241
|
}
|
|
251
242
|
|
|
252
|
-
|
|
243
|
+
return this.application.config.icon
|
|
244
|
+
}
|
|
253
245
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
width: typeof stateSize.width !== 'undefined' ? stateSize.width : configSize.width,
|
|
260
|
-
height: typeof stateSize.height !== 'undefined' ? stateSize.height : configSize.height,
|
|
261
|
-
minWidth: typeof stateSize.minWidth !== 'undefined' ? stateSize.minWidth : configSize.minWidth,
|
|
262
|
-
maxWidth: typeof stateSize.maxWidth !== 'undefined' ? stateSize.maxWidth : configSize.maxWidth,
|
|
263
|
-
minHeight: typeof stateSize.minHeight !== 'undefined' ? stateSize.minHeight : configSize.minHeight,
|
|
264
|
-
maxHeight: typeof stateSize.maxHeight !== 'undefined' ? stateSize.maxHeight : (configSize.maxHeight ?? 600),
|
|
265
|
-
}
|
|
246
|
+
// position
|
|
247
|
+
|
|
248
|
+
get position() {
|
|
249
|
+
if (typeof this.state.position === 'undefined') {
|
|
250
|
+
return this.config.position
|
|
266
251
|
}
|
|
267
252
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
253
|
+
return this.state.position
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// sizes
|
|
257
|
+
|
|
258
|
+
get size() {
|
|
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
|
+
}
|
|
272
289
|
|
|
273
|
-
|
|
274
|
-
|
|
290
|
+
public setSize(data: { width: number; height: number }) {
|
|
291
|
+
if (!this.state.size) {
|
|
292
|
+
this.state.size = { width: undefined, height: undefined }
|
|
275
293
|
}
|
|
276
294
|
|
|
277
|
-
|
|
295
|
+
this.state.size.width = data.width
|
|
296
|
+
this.state.size.height = data.height
|
|
297
|
+
}
|
|
278
298
|
|
|
279
|
-
|
|
280
|
-
if (this.config.overridable?.minimizable) {
|
|
281
|
-
return !!this.state.minimizable
|
|
282
|
-
}
|
|
299
|
+
// minimize
|
|
283
300
|
|
|
284
|
-
|
|
301
|
+
get isMinimizable() {
|
|
302
|
+
if (this.config.overridable?.minimizable) {
|
|
303
|
+
return !!this.state.minimizable
|
|
285
304
|
}
|
|
286
305
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return false
|
|
290
|
-
}
|
|
306
|
+
return !!this.config.minimizable
|
|
307
|
+
}
|
|
291
308
|
|
|
292
|
-
|
|
293
|
-
|
|
309
|
+
public minimize() {
|
|
310
|
+
if (!this.isMinimizable) {
|
|
311
|
+
return false
|
|
294
312
|
}
|
|
295
313
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
314
|
+
this.state.active = false
|
|
315
|
+
return true
|
|
316
|
+
}
|
|
300
317
|
|
|
301
|
-
|
|
318
|
+
public unminimize() {
|
|
319
|
+
this.state.active = true
|
|
320
|
+
return true
|
|
321
|
+
}
|
|
302
322
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
323
|
+
public toggleMinimize() {
|
|
324
|
+
this.state.active = !this.state.active
|
|
325
|
+
this.focus()
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// maximize
|
|
307
329
|
|
|
308
|
-
|
|
330
|
+
get isMaximizable() {
|
|
331
|
+
if (typeof this.state.maximizable === 'undefined') {
|
|
332
|
+
return !!this.config.maximizable
|
|
309
333
|
}
|
|
310
334
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return !!this.state.maximized
|
|
314
|
-
}
|
|
335
|
+
return this.state.maximizable
|
|
336
|
+
}
|
|
315
337
|
|
|
316
|
-
|
|
338
|
+
get isMaximized() {
|
|
339
|
+
if (this.config.overridable?.maximized) {
|
|
340
|
+
return !!this.state.maximized
|
|
317
341
|
}
|
|
318
342
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return false
|
|
322
|
-
}
|
|
343
|
+
return !!this.config.maximized
|
|
344
|
+
}
|
|
323
345
|
|
|
324
|
-
|
|
325
|
-
|
|
346
|
+
public toggleMaximize() {
|
|
347
|
+
if (!this.isMaximizable) {
|
|
348
|
+
return false
|
|
326
349
|
}
|
|
327
350
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
351
|
+
this.state.maximized = !this.state.maximized
|
|
352
|
+
return true
|
|
353
|
+
}
|
|
332
354
|
|
|
333
|
-
|
|
334
|
-
|
|
355
|
+
public maximize() {
|
|
356
|
+
if (!this.isMaximizable) {
|
|
357
|
+
return false
|
|
335
358
|
}
|
|
336
359
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
360
|
+
this.state.maximized = true
|
|
361
|
+
return true
|
|
362
|
+
}
|
|
341
363
|
|
|
342
|
-
|
|
343
|
-
|
|
364
|
+
public unmaximize() {
|
|
365
|
+
if (!this.isMaximizable) {
|
|
366
|
+
return false
|
|
344
367
|
}
|
|
345
368
|
|
|
346
|
-
|
|
369
|
+
this.state.maximized = false
|
|
370
|
+
return true
|
|
371
|
+
}
|
|
347
372
|
|
|
348
|
-
|
|
349
|
-
if (this.config.overridable?.destroyable) {
|
|
350
|
-
return !!this.state.destroyable
|
|
351
|
-
}
|
|
373
|
+
// destroy
|
|
352
374
|
|
|
353
|
-
|
|
375
|
+
get isDestroyable() {
|
|
376
|
+
if (this.config.overridable?.destroyable) {
|
|
377
|
+
return !!this.state.destroyable
|
|
354
378
|
}
|
|
355
379
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return false
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
this.application.closeWindow(this.state.id)
|
|
380
|
+
return !!this.config.destroyable
|
|
381
|
+
}
|
|
362
382
|
|
|
363
|
-
|
|
383
|
+
public destroy() {
|
|
384
|
+
if (!this.isDestroyable) {
|
|
385
|
+
return false
|
|
364
386
|
}
|
|
365
387
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
388
|
+
this.application.closeWindow(this.state.id)
|
|
389
|
+
|
|
390
|
+
return true
|
|
391
|
+
}
|
|
371
392
|
|
|
372
|
-
|
|
393
|
+
// draggable
|
|
394
|
+
get isDraggable() {
|
|
395
|
+
if (this.config.overridable?.draggable) {
|
|
396
|
+
return !!this.state.draggable
|
|
373
397
|
}
|
|
374
398
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
if (this.config.overridable?.resizable) {
|
|
378
|
-
return !!this.state.resizable
|
|
379
|
-
}
|
|
399
|
+
return !!this.config.draggable
|
|
400
|
+
}
|
|
380
401
|
|
|
381
|
-
|
|
402
|
+
// resizable
|
|
403
|
+
get isResizable() {
|
|
404
|
+
if (this.config.overridable?.resizable) {
|
|
405
|
+
return !!this.state.resizable
|
|
382
406
|
}
|
|
383
407
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
this.state.workspace = workspaceId
|
|
387
|
-
}
|
|
408
|
+
return !!this.config.resizable
|
|
409
|
+
}
|
|
388
410
|
|
|
389
|
-
|
|
411
|
+
// workspace
|
|
412
|
+
public setWorkspace(workspaceId: string) {
|
|
413
|
+
this.state.workspace = workspaceId
|
|
414
|
+
}
|
|
390
415
|
|
|
391
|
-
|
|
392
|
-
this.override.title = value
|
|
393
|
-
}
|
|
416
|
+
// override
|
|
394
417
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
418
|
+
public setTitleOverride(value: undefined | string) {
|
|
419
|
+
this.override.title = value
|
|
420
|
+
}
|
|
398
421
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
setActive: this.setActive.bind(this),
|
|
403
|
-
setFocus: this.setFocus.bind(this),
|
|
404
|
-
bringToFront: this.bringToFront.bind(this),
|
|
405
|
-
setPosition: this.setPosition.bind(this),
|
|
422
|
+
public resetTitleOverride() {
|
|
423
|
+
this.override.title = undefined
|
|
424
|
+
}
|
|
406
425
|
|
|
407
|
-
|
|
408
|
-
setSize: this.setSize.bind(this),
|
|
426
|
+
// menu
|
|
409
427
|
|
|
410
|
-
|
|
411
|
-
minimize: this.minimize.bind(this),
|
|
412
|
-
toggleMinimize: this.toggleMinimize.bind(this),
|
|
428
|
+
public menu: any[] = []
|
|
413
429
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
unmaximize: this.unmaximize.bind(this),
|
|
430
|
+
public setMenu(menu: any[]) {
|
|
431
|
+
this.menu = menu
|
|
432
|
+
}
|
|
418
433
|
|
|
419
|
-
|
|
420
|
-
|
|
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),
|
|
421
443
|
|
|
422
|
-
|
|
423
|
-
|
|
444
|
+
// size
|
|
445
|
+
setSize: this.setSize.bind(this),
|
|
424
446
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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),
|
|
429
465
|
}
|
|
466
|
+
}
|
|
430
467
|
}
|