本文整理汇总了TypeScript中w2ui.w2popup.open方法的典型用法代码示例。如果您正苦于以下问题:TypeScript w2popup.open方法的具体用法?TypeScript w2popup.open怎么用?TypeScript w2popup.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2ui.w2popup
的用法示例。
在下文中一共展示了w2popup.open方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createEvaluateDialog
function createEvaluateDialog(inputText, dialogTitle) {
var windowHeight = $(window).height(); // returns height of browser viewport
var windowWidth = $(window).width(); // returns width of browser viewport
var dialogBody = createGridDialogLayout(inputText ? Common.escapeHtml(inputText) : '');
var focusInput = function() {
var element = document.getElementById('dialogPath');
element.contentEditable = "true";
element.focus();
};
var executeEvaluation = function() {
var text = $("#dialogPath").html();
var expression = Common.clearHtml(text);
Command.browseScriptEvaluation([], expression, true); // clear the variables
};
w2popup.open({
title : dialogTitle,
body : dialogBody.content,
buttons : '<button id="dialogSave" class="btn dialogButton">Evaluate</button>',
width : Math.max(700, windowWidth / 2),
height : Math.max(400, windowHeight / 2),
overflow : 'hidden',
color : '#999',
speed : '0.3',
opacity : '0.8',
modal : false,
showClose : true,
showMax : true,
onOpen : function(event) {
setTimeout(function() {
dialogBody.init(); // bind the functions
$('#dialog').w2grid({
recordTitles: false, // show tooltips
name : 'evaluation',
columns : [ {
field : 'name',
caption : 'Name',
size : '40%',
sortable : false
}, {
field : 'value',
caption : 'Value',
size : '30%',
sortable : false
}, {
field : 'type',
caption : 'Type',
size : '30%'
} ],
onClick : function(event) {
var grid = this;
event.onComplete = function() {
var sel = grid.getSelection();
if (sel.length == 1) {
var record = grid.get(sel[0]);
var text = $("#dialogPath").html();
var expression = Common.clearHtml(text);
VariableManager.toggleExpandEvaluation(record.path, expression);
}
grid.selectNone();
grid.refresh();
}
}
});
focusInput();
setTimeout(function() {
VariableManager.showVariables();
}, 200);
}, 200);
},
onClose : function(event) {
w2ui['evaluation'].destroy(); // destroy grid so you can recreate it
//$("#dialog").remove(); // delete the element
VariableManager.clearEvaluation();
Command.browseScriptEvaluation([], "", true); // clear the variables
},
onMax : function(event) {
event.onComplete = function() {
w2ui['evaluation'].refresh(); // resize
focusInput();
}
$(window).trigger('resize');
},
onMin : function(event) {
event.onComplete = function() {
w2ui['evaluation'].refresh(); // resize
focusInput();
}
$(window).trigger('resize');
},
onKeydown : function(event) {
console.log('keydown');
}
});
$("#dialogSave").click(function() {
executeEvaluation();
});
}
示例2: createTreeDialog
function createTreeDialog(resourceDetails: FilePath, foldersOnly: boolean, saveCallback: any, ignoreOrCancelCallback: any, nameIsBlank: boolean, dialogTitle: string, treePath: string) {
var windowHeight: number = $(window).height(); // returns height of browser viewport
var windowWidth: number = $(window).width(); // returns width of browser viewport
var dialogExpandPath: string = "/";
if (resourceDetails != null) {
dialogExpandPath = resourceDetails.getProjectDirectory(); // /src/blah
}
var dialogBody = createFileSelectionDialogLayout(dialogExpandPath, '');
var focusInput = function() {
var element = document.getElementById('dialogPath');
element.contentEditable = "true";
element.focus();
};
var createFinalPath = function() {
var originalDialogFileName = $('#dialogPath').html();
var originalDialogFolder = $('#dialogFolder').html();
var dialogPathName: string = FileTree.cleanResourcePath(originalDialogFileName);
var dialogFolder: string = FileTree.cleanResourcePath(originalDialogFolder);
var dialogProjectPath: string = dialogFolder + "/" + dialogPathName; // /src/blah/script.snap
var dialogPathDetails: FilePath = FileTree.createResourcePath(dialogProjectPath);
return dialogPathDetails;
}
w2popup.open({
title : dialogTitle,
body : dialogBody.content,
buttons : '<button id="dialogSave" class="btn dialogButton">Save</button><button id="dialogCancel" class="btn dialogButton">Cancel</button>',
width : Math.max(500, windowWidth / 2),
height : Math.max(400, windowHeight / 2),
overflow : 'hidden',
color : '#999',
speed : '0.3',
opacity : '0.8',
modal : true,
showClose : true,
showMax : true,
onOpen : function(event) {
setTimeout(function() {
dialogBody.init();
focusInput();
}, 200);
},
onClose : function(event) {
console.log('close');
},
onMax : function(event) {
console.log('max');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
};
},
onMin : function(event) {
console.log('min');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
};
},
onKeydown : function(event) {
console.log('keydown');
}
});
$("#dialogSave").click(function() {
if(saveCallback) {
var dialogPathDetails: FilePath = createFinalPath();
saveCallback(dialogPathDetails);
}
w2popup.close();
});
$("#dialogCancel").click(function() {
if(ignoreOrCancelCallback) {
var dialogPathDetails: FilePath = createFinalPath();
ignoreOrCancelCallback(dialogPathDetails);
}
w2popup.close();
});
if (resourceDetails != null) {
$('#dialogFolder').html(FileTree.cleanResourcePath(resourceDetails.getProjectDirectory())); // /src/blah
if(!nameIsBlank) {
$('#dialogPath').html(FileTree.cleanResourcePath(resourceDetails.getFileName())); // script.snap
}
}
FileTree.createTree(treePath, "dialog", "dialogTree", dialogExpandPath, foldersOnly, null, function(event, data) {
var selectedFileDetails: FilePath = FileTree.createResourcePath(data.node.tooltip);
if (data.node.isFolder()) {
$('#dialogFolder').html(FileTree.cleanResourcePath(selectedFileDetails.getProjectDirectory()));
//$('#dialogPath').html(""); // DO NOT CLEAR THE PATH INPUT
} else {
$('#dialogFolder').html(FileTree.cleanResourcePath(selectedFileDetails.getProjectDirectory())); // /src/blah
$('#dialogPath').html(FileTree.cleanResourcePath(selectedFileDetails.getFileName())); // file.snap
}
});
}
示例3: createListDialog
export function createListDialog(listFunction, patternList, dialogTitle) { // listFunction(token): [a, b, c]
var windowHeight = $(window).height(); // returns height of browser viewport
var windowWidth = $(window).width(); // returns width of browser viewport
var dialogBody = createListDialogLayout();
var focusInput = function() {
var element = document.getElementById('dialogPath');
element.contentEditable = "true";
element.focus();
};
w2popup.open({
title : dialogTitle,
body : dialogBody.content,
buttons : '<button id="dialogCancel" class="btn dialogButton">Cancel</button>',
width : Math.max(800, windowWidth / 2),
height : Math.max(400, windowHeight / 2),
overflow : 'hidden',
color : '#999',
speed : '0.3',
opacity : '0.8',
modal : true,
showClose : true,
showMax : true,
onOpen : function(event) {
setTimeout(function() {
dialogBody.init();
$('#dialogPath').on('change keyup paste', function() {
var expressionText = $("#dialogPath").html();
// add a delay before you execute
executeIfTextUnchanged(expressionText, "dialogPath", 300, function() {
var expressionPattern = null;
if(patternList) {
expressionPattern = $("#dialogFolder").html();
expressionPattern = Common.clearHtml(expressionPattern);
}
if(expressionText) {
expressionText = Common.clearHtml(expressionText);
}
listFunction(expressionText, expressionPattern, function(list, requestedExpression) {
var currentExpression = $("#dialogPath").html();
if(!requestedExpression || requestedExpression == currentExpression) {
var content = createDialogListTable(list);
if(content.content){
$("#dialog").html(content.content);
}else {
$("#dialog").html('');
}
// this is kind of crap, but we need to be sure the html is rendered before binding
if(content.init) {
setTimeout(content.init, 100); // register the init function to run
}
}
});
});
});
focusInput();
}, 200);
},
onMax : function(event) {
console.log('max');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
};
},
onMin : function(event) {
console.log('min');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
};
}
});
$("#dialogSave").click(function() {
w2popup.close();
});
$("#dialogCancel").click(function() {
w2popup.close();
});
}
示例4: createTextSearchAndReplaceDialog
export function createTextSearchAndReplaceDialog(listFunction, fileFilterPatterns, dialogTitle) { // listFunction(token): [a, b, c]
var windowHeight = $(window).height(); // returns height of browser viewport
var windowWidth = $(window).width(); // returns width of browser viewport
var focusInput = function() {
var element = document.getElementById('searchText');
element.contentEditable = "true";
element.focus();
};
var executeSearch = function() {
var expressionText = $("#searchText").html();
// add a delay before you execute
executeIfTextUnchanged(expressionText, "searchText", 300, function() {
var searchCriteria = {
caseSensitive: isCheckboxSelected("inputCaseSensitive"),
regularExpression: isCheckboxSelected("inputRegularExpression"),
wholeWord: isCheckboxSelected("inputWholeWord")
};
var expressionPattern = null;
if(fileFilterPatterns) {
expressionPattern = $("#fileFilterPatterns").html();
expressionPattern = Common.clearHtml(expressionPattern);
}
if(expressionText) {
expressionText = Common.clearHtml(expressionText);
}
listFunction(expressionText, expressionPattern, searchCriteria, function(list, requestedText) {
var currentText = $("#searchText").html();
if(!requestedText || currentText == requestedText) {
var content = createDialogListTable(list);
if(content.content){
$("#dialog").html(content.content);
}else {
$("#dialog").html('');
}
// this is kind of crap, but we need to be sure the html is rendered before binding
if(content.init) {
setTimeout(content.init, 100); // register the init function to run
}
}
});
});
};
var dialogBody = createTextSearchAndReplaceDialogLayout(fileFilterPatterns, '', executeSearch);
w2popup.open({
title : dialogTitle,
body : dialogBody.content,
buttons : '<button id="dialogSave" class="btn dialogButton">Replace</button><button id="dialogCancel" class="btn dialogButton">Cancel</button>',
width : Math.max(800, windowWidth / 2),
height : Math.max(400, windowHeight / 2),
overflow : 'hidden',
color : '#999',
speed : '0.3',
opacity : '0.8',
modal : true,
showClose : true,
showMax : true,
onOpen : function(event) {
setTimeout(function() {
dialogBody.init();
$('#searchText').on('change keyup paste', executeSearch);
// $('#inputCaseSensitive').change(executeSearch);
// $('#inputRegularExpression').change(executeSearch);
// $('#inputWholeWord').change(executeSearch);
focusInput();
}, 200);
},
onMax : function(event) {
console.log('max');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
};
},
onMin : function(event) {
console.log('min');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
};
}
});
$("#dialogSave").click(function() {
var searchText = $("#searchText").html();
var replaceText = $("#replaceText").html();
var filePatterns = $("#fileFilterPatterns").html();
var searchCriteria = {
caseSensitive: isCheckboxSelected("inputCaseSensitive"),
regularExpression: isCheckboxSelected("inputRegularExpression"),
wholeWord: isCheckboxSelected("inputWholeWord"),
enableReplace: true,
replace: replaceText
};
Command.replaceTokenInFiles(searchText, searchCriteria, filePatterns);
w2popup.close();
});
//.........这里部分代码省略.........
示例5: createTreeOpenDialog
export function createTreeOpenDialog(openCallback, closeCallback, dialogTitle, buttonText, treePath) {
var windowHeight = $(window).height(); // returns height of browser viewport
var windowWidth = $(window).width(); // returns width of browser viewport
var completeFunction = function() {
var originalDialogFolder: string = $('#dialogPath').html();
var dialogFolder: string = FileTree.cleanResourcePath(originalDialogFolder); // clean up path
var dialogPathDetails: FilePath = FileTree.createResourcePath(dialogFolder);
var selectedDirectory: string = dialogPathDetails.getProjectDirectory();
if(selectedDirectory.indexOf("/") == 0) {
selectedDirectory = selectedDirectory.substring(1);
}
openCallback(dialogPathDetails, selectedDirectory);
};
var dialogBody = createFileFolderSelectionDialogLayout();
var focusInput = function() {
var element = document.getElementById('dialogPath');
element.contentEditable = "true";
element.focus();
};
w2popup.open({
title : dialogTitle,
body : dialogBody.content,
buttons : '<button id="dialogSave" class="btn dialogButton">'+buttonText+'</button>',
width : Math.max(500, windowWidth / 2),
height : Math.max(400, windowHeight / 2),
overflow : 'hidden',
color : '#999',
speed : '0.3',
opacity : '0.8',
modal : true,
showClose : true,
showMax : true,
onOpen : function(event) {
setTimeout(function() {
dialogBody.init();
focusInput();
}, 200);
},
onClose : function(event) {
closeCallback(); // this should probably be a parameter
},
onMax : function(event) {
console.log('max');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
}
},
onMin : function(event) {
console.log('min');
$(window).trigger('resize');
event.onComplete = function() {
focusInput();
}
},
onKeydown : function(event) {
console.log('keydown');
}
});
$("#dialogSave").click(function() {
completeFunction();
w2popup.close();
});
FileTree.createTreeOfDepth(treePath, "dialog", "dialogTree", "/" + Common.getProjectName(), true, null, function(event, data) {
var selectedFileDetails: FilePath = FileTree.createResourcePath(data.node.tooltip);
var selectedDirectory = selectedFileDetails.getProjectDirectory();
if(selectedDirectory.indexOf("/") == 0) {
selectedDirectory = selectedDirectory.substring(1);
}
$('#dialogPath').html(FileTree.cleanResourcePath(selectedDirectory));
}, 2);
}