@magic-xpa/angular 4.702.0 → 4.800.0-dev000.0

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.
Files changed (119) hide show
  1. package/bundles/magic-xpa-angular.umd.js +879 -2102
  2. package/bundles/magic-xpa-angular.umd.js.map +1 -1
  3. package/bundles/magic-xpa-angular.umd.min.js +1 -15
  4. package/bundles/magic-xpa-angular.umd.min.js.map +1 -1
  5. package/esm2015/index.js +1 -1
  6. package/esm2015/magic-xpa-angular.js +1 -4
  7. package/esm2015/src/controls.metadata.model.js +3 -36
  8. package/esm2015/src/interfaces/sub-form-definition.iterface.js +1 -1
  9. package/esm2015/src/magic.core.module.js +4 -14
  10. package/esm2015/src/services/ISubformMagicService.js +1 -1
  11. package/esm2015/src/services/OverlayWindowService.js +4 -29
  12. package/esm2015/src/services/StylesMapManager.js +1 -4
  13. package/esm2015/src/services/accessor.magic.service.js +44 -242
  14. package/esm2015/src/services/commands-collector.magic.service.js +4 -7
  15. package/esm2015/src/services/component-list.magic.service.js +1 -25
  16. package/esm2015/src/services/confirmation.components.magic.provider.js +4 -24
  17. package/esm2015/src/services/engine.magic.service.js +7 -10
  18. package/esm2015/src/services/exit.magic.service.js +4 -10
  19. package/esm2015/src/services/magic.providers.js +1 -4
  20. package/esm2015/src/services/magic.services.js +4 -10
  21. package/esm2015/src/services/mg-date-adapter.js +5 -5
  22. package/esm2015/src/services/overlay.conainer.magic.provider.js +4 -8
  23. package/esm2015/src/services/router-commands.magic.service.js +4 -10
  24. package/esm2015/src/services/subform.magic.service.js +37 -56
  25. package/esm2015/src/services/table.magic.service.js +5 -61
  26. package/esm2015/src/services/task.magics.service.js +15 -282
  27. package/esm2015/src/services/title.magic.service.js +4 -15
  28. package/esm2015/src/ui/GuiInteractiveExecutor.js +8 -6
  29. package/esm2015/src/ui/components/base-magic-alert.component.js +4 -14
  30. package/esm2015/src/ui/components/base-magic-confirm.component.js +4 -16
  31. package/esm2015/src/ui/components/magic-alert.component.js +5 -8
  32. package/esm2015/src/ui/components/magic-confirmation-box.component.js +5 -8
  33. package/esm2015/src/ui/directives/NonMagicControlDirective.js +4 -31
  34. package/esm2015/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.js +4 -10
  35. package/esm2015/src/ui/directives/magic/checkbox.magic.directive.js +4 -13
  36. package/esm2015/src/ui/directives/magic/combobox.magic.directive.js +4 -10
  37. package/esm2015/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.js +5 -11
  38. package/esm2015/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.js +4 -16
  39. package/esm2015/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.js +5 -11
  40. package/esm2015/src/ui/directives/magic/input.noformcontrol.magic.directive.js +4 -10
  41. package/esm2015/src/ui/directives/magic/nocontrol.magic.directive.js +6 -16
  42. package/esm2015/src/ui/directives/magic/row.magic.directive.js +7 -23
  43. package/esm2015/src/ui/directives/magic-focus.directive.js +4 -7
  44. package/esm2015/src/ui/directives/magic.directive.js +18 -82
  45. package/esm2015/src/ui/directives/magicViewContainerRef.directive.js +4 -8
  46. package/esm2015/src/ui/directives/mgformat.magic.directive.js +4 -57
  47. package/esm2015/src/ui/directives/range-validator.magic.directive.js +4 -20
  48. package/esm2015/src/ui/magic-confirmationBox.js +1 -25
  49. package/esm2015/src/ui/magic-modal/base-magic-overlay-container.js +1 -1
  50. package/esm2015/src/ui/magic-modal/magic-modal-form.js +1 -4
  51. package/esm2015/src/ui/magic-modal/magic-modal-interface.js +1 -1
  52. package/esm2015/src/ui/magic-modal/magic-overlay-container-wrapper.js +4 -21
  53. package/esm2015/src/ui/magic-modal/magic-overlay-container.js +4 -46
  54. package/esm2015/src/ui/magic-root.component.js +10 -53
  55. package/esm2015/src/ui/mgerror.magic.component.js +4 -21
  56. package/esm2015/src/ui/pipes/date.magic.pipe.js +5 -12
  57. package/esm2015/src/ui/pipes/time.magic.pipe.js +4 -7
  58. package/esm2015/src/ui/router-container.magic.component.js +15 -36
  59. package/esm2015/src/ui/subform.magic.component.js +4 -23
  60. package/esm2015/src/ui/task-base.magic.component.js +4 -74
  61. package/esm2015/src/ui/utils.js +1 -20
  62. package/fesm2015/magic-xpa-angular.js +808 -2061
  63. package/fesm2015/magic-xpa-angular.js.map +1 -1
  64. package/magic-xpa-angular.d.ts +0 -3
  65. package/package.json +3 -3
  66. package/src/controls.metadata.model.d.ts +0 -16
  67. package/src/interfaces/sub-form-definition.iterface.d.ts +0 -6
  68. package/src/magic.core.module.d.ts +0 -3
  69. package/src/services/OverlayWindowService.d.ts +0 -19
  70. package/src/services/StylesMapManager.d.ts +0 -3
  71. package/src/services/accessor.magic.service.d.ts +16 -202
  72. package/src/services/commands-collector.magic.service.d.ts +0 -3
  73. package/src/services/component-list.magic.service.d.ts +0 -27
  74. package/src/services/confirmation.components.magic.provider.d.ts +0 -16
  75. package/src/services/engine.magic.service.d.ts +1 -3
  76. package/src/services/exit.magic.service.d.ts +0 -6
  77. package/src/services/magic.providers.d.ts +0 -3
  78. package/src/services/magic.services.d.ts +0 -6
  79. package/src/services/router-commands.magic.service.d.ts +0 -6
  80. package/src/services/subform.magic.service.d.ts +5 -30
  81. package/src/services/table.magic.service.d.ts +0 -55
  82. package/src/services/task.magics.service.d.ts +1 -294
  83. package/src/services/title.magic.service.d.ts +0 -11
  84. package/src/ui/GuiInteractiveExecutor.d.ts +1 -3
  85. package/src/ui/components/base-magic-alert.component.d.ts +0 -16
  86. package/src/ui/components/base-magic-confirm.component.d.ts +0 -18
  87. package/src/ui/components/magic-alert.component.d.ts +0 -3
  88. package/src/ui/components/magic-confirmation-box.component.d.ts +0 -3
  89. package/src/ui/directives/NonMagicControlDirective.d.ts +0 -41
  90. package/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.d.ts +0 -6
  91. package/src/ui/directives/magic/checkbox.magic.directive.d.ts +0 -9
  92. package/src/ui/directives/magic/combobox.magic.directive.d.ts +0 -6
  93. package/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.d.ts +0 -6
  94. package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +0 -12
  95. package/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.d.ts +0 -6
  96. package/src/ui/directives/magic/input.noformcontrol.magic.directive.d.ts +0 -6
  97. package/src/ui/directives/magic/nocontrol.magic.directive.d.ts +0 -3
  98. package/src/ui/directives/magic/row.magic.directive.d.ts +0 -15
  99. package/src/ui/directives/magic-focus.directive.d.ts +0 -3
  100. package/src/ui/directives/magic.directive.d.ts +1 -78
  101. package/src/ui/directives/magicViewContainerRef.directive.d.ts +0 -3
  102. package/src/ui/directives/mgformat.magic.directive.d.ts +0 -40
  103. package/src/ui/directives/range-validator.magic.directive.d.ts +0 -16
  104. package/src/ui/magic-confirmationBox.d.ts +0 -19
  105. package/src/ui/magic-modal/base-magic-overlay-container.d.ts +0 -9
  106. package/src/ui/magic-modal/magic-modal-form.d.ts +0 -3
  107. package/src/ui/magic-modal/magic-modal-interface.d.ts +0 -27
  108. package/src/ui/magic-modal/magic-overlay-container-wrapper.d.ts +0 -20
  109. package/src/ui/magic-modal/magic-overlay-container.d.ts +0 -51
  110. package/src/ui/magic-root.component.d.ts +0 -42
  111. package/src/ui/mgerror.magic.component.d.ts +0 -19
  112. package/src/ui/pipes/date.magic.pipe.d.ts +0 -6
  113. package/src/ui/pipes/time.magic.pipe.d.ts +0 -3
  114. package/src/ui/router-container.magic.component.d.ts +5 -21
  115. package/src/ui/subform.magic.component.d.ts +0 -21
  116. package/src/ui/task-base.magic.component.d.ts +0 -72
  117. package/src/ui/utils.d.ts +0 -3
  118. package/esm2015/src/ui/load-on-demand-module .magic.component.js +0 -16
  119. package/src/ui/load-on-demand-module .magic.component.d.ts +0 -5
@@ -1,36 +1,36 @@
1
1
  import { isNullOrUndefined, isUndefined } from 'util';
