Skip to content

Commit 364d5f2

Browse files
authored
Merge pull request #1104 from neomjs/dev
v1.3.55
2 parents bf03797 + b50290d commit 364d5f2

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

examples/dialog/MainContainer.mjs

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Button from '../../src/component/Button.mjs';
2+
import CheckBox from '../../src/form/field/CheckBox.mjs';
23
import Toolbar from '../../src/container/Toolbar.mjs';
34
import DemoDialog from './DemoDialog.mjs';
45
import Viewport from '../../src/container/Viewport.mjs';
@@ -14,7 +15,19 @@ class MainContainer extends Viewport {
1415

1516
autoMount: true,
1617
layout : 'base',
17-
style : {padding: '20px'}
18+
style : {padding: '20px'},
19+
20+
/**
21+
* Custom config which gets passed to the dialog
22+
* Either a dom node id, 'document.body' or null
23+
* @member {String|null} boundaryContainerId='document.body'
24+
*/
25+
boundaryContainerId: 'document.body',
26+
/**
27+
* Custom config
28+
* @member {Neo.dialog.Base|null} dialog=null
29+
*/
30+
dialog: null
1831
}}
1932

2033
/**
@@ -33,6 +46,14 @@ class MainContainer extends Viewport {
3346
handler: me.createDialog.bind(me),
3447
iconCls: 'fa fa-window-maximize',
3548
text : 'Create Dialog',
49+
}, {
50+
module : CheckBox,
51+
checked : true,
52+
hideLabel : true,
53+
hideValueLabel: false,
54+
listeners : {change: me.onDragLimitChange, scope: me},
55+
style : {marginLeft: '3em'},
56+
valueLabelText: 'Limit Drag&Drop to the document.body'
3657
}, '->', {
3758
module : Button,
3859
handler: MainContainer.switchTheme.bind(me),
@@ -47,12 +68,37 @@ class MainContainer extends Viewport {
4768
* @param {Object} data
4869
*/
4970
createDialog(data) {
50-
Neo.create(DemoDialog, {
51-
animateTargetId: data.component.id,
52-
appName : this.appName
71+
let me = this;
72+
73+
data.component.disabled = true;
74+
75+
me.dialog = Neo.create(DemoDialog, {
76+
animateTargetId : data.component.id,
77+
appName : me.appName,
78+
boundaryContainerId: me.boundaryContainerId,
79+
listeners : {close: me.onWindowClose, scope: me}
5380
});
5481
}
5582

83+
/**
84+
*
85+
* @param {Object} data
86+
*/
87+
onDragLimitChange(data) {
88+
this.dialog.boundaryContainerId = data.value ? 'document.body' : null
89+
}
90+
91+
/**
92+
*
93+
*/
94+
onWindowClose() {
95+
let button = this.down({
96+
text: 'Create Dialog'
97+
});
98+
99+
button.disabled = false;
100+
}
101+
56102
/**
57103
*
58104
* @param {Object} data

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "neo.mjs",
3-
"version": "1.3.54",
3+
"version": "1.3.55",
44
"description": "The webworkers driven UI framework",
55
"repository": {
66
"type": "git",

src/dialog/Base.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class Base extends Panel {
210210
});
211211
}, 30);
212212

213+
me.fire('close');
213214
me.destroy(true);
214215
});
215216
});
@@ -272,6 +273,7 @@ class Base extends Panel {
272273
if (me.animateTargetId) {
273274
me.animateHide();
274275
} else {
276+
me.fire('close');
275277
me.destroy(true);
276278
}
277279
}

0 commit comments

Comments
 (0)