Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window bugs on minimize/maximize #1003

Closed
1 of 2 tasks
spieIbug opened this issue Nov 20, 2018 · 15 comments · Fixed by #1022
Closed
1 of 2 tasks

Window bugs on minimize/maximize #1003

spieIbug opened this issue Nov 20, 2018 · 15 comments · Fixed by #1022

Comments

@spieIbug
Copy link

BUG

I'm submitting a ...

  • bug report
  • feature request

Issue description

Current behavior:
When i minimize Window, and click again to bring it to front, it loose the template.
When i try to put it fullScreen, it place it to the bottom right position
Expected behavior:
Click on minimized window, bring it normaly with the template.
Click on fullScreen, make the window full screen.

Steps to reproduce:
See documentation, it's bugged
[window documentaiton] (https://akveo.github.io/nebular/docs/components/window/examples)

Related code:

import { Component } from '@angular/core';
import { NbWindowRef, NbWindowService } from '@nebular/theme';

@Component({
  template: `
    <form class="form">
      <label for="subject">Subject:</label>
      <input nbInput id="subject" type="text">

      <label class="text-label" for="text">Text:</label>
      <textarea nbInput id="text"></textarea>
    </form>
  `,
})
export class NbFormComponent {
  constructor(public windowRef: NbWindowRef) {}

  close() {
    this.windowRef.close();
  }
}

@Component({
  template: `<button (click)="openWindow()" nbButton>Open window</button>`,
  styleUrls: [ './window.scss' ],
})
export class NbWindowShowcaseComponent {

  constructor(private windowService: NbWindowService) {}

  openWindow() {
    this.windowService.open(NbFormComponent, { title: `Window` });
  }
}

Other information:

npm, node, OS, Browser

Node, npm: `v8.11.1` and `5.6.0`
OS: Windows (7/8/10).
Browser: Chrome

Angular, Nebular

angular: 7.0.0
nebular: 2.0.2
@nnixaa
Copy link
Collaborator

nnixaa commented Nov 20, 2018

Confirmed.

@nnixaa
Copy link
Collaborator

nnixaa commented Nov 20, 2018

@meyacine thanks for reporting!

@yggg
Copy link
Contributor

yggg commented Nov 27, 2018

When i try to put it fullScreen, it place it to the bottom right position

I've created separate issue to rethink window expanding #1021.

Missing template will be fixed with #1022. Thanks for reporting!

@issue-sh issue-sh bot removed the Sprint label Nov 29, 2018
@senthilmnhr87
Copy link

When minimizing window the component is destroyed.
When maximizing the minimized window, it create a new instance.
So the data on the template is loose.

Kindly let me know its can be fixed?

@tomer953
Copy link

Same issue, anyway to prevent the destroy on minimize ?

@omidkh68
Copy link

omidkh68 commented May 8, 2020

@nnixaa
Same issue, I don't want component destroyed when window minimized, any idea for this?

@carmeloNET
Copy link

i have the same problem, now i am working with a window dialog and when minimize or maximize the component referenced is destroyed. when you open again the dialog, lost all the previous state.

@carmeloNET
Copy link

an idea, if you are using ngrx, create a object state for the form in the component, and when show again the dialog get data from the object state, with that you coul reset the object or continue writting in it

@naingaungphyo
Copy link

naingaungphyo commented Jun 12, 2020

@carmeloNET
I want to save the state in services without using ngrx.
So to save the state before the component get destroyed by pressing minimize button, I think I need to subscribe NbWindowRef.stateChange. But can you confirm that it is safe to save the state inside NbWindowRef.stateChange.subscirbe() block?
What I'm worrying is that, component being destroyed before the state is saved. (ie, is this stateChange.subscribe() called only after the component is destroyed or not)
Or should I simply save the state inside ngOnDestroy()?

and also, do you have idea about how to update the state object while the user is typing in the component form.

I wish there is a way, an option flag to configure component being destroy or not when we press minimize button.

@AmolSB
Copy link

AmolSB commented Jul 23, 2020

Is it resolved?

@PPrasai
Copy link

PPrasai commented Sep 15, 2020

@naingaungphyo Did it work? I am facing a similar issue. My nbWindow contains a form which I would like to retain its values on minimizing.

@carmeloNET
Copy link

@naingaungphyo @AmolSB I did a project for example using nebular starter kit to have running the nebular template and give you an idea how can work nbWindow with a angular service to keep the state saved. It is found in this repo
https://github.com/carmeloNET/ngx-admin-nbWindow , just need run npm install and ng serve.

@weedkiller
Copy link

@carmeloNET which file/line or section is it. BTW very nice theme!

@naingaungphyo
Copy link

naingaungphyo commented Jan 18, 2021

@weedkiller
It is here.
It is saving form value in a variable using custom service when the certain state changes.
I was trying to do that too but in my case, there were a lot of different fields and variables to be saved. It was not that simple to implement set and get.

@betojsx
Copy link

betojsx commented Nov 28, 2021

why is this issues closed? the problem is not solved yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.