Declare some js globals as Window properties
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
edc4a0d41f
commit
f5a5983bc1
@ -67,6 +67,7 @@
|
|||||||
"wrap-iife": "error",
|
"wrap-iife": "error",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-this-alias": "off"
|
"@typescript-eslint/no-this-alias": "off"
|
||||||
}
|
}
|
||||||
|
|||||||
8
js/global.d.ts
vendored
8
js/global.d.ts
vendored
@ -9,6 +9,12 @@ declare var maxInputVars: number;
|
|||||||
|
|
||||||
declare function sprintf(format: string, ...values: (string|number)[]): string;
|
declare function sprintf(format: string, ...values: (string|number)[]): string;
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
ol: any;
|
||||||
|
|
||||||
|
drawOpenLayers: () => any;
|
||||||
|
}
|
||||||
|
|
||||||
interface JQuery {
|
interface JQuery {
|
||||||
getPostData: () => string;
|
getPostData: () => string;
|
||||||
|
|
||||||
@ -27,4 +33,6 @@ interface JQuery {
|
|||||||
|
|
||||||
interface JQueryStatic {
|
interface JQueryStatic {
|
||||||
timepicker: JQueryUI.Datepicker;
|
timepicker: JQueryUI.Datepicker;
|
||||||
|
|
||||||
|
jqplot: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ var ChartType = {
|
|||||||
TIMELINE: 'timeline',
|
TIMELINE: 'timeline',
|
||||||
SCATTER: 'scatter'
|
SCATTER: 'scatter'
|
||||||
};
|
};
|
||||||
window.ChartType = ChartType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Column type enumeration
|
* Column type enumeration
|
||||||
@ -24,7 +23,6 @@ var ColumnType = {
|
|||||||
BOOLEAN: 'boolean',
|
BOOLEAN: 'boolean',
|
||||||
DATE: 'date'
|
DATE: 'date'
|
||||||
};
|
};
|
||||||
window.ColumnType = ColumnType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract chart factory which defines the contract for chart factories
|
* Abstract chart factory which defines the contract for chart factories
|
||||||
@ -211,8 +209,6 @@ var DataTable = function () {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
window.DataTable = DataTable;
|
|
||||||
|
|
||||||
/** *****************************************************************************
|
/** *****************************************************************************
|
||||||
* JQPlot specific code
|
* JQPlot specific code
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -729,4 +725,16 @@ JQPlotChartFactory.prototype.createChart = function (type, elementId) {
|
|||||||
return chart;
|
return chart;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
ChartType: typeof ChartType;
|
||||||
|
ColumnType: typeof ColumnType;
|
||||||
|
DataTable: typeof DataTable;
|
||||||
|
JQPlotChartFactory: typeof JQPlotChartFactory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.ChartType = ChartType;
|
||||||
|
window.ColumnType = ColumnType;
|
||||||
|
window.DataTable = DataTable;
|
||||||
window.JQPlotChartFactory = JQPlotChartFactory;
|
window.JQPlotChartFactory = JQPlotChartFactory;
|
||||||
|
|||||||
@ -887,7 +887,12 @@ DesignerHistory.buildQuery = function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// @ts-ignore
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
DesignerHistory: typeof DesignerHistory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.DesignerHistory = DesignerHistory;
|
window.DesignerHistory = DesignerHistory;
|
||||||
|
|
||||||
export { DesignerHistory };
|
export { DesignerHistory };
|
||||||
|
|||||||
@ -319,6 +319,20 @@ AJAX.registerTeardown('designer/init.js', function () {
|
|||||||
$('.trigger').off('click');
|
$('.trigger').off('click');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
designerConfig: {
|
||||||
|
db: string;
|
||||||
|
scriptTables: { j_tabs: any[], h_tabs: any[] };
|
||||||
|
scriptContr: any[];
|
||||||
|
server: number;
|
||||||
|
scriptDisplayField: any[];
|
||||||
|
displayPage: number;
|
||||||
|
tablesEnabled: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AJAX.registerOnload('designer/init.js', function () {
|
AJAX.registerOnload('designer/init.js', function () {
|
||||||
$('.trigger').on('click', function () {
|
$('.trigger').on('click', function () {
|
||||||
$('.panel').toggle('fast');
|
$('.panel').toggle('fast');
|
||||||
@ -328,7 +342,6 @@ AJAX.registerOnload('designer/init.js', function () {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const configValues = window.designerConfig;
|
const configValues = window.designerConfig;
|
||||||
|
|
||||||
DesignerConfig.jTabs = configValues.scriptTables.j_tabs;
|
DesignerConfig.jTabs = configValues.scriptTables.j_tabs;
|
||||||
|
|||||||
@ -3,6 +3,13 @@ import { AJAX } from './modules/ajax.ts';
|
|||||||
import { CommonParams } from './modules/common.ts';
|
import { CommonParams } from './modules/common.ts';
|
||||||
import { ajaxShowMessage } from './modules/ajax-message.ts';
|
import { ajaxShowMessage } from './modules/ajax-message.ts';
|
||||||
import getImageTag from './modules/functions/getImageTag.ts';
|
import getImageTag from './modules/functions/getImageTag.ts';
|
||||||
|
import type * as TraceKit from 'tracekit/tracekit.d.ts';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
TraceKit: typeof TraceKit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* general function, usually for data manipulation pages
|
* general function, usually for data manipulation pages
|
||||||
|
|||||||
@ -126,8 +126,6 @@ function loadJSAndGISEditor (value, field, type, inputName) {
|
|||||||
window.gisEditorLoaded = true;
|
window.gisEditorLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.loadJSAndGISEditor = loadJSAndGISEditor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the GIS editor via AJAX
|
* Loads the GIS editor via AJAX
|
||||||
*
|
*
|
||||||
@ -157,8 +155,6 @@ function loadGISEditor (value, field, type, inputName) {
|
|||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.loadGISEditor = loadGISEditor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens up the dialog for the GIS data editor.
|
* Opens up the dialog for the GIS data editor.
|
||||||
*/
|
*/
|
||||||
@ -189,8 +185,6 @@ function openGISEditor () {
|
|||||||
$gisEditor.fadeIn('fast');
|
$gisEditor.fadeIn('fast');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.openGISEditor = openGISEditor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and insert the GIS data in Well Known Text format
|
* Prepare and insert the GIS data in Well Known Text format
|
||||||
* to the input field.
|
* to the input field.
|
||||||
@ -402,3 +396,16 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
|||||||
$noOfGeomsInput.val(noOfGeoms + 1);
|
$noOfGeomsInput.val(noOfGeoms + 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
gisEditorLoaded: boolean;
|
||||||
|
loadJSAndGISEditor: typeof loadJSAndGISEditor;
|
||||||
|
loadGISEditor: typeof loadGISEditor;
|
||||||
|
openGISEditor: typeof openGISEditor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.loadJSAndGISEditor = loadJSAndGISEditor;
|
||||||
|
window.loadGISEditor = loadGISEditor;
|
||||||
|
window.openGISEditor = openGISEditor;
|
||||||
|
|||||||
@ -213,7 +213,7 @@ function getIdPrefix (element) {
|
|||||||
let validate = {};
|
let validate = {};
|
||||||
|
|
||||||
// form validator list
|
// form validator list
|
||||||
window.validators = {
|
const validators = {
|
||||||
// regexp: numeric value
|
// regexp: numeric value
|
||||||
regExpNumeric: /^[0-9]+$/,
|
regExpNumeric: /^[0-9]+$/,
|
||||||
// regexp: extract parts from PCRE expression
|
// regexp: extract parts from PCRE expression
|
||||||
@ -842,6 +842,14 @@ const Config = {
|
|||||||
on: on,
|
on: on,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
validators: typeof validators;
|
||||||
|
Config: typeof Config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.validators = validators;
|
||||||
window.Config = Config;
|
window.Config = Config;
|
||||||
|
|
||||||
export { Config };
|
export { Config };
|
||||||
|
|||||||
@ -1565,4 +1565,10 @@ var ConsoleDebug = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
Console: typeof Console;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export { Console };
|
export { Console };
|
||||||
|
|||||||
@ -3853,6 +3853,13 @@ $.fn.confirm = Functions.confirm;
|
|||||||
$.fn.sortTable = Functions.sortTable;
|
$.fn.sortTable = Functions.sortTable;
|
||||||
$.fn.getPostData = Functions.getPostData;
|
$.fn.getPostData = Functions.getPostData;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
codeMirrorEditor: CodeMirror.EditorFromTextArea | boolean | null;
|
||||||
|
Functions: typeof Functions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.Functions = Functions;
|
window.Functions = Functions;
|
||||||
|
|
||||||
export { Functions };
|
export { Functions };
|
||||||
|
|||||||
@ -1414,6 +1414,12 @@ const Navigation = {
|
|||||||
update: update,
|
update: update,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
Navigation: typeof Navigation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.Navigation = Navigation;
|
window.Navigation = Navigation;
|
||||||
|
|
||||||
export { Navigation };
|
export { Navigation };
|
||||||
|
|||||||
@ -1391,4 +1391,10 @@ const Sql = {
|
|||||||
initProfilingTables: initProfilingTables,
|
initProfilingTables: initProfilingTables,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
Sql: typeof Sql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.Sql = Sql;
|
window.Sql = Sql;
|
||||||
|
|||||||
@ -224,8 +224,6 @@ function verifyAfterSearchFieldChange (index, searchFormId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.verifyAfterSearchFieldChange = verifyAfterSearchFieldChange;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the an input contains multiple int values
|
* Validate the an input contains multiple int values
|
||||||
* @param {jQuery} jqueryInput the Jquery object
|
* @param {jQuery} jqueryInput the Jquery object
|
||||||
@ -462,7 +460,6 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.verificationsAfterFieldChange = verificationsAfterFieldChange;
|
|
||||||
/* End of fields validation*/
|
/* End of fields validation*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -941,4 +938,14 @@ function changeValueFieldType (elem, searchIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
verifyAfterSearchFieldChange: typeof verifyAfterSearchFieldChange;
|
||||||
|
verificationsAfterFieldChange: typeof verificationsAfterFieldChange;
|
||||||
|
changeValueFieldType: typeof changeValueFieldType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.verifyAfterSearchFieldChange = verifyAfterSearchFieldChange;
|
||||||
|
window.verificationsAfterFieldChange = verificationsAfterFieldChange;
|
||||||
window.changeValueFieldType = changeValueFieldType;
|
window.changeValueFieldType = changeValueFieldType;
|
||||||
|
|||||||
@ -40,8 +40,6 @@ function zoomAndPan () {
|
|||||||
$('path.vector', gisSvg).attr('stroke-width', 0.5 / scale);
|
$('path.vector', gisSvg).attr('stroke-width', 0.5 / scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.zoomAndPan = zoomAndPan;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initially loads either SVG or OSM visualization based on the choice.
|
* Initially loads either SVG or OSM visualization based on the choice.
|
||||||
*/
|
*/
|
||||||
@ -53,8 +51,6 @@ function selectVisualization () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.selectVisualization = selectVisualization;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds necessary styles to the div that contains the openStreetMap.
|
* Adds necessary styles to the div that contains the openStreetMap.
|
||||||
*/
|
*/
|
||||||
@ -69,8 +65,6 @@ function styleOSM () {
|
|||||||
$('#openlayersmap').css(cssObj);
|
$('#openlayersmap').css(cssObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.styleOSM = styleOSM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a reference to the gis svg element.
|
* Store a reference to the gis svg element.
|
||||||
*/
|
*/
|
||||||
@ -78,8 +72,6 @@ function storeGisSvgRef () {
|
|||||||
gisSvg = $('#placeholder').find('svg').get(0);
|
gisSvg = $('#placeholder').find('svg').get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.storeGisSvgRef = storeGisSvgRef;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds controls for zooming and panning.
|
* Adds controls for zooming and panning.
|
||||||
*/
|
*/
|
||||||
@ -102,8 +94,6 @@ function addZoomPanControllers () {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addZoomPanControllers = addZoomPanControllers;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes the GIS visualization to fit into the space available.
|
* Resizes the GIS visualization to fit into the space available.
|
||||||
*/
|
*/
|
||||||
@ -370,3 +360,19 @@ AJAX.registerOnload('table/gis_visualization.js', function () {
|
|||||||
$('#tooltip').remove();
|
$('#tooltip').remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
zoomAndPan: typeof zoomAndPan;
|
||||||
|
selectVisualization: typeof selectVisualization;
|
||||||
|
styleOSM: typeof styleOSM;
|
||||||
|
storeGisSvgRef: typeof storeGisSvgRef;
|
||||||
|
addZoomPanControllers: typeof addZoomPanControllers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.zoomAndPan = zoomAndPan;
|
||||||
|
window.selectVisualization = selectVisualization;
|
||||||
|
window.styleOSM = styleOSM;
|
||||||
|
window.storeGisSvgRef = storeGisSvgRef;
|
||||||
|
window.addZoomPanControllers = addZoomPanControllers;
|
||||||
|
|||||||
@ -25,4 +25,10 @@ function extendingValidatorMessages () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
extendingValidatorMessages: typeof extendingValidatorMessages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.extendingValidatorMessages = extendingValidatorMessages;
|
window.extendingValidatorMessages = extendingValidatorMessages;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user