mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 17:38:20 +01:00
fix old system dialog is not destroyed after closed
This commit is contained in:
parent
1c32f2010c
commit
ced3777d30
@ -35,7 +35,7 @@ namespace OS {
|
||||
*/
|
||||
export abstract class SubWindow extends BaseModel {
|
||||
modal: false;
|
||||
parent: BaseModel;
|
||||
parent: BaseModel | typeof GUI;
|
||||
|
||||
/**
|
||||
*Creates an instance of SubWindow.
|
||||
@ -91,8 +91,9 @@ namespace OS {
|
||||
* @memberof SubWindow
|
||||
*/
|
||||
meta(): API.PackageMetaType {
|
||||
if (this.parent && this.parent.meta) {
|
||||
return this.parent.meta();
|
||||
const p = this.parent as BaseModel;
|
||||
if (p && p.meta) {
|
||||
return p.meta();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ namespace OS {
|
||||
dialog = d as GUI.BaseDialog;
|
||||
}
|
||||
|
||||
dialog.parent = undefined;
|
||||
dialog.parent = GUI;
|
||||
dialog.handle = resolve;
|
||||
dialog.pid = -1;
|
||||
dialog.data = data;
|
||||
|
@ -60,7 +60,6 @@ namespace OS {
|
||||
}
|
||||
|
||||
protected mount() {
|
||||
this._onbtclick = (e) => {};
|
||||
$(this.refs.button).click((e) => {
|
||||
const evt: TagEventType = {
|
||||
id: this.aid,
|
||||
@ -76,6 +75,7 @@ namespace OS {
|
||||
protected init(): void {
|
||||
this.enable = true;
|
||||
this.toggle = false;
|
||||
this._onbtclick = (e) => {};
|
||||
}
|
||||
protected calibrate(): void {}
|
||||
reload(d?: any): void {}
|
||||
|
@ -57,7 +57,10 @@ namespace OS {
|
||||
set(v: GenericObject<any>) {
|
||||
for (let k in v) {
|
||||
let descriptor = this.descriptor_of(k);
|
||||
if (descriptor && descriptor.set) this[k] = v[k];
|
||||
if (descriptor && descriptor.set)
|
||||
{
|
||||
this[k] = v[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,13 @@ test("Test button tag behavior", () =>{
|
||||
bt.onbtclick = cb
|
||||
$("button",bt).trigger("click");
|
||||
expect(cb).toBeCalledTimes(1);
|
||||
const data = {
|
||||
text: "name",
|
||||
onbtclick: jest.fn()
|
||||
};
|
||||
bt.set(data);
|
||||
$("button",bt).trigger("click");
|
||||
expect(data.onbtclick).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
// Label test
|
||||
|
Loading…
Reference in New Issue
Block a user