2
- import { ɵɵdefineInjectable, ɵsetClassMetadata, Injectable, Input, Output, ɵɵdirectiveInject, ViewContainerRef, ComponentFactoryResolver, ɵɵdefineDirective, Directive, ɵɵgetCurrentView, ɵɵelementStart, ɵɵlistener, ɵɵrestoreView, ɵɵnextContext, ɵɵtext, ɵɵelementEnd, ɵɵadvance, ɵɵtextInterpolate1, EventEmitter, Injector, ɵɵdefineComponent, ɵɵviewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ɵɵInheritDefinitionFeature, ɵɵtemplate, ɵɵelement, ɵɵproperty, Component, ViewChild, ElementRef, NgModuleFactoryLoader, ChangeDetectorRef, ɵɵstaticViewQuery, ɵɵgetInheritedFactory, ɵɵinject, ɵɵProvidersFeature, HostListener, Renderer2, Optional, ɵɵdefinePipe, Pipe, ɵɵprojection, ɵɵprojectionDef, ɵɵelementContainer, ɵɵreference, ɵɵresolveWindow, ɵɵtemplateRefExtractor, forwardRef, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
3
- import { NgIf, NgStyle, DatePipe, NgTemplateOutlet, CommonModule, formatDate } from '@angular/common';
4
- import { ActivatedRoute, Router, RouterModule } from '@angular/router';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, Component, Input, Output, Directive, EventEmitter, ViewChild, HostListener, Optional, Pipe, forwardRef, NgModule } from '@angular/core';
4
+ import * as i1 from '@angular/common';
5
+ import { DatePipe, CommonModule, formatDate } from '@angular/common';
6
+ import * as i2 from '@angular/router';
7
+ import { RouterModule } from '@angular/router';
5
8
  import { FormGroup, FormControl, Validators, NG_VALIDATORS, NG_VALUE_ACCESSOR, CheckboxControlValueAccessor, DefaultValueAccessor, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
- import { DynamicComponent, DynamicIoDirective, DynamicModule } from 'ng-dynamic-component';
9
+ import * as i3 from 'ng-dynamic-component';
10
+ import { DynamicModule } from 'ng-dynamic-component';
7
11
  import { __awaiter, __decorate, __metadata } from 'tslib';
8
12
  import { Subject } from 'rxjs';
9
- import { MagicBridge, getGuiEventObj } from '@magic-xpa/engine';
13
+ import { MagicBridge, getGuiEventObj, CookieService } from '@magic-xpa/engine';
10
14
  import { InteractiveCommandType, OverlayType, Styles, HtmlProperties, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
11
- import { MagicProperties, StorageAttribute, Logger, BindingLevel, StorageAttributeType, StrUtil, PICInterface } from '@magic-xpa/utils';
15
+ import { MagicProperties, Logger, StrUtil, StorageAttribute, BindingLevel, StorageAttributeType, PICInterface } from '@magic-xpa/utils';
12
16
  import { filter, map, debounceTime } from 'rxjs/operators';
13
- import { NString, StringBuilder, List, RefParam } from '@magic-xpa/mscorelib';
14
- import { Title } from '@angular/platform-browser';
17
+ import { NString, List, StringBuilder, RefParam } from '@magic-xpa/mscorelib';
18
+ import * as i1$1 from '@angular/platform-browser';
15
19
  import { fromEvent } from 'rxjs/internal/observable/fromEvent';
16
- import { HttpClient, HttpClientModule } from '@angular/common/http';
20
+ import * as i5 from '@angular/common/http';
21
+ import { HttpClientModule } from '@angular/common/http';
17
22
  import { NativeDateAdapter, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
18
- import { Platform } from '@angular/cdk/platform';
23
+ import * as i1$2 from '@angular/cdk/platform';
19
24
 
20
- /**
21
- * @ignore
22
- */
23
25
  class ControlMetadata {
24
26
  constructor() {
25
27
  this.properties = new Map();
26
28
  this.classesMap = new Map();
27
29
  this.stylesMap = new Map();
28
- // user properties
29
30
  this.userProperties = new Map();
30
31
  this.customValidators = new Map();
31
32
  }
32
33
  setClass(key, value) {
33
- // for no-control - hold the name of the class to be removed later
34
34
  if (this.classesMap.has(key)) {
35
35
  this.removedClass = this.classesMap.get(key);
36
36
  }
@@ -45,14 +45,9 @@ class ControlMetadata {
45
45
  this.stylesMap.set(key, value);
46
46
  }
47
47
  }
48
- /**
49
- * @ignore
50
- */
51
48
  class ControlsMetadata {
52
49
  constructor() {
53
- //values of control
54
50
  this.values = new Map();
55
- // dictionary of controls with there properties
56
51
  this.ControlsProperties = new Map();
57
52
  this.isCreated = false;
58
53
  this.isEditing = false;
@@ -66,8 +61,6 @@ class ControlsMetadata {
66
61
  return this.ControlsProperties.get(controlId);
67
62
  }
68
63
  update(obj) {
69
- //should we keep the values here ?
70
- //this.values = obj.ControlsValues;
71
64
  let props = obj.ControlsMetaData;
72
65
  for (let controlName in props) {
73
66
  if (!this.ControlsProperties.has(controlName))
@@ -96,16 +89,13 @@ class ControlsMetadata {
96
89
  return this.values.get(controlName);
97
90
  }
98
91
  }
99
- /**
100
- * @ignore
101
- */
102
92
  class Records {
103
93
  constructor() {
104
94
  this.data = new Map();
105
- this.list = []; //used for sequential access in table
95
+ this.list = [];
106
96
  this.recordsBeforeCurrentView = 0;
107
97
  this.isEmptyDataView = false;
108
- this.sizeUpdated = false; //used for evaluating the RecordsSizeChange.
98
+ this.sizeUpdated = false;
109
99
  }
110
100
  getRow(dvRowId) {
111
101
  return this.list[dvRowId + this.recordsBeforeCurrentView];
@@ -129,24 +119,14 @@ class Records {
129
119
  }
130
120
  return false;
131
121
  }
132
- /*
133
- * for row editing
134
- * */
135
122
  startRowEditing(guiRowId) {
136
123
  if (guiRowId < this.list.length && this.data.has(guiRowId))
137
124
  this.data.get(guiRowId).isEditing = true;
138
125
  }
139
- /*
140
- * stop row editing on row Id
141
- * */
142
126
  stopRowEditing(guiRowId) {
143
127
  if (guiRowId < this.list.length && this.data.has(guiRowId))
144
128
  this.data.get(guiRowId).isEditing = false;
145
129
  }
146
- /*
147
- * return if row is in editing
148
- * Called by the HTML code, so parameter is a string, not a numebr
149
- * */
150
130
  isRowInRowEditing(guiRowId) {
151
131
  if (+guiRowId < this.list.length) {
152
132
  if (!this.data.has(+guiRowId) || isNullOrUndefined(this.data.get(+guiRowId)))
@@ -175,7 +155,6 @@ class Records {
175
155
  updateSize(len) {
176
156
  if (this.list.length != len) {
177
157
  if (len < this.list.length) {
178
- //remove rows
179
158
  for (let i = len; i < this.list.length; i++) {
180
159
  this.data.delete(i);
181
160
  }
@@ -184,10 +163,6 @@ class Records {
184
163
  this.sizeUpdated = true;
185
164
  }
186
165
  }
187
- /**
188
- * crears data for the first record
189
- * @param template
190
- */
191
166
  clearFirstTableRecord(template) {
192
167
  if (this.list.length >= 1) {
193
168
  for (const key in template) {
@@ -218,9 +193,6 @@ class Records {
218
193
  return this.guiTopIndex;
219
194
  }
220
195
  }
221
- /**
222
- * @ignore
223
- */
224
196
  var HtmlClasses;
225
197
  (function (HtmlClasses) {
226
198
  HtmlClasses["Color"] = "color";
@@ -229,16 +201,11 @@ var HtmlClasses;
229
201
  HtmlClasses["HintColor"] = "hintcolor";
230
202
  })(HtmlClasses || (HtmlClasses = {}));
231
203
 
232
- /**
233
- * @ignore
234
- */
235
204
  class EngineMagicService {
236
205
  constructor() {
237
206
  this.magicBridge = MagicBridge;
238
207
  this.isStub = false;
239
- // true when user is logged in magic
240
208
  this.isLoggedIn = false;
241
- //TODO - unregister
242
209
  this.refreshDom = new Subject();
243
210
  this.interactiveCommands = new Subject();
244
211
  }
@@ -281,6 +248,9 @@ class EngineMagicService {
281
248
  GetControlPictureMask(taskId, controlName) {
282
249
  return this.magicBridge.GetControlPictureMask(taskId, controlName);
283
250
  }
251
+ GetFormattedValue(taskId, controlName, value) {
252
+ return this.magicBridge.GetFormattedValue(taskId, controlName, value);
253
+ }
284
254
  ValidateControlValue(taskId, controlName, value) {
285
255
  return this.magicBridge.ValidateControlValue(taskId, controlName, value);
286
256
  }
@@ -288,7 +258,6 @@ class EngineMagicService {
288
258
  return this.magicBridge.GetFldRanges(taskId, controlName);
289
259
  }
290
260
  saveData(data) {
291
- //this.magicBridge.saveData(data);
292
261
  }
293
262
  getIsLoggedIn() {
294
263
  return this.isLoggedIn;
@@ -303,24 +272,15 @@ class EngineMagicService {
303
272
  this.magicBridge.TerminateContextUsingFetchAPI();
304
273
  }
305
274
  }
306
- /** @nocollapse */ EngineMagicService.ɵfac = function EngineMagicService_Factory(t) { return new (t || EngineMagicService)(); };
307
- /** @nocollapse */ EngineMagicService.ɵprov = ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac });
308
- /*@__PURE__*/ (function () { ɵsetClassMetadata(EngineMagicService, [{
275
+ EngineMagicService.ɵfac = function EngineMagicService_Factory(t) { return new (t || EngineMagicService)(); };
276
+ EngineMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac });
277
+ (function () { i0.ɵsetClassMetadata(EngineMagicService, [{
309
278
  type: Injectable
310
279
  }], null, null); })();
311
280
 
312
- /**
313
- * Manages the list of components in a project, and the project title
314
- */
315
281
  class ComponentListMagicService {
316
282
  constructor() {
317
- /**
318
- * Map of project components
319
- */
320
283
  this.components = new Map();
321
- /**
322
- * Map of project dialogs
323
- */
324
284
  this.dialogs = new Map();
325
285
  this.lazyLoadModulesMap = null;
326
286
  }
@@ -334,11 +294,6 @@ class ComponentListMagicService {
334
294
  data = this.components.get(name);
335
295
  return data;
336
296
  }
337
- /**
338
- * Return a component according to name
339
- * @param name Name of requested component
340
- * @returns The requested component
341
- */
342
297
  getComponent(name, mustHaveData = true) {
343
298
  let data = this.getData(name, mustHaveData);
344
299
  return data ? data.component : null;
@@ -349,29 +304,16 @@ class ComponentListMagicService {
349
304
  this.components.set(key, data);
350
305
  }
351
306
  }
352
- /**
353
- * Return a component according to name
354
- * @param name Name of requested component
355
- * @returns The requested component
356
- */
357
307
  getModuleRef(name) {
358
308
  let data = this.getData(name, false);
359
309
  return data ? data.moduleRef : null;
360
310
  ;
361
311
  }
362
- /**
363
- * Return the lazy load module details of the specified component
364
- * @param name: Name of requested component
365
- * @returns: lazy load module details
366
- */
367
312
  getLazyLoadModuleData(name) {
368
313
  return (this.lazyLoadModulesMap != null && this.lazyLoadModulesMap.hasOwnProperty(name)) ? this.lazyLoadModulesMap[name] : null;
369
314
  }
370
315
  }
371
316
 
372
- /**
373
- * @ignore
374
- */
375
317
  class StylesMapManager {
376
318
  static magicValueGetStyle(styleName, magicValue) {
377
319
  let style = "";
@@ -398,12 +340,326 @@ StylesMapManager.MagicPropertyToHtmlAttributeMap = new Map([
398
340
  [MagicProperties.Wallpaper, "background-image"]
399
341
  ]);
400
342
 
401
- /**
402
- * @ignore
403
- */
343
+ class CommandsCollectorMagicService {
344
+ constructor(magic) {
345
+ this.magic = magic;
346
+ this.count = 0;
347
+ this.commands = new List();
348
+ this.subscription = null;
349
+ }
350
+ startCollecting() {
351
+ this.count++;
352
+ Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.startCollecting() --- " + this.count);
353
+ if (this.subscription === null) {
354
+ this.subscription = this.magic.refreshDom
355
+ .subscribe(command => {
356
+ this.commands.push(command);
357
+ });
358
+ }
359
+ }
360
+ stopCollecting() {
361
+ this.count--;
362
+ Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.stopCollecting() --- " + this.count);
363
+ if (this.count === 0) {
364
+ this.subscription.unsubscribe();
365
+ this.subscription = null;
366
+ }
367
+ }
368
+ GetCommands(taskId) {
369
+ const commands = this.commands.filter((command) => command.TaskTag === taskId);
370
+ commands.forEach(command => { this.commands.Remove(command); });
371
+ return commands;
372
+ }
373
+ }
374
+ CommandsCollectorMagicService.ɵfac = function CommandsCollectorMagicService_Factory(t) { return new (t || CommandsCollectorMagicService)(i0.ɵɵinject(EngineMagicService)); };
375
+ CommandsCollectorMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac });
376
+ (function () { i0.ɵsetClassMetadata(CommandsCollectorMagicService, [{
377
+ type: Injectable
378
+ }], function () { return [{ type: EngineMagicService }]; }, null); })();
379
+
380
+ class RouteCommand {
381
+ }
382
+ class RouterCommandsMagicService {
383
+ constructor() {
384
+ this.pendingRouteCommands = [];
385
+ }
386
+ AddRouteCommand(routeCommand) {
387
+ this.pendingRouteCommands.push(routeCommand);
388
+ }
389
+ ExecuteNextCommand() {
390
+ let pendingRouteCommand = this.pendingRouteCommands.shift();
391
+ if (!isNullOrUndefined(pendingRouteCommand)) {
392
+ pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
393
+ }
394
+ }
395
+ }
396
+ RouterCommandsMagicService.ɵfac = function RouterCommandsMagicService_Factory(t) { return new (t || RouterCommandsMagicService)(); };
397
+ RouterCommandsMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac });
398
+ (function () { i0.ɵsetClassMetadata(RouterCommandsMagicService, [{
399
+ type: Injectable
400
+ }], null, null); })();
401
+
402
+ class SubformMagicService {
403
+ constructor(task, activatedRoute, componentList, pendingCommandsCollector, router, routerCommandsMagicService, componentListMagicService, loader, injector) {
404
+ this.task = task;
405
+ this.activatedRoute = activatedRoute;
406
+ this.componentList = componentList;
407
+ this.pendingCommandsCollector = pendingCommandsCollector;
408
+ this.router = router;
409
+ this.routerCommandsMagicService = routerCommandsMagicService;
410
+ this.componentListMagicService = componentListMagicService;
411
+ this.loader = loader;
412
+ this.injector = injector;
413
+ this.subformsDict = {};
414
+ this.routesDict = {};
415
+ this.currentRouteDefinition = null;
416
+ }
417
+ mgGetComp(subformName) {
418
+ if (subformName in this.subformsDict) {
419
+ let formName = this.subformsDict[subformName].formName;
420
+ if (formName)
421
+ return this.componentList.getComponent(formName);
422
+ }
423
+ return null;
424
+ }
425
+ mgGetParameters(subformName) {
426
+ if (subformName in this.subformsDict) {
427
+ return this.subformsDict[subformName].parameters;
428
+ }
429
+ else
430
+ return "";
431
+ }
432
+ deleteSubformComp(subformControlName, formName) {
433
+ if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
434
+ if (this.subformsDict[subformControlName].formName === formName) {
435
+ this.subformsDict[subformControlName] = {};
436
+ this.task.refreshView();
437
+ }
438
+ }
439
+ }
440
+ addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
441
+ this.pendingCommandsCollector.startCollecting();
442
+ let refreshNeeded = false;
443
+ if (isNullOrUndefined(routerPath)) {
444
+ if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
445
+ if (this.subformsDict[subformControlName].formName === formName) {
446
+ this.subformsDict[subformControlName] = {};
447
+ this.task.refreshView();
448
+ }
449
+ }
450
+ let moduleRef = this.componentListMagicService.getModuleRef(formName);
451
+ if (moduleRef == null) {
452
+ let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(formName);
453
+ if (lazyLoadModule != null) {
454
+ this.loader
455
+ .load(lazyLoadModule.modulePath + "#" + lazyLoadModule.moduleName)
456
+ .then((moduleFactory) => {
457
+ moduleRef = moduleFactory.create(this.injector);
458
+ this.subformsDict[subformControlName] = {
459
+ formName,
460
+ parameters: { taskIdParam: taskId, taskDescription: taskDescription }
461
+ };
462
+ this.task.refreshView();
463
+ });
464
+ }
465
+ }
466
+ else {
467
+ this.subformsDict[subformControlName] = {
468
+ formName,
469
+ parameters: { taskIdParam: taskId, taskDescription: taskDescription }
470
+ };
471
+ refreshNeeded = true;
472
+ }
473
+ }
474
+ else {
475
+ if (inDefaultOutlet)
476
+ subformControlName = "primary";
477
+ let routeParams = new List();
478
+ routeParams.push(routerPath);
479
+ if (params !== null) {
480
+ routeParams = routeParams.concat(params);
481
+ }
482
+ let routeCommand = {
483
+ callerMgSubformServiceRef: this,
484
+ routerOutletName: subformControlName,
485
+ formName: formName,
486
+ parameters: { taskIdParam: taskId, taskDescription: taskDescription },
487
+ routeParams: routeParams
488
+ };
489
+ if (SubformMagicService.currentCallerMgSubformServiceRef === null)
490
+ this.ExecuteRouteCommand(routeCommand);
491
+ else
492
+ this.routerCommandsMagicService.AddRouteCommand(routeCommand);
493
+ }
494
+ if (refreshNeeded)
495
+ this.task.refreshView();
496
+ }
497
+ ExecuteRouteCommand(routeCommand) {
498
+ let reusingComponent = false;
499
+ let currentSubformMagicService = routeCommand.callerMgSubformServiceRef;
500
+ let relativeRoute = SubformMagicService.getRelativeRoute(currentSubformMagicService.activatedRoute);
501
+ if (currentSubformMagicService.routesDict[routeCommand.routerOutletName] === routeCommand.routeParams[0]) {
502
+ currentSubformMagicService.router.navigate([{ outlets: { [routeCommand.routerOutletName]: null } }], { relativeTo: relativeRoute })
503
+ .then((result) => {
504
+ SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
505
+ currentSubformMagicService.currentRouteDefinition = {
506
+ formName: routeCommand.formName,
507
+ parameters: routeCommand.parameters
508
+ };
509
+ currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
510
+ });
511
+ }
512
+ else {
513
+ SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
514
+ currentSubformMagicService.currentRouteDefinition = {
515
+ formName: routeCommand.formName,
516
+ parameters: routeCommand.parameters
517
+ };
518
+ if (SubformMagicService.routerContainers.length > 0) {
519
+ let routeContainer = SubformMagicService.routerContainers[0];
520
+ SubformMagicService.routerContainers.shift();
521
+ routeContainer.initializeComponent();
522
+ }
523
+ else {
524
+ currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
525
+ }
526
+ }
527
+ }
528
+ PerformRouterNavigate(routerOutletName, routeParams) {
529
+ let relativeRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
530
+ this.router.navigate([{ outlets: { [routerOutletName]: routeParams } }], { relativeTo: relativeRoute })
531
+ .then((result) => {
532
+ if (result !== null && !result) {
533
+ let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
534
+ subformMagicService.currentRouteDefinition = null;
535
+ SubformMagicService.currentCallerMgSubformServiceRef = null;
536
+ subformMagicService.pendingCommandsCollector.stopCollecting();
537
+ subformMagicService.routerCommandsMagicService.ExecuteNextCommand();
538
+ }
539
+ });
540
+ }
541
+ init() {
542
+ const pendingCommands = this.pendingCommandsCollector.GetCommands(this.task.taskId);
543
+ if (pendingCommands.length > 0) {
544
+ pendingCommands.forEach(command => { this.task.executeCommand(command); });
545
+ this.task.refreshView();
546
+ }
547
+ this.pendingCommandsCollector.stopCollecting();
548
+ }
549
+ refreshView() {
550
+ this.task.refreshView();
551
+ }
552
+ static getRelativeRoute(sendActivatedRoute) {
553
+ let currentActiveRoute = sendActivatedRoute;
554
+ if (currentActiveRoute.snapshot.routeConfig !== null && currentActiveRoute.snapshot.routeConfig.path === '') {
555
+ currentActiveRoute = currentActiveRoute.parent;
556
+ if (!currentActiveRoute.snapshot.routeConfig.loadChildren)
557
+ console.log("getRelativeRoute(): both path and currentActiveRoute.snapshot.routeConfig.loadChildren are empty.");
558
+ }
559
+ return currentActiveRoute;
560
+ }
561
+ }
562
+ SubformMagicService.currentCallerMgSubformServiceRef = null;
563
+ SubformMagicService.routerContainers = new Array();
564
+ SubformMagicService.ɵfac = function SubformMagicService_Factory(t) { return new (t || SubformMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(i2.ActivatedRoute), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(CommandsCollectorMagicService), i0.ɵɵinject(i2.Router), i0.ɵɵinject(RouterCommandsMagicService), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(i0.NgModuleFactoryLoader), i0.ɵɵinject(i0.Injector)); };
565
+ SubformMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
566
+ (function () { i0.ɵsetClassMetadata(SubformMagicService, [{
567
+ type: Injectable
568
+ }], function () { return [{ type: TaskMagicService }, { type: i2.ActivatedRoute }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: i2.Router }, { type: RouterCommandsMagicService }, { type: ComponentListMagicService }, { type: i0.NgModuleFactoryLoader }, { type: i0.Injector }]; }, null); })();
569
+
570
+ class RouterContainerMagicComponent {
571
+ constructor(activatedRoute, router, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
572
+ this.activatedRoute = activatedRoute;
573
+ this.router = router;
574
+ this.magic = magic;
575
+ this.containerTaskService = containerTaskService;
576
+ this.componentFactoryResolver = componentFactoryResolver;
577
+ this.viewContainerRef = viewContainerRef;
578
+ this.componentList = componentList;
579
+ this.pendingCommandsCollector = pendingCommandsCollector;
580
+ this.routerCommandsMagicService = routerCommandsMagicService;
581
+ this.componentRef = null;
582
+ this.parentMgSubformService = null;
583
+ }
584
+ static get LastRoute() {
585
+ return RouterContainerMagicComponent.lastRoute;
586
+ }
587
+ ngOnInit() {
588
+ let outletname = this.activatedRoute.outlet;
589
+ let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
590
+ let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
591
+ RouterContainerMagicComponent.lastRoute = this.router.url;
592
+ if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
593
+ this.insertRouteEvent(currentActiveRoute);
594
+ SubformMagicService.routerContainers.push(this);
595
+ }
596
+ else {
597
+ this.initializeComponent();
598
+ }
599
+ }
600
+ insertRouteEvent(currentActiveRoute) {
601
+ let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
602
+ guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
603
+ if (currentActiveRoute.snapshot.outlet !== 'primary')
604
+ guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
605
+ let calcRouterPath = currentActiveRoute.routeConfig.path;
606
+ if (calcRouterPath.length > 0) {
607
+ let routerPath = calcRouterPath;
608
+ let tokens = StrUtil.tokenize(routerPath, "/:");
609
+ guiEvent.RouterPath = tokens[0];
610
+ guiEvent.RouterParams = new List();
611
+ for (let i = 1; i < tokens.length; i++) {
612
+ guiEvent.RouterParams.push(currentActiveRoute.snapshot.params[tokens[i]]);
613
+ }
614
+ }
615
+ this.containerTaskService.insertEvent(guiEvent);
616
+ }
617
+ initializeComponent() {
618
+ let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
619
+ if (subformMagicService.currentRouteDefinition !== null) {
620
+ let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
621
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
622
+ this.componentRef = this.viewContainerRef.createComponent(componentFactory);
623
+ Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
624
+ let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
625
+ let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
626
+ subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
627
+ this.parentMgSubformService = subformMagicService;
628
+ subformMagicService.currentRouteDefinition = null;
629
+ SubformMagicService.currentCallerMgSubformServiceRef = null;
630
+ let ignoreParamChange = true;
631
+ myActiveRoute.paramMap.subscribe(params => {
632
+ if (!ignoreParamChange)
633
+ this.insertRouteEvent(myActiveRoute);
634
+ ignoreParamChange = false;
635
+ });
636
+ this.parentMgSubformService.refreshView();
637
+ this.routerCommandsMagicService.ExecuteNextCommand();
638
+ }
639
+ }
640
+ ngOnDestroy() {
641
+ if (this.componentRef != null) {
642
+ this.componentRef.instance.task.close();
643
+ let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
644
+ this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
645
+ RouterContainerMagicComponent.lastRoute = this.router.url;
646
+ }
647
+ }
648
+ }
649
+ RouterContainerMagicComponent.lastRoute = "/";
650
+ RouterContainerMagicComponent.ɵfac = function RouterContainerMagicComponent_Factory(t) { return new (t || RouterContainerMagicComponent)(i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(RouterCommandsMagicService)); };
651
+ RouterContainerMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
652
+ (function () { i0.ɵsetClassMetadata(RouterContainerMagicComponent, [{
653
+ type: Component,
654
+ args: [{
655
+ selector: 'magic-route-outlet',
656
+ template: `
657
+ `
658
+ }]
659
+ }], function () { return [{ type: i2.ActivatedRoute }, { type: i2.Router }, { type: EngineMagicService }, { type: TaskMagicService }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null); })();
660
+
404
661
  class GuiInteractiveExecutor {
405
662
  Run() {
406
- // Sets the currentContextID
407
663
  try {
408
664
  switch (this.command._commandType) {
409
665
  case InteractiveCommandType.GET_VALUE:
@@ -430,11 +686,13 @@ class GuiInteractiveExecutor {
430
686
  case InteractiveCommandType.REFRESH_PAGE:
431
687
  this.OnRefreshPage();
432
688
  break;
689
+ case InteractiveCommandType.GET_LAST_ROUTE:
690
+ this.OnGetLastRoute();
691
+ break;
433
692
  }
434
693
  }
435
694
  catch (ex) {
436
695
  throw ex;
437
- //want to see all the exceptions for now
438
696
  }
439
697
  }
440
698
  static executeInteractiveCommand(task, guiIntactiveCommand, overlayService) {
@@ -490,6 +748,9 @@ class GuiInteractiveExecutor {
490
748
  else
491
749
  this.command._boolVal = this.task.Records.list[guiRowIndex].isEditing;
492
750
  }
751
+ OnGetLastRoute() {
752
+ this.command.resultString = RouterContainerMagicComponent.LastRoute;
753
+ }
493
754
  }
494
755
 
495
756
  let BaseMagicOverlayContainer = class BaseMagicOverlayContainer {
@@ -511,80 +772,56 @@ BaseMagicOverlayContainer = __decorate([
511
772
  Output()
512
773
  ], BaseMagicOverlayContainer);
513
774
 
514
- /**
515
- * Directive for setting ViewContainerRef on element
516
- */
517
775
  class MagicViewContainerRef {
518
776
  constructor(vcRef, resolver) {
519
777
  this.vcRef = vcRef;
520
778
  this.resolver = resolver;
521
- // For angular 10 - find the component from the views
522
779
  let comp = (this.vcRef._hostView).find(v => v != null && !isNullOrUndefined(v.setViewContainerRef));
523
780
  comp.setViewContainerRef(vcRef);
524
781
  }
525
782
  }
526
- /** @nocollapse */ MagicViewContainerRef.ɵfac = function MagicViewContainerRef_Factory(t) { return new (t || MagicViewContainerRef)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(ComponentFactoryResolver)); };
527
- /** @nocollapse */ MagicViewContainerRef.ɵdir = ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]] });
528
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicViewContainerRef, [{
783
+ MagicViewContainerRef.ɵfac = function MagicViewContainerRef_Factory(t) { return new (t || MagicViewContainerRef)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
784
+ MagicViewContainerRef.ɵdir = i0.ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]] });
785
+ (function () { i0.ɵsetClassMetadata(MagicViewContainerRef, [{
529
786
  type: Directive,
530
787
  args: [{
531
788
  selector: '[magicViewContainerRef]',
532
789
  }]
533
- }], function () { return [{ type: ViewContainerRef }, { type: ComponentFactoryResolver }]; }, null); })();
790
+ }], function () { return [{ type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, null); })();
534
791
 
535
- const _c0 = ["modalheader"];
536
- const _c1 = ["modalForeground"];
792
+ const _c0$3 = ["modalheader"];
793
+ const _c1$1 = ["modalForeground"];
537
794
  function MagicOverlayContainer_button_2_Template(rf, ctx) { if (rf & 1) {
538
- const _r5 = ɵɵgetCurrentView();
539
- ɵɵelementStart(0, "button", 8);
540
- ɵɵlistener("click", function MagicOverlayContainer_button_2_Template_button_click_0_listener() { ɵɵrestoreView(_r5); const ctx_r4 = ɵɵnextContext(); return ctx_r4.OnClose(); });
541
- ɵɵtext(1, "X");
542
- ɵɵelementEnd();
795
+ const _r5 = i0.ɵɵgetCurrentView();
796
+ i0.ɵɵelementStart(0, "button", 8);
797
+ i0.ɵɵlistener("click", function MagicOverlayContainer_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.OnClose(); });
798
+ i0.ɵɵtext(1, "X");
799
+ i0.ɵɵelementEnd();
543
800
  } }
544
801
  function MagicOverlayContainer_div_5_Template(rf, ctx) { if (rf & 1) {
545
- const _r8 = ɵɵgetCurrentView();
546
- ɵɵelementStart(0, "div", 9, 10);
547
- ɵɵtext(2);
548
- ɵɵelementStart(3, "button", 11);
549
- ɵɵlistener("click", function MagicOverlayContainer_div_5_Template_button_click_3_listener() { ɵɵrestoreView(_r8); const ctx_r7 = ɵɵnextContext(); return ctx_r7.OnClose(); });
550
- ɵɵtext(4, "X");
551
- ɵɵelementEnd();
552
- ɵɵelementEnd();
802
+ const _r8 = i0.ɵɵgetCurrentView();
803
+ i0.ɵɵelementStart(0, "div", 9, 10);
804
+ i0.ɵɵtext(2);
805
+ i0.ɵɵelementStart(3, "button", 11);
806
+ i0.ɵɵlistener("click", function MagicOverlayContainer_div_5_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return ctx_r7.OnClose(); });
807
+ i0.ɵɵtext(4, "X");
808
+ i0.ɵɵelementEnd();
809
+ i0.ɵɵelementEnd();
553
810
  } if (rf & 2) {
554
- const ctx_r2 = ɵɵnextContext();
555
- ɵɵadvance(2);
556
- ɵɵtextInterpolate1(" ", ctx_r2.getText(), " ");
811
+ const ctx_r2 = i0.ɵɵnextContext();
812
+ i0.ɵɵadvance(2);
813
+ i0.ɵɵtextInterpolate1(" ", ctx_r2.getText(), " ");
557
814
  } }
558
- /**
559
- * Creates a modal window for Magic modal window components
560
- */
561
815
  class MagicOverlayContainer extends BaseMagicOverlayContainer {
562
- /**
563
- *
564
- * @param injector
565
- * @param componentFactoryResolver
566
- */
567
816
  constructor(injector, componentFactoryResolver) {
568
817
  super();
569
818
  this.injector = injector;
570
819
  this.componentFactoryResolver = componentFactoryResolver;
571
- /**
572
- *
573
- */
574
820
  this.ModalComp = null;
575
- /**
576
- *
577
- */
578
821
  this.ModalCompParameters = {};
579
822
  this.onClose = new EventEmitter();
580
- /**
581
- *
582
- */
583
823
  this.componentRef = null;
584
824
  }
585
- /**
586
- *
587
- */
588
825
  ngOnInit() {
589
826
  const factory = this.componentFactoryResolver.resolveComponentFactory(this.ModalComp);
590
827
  this.componentRef = this.modalbodyViewContainerRef.createComponent(factory);
@@ -593,10 +830,6 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
593
830
  setViewContainerRef(vcRef) {
594
831
  this.modalbodyViewContainerRef = vcRef;
595
832
  }
596
- /**
597
- * Returns the form name
598
- * @returns
599
- */
600
833
  getText() {
601
834
  if (this.componentRef !== null) {
602
835
  let comp = this.componentRef.instance;
@@ -605,10 +838,6 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
605
838
  else
606
839
  return "";
607
840
  }
608
- /**
609
- * Returns CSS styles for the window
610
- * @returns
611
- */
612
841
  getStyle() {
613
842
  let styles = {};
614
843
  if (this.componentRef != undefined) {
@@ -625,10 +854,6 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
625
854
  }
626
855
  return styles;
627
856
  }
628
- /**
629
- * Returns the CSS styles for the client area
630
- * @returns
631
- */
632
857
  getClientAreaStyles() {
633
858
  let styles = {};
634
859
  if (this.componentRef != undefined) {
@@ -644,63 +869,53 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
644
869
  }
645
870
  return styles;
646
871
  }
647
- /**
648
- * Should the title bar be displayed
649
- * @returns
650
- */
651
872
  getShowTitleBar() {
652
873
  if (this.componentRef != undefined) {
653
874
  let comp = this.componentRef.instance;
654
875
  return comp.ShowTitleBar();
655
876
  }
656
877
  }
657
- /**
658
- *
659
- */
660
878
  OnClose() {
661
879
  this.onClose.emit();
662
880
  }
663
- /**
664
- * Handles click in the background window
665
- */
666
881
  OnBackgroundClick() {
667
882
  let comp = this.componentRef.instance;
668
883
  if (comp.ShouldCloseOnBackgroundClick())
669
884
  this.OnClose();
670
885
  }
671
886
  }
672
- /** @nocollapse */ MagicOverlayContainer.ɵfac = function MagicOverlayContainer_Factory(t) { return new (t || MagicOverlayContainer)(ɵɵdirectiveInject(Injector), ɵɵdirectiveInject(ComponentFactoryResolver)); };
673
- /** @nocollapse */ MagicOverlayContainer.ɵcmp = ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
674
- ɵɵviewQuery(_c0, true);
675
- ɵɵviewQuery(_c1, true);
887
+ MagicOverlayContainer.ɵfac = function MagicOverlayContainer_Factory(t) { return new (t || MagicOverlayContainer)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
888
+ MagicOverlayContainer.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
889
+ i0.ɵɵviewQuery(_c0$3, true);
890
+ i0.ɵɵviewQuery(_c1$1, true);
676
891
  } if (rf & 2) {
677
892
  var _t;
678
- ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
679
- ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.foregroundElementRef = _t.first);
680
- } }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, features: [ɵɵInheritDefinitionFeature], decls: 9, vars: 4, consts: [[1, "modal-background", 3, "click"], ["tabindex", "-1", "style", "float:right; border: none; background-color: transparent; outline: none; color: white", 3, "click", 4, "ngIf"], [1, "modal-foreground", 3, "ngStyle"], ["modalForeground", ""], ["class", "modal-header", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["modalbody", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "modal-header"], ["modalheader", ""], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) { if (rf & 1) {
681
- ɵɵelementStart(0, "div");
682
- ɵɵelementStart(1, "div", 0);
683
- ɵɵlistener("click", function MagicOverlayContainer_Template_div_click_1_listener() { return ctx.OnBackgroundClick(); });
684
- ɵɵtemplate(2, MagicOverlayContainer_button_2_Template, 2, 0, "button", 1);
685
- ɵɵelementEnd();
686
- ɵɵelementStart(3, "div", 2, 3);
687
- ɵɵtemplate(5, MagicOverlayContainer_div_5_Template, 5, 1, "div", 4);
688
- ɵɵelementStart(6, "div", 5);
689
- ɵɵelement(7, "div", 6, 7);
690
- ɵɵelementEnd();
691
- ɵɵelementEnd();
692
- ɵɵelementEnd();
893
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
894
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.foregroundElementRef = _t.first);
895
+ } }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 9, vars: 4, consts: [[1, "modal-background", 3, "click"], ["tabindex", "-1", "style", "float:right; border: none; background-color: transparent; outline: none; color: white", 3, "click", 4, "ngIf"], [1, "modal-foreground", 3, "ngStyle"], ["modalForeground", ""], ["class", "modal-header", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["modalbody", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "modal-header"], ["modalheader", ""], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) { if (rf & 1) {
896
+ i0.ɵɵelementStart(0, "div");
897
+ i0.ɵɵelementStart(1, "div", 0);
898
+ i0.ɵɵlistener("click", function MagicOverlayContainer_Template_div_click_1_listener() { return ctx.OnBackgroundClick(); });
899
+ i0.ɵɵtemplate(2, MagicOverlayContainer_button_2_Template, 2, 0, "button", 1);
900
+ i0.ɵɵelementEnd();
901
+ i0.ɵɵelementStart(3, "div", 2, 3);
902
+ i0.ɵɵtemplate(5, MagicOverlayContainer_div_5_Template, 5, 1, "div", 4);
903
+ i0.ɵɵelementStart(6, "div", 5);
904
+ i0.ɵɵelement(7, "div", 6, 7);
905
+ i0.ɵɵelementEnd();
906
+ i0.ɵɵelementEnd();
907
+ i0.ɵɵelementEnd();
693
908
  } if (rf & 2) {
694
- ɵɵadvance(2);
695
- ɵɵproperty("ngIf", !ctx.getShowTitleBar());
696
- ɵɵadvance(1);
697
- ɵɵproperty("ngStyle", ctx.getStyle());
698
- ɵɵadvance(2);
699
- ɵɵproperty("ngIf", ctx.getShowTitleBar());
700
- ɵɵadvance(1);
701
- ɵɵproperty("ngStyle", ctx.getClientAreaStyles());
702
- } }, directives: [NgIf, NgStyle, MagicViewContainerRef], styles: [".modal-foreground[_ngcontent-%COMP%]{background-color:#fff}.modal-background[_ngcontent-%COMP%], .modal-foreground[_ngcontent-%COMP%]{bottom:0;left:0;position:fixed;right:0;top:0}.modal-background[_ngcontent-%COMP%]{background-color:#000;opacity:.75}.modal-header[_ngcontent-%COMP%]{background-color:beige;border-bottom:2px solid red}"] });
703
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicOverlayContainer, [{
909
+ i0.ɵɵadvance(2);
910
+ i0.ɵɵproperty("ngIf", !ctx.getShowTitleBar());
911
+ i0.ɵɵadvance(1);
912
+ i0.ɵɵproperty("ngStyle", ctx.getStyle());
913
+ i0.ɵɵadvance(2);
914
+ i0.ɵɵproperty("ngIf", ctx.getShowTitleBar());
915
+ i0.ɵɵadvance(1);
916
+ i0.ɵɵproperty("ngStyle", ctx.getClientAreaStyles());
917
+ } }, directives: [i1.NgIf, i1.NgStyle, MagicViewContainerRef], styles: [".modal-foreground[_ngcontent-%COMP%]{background-color:#fff}.modal-background[_ngcontent-%COMP%], .modal-foreground[_ngcontent-%COMP%]{bottom:0;left:0;position:fixed;right:0;top:0}.modal-background[_ngcontent-%COMP%]{background-color:#000;opacity:.75}.modal-header[_ngcontent-%COMP%]{background-color:beige;border-bottom:2px solid red}"] });
918
+ (function () { i0.ɵsetClassMetadata(MagicOverlayContainer, [{
704
919
  type: Component,
705
920
  args: [{
706
921
  selector: 'app-magic-overlay-container',
@@ -723,7 +938,7 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
723
938
  `,
724
939
  styleUrls: ['./magic-overlay-container.css']
725
940
  }]
726
- }], function () { return [{ type: Injector }, { type: ComponentFactoryResolver }]; }, { headerElementRef: [{
941
+ }], function () { return [{ type: i0.Injector }, { type: i0.ComponentFactoryResolver }]; }, { headerElementRef: [{
727
942
  type: ViewChild,
728
943
  args: ['modalheader', { static: false }]
729
944
  }], foregroundElementRef: [{
@@ -737,44 +952,28 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
737
952
  type: Output
738
953
  }] }); })();
739
954
 
740
- /**
741
- * Service managing overlay windows
742
- * This is Magic's default provider
743
- */
744
955
  class OverlayContainerMagicProvider {
745
956
  getComponent() {
746
957
  return MagicOverlayContainer;
747
958
  }
748
959
  }
749
- /** @nocollapse */ OverlayContainerMagicProvider.ɵfac = function OverlayContainerMagicProvider_Factory(t) { return new (t || OverlayContainerMagicProvider)(); };
750
- /** @nocollapse */ OverlayContainerMagicProvider.ɵprov = ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
751
- /*@__PURE__*/ (function () { ɵsetClassMetadata(OverlayContainerMagicProvider, [{
960
+ OverlayContainerMagicProvider.ɵfac = function OverlayContainerMagicProvider_Factory(t) { return new (t || OverlayContainerMagicProvider)(); };
961
+ OverlayContainerMagicProvider.ɵprov = i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
962
+ (function () { i0.ɵsetClassMetadata(OverlayContainerMagicProvider, [{
752
963
  type: Injectable
753
964
  }], null, null); })();
754
965
 
755
- /**
756
- * This is a base class for the magic confirm components
757
- */
758
966
  class BaseMagicConfirmComponent {
759
967
  constructor() {
760
- /**
761
- * onClose Event - to be raised when the component is closed
762
- * should pass true when OK is pressed and false when cancel is pressed
763
- */
764
968
  this.onClose = new EventEmitter();
765
969
  }
766
- /**
767
- * raises close Event
768
- * @param result true when OK is pressed and false when cancel is pressed
769
- *
770
- */
771
970
  OnClose(result) {
772
971
  this.onClose.emit(result);
773
972
  }
774
973
  }
775
- /** @nocollapse */ BaseMagicConfirmComponent.ɵfac = function BaseMagicConfirmComponent_Factory(t) { return new (t || BaseMagicConfirmComponent)(); };
776
- /** @nocollapse */ BaseMagicConfirmComponent.ɵcmp = ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, styles: [""] });
777
- /*@__PURE__*/ (function () { ɵsetClassMetadata(BaseMagicConfirmComponent, [{
974
+ BaseMagicConfirmComponent.ɵfac = function BaseMagicConfirmComponent_Factory(t) { return new (t || BaseMagicConfirmComponent)(); };
975
+ BaseMagicConfirmComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, styles: [""] });
976
+ (function () { i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
778
977
  type: Component,
779
978
  args: [{
780
979
  selector: 'mg-base-alert',
@@ -789,27 +988,17 @@ class BaseMagicConfirmComponent {
789
988
  type: Output
790
989
  }] }); })();
791
990
 
792
- /**
793
- * This is a base class for the magic alert components
794
- */
795
991
  class BaseMagicAlertComponent {
796
992
  constructor() {
797
- /**
798
- * onClose Event - to be raised when the component is closed
799
-
800
- */
801
993
  this.onClose = new EventEmitter();
802
994
  }
803
- /**
804
- * close magic alert
805
- */
806
995
  OnClose() {
807
996
  this.onClose.emit();
808
997
  }
809
998
  }
810
- /** @nocollapse */ BaseMagicAlertComponent.ɵfac = function BaseMagicAlertComponent_Factory(t) { return new (t || BaseMagicAlertComponent)(); };
811
- /** @nocollapse */ BaseMagicAlertComponent.ɵcmp = ɵɵdefineComponent({ type: BaseMagicAlertComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicAlertComponent_Template(rf, ctx) { }, styles: [""] });
812
- /*@__PURE__*/ (function () { ɵsetClassMetadata(BaseMagicAlertComponent, [{
999
+ BaseMagicAlertComponent.ɵfac = function BaseMagicAlertComponent_Factory(t) { return new (t || BaseMagicAlertComponent)(); };
1000
+ BaseMagicAlertComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicAlertComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicAlertComponent_Template(rf, ctx) { }, styles: [""] });
1001
+ (function () { i0.ɵsetClassMetadata(BaseMagicAlertComponent, [{
813
1002
  type: Component,
814
1003
  args: [{
815
1004
  selector: 'mg-base-alert',
@@ -824,9 +1013,6 @@ class BaseMagicAlertComponent {
824
1013
  type: Output
825
1014
  }] }); })();
826
1015
 
827
- /**
828
- * Directive for setting focus on element
829
- */
830
1016
  class MagicFocusDirective {
831
1017
  constructor(hostElement) {
832
1018
  this.hostElement = hostElement;
@@ -835,40 +1021,27 @@ class MagicFocusDirective {
835
1021
  this.hostElement.nativeElement.focus();
836
1022
  }
837
1023
  }
838
- /** @nocollapse */ MagicFocusDirective.ɵfac = function MagicFocusDirective_Factory(t) { return new (t || MagicFocusDirective)(ɵɵdirectiveInject(ElementRef)); };
839
- /** @nocollapse */ MagicFocusDirective.ɵdir = ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]] });
840
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicFocusDirective, [{
1024
+ MagicFocusDirective.ɵfac = function MagicFocusDirective_Factory(t) { return new (t || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
1025
+ MagicFocusDirective.ɵdir = i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]] });
1026
+ (function () { i0.ɵsetClassMetadata(MagicFocusDirective, [{
841
1027
  type: Directive,
842
1028
  args: [{
843
1029
  selector: '[magicFocus]'
844
1030
  }]
845
- }], function () { return [{ type: ElementRef }]; }, null); })();
1031
+ }], function () { return [{ type: i0.ElementRef }]; }, null); })();
846
1032
 
847
- const _c0$1 = ["overlayContainerWrapper"];
1033
+ const _c0$2 = ["overlayContainerWrapper"];
848
1034
  class MagicOverlayContainerWrapper {
849
- /**
850
- *
851
- * @param componentFactoryResolver
852
- */
853
1035
  constructor(componentListMagicService, loader, injector, componentFactoryResolver, changeDetectorRef) {
854
1036
  this.componentListMagicService = componentListMagicService;
855
1037
  this.loader = loader;
856
1038
  this.injector = injector;
857
1039
  this.componentFactoryResolver = componentFactoryResolver;
858
1040
  this.changeDetectorRef = changeDetectorRef;
859
- /**
860
- *
861
- */
862
1041
  this.Component = null;
863
- /**
864
- *
865
- */
866
1042
  this.Parameters = {};
867
1043
  this.onClose = new EventEmitter();
868
1044
  }
869
- /**
870
- *
871
- */
872
1045
  ngOnInit() {
873
1046
  let moduleRef = this.componentListMagicService.getModuleRef(this.Parameters.MagicFormName);
874
1047
  if (moduleRef == null) {
@@ -918,31 +1091,27 @@ class MagicOverlayContainerWrapper {
918
1091
  this.changeDetectorRef.detectChanges();
919
1092
  }
920
1093
  }
921
- /**
922
- * @ignore
923
- * contais data of allowed base components to use
924
- */
925
1094
  MagicOverlayContainerWrapper.allowedBaseComps = new Map([
926
1095
  [OverlayType.Overlay, { comp: BaseMagicOverlayContainer, error: 'BaseMagicOverlayContainer . Overlay ' }],
927
1096
  [OverlayType.Alert, { comp: BaseMagicAlertComponent, error: 'BaseMagicAlertComponent. Alert ' }],
928
1097
  [OverlayType.ConfirmationBox, { comp: BaseMagicConfirmComponent, error: 'BaseMagicConfirmComponent. Confirmation ' }]
929
1098
  ]);
930
- /** @nocollapse */ MagicOverlayContainerWrapper.ɵfac = function MagicOverlayContainerWrapper_Factory(t) { return new (t || MagicOverlayContainerWrapper)(ɵɵdirectiveInject(ComponentListMagicService), ɵɵdirectiveInject(NgModuleFactoryLoader), ɵɵdirectiveInject(Injector), ɵɵdirectiveInject(ComponentFactoryResolver), ɵɵdirectiveInject(ChangeDetectorRef)); };
931
- /** @nocollapse */ MagicOverlayContainerWrapper.ɵcmp = ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
932
- ɵɵstaticViewQuery(_c0$1, true);
1099
+ MagicOverlayContainerWrapper.ɵfac = function MagicOverlayContainerWrapper_Factory(t) { return new (t || MagicOverlayContainerWrapper)(i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(i0.NgModuleFactoryLoader), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
1100
+ MagicOverlayContainerWrapper.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
1101
+ i0.ɵɵstaticViewQuery(_c0$2, true);
933
1102
  } if (rf & 2) {
934
1103
  var _t;
935
- ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.overlayContainerWrapperElementRef = _t.first);
1104
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.overlayContainerWrapperElementRef = _t.first);
936
1105
  } }, inputs: { Component: "Component", Parameters: "Parameters", OverlayTypeParam: "OverlayTypeParam" }, outputs: { onClose: "onClose" }, decls: 7, vars: 0, consts: [["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["overlayContainerWrapper", ""], ["magicViewContainerRef", ""], ["overlayContent", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) { if (rf & 1) {
937
- ɵɵelementStart(0, "div");
938
- ɵɵelement(1, "div", 0);
939
- ɵɵelementStart(2, "div", 1, 2);
940
- ɵɵelement(4, "div", 3, 4);
941
- ɵɵelementEnd();
942
- ɵɵelement(6, "div", 5);
943
- ɵɵelementEnd();
1106
+ i0.ɵɵelementStart(0, "div");
1107
+ i0.ɵɵelement(1, "div", 0);
1108
+ i0.ɵɵelementStart(2, "div", 1, 2);
1109
+ i0.ɵɵelement(4, "div", 3, 4);
1110
+ i0.ɵɵelementEnd();
1111
+ i0.ɵɵelement(6, "div", 5);
1112
+ i0.ɵɵelementEnd();
944
1113
  } }, directives: [MagicFocusDirective, MagicViewContainerRef], styles: [".overlay-container-wrapper-background[_ngcontent-%COMP%] {\n \n position: fixed;\n top: 0;\n z-index: 999;\n right: 0;\n bottom: 0;\n left: 0;\n }"] });
945
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicOverlayContainerWrapper, [{
1114
+ (function () { i0.ɵsetClassMetadata(MagicOverlayContainerWrapper, [{
946
1115
  type: Component,
947
1116
  args: [{
948
1117
  selector: 'app-magic-overlay-container-wrapper',
@@ -968,7 +1137,7 @@ MagicOverlayContainerWrapper.allowedBaseComps = new Map([
968
1137
  }
969
1138
  `]
970
1139
  }]
971
- }], function () { return [{ type: ComponentListMagicService }, { type: NgModuleFactoryLoader }, { type: Injector }, { type: ComponentFactoryResolver }, { type: ChangeDetectorRef }]; }, { Component: [{
1140
+ }], function () { return [{ type: ComponentListMagicService }, { type: i0.NgModuleFactoryLoader }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }]; }, { Component: [{
972
1141
  type: Input
973
1142
  }], Parameters: [{
974
1143
  type: Input
@@ -981,35 +1150,32 @@ MagicOverlayContainerWrapper.allowedBaseComps = new Map([
981
1150
  args: ['overlayContainerWrapper', { static: true }]
982
1151
  }] }); })();
983
1152
 
984
- /***
985
- * This is sample component for the alert message
986
- */
987
1153
  class MagicAlertComponent extends BaseMagicAlertComponent {
988
1154
  }
989
- /** @nocollapse */ MagicAlertComponent.ɵfac = function MagicAlertComponent_Factory(t) { return ɵMagicAlertComponent_BaseFactory(t || MagicAlertComponent); };
990
- /** @nocollapse */ MagicAlertComponent.ɵcmp = ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], features: [ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
991
- ɵɵelementStart(0, "div");
992
- ɵɵelementStart(1, "div", 0);
993
- ɵɵelementStart(2, "h2");
994
- ɵɵtext(3);
995
- ɵɵelementEnd();
996
- ɵɵelementStart(4, "p");
997
- ɵɵtext(5);
998
- ɵɵelementEnd();
999
- ɵɵelementStart(6, "button", 1);
1000
- ɵɵlistener("click", function MagicAlertComponent_Template_button_click_6_listener() { return ctx.OnClose(); });
1001
- ɵɵtext(7, "OK");
1002
- ɵɵelementEnd();
1003
- ɵɵelementEnd();
1004
- ɵɵelementEnd();
1155
+ MagicAlertComponent.ɵfac = function MagicAlertComponent_Factory(t) { return ɵMagicAlertComponent_BaseFactory(t || MagicAlertComponent); };
1156
+ MagicAlertComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
1157
+ i0.ɵɵelementStart(0, "div");
1158
+ i0.ɵɵelementStart(1, "div", 0);
1159
+ i0.ɵɵelementStart(2, "h2");
1160
+ i0.ɵɵtext(3);
1161
+ i0.ɵɵelementEnd();
1162
+ i0.ɵɵelementStart(4, "p");
1163
+ i0.ɵɵtext(5);
1164
+ i0.ɵɵelementEnd();
1165
+ i0.ɵɵelementStart(6, "button", 1);
1166
+ i0.ɵɵlistener("click", function MagicAlertComponent_Template_button_click_6_listener() { return ctx.OnClose(); });
1167
+ i0.ɵɵtext(7, "OK");
1168
+ i0.ɵɵelementEnd();
1169
+ i0.ɵɵelementEnd();
1170
+ i0.ɵɵelementEnd();
1005
1171
  } if (rf & 2) {
1006
- ɵɵadvance(3);
1007
- ɵɵtextInterpolate1(" ", ctx.title, "");
1008
- ɵɵadvance(2);
1009
- ɵɵtextInterpolate1("", ctx.message, " ");
1172
+ i0.ɵɵadvance(3);
1173
+ i0.ɵɵtextInterpolate1(" ", ctx.title, "");
1174
+ i0.ɵɵadvance(2);
1175
+ i0.ɵɵtextInterpolate1("", ctx.message, " ");
1010
1176
  } }, styles: [".mg-message-background[_ngcontent-%COMP%] {\n background-color: #F5F5F5;\n text-align: center;\n width: 40%;\n font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\n padding: 17px;\n border-radius: 5px;\n text-align: center;\n margin-top: 10% ;\n margin-left: auto;\n margin-right: auto;\n border: 1px solid gray;\n }\n\n button[_ngcontent-%COMP%] {\n background-color: #8CD4F5;\n color: white;\n border: none;\n box-shadow: none;\n font-size: 17px;\n font-weight: 500;\n -webkit-border-radius: 4px;\n border-radius: 5px;\n padding: 10px 32px;\n margin: 26px 5px 0 5px;\n cursor: pointer;\n }"] });
