laravel-jstools
Version:
JS tools for building front-side of Laravel applications
52 lines (51 loc) • 3.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppServiceProvider = void 0;
const laravel_jstools_di_1 = require("laravel-jstools-di");
const JSToolsAbstractMap_1 = require("../JSToolsAbstractMap");
const TranslateService_1 = require("../../services/TranslateService/TranslateService");
const ConsoleNotyService_1 = require("../../services/NotyService/ConsoleNotyService");
const AxiosService_1 = require("../../services/AxiosService/AxiosService");
const EntityTypeEnum_1 = require("../../entities/EntityTypeEnum");
const JQueryForm_1 = require("../../entities/Form/JQueryForm");
const BS52Modal_1 = require("../../entities/Modal/BS52Modal");
const PageService_1 = require("../../services/PageService/PageService");
class AppServiceProvider extends laravel_jstools_di_1.ServiceProvider {
register() {
this.singleton(JSToolsAbstractMap_1.JSToolsAbstractMap.AxiosServiceContract, () => {
return new AxiosService_1.AxiosService();
});
this.alias(JSToolsAbstractMap_1.JSToolsAbstractMap.AxiosServiceContract, 'a');
this.singleton(JSToolsAbstractMap_1.JSToolsAbstractMap.TranslateServiceContract, () => {
return new TranslateService_1.TranslateService({
langDefault: this.appData.lang.default,
langCurrent: this.appData.lang.current,
translationList: this.appData.lang.translationList,
});
});
this.alias(JSToolsAbstractMap_1.JSToolsAbstractMap.TranslateServiceContract, 't');
this.singleton(JSToolsAbstractMap_1.JSToolsAbstractMap.NotyServiceContract, () => {
return new ConsoleNotyService_1.ConsoleNotyService();
});
this.alias(JSToolsAbstractMap_1.JSToolsAbstractMap.NotyServiceContract, 'n');
this.singleton(JSToolsAbstractMap_1.JSToolsAbstractMap.PageServiceContract, () => {
return new PageService_1.PageService();
});
this.alias(JSToolsAbstractMap_1.JSToolsAbstractMap.PageServiceContract, 'p');
this.bind(JSToolsAbstractMap_1.JSToolsAbstractMap.FormContract, (params) => {
switch (params.entityType) {
case EntityTypeEnum_1.EntityTypeEnum.bs_5_2:
return new JQueryForm_1.JQueryForm(params.formId, params.formData, params.showNoty, params.componentsOptions);
}
return new JQueryForm_1.JQueryForm(params.formId, params.formData, params.showNoty, params.componentsOptions);
});
this.bind(JSToolsAbstractMap_1.JSToolsAbstractMap.ModalContract, (params) => {
switch (params.entityType) {
case EntityTypeEnum_1.EntityTypeEnum.bs_5_2:
return new BS52Modal_1.BS52Modal(params.modalId, params.modalUsage, params.modalData, params.showNoty, params.tools);
}
return new BS52Modal_1.BS52Modal(params.modalId, params.modalUsage, params.modalData, params.showNoty, params.tools);
});
}
}
exports.AppServiceProvider = AppServiceProvider;