Skip to content

Commit

Permalink
fix(window): improve window
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed Jul 7, 2024
1 parent 0b14d8f commit d605c9e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
34 changes: 6 additions & 28 deletions packages/core/components/Window.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
},
props: {
instance: {
window: {
type: Object,
default: null
},
Expand All @@ -98,30 +98,6 @@ export default {
}
},
parentWindow: {
type: Object,
default: null
},
options: {
type: Object,
default() {
return {
title: 'Window Title',
scaleX: true,
scaleY: true,
scrollX: true,
scrollY: true,
clampX: false,
clampY: false,
freeze: false,
focused: false,
center: true,
embed: false
};
}
},
wrapper: {
type: Object,
default() {
Expand Down Expand Up @@ -177,8 +153,7 @@ export default {
emits: ['focused', 'ready', 'close', 'up', 'down', 'refresh'],
setup(props) {
provide('window', toRef(props, 'instance'));
provide('parentWindow', toRef(props, 'parentWindow'));
provide('window', toRef(props, 'window'));
},
data() {
Expand Down Expand Up @@ -275,6 +250,9 @@ export default {
size() {
return this.layout.size;
},
options() {
return this.window.options;
},
focused() {
return this.options.focused;
},
Expand Down Expand Up @@ -390,7 +368,7 @@ export default {
},
onPointerDown() {
if (!this.options.freeze) {
this.options.focused = true;
this.wrapper.setActiveWindow(this.id);
}
},
onClickHeader(e) {
Expand Down
26 changes: 24 additions & 2 deletions packages/core/components/WindowWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<wb-env-window
v-for="window in sortedWindows"
:key="window.id"
:instance="window"
v-bind="window"
v-bind="getWindowProps(window)"
@ready="onReadyWindow"
@focused="onFocusedWindow"
@close="onCloseWindow"
Expand Down Expand Up @@ -105,6 +104,29 @@ export default {
},
methods: {
getWindowProps(window) {
const {
id,
layout,
sidebarComponent,
sidebarComponentData,
component,
componentData,
symbolWrapper
} = window;
return {
window,
id,
wrapper: this.wrapper,
layout,
sidebarComponent,
sidebarComponentData,
component,
componentData,
symbolWrapper
};
},
refresh(force) {
if (force) {
this.onRefresh();
Expand Down

0 comments on commit d605c9e

Please sign in to comment.