some fixes on the TS interface of client-side api and TS conversation tool

This commit is contained in:
Ralf Becker 2020-02-09 12:27:39 +01:00 committed by Hadi Nategh
parent 7d85dcaa1f
commit d053a72a17
4 changed files with 17 additions and 13 deletions

View File

@ -44,9 +44,6 @@ require("../etemplate/et2_types");
* // Underscore private by convention
* }
* });
*
* @class AppJS
* @augments Class
*/
var EgwApp = /** @class */ (function () {
/**
@ -263,6 +260,7 @@ var EgwApp = /** @class */ (function () {
* @return {boolean} false - Returns false to stop event propagation
*/
EgwApp.prototype.setState = function (state, template) {
var _a;
// State should be an object, not a string, but we'll parse
if (typeof state == "string") {
if (state.indexOf('{') != -1 || state == 'null') {
@ -310,7 +308,7 @@ var EgwApp = /** @class */ (function () {
url = egw.link('/index.php', jQuery.extend({ 'favorite': safe_name }, egw.link_get_registry(this.appname, 'list')));
}
// if no list try index value from application
else if (egw.app(this.appname).index) {
else if ((_a = egw.app(this.appname)) === null || _a === void 0 ? void 0 : _a.index) {
url = egw.link('/index.php', 'menuaction=' + egw.app(this.appname).index + '&favorite=' + safe_name);
}
egw.open_link(url, undefined, undefined, this.appname);

View File

@ -57,9 +57,6 @@ export interface PushData
* // Underscore private by convention
* }
* });
*
* @class AppJS
* @augments Class
*/
export abstract class EgwApp
{
@ -367,7 +364,7 @@ export abstract class EgwApp
* @param {string} template template name to check, instead of trying all templates of current app
* @return {boolean} false - Returns false to stop event propagation
*/
setState(state, template)
setState(state, template? : string)
{
// State should be an object, not a string, but we'll parse
if(typeof state == "string")

View File

@ -45,7 +45,7 @@ declare interface Iapplication
*/
declare interface IegwData
{
timestamp: number;
timestamp?: number;
data: {[key:string]: any};
}
@ -771,7 +771,7 @@ declare interface IegwWndLocal extends IegwGlobal
* @param {object} _context
* @param {string} _prefix prefix for _jsFiles
*/
includeJS(_jsFiles : string|string[], _callback : Function, _context : object, _prefix? : string);
includeJS(_jsFiles : string|string[], _callback : Function, _context? : object, _prefix? : string);
/**
* Check if file is already included and optional mark it as included if not yet included
*
@ -1209,4 +1209,11 @@ declare function egwIsMobile() : string|null;
declare var mailvelope : any;
declare function egw_refresh(_msg : string, app : string, id? : string|number, _type?, targetapp?, replace?, _with?, msgtype?);
declare function egw_open();
declare function egw_open();
declare function egw_getWindowLeft() : number;
declare function egw_getWindowTop() : number;
declare function egw_getWindowInnerWidth() : number;
declare function egw_getWindowInnerHeight() : number;
declare function egw_getWindowOuterWidth() : number;
declare function egw_getWindowOuterHeight() : number;

View File

@ -24,7 +24,7 @@ $replace = array(
]);
},
"/^\tappname:\s*'([^']+)',/m" => "\treadonly appname = '$1';",
"/^\t([^: ,;(]+):\s*([^()]+),/m" => "\t\$1: $2;",
"/^\t([^: ,;(\t]+?):\s*([^()]+?),/m" => "\t\$1 : any = $2;",
"/^\t([^:\n]+):\s*function\s*\(.*this._super.(apply|call)\(/msU" =>
function($matches) {
return str_replace('this._super',
@ -33,8 +33,10 @@ $replace = array(
"/^\t([^:\n]+):\s*function\s*\(/m" => function($matches) {
return "\t".($matches[1] === 'init' ? 'constructor' : $matches[1]).'(';
},
// TS does not like to call parent constructor with super.apply(this, arguments) and we dont have arguments ...
'/\tsuper.apply\(this, *arguments\)/' => "\tsuper()",
"/^\t},$/m" => "\t}",
'/^ \* @version \$Id\$\n/m' => '',
'/^ \* @version \$Id[^$]*\$\n/m' => '',
'#^ \* @link http://www.egroupware.org#m' => ' * @link: https://www.egroupware.org',
);