jsharmony 1.28.2 → 1.28.3
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/clientjs/XExt.js +44 -33
- package/package.json +1 -1
- package/public/js/jsHarmony.js +1 -1
package/clientjs/XExt.js
CHANGED
|
@@ -1947,7 +1947,7 @@ exports = module.exports = function(jsh){
|
|
|
1947
1947
|
|
|
1948
1948
|
//html - HTML or jQuery object
|
|
1949
1949
|
XExt.CustomPrompt = function (sel, html, onInit, onAccept, onCancel, onClosed, options) {
|
|
1950
|
-
options = _.extend({ backgroundClose: false, reuse: false, restoreFocus: true, onClosing: null }, options);
|
|
1950
|
+
options = _.extend({ backgroundClose: false, reuse: false, restoreFocus: true, onClosing: null, asyncInit: false }, options);
|
|
1951
1951
|
if(options.specialKeys === false) options.specialKeys = { enter: false, escape: false };
|
|
1952
1952
|
else options.specialKeys = _.extend({ enter: true, escape: true }, options.specialKeys);
|
|
1953
1953
|
|
|
@@ -1990,41 +1990,52 @@ exports = module.exports = function(jsh){
|
|
|
1990
1990
|
if (onAccept) return onAccept(function () { acceptfunc_aftervalidate(); });
|
|
1991
1991
|
else acceptfunc_aftervalidate();
|
|
1992
1992
|
};
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1993
|
+
XExt.execif(true,
|
|
1994
|
+
function(done){
|
|
1995
|
+
if(onInit && options.asyncInit){
|
|
1996
|
+
onInit(acceptfunc, cancelfunc, done);
|
|
1997
|
+
}
|
|
1998
|
+
else {
|
|
1999
|
+
if (onInit) onInit(acceptfunc, cancelfunc);
|
|
2000
|
+
return done();
|
|
2001
|
+
}
|
|
2002
|
+
},
|
|
2003
|
+
function(){
|
|
2004
|
+
jsh.$dialogBlock(sel + ' input.button_ok').on('click', acceptfunc);
|
|
2005
|
+
jsh.$dialogBlock(sel + ' input.button_cancel').on('click', cancelfunc);
|
|
1996
2006
|
|
|
1997
|
-
|
|
1998
|
-
|
|
2007
|
+
jsh.$dialogBlock(sel).off('acceptDialog').on('acceptDialog', acceptfunc);
|
|
2008
|
+
jsh.$dialogBlock(sel).off('cancelDialog').on('cancelDialog', cancelfunc);
|
|
1999
2009
|
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
});
|
|
2003
|
-
jsh.$dialogBlock(sel + ' input:not(:checkbox):not(:button)').on('keydown', function (e) {
|
|
2004
|
-
if (options.specialKeys.escape && (e.keyCode == 13)) { e.preventDefault(); e.stopImmediatePropagation(); acceptfunc(); }
|
|
2005
|
-
});
|
|
2006
|
-
if(options.backgroundClose){
|
|
2007
|
-
jsh.dialogBlock.on('mousedown.close' + sel, function(e){
|
|
2008
|
-
if(!$(e.target).is('.xdialogoverlay,.xdialogblock')) return;
|
|
2009
|
-
var mouseDownTime = new Date().getTime();
|
|
2010
|
-
jsh.dialogBlock.one('mouseup.close', function(e){
|
|
2011
|
-
var mouseUpTime = new Date().getTime();
|
|
2012
|
-
if((mouseUpTime - mouseDownTime) > 5000) return;
|
|
2013
|
-
if(!$(e.target).is('.xdialogoverlay,.xdialogblock')) return;
|
|
2014
|
-
if(jsh.xDialog.length && (jsh.xDialog[0]==sel)){ e.preventDefault(); e.stopImmediatePropagation(); cancelfunc(); }
|
|
2010
|
+
jsh.$dialogBlock(sel + ' input, ' + sel + ' textarea, ' + sel + ' select').on('keydown', function (e) {
|
|
2011
|
+
if (options.specialKeys.escape && (e.keyCode == 27)) { e.preventDefault(); e.stopImmediatePropagation(); cancelfunc(); }
|
|
2015
2012
|
});
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2013
|
+
jsh.$dialogBlock(sel + ' input:not(:checkbox):not(:button)').on('keydown', function (e) {
|
|
2014
|
+
if (options.specialKeys.escape && (e.keyCode == 13)) { e.preventDefault(); e.stopImmediatePropagation(); acceptfunc(); }
|
|
2015
|
+
});
|
|
2016
|
+
if(options.backgroundClose){
|
|
2017
|
+
jsh.dialogBlock.on('mousedown.close' + sel, function(e){
|
|
2018
|
+
if(!$(e.target).is('.xdialogoverlay,.xdialogblock')) return;
|
|
2019
|
+
var mouseDownTime = new Date().getTime();
|
|
2020
|
+
jsh.dialogBlock.one('mouseup.close', function(e){
|
|
2021
|
+
var mouseUpTime = new Date().getTime();
|
|
2022
|
+
if((mouseUpTime - mouseDownTime) > 5000) return;
|
|
2023
|
+
if(!$(e.target).is('.xdialogoverlay,.xdialogblock')) return;
|
|
2024
|
+
if(jsh.xDialog.length && (jsh.xDialog[0]==sel)){ e.preventDefault(); e.stopImmediatePropagation(); cancelfunc(); }
|
|
2025
|
+
});
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
jsh.$dialogBlock(sel).show();
|
|
2029
|
+
jsh.dialogBlock.show();
|
|
2030
|
+
if(jsh.XPage && jsh.XPage.LayoutOneColumn) jsh.XPage.LayoutOneColumn(jsh.$dialogBlock(sel)[0], { reset: true });
|
|
2031
|
+
jsh.XWindowResize();
|
|
2032
|
+
setTimeout(function(){
|
|
2033
|
+
jsh.XWindowResize();
|
|
2034
|
+
if(jsh.$dialogBlock(sel + ' .default_focus').length) jsh.$dialogBlock(sel + ' .default_focus').focus();
|
|
2035
|
+
else jsh.$dialogBlock(sel).$find('input:visible,textarea:visible,select:visible').first().focus();
|
|
2036
|
+
}, 1);
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
2028
2039
|
};
|
|
2029
2040
|
|
|
2030
2041
|
XExt.AcceptDialog = function(){
|