1011
- const ɵMagicAlertComponent_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFactory(MagicAlertComponent);
1012
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicAlertComponent, [{
1177
+ const ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent);
1178
+ (function () { i0.ɵsetClassMetadata(MagicAlertComponent, [{
1013
1179
  type: Component,
1014
1180
  args: [{
1015
1181
  selector: 'sample-magic-alert-component',
@@ -1053,39 +1219,36 @@ const ɵMagicAlertComponent_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFactory(
1053
1219
  }]
1054
1220
  }], null, null); })();
1055
1221
 
1056
- /***
1057
- * This is sample component for the confirmation box
1058
- */
1059
1222
  class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1060
1223
  }
1061
- /** @nocollapse */ MagicConfirmationBoxComponent.ɵfac = function MagicConfirmationBoxComponent_Factory(t) { return ɵMagicConfirmationBoxComponent_BaseFactory(t || MagicConfirmationBoxComponent); };
1062
- /** @nocollapse */ MagicConfirmationBoxComponent.ɵcmp = ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], features: [ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "mg-message-background"], [3, "click"], [1, "cancel", 3, "click"]], template: function MagicConfirmationBoxComponent_Template(rf, ctx) { if (rf & 1) {
1063
- ɵɵelementStart(0, "div");
1064
- ɵɵelementStart(1, "div", 0);
1065
- ɵɵelementStart(2, "h2");
1066
- ɵɵtext(3);
1067
- ɵɵelementEnd();
1068
- ɵɵtext(4);
1069
- ɵɵelement(5, "br");
1070
- ɵɵelement(6, "br");
1071
- ɵɵelementStart(7, "button", 1);
1072
- ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_7_listener() { return ctx.OnClose(true); });
1073
- ɵɵtext(8, "OK");
1074
- ɵɵelementEnd();
1075
- ɵɵelementStart(9, "button", 2);
1076
- ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_9_listener() { return ctx.OnClose(false); });
1077
- ɵɵtext(10, "Cancel");
1078
- ɵɵelementEnd();
1079
- ɵɵelementEnd();
1080
- ɵɵelementEnd();
1224
+ MagicConfirmationBoxComponent.ɵfac = function MagicConfirmationBoxComponent_Factory(t) { return ɵMagicConfirmationBoxComponent_BaseFactory(t || MagicConfirmationBoxComponent); };
1225
+ MagicConfirmationBoxComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "mg-message-background"], [3, "click"], [1, "cancel", 3, "click"]], template: function MagicConfirmationBoxComponent_Template(rf, ctx) { if (rf & 1) {
1226
+ i0.ɵɵelementStart(0, "div");
1227
+ i0.ɵɵelementStart(1, "div", 0);
1228
+ i0.ɵɵelementStart(2, "h2");
1229
+ i0.ɵɵtext(3);
1230
+ i0.ɵɵelementEnd();
1231
+ i0.ɵɵtext(4);
1232
+ i0.ɵɵelement(5, "br");
1233
+ i0.ɵɵelement(6, "br");
1234
+ i0.ɵɵelementStart(7, "button", 1);
1235
+ i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_7_listener() { return ctx.OnClose(true); });
1236
+ i0.ɵɵtext(8, "OK");
1237
+ i0.ɵɵelementEnd();
1238
+ i0.ɵɵelementStart(9, "button", 2);
1239
+ i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_9_listener() { return ctx.OnClose(false); });
1240
+ i0.ɵɵtext(10, "Cancel");
1241
+ i0.ɵɵelementEnd();
1242
+ i0.ɵɵelementEnd();
1243
+ i0.ɵɵelementEnd();
1081
1244
  } if (rf & 2) {
1082
- ɵɵadvance(3);
1083
- ɵɵtextInterpolate1(" ", ctx.title, "");
1084
- ɵɵadvance(1);
1085
- ɵɵtextInterpolate1(" ", ctx.message, " ");
1245
+ i0.ɵɵadvance(3);
1246
+ i0.ɵɵtextInterpolate1(" ", ctx.title, "");
1247
+ i0.ɵɵadvance(1);
1248
+ i0.ɵɵtextInterpolate1(" ", ctx.message, " ");
1086
1249
  } }, styles: [".mg-message-background[_ngcontent-%COMP%] {\n background-color: #F5F5F5;\n text-align: center;\n width: 40%;\n font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\n padding: 17px;\n border-radius: 5px;\n text-align: center;\n margin-top: 10% ;\n margin-left: auto;\n margin-right: auto;\n border: 1px solid gray;\n }\n\n button[_ngcontent-%COMP%] {\n background-color: #8CD4F5;\n color: white;\n border: none;\n box-shadow: none;\n font-size: 17px;\n font-weight: 500;\n -webkit-border-radius: 4px;\n border-radius: 5px;\n padding: 10px 32px;\n margin: 26px 5px 0 5px;\n cursor: pointer;\n }\n \n button.cancel[_ngcontent-%COMP%] {\n background-color: #C1C1C1;\n }"] });
