Use js modules

This commit is contained in:
Dennis Eichhorn 2019-04-02 22:44:46 +02:00
parent 76d483a3a6
commit 400bc04405
5 changed files with 140 additions and 228 deletions

View File

@ -184,8 +184,10 @@
</div>
</div>
<script>
const loginRequest = new jsOMS.Message.Request.Request('http://127.0.0.1/en/api/login', 'POST', 'json');
<script type="module">
import { Request } from "../../../jsOMS/Message/Request/Request.js";
const loginRequest = new Request('http://127.0.0.1/en/api/login', 'POST', 'json');
loginRequest.setData({user: 'admin', pass: 'orange'});
loginRequest.send();
</script>

View File

@ -9,117 +9,7 @@
<link rel="stylesheet" type="text/css" href="../../../Web/Backend/css/backend.css">
<link rel="stylesheet" type="text/css" href="../../../Resources/fontawesome/css/font-awesome.min.css">
<script src="../../../jsOMS/Utils/oLib.js"></script>
<script src="../../../jsOMS/Asset/AssetManager.js"></script>
<script src="../../../jsOMS/Autoloader.js"></script>
<script src="../../../jsOMS/Account/AccountType.js"></script>
<script src="../../../jsOMS/Account/AccountManager.js"></script>
<script src="../../../jsOMS/Uri/Http.js"></script>
<script src="../../../jsOMS/Uri/UriFactory.js"></script>
<script src="../../../jsOMS/DataStorage/CacheManager.js"></script>
<script src="../../../jsOMS/DataStorage/LocalStorage.js"></script>
<script src="../../../jsOMS/DataStorage/StorageManager.js"></script>
<script src="../../../jsOMS/Event/EventManager.js"></script>
<script src="../../../jsOMS/Message/Request/BrowserType.js"></script>
<script src="../../../jsOMS/Message/Request/OSType.js"></script>
<script src="../../../jsOMS/Message/Request/RequestMethod.js"></script>
<script src="../../../jsOMS/Message/Request/RequestType.js"></script>
<script src="../../../jsOMS/Message/Request/Request.js"></script>
<script src="../../../jsOMS/UI/ActionManager.js"></script>
<script src="../../../jsOMS/Message/Response/ResponseType.js"></script>
<script src="../../../jsOMS/Message/Response/ResponseManager.js"></script>
<script src="../../../jsOMS/Message/Response/Response.js"></script>
<script src="../../../jsOMS/Message/Notification/App/AppNotification.js"></script>
<script src="../../../jsOMS/Message/Notification/Browser/BrowserNotification.js"></script>
<script src="../../../jsOMS/Message/Notification/NotificationType.js"></script>
<script src="../../../jsOMS/Message/Notification/NotificationLevel.js"></script>
<script src="../../../jsOMS/Message/Notification/NotificationManager.js"></script>
<script src="../../../jsOMS/Message/Notification/NotificationMessage.js"></script>
<script src="../../../jsOMS/Module/ModuleFactory.js"></script>
<script src="../../../jsOMS/Module/ModuleManager.js"></script>
<script src="../../../jsOMS/Dispatcher/Dispatcher.js"></script>
<script src="../../../jsOMS/Log/Logger.js"></script>
<script src="../../../jsOMS/Log/LogLevel.js"></script>
<script src="../../../jsOMS/UI/Component/Form.js"></script>
<script src="../../../jsOMS/UI/Component/Table.js"></script>
<script src="../../../jsOMS/UI/Input/InputManager.js"></script>
<script src="../../../jsOMS/UI/Input/Keyboard/KeyboardManager.js"></script>
<script src="../../../jsOMS/UI/Input/Mouse/ClickType.js"></script>
<script src="../../../jsOMS/UI/Input/Mouse/EventType.js"></script>
<script src="../../../jsOMS/UI/Input/Mouse/MouseManager.js"></script>
<script src="../../../jsOMS/UI/Input/Touch/TouchManager.js"></script>
<script src="../../../jsOMS/UI/Input/Voice/VoiceManager.js"></script>
<script src="../../../jsOMS/UI/Input/Voice/ReadManager.js"></script>
<script src="../../../jsOMS/UI/Input/Voice/SpeechManager.js"></script>
<script src="../../../jsOMS/UI/Component/Tab.js"></script>
<script src="../../../jsOMS/UI/Component/AdvancedInput.js"></script>
<script src="../../../jsOMS/UI/Loader.js"></script>
<script src="../../../jsOMS/UI/DragNDrop.js"></script>
<script src="../../../jsOMS/UI/GeneralUI.js"></script>
<script src="../../../jsOMS/UI/UIManager.js"></script>
<script src="../../../jsOMS/Views/FormView.js"></script>
<script src="../../../jsOMS/Views/TableView.js"></script>
<script src="../../../jsOMS/Utils/Parser/Markdown.js"></script>
<script src="../../../jsOMS/Model/Message/DomActionType.js"></script>
<script src="../../../jsOMS/Model/Message/DomAction.js"></script>
<script src="../../../jsOMS/Model/Message/FormValidation.js"></script>
<script src="../../../jsOMS/Model/Message/NotifyType.js"></script>
<script src="../../../jsOMS/Model/Message/Notify.js"></script>
<script src="../../../jsOMS/Model/Message/Redirect.js"></script>
<script src="../../../jsOMS/Model/Message/Reload.js"></script>
<script src="../../../jsOMS/Model/Action/Message/Request.js"></script>
<script src="../../../jsOMS/Model/Action/Message/Log.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Popup.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Remove.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Show.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Hide.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Focus.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Datalist/Clear.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Datalist/Append.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Table/Clear.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/Table/Append.js"></script>
<script src="../../../jsOMS/Model/Action/Event/Prevent.js"></script>
<script src="../../../jsOMS/Model/Action/Utils/Timer.js"></script>
<script src="../../../jsOMS/Model/Action/Validate/Keypress.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/SetValue.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/RemoveValue.js"></script>
<script src="../../../jsOMS/Model/Action/Dom/GetValue.js"></script>
<script src="../../../Web/Backend/js/config.js"></script>
<script src="../../../Web/Backend/js/global/ActionEvents.js"></script>
<script src="../../../Web/Backend/js/global/KeyboardEvents.js"></script>
<script src="../../../Web/Backend/js/global/MouseEvents.js"></script>
<script src="../../../Web/Backend/js/global/ResponseEvents.js"></script>
<script src="../../../Web/Backend/js/global/TouchEvents.js"></script>
<script src="../../../Web/Backend/js/global/VoiceEvents.js"></script>
<script src="../../../Resources/d3/d3.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../../cssOMS/chart/chart.css">
<link rel="stylesheet" type="text/css" href="../../../cssOMS/chart/chart_line.css">
<link rel="stylesheet" type="text/css" href="../../../cssOMS/chart/chart_bar.css">
<script src="../../../jsOMS/Utils/oLib.js"></script>
<script src="../../../jsOMS/Asset/AssetManager.js"></script>
<script src="../../../jsOMS/Autoloader.js"></script>
<script src="../../../jsOMS/Chart/ChartAbstract.js"></script>
<script src="../../../jsOMS/Chart/LineChart.js"></script>
<script src="../../../jsOMS/Chart/AreaChart.js"></script>
<script src="../../../jsOMS/Chart/DiffAreaChart.js"></script>
<script src="../../../jsOMS/Chart/StackedAreaChart.js"></script>
<script src="../../../jsOMS/Chart/ColumnChart.js"></script>
<script src="../../../jsOMS/Chart/BarChart.js"></script>
<script src="../../../jsOMS/Chart/GroupedColumnChart.js"></script>
<script src="../../../jsOMS/Chart/GroupedBarChart.js"></script>
<script src="../../../jsOMS/Chart/StackedColumnChart.js"></script>
<script src="../../../jsOMS/Chart/StackedBarChart.js"></script>
<script src="../../../jsOMS/Chart/PieChart.js"></script>
<script src="../../../jsOMS/Chart/DonutChart.js"></script>
<script src="../../../jsOMS/Chart/WaterfallChart.js"></script>
<script src="../../../jsOMS/Chart/VWaterfallChart.js"></script>
<script src="../../../jsOMS/Chart/PyramidChart.js"></script>
<script src="../../../jsOMS/Chart/ScatterplotChart.js"></script>
<script src="../../../jsOMS/Chart/CalendarChart.js"></script>
<script src="../../../jsOMS/Chart/CandlestickChart.js"></script>
<script src="../../../jsOMS/Chart/OhlcChart.js"></script>
<script src="../load.js"></script>
<script src="../load.js" type="module"></script>
</head>
<body>
<header>

