@magic-xpa/angular 4.800.0-dev480.94 → 4.801.0-dev481.221
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 +459 -404
- 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/services/accessor.magic.service.js +13 -1
- package/esm2015/src/services/subform.magic.service.js +31 -10
- package/esm2015/src/services/task.magics.service.js +3 -2
- package/esm2015/src/ui/GuiInteractiveExecutor.js +8 -1
- package/esm2015/src/ui/directives/magic/row.magic.directive.js +4 -2
- package/esm2015/src/ui/directives/magic.directive.js +5 -3
- package/esm2015/src/ui/router-container.magic.component.js +12 -5
- package/fesm2015/magic-xpa-angular.js +438 -388
- package/fesm2015/magic-xpa-angular.js.map +1 -1
- package/package.json +3 -3
- package/src/services/accessor.magic.service.d.ts +8 -1
- package/src/services/subform.magic.service.d.ts +5 -2
- package/src/ui/GuiInteractiveExecutor.d.ts +1 -0
- package/src/ui/directives/magic.directive.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 {
|
|
@@ -1530,6 +1854,7 @@ class TaskMagicService {
|
|
|
1530
1854
|
control.setValidators([control.validator, this.customValidator(guiRowId.toString(), controlId)]);
|
|
1531
1855
|
else
|
|
1532
1856
|
control.setValidators(this.customValidator(guiRowId.toString(), controlId));
|
|
1857
|
+
control.updateValueAndValidity();
|
|
1533
1858
|
}
|
|
1534
1859
|
}
|
|
1535
1860
|
break;
|
|
@@ -1542,7 +1867,7 @@ class TaskMagicService {
|
|
|
1542
1867
|
properties.setStyle(command.Operation, command.obj1);
|
|
1543
1868
|
break;
|
|
1544
1869
|
case CommandType.SET_ATTRIBUTE:
|
|
1545
|
-
properties = this.Records.list[
|
|
1870
|
+
properties = this.Records.list[0].getControlMetadata(controlId);
|
|
1546
1871
|
properties.dataType = String.fromCharCode(command.number);
|
|
1547
1872
|
break;
|
|
1548
1873
|
case CommandType.SET_VALUE:
|
|
@@ -1703,320 +2028,114 @@ class TaskMagicService {
|
|
|
1703
2028
|
onComboboxSelectionChanged(event, idx, line) {
|
|
1704
2029
|
let guiEvent = getGuiEventObj('selectionchanged', idx, line);
|
|
1705
2030
|
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) {
|
|
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.subformsDict = {};
|
|
1883
|
-
this.routesDict = {};
|
|
1884
|
-
this.currentRouteDefinition = null;
|
|
1885
|
-
}
|
|
1886
|
-
mgGetComp(subformName) {
|
|
1887
|
-
if (subformName in this.subformsDict) {
|
|
1888
|
-
let formName = this.subformsDict[subformName].formName;
|
|
1889
|
-
if (formName)
|
|
1890
|
-
return this.componentList.getComponent(formName);
|
|
1891
|
-
}
|
|
1892
|
-
return null;
|
|
1893
|
-
}
|
|
1894
|
-
mgGetParameters(subformName) {
|
|
1895
|
-
if (subformName in this.subformsDict) {
|
|
1896
|
-
return this.subformsDict[subformName].parameters;
|
|
1897
|
-
}
|
|
1898
|
-
else
|
|
1899
|
-
return "";
|
|
1900
|
-
}
|
|
1901
|
-
deleteSubformComp(subformControlName, formName) {
|
|
1902
|
-
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
|
1903
|
-
if (this.subformsDict[subformControlName].formName === formName) {
|
|
1904
|
-
this.subformsDict[subformControlName] = {};
|
|
1905
|
-
this.task.refreshView();
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
|
|
1910
|
-
this.pendingCommandsCollector.startCollecting();
|
|
1911
|
-
let refreshNeeded = false;
|
|
1912
|
-
if (isNullOrUndefined(routerPath)) {
|
|
1913
|
-
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
|
1914
|
-
if (this.subformsDict[subformControlName].formName === formName) {
|
|
1915
|
-
this.subformsDict[subformControlName] = {};
|
|
1916
|
-
this.task.refreshView();
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
this.subformsDict[subformControlName] = {
|
|
1920
|
-
formName,
|
|
1921
|
-
parameters: { taskIdParam: taskId, taskDescription: taskDescription }
|
|
1922
|
-
};
|
|
1923
|
-
refreshNeeded = true;
|
|
2031
|
+
guiEvent.Value = event;
|
|
1924
2032
|
}
|
|
1925
2033
|
else {
|
|
1926
|
-
if (
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
2034
|
+
if (!isNullOrUndefined(event.target)) {
|
|
2035
|
+
let indexes = new Array(event.target.selectedOptions.length);
|
|
2036
|
+
for (let i = 0; i < event.target.selectedOptions.length; i++) {
|
|
2037
|
+
indexes[i] = event.target.selectedOptions[i].index;
|
|
2038
|
+
}
|
|
2039
|
+
guiEvent.Value = indexes.join(',');
|
|
1932
2040
|
}
|
|
1933
|
-
let routeCommand = {
|
|
1934
|
-
callerMgSubformServiceRef: this,
|
|
1935
|
-
routerOutletName: subformControlName,
|
|
1936
|
-
formName: formName,
|
|
1937
|
-
parameters: { taskIdParam: taskId, taskDescription: taskDescription },
|
|
1938
|
-
routeParams: routeParams
|
|
1939
|
-
};
|
|
1940
|
-
if (SubformMagicService.currentCallerMgSubformServiceRef === null)
|
|
1941
|
-
this.ExecuteRouteCommand(routeCommand);
|
|
1942
2041
|
else
|
|
1943
|
-
|
|
2042
|
+
guiEvent.Value = event.value;
|
|
1944
2043
|
}
|
|
1945
|
-
|
|
1946
|
-
this.task.refreshView();
|
|
2044
|
+
this.insertEvent(guiEvent);
|
|
1947
2045
|
}
|
|
1948
|
-
|
|
1949
|
-
let
|
|
1950
|
-
let
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
2046
|
+
onListBoxSelectionChanged(event, idx) {
|
|
2047
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2048
|
+
let selectedOptions;
|
|
2049
|
+
if (!isNullOrUndefined(event.target))
|
|
2050
|
+
selectedOptions = event.target.selectedOptions;
|
|
2051
|
+
else
|
|
2052
|
+
selectedOptions = event.source.selectedOptions.selected;
|
|
2053
|
+
let length = selectedOptions.length;
|
|
2054
|
+
let indexes = new Array(length);
|
|
2055
|
+
for (let i = 0; i < length; i++) {
|
|
2056
|
+
if (!isNullOrUndefined(event.target))
|
|
2057
|
+
indexes[i] = (selectedOptions[i]).index;
|
|
2058
|
+
else
|
|
2059
|
+
indexes[i] = (selectedOptions[i]).value;
|
|
2060
|
+
}
|
|
2061
|
+
guiEvent.Value = indexes;
|
|
2062
|
+
this.insertEvent(guiEvent);
|
|
2063
|
+
}
|
|
2064
|
+
onCheckChanged(event, idx, rowId) {
|
|
2065
|
+
if (typeof rowId === 'undefined')
|
|
2066
|
+
rowId = 0;
|
|
2067
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
|
|
2068
|
+
if (typeof (event) == 'boolean') {
|
|
2069
|
+
guiEvent.Value = event;
|
|
1962
2070
|
}
|
|
1963
2071
|
else {
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
};
|
|
1969
|
-
if (SubformMagicService.routerContainers.length > 0) {
|
|
1970
|
-
let routeContainer = SubformMagicService.routerContainers[0];
|
|
1971
|
-
SubformMagicService.routerContainers.shift();
|
|
1972
|
-
routeContainer.initializeComponent();
|
|
1973
|
-
}
|
|
1974
|
-
else {
|
|
1975
|
-
currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
|
|
1976
|
-
}
|
|
2072
|
+
if (typeof event.target === 'undefined')
|
|
2073
|
+
guiEvent.Value = (event).checked;
|
|
2074
|
+
else
|
|
2075
|
+
guiEvent.Value = (event.target).checked;
|
|
1977
2076
|
}
|
|
2077
|
+
this.insertEvent(guiEvent);
|
|
1978
2078
|
}
|
|
1979
|
-
|
|
1980
|
-
let
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
if (result !== null && !result) {
|
|
1984
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
1985
|
-
subformMagicService.currentRouteDefinition = null;
|
|
1986
|
-
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
1987
|
-
subformMagicService.pendingCommandsCollector.stopCollecting();
|
|
1988
|
-
subformMagicService.routerCommandsMagicService.ExecuteNextCommand();
|
|
1989
|
-
}
|
|
1990
|
-
});
|
|
2079
|
+
mgOnTabSelectionChanged(idx, layer) {
|
|
2080
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2081
|
+
guiEvent.Value = layer.toString();
|
|
2082
|
+
this.insertEvent(guiEvent);
|
|
1991
2083
|
}
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2084
|
+
mgOnRadioSelectionChanged(event, idx) {
|
|
2085
|
+
let result = this.getFormControl('0', idx);
|
|
2086
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2087
|
+
if (typeof result.value !== 'string')
|
|
2088
|
+
guiEvent.Value = result.value.index;
|
|
2089
|
+
else
|
|
2090
|
+
guiEvent.Value = result.value;
|
|
2091
|
+
this.insertEvent(guiEvent);
|
|
1999
2092
|
}
|
|
2000
|
-
|
|
2001
|
-
this.
|
|
2093
|
+
close() {
|
|
2094
|
+
this.insertEvent(getGuiEventObj('close', null, 0));
|
|
2002
2095
|
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2096
|
+
IsStub() {
|
|
2097
|
+
return this.magic.isStub;
|
|
2098
|
+
}
|
|
2099
|
+
saveData(data) {
|
|
2100
|
+
this.magic.saveData(data);
|
|
2101
|
+
}
|
|
2102
|
+
createData() {
|
|
2103
|
+
let myData = {
|
|
2104
|
+
records: this.Records,
|
|
2105
|
+
template: this.template
|
|
2106
|
+
};
|
|
2107
|
+
let text = 'loadData():any {\n' +
|
|
2108
|
+
' let stubData = ' + JSON.stringify(myData) + ';\n' +
|
|
2109
|
+
' this.loadStubData(stubData);}';
|
|
2110
|
+
console.log(text);
|
|
2111
|
+
this.saveData(text);
|
|
2112
|
+
}
|
|
2113
|
+
loadStubData(stubData) {
|
|
2114
|
+
this.Records = stubData.records;
|
|
2115
|
+
this.settemplate(stubData.template);
|
|
2116
|
+
this.taskId = '1';
|
|
2117
|
+
for (let i = 0; i < this.Records.list.length; i++)
|
|
2118
|
+
this.buildTableRowControls(i);
|
|
2119
|
+
}
|
|
2120
|
+
loadData() {
|
|
2121
|
+
alert('Please, overwrite method loadData');
|
|
2122
|
+
}
|
|
2123
|
+
setStubValue(guiRowId, fc, name) {
|
|
2124
|
+
if (this.IsStub()) {
|
|
2125
|
+
try {
|
|
2126
|
+
let val = this.Records.list[guiRowId].values[name];
|
|
2127
|
+
fc.setValue(val);
|
|
2128
|
+
}
|
|
2129
|
+
catch (e) {
|
|
2130
|
+
}
|
|
2009
2131
|
}
|
|
2010
|
-
return currentActiveRoute;
|
|
2011
2132
|
}
|
|
2012
2133
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
SubformMagicService.ɵprov = ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
|
|
2017
|
-
(function () { ɵsetClassMetadata(SubformMagicService, [{
|
|
2134
|
+
TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(ɵɵinject(EngineMagicService), ɵɵinject(OverlayWindowService)); };
|
|
2135
|
+
TaskMagicService.ɵprov = ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
|
|
2136
|
+
(function () { ɵsetClassMetadata(TaskMagicService, [{
|
|
2018
2137
|
type: Injectable
|
|
2019
|
-
}], function () { return [{ type:
|
|
2138
|
+
}], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null); })();
|
|
2020
2139
|
|
|
2021
2140
|
class TableMagicService {
|
|
2022
2141
|
constructor(componentList, task) {
|
|
@@ -2246,6 +2365,18 @@ class AccessorMagicService {
|
|
|
2246
2365
|
getItemListValues(id, rowId) {
|
|
2247
2366
|
return this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
|
2248
2367
|
}
|
|
2368
|
+
getFilteredList(controlId, rowId) {
|
|
2369
|
+
if (isNullOrUndefined(rowId))
|
|
2370
|
+
rowId = '0';
|
|
2371
|
+
let items = this.getItemListValues(controlId, rowId);
|
|
2372
|
+
let value = this.task.getFormControl(rowId, controlId).value;
|
|
2373
|
+
if (value !== null && value !== "" && items instanceof Array) {
|
|
2374
|
+
value = value.toLowerCase();
|
|
2375
|
+
return items.filter(option => option.displayValue.toLowerCase().includes(value));
|
|
2376
|
+
}
|
|
2377
|
+
else
|
|
2378
|
+
return items;
|
|
2379
|
+
}
|
|
2249
2380
|
getDisplayValue(id, rowId) {
|
|
2250
2381
|
let displayValue = "";
|
|
2251
2382
|
let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
|
@@ -2502,7 +2633,8 @@ class RowMagicDirective {
|
|
|
2502
2633
|
onClick($event) {
|
|
2503
2634
|
if (this.rowId != '') {
|
|
2504
2635
|
this._task.insertEvent(getGuiEventObj('click', "magicRow", +this.rowId));
|
|
2505
|
-
|
|
2636
|
+
if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
|
|
2637
|
+
event.cancelBubble = true;
|
|
2506
2638
|
}
|
|
2507
2639
|
}
|
|
2508
2640
|
}
|
|
@@ -2561,7 +2693,8 @@ class MagicDirective {
|
|
|
2561
2693
|
if (this.htmlElement instanceof HTMLButtonElement)
|
|
2562
2694
|
fromButton = true;
|
|
2563
2695
|
this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
|
|
2564
|
-
|
|
2696
|
+
if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
|
|
2697
|
+
e.cancelBubble = true;
|
|
2565
2698
|
});
|
|
2566
2699
|
});
|
|
2567
2700
|
this.renderer.listen(this.htmlElement, 'change', (e) => {
|
|
@@ -2601,7 +2734,7 @@ class MagicDirective {
|
|
|
2601
2734
|
(e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
|
|
2602
2735
|
if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
|
|
2603
2736
|
guiEvent.keyCode = e.keyCode;
|
|
2604
|
-
if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && !MagicDirective.opened)
|
|
2737
|
+
if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
|
|
2605
2738
|
e.cancelBubble = true;
|
|
2606
2739
|
this.task.insertEvent(guiEvent);
|
|
2607
2740
|
}
|
|
@@ -2696,6 +2829,7 @@ class MagicDirective {
|
|
|
2696
2829
|
}
|
|
2697
2830
|
}
|
|
2698
2831
|
MagicDirective.opened = false;
|
|
2832
|
+
MagicDirective.noOfAutoCompleteBoxesOpened = 0;
|
|
2699
2833
|
MagicDirective.ɵfac = function MagicDirective_Factory(t) { return new (t || MagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
|
2700
2834
|
MagicDirective.ɵdir = ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", rowId: "rowId" } });
|
|
2701
2835
|
(function () { ɵsetClassMetadata(MagicDirective, [{
|
|
@@ -2896,90 +3030,6 @@ NoControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: NoControlMagicDirect
|
|
|
2896
3030
|
args: ['magicnc']
|
|
2897
3031
|
}] }); })();
|
|
2898
3032
|
|
|
2899
|
-
class RouterContainerMagicComponent {
|
|
2900
|
-
constructor(activatedRoute, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
|
|
2901
|
-
this.activatedRoute = activatedRoute;
|
|
2902
|
-
this.magic = magic;
|
|
2903
|
-
this.containerTaskService = containerTaskService;
|
|
2904
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
2905
|
-
this.viewContainerRef = viewContainerRef;
|
|
2906
|
-
this.componentList = componentList;
|
|
2907
|
-
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
2908
|
-
this.routerCommandsMagicService = routerCommandsMagicService;
|
|
2909
|
-
this.componentRef = null;
|
|
2910
|
-
this.parentMgSubformService = null;
|
|
2911
|
-
}
|
|
2912
|
-
ngOnInit() {
|
|
2913
|
-
let outletname = this.activatedRoute.outlet;
|
|
2914
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
2915
|
-
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
2916
|
-
if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
|
|
2917
|
-
this.insertRouteEvent(currentActiveRoute);
|
|
2918
|
-
SubformMagicService.routerContainers.push(this);
|
|
2919
|
-
}
|
|
2920
|
-
else {
|
|
2921
|
-
this.initializeComponent();
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
insertRouteEvent(currentActiveRoute) {
|
|
2925
|
-
let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
|
|
2926
|
-
guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
|
|
2927
|
-
if (currentActiveRoute.snapshot.outlet !== 'primary')
|
|
2928
|
-
guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
|
|
2929
|
-
let calcRouterPath = currentActiveRoute.routeConfig.path;
|
|
2930
|
-
if (calcRouterPath.length > 0) {
|
|
2931
|
-
let routerPath = calcRouterPath;
|
|
2932
|
-
let tokens = StrUtil.tokenize(routerPath, "/:");
|
|
2933
|
-
guiEvent.RouterPath = tokens[0];
|
|
2934
|
-
guiEvent.RouterParams = new List();
|
|
2935
|
-
for (let i = 1; i < tokens.length; i++) {
|
|
2936
|
-
guiEvent.RouterParams.push(this.activatedRoute.snapshot.params[tokens[i]]);
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
this.containerTaskService.insertEvent(guiEvent);
|
|
2940
|
-
}
|
|
2941
|
-
initializeComponent() {
|
|
2942
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
2943
|
-
if (subformMagicService.currentRouteDefinition !== null) {
|
|
2944
|
-
let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
|
|
2945
|
-
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
|
|
2946
|
-
this.componentRef = this.viewContainerRef.createComponent(componentFactory);
|
|
2947
|
-
Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
|
|
2948
|
-
let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
2949
|
-
let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
|
|
2950
|
-
subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
|
|
2951
|
-
this.parentMgSubformService = subformMagicService;
|
|
2952
|
-
subformMagicService.currentRouteDefinition = null;
|
|
2953
|
-
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
2954
|
-
let ignoreParamChange = true;
|
|
2955
|
-
myActiveRoute.paramMap.subscribe(params => {
|
|
2956
|
-
if (!ignoreParamChange)
|
|
2957
|
-
this.insertRouteEvent(myActiveRoute);
|
|
2958
|
-
ignoreParamChange = false;
|
|
2959
|
-
});
|
|
2960
|
-
this.parentMgSubformService.refreshView();
|
|
2961
|
-
this.routerCommandsMagicService.ExecuteNextCommand();
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
ngOnDestroy() {
|
|
2965
|
-
if (this.componentRef != null) {
|
|
2966
|
-
this.componentRef.instance.task.close();
|
|
2967
|
-
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
2968
|
-
this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
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)); };
|
|
2973
|
-
RouterContainerMagicComponent.ɵcmp = ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
|
2974
|
-
(function () { ɵsetClassMetadata(RouterContainerMagicComponent, [{
|
|
2975
|
-
type: Component,
|
|
2976
|
-
args: [{
|
|
2977
|
-
selector: 'magic-route-outlet',
|
|
2978
|
-
template: `
|
|
2979
|
-
`
|
|
2980
|
-
}]
|
|
2981
|
-
}], function () { return [{ type: ActivatedRoute }, { type: EngineMagicService }, { type: TaskMagicService }, { type: ComponentFactoryResolver }, { type: ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null); })();
|
|
2982
|
-
|
|
2983
3033
|
class Constants {
|
|
2984
3034
|
}
|
|
2985
3035
|
Constants.DATE_FMT = 'dd/MMM/yyyy';
|