1087
- const ɵMagicConfirmationBoxComponent_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFactory(MagicConfirmationBoxComponent);
1088
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicConfirmationBoxComponent, [{
1250
+ const ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent);
1251
+ (function () { i0.ɵsetClassMetadata(MagicConfirmationBoxComponent, [{
1089
1252
  type: Component,
1090
1253
  args: [{
1091
1254
  selector: 'sample-magic-confirmation-box',
@@ -1136,52 +1299,25 @@ const ɵMagicConfirmationBoxComponent_BaseFactory = /*@__PURE__*/ ɵɵgetInherit
1136
1299
  }]
1137
1300
  }], null, null); })();
1138
1301
 
1139
- /**
1140
- * Service managing overlay windows
1141
- * This is Magic's default provider
1142
- */
1143
- /**
1144
- * Service managing alert and confirmation windows
1145
- * This is Magic's default provider
1146
- */
1147
1302
  class ConfirmationComponentsMagicProvider {
1148
- /**
1149
- * Return true when use default javascript alert and confirmation or return false to provide custom components
1150
- * @returns true is we want to use default javascript alert and confirmation
1151
- */
1152
1303
  showDefaultConfirmations() {
1153
1304
  return true;
1154
1305
  }
1155
- /**
1156
- * Returns component that will replace javascript alert. The component will be used only if showDefaultConfirmations = false
1157
- * @returns component that will replace javascript Alert
1158
- */
1159
1306
  getAlertComponent() {
1160
1307
  return MagicAlertComponent;
1161
1308
  }
1162
- /**
1163
- * Returns component that will replace javascript confirmation box. The component will be used only if showDefaultConfirmations = false
1164
- * @returns component that will replace javascript confirmation box
1165
- */
1166
1309
  getConfirmtionComponent() {
1167
1310
  return MagicConfirmationBoxComponent;
1168
1311
  }
1169
1312
  }
1170
- /** @nocollapse */ ConfirmationComponentsMagicProvider.ɵfac = function ConfirmationComponentsMagicProvider_Factory(t) { return new (t || ConfirmationComponentsMagicProvider)(); };
1171
- /** @nocollapse */ ConfirmationComponentsMagicProvider.ɵprov = ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1172
- /*@__PURE__*/ (function () { ɵsetClassMetadata(ConfirmationComponentsMagicProvider, [{
1313
+ ConfirmationComponentsMagicProvider.ɵfac = function ConfirmationComponentsMagicProvider_Factory(t) { return new (t || ConfirmationComponentsMagicProvider)(); };
1314
+ ConfirmationComponentsMagicProvider.ɵprov = i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1315
+ (function () { i0.ɵsetClassMetadata(ConfirmationComponentsMagicProvider, [{
1173
1316
  type: Injectable
1174
1317
  }], null, null); })();
1175
1318
 
1176
- /**
1177
- * Displays a message-box
1178
- */
1179
1319
  class confirmationBox {
1180
- /**
1181
- * @ignore
1182
- */
1183
1320
  static isConfirmBox(style) {
1184
- // button format mask is in first nibble from right
1185
1321
  let buttonMode = style & 0x0F;
1186
1322
  var isConfirm = (buttonMode === Styles.MSGBOX_BUTTON_OK_CANCEL) ||
1187
1323
  (buttonMode === Styles.MSGBOX_BUTTON_ABORT_RETRY_IGNORE) ||
@@ -1190,14 +1326,7 @@ class confirmationBox {
1190
1326
  (buttonMode === Styles.MSGBOX_BUTTON_RETRY_CANCEL);
1191
1327
  return (isConfirm);
1192
1328
  }
1193
- /**
1194
- * Converts the result from the HTML window to the expected result type
1195
- * @param style Result received from HTML window
1196
- * @param okWasPressed Was the "OK" pressed
1197
- * @returns MessageBox result type
1198
- */
1199
1329
  static convertToExcpectedResultBox(style, okWasPressed) {
1200
- // button format mask is in first nibble from right
1201
1330
  let buttonMode = style & 0x0F;
1202
1331
  let retValue = Styles.MSGBOX_RESULT_OK;
1203
1332
  if (buttonMode === Styles.MSGBOX_BUTTON_OK)
@@ -1214,19 +1343,10 @@ class confirmationBox {
1214
1343
  retValue = okWasPressed ? Styles.MSGBOX_RESULT_RETRY : Styles.MSGBOX_RESULT_CANCEL;
1215
1344
  return retValue;
1216
1345
  }
1217
- /**
1218
- * Show a message box as an HTML window
1219
- * @param title Title of the message box
1220
- * @param message Message that will be display in the message box
1221
- * @param style Style that include buttons \ Icons
1222
- * @returns MessageBox result
1223
- */
1224
1346
  static showConfirmationBox(title, message, style) {
1225
1347
  let okWasPressed = false;
1226
1348
  let retValue = Styles.MSGBOX_RESULT_OK;
1227
- // check if it is confirmation box
1228
1349
  let isConfirm = this.isConfirmBox(style);
1229
- // the title will be added to the string and we will add new line after the title
1230
1350
  let titleAndString = title + '\n' + '\n' + message;
1231
1351
  if (isConfirm)
1232
1352
  okWasPressed = confirm(titleAndString);
@@ -1234,14 +1354,10 @@ class confirmationBox {
1234
1354
  alert(titleAndString);
1235
1355
  okWasPressed = true;
1236
1356
  }
1237
- // return the result from the user
1238
1357
  return okWasPressed;
1239
1358
  }
1240
1359
  }
1241
1360
 
1242
- /**
1243
- * Service managing overlay windows
1244
- */
1245
1361
  class OverlayWindowService {
1246
1362
  constructor(componentFactoryResolver, componentList, engineMagicService, overlayContainerMagicProvider, confirmationComponentsMagicProvider) {
1247
1363
  this.componentFactoryResolver = componentFactoryResolver;
@@ -1256,7 +1372,6 @@ class OverlayWindowService {
1256
1372
  this.overlayWindowFocusManager = new OverlayWindowFocusManager(rootMagicElement);
1257
1373
  }
1258
1374
  open(formName, taskId, taskDescription) {
1259
- // for overlay which are lazy loaded don't find data in component-list
1260
1375
  let comp = this.componentList.lazyLoadModulesMap != null && this.componentList.lazyLoadModulesMap.hasOwnProperty(formName) ? null : this.componentList.getComponent(formName);
1261
1376
  let parameters = { taskIdParam: taskId, taskDescription: taskDescription };
1262
1377
  let componentRef = this.createModalComponent({ MagicFormName: formName, ModalComp: comp, ModalCompParameters: parameters }, this.overlayContainerMagicProvider.getComponent(), OverlayType.Overlay);
@@ -1267,27 +1382,18 @@ class OverlayWindowService {
1267
1382
  });
1268
1383
  }
1269
1384
  close(commandStr) {
1270
- // Close the overlay by removing the overlay window from its container
1271
1385
  this.overlayWindowsContainerViewRef.remove();
1272
1386
  this.overlayWindowFocusManager.popDialog();
1273
1387
  let guiEvent1 = getGuiEventObj("dispose", null, 0);
1274
1388
  guiEvent1.TaskID = commandStr;
1275
1389
  this.engineMagicService.insertEvent(guiEvent1);
1276
1390
  }
1277
- /**
1278
- * Open Confirmation box
1279
- * @param title title of the box
1280
- * @param msg message
1281
- * @param style Magic style
1282
- */
1283
1391
  openConfirmationBox(title, msg, style) {
1284
- //show default confirmations
1285
1392
  if (this.confirmationComponentsMagicProvider.showDefaultConfirmations()) {
1286
1393
  let res = confirmationBox.showConfirmationBox(title, msg, style);
1287
1394
  this.finishConfirmation(style, res);
1288
1395
  }
1289
1396
  else {
1290
- //show custom confirmations
1291
1397
  let comp = confirmationBox.isConfirmBox(style) ? this.confirmationComponentsMagicProvider.getConfirmtionComponent() : this.confirmationComponentsMagicProvider.getAlertComponent();
1292
1398
  let overlayType = confirmationBox.isConfirmBox(style) ? OverlayType.ConfirmationBox : OverlayType.Alert;
1293
1399
  let componentRef = this.createModalComponent({ title: title, message: msg }, comp, overlayType);
@@ -1298,21 +1404,11 @@ class OverlayWindowService {
1298
1404
  });
1299
1405
  }
1300
1406
  }
1301
- /**
1302
- * This method is called on close of the confirmation
1303
- * @param style Magic style
1304
- * @param result
1305
- */
1306
1407
  finishConfirmation(style, result) {
1307
1408
  let guiEvent = getGuiEventObj("confirmationClosed", null, 0);
1308
1409
  guiEvent.keyCode = confirmationBox.convertToExcpectedResultBox(style, result);
1309
1410
  this.engineMagicService.insertEvent(guiEvent);
1310
1411
  }
1311
- /**
1312
- * creates a modal component. Can be used for overlay, message box or confirmation box
1313
- * @param parameters component's parameters
1314
- * @param component components to create
1315
- */
1316
1412
  createModalComponent(parameters, component, overlayType) {
1317
1413
  let componentRef;
1318
1414
  let magicModalContainerParameters = {
@@ -1320,22 +1416,20 @@ class OverlayWindowService {
1320
1416
  Parameters: parameters,
1321
1417
  OverlayTypeParam: overlayType
1322
1418
  };
1323
- // Create the UI component of modal window
1324
1419
  const factory = this.componentFactoryResolver.resolveComponentFactory(MagicOverlayContainerWrapper);
1325
1420
  let viewCRef = this.overlayWindowsContainerViewRef;
1326
1421
  componentRef = viewCRef.createComponent(factory);
1327
- // Set the data to newly created component
1328
1422
  Object.assign(componentRef.instance, magicModalContainerParameters);
1329
1423
  this.overlayWindowFocusManager.pushDialog(componentRef.instance.GetRootElement());
1330
1424
  componentRef.instance.DetectChanges();
1331
1425
  return componentRef;
1332
1426
  }
1333
1427
  }
1334
- /** @nocollapse */ OverlayWindowService.ɵfac = function OverlayWindowService_Factory(t) { return new (t || OverlayWindowService)(ɵɵinject(ComponentFactoryResolver), ɵɵinject(ComponentListMagicService), ɵɵinject(EngineMagicService), ɵɵinject(OverlayContainerMagicProvider), ɵɵinject(ConfirmationComponentsMagicProvider)); };
1335
- /** @nocollapse */ OverlayWindowService.ɵprov = ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac });
1336
- /*@__PURE__*/ (function () { ɵsetClassMetadata(OverlayWindowService, [{
1428
+ OverlayWindowService.ɵfac = function OverlayWindowService_Factory(t) { return new (t || OverlayWindowService)(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayContainerMagicProvider), i0.ɵɵinject(ConfirmationComponentsMagicProvider)); };
1429
+ OverlayWindowService.ɵprov = i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac });
1430
+ (function () { i0.ɵsetClassMetadata(OverlayWindowService, [{
1337
1431
  type: Injectable
1338
- }], function () { return [{ type: ComponentFactoryResolver }, { type: ComponentListMagicService }, { type: EngineMagicService }, { type: OverlayContainerMagicProvider }, { type: ConfirmationComponentsMagicProvider }]; }, null); })();
1432
+ }], function () { return [{ type: i0.ComponentFactoryResolver }, { type: ComponentListMagicService }, { type: EngineMagicService }, { type: OverlayContainerMagicProvider }, { type: ConfirmationComponentsMagicProvider }]; }, null); })();
1339
1433
  class OverlayWindowFocusManager {
1340
1434
  constructor(rootMagicElement) {
1341
1435
  this.rootMagicElement = null;
@@ -1454,95 +1548,37 @@ class DialogInfo {
1454
1548
  }
1455
1549
  }
1456
1550
 
1457
- /**
1458
- * Main service to connect the UI with the Magic WebCLient
1459
- */
1460
1551
  class TaskMagicService {
1461
- /**
1462
- *
1463
- * @param magic
1464
- */
1465
1552
  constructor(magic, overlayWindowService) {
1466
1553
  this.magic = magic;
1467
1554
  this.overlayWindowService = overlayWindowService;
1468
- /**
1469
- * Collection of data for all controls
1470
- */
1471
1555
  this.Records = new Records();
1472
- /**
1473
- * FormGroup collection for line mode
1474
- */
1475
1556
  this.formGroups = [];
1476
- /**
1477
- * @ignore
1478
- */
1479
1557
  this.refreshDom = new Subject();
1480
- /**
1481
- * @ignore
1482
- */
1483
1558
  this.detectChanges = new Subject();
1484
- /**
1485
- * @ignore
1486
- */
1487
1559
  this.interactiveCommands = new Subject();
1488
- /**
1489
- * @ignore
1490
- * This event is emitted when the selected row in a table changes.
1491
- */
1492
1560
  this.OnSelectedRowChanged = new EventEmitter();
1493
- /**
1494
- * @ignore
1495
- */
1496
1561
  this.customPropertiesSubject = new Subject();
1497
- /**
1498
- * @ignore
1499
- */
1500
1562
  this.recordsCountChangeSubject = new Subject();
1501
- /**
1502
- * @ignore
1503
- */
1504
1563
  this.oldPageSize = 0;
1505
1564
  this.Records.setGuiTopIndex(0);
1506
1565
  this.mgInputDateFormat = null;
1507
1566
  }
1508
- /**
1509
- * returns true if used is logged in
1510
- * @returns
1511
- */
1512
1567
  getIsLoggenIn() {
1513
1568
  return this.magic.getIsLoggedIn();
1514
1569
  }
1515
- /**
1516
- * returns the task Id
1517
- * @returns
1518
- */
1519
1570
  get taskId() {
1520
1571
  return this._taskId;
1521
1572
  }
1522
- /**
1523
- * Sets the task Id
1524
- * @param value the task id to set
1525
- */
1526
1573
  set taskId(value) {
1527
- // debugger;
1528
1574
  this._taskId = value;
1529
1575
  }
1530
- /**
1531
- * Returns the task's data in Screen mode
1532
- * @returns
1533
- */
1534
1576
  get ScreenControlsData() {
1535
1577
  return this.Records.list['0'];
1536
1578
  }
1537
- /**
1538
- * @ignore
1539
- */
1540
1579
  settemplate(value) {
1541
1580
  this.template = value;
1542
1581
  }
1543
- /**
1544
- * Builds the FormControl for each and every control
1545
- */
1546
1582
  buildScreenModeControls() {
1547
1583
  const group = new FormGroup({});
1548
1584
  for (const key in this.template) {
@@ -1554,21 +1590,10 @@ class TaskMagicService {
1554
1590
  }
1555
1591
  this.ScreenModeControls = group;
1556
1592
  }
1557
- /**
1558
- * Is the control a table control
1559
- * @param id Id of the control
1560
- * @returns
1561
- */
1562
1593
  isTableControl(id) {
1563
1594
  return this.template[id] == '1';
1564
1595
  }
1565
1596
  getMgInputDateFormat() { return this.mgInputDateFormat; }
1566
- /**
1567
- * Returns the FormControl of a control
1568
- * @param guiRowid Id of the requested row
1569
- * @param id Id of the control
1570
- * @returns
1571
- */
1572
1597
  getFormControl(guiRowid, id) {
1573
1598
  let c;
1574
1599
  let group = this.isTableControl(id) ? this.formGroups[guiRowid] : this.ScreenModeControls;
@@ -1578,21 +1603,12 @@ class TaskMagicService {
1578
1603
  }
1579
1604
  return c;
1580
1605
  }
1581
- /**
1582
- * handle the change of text for input control inside table
1583
- * @param guiRowId Id of the row for which the FormControls are built
1584
- * set the new value of the formcontrol
1585
- */
1586
1606
  setInputTextValue(controlId, guiRowid, val) {
1587
1607
  this.setValue(controlId, guiRowid, this.ConvertValToNative(controlId, 0, val));
1588
1608
  const fc = this.getFormControl(guiRowid, controlId);
1589
1609
  if (!isNullOrUndefined(val))
1590
1610
  fc.setValue(val);
1591
1611
  }
1592
- /**
1593
- * Build the FormControls for a table row
1594
- * @param guiRowId Id of the row for which the FormControls are built
1595
- */
1596
1612
  buildTableRowControls(guiRowId) {
1597
1613
  const group = new FormGroup({});
1598
1614
  for (const key in this.template) {
@@ -1604,58 +1620,30 @@ class TaskMagicService {
1604
1620
  }
1605
1621
  this.formGroups[guiRowId] = group;
1606
1622
  }
1607
- /**
1608
- *
1609
- * @ignore
1610
- */
1611
1623
  updateRecordsBeforeCurrentView(value) {
1612
1624
  this.Records.recordsBeforeCurrentView = value;
1613
1625
  }
1614
- /**
1615
- * @ignore
1616
- */
1617
1626
  setIncludesFirst(value) {
1618
1627
  this.Records.includesFirst = value;
1619
1628
  }
1620
- /**
1621
- * @ignore
1622
- */
1623
1629
  setIncludesLast(value) {
1624
1630
  this.Records.includesLast = value;
1625
1631
  }
1626
- /**
1627
- * @ignore
1628
- */
1629
1632
  markRowAsCreated(guiRowId) {
1630
1633
  this.Records.markRowAsCreated(guiRowId);
1631
1634
  }
1632
- /**
1633
- * @ignore
1634
- */
1635
1635
  markRowAsNotCreated(guiRowId) {
1636
1636
  this.Records.markRowAsNotCreated(guiRowId);
1637
1637
  }
1638
- /**
1639
- * @ignore
1640
- */
1641
1638
  startRowEditing(guiRowId) {
1642
1639
  this.Records.startRowEditing(guiRowId);
1643
1640
  }
1644
- /**
1645
- * @ignore
1646
- */
1647
1641
  stopRowEditing(guiRowId) {
1648
1642
  this.Records.stopRowEditing(guiRowId);
1649
1643
  }
1650
- /**
1651
- * @ignore
1652
- */
1653
1644
  isRowInRowEditing(guiRowId) {
1654
1645
  return this.Records.isRowInRowEditing(guiRowId);
1655
1646
  }
1656
- /**
1657
- * @ignore
1658
- */
1659
1647
  setIsEmptyDataView(isEmpty) {
1660
1648
  if (this.Records.isEmptyDataView !== isEmpty) {
1661
1649
  if (isEmpty)
@@ -1665,11 +1653,6 @@ class TaskMagicService {
1665
1653
  this.refreshView();
1666
1654
  }
1667
1655
  }
1668
- /**
1669
- * Initialize the service to work with the task
1670
- * @param taskId Id of the task
1671
- * @param taskDescription
1672
- */
1673
1656
  initTask(taskId, taskDescription) {
1674
1657
  this.Records.createFirst();
1675
1658
  this.oldPageSize = 0;
@@ -1681,71 +1664,39 @@ class TaskMagicService {
1681
1664
  this.settemplate(taskDescription);
1682
1665
  }
1683
1666
  this.buildScreenModeControls();
1684
- // remove previous subscriptions
1685
1667
  if (!isNullOrUndefined(this.subscribeRefreshDom))
1686
1668
  this.subscribeRefreshDom.unsubscribe();
1687
1669
  if (!isNullOrUndefined(this.subscribeInteractiveCommands))
1688
1670
  this.subscribeInteractiveCommands.unsubscribe();
1689
1671
  this.subscribeRefreshDom = this.magic.refreshDom.pipe(filter(command => command.TaskTag === this.taskId))
1690
1672
  .subscribe(command => {
1691
- // console.log("Task " + command.TaskTag + "command " + command.CommandType);
1692
1673
  this.executeCommand(command);
1693
1674
  });
1694
1675
  this.subscribeInteractiveCommands = this.magic.interactiveCommands
1695
1676
  .pipe(filter(command => command.TaskTag === this.taskId))
1696
1677
  .subscribe(command => {
1697
- // console.log("Task " + command.TaskTag + "command " + command.CommandType);
1698
1678
  this.executeInteractiveCommand(command);
1699
1679
  });
1700
1680
  }
1701
- /**
1702
- * @ignore
1703
- */
1704
1681
  refreshView() {
1705
1682
  this.detectChanges.next('');
1706
1683
  }
1707
- /**
1708
- * Insert an event to the Magic WebClient event queue
1709
- * @param guiEvent The event to insert
1710
- */
1711
1684
  insertEvent(guiEvent) {
1712
1685
  guiEvent.TaskID = this.taskId;
1713
1686
  this.magic.insertEvent(guiEvent);
1714
1687
  }
1715
- /**
1716
- * @ignore
1717
- */
1718
1688
  GetControlPictureMask(controlName) {
1719
1689
  return this.magic.GetControlPictureMask(this.taskId, controlName);
1720
1690
  }
1721
- /**
1722
- * Validates the control value, using the Magic WebClient
1723
- * @param controlName Id of validated control
1724
- * @param value value to be validated
1725
- * @returns If validation fails, returns error message, else returns null
1726
- */
1727
1691
  ValidateControlValue(controlName, value) {
1728
1692
  return this.magic.ValidateControlValue(this.taskId, controlName, value);
1729
1693
  }
1730
- /**
1731
- * @ignore
1732
- */
1733
1694
  GetRangedValue(controlName, value) {
1734
1695
  return this.magic.GetRangedValue(this.taskId, controlName, value);
1735
1696
  }
1736
- /**
1737
- * @ignore
1738
- */
1739
1697
  GetFldRanges(controlName) {
1740
1698
  return this.magic.GetFldRanges(this.taskId, controlName);
1741
1699
  }
1742
- /**
1743
- * returns the value of a property of the control
1744
- * @param controlId Id of control
1745
- * @param prop Property
1746
- * @param guiRowId Row Id, if applicable
1747
- * @returns Property value
1748
- */
1749
1700
  getProperty(controlId, prop, guiRowId) {
1750
1701
  if (isNullOrUndefined(guiRowId))
1751
1702
  guiRowId = '0';
@@ -1759,9 +1710,6 @@ class TaskMagicService {
1759
1710
  return this.Records.list[guiRowId].getProperty(controlId, prop);
1760
1711
  }
1761
1712
  }
1762
- /**
1763
- * @ignore
1764
- */
1765
1713
  getPropertyStub(ControlsProperties, controlId, prop) {
1766
1714
  ControlsProperties = ControlsProperties.ControlsProperties;
1767
1715
  if (controlId in ControlsProperties) {
@@ -1771,31 +1719,15 @@ class TaskMagicService {
1771
1719
  }
1772
1720
  return '';
1773
1721
  }
1774
- /**
1775
- * @ignore
1776
- */
1777
1722
  getStyleStub(ControlsProperties, controlId, styleName) {
1778
1723
  ControlsProperties = ControlsProperties.ControlsProperties;
1779
1724
  return ControlsProperties[controlId].stylesMap.get(styleName);
1780
1725
  }
1781
- /**
1782
- * Return the CSS classes used for this control
1783
- * @param controlId Id of control
1784
- * @param guiRowId Row Id, if applicable
1785
- * @returns String containing the classes currently defined for this control
1786
- */
1787
1726
  getClasses(controlId, guiRowId) {
1788
1727
  if (isNullOrUndefined(guiRowId))
1789
1728
  guiRowId = '0';
1790
1729
  return this.Records.list[guiRowId].getControlMetadata(controlId).classes;
1791
1730
  }
1792
- /**
1793
- * Return the value of a style used for a control
1794
- * @param controlId Id of control
1795
- * @param styleName Name of style
1796
- * @param guiRowId Row Id, if applicable
1797
- * @returns value of style of the control
1798
- */
1799
1731
  getStyle(controlId, styleName, guiRowId) {
1800
1732
  if (isNullOrUndefined(guiRowId))
1801
1733
  guiRowId = '0';
@@ -1806,36 +1738,21 @@ class TaskMagicService {
1806
1738
  return StylesMapManager.magicValueGetStyle(styleName, magicValue);
1807
1739
  }
1808
1740
  }
1809
- /**
1810
- * Return the value of a control
1811
- * @param controlId Id of control
1812
- * @param guiRowId Row Id, if applicable
1813
- * @returns value of the control
1814
- */
1815
1741
  getValue(controlId, guiRowId) {
1816
1742
  if (isNullOrUndefined(guiRowId))
1817
1743
  guiRowId = '0';
1818
1744
  return this.Records.list.length > +guiRowId ? this.Records.list[guiRowId].values[controlId] : '';
1819
1745
  }
1820
- /**
1821
- * Sets the value of a control
1822
- * @param controlId Id of control
1823
- * @param guiRowId Row Id, if applicable
1824
- * @param value Value to set
1825
- */
1746
+ getFormattedValue(controlName, val) {
1747
+ return this.magic.GetFormattedValue(this.taskId, controlName, val);
1748
+ }
1826
1749
  setValue(controlId, guiRowId, value) {
1827
1750
  return this.Records.list[guiRowId].setValue(controlId, value);
1828
1751
  }
1829
- /**
1830
- * @ignore
1831
- */
1832
1752
  executeInteractiveCommand(guiInteractiveCommand) {
1833
1753
  GuiInteractiveExecutor.executeInteractiveCommand(this, guiInteractiveCommand, this.overlayWindowService);
1834
1754
  this.interactiveCommands.next(guiInteractiveCommand);
1835
1755
  }
1836
- /**
1837
- * @ignore
1838
- */
1839
1756
  handleSetProperty(command, isTableChild) {
1840
1757
  let controlId = command.CtrlName;
1841
1758
  let dvRowId = (command.line || 0);
@@ -1872,7 +1789,6 @@ class TaskMagicService {
1872
1789
  let controlId = command.CtrlName;
1873
1790
  let properties;
1874
1791
  let isTableChild = this.isTableControl(controlId);
1875
- // For non-input type controls on table.
1876
1792
  if (command.obj !== null)
1877
1793
  isTableChild = isTableChild || command.obj.IsTableChild;
1878
1794
  guiRowId = this.getGuiRowId(dvRowId, isTableChild);
@@ -1923,13 +1839,13 @@ class TaskMagicService {
1923
1839
  break;
1924
1840
  case CommandType.SET_PROPERTY:
1925
1841
  this.handleSetProperty(command, isTableChild);
1842
+ if (command.Operation == HtmlProperties.ReadOnly)
1843
+ this.refreshDom.next(command);
1926
1844
  break;
1927
1845
  case CommandType.PROP_SET_USER_PROPERTY:
1928
1846
  properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1929
- // if the property has changed, set the property and raise the subject
1930
1847
  if (properties.userProperties.get(command.Operation) !== command.obj1) {
1931
1848
  properties.userProperties.set(command.Operation, command.obj1);
1932
- // the property name is of format <controlName>~<propertyName>
1933
1849
  this.customPropertiesSubject.next({ propertyName: controlId + '~' + command.Operation, value: command.obj1, rowId: guiRowId });
1934
1850
  }
1935
1851
  break;
@@ -1943,6 +1859,7 @@ class TaskMagicService {
1943
1859
  control.setValidators([control.validator, this.customValidator(guiRowId.toString(), controlId)]);
1944
1860
  else
1945
1861
  control.setValidators(this.customValidator(guiRowId.toString(), controlId));
1862
+ control.updateValueAndValidity();
1946
1863
  }
1947
1864
  }
1948
1865
  break;
@@ -1955,7 +1872,7 @@ class TaskMagicService {
1955
1872
  properties.setStyle(command.Operation, command.obj1);
1956
1873
  break;
1957
1874
  case CommandType.SET_ATTRIBUTE:
1958
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1875
+ properties = this.Records.list[0].getControlMetadata(controlId);
1959
1876
  properties.dataType = String.fromCharCode(command.number);
1960
1877
  break;
1961
1878
  case CommandType.SET_VALUE:
@@ -1974,12 +1891,11 @@ class TaskMagicService {
1974
1891
  case CommandType.SET_EMPTY_DATAVIEW:
1975
1892
  this.setIsEmptyDataView(command.Bool1);
1976
1893
  break;
1894
+ case CommandType.SET_FOCUS:
1895
+ this.refreshDom.next(command);
1896
+ break;
1977
1897
  }
1978
- this.refreshDom.next(command);
1979
1898
  }
1980
- /**
1981
- custom validator
1982
- */
1983
1899
  customValidator(rowid, id) {
1984
1900
  return (control) => {
1985
1901
  let controlMetadata;
@@ -1993,13 +1909,6 @@ class TaskMagicService {
1993
1909
  return null;
1994
1910
  };
1995
1911
  }
1996
- /**
1997
- * COnvert a value from Magic format to native format
1998
- * @param controlId Id of control
1999
- * @param rowId Row Id, if applicable
2000
- * @param val Value to convert
2001
- * @returns Converted value
2002
- */
2003
1912
  ConvertValToNative(controlId, rowId, val) {
2004
1913
  let properties;
2005
1914
  properties = this.Records.list[0].getControlMetadata(controlId);
@@ -2048,13 +1957,6 @@ class TaskMagicService {
2048
1957
  return val;
2049
1958
  }
2050
1959
  }
2051
- /**
2052
- * Convert a value from native to Magic format
2053
- * @param controlId Id of control
2054
- * @param rowId Row Id, if applicable
2055
- * @param val Value to convert
2056
- * @returns Converted value
2057
- */
2058
1960
  ConvertValFromNative(controlId, rowId, val) {
2059
1961
  let properties;
2060
1962
  properties = this.Records.list[0].getControlMetadata(controlId);
@@ -2097,22 +1999,12 @@ class TaskMagicService {
2097
1999
  return val;
2098
2000
  }
2099
2001
  }
2100
- /**
2101
- * Handle resize and also fetch chunk of records if having an empty view.
2102
- * @ignore
2103
- * @param pageSize : PageSize
2104
- * @param topGuiRowId : GuiRowId of first record in view.
2105
- */
2106
2002
  resize(pageSize, topGuiRowId) {
2107
2003
  let guiEvent = getGuiEventObj('resize', 'table', 0);
2108
2004
  guiEvent.PageSize = pageSize;
2109
- //As 'getRows' event also gets executed, set the guiEvent.Line parameter.
2110
2005
  guiEvent.Line = topGuiRowId;
2111
2006
  this.insertEvent(guiEvent);
2112
2007
  }
2113
- /**
2114
- * Fetches data for new table rows when scrolling done
2115
- */
2116
2008
  onScrollDown() {
2117
2009
  if (!this.Records.includesLast) {
2118
2010
  let guiEvent = getGuiEventObj('getRows', 'table', 0);
@@ -2120,29 +2012,15 @@ class TaskMagicService {
2120
2012
  this.insertEvent(guiEvent);
2121
2013
  }
2122
2014
  }
2123
- /**
2124
- * Sets the new browser window title
2125
- * @param newTitle New window title
2126
- */
2127
2015
  setTitle(newTitle) {
2128
2016
  this.mgTitleService.setTitle(newTitle);
2129
2017
  }
2130
- /**
2131
- * @ignore
2132
- */
2133
2018
  getGuiRowId(dvRowId, isTableControl) {
2134
2019
  return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
2135
2020
  }
2136
- /**
2137
- *
2138
- * @ignore
2139
- */
2140
2021
  getDvRowId(guiRowId) {
2141
2022
  return (guiRowId - this.Records.recordsBeforeCurrentView);
2142
2023
  }
2143
- /**
2144
- * Clean up the service when it is no longer needed
2145
- */
2146
2024
  dispose() {
2147
2025
  this.refreshDom.complete();
2148
2026
  this.detectChanges.complete();
@@ -2152,14 +2030,6 @@ class TaskMagicService {
2152
2030
  this.customPropertiesSubject.complete();
2153
2031
  this.OnSelectedRowChanged.complete();
2154
2032
  }
2155
- ///////////////////////////////
2156
- //Events:
2157
- /**
2158
- * Handle the Combobox "change" event
2159
- * @param event The event received from the UI
2160
- * @param idx Id of the control raising the event
2161
- * @param line Row Id, if applicable
2162
- */
2163
2033
  onComboboxSelectionChanged(event, idx, line) {
2164
2034
  let guiEvent = getGuiEventObj('selectionchanged', idx, line);
2165
2035
  if (typeof (event) == 'number') {
@@ -2167,467 +2037,136 @@ class TaskMagicService {
2167
2037
  }
2168
2038
  else {
2169
2039
  if (!isNullOrUndefined(event.target)) {
2170
- let indexes = new Array(event.target.selectedOptions.length);
2171
- for (let i = 0; i < event.target.selectedOptions.length; i++) {
2172
- indexes[i] = event.target.selectedOptions[i].index;
2173
- }
2174
- guiEvent.Value = indexes.join(',');
2175
- }
2176
- else
2177
- guiEvent.Value = event.value;
2178
- }
2179
- this.insertEvent(guiEvent);
2180
- }
2181
- /**
2182
- * Handle the Listbox "change" event
2183
- * @param event The event received from the UI
2184
- * @param idx Id of the control raising the event
2185
- */
2186
- onListBoxSelectionChanged(event, idx) {
2187
- let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2188
- let selectedOptions;
2189
- if (!isNullOrUndefined(event.target))
2190
- selectedOptions = event.target.selectedOptions;
2191
- else
2192
- selectedOptions = event.source.selectedOptions.selected;
2193
- let length = selectedOptions.length;
2194
- let indexes = new Array(length);
2195
- for (let i = 0; i < length; i++) {
2196
- if (!isNullOrUndefined(event.target))
2197
- indexes[i] = (selectedOptions[i]).index;
2198
- else
2199
- indexes[i] = (selectedOptions[i]).value;
2200
- }
2201
- guiEvent.Value = indexes; // TODO: fix
2202
- this.insertEvent(guiEvent);
2203
- }
2204
- /**
2205
- * Handle the Checkbox "change" event
2206
- * @param event The event received from the UI
2207
- * @param idx Id of the control raising the event
2208
- * @param rowId Row Id, if applicable
2209
- */
2210
- onCheckChanged(event, idx, rowId) {
2211
- if (typeof rowId === 'undefined')
2212
- rowId = 0;
2213
- let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
2214
- if (typeof (event) == 'boolean') {
2215
- guiEvent.Value = event;
2216
- }
2217
- else {
2218
- if (typeof event.target === 'undefined')
2219
- guiEvent.Value = (event).checked;
2220
- else
2221
- guiEvent.Value = (event.target).checked;
2222
- }
2223
- this.insertEvent(guiEvent);
2224
- }
2225
- /**
2226
- * Handle tab selection change, caused by UI events
2227
- * @param idx Id of the control raising the event
2228
- * @param layer Id of selected tabpage
2229
- */
2230
- mgOnTabSelectionChanged(idx, layer) {
2231
- let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2232
- guiEvent.Value = layer.toString();
2233
- this.insertEvent(guiEvent);
2234
- }
2235
- /**
2236
- * Handle the Radio button "change" event
2237
- * @param event The event received from the UI
2238
- * @param idx Id of the control raising the event
2239
- */
2240
- mgOnRadioSelectionChanged(event, idx) {
2241
- let result = this.getFormControl('0', idx);
2242
- let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2243
- if (typeof result.value !== 'string')
2244
- guiEvent.Value = result.value.index;
2245
- else
2246
- guiEvent.Value = result.value;
2247
- this.insertEvent(guiEvent);
2248
- }
2249
- /**
2250
- * Inserts the "close" event to the magic WebClient event queue
2251
- */
2252
- close() {
2253
- this.insertEvent(getGuiEventObj('close', null, 0));
2254
- }
2255
- ///////////////////////////////
2256
- /**
2257
- * @ignore
2258
- */
2259
- IsStub() {
2260
- return this.magic.isStub;
2261
- }
2262
- /**
2263
- * @ignore
2264
- */
2265
- saveData(data) {
2266
- this.magic.saveData(data);
2267
- }
2268
- /**
2269
- * @ignore
2270
- */
2271
- createData() {
2272
- let myData = {
2273
- records: this.Records,
2274
- template: this.template
2275
- };
2276
- let text = 'loadData():any {\n' +
2277
- ' let stubData = ' + JSON.stringify(myData) + ';\n' +
2278
- ' this.loadStubData(stubData);}';
2279
- console.log(text);
2280
- this.saveData(text);
2281
- }
2282
- /**
2283
- * @ignore
2284
- */
2285
- loadStubData(stubData) {
2286
- this.Records = stubData.records;
2287
- this.settemplate(stubData.template);
2288
- this.taskId = '1';
2289
- for (let i = 0; i < this.Records.list.length; i++)
2290
- this.buildTableRowControls(i);
2291
- }
2292
- /**
2293
- * @ignore
2294
- */
2295
- loadData() {
2296
- alert('Please, overwrite method loadData');
2297
- }
2298
- /**
2299
- * @ignore
2300
- */
2301
- setStubValue(guiRowId, fc, name) {
2302
- if (this.IsStub()) {
2303
- try {
2304
- let val = this.Records.list[guiRowId].values[name];
2305
- fc.setValue(val);
2306
- }
2307
- catch (e) {
2308
- }
2309
- }
2310
- }
2311
- }
2312
- /** @nocollapse */ TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(ɵɵinject(EngineMagicService), ɵɵinject(OverlayWindowService)); };
2313
- /** @nocollapse */ TaskMagicService.ɵprov = ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
2314
- /*@__PURE__*/ (function () { ɵsetClassMetadata(TaskMagicService, [{
2315
- type: Injectable
2316
- }], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null); })();
2317
-
2318
- /**
2319
- * @ignore
2320
- */
2321
- class CommandsCollectorMagicService {
2322
- constructor(magic) {
2323
- this.magic = magic;
2324
- this.count = 0;
2325
- this.commands = new List();
2326
- this.subscription = null;
2327
- }
2328
- startCollecting() {
2329
- this.count++;
2330
- Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.startCollecting() --- " + this.count);
2331
- if (this.subscription === null) {
2332
- this.subscription = this.magic.refreshDom
2333
- .subscribe(command => {
2334
- this.commands.push(command);
2335
- });
2336
- }
2337
- }
2338
- stopCollecting() {
2339
- this.count--;
2340
- Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.stopCollecting() --- " + this.count);
2341
- if (this.count === 0) {
2342
- this.subscription.unsubscribe();
2343
- this.subscription = null;
2344
- }
2345
- }
2346
- GetCommands(taskId) {
2347
- const commands = this.commands.filter((command) => command.TaskTag === taskId);
2348
- commands.forEach(command => { this.commands.Remove(command); });
2349
- return commands;
2350
- }
2351
- }
2352
- /** @nocollapse */ CommandsCollectorMagicService.ɵfac = function CommandsCollectorMagicService_Factory(t) { return new (t || CommandsCollectorMagicService)(ɵɵinject(EngineMagicService)); };
2353
- /** @nocollapse */ CommandsCollectorMagicService.ɵprov = ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac });
2354
- /*@__PURE__*/ (function () { ɵsetClassMetadata(CommandsCollectorMagicService, [{
2355
- type: Injectable
2356
- }], function () { return [{ type: EngineMagicService }]; }, null); })();
2357
-
2358
- /**
2359
- * @ignore
2360
- */
2361
- class RouteCommand {
2362
- }
2363
- /**
2364
- * @ignore
2365
- */
2366
- class RouterCommandsMagicService {
2367
- constructor() {
2368
- this.pendingRouteCommands = [];
2369
- }
2370
- AddRouteCommand(routeCommand) {
2371
- this.pendingRouteCommands.push(routeCommand);
2372
- }
2373
- ExecuteNextCommand() {
2374
- let pendingRouteCommand = this.pendingRouteCommands.shift();
2375
- if (!isNullOrUndefined(pendingRouteCommand)) {
2376
- pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
2377
- }
2378
- }
2379
- }
2380
- /** @nocollapse */ RouterCommandsMagicService.ɵfac = function RouterCommandsMagicService_Factory(t) { return new (t || RouterCommandsMagicService)(); };
2381
- /** @nocollapse */ RouterCommandsMagicService.ɵprov = ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac });
2382
- /*@__PURE__*/ (function () { ɵsetClassMetadata(RouterCommandsMagicService, [{
2383
- type: Injectable
2384
- }], null, null); })();
2385
-
2386
- /**
2387
- * Service for managing subforms and routing
2388
- */
2389
- class SubformMagicService {
2390
- constructor(task, activatedRoute, componentList, pendingCommandsCollector, router, routerCommandsMagicService) {
2391
- this.task = task;
2392
- this.activatedRoute = activatedRoute;
2393
- this.componentList = componentList;
2394
- this.pendingCommandsCollector = pendingCommandsCollector;
2395
- this.router = router;
2396
- this.routerCommandsMagicService = routerCommandsMagicService;
2397
- this.subformsDict /*:{ [x: string]: SubformDefinition }*/ = {};
2398
- this.routesDict = {}; // dictionary of router outlet to router path
2399
- this.currentRouteDefinition = null;
2400
- }
2401
- /**
2402
- * Finds and returns the component according to the subform name
2403
- * @param subformName
2404
- * @returns
2405
- */
2406
- mgGetComp(subformName) {
2407
- if (subformName in this.subformsDict) {
2408
- let formName = this.subformsDict[subformName].formName;
2409
- if (formName)
2410
- return this.componentList.getComponent(formName);
2411
- }
2412
- return null;
2413
- }
2414
- /**
2415
- * Returns the parameters of the subform
2416
- * @param subformName
2417
- * @returns
2418
- */
2419
- mgGetParameters(subformName) {
2420
- if (subformName in this.subformsDict) {
2421
- return this.subformsDict[subformName].parameters;
2422
- }
2423
- else
2424
- return "";
2425
- }
2426
- /**
2427
- * @ignore
2428
- */
2429
- deleteSubformComp(subformControlName, formName) {
2430
- if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
2431
- if (this.subformsDict[subformControlName].formName === formName) {
2432
- this.subformsDict[subformControlName] = {};
2433
- this.task.refreshView();
2434
- }
2435
- }
2436
- }
2437
- /**
2438
- * @ignore
2439
- */
2440
- addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
2441
- this.pendingCommandsCollector.startCollecting();
2442
- let refreshNeeded = false;
2443
- if (isNullOrUndefined(routerPath)) { // call in destination subform
2444
- if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
2445
- if (this.subformsDict[subformControlName].formName === formName) {
2446
- this.subformsDict[subformControlName] = {};
2447
- this.task.refreshView();
2448
- }
2449
- }
2450
- this.subformsDict[subformControlName] = {
2451
- formName,
2452
- parameters: { taskIdParam: taskId, taskDescription: taskDescription }
2453
- };
2454
- //this.ref.detectChanges();
2455
- refreshNeeded = true;
2456
- }
2457
- else { // call route
2458
- if (inDefaultOutlet)
2459
- subformControlName = "primary";
2460
- let routeParams = new List();
2461
- routeParams.push(routerPath);
2462
- if (params !== null) {
2463
- routeParams = routeParams.concat(params);
2040
+ let indexes = new Array(event.target.selectedOptions.length);
2041
+ for (let i = 0; i < event.target.selectedOptions.length; i++) {
2042
+ indexes[i] = event.target.selectedOptions[i].index;
2043
+ }
2044
+ guiEvent.Value = indexes.join(',');
2464
2045
  }
2465
- let routeCommand = {
2466
- callerMgSubformServiceRef: this,
2467
- routerOutletName: subformControlName,
2468
- formName: formName,
2469
- parameters: { taskIdParam: taskId, taskDescription: taskDescription },
2470
- routeParams: routeParams
2471
- };
2472
- // If SubformMagicService.currentCallerMgSubformServiceRef !== null means that router.navigate() is already
2473
- // called once, but angular has not yet executed it (ngOnInit of the new component is not called).
2474
- // In such a case, do not executed router.navigate() again. Because, angular ignores the previous one.
2475
- // So, put a command in the queue which will be executed after the first one is executed.
2476
- if (SubformMagicService.currentCallerMgSubformServiceRef === null)
2477
- this.ExecuteRouteCommand(routeCommand);
2478
2046
  else
2479
- this.routerCommandsMagicService.AddRouteCommand(routeCommand);
2047
+ guiEvent.Value = event.value;
2480
2048
  }
2481
- if (refreshNeeded)
2482
- this.task.refreshView();
2049
+ this.insertEvent(guiEvent);
2483
2050
  }
2484
- /**
2485
- * Open the subform using a route command
2486
- */
2487
- ExecuteRouteCommand(routeCommand) {
2488
- let reusingComponent = false;
2489
- let currentSubformMagicService = routeCommand.callerMgSubformServiceRef;
2490
- let relativeRoute = SubformMagicService.getRelativeRoute(currentSubformMagicService.activatedRoute);
2491
- if (currentSubformMagicService.routesDict[routeCommand.routerOutletName] === routeCommand.routeParams[0]) {
2492
- // If the specified router outlet already hosts the same router path, router.navigate() doesn't actually navigate.
2493
- // So, first clear the outlet (passing null route params, clears the outlet) and then navigate again.
2494
- currentSubformMagicService.router.navigate([{ outlets: { [routeCommand.routerOutletName]: null } }], { relativeTo: relativeRoute })
2495
- .then((result) => {
2496
- SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
2497
- currentSubformMagicService.currentRouteDefinition = {
2498
- formName: routeCommand.formName,
2499
- parameters: routeCommand.parameters
2500
- };
2501
- currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
2502
- });
2051
+ onListBoxSelectionChanged(event, idx) {
2052
+ let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2053
+ let selectedOptions;
2054
+ if (!isNullOrUndefined(event.target))
2055
+ selectedOptions = event.target.selectedOptions;
2056
+ else
2057
+ selectedOptions = event.source.selectedOptions.selected;
2058
+ let length = selectedOptions.length;
2059
+ let indexes = new Array(length);
2060
+ for (let i = 0; i < length; i++) {
2061
+ if (!isNullOrUndefined(event.target))
2062
+ indexes[i] = (selectedOptions[i]).index;
2063
+ else
2064
+ indexes[i] = (selectedOptions[i]).value;
2065
+ }
2066
+ guiEvent.Value = indexes;
2067
+ this.insertEvent(guiEvent);
2068
+ }
2069
+ onCheckChanged(event, idx, rowId) {
2070
+ if (typeof rowId === 'undefined')
2071
+ rowId = 0;
2072
+ let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
2073
+ if (typeof (event) == 'boolean') {
2074
+ guiEvent.Value = event;
2503
2075
  }
2504
2076
  else {
2505
- SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
2506
- currentSubformMagicService.currentRouteDefinition = {
2507
- formName: routeCommand.formName,
2508
- parameters: routeCommand.parameters
2509
- };
2510
- if (SubformMagicService.routerContainers.length > 0) {
2511
- let routeContainer = SubformMagicService.routerContainers[0];
2512
- SubformMagicService.routerContainers.shift();
2513
- routeContainer.initializeComponent();
2514
- }
2515
- else {
2516
- currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
2517
- }
2077
+ if (typeof event.target === 'undefined')
2078
+ guiEvent.Value = (event).checked;
2079
+ else
2080
+ guiEvent.Value = (event.target).checked;
2518
2081
  }
2082
+ this.insertEvent(guiEvent);
2519
2083
  }
2520
- PerformRouterNavigate(routerOutletName, routeParams) {
2521
- let relativeRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
2522
- this.router.navigate([{ outlets: { [routerOutletName]: routeParams } }], { relativeTo: relativeRoute })
2523
- .then((result) => {
2524
- if (result !== null && !result) {
2525
- let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
2526
- subformMagicService.currentRouteDefinition = null;
2527
- SubformMagicService.currentCallerMgSubformServiceRef = null;
2528
- subformMagicService.pendingCommandsCollector.stopCollecting();
2529
- subformMagicService.routerCommandsMagicService.ExecuteNextCommand();
2530
- }
2531
- });
2084
+ mgOnTabSelectionChanged(idx, layer) {
2085
+ let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2086
+ guiEvent.Value = layer.toString();
2087
+ this.insertEvent(guiEvent);
2532
2088
  }
2533
- /**
2534
- * @ignore
2535
- */
2536
- init() {
2537
- // If commands were issued for this task before ngOnInit(), they were not executed because task had not registered for them.
2538
- // So, execute them now.
2539
- const pendingCommands = this.pendingCommandsCollector.GetCommands(this.task.taskId);
2540
- if (pendingCommands.length > 0) {
2541
- pendingCommands.forEach(command => { this.task.executeCommand(command); });
2542
- this.task.refreshView();
2543
- }
2544
- this.pendingCommandsCollector.stopCollecting();
2089
+ mgOnRadioSelectionChanged(event, idx) {
2090
+ let result = this.getFormControl('0', idx);
2091
+ let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2092
+ if (typeof result.value !== 'string')
2093
+ guiEvent.Value = result.value.index;
2094
+ else
2095
+ guiEvent.Value = result.value;
2096
+ this.insertEvent(guiEvent);
2545
2097
  }
2546
- /**
2547
- * @ignore
2548
- */
2549
- refreshView() {
2550
- this.task.refreshView();
2098
+ close() {
2099
+ this.insertEvent(getGuiEventObj('close', null, 0));
2551
2100
  }
2552
- ///
2553
- // return the relative route
2554
- //
2555
- static getRelativeRoute(sendActivatedRoute) {
2556
- let currentActiveRoute = sendActivatedRoute;
2557
- if (currentActiveRoute.snapshot.routeConfig !== null && currentActiveRoute.snapshot.routeConfig.path === '') {
2558
- currentActiveRoute = currentActiveRoute.parent;
2559
- if (!currentActiveRoute.snapshot.routeConfig.loadChildren)
2560
- console.log("getRelativeRoute(): both path and currentActiveRoute.snapshot.routeConfig.loadChildren are empty.");
2101
+ IsStub() {
2102
+ return this.magic.isStub;
2103
+ }
2104
+ saveData(data) {
2105
+ this.magic.saveData(data);
2106
+ }
2107
+ createData() {
2108
+ let myData = {
2109
+ records: this.Records,
2110
+ template: this.template
2111
+ };
2112
+ let text = 'loadData():any {\n' +
2113
+ ' let stubData = ' + JSON.stringify(myData) + ';\n' +
2114
+ ' this.loadStubData(stubData);}';
2115
+ console.log(text);
2116
+ this.saveData(text);
2117
+ }
2118
+ loadStubData(stubData) {
2119
+ this.Records = stubData.records;
2120
+ this.settemplate(stubData.template);
2121
+ this.taskId = '1';
2122
+ for (let i = 0; i < this.Records.list.length; i++)
2123
+ this.buildTableRowControls(i);
2124
+ }
2125
+ loadData() {
2126
+ alert('Please, overwrite method loadData');
2127
+ }
2128
+ setStubValue(guiRowId, fc, name) {
2129
+ if (this.IsStub()) {
2130
+ try {
2131
+ let val = this.Records.list[guiRowId].values[name];
2132
+ fc.setValue(val);
2133
+ }
2134
+ catch (e) {
2135
+ }
2561
2136
  }
2562
- return currentActiveRoute;
2563
2137
  }
2564
2138
  }
2565
- SubformMagicService.currentCallerMgSubformServiceRef = null;
2566
- SubformMagicService.routerContainers = new Array();
2567
- /** @nocollapse */ SubformMagicService.ɵfac = function SubformMagicService_Factory(t) { return new (t || SubformMagicService)(ɵɵinject(TaskMagicService), ɵɵinject(ActivatedRoute), ɵɵinject(ComponentListMagicService), ɵɵinject(CommandsCollectorMagicService), ɵɵinject(Router), ɵɵinject(RouterCommandsMagicService)); };
2568
- /** @nocollapse */ SubformMagicService.ɵprov = ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
2569
- /*@__PURE__*/ (function () { ɵsetClassMetadata(SubformMagicService, [{
2139
+ TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayWindowService)); };
2140
+ TaskMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
2141
+ (function () { i0.ɵsetClassMetadata(TaskMagicService, [{
2570
2142
  type: Injectable
2571
- }], function () { return [{ type: TaskMagicService }, { type: ActivatedRoute }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: Router }, { type: RouterCommandsMagicService }]; }, null); })();
2143
+ }], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null); })();
2572
2144
 
2573
- /**
2574
- * Implements various table-related functionalities
2575
- */
2576
2145
  class TableMagicService {
2577
- /**
2578
- *
2579
- * @param componentList Component-mapping service
2580
- * @param task Magic task service
2581
- */
2582
2146
  constructor(componentList, task) {
2583
2147
  this.componentList = componentList;
2584
2148
  this.task = task;
2585
2149
  this.shouldOpenFieldTextEditor = true;
2586
2150
  }
2587
- /**
2588
- * Refreshes the DataSource
2589
- */
2590
2151
  refreshDataSource() {
2591
2152
  }
2592
- /**
2593
- * Returns the table page size
2594
- */
2595
2153
  getPageSize() {
2596
2154
  return 10;
2597
2155
  }
2598
- /**
2599
- * Returns max no of rows in the table.
2600
- */
2601
2156
  getMaxRowsInTable() {
2602
2157
  return this.task.Records.list.length;
2603
2158
  }
2604
- /**
2605
- * Selects the specified row
2606
- * @param rowId The row to select
2607
- */
2608
2159
  selectRow(rowId) {
2609
2160
  this.selectedItem = rowId;
2610
2161
  }
2611
2162
  getSelectedRow() {
2612
2163
  return this.selectedItem;
2613
2164
  }
2614
- /**
2615
- * Returns the selected row
2616
- */
2617
2165
  selectedRow() {
2618
2166
  return null;
2619
2167
  }
2620
- /**
2621
- * Selects the specified page
2622
- * @param pageId The page to select
2623
- */
2624
2168
  selectPage(pageId) {
2625
2169
  }
2626
- /**
2627
- * Returns whether a dialog should be opened for the HTML element
2628
- * @param element The HTML element for which a dialog may be needed
2629
- * @returns
2630
- */
2631
2170
  OpenDialogForControl(element) {
2632
2171
  if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
2633
2172
  element.tagName === "INPUT" ||
@@ -2635,34 +2174,17 @@ class TableMagicService {
2635
2174
  return false;
2636
2175
  return true;
2637
2176
  }
2638
- /**
2639
- * Returns the dialog used to edit values
2640
- */
2641
2177
  getDialog() {
2642
2178
  return null;
2643
2179
  }
2644
- /**
2645
- * Handles the table "scrolled" event
2646
- */
2647
2180
  onScrollDown() {
2648
2181
  this.task.onScrollDown();
2649
2182
  }
2650
- /**
2651
- * To be overwitten in specific implelemtations
2652
- */
2653
2183
  sortData(e) { }
2654
- /**
2655
- * To be overwitten in specific implelemtations
2656
- */
2657
2184
  mgOnPaginateChange(e) { }
2658
2185
  mgOptionChanged(e) { }
2659
- /**
2660
- * Change the number of lines in a table
2661
- * @param size New number of lines in table
2662
- */
2663
2186
  updateTableSize(size) {
2664
- if (size === 0) // never remove row 0 for now
2665
- {
2187
+ if (size === 0) {
2666
2188
  size = 1;
2667
2189
  this.task.Records.clearFirstTableRecord(this.task.template);
2668
2190
  }
@@ -2670,17 +2192,11 @@ class TableMagicService {
2670
2192
  this.task.Records.updateSize(size);
2671
2193
  this.task.setIncludesFirst(false);
2672
2194
  }
2673
- /**
2674
- * @ignore
2675
- */
2676
2195
  setTableTopIndex(value) {
2677
2196
  if (!this.task.Records.includesFirst)
2678
2197
  value++;
2679
2198
  this.task.Records.setGuiTopIndex(value);
2680
2199
  }
2681
- /**
2682
- * @ignore
2683
- */
2684
2200
  getTableTopIndex() {
2685
2201
  let topIndex = this.task.Records.getGuiTopIndex();
2686
2202
  if (!this.task.Records.includesFirst)
@@ -2688,55 +2204,32 @@ class TableMagicService {
2688
2204
  return topIndex;
2689
2205
  }
2690
2206
  }
2691
- /** @nocollapse */ TableMagicService.ɵfac = function TableMagicService_Factory(t) { return new (t || TableMagicService)(ɵɵinject(ComponentListMagicService), ɵɵinject(TaskMagicService)); };
2692
- /** @nocollapse */ TableMagicService.ɵprov = ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
2693
- /*@__PURE__*/ (function () { ɵsetClassMetadata(TableMagicService, [{
2207
+ TableMagicService.ɵfac = function TableMagicService_Factory(t) { return new (t || TableMagicService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(TaskMagicService)); };
2208
+ TableMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
2209
+ (function () { i0.ɵsetClassMetadata(TableMagicService, [{
2694
2210
  type: Injectable
2695
2211
  }], function () { return [{ type: ComponentListMagicService }, { type: TaskMagicService }]; }, null); })();
2696
2212
 
2697
- /**
2698
- * Enables changing the browser title using Magic expression (SetTitle)
2699
- */
2700
2213
  class TitleMagicService {
2701
- /**
2702
- *
2703
- * @param titleService Angular's title-changing class
2704
- */
2705
2214
  constructor(titleService) {
2706
2215
  this.titleService = titleService;
2707
2216
  }
2708
- /**
2709
- * Set the new title of the window
2710
- * @param newTitle New title of the window
2711
- */
2712
2217
  setTitle(newTitle) {
2713
2218
  this.titleService.setTitle(newTitle);
2714
2219
  }
2715
2220
  }
2716
- /** @nocollapse */ TitleMagicService.ɵfac = function TitleMagicService_Factory(t) { return new (t || TitleMagicService)(ɵɵinject(Title)); };
2717
- /** @nocollapse */ TitleMagicService.ɵprov = ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
2718
- /*@__PURE__*/ (function () { ɵsetClassMetadata(TitleMagicService, [{
2221
+ TitleMagicService.ɵfac = function TitleMagicService_Factory(t) { return new (t || TitleMagicService)(i0.ɵɵinject(i1$1.Title)); };
2222
+ TitleMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
2223
+ (function () { i0.ɵsetClassMetadata(TitleMagicService, [{
2719
2224
  type: Injectable
2720
- }], function () { return [{ type: Title }]; }, null); })();
2225
+ }], function () { return [{ type: i1$1.Title }]; }, null); })();
2721
2226
 
2722
- /**
2723
- * Provides the UI with values calculated by the Magic WebClient
2724
- */
2725
2227
  class AccessorMagicService {
2726
- /**
2727
- * @ignore
2728
- */
2729
2228
  constructor(task) {
2730
2229
  this.task = task;
2731
2230
  this.Logger = null;
2732
2231
  this.Logger = Logger.Instance;
2733
2232
  }
2734
- /**
2735
- * Checks if the control is read-only
2736
- * @param controlId Id of control
2737
- * @returns Is the control not read-only
2738
- */
2739
- // CheckReadOnly
2740
2233
  checkIsReadOnly(controlId) {
2741
2234
  let properties;
2742
2235
  properties = this.task.Records.list[0].getControlMetadata(controlId);
@@ -2745,99 +2238,45 @@ class AccessorMagicService {
2745
2238
  else
2746
2239
  return true;
2747
2240
  }
2748
- /**
2749
- * Returns the text of the control
2750
- * @param controlId Id of control
2751
- * @param rowId Id of row, if applicable
2752
- * @returns The text of the control
2753
- */
2754
- // mgGetText
2755
2241
  getText(controlId, rowId) {
2756
2242
  return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
2757
2243
  }
2758
- /**
2759
- * Gets the text of the tab page
2760
- * @param controlId Id of control
2761
- * @param layer Id of tabpage
2762
- * @returns Text of tabpage
2763
- */
2764
- // mgGetTabpageText
2765
2244
  getTabpageText(controlId, layer) {
2766
2245
  const items = this.task.getProperty(controlId, HtmlProperties.ItemsList);
2767
2246
  if (typeof items !== "undefined")
2768
2247
  return items[layer].displayValue;
2769
2248
  return "";
2770
2249
  }
2771
- /**
2772
- * Gets the image defined for the control
2773
- * @param controlId Id of control
2774
- * @param rowId Id of row, if applicable
2775
- * @returns Image set on control
2776
- */
2777
- // mgGetImage
2778
2250
  getImage(controlId, rowId) {
2779
2251
  let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2780
2252
  return result;
2781
2253
  }
2782
- /**
2783
- * Returns whether an image is set for this control
2784
- * @param controlId Id of control
2785
- * @param rowId Id of row, if applicable
2786
- * @returns returns true if control has an image set on it
2787
- */
2788
- // mgIsImageExists
2789
2254
  isImageExists(controlId, rowId) {
2790
2255
  let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2791
2256
  return !isNullOrUndefined(result);
2792
2257
  }
2793
- /**
2794
- * Gets the CSS classes set on the control
2795
- * @param controlId Id of control
2796
- * @param rowId Id of row, if applicable
2797
- * @returns The classes for this control
2798
- */
2799
- // mgGetClasses
2800
2258
  getClasses(controlId, rowId) {
2801
2259
  return this.task.getClasses(controlId, rowId);
2802
2260
  }
2803
- /**
2804
- * Gets the CSS styles set on the control
2805
- * @param controlId Id of control
2806
- * @param styleName NAme of style requested
2807
- * @param rowId Id of row, if applicable
2808
- * @returns The style set on the control
2809
- */
2810
- // mgGetStyle
2811
2261
  getStyle(controlId, styleName, rowId) {
2812
2262
  let style = this.task.getStyle(controlId, styleName, rowId);
2813
2263
  return style;
2814
2264
  }
2815
- /**
2816
- * Returns whether a control is visible or not
2817
- * @param controlId Id of control
2818
- * @param rowId Id of row, if applicable
2819
- * @returns Is the control visible or hidden
2820
- */
2821
- // mgGetVisible
2822
2265
  getVisible(controlId, rowId) {
2823
2266
  let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
2824
2267
  return vis ? 'visible' : 'hidden';
2825
2268
  }
2826
- /**
2827
- * Returns object representing numeric picture
2828
- * @param picture string which is defined in magic
2829
- * @returns object representing numeric picture
2830
- */
2831
- // mgGetNumericPicture
2832
2269
  getNumericPicture(picture) {
2833
2270
  if (isNullOrUndefined(picture))
2834
2271
  return null;
2835
2272
  let pic = new PIC(picture, StorageAttribute.NUMERIC, 0);
2836
2273
  var obj = {};
2837
- if (pic.getPosPref_().length > 0)
2838
- obj['prefix'] = pic.getPosPref_();
2839
- else
2840
- obj['prefix'] = "";
2274
+ obj['prefix'] = "";
2275
+ if (pic.getPosPref_().length > 0 && pic.getNegPref_().length > 0) {
2276
+ let pref = '-' + pic.getPosPref_();
2277
+ if (pref == pic.getNegPref_())
2278
+ obj['prefix'] = pic.getPosPref_();
2279
+ }
2841
2280
  if (pic.getPosSuff_().length > 0)
2842
2281
  obj['suffix'] = pic.getPosSuff_();
2843
2282
  else
@@ -2859,118 +2298,51 @@ class AccessorMagicService {
2859
2298
  obj['wholes'] = pic.getWholes();
2860
2299
  return obj;
2861
2300
  }
2862
- /**
2863
- * Returns whether a control should have the "required" attribute set on it
2864
- * @param controlId Id of control
2865
- * @param rowId Id of row, if applicable
2866
- * @returns
2867
- */
2868
- // mgGetMustInput
2869
2301
  getMustInput(controlId, rowId) {
2870
2302
  let vis = this.getProperty(controlId, HtmlProperties.MustInput, rowId);
2871
2303
  return vis ? 'true' : 'false';
2872
2304
  }
2873
- /**
2874
- * Returns whether a control is disabled
2875
- * @param controlId Id of control
2876
- * @param rowId Id of row, if applicable
2877
- * @returns
2878
- */
2879
- // mgIsDisabled
2880
2305
  isDisabled(controlId, rowId) {
2881
2306
  let result = this.getProperty(controlId, HtmlProperties.Enabled, rowId);
2882
2307
  return result === true ? null : true;
2883
2308
  }
2884
- /**
2885
- * @ignore
2886
- */
2887
- // getProperty (not changed)
2888
2309
  getProperty(controlId, prop, rowId) {
2889
2310
  return this.task.getProperty(controlId, prop, rowId);
2890
2311
  }
2891
- /**
2892
- * Returns the title (tooltip) text of the control
2893
- * @param controlId Id of control
2894
- * @param rowId Id of row, if applicable
2895
- * @returns
2896
- */
2897
- // mgGetTitle
2898
2312
  getTitle(controlId, rowId) {
2899
2313
  return this.task.getProperty(controlId, HtmlProperties.Tooltip, rowId);
2900
2314
  }
2901
- /**
2902
- * Gets the selection control's selected value
2903
- * @param controlId Id of control
2904
- * @param rowId Id of row, if applicable
2905
- * @returns
2906
- */
2907
- // getSelectedValue
2315
+ getZoomButtonTitle(controlId, rowId) {
2316
+ return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
2317
+ }
2908
2318
  getSelectedValue(controlId, rowId) {
2909
2319
  return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
2910
2320
  }
2911
- /**
2912
- * Gets the place-holder text of the control
2913
- * @param controlId Id of control
2914
- * @param rowId Id of row, if applicable
2915
- * @returns
2916
- */
2917
- // mgGetPlaceholder
2918
2321
  getPlaceholder(controlId, rowId) {
2919
2322
  return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
2920
2323
  }
2921
- /**
2922
- * Returns a type for input controls - should the control be a simple text or a password control
2923
- * @param controlId Id of control
2924
- * @param rowId Id of row, if applicable
2925
- * @returns
2926
- */
2927
- // mgGetType
2928
2324
  getType(controlId, rowId) {
2929
2325
  let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
2930
2326
  return result ? "password" : "text";
2931
2327
  }
2932
- /**
2933
- * Returns the tab-index of the control
2934
- * @param controlId Id of control
2935
- * @param rowId Id of row, if applicable
2936
- * @returns
2937
- */
2938
- // mgGetTabIndex
2939
2328
  getTabIndex(controlId, rowId) {
2940
2329
  return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
2941
2330
  }
2942
- /**
2943
- * Returns the value of the control
2944
- * @param controlId Id of control
2945
- * @param rowId Id of row, if applicable
2946
- * @returns
2947
- */
2948
- /// mgGetValue -->
2949
2331
  getValue(controlId, rowId) {
2950
2332
  let val = this.task.getValue(controlId, rowId);
2951
2333
  return val;
2952
2334
  }
2953
- /**
2954
- * Returns the Picture of the control
2955
- * @param controlId Id of control
2956
- * @param rowId Id of row, if applicable
2957
- * @returns
2958
- */
2959
- /// getPicture -->
2335
+ getFormattedValue(controlId, rowId) {
2336
+ let val = this.task.getValue(controlId, rowId);
2337
+ val = this.task.getFormattedValue(controlId, val);
2338
+ return val;
2339
+ }
2960
2340
  getPicture(controlId, rowId) {
2961
2341
  if (isNullOrUndefined(controlId))
2962
2342
  return null;
2963
2343
  let pic = this.task.GetControlPictureMask(controlId);
2964
2344
  return (pic != null) ? pic.getFormat().toString() : null;
2965
2345
  }
2966
- /**
2967
- * Returns the custom (user) properties of the control
2968
- * @param controlId Id of control
2969
- * @param propertyName Name of requested property
2970
- * @param rowId Id of row, if applicable
2971
- * @returns
2972
- */
2973
- // mgGetCustomProperty
2974
2346
  getCustomProperty(controlId, propertyNameOrRowID, rowId) {
2975
2347
  if (controlId.indexOf('~') == -1)
2976
2348
  return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
@@ -2995,22 +2367,21 @@ class AccessorMagicService {
2995
2367
  }
2996
2368
  return userProperties;
2997
2369
  }
2998
- /**
2999
- * Gets the values of the items of a selection control
3000
- * @param id Id of control
3001
- * @param rowId Id of row, if applicable
3002
- * @returns
3003
- */
3004
- // mgGetItemListValues
3005
2370
  getItemListValues(id, rowId) {
3006
2371
  return this.getProperty(id, HtmlProperties.ItemsList, rowId);
3007
2372
  }
3008
- /**
3009
- * Gets the display value of the item from items of a selection control
3010
- * @param id Id of control
3011
- * @param rowId Id of row, if applicable
3012
- * @returns
3013
- */
2373
+ getFilteredList(controlId, rowId) {
2374
+ if (isNullOrUndefined(rowId))
2375
+ rowId = '0';
2376
+ let items = this.getItemListValues(controlId, rowId);
2377
+ let value = this.task.getFormControl(rowId, controlId).value;
2378
+ if (value !== null && value !== "" && items instanceof Array) {
2379
+ value = value.toLowerCase();
2380
+ return items.filter(option => option.displayValue.toLowerCase().includes(value));
2381
+ }
2382
+ else
2383
+ return items;
2384
+ }
3014
2385
  getDisplayValue(id, rowId) {
3015
2386
  let displayValue = "";
3016
2387
  let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
@@ -3019,12 +2390,6 @@ class AccessorMagicService {
3019
2390
  displayValue = o[value].displayValue;
3020
2391
  return displayValue;
3021
2392
  }
3022
- /**
3023
- * Returns whether a tab page is selected or not
3024
- * @param index of current option in iterarotr
3025
- * @param control Id of list control
3026
- * @returns
3027
- */ // isOptionSelected
3028
2393
  isOptionSelected(index, controlId) {
3029
2394
  let val = this.task.getValue(controlId, "0");
3030
2395
  for (let item of val) {
@@ -3033,40 +2398,18 @@ class AccessorMagicService {
3033
2398
  }
3034
2399
  return false;
3035
2400
  }
3036
- /**
3037
- * Returns whether a tab page is selected or not - used for the tab buttons
3038
- * @param controlId Id of control
3039
- * @param layer Id of the tab page
3040
- * @returns
3041
- */ // mgIsTabPageSelected
3042
2401
  isTabPageSelected(controlId, layer) {
3043
2402
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
3044
- return val == (layer - 1); // comparing string to number!
3045
- }
3046
- /**
3047
- * Returns whether a tab page layer is selected or not - used for the div which represents the tab page
3048
- * @param controlId Id of control
3049
- * @param layer Id of the tab page
3050
- * @returns
3051
- */ // mgIsTabLayerSelected
2403
+ return val == (layer - 1);
2404
+ }
3052
2405
  isTabPageLayerSelected(controlId, layer) {
3053
2406
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
3054
- return val == (layer - 1); // comparing string to number!
2407
+ return val == (layer - 1);
3055
2408
  }
3056
- /**
3057
- * Returns the index of the selected tab page
3058
- * @param controlId Id of control
3059
- * @returns
3060
- */
3061
2409
  getTabSelectedIndex(controlId) {
3062
2410
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
3063
- return val; // comparing string to number!
2411
+ return val;
3064
2412
  }
3065
- // private methodes
3066
- /**
3067
- * @ignore
3068
- */
3069
- // mgIfRowCreated
3070
2413
  ifRowCreated(row) {
3071
2414
  if (row == null)
3072
2415
  return false;
@@ -3074,48 +2417,25 @@ class AccessorMagicService {
3074
2417
  let result = this.getFormGroupByRow(rowId);
3075
2418
  return !isNullOrUndefined(result);
3076
2419
  }
3077
- /**
3078
- * @ignore
3079
- */
3080
- // mgGetFormGroupByRow
3081
2420
  getFormGroupByRow(id) {
3082
2421
  return this.task.formGroups[id];
3083
2422
  }
3084
- /**
3085
- * @ignore
3086
- */
3087
- // isRowSelected (not changed)
3088
2423
  isRowSelected(controlId, rowId) {
3089
2424
  const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
3090
2425
  return selectedRow == rowId;
3091
2426
  }
3092
- /**
3093
- * Returns whether a row is in edit state
3094
- * @param row
3095
- */
3096
2427
  isRowInRowEditing(row) {
3097
2428
  let guiRowId = '0';
3098
2429
  guiRowId = typeof row == "number" ? row.toString() : row.rowId;
3099
2430
  return this.task.isRowInRowEditing(guiRowId);
3100
2431
  }
3101
- /**
3102
- * Returns whether a row is in edit state, use this method while control outside table control
3103
- * @param row
3104
- */
3105
2432
  isCurrentInRowEditing() {
3106
2433
  let row = this.task.tableService.getSelectedRow();
3107
2434
  return this.task.isRowInRowEditing(row);
3108
2435
  }
3109
- /**
3110
- * @ignore
3111
- */
3112
- // GetGuiTopIndex
3113
2436
  guiTopIndex() {
3114
2437
  return this.task.tableService.getTableTopIndex();
3115
2438
  }
3116
- /**
3117
- * @ignore
3118
- */
3119
2439
  getErrMsg(id, rowId) {
3120
2440
  let c = this.task.getFormControl(rowId, id);
3121
2441
  if (c.hasError('required'))
@@ -3137,12 +2457,6 @@ class AccessorMagicService {
3137
2457
  }
3138
2458
  return 'unknown error';
3139
2459
  }
3140
- /**
3141
- * Sets a user-supplied value to the specified control
3142
- * @param controlName
3143
- * @param value
3144
- * @param refreshDisplay
3145
- */
3146
2460
  setValueToControl(controlName, value, refreshDisplay) {
3147
2461
  if (typeof refreshDisplay === "undefined")
3148
2462
  refreshDisplay = true;
@@ -3151,44 +2465,28 @@ class AccessorMagicService {
3151
2465
  guiEvent.param = refreshDisplay;
3152
2466
  this.task.insertEvent(guiEvent);
3153
2467
  }
3154
- /**
3155
- * @ignore
3156
- */
3157
2468
  isDataviewEmpty() {
3158
2469
  return this.task.Records.isEmptyDataView;
3159
2470
  }
3160
- /**
3161
- * simulates a click event on the specified control, for the Magic engine
3162
- * @param controlName
3163
- * @param rowId
3164
- */
3165
2471
  simulateClick(controlName, rowId) {
3166
2472
  if (typeof rowId === "undefined")
3167
2473
  rowId = 0;
3168
2474
  this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
3169
2475
  }
3170
- /**
3171
- * Return Boolean TRUE if user logged in Else it will return FALSE
3172
- */
3173
2476
  isLoggedIn() {
3174
2477
  return this.task.getIsLoggenIn();
3175
2478
  }
3176
- /**
3177
- * Returns JS object containing the records with all table fields.
3178
- */
3179
2479
  GetFormRecords() {
3180
2480
  let rowId = 0;
3181
2481
  let recArray;
3182
2482
  if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
3183
2483
  let recList = this.task.Records.list;
3184
2484
  let tableControls = new Array();
3185
- //Generate list of table fields names
3186
2485
  for (const key in this.task.template) {
3187
2486
  if (this.task.template[key] == '1')
3188
2487
  tableControls.push(key);
3189
2488
  }
3190
2489
  recArray = new Array();
3191
- //Update the records as list of objects with values for table fields.
3192
2490
  if (tableControls.length > 0) {
3193
2491
  recList.forEach((ctrlMetaData) => {
3194
2492
  if (this.task.Records.isRowCreated(rowId)) {
@@ -3204,20 +2502,23 @@ class AccessorMagicService {
3204
2502
  }
3205
2503
  return recArray;
3206
2504
  }
2505
+ SetCookie(name, value, expires, path, domain, secure, sameSite) {
2506
+ CookieService.setCookie(name, value, expires, path, domain, secure, sameSite);
2507
+ }
2508
+ GetCookie(name) {
2509
+ return CookieService.getCookie(name);
2510
+ }
2511
+ DeleteCookie(name) {
2512
+ return CookieService.deleteCookie(name);
2513
+ }
3207
2514
  }
3208
- /** @nocollapse */ AccessorMagicService.ɵfac = function AccessorMagicService_Factory(t) { return new (t || AccessorMagicService)(ɵɵinject(TaskMagicService)); };
3209
- /** @nocollapse */ AccessorMagicService.ɵprov = ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
3210
- /*@__PURE__*/ (function () { ɵsetClassMetadata(AccessorMagicService, [{
2515
+ AccessorMagicService.ɵfac = function AccessorMagicService_Factory(t) { return new (t || AccessorMagicService)(i0.ɵɵinject(TaskMagicService)); };
2516
+ AccessorMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
2517
+ (function () { i0.ɵsetClassMetadata(AccessorMagicService, [{
3211
2518
  type: Injectable
3212
2519
  }], function () { return [{ type: TaskMagicService }]; }, null); })();
3213
2520
 
3214
- /**
3215
- * Central place for adding the Magic services
3216
- */
3217
2521
  class MagicServices {
3218
- /**
3219
- * @ignore
3220
- */
3221
2522
  constructor(task, subformService, tableService, titleService, mgAccessorService) {
3222
2523
  this.task = task;
3223
2524
  this.subformService = subformService;
@@ -3230,74 +2531,36 @@ class MagicServices {
3230
2531
  task.mgAccessorService = mgAccessorService;
3231
2532
  }
3232
2533
  }
3233
- /** @nocollapse */ MagicServices.ɵfac = function MagicServices_Factory(t) { return new (t || MagicServices)(ɵɵinject(TaskMagicService), ɵɵinject(SubformMagicService), ɵɵinject(TableMagicService), ɵɵinject(TitleMagicService), ɵɵinject(AccessorMagicService)); };
3234
- /** @nocollapse */ MagicServices.ɵprov = ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
3235
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicServices, [{
2534
+ MagicServices.ɵfac = function MagicServices_Factory(t) { return new (t || MagicServices)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(SubformMagicService), i0.ɵɵinject(TableMagicService), i0.ɵɵinject(TitleMagicService), i0.ɵɵinject(AccessorMagicService)); };
2535
+ MagicServices.ɵprov = i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
2536
+ (function () { i0.ɵsetClassMetadata(MagicServices, [{
3236
2537
  type: Injectable
3237
2538
  }], function () { return [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }]; }, null); })();
3238
2539
 
3239
- /**
3240
- * Base component representing a Magic task
3241
- */
3242
2540
  class TaskBaseMagicComponent {
3243
- /**
3244
- *
3245
- * @param ref changes-detector object
3246
- * @param magicServices Access point for all Magic services
3247
- */
3248
2541
  constructor(ref, magicServices) {
3249
2542
  this.ref = ref;
3250
2543
  this.magicServices = magicServices;
3251
- /**
3252
- * @ignore
3253
- */
3254
2544
  this.magicProperties = MagicProperties;
3255
2545
  }
3256
- /**
3257
- * Returns the Magic task service
3258
- * @returns
3259
- */
3260
2546
  get task() {
3261
2547
  return this.magicServices.task;
3262
2548
  }
3263
- /**
3264
- * Returns the Magic subform service
3265
- * @returns
3266
- */
3267
2549
  get mgSub() {
3268
2550
  return this.magicServices.subformService;
3269
2551
  }
3270
- /**
3271
- * Returns the Magic table service
3272
- * @returns
3273
- */
3274
2552
  get tableService() {
3275
2553
  return this.magicServices.tableService;
3276
2554
  }
3277
- /**
3278
- * Returns the Magic accessor service
3279
- * @returns
3280
- */
3281
2555
  get mg() {
3282
2556
  return this.magicServices.mgAccessorService;
3283
2557
  }
3284
- /**
3285
- * Returns the task Id
3286
- * @returns
3287
- */
3288
2558
  get taskId() {
3289
2559
  return this.task.taskId;
3290
2560
  }
3291
- /**
3292
- * Returns the FormGroup for screen-mode forms
3293
- * @returns
3294
- */
3295
2561
  get screenFormGroup() {
3296
2562
  return this.task.ScreenModeControls;
3297
2563
  }
3298
- /**
3299
- * Interface implementation
3300
- */
3301
2564
  ngOnInit() {
3302
2565
  let subscription = this.task.detectChanges.pipe().subscribe(c => {
3303
2566
  this.ref.detectChanges();
@@ -3305,48 +2568,19 @@ class TaskBaseMagicComponent {
3305
2568
  this.task.initTask(this.taskIdParam, this.taskDescription);
3306
2569
  this.createFormControlsAccessor(this.screenFormGroup);
3307
2570
  this.setInputDateFormat();
3308
- // subcribe to custom property changes
3309
2571
  this.task.customPropertiesSubject.pipe().subscribe(property => {
3310
2572
  this.PropertyChanged(property.propertyName, property.rowId, property.value);
3311
2573
  });
3312
- // subcribe to records count changes
3313
2574
  this.task.recordsCountChangeSubject.pipe().subscribe(value => {
3314
2575
  this.RecordsCountChanged(value);
3315
2576
  });
3316
2577
  }
3317
- /**
3318
- * @ignore
3319
- */
3320
2578
  createFormControlsAccessor(formGroup) { }
3321
- /**
3322
- * @ignore
3323
- */
3324
2579
  setInputDateFormat() { }
3325
- /**
3326
- * This method is called when the value of any custom property is updated in Magic
3327
- * propertyName : name of property which is updated. The format is <controlname>~<propertyname>
3328
- * rowId : row number of the updated property for controls in table control (0 for controls outside table)
3329
- * value : updated value of the property
3330
- * @returns : void
3331
- * To use the method override it in your component and check the property name and write you code ..for eg
3332
- * if(propertyName == 'controlname~propertyName') {// your code}
3333
- * else { // your code}
3334
- */
3335
2580
  PropertyChanged(propertyName, rowId, value) {
3336
- // intentionally left blank because the implementation should be in the derived class
3337
- }
3338
- /**
3339
- * Records count change subject is subscribed to change in its value. This method will be called
3340
- * as the value of records count is received at from server.
3341
- * @returns : void
3342
- * To use the method override it in your component.
3343
- */
2581
+ }
3344
2582
  RecordsCountChanged(recordsCount) {
3345
- // intentionally left blank because the implementation should be in the derived class
3346
2583
  }
3347
- /**
3348
- * Interface implementation
3349
- */
3350
2584
  ngAfterViewInit() {
3351
2585
  this.mgSub.init();
3352
2586
  }
@@ -3356,44 +2590,32 @@ class TaskBaseMagicComponent {
3356
2590
  this.task.oldPageSize = this.tableService.getPageSize();
3357
2591
  }
3358
2592
  }
3359
- /**
3360
- * Interface implementation
3361
- */
3362
2593
  ngOnDestroy() {
3363
2594
  this.task.dispose();
3364
2595
  }
3365
2596
  }
3366
- /** @nocollapse */ TaskBaseMagicComponent.ɵfac = function TaskBaseMagicComponent_Factory(t) { return new (t || TaskBaseMagicComponent)(ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(MagicServices)); };
3367
- /** @nocollapse */ TaskBaseMagicComponent.ɵcmp = ɵɵdefineComponent({ type: TaskBaseMagicComponent, selectors: [["task-magic"]], inputs: { taskIdParam: "taskIdParam", taskDescription: "taskDescription" }, features: [ɵɵProvidersFeature([TaskMagicService, SubformMagicService, TableMagicService])], decls: 0, vars: 0, template: function TaskBaseMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
3368
- /*@__PURE__*/ (function () { ɵsetClassMetadata(TaskBaseMagicComponent, [{
2597
+ TaskBaseMagicComponent.ɵfac = function TaskBaseMagicComponent_Factory(t) { return new (t || TaskBaseMagicComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(MagicServices)); };
2598
+ TaskBaseMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TaskBaseMagicComponent, selectors: [["task-magic"]], inputs: { taskIdParam: "taskIdParam", taskDescription: "taskDescription" }, features: [i0.ɵɵProvidersFeature([TaskMagicService, SubformMagicService, TableMagicService])], decls: 0, vars: 0, template: function TaskBaseMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
2599
+ (function () { i0.ɵsetClassMetadata(TaskBaseMagicComponent, [{
3369
2600
  type: Component,
3370
2601
  args: [{
3371
2602
  selector: 'task-magic',
3372
2603
  providers: [TaskMagicService, SubformMagicService, TableMagicService],
3373
2604
  template: ''
3374
2605
  }]
3375
- }], function () { return [{ type: ChangeDetectorRef }, { type: MagicServices }]; }, { taskIdParam: [{
2606
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: MagicServices }]; }, { taskIdParam: [{
3376
2607
  type: Input
3377
2608
  }], taskDescription: [{
3378
2609
  type: Input
3379
2610
  }] }); })();
3380
2611
 
3381
- /**
3382
- * @ignore
3383
- */
3384
2612
  class RowMagicDirective {
3385
2613
  constructor(_task, element) {
3386
2614
  this._task = _task;
3387
2615
  this.element = element;
3388
- /**
3389
- * @ignore
3390
- */
3391
2616
  this.rowChangedSubscriber = null;
3392
2617
  this.htmlElement = this.element.nativeElement;
3393
2618
  }
3394
- /**
3395
- * Initializes this object
3396
- */
3397
2619
  ngOnInit() {
3398
2620
  this.rowChangedSubscriber = this._task
3399
2621
  .OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
@@ -3408,16 +2630,7 @@ class RowMagicDirective {
3408
2630
  return (rect.top >= parentRect.top &&
3409
2631
  rect.bottom <= parentRect.bottom);
3410
2632
  }
3411
- /**
3412
- * Cleanup
3413
- */
3414
2633
  ngOnDestroy() {
3415
- // Don't know why, but when the table is loaded for the first time, we
3416
- // get ngOnInit() for the 1st row (rowId = "0") and then ngOnDestroy()
3417
- // for number of rows in the page but here this.rowId is undefined.
3418
- // Since ngOnInit() was not called for all these rows, this.rowChangedSubscriber
3419
- // is null and hence crashes.
3420
- // So, the condition to check nulity is added.
3421
2634
  if (this.rowChangedSubscriber !== null) {
3422
2635
  this.rowChangedSubscriber.unsubscribe();
3423
2636
  }
@@ -3425,20 +2638,21 @@ class RowMagicDirective {
3425
2638
  onClick($event) {
3426
2639
  if (this.rowId != '') {
3427
2640
  this._task.insertEvent(getGuiEventObj('click', "magicRow", +this.rowId));
3428
- event.cancelBubble = true;
2641
+ if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
2642
+ event.cancelBubble = true;
3429
2643
  }
3430
2644
  }
3431
2645
  }
3432
- /** @nocollapse */ RowMagicDirective.ɵfac = function RowMagicDirective_Factory(t) { return new (t || RowMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef)); };
3433
- /** @nocollapse */ RowMagicDirective.ɵdir = ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3434
- ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
2646
+ RowMagicDirective.ɵfac = function RowMagicDirective_Factory(t) { return new (t || RowMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
2647
+ RowMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
2648
+ i0.ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
3435
2649
  } }, inputs: { rowId: ["magicRow", "rowId"] } });
3436
- /*@__PURE__*/ (function () { ɵsetClassMetadata(RowMagicDirective, [{
2650
+ (function () { i0.ɵsetClassMetadata(RowMagicDirective, [{
3437
2651
  type: Directive,
3438
2652
  args: [{
3439
2653
  selector: '[magicRow]'
3440
2654
  }]
3441
- }], function () { return [{ type: TaskMagicService }, { type: ElementRef }]; }, { rowId: [{
2655
+ }], function () { return [{ type: TaskMagicService }, { type: i0.ElementRef }]; }, { rowId: [{
3442
2656
  type: Input,
3443
2657
  args: ['magicRow']
3444
2658
  }], onClick: [{
@@ -3446,35 +2660,16 @@ class RowMagicDirective {
3446
2660
  args: ['click', ['$event']]
3447
2661
  }] }); })();
3448
2662
 
3449
- /**
3450
- * Connects HTML elements to the Magic Web Client engine
3451
- */
3452
2663
  class MagicDirective {
3453
- /**
3454
- *
3455
- * @param _task The task service
3456
- * @param element The element for which the directive is applied
3457
- * @param renderer Renderer for the element
3458
- * @param vcRef
3459
- * @param magicRow
3460
- */
3461
2664
  constructor(_task, element, renderer, vcRef, magicRow) {
3462
2665
  this._task = _task;
3463
2666
  this.element = element;
3464
2667
  this.renderer = renderer;
3465
2668
  this.vcRef = vcRef;
3466
2669
  this.magicRow = magicRow;
3467
- /**
3468
- * Collection of event handlers for this element
3469
- */
3470
2670
  this.eventHandlers = {};
3471
2671
  this.eventsOnlyVal = false;
3472
2672
  this.htmlElement = this.element.nativeElement;
3473
- //let c = (<any>this.vcRef)._view;
3474
- //while (!(c instanceof TaskBaseMagicComponent)) {
3475
- // c = c.component;
3476
- //}
3477
- //this.component = c;
3478
2673
  if (!(typeof magicRow === 'undefined' || magicRow === null))
3479
2674
  this.rowId = magicRow.rowId;
3480
2675
  }
@@ -3483,36 +2678,28 @@ class MagicDirective {
3483
2678
  this.selector = 'magic';
3484
2679
  }
3485
2680
  ;
3486
- /**
3487
- * This flag is used when we only want to register to events, but do not want to execute commands sent from server
3488
- */
3489
2681
  set eventsOnly(val) {
3490
2682
  console.log('eventsOnly');
3491
2683
  this.eventsOnlyVal = true;
3492
2684
  }
3493
2685
  ;
3494
- /**
3495
- * Get the task service
3496
- * @returns
3497
- */
3498
2686
  get task() {
3499
2687
  return this._task;
3500
2688
  }
3501
- /**
3502
- * Register to the events this element may need to handle
3503
- */
3504
2689
  regEvents() {
3505
- // Handle events for which event handler may be removed and restored
3506
2690
  this.eventHandlers['focusin'] = this.OnFocus.bind(this);
3507
2691
  Object.keys(this.eventHandlers).forEach((key) => {
3508
2692
  this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
3509
2693
  });
3510
- // Handle events with anonymous event handlers
3511
- let events = ['click', 'mousedown', 'dblclick']; // ,'resize', 'load', 'unload'
2694
+ let events = ['click', 'mousedown', 'dblclick'];
3512
2695
  events.forEach(event => {
3513
2696
  this.renderer.listen(this.htmlElement, event, (e) => {
3514
- this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId));
3515
- e.cancelBubble = true;
2697
+ let fromButton = false;
2698
+ if (this.htmlElement instanceof HTMLButtonElement)
2699
+ fromButton = true;
2700
+ this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
2701
+ if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
2702
+ e.cancelBubble = true;
3516
2703
  });
3517
2704
  });
3518
2705
  this.renderer.listen(this.htmlElement, 'change', (e) => {
@@ -3523,13 +2710,10 @@ class MagicDirective {
3523
2710
  this.task.insertEvent(guiEvent);
3524
2711
  }
3525
2712
  });
3526
- // handle the input event
3527
2713
  fromEvent(this.htmlElement, 'input').pipe(map((event) => {
3528
2714
  return event.target.value;
3529
- }), debounceTime(200) // time after which value will be sent to magic
3530
- ).subscribe((x) => {
2715
+ }), debounceTime(200)).subscribe((x) => {
3531
2716
  if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
3532
- // Don't support character binding for date/time values
3533
2717
  let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
3534
2718
  if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
3535
2719
  this.task.mgAccessorService.setValueToControl(this.id, x, true);
@@ -3555,25 +2739,16 @@ class MagicDirective {
3555
2739
  (e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
3556
2740
  if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
3557
2741
  guiEvent.keyCode = e.keyCode;
3558
- // Defect 160021 fixed - don't set e.cancelBubble when combobox is opened and esc key is pressed
3559
- if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && !MagicDirective.opened)
2742
+ if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
3560
2743
  e.cancelBubble = true;
3561
2744
  this.task.insertEvent(guiEvent);
3562
2745
  }
3563
2746
  });
3564
2747
  }
3565
- /**
3566
- * Handle focus event
3567
- */
3568
2748
  OnFocus() {
3569
2749
  this.task.insertEvent(getGuiEventObj('focus', this.id, +this.rowId));
3570
2750
  event.cancelBubble = true;
3571
2751
  }
3572
- /**
3573
- * Is the command's element the same as this directive's element
3574
- * @param command
3575
- * @returns true/false
3576
- */
3577
2752
  IsSameElement(command) {
3578
2753
  let line = command.line;
3579
2754
  if (this.task.isTableControl(command.CtrlName))
@@ -3582,17 +2757,9 @@ class MagicDirective {
3582
2757
  (line === +this.rowId ||
3583
2758
  (line === 0 && isNullOrUndefined(this.rowId))));
3584
2759
  }
3585
- /**
3586
- * Is the command's element the same as this directive's component
3587
- * @param command
3588
- * @returns true/false
3589
- */
3590
2760
  IsSameComponent(command) {
3591
2761
  return (command.controlName === this.id);
3592
2762
  }
3593
- /**
3594
- * @ignore
3595
- */
3596
2763
  regUpdatesUI() {
3597
2764
  this.subscribeRefreshDom = this.task
3598
2765
  .refreshDom.pipe(filter(c => this.IsSameElement(c)))
@@ -3614,17 +2781,10 @@ class MagicDirective {
3614
2781
  this.handleInteractiveCommands(command);
3615
2782
  });
3616
2783
  }
3617
- /**
3618
- * Initializes this object
3619
- */
3620
2784
  ngOnInit() {
3621
2785
  this.regEvents();
3622
2786
  this.regUpdatesUI();
3623
2787
  }
3624
- /**
3625
- * Handles the commands received from the Magic WebClient engine
3626
- * @param command
3627
- */
3628
2788
  handleCommand(command) {
3629
2789
  switch (command.CommandType) {
3630
2790
  case CommandType.SET_PROPERTY:
@@ -3632,14 +2792,12 @@ class MagicDirective {
3632
2792
  break;
3633
2793
  case CommandType.SET_FOCUS:
3634
2794
  this.focusUnlistener();
3635
- this.htmlElement.focus();
2795
+ if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
2796
+ this.htmlElement.focus();
3636
2797
  this.focusUnlistener = this.renderer.listen(this.htmlElement, 'focusin', this.eventHandlers['focusin']);
3637
2798
  break;
3638
2799
  }
3639
2800
  }
3640
- /**
3641
- * handle the interactive commands like CallJS
3642
- */
3643
2801
  handleInteractiveCommands(command) {
3644
2802
  switch (command._commandType) {
3645
2803
  case InteractiveCommandType.CALL_JS:
@@ -3649,24 +2807,18 @@ class MagicDirective {
3649
2807
  let resultString = '';
3650
2808
  try {
3651
2809
  if (!isNullOrUndefined(magicComponent[methodName])) {
3652
- // invoke the method on instance of magic componenet
3653
2810
  resultString = magicComponent[methodName].apply(magicComponent, args);
3654
2811
  }
3655
2812
  else
3656
- console.error('Instance method ' + methodName + ' does not exists'); // when method is not found
2813
+ console.error('Instance method ' + methodName + ' does not exists');
3657
2814
  }
3658
2815
  catch (e) {
3659
- // any other exception
3660
2816
  console.error(e.message);
3661
2817
  }
3662
- command.resultString = resultString; // update the return value
2818
+ command.resultString = resultString;
3663
2819
  break;
3664
2820
  }
3665
2821
  }
3666
- /**
3667
- * Handle the Magic set-property command
3668
- * @param command
3669
- */
3670
2822
  handleSetProperty(command) {
3671
2823
  switch (command.Operation) {
3672
2824
  case HtmlProperties.ReadOnly:
@@ -3677,22 +2829,20 @@ class MagicDirective {
3677
2829
  break;
3678
2830
  }
3679
2831
  }
3680
- /**
3681
- * Cleanup
3682
- */
3683
2832
  ngOnDestroy() {
3684
2833
  this.subscribeRefreshDom.unsubscribe();
3685
2834
  }
3686
2835
  }
3687
2836
  MagicDirective.opened = false;
3688
- /** @nocollapse */ MagicDirective.ɵfac = function MagicDirective_Factory(t) { return new (t || MagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
3689
- /** @nocollapse */ MagicDirective.ɵdir = ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", rowId: "rowId" } });
3690
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicDirective, [{
2837
+ MagicDirective.noOfAutoCompleteBoxesOpened = 0;
2838
+ MagicDirective.ɵfac = function MagicDirective_Factory(t) { return new (t || MagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
2839
+ MagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", rowId: "rowId" } });
2840
+ (function () { i0.ɵsetClassMetadata(MagicDirective, [{
3691
2841
  type: Directive,
3692
2842
  args: [{
3693
2843
  selector: '[magic]'
3694
2844
  }]
3695
- }], function () { return [{ type: TaskMagicService }, { type: ElementRef }, { type: Renderer2 }, { type: ViewContainerRef }, { type: RowMagicDirective, decorators: [{
2845
+ }], function () { return [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: RowMagicDirective, decorators: [{
3696
2846
  type: Optional
3697
2847
  }] }]; }, { magic: [{
3698
2848
  type: Input,
@@ -3704,9 +2854,6 @@ MagicDirective.opened = false;
3704
2854
  type: Input
3705
2855
  }] }); })();
3706
2856
 
3707
- /**
3708
- * @ignore
3709
- */
3710
2857
  class NoControlMagicDirective extends MagicDirective {
3711
2858
  constructor(_task, element, renderer, vcRef, magicRow) {
3712
2859
  super(_task, element, renderer, vcRef, magicRow);
@@ -3741,12 +2888,10 @@ class NoControlMagicDirective extends MagicDirective {
3741
2888
  }
3742
2889
  }
3743
2890
  }
3744
- // is the div a tab control
3745
2891
  isTabControl() {
3746
2892
  return this.htmlElement instanceof HTMLDivElement &&
3747
2893
  this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
3748
2894
  }
3749
- // is the div a radio buttons wrapper
3750
2895
  isRadio() {
3751
2896
  return this.htmlElement instanceof HTMLDivElement &&
3752
2897
  this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
@@ -3755,7 +2900,6 @@ class NoControlMagicDirective extends MagicDirective {
3755
2900
  super.handleCommand(command);
3756
2901
  switch (command.CommandType) {
3757
2902
  case CommandType.SET_CLASS:
3758
- //remove the class which was replaced by this new one, as registered in the ControlMetadata
3759
2903
  const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
3760
2904
  if (controlMetadata.removedClass != '') {
3761
2905
  this.htmlElement.classList.remove(controlMetadata.removedClass);
@@ -3768,7 +2912,7 @@ class NoControlMagicDirective extends MagicDirective {
3768
2912
  this.htmlElement.innerText = command.value;
3769
2913
  if (this.htmlElement instanceof HTMLSelectElement)
3770
2914
  this.htmlElement.value = command.value;
3771
- if (this.htmlElement instanceof HTMLAnchorElement) //hyper-text button
2915
+ if (this.htmlElement instanceof HTMLAnchorElement)
3772
2916
  this.htmlElement.text = command.value;
3773
2917
  if (this.htmlElement instanceof HTMLInputElement) {
3774
2918
  if (this.htmlElement.type === "checkbox") {
@@ -3792,7 +2936,6 @@ class NoControlMagicDirective extends MagicDirective {
3792
2936
  break;
3793
2937
  }
3794
2938
  }
3795
- // handle set-property commands
3796
2939
  handleSetProperty(command) {
3797
2940
  super.handleSetProperty(command);
3798
2941
  switch (command.Operation) {
@@ -3808,7 +2951,6 @@ class NoControlMagicDirective extends MagicDirective {
3808
2951
  break;
3809
2952
  case HtmlProperties.ItemsList:
3810
2953
  if (this.htmlElement instanceof HTMLSelectElement) {
3811
- // clear the list
3812
2954
  var len = this.htmlElement.length;
3813
2955
  for (var i = len - 1; i >= 0; i--) {
3814
2956
  this.htmlElement.remove(i);
@@ -3850,8 +2992,7 @@ class NoControlMagicDirective extends MagicDirective {
3850
2992
  let child = tabControl.children[i];
3851
2993
  const layer = child.getAttribute('layer') - 1;
3852
2994
  if (child instanceof HTMLButtonElement) {
3853
- // set button style
3854
- if (layer == command.obj1) { // compare int to string
2995
+ if (layer == command.obj1) {
3855
2996
  child.classList.add('tab_button_active');
3856
2997
  }
3857
2998
  else {
@@ -3859,7 +3000,6 @@ class NoControlMagicDirective extends MagicDirective {
3859
3000
  }
3860
3001
  }
3861
3002
  else {
3862
- // not a buton - hide unselected tabpages
3863
3003
  let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
3864
3004
  child.setAttribute('style', style);
3865
3005
  }
@@ -3881,141 +3021,23 @@ class NoControlMagicDirective extends MagicDirective {
3881
3021
  }
3882
3022
  }
3883
3023
  }
3884
- /** @nocollapse */ NoControlMagicDirective.ɵfac = function NoControlMagicDirective_Factory(t) { return new (t || NoControlMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
3885
- /** @nocollapse */ NoControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: ["magicnc", "magic"] }, features: [ɵɵInheritDefinitionFeature] });
3886
- /*@__PURE__*/ (function () { ɵsetClassMetadata(NoControlMagicDirective, [{
3024
+ NoControlMagicDirective.ɵfac = function NoControlMagicDirective_Factory(t) { return new (t || NoControlMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
3025
+ NoControlMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: ["magicnc", "magic"] }, features: [i0.ɵɵInheritDefinitionFeature] });
3026
+ (function () { i0.ɵsetClassMetadata(NoControlMagicDirective, [{
3887
3027
  type: Directive,
3888
3028
  args: [{
3889
3029
  selector: '[magicnc]'
3890
3030
  }]
3891
- }], function () { return [{ type: TaskMagicService }, { type: ElementRef }, { type: Renderer2 }, { type: ViewContainerRef }, { type: RowMagicDirective, decorators: [{
3031
+ }], function () { return [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: RowMagicDirective, decorators: [{
3892
3032
  type: Optional
3893
3033
  }] }]; }, { magic: [{
3894
3034
  type: Input,
3895
3035
  args: ['magicnc']
3896
3036
  }] }); })();
3897
3037
 
3898
- /**
3899
- * Mock component, implements routing by connecting the requested URL with the appropriate Magic task
3900
- */
3901
- class RouterContainerMagicComponent {
3902
- /**
3903
- *
3904
- * @param changeDetectorRef
3905
- * @param activatedRoute
3906
- * @param magic
3907
- * @param componentFactoryResolver
3908
- * @param viewContainerRef
3909
- * @param componentList
3910
- * @param pendingCommandsCollector
3911
- */
3912
- constructor(activatedRoute, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
3913
- this.activatedRoute = activatedRoute;
3914
- this.magic = magic;
3915
- this.containerTaskService = containerTaskService;
3916
- this.componentFactoryResolver = componentFactoryResolver;
3917
- this.viewContainerRef = viewContainerRef;
3918
- this.componentList = componentList;
3919
- this.pendingCommandsCollector = pendingCommandsCollector;
3920
- this.routerCommandsMagicService = routerCommandsMagicService;
3921
- this.componentRef = null;
3922
- this.parentMgSubformService = null;
3923
- }
3924
- /**
3925
- * Initialization
3926
- */
3927
- ngOnInit() {
3928
- let outletname = this.activatedRoute.outlet;
3929
- let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
3930
- let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
3931
- if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
3932
- this.insertRouteEvent(currentActiveRoute);
3933
- SubformMagicService.routerContainers.push(this);
3934
- }
3935
- else {
3936
- this.initializeComponent();
3937
- }
3938
- }
3939
- insertRouteEvent(currentActiveRoute) {
3940
- let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
3941
- guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
3942
- if (currentActiveRoute.snapshot.outlet !== 'primary')
3943
- guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
3944
- // if this is LoadOnDemandModuleMagicComponent it's mean that this is load on demand module and we
3945
- // need to take the path form routeConfig.path
3946
- let calcRouterPath = currentActiveRoute.routeConfig.path;
3947
- // add the RouterPath only if exist
3948
- if (calcRouterPath.length > 0) {
3949
- let routerPath = calcRouterPath;
3950
- let tokens = StrUtil.tokenize(routerPath, "/:");
3951
- guiEvent.RouterPath = tokens[0];
3952
- guiEvent.RouterParams = new List();
3953
- for (let i = 1; i < tokens.length; i++) {
3954
- guiEvent.RouterParams.push(this.activatedRoute.snapshot.params[tokens[i]]);
3955
- }
3956
- }
3957
- this.containerTaskService.insertEvent(guiEvent);
3958
- }
3959
- initializeComponent() {
3960
- // re-init subformMagicService since it may change after executing "RouterNavigate" event.
3961
- let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
3962
- if (subformMagicService.currentRouteDefinition !== null) {
3963
- let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
3964
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
3965
- this.componentRef = this.viewContainerRef.createComponent(componentFactory);
3966
- Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
3967
- let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
3968
- let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
3969
- subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
3970
- this.parentMgSubformService = subformMagicService;
3971
- subformMagicService.currentRouteDefinition = null;
3972
- SubformMagicService.currentCallerMgSubformServiceRef = null;
3973
- //When the component is initialized, then also we get the notification for paramMap subscription.
3974
- //But in this case, we do not have to raise the event, because magic engine itself has initiated the route with the same parameters.
3975
- //So, control it via ignoreParamChange flag.
3976
- let ignoreParamChange = true;
3977
- myActiveRoute.paramMap.subscribe(params => {
3978
- if (!ignoreParamChange)
3979
- this.insertRouteEvent(myActiveRoute);
3980
- ignoreParamChange = false;
3981
- });
3982
- this.parentMgSubformService.refreshView();
3983
- this.routerCommandsMagicService.ExecuteNextCommand();
3984
- }
3985
- }
3986
- /**
3987
- * Cleanup
3988
- */
3989
- ngOnDestroy() {
3990
- // TODO Routing: Call close() only if the task is not already closed.
3991
- // Task can be closed when a router is overlayed by another task via call operation.
3992
- if (this.componentRef != null) {
3993
- this.componentRef.instance.task.close();
3994
- let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
3995
- this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
3996
- }
3997
- }
3998
- }
3999
- /** @nocollapse */ 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)); };
4000
- /** @nocollapse */ RouterContainerMagicComponent.ɵcmp = ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
4001
- /*@__PURE__*/ (function () { ɵsetClassMetadata(RouterContainerMagicComponent, [{
4002
- type: Component,
4003
- args: [{
4004
- selector: 'magic-route-outlet',
4005
- template: `
4006
- `
4007
- }]
4008
- }], function () { return [{ type: ActivatedRoute }, { type: EngineMagicService }, { type: TaskMagicService }, { type: ComponentFactoryResolver }, { type: ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null); })();
4009
-
4010
- /**
4011
- * @ignore
4012
- */
4013
3038
  class Constants {
4014
3039
  }
4015
3040
  Constants.DATE_FMT = 'dd/MMM/yyyy';
4016
- /**
4017
- * @ignore
4018
- */
4019
3041
  class DateMagicPipe extends DatePipe {
4020
3042
  constructor(_task) {
4021
3043
  super('en-US');
@@ -4027,7 +3049,6 @@ class DateMagicPipe extends DatePipe {
4027
3049
  let mgDateFormatter = new MgDateFormatter();
4028
3050
  if (!isNullOrUndefined(value) && mask !== null) {
4029
3051
  formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
4030
- // If control is label control of table, due to query mode, then save the format here.
4031
3052
  if (formatStr != null && this._task.isTableControl(controlId)) {
4032
3053
  if (this._task.mgInputDateFormat == null)
4033
3054
  this._task.mgInputDateFormat = formatStr;
@@ -4041,9 +3062,9 @@ class DateMagicPipe extends DatePipe {
4041
3062
  return value;
4042
3063
  }
4043
3064
  }
4044
- /** @nocollapse */ DateMagicPipe.ɵfac = function DateMagicPipe_Factory(t) { return new (t || DateMagicPipe)(ɵɵdirectiveInject(TaskMagicService)); };
4045
- /** @nocollapse */ DateMagicPipe.ɵpipe = ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
4046
- /*@__PURE__*/ (function () { ɵsetClassMetadata(DateMagicPipe, [{
3065
+ DateMagicPipe.ɵfac = function DateMagicPipe_Factory(t) { return new (t || DateMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService)); };
3066
+ DateMagicPipe.ɵpipe = i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
3067
+ (function () { i0.ɵsetClassMetadata(DateMagicPipe, [{
4047
3068
  type: Pipe,
4048
3069
  args: [{
4049
3070
  name: 'magicDate'
@@ -4108,17 +3129,11 @@ class MgDateFormatter {
4108
3129
  return formatStr.ToString();
4109
3130
  }
4110
3131
  else
4111
- return "dd-mm-yyyy"; // return default format.
3132
+ return "dd-mm-yyyy";
4112
3133
  }
4113
3134
  }
4114
3135
 
4115
- /**
4116
- * Perform Magic validation on input controls which hold alphanumeric strings
4117
- */
4118
3136
  class MgformatMagicDirective {
4119
- /**
4120
- * @ignore
4121
- */
4122
3137
  constructor(magicDir, _task) {
4123
3138
  this.magicDir = magicDir;
4124
3139
  this._task = _task;
@@ -4126,20 +3141,12 @@ class MgformatMagicDirective {
4126
3141
  ngAfterViewInit() {
4127
3142
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
4128
3143
  if (control != null && this._task.mgInputDateFormat == null) {
4129
- // get the first date control's format.
4130
3144
  let pic = this._task.GetControlPictureMask(this.magicDir.id);
4131
3145
  if (pic.getAttr() == StorageAttribute.DATE) {
4132
3146
  this.formatDate(pic);
4133
3147
  }
4134
3148
  }
4135
3149
  }
4136
- /**
4137
- * @ignore
4138
- */
4139
- /**
4140
- * This can be used to set pattern
4141
- * On input, verifies the input matches the required mask
4142
- */
4143
3150
  onFocusEvent($event) {
4144
3151
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
4145
3152
  if (control != null) {
@@ -4164,10 +3171,6 @@ class MgformatMagicDirective {
4164
3171
  }
4165
3172
  }
4166
3173
  }
4167
- /**
4168
- * @ignore
4169
- */
4170
- // This can be used to implement uppercase/lower case
4171
3174
  onChangeEvent($event) {
4172
3175
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
4173
3176
  let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
@@ -4185,9 +3188,6 @@ class MgformatMagicDirective {
4185
3188
  let mgDateFormatter = new MgDateFormatter();
4186
3189
  this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
4187
3190
  }
4188
- /**
4189
- * @ignore
4190
- */
4191
3191
  formatAlphaUnicode(control) {
4192
3192
  let value = control.value;
4193
3193
  if (value !== null && value.length > 0) {
@@ -4213,9 +3213,6 @@ class MgformatMagicDirective {
4213
3213
  control.setValue(valueStr.ToString());
4214
3214
  }
4215
3215
  }
4216
- /**
4217
- * @ignore
4218
- */
4219
3216
  formatBoolean(control) {
4220
3217
  let value = control.value;
4221
3218
  if (value !== null && value.length > 0) {
@@ -4228,12 +3225,6 @@ class MgformatMagicDirective {
4228
3225
  }
4229
3226
  }
4230
3227
  }
4231
- /**
4232
- * @ignore
4233
- */
4234
- /// <summary>
4235
- /// generate pattern from fld's format
4236
- /// </summary>
4237
3228
  generatePattern(attribute, pic) {
4238
3229
  let pattern = "";
4239
3230
  switch (attribute) {
@@ -4247,12 +3238,6 @@ class MgformatMagicDirective {
4247
3238
  }
4248
3239
  return pattern;
4249
3240
  }
4250
- /**
4251
- * @ignore
4252
- */
4253
- /// <summary>
4254
- /// generate pattern for Alpha
4255
- /// </summary>
4256
3241
  generatePatternForNumber(pic) {
4257
3242
  let patternStr = new StringBuilder();
4258
3243
  patternStr.Append("^");
@@ -4265,9 +3250,6 @@ class MgformatMagicDirective {
4265
3250
  patternStr.Append("$");
4266
3251
  return patternStr.ToString();
4267
3252
  }
4268
- /**
4269
- * @ignore
4270
- */
4271
3253
  isPatternGenerationNeeded(attr, pic) {
4272
3254
  switch (attr) {
4273
3255
  case StorageAttribute.NUMERIC:
@@ -4277,12 +3259,6 @@ class MgformatMagicDirective {
4277
3259
  return (pic.getMaskChars() > 0) ? true : false;
4278
3260
  }
4279
3261
  }
4280
- /**
4281
- * @ignore
4282
- */
4283
- /// <summary>
4284
- /// generate pattern for Alpha
4285
- /// </summary>
4286
3262
  generatePatternForAlpha(pic) {
4287
3263
  let cnt = 0;
4288
3264
  let inputAllChars = false;
@@ -4293,7 +3269,6 @@ class MgformatMagicDirective {
4293
3269
  let pattern = new StringBuilder();
4294
3270
  pattern.Append("^");
4295
3271
  for (let i = 0; i < mask.length;) {
4296
- //start new subset , if mask[i] is one of these.
4297
3272
  if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
4298
3273
  || mask.charCodeAt(i) == PICInterface.PIC_X)) {
4299
3274
  pattern.Append("(");
@@ -4339,13 +3314,9 @@ class MgformatMagicDirective {
4339
3314
  pattern.Append("$");
4340
3315
  return pattern.ToString();
4341
3316
  }
4342
- /**
4343
- * @ignore
4344
- */
4345
3317
  getDirectiveCount(mask, idx, pattern, changeInPattern) {
4346
3318
  changeInPattern.value = false;
4347
3319
  let patternCount = 0;
4348
- // find max chars
4349
3320
  while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
4350
3321
  patternCount++;
4351
3322
  idx++;
@@ -4354,9 +3325,6 @@ class MgformatMagicDirective {
4354
3325
  changeInPattern.value = true;
4355
3326
  return patternCount;
4356
3327
  }
4357
- /**
4358
- * @ignore
4359
- */
4360
3328
  IsPatternMatches(mask, pattern) {
4361
3329
  for (let i = 0; i < pattern.length; i++)
4362
3330
  if (mask == pattern[i])
@@ -4364,11 +3332,11 @@ class MgformatMagicDirective {
4364
3332
  return false;
4365
3333
  }
4366
3334
  }
4367
- /** @nocollapse */ MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(ɵɵdirectiveInject(MagicDirective), ɵɵdirectiveInject(TaskMagicService)); };
4368
- /** @nocollapse */ MgformatMagicDirective.ɵdir = ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4369
- ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); });
3335
+ MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
3336
+ MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3337
+ i0.ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); });
4370
3338
  } } });
4371
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MgformatMagicDirective, [{
3339
+ (function () { i0.ɵsetClassMetadata(MgformatMagicDirective, [{
4372
3340
  type: Directive,
4373
3341
  args: [{
4374
3342
  selector: '[mgFormat]'
@@ -4381,9 +3349,6 @@ class MgformatMagicDirective {
4381
3349
  args: ['change', ['$event']]
4382
3350
  }] }); })();
4383
3351
 
4384
- /**
4385
- * @ignore
4386
- */
4387
3352
  class TimeMagicPipe extends DatePipe {
4388
3353
  constructor(_task) {
4389
3354
  super('en-US');
@@ -4419,33 +3384,20 @@ class TimeMagicPipe extends DatePipe {
4419
3384
  return value;
4420
3385
  }
4421
3386
  }
4422
- /** @nocollapse */ TimeMagicPipe.ɵfac = function TimeMagicPipe_Factory(t) { return new (t || TimeMagicPipe)(ɵɵdirectiveInject(TaskMagicService)); };
4423
- /** @nocollapse */ TimeMagicPipe.ɵpipe = ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
4424
- /*@__PURE__*/ (function () { ɵsetClassMetadata(TimeMagicPipe, [{
3387
+ TimeMagicPipe.ɵfac = function TimeMagicPipe_Factory(t) { return new (t || TimeMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService)); };
3388
+ TimeMagicPipe.ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
3389
+ (function () { i0.ɵsetClassMetadata(TimeMagicPipe, [{
4425
3390
  type: Pipe,
4426
3391
  args: [{
4427
3392
  name: 'magicTime'
4428
3393
  }]
4429
3394
  }], function () { return [{ type: TaskMagicService }]; }, null); })();
4430
3395
 
4431
- /**
4432
- * Validates the field range.
4433
- */
4434
3396
  class RangeValidatorMagicDirective {
4435
- /**
4436
- *
4437
- * @param _task The task service
4438
- * @param vcRef
4439
- */
4440
3397
  constructor(_task, vcRef) {
4441
3398
  this._task = _task;
4442
3399
  this.vcRef = vcRef;
4443
3400
  }
4444
- /**
4445
- * Validation method
4446
- * @param c FormControl to validate
4447
- * @returns If validation fails, return error message, else returns null
4448
- */
4449
3401
  validate(c) {
4450
3402
  let controlName;
4451
3403
  controlName = this.getControlName(c);
@@ -4467,23 +3419,20 @@ class RangeValidatorMagicDirective {
4467
3419
  };
4468
3420
  }
4469
3421
  }
4470
- /**
4471
- * @ignore
4472
- */
4473
3422
  getControlName(c) {
4474
3423
  const formGroup = c.parent.controls;
4475
3424
  return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
4476
3425
  }
4477
3426
  }
4478
- /** @nocollapse */ RangeValidatorMagicDirective.ɵfac = function RangeValidatorMagicDirective_Factory(t) { return new (t || RangeValidatorMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ViewContainerRef)); };
4479
- /** @nocollapse */ RangeValidatorMagicDirective.ɵdir = ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [ɵɵProvidersFeature([
3427
+ RangeValidatorMagicDirective.ɵfac = function RangeValidatorMagicDirective_Factory(t) { return new (t || RangeValidatorMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
3428
+ RangeValidatorMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [i0.ɵɵProvidersFeature([
4480
3429
  {
4481
3430
  provide: NG_VALIDATORS,
4482
3431
  useExisting: RangeValidatorMagicDirective,
4483
3432
  multi: true,
4484
3433
  }
4485
3434
  ])] });
4486
- /*@__PURE__*/ (function () { ɵsetClassMetadata(RangeValidatorMagicDirective, [{
3435
+ (function () { i0.ɵsetClassMetadata(RangeValidatorMagicDirective, [{
4487
3436
  type: Directive,
4488
3437
  args: [{
4489
3438
  selector: '[rangevalidator] ',
@@ -4495,56 +3444,37 @@ class RangeValidatorMagicDirective {
4495
3444
  }
4496
3445
  ]
4497
3446
  }]
4498
- }], function () { return [{ type: TaskMagicService }, { type: ViewContainerRef }]; }, null); })();
3447
+ }], function () { return [{ type: TaskMagicService }, { type: i0.ViewContainerRef }]; }, null); })();
4499
3448
 
4500
3449
  function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) { if (rf & 1) {
4501
- ɵɵelement(0, "ndc-dynamic", 1);
3450
+ i0.ɵɵelement(0, "ndc-dynamic", 1);
4502
3451
  } if (rf & 2) {
4503
- const ctx_r0 = ɵɵnextContext();
4504
- ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
3452
+ const ctx_r0 = i0.ɵɵnextContext();
3453
+ i0.ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
4505
3454
  } }
4506
- /**
4507
- * Represents a Magic subform
4508
- */
4509
3455
  class SubformMagicComponent {
4510
- /**
4511
- * @ignore
4512
- */
4513
3456
  constructor(vcRef, mgSub) {
4514
3457
  this.vcRef = vcRef;
4515
3458
  this.mgSub = mgSub;
4516
- /**
4517
- * @ignore
4518
- */
4519
3459
  this.component = null;
4520
- // For angular 10 - find the component from views
4521
3460
  this.component = (this.vcRef._hostView).find(v => !isNullOrUndefined(v));
4522
3461
  }
4523
- /**
4524
- * @ignore
4525
- */
4526
3462
  set magic(val) { this.id = val; }
4527
3463
  ;
4528
- /**
4529
- * @ignore
4530
- */
4531
3464
  get Component() {
4532
3465
  return this.mgSub.mgGetComp(this.id);
4533
3466
  }
4534
- /**
4535
- * @ignore
4536
- */
4537
3467
  get Parameters() {
4538
3468
  return this.mgSub.mgGetParameters(this.id);
4539
3469
  }
4540
3470
  }
4541
- /** @nocollapse */ SubformMagicComponent.ɵfac = function SubformMagicComponent_Factory(t) { return new (t || SubformMagicComponent)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(SubformMagicService)); };
4542
- /** @nocollapse */ SubformMagicComponent.ɵcmp = ɵɵdefineComponent({ type: SubformMagicComponent, selectors: [["magic-subform"]], inputs: { magic: "magic" }, decls: 1, vars: 1, consts: [[3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"]], template: function SubformMagicComponent_Template(rf, ctx) { if (rf & 1) {
4543
- ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
3471
+ SubformMagicComponent.ɵfac = function SubformMagicComponent_Factory(t) { return new (t || SubformMagicComponent)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(SubformMagicService)); };
3472
+ SubformMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SubformMagicComponent, selectors: [["magic-subform"]], inputs: { magic: "magic" }, decls: 1, vars: 1, consts: [[3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"]], template: function SubformMagicComponent_Template(rf, ctx) { if (rf & 1) {
3473
+ i0.ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
4544
3474
  } if (rf & 2) {
4545
- ɵɵproperty("ngIf", ctx.Component);
4546
- } }, directives: [NgIf, DynamicComponent, DynamicIoDirective], encapsulation: 2 });
4547
- /*@__PURE__*/ (function () { ɵsetClassMetadata(SubformMagicComponent, [{
3475
+ i0.ɵɵproperty("ngIf", ctx.Component);
3476
+ } }, directives: [i1.NgIf, i3.DynamicComponent, i3.DynamicIoDirective], encapsulation: 2 });
3477
+ (function () { i0.ɵsetClassMetadata(SubformMagicComponent, [{
4548
3478
  type: Component,
4549
3479
  args: [{
4550
3480
  selector: 'magic-subform',
@@ -4556,52 +3486,42 @@ class SubformMagicComponent {
4556
3486
  </ndc-dynamic>
4557
3487
  `
4558
3488
  }]
4559
- }], function () { return [{ type: ViewContainerRef }, { type: SubformMagicService }]; }, { magic: [{
3489
+ }], function () { return [{ type: i0.ViewContainerRef }, { type: SubformMagicService }]; }, { magic: [{
4560
3490
  type: Input,
4561
3491
  args: ['magic']
4562
3492
  }] }); })();
4563
3493
 
4564
- const _c0$2 = ["customContent"];
3494
+ const _c0$1 = ["customContent"];
4565
3495
  function ErrorMagicComponent_div_0_span_4_Template(rf, ctx) { if (rf & 1) {
4566
- ɵɵelementStart(0, "span");
4567
- ɵɵtext(1);
4568
- ɵɵelementEnd();
3496
+ i0.ɵɵelementStart(0, "span");
3497
+ i0.ɵɵtext(1);
3498
+ i0.ɵɵelementEnd();
4569
3499
  } if (rf & 2) {
4570
- const ctx_r2 = ɵɵnextContext(2);
4571
- ɵɵadvance(1);
4572
- ɵɵtextInterpolate1(" ", ctx_r2.mgService.getErrMsg(ctx_r2.id, ctx_r2.rowId), " ");
3500
+ const ctx_r2 = i0.ɵɵnextContext(2);
3501
+ i0.ɵɵadvance(1);
3502
+ i0.ɵɵtextInterpolate1(" ", ctx_r2.mgService.getErrMsg(ctx_r2.id, ctx_r2.rowId), " ");
4573
3503
  } }
4574
3504
  function ErrorMagicComponent_div_0_Template(rf, ctx) { if (rf & 1) {
4575
- ɵɵelementStart(0, "div");
4576
- ɵɵelementStart(1, "div", null, 1);
4577
- ɵɵprojection(3);
4578
- ɵɵelementEnd();
4579
- ɵɵtemplate(4, ErrorMagicComponent_div_0_span_4_Template, 2, 1, "span", 0);
4580
- ɵɵelementEnd();
3505
+ i0.ɵɵelementStart(0, "div");
3506
+ i0.ɵɵelementStart(1, "div", null, 1);
3507
+ i0.ɵɵprojection(3);
3508
+ i0.ɵɵelementEnd();
3509
+ i0.ɵɵtemplate(4, ErrorMagicComponent_div_0_span_4_Template, 2, 1, "span", 0);
3510
+ i0.ɵɵelementEnd();
4581
3511
  } if (rf & 2) {
4582
- const ctx_r0 = ɵɵnextContext();
4583
- ɵɵadvance(4);
4584
- ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
3512
+ const ctx_r0 = i0.ɵɵnextContext();
3513
+ i0.ɵɵadvance(4);
3514
+ i0.ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
4585
3515
  } }
4586
- const _c1$1 = ["*"];
4587
- /**
4588
- * Represents a Magic subform
4589
- */
3516
+ const _c1 = ["*"];
4590
3517
  class ErrorMagicComponent {
4591
- /**
4592
- * @ignore
4593
- */
4594
3518
  constructor(_task, mgService, changeDetectorRef) {
4595
3519
  this._task = _task;
4596
3520
  this.mgService = mgService;
4597
3521
  this.changeDetectorRef = changeDetectorRef;
4598
- // if true - display standard magic error message, if false - customer has provides his own content and we'll use it
4599
3522
  this.defaultDisplay = true;
4600
3523
  this.rowId = "0";
4601
3524
  }
4602
- /**
4603
- * @ignore
4604
- */
4605
3525
  set magic(val) {
4606
3526
  this.id = val;
4607
3527
  }
@@ -4615,10 +3535,6 @@ class ErrorMagicComponent {
4615
3535
  this.changeDetectorRef.detectChanges();
4616
3536
  }
4617
3537
  ;
4618
- /**
4619
- * returns true if the html element has no children
4620
- * @param element
4621
- */
4622
3538
  isEmpty(element) {
4623
3539
  const nodes = element.childNodes;
4624
3540
  for (let i = 0; i < nodes.length; i++) {
@@ -4629,9 +3545,6 @@ class ErrorMagicComponent {
4629
3545
  }
4630
3546
  return true;
4631
3547
  }
4632
- /**
4633
- * @ignore
4634
- */
4635
3548
  HasErrors(id) {
4636
3549
  if (!isUndefined(id)) {
4637
3550
  let control = this._task.getFormControl(this.rowId, id);
@@ -4653,19 +3566,19 @@ class ErrorMagicComponent {
4653
3566
  return false;
4654
3567
  }
4655
3568
  }
4656
- /** @nocollapse */ ErrorMagicComponent.ɵfac = function ErrorMagicComponent_Factory(t) { return new (t || ErrorMagicComponent)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(AccessorMagicService), ɵɵdirectiveInject(ChangeDetectorRef)); };
4657
- /** @nocollapse */ ErrorMagicComponent.ɵcmp = ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
4658
- ɵɵviewQuery(_c0$2, true);
3569
+ ErrorMagicComponent.ɵfac = function ErrorMagicComponent_Factory(t) { return new (t || ErrorMagicComponent)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(AccessorMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
3570
+ ErrorMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
3571
+ i0.ɵɵviewQuery(_c0$1, true);
4659
3572
  } if (rf & 2) {
4660
3573
  var _t;
4661
- ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.CustomContent = _t.first);
4662
- } }, inputs: { magic: "magic", rowId1: ["rowId", "rowId1"] }, ngContentSelectors: _c1$1, decls: 1, vars: 1, consts: [[4, "ngIf"], ["customContent", ""]], template: function ErrorMagicComponent_Template(rf, ctx) { if (rf & 1) {
4663
- ɵɵprojectionDef();
4664
- ɵɵtemplate(0, ErrorMagicComponent_div_0_Template, 5, 1, "div", 0);
3574
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.CustomContent = _t.first);
3575
+ } }, inputs: { magic: "magic", rowId1: ["rowId", "rowId1"] }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [[4, "ngIf"], ["customContent", ""]], template: function ErrorMagicComponent_Template(rf, ctx) { if (rf & 1) {
3576
+ i0.ɵɵprojectionDef();
3577
+ i0.ɵɵtemplate(0, ErrorMagicComponent_div_0_Template, 5, 1, "div", 0);
4665
3578
  } if (rf & 2) {
4666
- ɵɵproperty("ngIf", ctx.HasErrors(ctx.id));
4667
- } }, directives: [NgIf], encapsulation: 2 });
4668
- /*@__PURE__*/ (function () { ɵsetClassMetadata(ErrorMagicComponent, [{
3579
+ i0.ɵɵproperty("ngIf", ctx.HasErrors(ctx.id));
3580
+ } }, directives: [i1.NgIf], encapsulation: 2 });
3581
+ (function () { i0.ɵsetClassMetadata(ErrorMagicComponent, [{
4669
3582
  type: Component,
4670
3583
  args: [{
4671
3584
  selector: 'mgError',
@@ -4679,7 +3592,7 @@ class ErrorMagicComponent {
4679
3592
  </div>
4680
3593
  `
4681
3594
  }]
4682
- }], function () { return [{ type: TaskMagicService }, { type: AccessorMagicService }, { type: ChangeDetectorRef }]; }, { magic: [{
3595
+ }], function () { return [{ type: TaskMagicService }, { type: AccessorMagicService }, { type: i0.ChangeDetectorRef }]; }, { magic: [{
4683
3596
  type: Input,
4684
3597
  args: ['magic']
4685
3598
  }], rowId1: [{
@@ -4690,28 +3603,19 @@ class ErrorMagicComponent {
4690
3603
  args: ['customContent', { static: false }]
4691
3604
  }] }); })();
4692
3605
 
4693
- /**
4694
- * Directive for checkboxes, to handle the 'change' event
4695
- */
4696
3606
  class CheckboxMagicDirective {
4697
- /**
4698
- * @ignore
4699
- */
4700
3607
  constructor(magicDirective) {
4701
3608
  this.magicDirective = magicDirective;
4702
3609
  }
4703
- /**
4704
- * Handles the Checkbox 'change' event - pass it to the Magic engine
4705
- */
4706
3610
  onChange($event) {
4707
3611
  this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4708
3612
  }
4709
3613
  }
4710
- /** @nocollapse */ CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
4711
- /** @nocollapse */ CheckboxMagicDirective.ɵdir = ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4712
- ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
3614
+ CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
3615
+ CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3616
+ i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4713
3617
  } } });
4714
- /*@__PURE__*/ (function () { ɵsetClassMetadata(CheckboxMagicDirective, [{
3618
+ (function () { i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
4715
3619
  type: Directive,
4716
3620
  args: [{
4717
3621
  selector: `
@@ -4723,25 +3627,19 @@ class CheckboxMagicDirective {
4723
3627
  args: ['change', ['$event']]
4724
3628
  }] }); })();
4725
3629
 
4726
- /**
4727
- * Directive for comboboxes, to handle the 'change' event
4728
- */
4729
3630
  class ComboboxMagicDirective {
4730
3631
  constructor(magicDirective) {
4731
3632
  this.magicDirective = magicDirective;
4732
3633
  }
4733
- /**
4734
- * Handles the Combobox 'change' event - pass it to the Magic engine
4735
- */
4736
3634
  onChange($event) {
4737
3635
  this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4738
3636
  }
4739
3637
  }
4740
- /** @nocollapse */ ComboboxMagicDirective.ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
4741
- /** @nocollapse */ ComboboxMagicDirective.ɵdir = ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4742
- ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
3638
+ ComboboxMagicDirective.ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
3639
+ ComboboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3640
+ i0.ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4743
3641
  } } });
4744
- /*@__PURE__*/ (function () { ɵsetClassMetadata(ComboboxMagicDirective, [{
3642
+ (function () { i0.ɵsetClassMetadata(ComboboxMagicDirective, [{
4745
3643
  type: Directive,
4746
3644
  args: [{
4747
3645
  selector: `select[magic]:not([multiple])`,
@@ -4751,56 +3649,38 @@ class ComboboxMagicDirective {
4751
3649
  args: ['change', ['$event']]
4752
3650
  }] }); })();
4753
3651
 
4754
- /**
4755
- * This service supports custom actions on magic exit
4756
- */
4757
3652
  class ExitMagicService {
4758
- /**
4759
- * Override this method to implement custom logic on magic exit
4760
- */
4761
3653
  exitMagic() {
4762
3654
  console.log("Magic application terminated");
4763
3655
  }
4764
3656
  }
4765
- /** @nocollapse */ ExitMagicService.ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
4766
- /** @nocollapse */ ExitMagicService.ɵprov = ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
4767
- /*@__PURE__*/ (function () { ɵsetClassMetadata(ExitMagicService, [{
3657
+ ExitMagicService.ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
3658
+ ExitMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
3659
+ (function () { i0.ɵsetClassMetadata(ExitMagicService, [{
4768
3660
  type: Injectable
4769
3661
  }], null, null); })();
4770
3662
 
4771
- const _c0$3 = ["magicRoot"];
3663
+ const _c0 = ["magicRoot"];
4772
3664
  function MagicShellComponent_ndc_dynamic_2_Template(rf, ctx) { if (rf & 1) {
4773
- ɵɵelement(0, "ndc-dynamic", 6);
3665
+ i0.ɵɵelement(0, "ndc-dynamic", 6);
4774
3666
  } if (rf & 2) {
4775
- const ctx_r1 = ɵɵnextContext();
4776
- ɵɵproperty("ndcDynamicComponent", ctx_r1.RootComponent)("ndcDynamicInputs", ctx_r1.RootComponentParameters);
3667
+ const ctx_r1 = i0.ɵɵnextContext();
3668
+ i0.ɵɵproperty("ndcDynamicComponent", ctx_r1.RootComponent)("ndcDynamicInputs", ctx_r1.RootComponentParameters);
4777
3669
  } }
4778
3670
  function MagicShellComponent_div_5_Template(rf, ctx) { if (rf & 1) {
4779
- ɵɵelementStart(0, "div", 7);
4780
- ɵɵelementContainer(1, 8);
4781
- ɵɵelementEnd();
3671
+ i0.ɵɵelementStart(0, "div", 7);
3672
+ i0.ɵɵelementContainer(1, 8);
3673
+ i0.ɵɵelementEnd();
4782
3674
  } if (rf & 2) {
4783
- const ctx_r3 = ɵɵnextContext();
4784
- const _r4 = ɵɵreference(7);
4785
- ɵɵadvance(1);
4786
- ɵɵproperty("ngTemplateOutlet", ctx_r3.SpinnerTemplate ? ctx_r3.SpinnerTemplate : _r4);
3675
+ const ctx_r3 = i0.ɵɵnextContext();
3676
+ const _r4 = i0.ɵɵreference(7);
3677
+ i0.ɵɵadvance(1);
3678
+ i0.ɵɵproperty("ngTemplateOutlet", ctx_r3.SpinnerTemplate ? ctx_r3.SpinnerTemplate : _r4);
4787
3679
  } }
4788
3680
  function MagicShellComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
4789
- ɵɵelement(0, "div", 9);
3681
+ i0.ɵɵelement(0, "div", 9);
4790
3682
  } }
4791
- /**
4792
- * Root Magic component
4793
- */
4794
3683
  class MagicShellComponent {
4795
- /**
4796
- *
4797
- * @param magic Magic's service
4798
- * @param componentList Magic component list
4799
- * @param changeDetectorRef Changes detector
4800
- * @param titleService Title setting service
4801
- * @param httpClient The native httpClient instance
4802
- * @param exitMagicService Magic exit service
4803
- */
4804
3684
  constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, exitMagicService) {
4805
3685
  this.engineMagicService = engineMagicService;
4806
3686
  this.componentList = componentList;
@@ -4810,32 +3690,22 @@ class MagicShellComponent {
4810
3690
  this.httpClient = httpClient;
4811
3691
  this.pendingCommandsCollector = pendingCommandsCollector;
4812
3692
  this.exitMagicService = exitMagicService;
4813
- /**
4814
- * Root component to be displayed in the window
4815
- */
4816
3693
  this.RootComponent = null;
4817
3694
  this.magicEngineTerminated = false;
4818
3695
  this.initialize();
4819
3696
  this.setTitle();
4820
3697
  }
4821
- /**
4822
- * Before-unload event listener
4823
- * @param event
4824
- */
4825
3698
  onBeforeUnload(event) {
4826
3699
  if (this.engineMagicService.TransCacheExists()) {
4827
- // Show the confirmation box before unloading the browser
4828
3700
  event.returnValue = 'Are you sure?';
4829
3701
  return 'Are you sure?';
4830
3702
  }
4831
3703
  else {
4832
- // terminate the magic server context using fetch API with keep-alive
4833
3704
  this.engineMagicService.TerminateContextUsingFetchAPI();
4834
3705
  this.magicEngineTerminated = true;
4835
3706
  }
4836
3707
  }
4837
3708
  onUnload(event) {
4838
- // Chrome provides an opportunity to terminate the context after user approves the browser unload alert
4839
3709
  if (!this.magicEngineTerminated)
4840
3710
  this.engineMagicService.TerminateContextUsingFetchAPI();
4841
3711
  }
@@ -4846,26 +3716,13 @@ class MagicShellComponent {
4846
3716
  setViewContainerRef(vcRef) {
4847
3717
  this.overlayWindowsContainerViewRef = vcRef;
4848
3718
  }
4849
- /**
4850
- * Initialization of Magic mechanisms
4851
- */
4852
3719
  initialize() {
4853
3720
  this.registerUICommands();
4854
3721
  }
4855
- /**
4856
- * Set the title
4857
- */
4858
3722
  setTitle() {
4859
3723
  const newTitle = this.componentList.title;
4860
3724
  this.titleService.setTitle(newTitle);
4861
3725
  }
4862
- /**
4863
- * Set the component according to requested form
4864
- * @param formName Name of the form to open
4865
- * @param taskId Id of opening task
4866
- * @param taskDescription TODO
4867
- * @param isModal whether modal window is being opened
4868
- */
4869
3726
  setComponent(formName, taskId, taskDescription, isModal) {
4870
3727
  this.pendingCommandsCollector.startCollecting();
4871
3728
  if (isModal) {
@@ -4877,9 +3734,6 @@ class MagicShellComponent {
4877
3734
  }
4878
3735
  this.changeDetectorRef.detectChanges();
4879
3736
  }
4880
- /**
4881
- * @ignore
4882
- */
4883
3737
  registerUICommands() {
4884
3738
  this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
4885
3739
  .subscribe(command => {
@@ -4891,10 +3745,6 @@ class MagicShellComponent {
4891
3745
  GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
4892
3746
  });
4893
3747
  }
4894
- /**
4895
- * Execute commands received from the Magic WebClient engine
4896
- * @param command
4897
- */
4898
3748
  executeCommand(command) {
4899
3749
  switch (command.CommandType) {
4900
3750
  case CommandType.OPEN_FORM:
@@ -4909,7 +3759,7 @@ class MagicShellComponent {
4909
3759
  this.RootComponentParameters = {};
4910
3760
  this.changeDetectorRef.detectChanges();
4911
3761
  }
4912
- else { // Close modal window
3762
+ else {
4913
3763
  this.overlayWindowService.close(command.str);
4914
3764
  this.changeDetectorRef.detectChanges();
4915
3765
  }
@@ -4927,39 +3777,38 @@ class MagicShellComponent {
4927
3777
  if (this.exitMagicService)
4928
3778
  this.exitMagicService.exitMagic();
4929
3779
  break;
3780
+ case CommandType.SHOW_HTML_ERROR:
3781
+ window.document.write(command.str);
3782
+ break;
4930
3783
  }
4931
3784
  }
4932
3785
  }
4933
- /** @nocollapse */ MagicShellComponent.ɵfac = function MagicShellComponent_Factory(t) { return new (t || MagicShellComponent)(ɵɵdirectiveInject(EngineMagicService), ɵɵdirectiveInject(ComponentListMagicService), ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(Title), ɵɵdirectiveInject(OverlayWindowService), ɵɵdirectiveInject(HttpClient), ɵɵdirectiveInject(CommandsCollectorMagicService), ɵɵdirectiveInject(ExitMagicService, 8)); };
4934
- /** @nocollapse */ MagicShellComponent.ɵcmp = ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
4935
- ɵɵstaticViewQuery(_c0$3, true);
3786
+ MagicShellComponent.ɵfac = function MagicShellComponent_Factory(t) { return new (t || MagicShellComponent)(i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$1.Title), i0.ɵɵdirectiveInject(OverlayWindowService), i0.ɵɵdirectiveInject(i5.HttpClient), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(ExitMagicService, 8)); };
3787
+ MagicShellComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
3788
+ i0.ɵɵstaticViewQuery(_c0, true);
4936
3789
  } if (rf & 2) {
4937
3790
  var _t;
4938
- ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
3791
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
4939
3792
  } }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) { if (rf & 1) {
4940
- ɵɵlistener("beforeunload", function MagicShellComponent_beforeunload_HostBindingHandler($event) { return ctx.onBeforeUnload($event); }, false, ɵɵresolveWindow)("unload", function MagicShellComponent_unload_HostBindingHandler($event) { return ctx.onUnload($event); }, false, ɵɵresolveWindow);
4941
- } }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, features: [ɵɵProvidersFeature([
4942
- // ExitMagicService
4943
- ])], decls: 8, vars: 2, consts: [["magicRoot", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], ["magicViewContainerRef", ""], ["overlayWindowsContainer", ""], ["class", "spinner-background", 4, "ngIf"], ["defaultSpinner", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs"], [1, "spinner-background"], [3, "ngTemplateOutlet"], [1, "mgSpinnerClass"]], template: function MagicShellComponent_Template(rf, ctx) { if (rf & 1) {
4944
- ɵɵelementStart(0, "div", null, 0);
4945
- ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 1);
4946
- ɵɵelement(3, "div", 2, 3);
4947
- ɵɵelementEnd();
4948
- ɵɵtemplate(5, MagicShellComponent_div_5_Template, 2, 1, "div", 4);
4949
- ɵɵtemplate(6, MagicShellComponent_ng_template_6_Template, 1, 0, "ng-template", null, 5, ɵɵtemplateRefExtractor);
3793
+ i0.ɵɵlistener("beforeunload", function MagicShellComponent_beforeunload_HostBindingHandler($event) { return ctx.onBeforeUnload($event); }, false, i0.ɵɵresolveWindow)("unload", function MagicShellComponent_unload_HostBindingHandler($event) { return ctx.onUnload($event); }, false, i0.ɵɵresolveWindow);
3794
+ } }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, features: [i0.ɵɵProvidersFeature([])], decls: 8, vars: 2, consts: [["magicRoot", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], ["magicViewContainerRef", ""], ["overlayWindowsContainer", ""], ["class", "spinner-background", 4, "ngIf"], ["defaultSpinner", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs"], [1, "spinner-background"], [3, "ngTemplateOutlet"], [1, "mgSpinnerClass"]], template: function MagicShellComponent_Template(rf, ctx) { if (rf & 1) {
3795
+ i0.ɵɵelementStart(0, "div", null, 0);
3796
+ i0.ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 1);
3797
+ i0.ɵɵelement(3, "div", 2, 3);
3798
+ i0.ɵɵelementEnd();
3799
+ i0.ɵɵtemplate(5, MagicShellComponent_div_5_Template, 2, 1, "div", 4);
3800
+ i0.ɵɵtemplate(6, MagicShellComponent_ng_template_6_Template, 1, 0, "ng-template", null, 5, i0.ɵɵtemplateRefExtractor);
4950
3801
  } if (rf & 2) {
4951
- ɵɵadvance(2);
4952
- ɵɵproperty("ngIf", ctx.RootComponent !== null);
4953
- ɵɵadvance(3);
4954
- ɵɵproperty("ngIf", ctx.showSpinner);
4955
- } }, directives: [NgIf, MagicViewContainerRef, DynamicComponent, DynamicIoDirective, NgTemplateOutlet], styles: [".mgSpinnerClass[_ngcontent-%COMP%] {\n border: 10px solid #cccccc; \n border-top: 10px solid black; \n border-radius: 50%;\n position: fixed;\n margin: auto;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100px;\n height: 100px;\n animation: spin 2s linear infinite;\n }\n .spinner-background[_ngcontent-%COMP%] {\n \n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n z-index: 1000;\n left: 0;\n opacity: 0.5;\n }\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }"] });
4956
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicShellComponent, [{
3802
+ i0.ɵɵadvance(2);
3803
+ i0.ɵɵproperty("ngIf", ctx.RootComponent !== null);
3804
+ i0.ɵɵadvance(3);
3805
+ i0.ɵɵproperty("ngIf", ctx.showSpinner);
3806
+ } }, directives: [i1.NgIf, MagicViewContainerRef, i3.DynamicComponent, i3.DynamicIoDirective, i1.NgTemplateOutlet], styles: [".mgSpinnerClass[_ngcontent-%COMP%] {\n border: 10px solid #cccccc; \n border-top: 10px solid black; \n border-radius: 50%;\n position: fixed;\n margin: auto;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100px;\n height: 100px;\n animation: spin 2s linear infinite;\n }\n .spinner-background[_ngcontent-%COMP%] {\n \n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n z-index: 1000;\n left: 0;\n opacity: 0.5;\n }\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }"] });
3807
+ (function () { i0.ɵsetClassMetadata(MagicShellComponent, [{
4957
3808
  type: Component,
4958
3809
  args: [{
4959
3810
  selector: 'magic-root',
4960
- providers: [
4961
- // ExitMagicService
4962
- ],
3811
+ providers: [],
4963
3812
  template: `
4964
3813
  <div #magicRoot>
4965
3814
  <ndc-dynamic
@@ -5011,7 +3860,7 @@ class MagicShellComponent {
5011
3860
  }
5012
3861
  `]
5013
3862
  }]
5014
- }], function () { return [{ type: EngineMagicService }, { type: ComponentListMagicService }, { type: ChangeDetectorRef }, { type: Title }, { type: OverlayWindowService }, { type: HttpClient }, { type: CommandsCollectorMagicService }, { type: ExitMagicService, decorators: [{
3863
+ }], function () { return [{ type: EngineMagicService }, { type: ComponentListMagicService }, { type: i0.ChangeDetectorRef }, { type: i1$1.Title }, { type: OverlayWindowService }, { type: i5.HttpClient }, { type: CommandsCollectorMagicService }, { type: ExitMagicService, decorators: [{
5015
3864
  type: Optional
5016
3865
  }] }]; }, { rootMagicElementRef: [{
5017
3866
  type: ViewChild,
@@ -5026,25 +3875,19 @@ class MagicShellComponent {
5026
3875
  args: ['window:unload', ['$event']]
5027
3876
  }] }); })();
5028
3877
 
5029
- /**
5030
- * @ignore
5031
- */
5032
3878
  const CHECKBOX_VALUE_ACCESSOR = {
5033
3879
  provide: NG_VALUE_ACCESSOR,
5034
3880
  useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
5035
3881
  multi: true,
5036
3882
  };
5037
- /**
5038
- * Value accessor for Checkbox without a FormControl
5039
- */
5040
3883
  class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
5041
3884
  }
5042
- /** @nocollapse */ MagicCheckboxControlValueAccessor.ɵfac = function MagicCheckboxControlValueAccessor_Factory(t) { return ɵMagicCheckboxControlValueAccessor_BaseFactory(t || MagicCheckboxControlValueAccessor); };
5043
- /** @nocollapse */ MagicCheckboxControlValueAccessor.ɵdir = ɵɵdefineDirective({ type: MagicCheckboxControlValueAccessor, selectors: [["input", "type", "checkbox", "magic", "", 3, "formControlName", "", 3, "no-form-control", ""], ["input", "type", "checkbox", "magic", "", 3, "formControl", ""], ["input", "type", "checkbox", "magic", "", 3, "ngModel", ""]], hostBindings: function MagicCheckboxControlValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
5044
- ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
5045
- } }, features: [ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), ɵɵInheritDefinitionFeature] });
5046
- const ɵMagicCheckboxControlValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor);
5047
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
3885
+ MagicCheckboxControlValueAccessor.ɵfac = function MagicCheckboxControlValueAccessor_Factory(t) { return ɵMagicCheckboxControlValueAccessor_BaseFactory(t || MagicCheckboxControlValueAccessor); };
3886
+ MagicCheckboxControlValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: MagicCheckboxControlValueAccessor, selectors: [["input", "type", "checkbox", "magic", "", 3, "formControlName", "", 3, "no-form-control", ""], ["input", "type", "checkbox", "magic", "", 3, "formControl", ""], ["input", "type", "checkbox", "magic", "", 3, "ngModel", ""]], hostBindings: function MagicCheckboxControlValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
3887
+ i0.ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
3888
+ } }, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
3889
+ const ɵMagicCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor);
3890
+ (function () { i0.ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
5048
3891
  type: Directive,
5049
3892
  args: [{
5050
3893
  selector: `
@@ -5057,25 +3900,19 @@ const ɵMagicCheckboxControlValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInh
5057
3900
  }]
5058
3901
  }], null, null); })();
5059
3902
 
5060
- /**
5061
- * @ignore
5062
- */
5063
3903
  const MAGIC_DEFAULT_VALUE_ACCESSOR = {
5064
3904
  provide: NG_VALUE_ACCESSOR,
5065
3905
  useExisting: forwardRef(() => MagicDefaultValueAccessor),
5066
3906
  multi: true
5067
3907
  };
5068
- /**
5069
- * @ignore
5070
- */
5071
3908
  class MagicDefaultValueAccessor extends DefaultValueAccessor {
5072
3909
  }
5073
- /** @nocollapse */ MagicDefaultValueAccessor.ɵfac = function MagicDefaultValueAccessor_Factory(t) { return ɵMagicDefaultValueAccessor_BaseFactory(t || MagicDefaultValueAccessor); };
5074
- /** @nocollapse */ MagicDefaultValueAccessor.ɵdir = ɵɵdefineDirective({ type: MagicDefaultValueAccessor, selectors: [["input", "magic", "", 3, "type", "checkbox", 3, "formControlName", "", 3, "no-form-control", ""], ["textarea", "magic", "", 3, "formControlName", "", 3, "noFormControl", "", 3, "no-form-control", ""]], hostBindings: function MagicDefaultValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
5075
- ɵɵlistener("input", function MagicDefaultValueAccessor_input_HostBindingHandler($event) { return ctx._handleInput($event.target.value); })("blur", function MagicDefaultValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); })("compositionstart", function MagicDefaultValueAccessor_compositionstart_HostBindingHandler() { return ctx._compositionStart(); })("compositionend", function MagicDefaultValueAccessor_compositionend_HostBindingHandler($event) { return ctx._compositionEnd($event.target.value); });
5076
- } }, exportAs: ["magic"], features: [ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), ɵɵInheritDefinitionFeature] });
5077
- const ɵMagicDefaultValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFactory(MagicDefaultValueAccessor);
5078
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicDefaultValueAccessor, [{
3910
+ MagicDefaultValueAccessor.ɵfac = function MagicDefaultValueAccessor_Factory(t) { return ɵMagicDefaultValueAccessor_BaseFactory(t || MagicDefaultValueAccessor); };
3911
+ MagicDefaultValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: MagicDefaultValueAccessor, selectors: [["input", "magic", "", 3, "type", "checkbox", 3, "formControlName", "", 3, "no-form-control", ""], ["textarea", "magic", "", 3, "formControlName", "", 3, "noFormControl", "", 3, "no-form-control", ""]], hostBindings: function MagicDefaultValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
3912
+ i0.ɵɵlistener("input", function MagicDefaultValueAccessor_input_HostBindingHandler($event) { return ctx._handleInput($event.target.value); })("blur", function MagicDefaultValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); })("compositionstart", function MagicDefaultValueAccessor_compositionstart_HostBindingHandler() { return ctx._compositionStart(); })("compositionend", function MagicDefaultValueAccessor_compositionend_HostBindingHandler($event) { return ctx._compositionEnd($event.target.value); });
3913
+ } }, exportAs: ["magic"], features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
3914
+ const ɵMagicDefaultValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicDefaultValueAccessor);
3915
+ (function () { i0.ɵsetClassMetadata(MagicDefaultValueAccessor, [{
5079
3916
  type: Directive,
5080
3917
  args: [{
5081
3918
  selector: `
@@ -5093,25 +3930,19 @@ const ɵMagicDefaultValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFa
5093
3930
  }]
5094
3931
  }], null, null); })();
5095
3932
 
5096
- /**
5097
- * Directive for checkboxes which should not have a form control
5098
- */
5099
3933
  class CheckboxNoFormControlMagicDirective {
5100
3934
  constructor(magicDirective) {
5101
3935
  this.magicDirective = magicDirective;
5102
3936
  }
5103
- /**
5104
- * Handle the 'Checkbox' change event - pass it to the Magic engine
5105
- */
5106
3937
  onChange($event) {
5107
3938
  this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
5108
3939
  }
5109
3940
  }
5110
- /** @nocollapse */ CheckboxNoFormControlMagicDirective.ɵfac = function CheckboxNoFormControlMagicDirective_Factory(t) { return new (t || CheckboxNoFormControlMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
5111
- /** @nocollapse */ CheckboxNoFormControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
5112
- ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
3941
+ CheckboxNoFormControlMagicDirective.ɵfac = function CheckboxNoFormControlMagicDirective_Factory(t) { return new (t || CheckboxNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
3942
+ CheckboxNoFormControlMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3943
+ i0.ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
5113
3944
  } } });
5114
- /*@__PURE__*/ (function () { ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
3945
+ (function () { i0.ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
5115
3946
  type: Directive,
5116
3947
  args: [{
5117
3948
  selector: `
@@ -5123,25 +3954,19 @@ class CheckboxNoFormControlMagicDirective {
5123
3954
  args: ['change', ['$event']]
5124
3955
  }] }); })();
5125
3956
 
5126
- /**
5127
- * Directive for non-checkbox input controls which do not have a form control
5128
- */
5129
3957
  class InputNoFormControlMagicDirective {
5130
3958
  constructor(magicDirective) {
5131
3959
  this.magicDirective = magicDirective;
5132
3960
  }
5133
- /**
5134
- * Handles the 'change' event - pass it to the Magic engine
5135
- */
5136
3961
  onChange($event) {
5137
3962
  this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
5138
3963
  }
5139
3964
  }
5140
- /** @nocollapse */ InputNoFormControlMagicDirective.ɵfac = function InputNoFormControlMagicDirective_Factory(t) { return new (t || InputNoFormControlMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
5141
- /** @nocollapse */ InputNoFormControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: InputNoFormControlMagicDirective, selectors: [["input", "magic", "", "noFormControl", "", 3, "type", "checkbox"], ["textarea", "magic", "", "noFormControl", "", 3, "type", "checkbox"]], hostBindings: function InputNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
5142
- ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
3965
+ InputNoFormControlMagicDirective.ɵfac = function InputNoFormControlMagicDirective_Factory(t) { return new (t || InputNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
3966
+ InputNoFormControlMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: InputNoFormControlMagicDirective, selectors: [["input", "magic", "", "noFormControl", "", 3, "type", "checkbox"], ["textarea", "magic", "", "noFormControl", "", 3, "type", "checkbox"]], hostBindings: function InputNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3967
+ i0.ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
5143
3968
  } } });
5144
- /*@__PURE__*/ (function () { ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
3969
+ (function () { i0.ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
5145
3970
  type: Directive,
5146
3971
  args: [{
5147
3972
  selector: `input[magic]:([noFormControl]):not([type=checkbox]),
@@ -5157,14 +3982,6 @@ const DATE_VALUE_ACCESSOR = {
5157
3982
  useExisting: forwardRef(() => DateValueAccessor),
5158
3983
  multi: true
5159
3984
  };
5160
- /**
5161
- * The accessor for writing a value and listening to changes on a date input element
5162
- *
5163
- * ### Example
5164
- * `<input type="date" name="birthday" ngModel dateInput>`
5165
- * OR
5166
- * `<input type="date" formControlName="birthday" dateInput>`
5167
- */
5168
3985
  class DateValueAccessor {
5169
3986
  constructor(renderer, elementRef) {
5170
3987
  this.renderer = renderer;
@@ -5172,7 +3989,6 @@ class DateValueAccessor {
5172
3989
  this.onChange = (_) => { };
5173
3990
  this.onTouched = () => { };
5174
3991
  }
5175
- /** Writes a new value to the element (model -> view) */
5176
3992
  writeValue(value) {
5177
3993
  if (!value) {
5178
3994
  this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
@@ -5180,32 +3996,29 @@ class DateValueAccessor {
5180
3996
  }
5181
3997
  this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
5182
3998
  }
5183
- /** Registers a callback function, called when value changes (view -> model) */
5184
3999
  registerOnChange(fn) {
5185
4000
  this.onChange = v => fn(v instanceof Date
5186
4001
  ? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
5187
4002
  : v);
5188
4003
  }
5189
- /** Registers a callback function, called when the control is blurred */
5190
4004
  registerOnTouched(fn) {
5191
4005
  this.onTouched = fn;
5192
4006
  }
5193
- /** Enables or disables the element when the control status changes */
5194
4007
  setDisabledState(isDisabled) {
5195
4008
  this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
5196
4009
  }
5197
4010
  }
5198
- /** @nocollapse */ DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ElementRef)); };
5199
- /** @nocollapse */ DateValueAccessor.ɵdir = ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
5200
- ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
5201
- } }, features: [ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
5202
- /*@__PURE__*/ (function () { ɵsetClassMetadata(DateValueAccessor, [{
4011
+ DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef)); };
4012
+ DateValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
4013
+ i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
4014
+ } }, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
4015
+ (function () { i0.ɵsetClassMetadata(DateValueAccessor, [{
5203
4016
  type: Directive,
5204
4017
  args: [{
5205
4018
  selector: "[dateInput]",
5206
4019
  providers: [DATE_VALUE_ACCESSOR]
5207
4020
  }]
5208
- }], function () { return [{ type: Renderer2 }, { type: ElementRef }]; }, { onChange: [{
4021
+ }], function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, { onChange: [{
5209
4022
  type: HostListener,
5210
4023
  args: ["input", ["$event.target.valueAsDate"]]
5211
4024
  }], onTouched: [{
@@ -5213,25 +4026,12 @@ class DateValueAccessor {
5213
4026
  args: ["blur", []]
5214
4027
  }] }); })();
5215
4028
 
5216
- /**
5217
- * Responsible for connecting HTML elements to the Magic WebClient engine showing it is not Magic Control but a Dummy control which is used to notify only receeive focus event for now
5218
- */
5219
4029
  class NonMagicControlDirective {
5220
- /**
5221
- *
5222
- * @param _task The task service
5223
- * @param element The element for which the directive is applied
5224
- * @param renderer Renderer for the element
5225
- * @param vcRef
5226
- */
5227
4030
  constructor(_task, element, renderer, vcRef) {
5228
4031
  this._task = _task;
5229
4032
  this.element = element;
5230
4033
  this.renderer = renderer;
5231
4034
  this.vcRef = vcRef;
5232
- /**
5233
- * Collection of event handlers for this element
5234
- */
5235
4035
  this.eventHandlers = {};
5236
4036
  this.eventsOnlyVal = false;
5237
4037
  this.htmlElement = this.element.nativeElement;
@@ -5241,52 +4041,35 @@ class NonMagicControlDirective {
5241
4041
  this.selector = 'NonMagicControl';
5242
4042
  }
5243
4043
  ;
5244
- /**
5245
- * Get the task service
5246
- * @returns
5247
- */
5248
4044
  get task() {
5249
4045
  return this._task;
5250
4046
  }
5251
- /**
5252
- * Register to the events this element may need to handle
5253
- */
5254
4047
  regEvents() {
5255
- // Handle events for which event handler may be removed and restored
5256
4048
  this.eventHandlers['focusin'] = this.OnFocus.bind(this);
5257
4049
  Object.keys(this.eventHandlers).forEach((key) => {
5258
4050
  this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
5259
4051
  });
5260
4052
  }
5261
- /**
5262
- * Handle focus event
5263
- */
5264
4053
  OnFocus() {
5265
4054
  this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', "", -1));
5266
4055
  event.cancelBubble = true;
5267
4056
  }
5268
- /**
5269
- * Initialize this object
5270
- */
5271
4057
  ngOnInit() {
5272
4058
  this.regEvents();
5273
4059
  }
5274
4060
  }
5275
- /** @nocollapse */ NonMagicControlDirective.ɵfac = function NonMagicControlDirective_Factory(t) { return new (t || NonMagicControlDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef)); };
5276
- /** @nocollapse */ NonMagicControlDirective.ɵdir = ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: ["NonMagicControl", "magic"] } });
5277
- /*@__PURE__*/ (function () { ɵsetClassMetadata(NonMagicControlDirective, [{
4061
+ NonMagicControlDirective.ɵfac = function NonMagicControlDirective_Factory(t) { return new (t || NonMagicControlDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
4062
+ NonMagicControlDirective.ɵdir = i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: ["NonMagicControl", "magic"] } });
4063
+ (function () { i0.ɵsetClassMetadata(NonMagicControlDirective, [{
5278
4064
  type: Directive,
5279
4065
  args: [{
5280
4066
  selector: '[NonMagicControl]'
5281
4067
  }]
5282
- }], function () { return [{ type: TaskMagicService }, { type: ElementRef }, { type: Renderer2 }, { type: ViewContainerRef }]; }, { magic: [{
4068
+ }], function () { return [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }]; }, { magic: [{
5283
4069
  type: Input,
5284
4070
  args: ['NonMagicControl']
5285
4071
  }] }); })();
5286
4072
 
5287
- /**
5288
- * @ignore
5289
- */
5290
4073
  const decs = [
5291
4074
  MagicDirective,
5292
4075
  CheckboxMagicDirective,
@@ -5317,9 +4100,6 @@ const decs = [
5317
4100
  MagicFocusDirective,
5318
4101
  MagicViewContainerRef
5319
4102
  ];
5320
- /**
5321
- * @ignore
5322
- */
5323
4103
  class MagicModule {
5324
4104
  static forRoot() {
5325
4105
  return {
@@ -5334,17 +4114,16 @@ class MagicModule {
5334
4114
  };
5335
4115
  }
5336
4116
  }
5337
- /** @nocollapse */ MagicModule.ɵmod = ɵɵdefineNgModule({ type: MagicModule });
5338
- /** @nocollapse */ MagicModule.ɵinj = ɵɵdefineInjector({ factory: function MagicModule_Factory(t) { return new (t || MagicModule)(); }, providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [[
4117
+ MagicModule.ɵmod = i0.ɵɵdefineNgModule({ type: MagicModule });
4118
+ MagicModule.ɵinj = i0.ɵɵdefineInjector({ factory: function MagicModule_Factory(t) { return new (t || MagicModule)(); }, providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [[
5339
4119
  CommonModule,
5340
4120
  FormsModule,
5341
4121
  ReactiveFormsModule,
5342
- //ThemeModule,
5343
4122
  RouterModule,
5344
4123
  DynamicModule,
5345
4124
  HttpClientModule
5346
4125
  ]] });
5347
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(MagicModule, { declarations: [MagicDirective,
4126
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MagicModule, { declarations: [MagicDirective,
5348
4127
  CheckboxMagicDirective,
5349
4128
  CheckboxNoFormControlMagicDirective,
5350
4129
  InputNoFormControlMagicDirective,
@@ -5374,7 +4153,6 @@ class MagicModule {
5374
4153
  MagicViewContainerRef], imports: [CommonModule,
5375
4154
  FormsModule,
5376
4155
  ReactiveFormsModule,
5377
- //ThemeModule,
5378
4156
  RouterModule,
5379
4157
  DynamicModule,
5380
4158
  HttpClientModule], exports: [MagicDirective,
@@ -5405,7 +4183,7 @@ class MagicModule {
5405
4183
  NonMagicControlDirective,
5406
4184
  MagicFocusDirective,
5407
4185
  MagicViewContainerRef] }); })();
5408
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MagicModule, [{
4186
+ (function () { i0.ɵsetClassMetadata(MagicModule, [{
5409
4187
  type: NgModule,
5410
4188
  args: [{
5411
4189
  declarations: [...decs],
@@ -5415,12 +4193,10 @@ class MagicModule {
5415
4193
  CommonModule,
5416
4194
  FormsModule,
5417
4195
  ReactiveFormsModule,
5418
- //ThemeModule,
5419
4196
  RouterModule,
5420
4197
  DynamicModule,
5421
4198
  HttpClientModule
5422
4199
  ],
5423
- //Customizable providers
5424
4200
  providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
5425
4201
  }]
5426
4202
  }], null, null); })();
@@ -5508,7 +4284,7 @@ class MgDateAdapter extends NativeDateAdapter {
5508
4284
  this.mgdtfmt = this.task.mgInputDateFormat;
5509
4285
  if (displayFormat === 'input') {
5510
4286
  if (this.mgdtfmt == null)
5511
- this.mgdtfmt = 'M/d/yyyy'; //default format
4287
+ this.mgdtfmt = 'M/d/yyyy';
5512
4288
  return formatDate(date, this.mgdtfmt, this.locale);
5513
4289
  }
5514
4290
  else {
@@ -5516,19 +4292,16 @@ class MgDateAdapter extends NativeDateAdapter {
5516
4292
  }
5517
4293
  }
5518
4294
  }
5519
- /** @nocollapse */ MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(ɵɵinject(Platform), ɵɵinject(TaskMagicService)); };
5520
- /** @nocollapse */ MgDateAdapter.ɵprov = ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
5521
- /*@__PURE__*/ (function () { ɵsetClassMetadata(MgDateAdapter, [{
4295
+ MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(i0.ɵɵinject(i1$2.Platform), i0.ɵɵinject(TaskMagicService)); };
4296
+ MgDateAdapter.ɵprov = i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
4297
+ (function () { i0.ɵsetClassMetadata(MgDateAdapter, [{
5522
4298
  type: Injectable
5523
- }], function () { return [{ type: Platform }, { type: TaskMagicService }]; }, null); })();
4299
+ }], function () { return [{ type: i1$2.Platform }, { type: TaskMagicService }]; }, null); })();
5524
4300
 
5525
4301
  const matDateProviders = [
5526
4302
  { provide: DateAdapter, useClass: MgDateAdapter },
5527
4303
  { provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
5528
4304
  ];
5529
- /**
5530
- * Magic service providers
5531
- */
5532
4305
  const basicMagicProviders = [
5533
4306
  MagicServices,
5534
4307
  TaskMagicService,
@@ -5542,18 +4315,7 @@ const magicProviders = [
5542
4315
  TableMagicService
5543
4316
  ];
5544
4317
 
5545
- /**
5546
- * @ignore
5547
- */
5548
- ///////////////////////////////////////////////////////////
5549
- // class to hold gui-related helper methods
5550
- ///////////////////////////////////////////////////////////
5551
4318
  class utils {
5552
- ///////////////////////////////////////////////////////////
5553
- // Add magic child control to the supplied array.
5554
- // Recursive, and checks children even if they are not magic controls.
5555
- // Magic controls are controls which have a magic directive attached to them.
5556
- ///////////////////////////////////////////////////////////
5557
4319
  static addChildren(parent, children, selector) {
5558
4320
  for (var i = 0; i < parent.children.length; i++) {
5559
4321
  if (typeof parent.children[i].attributes[selector] !== "undefined") {
@@ -5562,9 +4324,6 @@ class utils {
5562
4324
  this.addChildren(parent.children[i], children, selector);
5563
4325
  }
5564
4326
  }
5565
- ///////////////////////////////////////////////////////////
5566
- // Calculate the distance between the control and the supplied x,y coordinates
5567
- ///////////////////////////////////////////////////////////
5568
4327
  static getDistance(control, x, y) {
5569
4328
  let left = control.clientLeft, top = control.clientTop;
5570
4329
  let dx, dy;
@@ -5591,9 +4350,6 @@ class utils {
5591
4350
  const ret = (dx * dx + dy * dy);
5592
4351
  return ret;
5593
4352
  }
5594
- ///////////////////////////////////////////////////////////
5595
- //
5596
- ///////////////////////////////////////////////////////////
5597
4353
  static getDimentions(el) {
5598
4354
  let xPos = 0;
5599
4355
  let yPos = 0;
@@ -5601,14 +4357,12 @@ class utils {
5601
4357
  let height = el.height;
5602
4358
  while (el) {
5603
4359
  if (el.tagName == "BODY") {
5604
- // deal with browser quirks with body/window/document and page scroll
5605
4360
  let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
5606
4361
  let yScroll = el.scrollTop || document.documentElement.scrollTop;
5607
4362
  xPos += (el.offsetLeft - xScroll + el.clientLeft);
5608
4363
  yPos += (el.offsetTop - yScroll + el.clientTop);
5609
4364
  }
5610
4365
  else {
5611
- // for all other non-BODY elements
5612
4366
  xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
5613
4367
  yPos += (el.offsetTop - el.scrollTop + el.clientTop);
5614
4368
  }
@@ -5623,9 +4377,6 @@ class utils {
5623
4377
  }
5624
4378
  }
5625
4379
 
5626
- /**
5627
- * @ignore
5628
- */
5629
4380
  class ModalFormDefinition {
5630
4381
  constructor() {
5631
4382
  this.taskId = "";
@@ -5634,9 +4385,5 @@ class ModalFormDefinition {
5634
4385
  }
5635
4386
  }
5636
4387
 
5637
- /**
5638
- * Generated bundle index. Do not edit.
5639
- */
5640
-
5641
4388
  export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, CHECKBOX_VALUE_ACCESSOR, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_DEFAULT_VALUE_ACCESSOR, MG_FORMATS, MagicAlertComponent, MagicCheckboxControlValueAccessor, MagicConfirmationBoxComponent, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicModule, MagicOverlayContainer, MagicOverlayContainerWrapper, MagicServices, MagicShellComponent, MagicViewContainerRef, MgDateAdapter, MgDateFormatter, MgformatMagicDirective, ModalFormDefinition, NoControlMagicDirective, NonMagicControlDirective, OverlayContainerMagicProvider, OverlayWindowService, RangeValidatorMagicDirective, Records, RouteCommand, RouterCommandsMagicService, RouterContainerMagicComponent, RowMagicDirective, StylesMapManager, SubformMagicComponent, SubformMagicService, TableMagicService, TaskBaseMagicComponent, TaskMagicService, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
5642
4389
  //# sourceMappingURL=magic-xpa-angular.js.map