View File

@ -20,44 +20,45 @@
</div>
</template>
</div>
<script>
<script type="module">
import { } from '';
document.getElementById('okButton').addEventListener('click', function() {
window.omsApp.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(
new NotificationMessage(
'ok',
'Some Title',
'This is a message content.'
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
), NotificationType.APP_NOTIFICATION
);
});
document.getElementById('infoButton').addEventListener('click', function() {
window.omsApp.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(
new NotificationMessage(
'info',
'Some Title',
'This is a message content.'
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
), NotificationType.APP_NOTIFICATION
);
});
document.getElementById('warningButton').addEventListener('click', function() {
window.omsApp.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(
new NotificationMessage(
'warning',
'Some Title',
'This is a message content.'
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
), NotificationType.APP_NOTIFICATION
);
});
document.getElementById('errorButton').addEventListener('click', function() {
window.omsApp.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(
new NotificationMessage(
'error',
'Some Title',
'This is a message content.'
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
), NotificationType.APP_NOTIFICATION
);
});
</script>

View File

@ -524,10 +524,13 @@
</section>
</template>
<script>
const loginRequest = new jsOMS.Message.Request.Request('http://127.0.0.1/en/api/login', 'POST', 'json');
<script type="module">
import { Request } from '../../../jsOMS/Message/Request/Request.js';
import { Table } from '../../../jsOMS/UI/Component/Table.js';
const loginRequest = new Request('http://127.0.0.1/en/api/login', 'POST', 'json');
loginRequest.setData({user: 'admin', pass: 'orange'});
loginRequest.send();
jsOMS.UI.Component.Table.getRemoteData(document.getElementById('table3'));
Table.getRemoteData(document.getElementById('table3'));
</script>

