@magic-xpa/angular 4.800.0-dev480.188 → 4.800.0-dev480.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/magic-xpa-angular.umd.js +436 -419
- package/bundles/magic-xpa-angular.umd.js.map +1 -1
- package/bundles/magic-xpa-angular.umd.min.js +1 -1
- package/bundles/magic-xpa-angular.umd.min.js.map +1 -1
- package/esm2015/src/ui/GuiInteractiveExecutor.js +8 -1
- package/esm2015/src/ui/router-container.magic.component.js +12 -5
- package/fesm2015/magic-xpa-angular.js +423 -410
- package/fesm2015/magic-xpa-angular.js.map +1 -1
- package/package.json +3 -3
- package/src/ui/GuiInteractiveExecutor.d.ts +1 -0
- package/src/ui/router-container.magic.component.d.ts +5 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNullOrUndefined, isUndefined } from 'util';
|
|
2
|
-
import { ɵɵdefineInjectable, ɵsetClassMetadata, Injectable,
|
|
2
|
+
import { ɵɵdefineInjectable, ɵsetClassMetadata, Injectable, ɵɵinject, NgModuleFactoryLoader, Injector, ɵɵdirectiveInject, ComponentFactoryResolver, ViewContainerRef, ɵɵdefineComponent, Component, Input, Output, ɵɵdefineDirective, Directive, ɵɵgetCurrentView, ɵɵelementStart, ɵɵlistener, ɵɵrestoreView, ɵɵnextContext, ɵɵtext, ɵɵelementEnd, ɵɵadvance, ɵɵtextInterpolate1, EventEmitter, ɵɵviewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ɵɵInheritDefinitionFeature, ɵɵtemplate, ɵɵelement, ɵɵproperty, ViewChild, ElementRef, ChangeDetectorRef, ɵɵstaticViewQuery, ɵɵgetInheritedFactory, ɵɵProvidersFeature, HostListener, Renderer2, Optional, ɵɵdefinePipe, Pipe, ɵɵprojection, ɵɵprojectionDef, ɵɵelementContainer, ɵɵreference, ɵɵresolveWindow, ɵɵtemplateRefExtractor, forwardRef, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
|
|
3
3
|
import { NgIf, NgStyle, DatePipe, NgTemplateOutlet, CommonModule, formatDate } from '@angular/common';
|
|
4
4
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
5
5
|
import { FormGroup, FormControl, Validators, NG_VALIDATORS, NG_VALUE_ACCESSOR, CheckboxControlValueAccessor, DefaultValueAccessor, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -8,9 +8,9 @@ import { __awaiter, __decorate, __metadata } from 'tslib';
|
|
|
8
8
|
import { Subject } from 'rxjs';
|
|
9
9
|
import { MagicBridge, getGuiEventObj, CookieService } from '@magic-xpa/engine';
|
|
10
10
|
import { InteractiveCommandType, OverlayType, Styles, HtmlProperties, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
|
|
11
|
-
import { MagicProperties,
|
|
11
|
+
import { MagicProperties, Logger, StrUtil, StorageAttribute, BindingLevel, StorageAttributeType, PICInterface } from '@magic-xpa/utils';
|
|
12
12
|
import { filter, map, debounceTime } from 'rxjs/operators';
|
|
13
|
-
import { NString,
|
|
13
|
+
import { NString, List, StringBuilder, RefParam } from '@magic-xpa/mscorelib';
|
|
14
14
|
import { Title } from '@angular/platform-browser';
|
|
15
15
|
import { fromEvent } from 'rxjs/internal/observable/fromEvent';
|
|
16
16
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
@@ -335,6 +335,324 @@ StylesMapManager.MagicPropertyToHtmlAttributeMap = new Map([
|
|
|
335
335
|
[MagicProperties.Wallpaper, "background-image"]
|
|
336
336
|
]);
|
|
337
337
|
|
|
338
|
+
class CommandsCollectorMagicService {
|
|
339
|
+
constructor(magic) {
|
|
340
|
+
this.magic = magic;
|
|
341
|
+
this.count = 0;
|
|
342
|
+
this.commands = new List();
|
|
343
|
+
this.subscription = null;
|
|
344
|
+
}
|
|
345
|
+
startCollecting() {
|
|
346
|
+
this.count++;
|
|
347
|
+
Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.startCollecting() --- " + this.count);
|
|
348
|
+
if (this.subscription === null) {
|
|
349
|
+
this.subscription = this.magic.refreshDom
|
|
350
|
+
.subscribe(command => {
|
|
351
|
+
this.commands.push(command);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
stopCollecting() {
|
|
356
|
+
this.count--;
|
|
357
|
+
Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.stopCollecting() --- " + this.count);
|
|
358
|
+
if (this.count === 0) {
|
|
359
|
+
this.subscription.unsubscribe();
|
|
360
|
+
this.subscription = null;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
GetCommands(taskId) {
|
|
364
|
+
const commands = this.commands.filter((command) => command.TaskTag === taskId);
|
|
365
|
+
commands.forEach(command => { this.commands.Remove(command); });
|
|
366
|
+
return commands;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
CommandsCollectorMagicService.ɵfac = function CommandsCollectorMagicService_Factory(t) { return new (t || CommandsCollectorMagicService)(ɵɵinject(EngineMagicService)); };
|
|
370
|
+
CommandsCollectorMagicService.ɵprov = ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac });
|
|
371
|
+
(function () { ɵsetClassMetadata(CommandsCollectorMagicService, [{
|
|
372
|
+
type: Injectable
|
|
373
|
+
}], function () { return [{ type: EngineMagicService }]; }, null); })();
|
|
374
|
+
|
|
375
|
+
class RouteCommand {
|
|
376
|
+
}
|
|
377
|
+
class RouterCommandsMagicService {
|
|
378
|
+
constructor() {
|
|
379
|
+
this.pendingRouteCommands = [];
|
|
380
|
+
}
|
|
381
|
+
AddRouteCommand(routeCommand) {
|
|
382
|
+
this.pendingRouteCommands.push(routeCommand);
|
|
383
|
+
}
|
|
384
|
+
ExecuteNextCommand() {
|
|
385
|
+
let pendingRouteCommand = this.pendingRouteCommands.shift();
|
|
386
|
+
if (!isNullOrUndefined(pendingRouteCommand)) {
|
|
387
|
+
pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
RouterCommandsMagicService.ɵfac = function RouterCommandsMagicService_Factory(t) { return new (t || RouterCommandsMagicService)(); };
|
|
392
|
+
RouterCommandsMagicService.ɵprov = ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac });
|
|
393
|
+
(function () { ɵsetClassMetadata(RouterCommandsMagicService, [{
|
|
394
|
+
type: Injectable
|
|
395
|
+
}], null, null); })();
|
|
396
|
+
|
|
397
|
+
class SubformMagicService {
|
|
398
|
+
constructor(task, activatedRoute, componentList, pendingCommandsCollector, router, routerCommandsMagicService, componentListMagicService, loader, injector) {
|
|
399
|
+
this.task = task;
|
|
400
|
+
this.activatedRoute = activatedRoute;
|
|
401
|
+
this.componentList = componentList;
|
|
402
|
+
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
403
|
+
this.router = router;
|
|
404
|
+
this.routerCommandsMagicService = routerCommandsMagicService;
|
|
405
|
+
this.componentListMagicService = componentListMagicService;
|
|
406
|
+
this.loader = loader;
|
|
407
|
+
this.injector = injector;
|
|
408
|
+
this.subformsDict = {};
|
|
409
|
+
this.routesDict = {};
|
|
410
|
+
this.currentRouteDefinition = null;
|
|
411
|
+
}
|
|
412
|
+
mgGetComp(subformName) {
|
|
413
|
+
if (subformName in this.subformsDict) {
|
|
414
|
+
let formName = this.subformsDict[subformName].formName;
|
|
415
|
+
if (formName)
|
|
416
|
+
return this.componentList.getComponent(formName);
|
|
417
|
+
}
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
mgGetParameters(subformName) {
|
|
421
|
+
if (subformName in this.subformsDict) {
|
|
422
|
+
return this.subformsDict[subformName].parameters;
|
|
423
|
+
}
|
|
424
|
+
else
|
|
425
|
+
return "";
|
|
426
|
+
}
|
|
427
|
+
deleteSubformComp(subformControlName, formName) {
|
|
428
|
+
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
|
429
|
+
if (this.subformsDict[subformControlName].formName === formName) {
|
|
430
|
+
this.subformsDict[subformControlName] = {};
|
|
431
|
+
this.task.refreshView();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
|
|
436
|
+
this.pendingCommandsCollector.startCollecting();
|
|
437
|
+
let refreshNeeded = false;
|
|
438
|
+
if (isNullOrUndefined(routerPath)) {
|
|
439
|
+
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
|
440
|
+
if (this.subformsDict[subformControlName].formName === formName) {
|
|
441
|
+
this.subformsDict[subformControlName] = {};
|
|
442
|
+
this.task.refreshView();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
let moduleRef = this.componentListMagicService.getModuleRef(formName);
|
|
446
|
+
if (moduleRef == null) {
|
|
447
|
+
let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(formName);
|
|
448
|
+
if (lazyLoadModule != null) {
|
|
449
|
+
this.loader
|
|
450
|
+
.load(lazyLoadModule.modulePath + "#" + lazyLoadModule.moduleName)
|
|
451
|
+
.then((moduleFactory) => {
|
|
452
|
+
moduleRef = moduleFactory.create(this.injector);
|
|
453
|
+
this.subformsDict[subformControlName] = {
|
|
454
|
+
formName,
|
|
455
|
+
parameters: { taskIdParam: taskId, taskDescription: taskDescription }
|
|
456
|
+
};
|
|
457
|
+
this.task.refreshView();
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
this.subformsDict[subformControlName] = {
|
|
463
|
+
formName,
|
|
464
|
+
parameters: { taskIdParam: taskId, taskDescription: taskDescription }
|
|
465
|
+
};
|
|
466
|
+
refreshNeeded = true;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
if (inDefaultOutlet)
|
|
471
|
+
subformControlName = "primary";
|
|
472
|
+
let routeParams = new List();
|
|
473
|
+
routeParams.push(routerPath);
|
|
474
|
+
if (params !== null) {
|
|
475
|
+
routeParams = routeParams.concat(params);
|
|
476
|
+
}
|
|
477
|
+
let routeCommand = {
|
|
478
|
+
callerMgSubformServiceRef: this,
|
|
479
|
+
routerOutletName: subformControlName,
|
|
480
|
+
formName: formName,
|
|
481
|
+
parameters: { taskIdParam: taskId, taskDescription: taskDescription },
|
|
482
|
+
routeParams: routeParams
|
|
483
|
+
};
|
|
484
|
+
if (SubformMagicService.currentCallerMgSubformServiceRef === null)
|
|
485
|
+
this.ExecuteRouteCommand(routeCommand);
|
|
486
|
+
else
|
|
487
|
+
this.routerCommandsMagicService.AddRouteCommand(routeCommand);
|
|
488
|
+
}
|
|
489
|
+
if (refreshNeeded)
|
|
490
|
+
this.task.refreshView();
|
|
491
|
+
}
|
|
492
|
+
ExecuteRouteCommand(routeCommand) {
|
|
493
|
+
let reusingComponent = false;
|
|
494
|
+
let currentSubformMagicService = routeCommand.callerMgSubformServiceRef;
|
|
495
|
+
let relativeRoute = SubformMagicService.getRelativeRoute(currentSubformMagicService.activatedRoute);
|
|
496
|
+
if (currentSubformMagicService.routesDict[routeCommand.routerOutletName] === routeCommand.routeParams[0]) {
|
|
497
|
+
currentSubformMagicService.router.navigate([{ outlets: { [routeCommand.routerOutletName]: null } }], { relativeTo: relativeRoute })
|
|
498
|
+
.then((result) => {
|
|
499
|
+
SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
|
|
500
|
+
currentSubformMagicService.currentRouteDefinition = {
|
|
501
|
+
formName: routeCommand.formName,
|
|
502
|
+
parameters: routeCommand.parameters
|
|
503
|
+
};
|
|
504
|
+
currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
|
|
509
|
+
currentSubformMagicService.currentRouteDefinition = {
|
|
510
|
+
formName: routeCommand.formName,
|
|
511
|
+
parameters: routeCommand.parameters
|
|
512
|
+
};
|
|
513
|
+
if (SubformMagicService.routerContainers.length > 0) {
|
|
514
|
+
let routeContainer = SubformMagicService.routerContainers[0];
|
|
515
|
+
SubformMagicService.routerContainers.shift();
|
|
516
|
+
routeContainer.initializeComponent();
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
PerformRouterNavigate(routerOutletName, routeParams) {
|
|
524
|
+
let relativeRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
525
|
+
this.router.navigate([{ outlets: { [routerOutletName]: routeParams } }], { relativeTo: relativeRoute })
|
|
526
|
+
.then((result) => {
|
|
527
|
+
if (result !== null && !result) {
|
|
528
|
+
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
529
|
+
subformMagicService.currentRouteDefinition = null;
|
|
530
|
+
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
531
|
+
subformMagicService.pendingCommandsCollector.stopCollecting();
|
|
532
|
+
subformMagicService.routerCommandsMagicService.ExecuteNextCommand();
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
init() {
|
|
537
|
+
const pendingCommands = this.pendingCommandsCollector.GetCommands(this.task.taskId);
|
|
538
|
+
if (pendingCommands.length > 0) {
|
|
539
|
+
pendingCommands.forEach(command => { this.task.executeCommand(command); });
|
|
540
|
+
this.task.refreshView();
|
|
541
|
+
}
|
|
542
|
+
this.pendingCommandsCollector.stopCollecting();
|
|
543
|
+
}
|
|
544
|
+
refreshView() {
|
|
545
|
+
this.task.refreshView();
|
|
546
|
+
}
|
|
547
|
+
static getRelativeRoute(sendActivatedRoute) {
|
|
548
|
+
let currentActiveRoute = sendActivatedRoute;
|
|
549
|
+
if (currentActiveRoute.snapshot.routeConfig !== null && currentActiveRoute.snapshot.routeConfig.path === '') {
|
|
550
|
+
currentActiveRoute = currentActiveRoute.parent;
|
|
551
|
+
if (!currentActiveRoute.snapshot.routeConfig.loadChildren)
|
|
552
|
+
console.log("getRelativeRoute(): both path and currentActiveRoute.snapshot.routeConfig.loadChildren are empty.");
|
|
553
|
+
}
|
|
554
|
+
return currentActiveRoute;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
558
|
+
SubformMagicService.routerContainers = new Array();
|
|
559
|
+
SubformMagicService.ɵfac = function SubformMagicService_Factory(t) { return new (t || SubformMagicService)(ɵɵinject(TaskMagicService), ɵɵinject(ActivatedRoute), ɵɵinject(ComponentListMagicService), ɵɵinject(CommandsCollectorMagicService), ɵɵinject(Router), ɵɵinject(RouterCommandsMagicService), ɵɵinject(ComponentListMagicService), ɵɵinject(NgModuleFactoryLoader), ɵɵinject(Injector)); };
|
|
560
|
+
SubformMagicService.ɵprov = ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
|
|
561
|
+
(function () { ɵsetClassMetadata(SubformMagicService, [{
|
|
562
|
+
type: Injectable
|
|
563
|
+
}], function () { return [{ type: TaskMagicService }, { type: ActivatedRoute }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: Router }, { type: RouterCommandsMagicService }, { type: ComponentListMagicService }, { type: NgModuleFactoryLoader }, { type: Injector }]; }, null); })();
|
|
564
|
+
|
|
565
|
+
class RouterContainerMagicComponent {
|
|
566
|
+
constructor(activatedRoute, router, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
|
|
567
|
+
this.activatedRoute = activatedRoute;
|
|
568
|
+
this.router = router;
|
|
569
|
+
this.magic = magic;
|
|
570
|
+
this.containerTaskService = containerTaskService;
|
|
571
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
572
|
+
this.viewContainerRef = viewContainerRef;
|
|
573
|
+
this.componentList = componentList;
|
|
574
|
+
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
575
|
+
this.routerCommandsMagicService = routerCommandsMagicService;
|
|
576
|
+
this.componentRef = null;
|
|
577
|
+
this.parentMgSubformService = null;
|
|
578
|
+
}
|
|
579
|
+
static get LastRoute() {
|
|
580
|
+
return RouterContainerMagicComponent.lastRoute;
|
|
581
|
+
}
|
|
582
|
+
ngOnInit() {
|
|
583
|
+
let outletname = this.activatedRoute.outlet;
|
|
584
|
+
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
585
|
+
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
586
|
+
RouterContainerMagicComponent.lastRoute = this.router.url;
|
|
587
|
+
if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
|
|
588
|
+
this.insertRouteEvent(currentActiveRoute);
|
|
589
|
+
SubformMagicService.routerContainers.push(this);
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
this.initializeComponent();
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
insertRouteEvent(currentActiveRoute) {
|
|
596
|
+
let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
|
|
597
|
+
guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
|
|
598
|
+
if (currentActiveRoute.snapshot.outlet !== 'primary')
|
|
599
|
+
guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
|
|
600
|
+
let calcRouterPath = currentActiveRoute.routeConfig.path;
|
|
601
|
+
if (calcRouterPath.length > 0) {
|
|
602
|
+
let routerPath = calcRouterPath;
|
|
603
|
+
let tokens = StrUtil.tokenize(routerPath, "/:");
|
|
604
|
+
guiEvent.RouterPath = tokens[0];
|
|
605
|
+
guiEvent.RouterParams = new List();
|
|
606
|
+
for (let i = 1; i < tokens.length; i++) {
|
|
607
|
+
guiEvent.RouterParams.push(this.activatedRoute.snapshot.params[tokens[i]]);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
this.containerTaskService.insertEvent(guiEvent);
|
|
611
|
+
}
|
|
612
|
+
initializeComponent() {
|
|
613
|
+
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
614
|
+
if (subformMagicService.currentRouteDefinition !== null) {
|
|
615
|
+
let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
|
|
616
|
+
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
|
|
617
|
+
this.componentRef = this.viewContainerRef.createComponent(componentFactory);
|
|
618
|
+
Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
|
|
619
|
+
let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
620
|
+
let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
|
|
621
|
+
subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
|
|
622
|
+
this.parentMgSubformService = subformMagicService;
|
|
623
|
+
subformMagicService.currentRouteDefinition = null;
|
|
624
|
+
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
625
|
+
let ignoreParamChange = true;
|
|
626
|
+
myActiveRoute.paramMap.subscribe(params => {
|
|
627
|
+
if (!ignoreParamChange)
|
|
628
|
+
this.insertRouteEvent(myActiveRoute);
|
|
629
|
+
ignoreParamChange = false;
|
|
630
|
+
});
|
|
631
|
+
this.parentMgSubformService.refreshView();
|
|
632
|
+
this.routerCommandsMagicService.ExecuteNextCommand();
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
ngOnDestroy() {
|
|
636
|
+
if (this.componentRef != null) {
|
|
637
|
+
this.componentRef.instance.task.close();
|
|
638
|
+
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
639
|
+
this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
|
|
640
|
+
RouterContainerMagicComponent.lastRoute = this.router.url;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
RouterContainerMagicComponent.lastRoute = "/";
|
|
645
|
+
RouterContainerMagicComponent.ɵfac = function RouterContainerMagicComponent_Factory(t) { return new (t || RouterContainerMagicComponent)(ɵɵdirectiveInject(ActivatedRoute), ɵɵdirectiveInject(Router), ɵɵdirectiveInject(EngineMagicService), ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ComponentFactoryResolver), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(ComponentListMagicService), ɵɵdirectiveInject(CommandsCollectorMagicService), ɵɵdirectiveInject(RouterCommandsMagicService)); };
|
|
646
|
+
RouterContainerMagicComponent.ɵcmp = ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
|
647
|
+
(function () { ɵsetClassMetadata(RouterContainerMagicComponent, [{
|
|
648
|
+
type: Component,
|
|
649
|
+
args: [{
|
|
650
|
+
selector: 'magic-route-outlet',
|
|
651
|
+
template: `
|
|
652
|
+
`
|
|
653
|
+
}]
|
|
654
|
+
}], function () { return [{ type: ActivatedRoute }, { type: Router }, { type: EngineMagicService }, { type: TaskMagicService }, { type: ComponentFactoryResolver }, { type: ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null); })();
|
|
655
|
+
|
|
338
656
|
class GuiInteractiveExecutor {
|
|
339
657
|
Run() {
|
|
340
658
|
try {
|
|
@@ -363,6 +681,9 @@ class GuiInteractiveExecutor {
|
|
|
363
681
|
case InteractiveCommandType.REFRESH_PAGE:
|
|
364
682
|
this.OnRefreshPage();
|
|
365
683
|
break;
|
|
684
|
+
case InteractiveCommandType.GET_LAST_ROUTE:
|
|
685
|
+
this.OnGetLastRoute();
|
|
686
|
+
break;
|
|
366
687
|
}
|
|
367
688
|
}
|
|
368
689
|
catch (ex) {
|
|
@@ -422,6 +743,9 @@ class GuiInteractiveExecutor {
|
|
|
422
743
|
else
|
|
423
744
|
this.command._boolVal = this.task.Records.list[guiRowIndex].isEditing;
|
|
424
745
|
}
|
|
746
|
+
OnGetLastRoute() {
|
|
747
|
+
this.command.resultString = RouterContainerMagicComponent.LastRoute;
|
|
748
|
+
}
|
|
425
749
|
}
|
|
426
750
|
|
|
427
751
|
let BaseMagicOverlayContainer = class BaseMagicOverlayContainer {
|
|
@@ -1698,346 +2022,119 @@ class TaskMagicService {
|
|
|
1698
2022
|
this.subscribeRefreshDom.unsubscribe();
|
|
1699
2023
|
this.interactiveCommands.complete();
|
|
1700
2024
|
this.customPropertiesSubject.complete();
|
|
1701
|
-
this.OnSelectedRowChanged.complete();
|
|
1702
|
-
}
|
|
1703
|
-
onComboboxSelectionChanged(event, idx, line) {
|
|
1704
|
-
let guiEvent = getGuiEventObj('selectionchanged', idx, line);
|
|
1705
|
-
if (typeof (event) == 'number') {
|
|
1706
|
-
guiEvent.Value = event;
|
|
1707
|
-
}
|
|
1708
|
-
else {
|
|
1709
|
-
if (!isNullOrUndefined(event.target)) {
|
|
1710
|
-
let indexes = new Array(event.target.selectedOptions.length);
|
|
1711
|
-
for (let i = 0; i < event.target.selectedOptions.length; i++) {
|
|
1712
|
-
indexes[i] = event.target.selectedOptions[i].index;
|
|
1713
|
-
}
|
|
1714
|
-
guiEvent.Value = indexes.join(',');
|
|
1715
|
-
}
|
|
1716
|
-
else
|
|
1717
|
-
guiEvent.Value = event.value;
|
|
1718
|
-
}
|
|
1719
|
-
this.insertEvent(guiEvent);
|
|
1720
|
-
}
|
|
1721
|
-
onListBoxSelectionChanged(event, idx) {
|
|
1722
|
-
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
1723
|
-
let selectedOptions;
|
|
1724
|
-
if (!isNullOrUndefined(event.target))
|
|
1725
|
-
selectedOptions = event.target.selectedOptions;
|
|
1726
|
-
else
|
|
1727
|
-
selectedOptions = event.source.selectedOptions.selected;
|
|
1728
|
-
let length = selectedOptions.length;
|
|
1729
|
-
let indexes = new Array(length);
|
|
1730
|
-
for (let i = 0; i < length; i++) {
|
|
1731
|
-
if (!isNullOrUndefined(event.target))
|
|
1732
|
-
indexes[i] = (selectedOptions[i]).index;
|
|
1733
|
-
else
|
|
1734
|
-
indexes[i] = (selectedOptions[i]).value;
|
|
1735
|
-
}
|
|
1736
|
-
guiEvent.Value = indexes;
|
|
1737
|
-
this.insertEvent(guiEvent);
|
|
1738
|
-
}
|
|
1739
|
-
onCheckChanged(event, idx, rowId) {
|
|
1740
|
-
if (typeof rowId === 'undefined')
|
|
1741
|
-
rowId = 0;
|
|
1742
|
-
let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
|
|
1743
|
-
if (typeof (event) == 'boolean') {
|
|
1744
|
-
guiEvent.Value = event;
|
|
1745
|
-
}
|
|
1746
|
-
else {
|
|
1747
|
-
if (typeof event.target === 'undefined')
|
|
1748
|
-
guiEvent.Value = (event).checked;
|
|
1749
|
-
else
|
|
1750
|
-
guiEvent.Value = (event.target).checked;
|
|
1751
|
-
}
|
|
1752
|
-
this.insertEvent(guiEvent);
|
|
1753
|
-
}
|
|
1754
|
-
mgOnTabSelectionChanged(idx, layer) {
|
|
1755
|
-
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
1756
|
-
guiEvent.Value = layer.toString();
|
|
1757
|
-
this.insertEvent(guiEvent);
|
|
1758
|
-
}
|
|
1759
|
-
mgOnRadioSelectionChanged(event, idx) {
|
|
1760
|
-
let result = this.getFormControl('0', idx);
|
|
1761
|
-
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
1762
|
-
if (typeof result.value !== 'string')
|
|
1763
|
-
guiEvent.Value = result.value.index;
|
|
1764
|
-
else
|
|
1765
|
-
guiEvent.Value = result.value;
|
|
1766
|
-
this.insertEvent(guiEvent);
|
|
1767
|
-
}
|
|
1768
|
-
close() {
|
|
1769
|
-
this.insertEvent(getGuiEventObj('close', null, 0));
|
|
1770
|
-
}
|
|
1771
|
-
IsStub() {
|
|
1772
|
-
return this.magic.isStub;
|
|
1773
|
-
}
|
|
1774
|
-
saveData(data) {
|
|
1775
|
-
this.magic.saveData(data);
|
|
1776
|
-
}
|
|
1777
|
-
createData() {
|
|
1778
|
-
let myData = {
|
|
1779
|
-
records: this.Records,
|
|
1780
|
-
template: this.template
|
|
1781
|
-
};
|
|
1782
|
-
let text = 'loadData():any {\n' +
|
|
1783
|
-
' let stubData = ' + JSON.stringify(myData) + ';\n' +
|
|
1784
|
-
' this.loadStubData(stubData);}';
|
|
1785
|
-
console.log(text);
|
|
1786
|
-
this.saveData(text);
|
|
1787
|
-
}
|
|
1788
|
-
loadStubData(stubData) {
|
|
1789
|
-
this.Records = stubData.records;
|
|
1790
|
-
this.settemplate(stubData.template);
|
|
1791
|
-
this.taskId = '1';
|
|
1792
|
-
for (let i = 0; i < this.Records.list.length; i++)
|
|
1793
|
-
this.buildTableRowControls(i);
|
|
1794
|
-
}
|
|
1795
|
-
loadData() {
|
|
1796
|
-
alert('Please, overwrite method loadData');
|
|
1797
|
-
}
|
|
1798
|
-
setStubValue(guiRowId, fc, name) {
|
|
1799
|
-
if (this.IsStub()) {
|
|
1800
|
-
try {
|
|
1801
|
-
let val = this.Records.list[guiRowId].values[name];
|
|
1802
|
-
fc.setValue(val);
|
|
1803
|
-
}
|
|
1804
|
-
catch (e) {
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(ɵɵinject(EngineMagicService), ɵɵinject(OverlayWindowService)); };
|
|
1810
|
-
TaskMagicService.ɵprov = ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
|
|
1811
|
-
(function () { ɵsetClassMetadata(TaskMagicService, [{
|
|
1812
|
-
type: Injectable
|
|
1813
|
-
}], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null); })();
|
|
1814
|
-
|
|
1815
|
-
class CommandsCollectorMagicService {
|
|
1816
|
-
constructor(magic) {
|
|
1817
|
-
this.magic = magic;
|
|
1818
|
-
this.count = 0;
|
|
1819
|
-
this.commands = new List();
|
|
1820
|
-
this.subscription = null;
|
|
1821
|
-
}
|
|
1822
|
-
startCollecting() {
|
|
1823
|
-
this.count++;
|
|
1824
|
-
Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.startCollecting() --- " + this.count);
|
|
1825
|
-
if (this.subscription === null) {
|
|
1826
|
-
this.subscription = this.magic.refreshDom
|
|
1827
|
-
.subscribe(command => {
|
|
1828
|
-
this.commands.push(command);
|
|
1829
|
-
});
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
stopCollecting() {
|
|
1833
|
-
this.count--;
|
|
1834
|
-
Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.stopCollecting() --- " + this.count);
|
|
1835
|
-
if (this.count === 0) {
|
|
1836
|
-
this.subscription.unsubscribe();
|
|
1837
|
-
this.subscription = null;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
GetCommands(taskId) {
|
|
1841
|
-
const commands = this.commands.filter((command) => command.TaskTag === taskId);
|
|
1842
|
-
commands.forEach(command => { this.commands.Remove(command); });
|
|
1843
|
-
return commands;
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
CommandsCollectorMagicService.ɵfac = function CommandsCollectorMagicService_Factory(t) { return new (t || CommandsCollectorMagicService)(ɵɵinject(EngineMagicService)); };
|
|
1847
|
-
CommandsCollectorMagicService.ɵprov = ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac });
|
|
1848
|
-
(function () { ɵsetClassMetadata(CommandsCollectorMagicService, [{
|
|
1849
|
-
type: Injectable
|
|
1850
|
-
}], function () { return [{ type: EngineMagicService }]; }, null); })();
|
|
1851
|
-
|
|
1852
|
-
class RouteCommand {
|
|
1853
|
-
}
|
|
1854
|
-
class RouterCommandsMagicService {
|
|
1855
|
-
constructor() {
|
|
1856
|
-
this.pendingRouteCommands = [];
|
|
1857
|
-
}
|
|
1858
|
-
AddRouteCommand(routeCommand) {
|
|
1859
|
-
this.pendingRouteCommands.push(routeCommand);
|
|
1860
|
-
}
|
|
1861
|
-
ExecuteNextCommand() {
|
|
1862
|
-
let pendingRouteCommand = this.pendingRouteCommands.shift();
|
|
1863
|
-
if (!isNullOrUndefined(pendingRouteCommand)) {
|
|
1864
|
-
pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
RouterCommandsMagicService.ɵfac = function RouterCommandsMagicService_Factory(t) { return new (t || RouterCommandsMagicService)(); };
|
|
1869
|
-
RouterCommandsMagicService.ɵprov = ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac });
|
|
1870
|
-
(function () { ɵsetClassMetadata(RouterCommandsMagicService, [{
|
|
1871
|
-
type: Injectable
|
|
1872
|
-
}], null, null); })();
|
|
1873
|
-
|
|
1874
|
-
class SubformMagicService {
|
|
1875
|
-
constructor(task, activatedRoute, componentList, pendingCommandsCollector, router, routerCommandsMagicService, componentListMagicService, loader, injector) {
|
|
1876
|
-
this.task = task;
|
|
1877
|
-
this.activatedRoute = activatedRoute;
|
|
1878
|
-
this.componentList = componentList;
|
|
1879
|
-
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
1880
|
-
this.router = router;
|
|
1881
|
-
this.routerCommandsMagicService = routerCommandsMagicService;
|
|
1882
|
-
this.componentListMagicService = componentListMagicService;
|
|
1883
|
-
this.loader = loader;
|
|
1884
|
-
this.injector = injector;
|
|
1885
|
-
this.subformsDict = {};
|
|
1886
|
-
this.routesDict = {};
|
|
1887
|
-
this.currentRouteDefinition = null;
|
|
1888
|
-
}
|
|
1889
|
-
mgGetComp(subformName) {
|
|
1890
|
-
if (subformName in this.subformsDict) {
|
|
1891
|
-
let formName = this.subformsDict[subformName].formName;
|
|
1892
|
-
if (formName)
|
|
1893
|
-
return this.componentList.getComponent(formName);
|
|
1894
|
-
}
|
|
1895
|
-
return null;
|
|
1896
|
-
}
|
|
1897
|
-
mgGetParameters(subformName) {
|
|
1898
|
-
if (subformName in this.subformsDict) {
|
|
1899
|
-
return this.subformsDict[subformName].parameters;
|
|
1900
|
-
}
|
|
1901
|
-
else
|
|
1902
|
-
return "";
|
|
1903
|
-
}
|
|
1904
|
-
deleteSubformComp(subformControlName, formName) {
|
|
1905
|
-
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
|
1906
|
-
if (this.subformsDict[subformControlName].formName === formName) {
|
|
1907
|
-
this.subformsDict[subformControlName] = {};
|
|
1908
|
-
this.task.refreshView();
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
|
|
1913
|
-
this.pendingCommandsCollector.startCollecting();
|
|
1914
|
-
let refreshNeeded = false;
|
|
1915
|
-
if (isNullOrUndefined(routerPath)) {
|
|
1916
|
-
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
|
1917
|
-
if (this.subformsDict[subformControlName].formName === formName) {
|
|
1918
|
-
this.subformsDict[subformControlName] = {};
|
|
1919
|
-
this.task.refreshView();
|
|
1920
|
-
}
|
|
1921
|
-
}
|
|
1922
|
-
let moduleRef = this.componentListMagicService.getModuleRef(formName);
|
|
1923
|
-
if (moduleRef == null) {
|
|
1924
|
-
let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(formName);
|
|
1925
|
-
if (lazyLoadModule != null) {
|
|
1926
|
-
this.loader
|
|
1927
|
-
.load(lazyLoadModule.modulePath + "#" + lazyLoadModule.moduleName)
|
|
1928
|
-
.then((moduleFactory) => {
|
|
1929
|
-
moduleRef = moduleFactory.create(this.injector);
|
|
1930
|
-
this.subformsDict[subformControlName] = {
|
|
1931
|
-
formName,
|
|
1932
|
-
parameters: { taskIdParam: taskId, taskDescription: taskDescription }
|
|
1933
|
-
};
|
|
1934
|
-
this.task.refreshView();
|
|
1935
|
-
});
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
else {
|
|
1939
|
-
this.subformsDict[subformControlName] = {
|
|
1940
|
-
formName,
|
|
1941
|
-
parameters: { taskIdParam: taskId, taskDescription: taskDescription }
|
|
1942
|
-
};
|
|
1943
|
-
refreshNeeded = true;
|
|
1944
|
-
}
|
|
2025
|
+
this.OnSelectedRowChanged.complete();
|
|
2026
|
+
}
|
|
2027
|
+
onComboboxSelectionChanged(event, idx, line) {
|
|
2028
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, line);
|
|
2029
|
+
if (typeof (event) == 'number') {
|
|
2030
|
+
guiEvent.Value = event;
|
|
1945
2031
|
}
|
|
1946
2032
|
else {
|
|
1947
|
-
if (
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2033
|
+
if (!isNullOrUndefined(event.target)) {
|
|
2034
|
+
let indexes = new Array(event.target.selectedOptions.length);
|
|
2035
|
+
for (let i = 0; i < event.target.selectedOptions.length; i++) {
|
|
2036
|
+
indexes[i] = event.target.selectedOptions[i].index;
|
|
2037
|
+
}
|
|
2038
|
+
guiEvent.Value = indexes.join(',');
|
|
1953
2039
|
}
|
|
1954
|
-
let routeCommand = {
|
|
1955
|
-
callerMgSubformServiceRef: this,
|
|
1956
|
-
routerOutletName: subformControlName,
|
|
1957
|
-
formName: formName,
|
|
1958
|
-
parameters: { taskIdParam: taskId, taskDescription: taskDescription },
|
|
1959
|
-
routeParams: routeParams
|
|
1960
|
-
};
|
|
1961
|
-
if (SubformMagicService.currentCallerMgSubformServiceRef === null)
|
|
1962
|
-
this.ExecuteRouteCommand(routeCommand);
|
|
1963
2040
|
else
|
|
1964
|
-
|
|
2041
|
+
guiEvent.Value = event.value;
|
|
1965
2042
|
}
|
|
1966
|
-
|
|
1967
|
-
this.task.refreshView();
|
|
2043
|
+
this.insertEvent(guiEvent);
|
|
1968
2044
|
}
|
|
1969
|
-
|
|
1970
|
-
let
|
|
1971
|
-
let
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
2045
|
+
onListBoxSelectionChanged(event, idx) {
|
|
2046
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2047
|
+
let selectedOptions;
|
|
2048
|
+
if (!isNullOrUndefined(event.target))
|
|
2049
|
+
selectedOptions = event.target.selectedOptions;
|
|
2050
|
+
else
|
|
2051
|
+
selectedOptions = event.source.selectedOptions.selected;
|
|
2052
|
+
let length = selectedOptions.length;
|
|
2053
|
+
let indexes = new Array(length);
|
|
2054
|
+
for (let i = 0; i < length; i++) {
|
|
2055
|
+
if (!isNullOrUndefined(event.target))
|
|
2056
|
+
indexes[i] = (selectedOptions[i]).index;
|
|
2057
|
+
else
|
|
2058
|
+
indexes[i] = (selectedOptions[i]).value;
|
|
2059
|
+
}
|
|
2060
|
+
guiEvent.Value = indexes;
|
|
2061
|
+
this.insertEvent(guiEvent);
|
|
2062
|
+
}
|
|
2063
|
+
onCheckChanged(event, idx, rowId) {
|
|
2064
|
+
if (typeof rowId === 'undefined')
|
|
2065
|
+
rowId = 0;
|
|
2066
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
|
|
2067
|
+
if (typeof (event) == 'boolean') {
|
|
2068
|
+
guiEvent.Value = event;
|
|
1983
2069
|
}
|
|
1984
2070
|
else {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
};
|
|
1990
|
-
if (SubformMagicService.routerContainers.length > 0) {
|
|
1991
|
-
let routeContainer = SubformMagicService.routerContainers[0];
|
|
1992
|
-
SubformMagicService.routerContainers.shift();
|
|
1993
|
-
routeContainer.initializeComponent();
|
|
1994
|
-
}
|
|
1995
|
-
else {
|
|
1996
|
-
currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
|
|
1997
|
-
}
|
|
2071
|
+
if (typeof event.target === 'undefined')
|
|
2072
|
+
guiEvent.Value = (event).checked;
|
|
2073
|
+
else
|
|
2074
|
+
guiEvent.Value = (event.target).checked;
|
|
1998
2075
|
}
|
|
2076
|
+
this.insertEvent(guiEvent);
|
|
1999
2077
|
}
|
|
2000
|
-
|
|
2001
|
-
let
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
if (result !== null && !result) {
|
|
2005
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
2006
|
-
subformMagicService.currentRouteDefinition = null;
|
|
2007
|
-
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
2008
|
-
subformMagicService.pendingCommandsCollector.stopCollecting();
|
|
2009
|
-
subformMagicService.routerCommandsMagicService.ExecuteNextCommand();
|
|
2010
|
-
}
|
|
2011
|
-
});
|
|
2078
|
+
mgOnTabSelectionChanged(idx, layer) {
|
|
2079
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2080
|
+
guiEvent.Value = layer.toString();
|
|
2081
|
+
this.insertEvent(guiEvent);
|
|
2012
2082
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2083
|
+
mgOnRadioSelectionChanged(event, idx) {
|
|
2084
|
+
let result = this.getFormControl('0', idx);
|
|
2085
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2086
|
+
if (typeof result.value !== 'string')
|
|
2087
|
+
guiEvent.Value = result.value.index;
|
|
2088
|
+
else
|
|
2089
|
+
guiEvent.Value = result.value;
|
|
2090
|
+
this.insertEvent(guiEvent);
|
|
2020
2091
|
}
|
|
2021
|
-
|
|
2022
|
-
this.
|
|
2092
|
+
close() {
|
|
2093
|
+
this.insertEvent(getGuiEventObj('close', null, 0));
|
|
2023
2094
|
}
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2095
|
+
IsStub() {
|
|
2096
|
+
return this.magic.isStub;
|
|
2097
|
+
}
|
|
2098
|
+
saveData(data) {
|
|
2099
|
+
this.magic.saveData(data);
|
|
2100
|
+
}
|
|
2101
|
+
createData() {
|
|
2102
|
+
let myData = {
|
|
2103
|
+
records: this.Records,
|
|
2104
|
+
template: this.template
|
|
2105
|
+
};
|
|
2106
|
+
let text = 'loadData():any {\n' +
|
|
2107
|
+
' let stubData = ' + JSON.stringify(myData) + ';\n' +
|
|
2108
|
+
' this.loadStubData(stubData);}';
|
|
2109
|
+
console.log(text);
|
|
2110
|
+
this.saveData(text);
|
|
2111
|
+
}
|
|
2112
|
+
loadStubData(stubData) {
|
|
2113
|
+
this.Records = stubData.records;
|
|
2114
|
+
this.settemplate(stubData.template);
|
|
2115
|
+
this.taskId = '1';
|
|
2116
|
+
for (let i = 0; i < this.Records.list.length; i++)
|
|
2117
|
+
this.buildTableRowControls(i);
|
|
2118
|
+
}
|
|
2119
|
+
loadData() {
|
|
2120
|
+
alert('Please, overwrite method loadData');
|
|
2121
|
+
}
|
|
2122
|
+
setStubValue(guiRowId, fc, name) {
|
|
2123
|
+
if (this.IsStub()) {
|
|
2124
|
+
try {
|
|
2125
|
+
let val = this.Records.list[guiRowId].values[name];
|
|
2126
|
+
fc.setValue(val);
|
|
2127
|
+
}
|
|
2128
|
+
catch (e) {
|
|
2129
|
+
}
|
|
2030
2130
|
}
|
|
2031
|
-
return currentActiveRoute;
|
|
2032
2131
|
}
|
|
2033
2132
|
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
SubformMagicService.ɵprov = ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
|
|
2038
|
-
(function () { ɵsetClassMetadata(SubformMagicService, [{
|
|
2133
|
+
TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(ɵɵinject(EngineMagicService), ɵɵinject(OverlayWindowService)); };
|
|
2134
|
+
TaskMagicService.ɵprov = ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
|
|
2135
|
+
(function () { ɵsetClassMetadata(TaskMagicService, [{
|
|
2039
2136
|
type: Injectable
|
|
2040
|
-
}], function () { return [{ type:
|
|
2137
|
+
}], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null); })();
|
|
2041
2138
|
|
|
2042
2139
|
class TableMagicService {
|
|
2043
2140
|
constructor(componentList, task) {
|
|
@@ -2928,90 +3025,6 @@ NoControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: NoControlMagicDirect
|
|
|
2928
3025
|
args: ['magicnc']
|
|
2929
3026
|
}] }); })();
|
|
2930
3027
|
|
|
2931
|
-
class RouterContainerMagicComponent {
|
|
2932
|
-
constructor(activatedRoute, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
|
|
2933
|
-
this.activatedRoute = activatedRoute;
|
|
2934
|
-
this.magic = magic;
|
|
2935
|
-
this.containerTaskService = containerTaskService;
|
|
2936
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
2937
|
-
this.viewContainerRef = viewContainerRef;
|
|
2938
|
-
this.componentList = componentList;
|
|
2939
|
-
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
2940
|
-
this.routerCommandsMagicService = routerCommandsMagicService;
|
|
2941
|
-
this.componentRef = null;
|
|
2942
|
-
this.parentMgSubformService = null;
|
|
2943
|
-
}
|
|
2944
|
-
ngOnInit() {
|
|
2945
|
-
let outletname = this.activatedRoute.outlet;
|
|
2946
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
2947
|
-
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
2948
|
-
if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
|
|
2949
|
-
this.insertRouteEvent(currentActiveRoute);
|
|
2950
|
-
SubformMagicService.routerContainers.push(this);
|
|
2951
|
-
}
|
|
2952
|
-
else {
|
|
2953
|
-
this.initializeComponent();
|
|
2954
|
-
}
|
|
2955
|
-
}
|
|
2956
|
-
insertRouteEvent(currentActiveRoute) {
|
|
2957
|
-
let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
|
|
2958
|
-
guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
|
|
2959
|
-
if (currentActiveRoute.snapshot.outlet !== 'primary')
|
|
2960
|
-
guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
|
|
2961
|
-
let calcRouterPath = currentActiveRoute.routeConfig.path;
|
|
2962
|
-
if (calcRouterPath.length > 0) {
|
|
2963
|
-
let routerPath = calcRouterPath;
|
|
2964
|
-
let tokens = StrUtil.tokenize(routerPath, "/:");
|
|
2965
|
-
guiEvent.RouterPath = tokens[0];
|
|
2966
|
-
guiEvent.RouterParams = new List();
|
|
2967
|
-
for (let i = 1; i < tokens.length; i++) {
|
|
2968
|
-
guiEvent.RouterParams.push(this.activatedRoute.snapshot.params[tokens[i]]);
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
this.containerTaskService.insertEvent(guiEvent);
|
|
2972
|
-
}
|
|
2973
|
-
initializeComponent() {
|
|
2974
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
2975
|
-
if (subformMagicService.currentRouteDefinition !== null) {
|
|
2976
|
-
let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
|
|
2977
|
-
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
|
|
2978
|
-
this.componentRef = this.viewContainerRef.createComponent(componentFactory);
|
|
2979
|
-
Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
|
|
2980
|
-
let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
2981
|
-
let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
|
|
2982
|
-
subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
|
|
2983
|
-
this.parentMgSubformService = subformMagicService;
|
|
2984
|
-
subformMagicService.currentRouteDefinition = null;
|
|
2985
|
-
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
2986
|
-
let ignoreParamChange = true;
|
|
2987
|
-
myActiveRoute.paramMap.subscribe(params => {
|
|
2988
|
-
if (!ignoreParamChange)
|
|
2989
|
-
this.insertRouteEvent(myActiveRoute);
|
|
2990
|
-
ignoreParamChange = false;
|
|
2991
|
-
});
|
|
2992
|
-
this.parentMgSubformService.refreshView();
|
|
2993
|
-
this.routerCommandsMagicService.ExecuteNextCommand();
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
ngOnDestroy() {
|
|
2997
|
-
if (this.componentRef != null) {
|
|
2998
|
-
this.componentRef.instance.task.close();
|
|
2999
|
-
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
3000
|
-
this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
|
-
RouterContainerMagicComponent.ɵfac = function RouterContainerMagicComponent_Factory(t) { return new (t || RouterContainerMagicComponent)(ɵɵdirectiveInject(ActivatedRoute), ɵɵdirectiveInject(EngineMagicService), ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ComponentFactoryResolver), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(ComponentListMagicService), ɵɵdirectiveInject(CommandsCollectorMagicService), ɵɵdirectiveInject(RouterCommandsMagicService)); };
|
|
3005
|
-
RouterContainerMagicComponent.ɵcmp = ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
|
3006
|
-
(function () { ɵsetClassMetadata(RouterContainerMagicComponent, [{
|
|
3007
|
-
type: Component,
|
|
3008
|
-
args: [{
|
|
3009
|
-
selector: 'magic-route-outlet',
|
|
3010
|
-
template: `
|
|
3011
|
-
`
|
|
3012
|
-
}]
|
|
3013
|
-
}], function () { return [{ type: ActivatedRoute }, { type: EngineMagicService }, { type: TaskMagicService }, { type: ComponentFactoryResolver }, { type: ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null); })();
|
|
3014
|
-
|
|
3015
3028
|
class Constants {
|
|
3016
3029
|
}
|
|
3017
3030
|
Constants.DATE_FMT = 'dd/MMM/yyyy';
|