View File

@ -1,32 +1,50 @@
(function (jsOMS)
{
"use strict";
import { AssetManager } from '../../jsOMS/Asset/AssetManager.js';
import { Logger } from '../../jsOMS/Log/Logger.js';
import { CacheManager } from '../../jsOMS/DataStorage/CacheManager.js';
import { StorageManager } from '../../jsOMS/DataStorage/StorageManager.js';
import { EventManager } from '../../jsOMS/Event/EventManager.js';
import { ResponseManager } from '../../jsOMS/Message/Response/ResponseManager.js';
import { Dispatcher } from '../../jsOMS/Dispatcher/Dispatcher.js';
import { AccountManager } from '../../jsOMS/Account/AccountManager.js';
import { UIManager } from '../../jsOMS/UI/UIManager.js';
import { InputManager } from '../../jsOMS/UI/Input/InputManager.js';
import { ModuleManager } from '../../jsOMS/Module/ModuleManager.js';
import { ReadManager } from '../../jsOMS/UI/Input/Voice/ReadManager.js';
import { VoiceManager } from '../../jsOMS/UI/Input/Voice/VoiceManager.js';
import { NotificationManager } from '../../jsOMS/Message/Notification/NotificationManager.js';
import { Http } from '../../jsOMS/Uri/Http.js';
import { UriFactory } from '../../jsOMS/Uri/UriFactory.js';
jsOMS.Application = class {
import { ACTION_EVENTS } from '../../Web/Backend/js/global/ActionEvents.js';
import { KEYBOARD_EVENTS } from '../../Web/Backend/js/global/KeyboardEvents.js';
import { MOUSE_EVENTS } from '../../Web/Backend/js/global/MouseEvents.js';
import { RESPONSE_EVENTS } from '../../Web/Backend/js/global/ResponseEvents.js';
import { TOUCH_EVENTS } from '../../Web/Backend/js/global/TouchEvents.js';
import { VOICE_EVENTS } from '../../Web/Backend/js/global/VoiceEvents.js';
export class Application {
constructor ()
{
jsOMS.Autoloader.initPreloaded();
this.logger = jsOMS.Log.Logger.getInstance();
this.logger = Logger.getInstance();
window.logger = this.logger;
this.cacheManager = new jsOMS.DataStorage.CacheManager();
this.storageManager = new jsOMS.DataStorage.StorageManager();
this.eventManager = new jsOMS.Event.EventManager();
this.responseManager = new jsOMS.Message.Response.ResponseManager();
this.dispatcher = new jsOMS.Dispatcher.Dispatcher();
this.assetManager = new jsOMS.Asset.AssetManager();
this.acountManager = new jsOMS.Account.AccountManager();
this.uiManager = new jsOMS.UI.UIManager(this);
this.inputManager = new jsOMS.UI.Input.InputManager(this);
this.moduleManager = new jsOMS.Module.ModuleManager(this);
this.readManager = new jsOMS.UI.Input.Voice.ReadManager();
this.voiceManager = new jsOMS.UI.Input.Voice.VoiceManager(this);
this.notifyManager = new jsOMS.Message.Notification.NotificationManager();
this.request = new jsOMS.Uri.Http(window.location.href);
this.cacheManager = new CacheManager();
this.storageManager = new StorageManager();
this.eventManager = new EventManager();
this.responseManager = new ResponseManager();
this.dispatcher = new Dispatcher();
this.assetManager = new AssetManager();
this.acountManager = new AccountManager();
this.uiManager = new UIManager(this);
this.inputManager = new InputManager(this);
this.moduleManager = new ModuleManager(this);
this.readManager = new ReadManager();
this.voiceManager = new VoiceManager(this);
this.notifyManager = new NotificationManager();
this.request = new Http(window.location.href);
this.request.setRootPath(
jsOMS.Uri.Http.parseUrl(
Http.parseUrl(
document.getElementsByTagName('base')[0].href
).path
);
@ -38,8 +56,8 @@
this.setMouseActions();
this.setVoiceActions();
jsOMS.Uri.UriFactory.setupUriBuilder(this.request);
jsOMS.Uri.UriFactory.setQuery('/lang', window.location.href.substr(this.request.getBase().length).split('/')[0]);
UriFactory.setupUriBuilder(this.request);
UriFactory.setQuery('/lang', window.location.href.substr(this.request.getBase().length).split('/')[0]);
this.uiManager.bind();
};
@ -106,13 +124,11 @@
this.voiceManager.setup();
this.voiceManager.start();
};
}
}(window.jsOMS = window.jsOMS || {}));
};
jsOMS.ready(function ()
{
jsOMS.ready(function () {
"use strict";
/** global: jsOMS */
window.omsApp = new jsOMS.Application();
window.omsApp = new Application();
});