@magic-xpa/angular 4.1200.0-dev4120.13 → 4.1200.0-dev4120.131

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 (117) hide show
  1. package/fesm2022/magic-xpa-angular.mjs +1945 -210
  2. package/fesm2022/magic-xpa-angular.mjs.map +1 -1
  3. package/index.d.ts +3 -0
  4. package/package.json +6 -8
  5. package/src/controls.metadata.model.d.ts +16 -0
  6. package/src/interfaces/sub-form-definition.iterface.d.ts +6 -0
  7. package/src/magic.core.module.d.ts +5 -2
  8. package/src/services/OverlayWindowService.d.ts +19 -0
  9. package/src/services/StylesMapManager.d.ts +3 -0
  10. package/src/services/accessor.magic.service.d.ts +245 -3
  11. package/src/services/commands-collector.magic.service.d.ts +3 -0
  12. package/src/services/component-list.magic.service.d.ts +27 -0
  13. package/src/services/confirmation.components.magic.provider.d.ts +16 -0
  14. package/src/services/engine.magic.service.d.ts +5 -0
  15. package/src/services/exit.magic.service.d.ts +6 -0
  16. package/src/services/magic-color.service.d.ts +6 -0
  17. package/src/services/magic.providers.d.ts +3 -0
  18. package/src/services/magic.services.d.ts +6 -0
  19. package/src/services/router-commands.magic.service.d.ts +6 -0
  20. package/src/services/subform.magic.service.d.ts +28 -0
  21. package/src/services/table.magic.service.d.ts +56 -0
  22. package/src/services/task.magics.service.d.ts +305 -0
  23. package/src/services/title.magic.service.d.ts +11 -0
  24. package/src/ui/GuiInteractiveExecutor.d.ts +3 -0
  25. package/src/ui/components/base-magic-alert.component.d.ts +16 -0
  26. package/src/ui/components/base-magic-confirm.component.d.ts +18 -0
  27. package/src/ui/components/magic-alert.component.d.ts +3 -0
  28. package/src/ui/components/magic-confirmation-box.component.d.ts +3 -0
  29. package/src/ui/directives/NonMagicControlDirective.d.ts +41 -0
  30. package/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.d.ts +6 -0
  31. package/src/ui/directives/magic/checkbox.magic.directive.d.ts +12 -0
  32. package/src/ui/directives/magic/combobox.magic.directive.d.ts +9 -0
  33. package/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.d.ts +6 -0
  34. package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +13 -0
  35. package/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.d.ts +6 -0
  36. package/src/ui/directives/magic/input.noformcontrol.magic.directive.d.ts +6 -0
  37. package/src/ui/directives/magic/nocontrol.magic.directive.d.ts +3 -0
  38. package/src/ui/directives/magic/row.magic.directive.d.ts +15 -0
  39. package/src/ui/directives/magic-focus.directive.d.ts +3 -0
  40. package/src/ui/directives/magic.directive.d.ts +82 -0
  41. package/src/ui/directives/magicViewContainerRef.directive.d.ts +3 -0
  42. package/src/ui/directives/mgformat.magic.directive.d.ts +44 -0
  43. package/src/ui/directives/range-validator.magic.directive.d.ts +16 -0
  44. package/src/ui/magic-confirmationBox.d.ts +19 -0
  45. package/src/ui/magic-modal/base-magic-overlay-container.d.ts +9 -0
  46. package/src/ui/magic-modal/magic-modal-form.d.ts +3 -0
  47. package/src/ui/magic-modal/magic-modal-interface.d.ts +35 -0
  48. package/src/ui/magic-modal/magic-overlay-container-wrapper.d.ts +20 -0
  49. package/src/ui/magic-modal/magic-overlay-container.d.ts +85 -0
  50. package/src/ui/magic-root.component.d.ts +42 -0
  51. package/src/ui/mgerror.magic.component.d.ts +19 -0
  52. package/src/ui/pipes/date.magic.pipe.d.ts +6 -0
  53. package/src/ui/pipes/time.magic.pipe.d.ts +3 -0
  54. package/src/ui/router-container.magic.component.d.ts +19 -0
  55. package/src/ui/subform.magic.component.d.ts +21 -0
  56. package/src/ui/task-base.magic.component.d.ts +78 -0
  57. package/src/ui/utils.d.ts +3 -0
  58. package/esm2022/index.mjs +0 -59
  59. package/esm2022/magic-xpa-angular.mjs +0 -2
  60. package/esm2022/src/controls.metadata.model.mjs +0 -183
  61. package/esm2022/src/interfaces/sub-form-definition.iterface.mjs +0 -2
  62. package/esm2022/src/magic.core.module.mjs +0 -159
  63. package/esm2022/src/services/ISubformMagicService.mjs +0 -2
  64. package/esm2022/src/services/OverlayWindowService.mjs +0 -245
  65. package/esm2022/src/services/StylesMapManager.mjs +0 -28
  66. package/esm2022/src/services/accessor.magic.service.mjs +0 -358
  67. package/esm2022/src/services/commands-collector.magic.service.mjs +0 -47
  68. package/esm2022/src/services/component-list.magic.service.mjs +0 -45
  69. package/esm2022/src/services/confirmation.components.magic.provider.mjs +0 -21
  70. package/esm2022/src/services/engine.magic.service.mjs +0 -80
  71. package/esm2022/src/services/exit.magic.service.mjs +0 -13
  72. package/esm2022/src/services/magic-color.service.mjs +0 -101
  73. package/esm2022/src/services/magic.lazy.loader.service.mjs +0 -16
  74. package/esm2022/src/services/magic.providers.mjs +0 -25
  75. package/esm2022/src/services/magic.services.mjs +0 -36
  76. package/esm2022/src/services/mg-date-adapter.mjs +0 -108
  77. package/esm2022/src/services/overlay.conainer.magic.provider.mjs +0 -14
  78. package/esm2022/src/services/router-commands.magic.service.mjs +0 -31
  79. package/esm2022/src/services/subform.magic.service.mjs +0 -195
  80. package/esm2022/src/services/table.magic.service.mjs +0 -81
  81. package/esm2022/src/services/task.magics.service.mjs +0 -648
  82. package/esm2022/src/services/title.magic.service.mjs +0 -19
  83. package/esm2022/src/ui/GuiInteractiveExecutor.mjs +0 -114
  84. package/esm2022/src/ui/components/base-magic-alert.component.mjs +0 -24
  85. package/esm2022/src/ui/components/base-magic-confirm.component.mjs +0 -24
  86. package/esm2022/src/ui/components/magic-alert.component.mjs +0 -36
  87. package/esm2022/src/ui/components/magic-confirmation-box.component.mjs +0 -42
  88. package/esm2022/src/ui/directives/NonMagicControlDirective.mjs +0 -58
  89. package/esm2022/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.mjs +0 -29
  90. package/esm2022/src/ui/directives/magic/checkbox.magic.directive.mjs +0 -100
  91. package/esm2022/src/ui/directives/magic/combobox.magic.directive.mjs +0 -37
  92. package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.mjs +0 -27
  93. package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +0 -85
  94. package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.mjs +0 -32
  95. package/esm2022/src/ui/directives/magic/input.noformcontrol.magic.directive.mjs +0 -28
  96. package/esm2022/src/ui/directives/magic/nocontrol.magic.directive.mjs +0 -193
  97. package/esm2022/src/ui/directives/magic/row.magic.directive.mjs +0 -62
  98. package/esm2022/src/ui/directives/magic-focus.directive.mjs +0 -20
  99. package/esm2022/src/ui/directives/magic.directive.mjs +0 -232
  100. package/esm2022/src/ui/directives/magicViewContainerRef.directive.mjs +0 -20
  101. package/esm2022/src/ui/directives/mgformat.magic.directive.mjs +0 -579
  102. package/esm2022/src/ui/directives/range-validator.magic.directive.mjs +0 -60
  103. package/esm2022/src/ui/magic-confirmationBox.mjs +0 -42
  104. package/esm2022/src/ui/magic-modal/base-magic-overlay-container.mjs +0 -22
  105. package/esm2022/src/ui/magic-modal/magic-modal-form.mjs +0 -6
  106. package/esm2022/src/ui/magic-modal/magic-modal-interface.mjs +0 -2
  107. package/esm2022/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +0 -125
  108. package/esm2022/src/ui/magic-modal/magic-overlay-container.mjs +0 -162
  109. package/esm2022/src/ui/magic-root.component.mjs +0 -236
  110. package/esm2022/src/ui/mgerror.magic.component.mjs +0 -125
  111. package/esm2022/src/ui/pipes/date.magic.pipe.mjs +0 -106
  112. package/esm2022/src/ui/pipes/time.magic.pipe.mjs +0 -52
  113. package/esm2022/src/ui/pipes/time24.magic.pipe.mjs +0 -35
  114. package/esm2022/src/ui/router-container.magic.component.mjs +0 -115
  115. package/esm2022/src/ui/subform.magic.component.mjs +0 -56
  116. package/esm2022/src/ui/task-base.magic.component.mjs +0 -91
  117. package/esm2022/src/ui/utils.mjs +0 -54
@@ -1,6 +1,6 @@
1
1
  import { isNullOrUndefined, NString, List, isUndefined, StringBuilder, RefParam } from '@magic-xpa/mscorelib';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, Component, Input, Output, Directive, EventEmitter, ViewChild, InjectionToken, Inject, HostListener, Optional, Pipe, forwardRef, NgModule } from '@angular/core';
3
+ import { Injectable, Component, Input, Output, Directive, EventEmitter, HostListener, ViewChild, InjectionToken, Inject, Optional, Pipe, forwardRef, NgModule } from '@angular/core';
4
4
  import * as i1 from '@angular/common';
5
5
  import { DatePipe, CommonModule, formatDate } from '@angular/common';
6
6
  import * as i2 from '@angular/router';
@@ -8,20 +8,25 @@ import { NavigationEnd, RouterModule } from '@angular/router';
8
8
  import { FormGroup, FormControl, Validators, NG_VALIDATORS, NG_VALUE_ACCESSOR, CheckboxControlValueAccessor, DefaultValueAccessor, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
9
  import * as i3 from 'ng-dynamic-component';
10
10
  import { DynamicModule } from 'ng-dynamic-component';
11
- import { InteractiveCommandType, HtmlProperties, OverlayType, Styles, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
11
+ import { InteractiveCommandType, HtmlProperties, OverlayType, Styles, GuiConstants, CommandType, PIC, GuiEnvironment, Events, Modifiers } from '@magic-xpa/gui';
12
12
  import { MagicBridge, getGuiEventObj, CookieService, Environment, LastFocusedManager } from '@magic-xpa/engine';
13
- import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
13
+ import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, MsgInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
14
14
  import { filter, map, debounceTime } from 'rxjs/operators';
15
15
  import { Subject, EMPTY, fromEvent } from 'rxjs';
16
16
  import { __decorate, __metadata } from 'tslib';
17
+ import * as i2$1 from '@angular/cdk/drag-drop';
18
+ import { DragDropModule, CdkDragHandle, CdkDrag } from '@angular/cdk/drag-drop';
17
19
  import * as i1$1 from '@angular/platform-browser';
18
20
  import * as i1$2 from '@angular/common/http';
19
- import { HttpClientModule } from '@angular/common/http';
21
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
20
22
  import { maskitoTimeOptionsGenerator } from '@maskito/kit';
21
- import * as i2$1 from '@angular/cdk/platform';
23
+ import * as i2$2 from '@angular/cdk/platform';
22
24
  import { MaskitoModule } from '@maskito/angular';
23
25
  import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
24
26
 
27
+ /**
28
+ * @ignore
29
+ */
25
30
  class ControlMetadata {
26
31
  controlType;
27
32
  dataType;
@@ -31,9 +36,11 @@ class ControlMetadata {
31
36
  removedClass;
32
37
  classes;
33
38
  rangeValidator;
39
+ // user properties
34
40
  userProperties = new Map();
35
41
  customValidators = new Map();
36
42
  setClass(key, value) {
43
+ // for no-control - hold the name of the class to be removed later
37
44
  if (this.classesMap.has(key)) {
38
45
  this.removedClass = this.classesMap.get(key);
39
46
  }
@@ -48,8 +55,13 @@ class ControlMetadata {
48
55
  this.stylesMap.set(key, value);
49
56
  }
50
57
  }
58
+ /**
59
+ * @ignore
60
+ */
51
61
  class ControlsMetadata {
62
+ //values of control
52
63
  values = new Map();
64
+ // dictionary of controls with there properties
53
65
  ControlsProperties = new Map();
54
66
  rowId;
55
67
  isCreated = false;
@@ -63,6 +75,8 @@ class ControlsMetadata {
63
75
  return this.ControlsProperties.get(controlId);
64
76
  }
65
77
  update(obj) {
78
+ //should we keep the values here ?
79
+ //this.values = obj.ControlsValues;
66
80
  let props = obj.ControlsMetaData;
67
81
  for (let controlName in props) {
68
82
  if (!this.ControlsProperties.has(controlName))
@@ -91,15 +105,18 @@ class ControlsMetadata {
91
105
  return this.values.get(controlName);
92
106
  }
93
107
  }
108
+ /**
109
+ * @ignore
110
+ */
94
111
  class Records {
95
112
  data = new Map();
96
- list = [];
113
+ list = []; //used for sequential access in table
97
114
  includesFirst;
98
115
  includesLast;
99
116
  guiTopIndex;
100
117
  recordsBeforeCurrentView = 0;
101
118
  isEmptyDataView = false;
102
- sizeUpdated = false;
119
+ sizeUpdated = false; //used for evaluating the RecordsSizeChange.
103
120
  getRow(dvRowId) {
104
121
  return this.list[dvRowId + this.recordsBeforeCurrentView];
105
122
  }
@@ -122,14 +139,24 @@ class Records {
122
139
  }
123
140
  return false;
124
141
  }
142
+ /*
143
+ * for row editing
144
+ * */
125
145
  startRowEditing(guiRowId) {
126
146
  if (guiRowId < this.list.length && this.data.has(guiRowId))
127
147
  this.data.get(guiRowId).isEditing = true;
128
148
  }
149
+ /*
150
+ * stop row editing on row Id
151
+ * */
129
152
  stopRowEditing(guiRowId) {
130
153
  if (guiRowId < this.list.length && this.data.has(guiRowId))
131
154
  this.data.get(guiRowId).isEditing = false;
132
155
  }
156
+ /*
157
+ * return if row is in editing
158
+ * Called by the HTML code, so parameter is a string, not a numebr
159
+ * */
133
160
  isRowInRowEditing(guiRowId) {
134
161
  if (+guiRowId < this.list.length) {
135
162
  if (!this.data.has(+guiRowId) || isNullOrUndefined(this.data.get(+guiRowId)))
@@ -158,6 +185,7 @@ class Records {
158
185
  updateSize(len) {
159
186
  if (this.list.length != len) {
160
187
  if (len < this.list.length) {
188
+ //remove rows
161
189
  for (let i = len; i < this.list.length; i++) {
162
190
  this.data.delete(i);
163
191
  }
@@ -166,6 +194,10 @@ class Records {
166
194
  this.sizeUpdated = true;
167
195
  }
168
196
  }
197
+ /**
198
+ * crears data for the first record
199
+ * @param template
200
+ */
169
201
  clearFirstTableRecord(template) {
170
202
  if (this.list.length >= 1) {
171
203
  for (const key in template) {
@@ -196,6 +228,9 @@ class Records {
196
228
  return this.guiTopIndex;
197
229
  }
198
230
  }
231
+ /**
232
+ * @ignore
233
+ */
199
234
  var HtmlClasses;
200
235
  (function (HtmlClasses) {
201
236
  HtmlClasses["Color"] = "color";
@@ -204,6 +239,9 @@ var HtmlClasses;
204
239
  HtmlClasses["HintColor"] = "hintcolor";
205
240
  })(HtmlClasses || (HtmlClasses = {}));
206
241
 
242
+ /**
243
+ * @ignore
244
+ */
207
245
  class StylesMapManager {
208
246
  static StylesMap = new Map([
209
247
  [MagicProperties.LineDivider, new Map([[true, "solid"], [false, "hidden"]])],
@@ -230,10 +268,15 @@ class StylesMapManager {
230
268
  }
231
269
  }
232
270
 
271
+ /**
272
+ * @ignore
273
+ */
233
274
  class EngineMagicService {
234
275
  magicBridge = MagicBridge;
235
276
  isStub = false;
277
+ // true when user is logged in magic
236
278
  isLoggedIn = false;
279
+ //TODO - unregister
237
280
  refreshDom = new Subject();
238
281
  interactiveCommands = new Subject();
239
282
  startMagicEngine(httpClient, args) {
@@ -273,6 +316,12 @@ class EngineMagicService {
273
316
  GetControlPictureMask(taskId, controlName) {
274
317
  return this.magicBridge.GetControlPictureMask(taskId, controlName);
275
318
  }
319
+ UploadFileToServer(fileContent, serverFileName) {
320
+ return this.magicBridge.UploadFileToServer(fileContent, serverFileName);
321
+ }
322
+ async DownloadFileFromServer(serverFileName) {
323
+ return await this.magicBridge.DownloadFileFromServer(serverFileName);
324
+ }
276
325
  GetFormattedValue(taskId, controlName, value, rowId) {
277
326
  return this.magicBridge.GetFormattedValue(taskId, controlName, value, rowId);
278
327
  }
@@ -283,6 +332,7 @@ class EngineMagicService {
283
332
  return this.magicBridge.GetFldRanges(taskId, controlName);
284
333
  }
285
334
  saveData(data) {
335
+ //this.magicBridge.saveData(data);
286
336
  }
287
337
  getIsLoggedIn() {
288
338
  return this.isLoggedIn;
@@ -296,8 +346,8 @@ class EngineMagicService {
296
346
  TerminateContextUsingFetchAPI() {
297
347
  this.magicBridge.TerminateContextUsingFetchAPI();
298
348
  }
299
- static ɵfac = function EngineMagicService_Factory(t) { return new (t || EngineMagicService)(); };
300
- static ɵprov = i0.ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac, providedIn: 'root' });
349
+ /** @nocollapse */ static ɵfac = function EngineMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || EngineMagicService)(); };
350
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac, providedIn: 'root' });
301
351
  }
302
352
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EngineMagicService, [{
303
353
  type: Injectable,
@@ -306,8 +356,17 @@ class EngineMagicService {
306
356
  }]
307
357
  }], null, null); })();
308
358
 
359
+ /**
360
+ * Manages the list of components in a project, and the project title
361
+ */
309
362
  class ComponentListMagicService {
363
+ /**
364
+ * Map of project components
365
+ */
310
366
  components = new Map();
367
+ /**
368
+ * Map of project dialogs
369
+ */
311
370
  dialogs = new Map();
312
371
  lazyLoadModulesMap = null;
313
372
  getData(name, mustHaveData) {
@@ -320,6 +379,11 @@ class ComponentListMagicService {
320
379
  data = this.components.get(name);
321
380
  return data;
322
381
  }
382
+ /**
383
+ * Return a component according to name
384
+ * @param name Name of requested component
385
+ * @returns The requested component
386
+ */
323
387
  getComponent(name, mustHaveData = true) {
324
388
  let data = this.getData(name, mustHaveData);
325
389
  return data ? data.component : null;
@@ -330,17 +394,30 @@ class ComponentListMagicService {
330
394
  this.components.set(key, data);
331
395
  }
332
396
  }
397
+ /**
398
+ * Return a component according to name
399
+ * @param name Name of requested component
400
+ * @returns The requested component
401
+ */
333
402
  getModuleRef(name) {
334
403
  let data = this.getData(name, false);
335
404
  return data ? data.moduleRef : null;
336
405
  ;
337
406
  }
407
+ /**
408
+ * Return the lazy load module details of the specified component
409
+ * @param name: Name of requested component
410
+ * @returns: lazy load module details
411
+ */
338
412
  getLazyLoadModuleData(name) {
339
413
  return (this.lazyLoadModulesMap != null && this.lazyLoadModulesMap.hasOwnProperty(name)) ? this.lazyLoadModulesMap[name] : null;
340
414
  }
415
+ /**
416
+ * Project title
417
+ */
341
418
  title;
342
- static ɵfac = function ComponentListMagicService_Factory(t) { return new (t || ComponentListMagicService)(); };
343
- static ɵprov = i0.ɵɵdefineInjectable({ token: ComponentListMagicService, factory: ComponentListMagicService.ɵfac, providedIn: 'root' });
419
+ /** @nocollapse */ static ɵfac = function ComponentListMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ComponentListMagicService)(); };
420
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ComponentListMagicService, factory: ComponentListMagicService.ɵfac, providedIn: 'root' });
344
421
  }
345
422
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComponentListMagicService, [{
346
423
  type: Injectable,
@@ -349,6 +426,9 @@ class ComponentListMagicService {
349
426
  }]
350
427
  }], null, null); })();
351
428
 
429
+ /**
430
+ * @ignore
431
+ */
352
432
  class CommandsCollectorMagicService {
353
433
  magic;
354
434
  count = 0;
@@ -380,8 +460,8 @@ class CommandsCollectorMagicService {
380
460
  commands.forEach(command => { this.commands.Remove(command); });
381
461
  return commands;
382
462
  }
383
- static ɵfac = function CommandsCollectorMagicService_Factory(t) { return new (t || CommandsCollectorMagicService)(i0.ɵɵinject(EngineMagicService)); };
384
- static ɵprov = i0.ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac, providedIn: 'root' });
463
+ /** @nocollapse */ static ɵfac = function CommandsCollectorMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CommandsCollectorMagicService)(i0.ɵɵinject(EngineMagicService)); };
464
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac, providedIn: 'root' });
385
465
  }
386
466
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CommandsCollectorMagicService, [{
387
467
  type: Injectable,
@@ -390,6 +470,9 @@ class CommandsCollectorMagicService {
390
470
  }]
391
471
  }], () => [{ type: EngineMagicService }], null); })();
392
472
 
473
+ /**
474
+ * @ignore
475
+ */
393
476
  class RouteCommand {
394
477
  callerMgSubformServiceRef;
395
478
  routerOutletName;
@@ -397,6 +480,9 @@ class RouteCommand {
397
480
  parameters;
398
481
  routeParams;
399
482
  }
483
+ /**
484
+ * @ignore
485
+ */
400
486
  class RouterCommandsMagicService {
401
487
  pendingRouteCommands = [];
402
488
  AddRouteCommand(routeCommand) {
@@ -408,8 +494,8 @@ class RouterCommandsMagicService {
408
494
  pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
409
495
  }
410
496
  }
411
- static ɵfac = function RouterCommandsMagicService_Factory(t) { return new (t || RouterCommandsMagicService)(); };
412
- static ɵprov = i0.ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac, providedIn: 'root' });
497
+ /** @nocollapse */ static ɵfac = function RouterCommandsMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RouterCommandsMagicService)(); };
498
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac, providedIn: 'root' });
413
499
  }
414
500
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouterCommandsMagicService, [{
415
501
  type: Injectable,
@@ -422,8 +508,8 @@ class MagicLazyLoaderService {
422
508
  Load(path) {
423
509
  return Promise.reject('error in loading module :' + path);
424
510
  }
425
- static ɵfac = function MagicLazyLoaderService_Factory(t) { return new (t || MagicLazyLoaderService)(); };
426
- static ɵprov = i0.ɵɵdefineInjectable({ token: MagicLazyLoaderService, factory: MagicLazyLoaderService.ɵfac, providedIn: 'root' });
511
+ /** @nocollapse */ static ɵfac = function MagicLazyLoaderService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicLazyLoaderService)(); };
512
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicLazyLoaderService, factory: MagicLazyLoaderService.ɵfac, providedIn: 'root' });
427
513
  }
428
514
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicLazyLoaderService, [{
429
515
  type: Injectable,
@@ -432,6 +518,9 @@ class MagicLazyLoaderService {
432
518
  }]
433
519
  }], null, null); })();
434
520
 
521
+ /**
522
+ * Service for managing subforms and routing
523
+ */
435
524
  class SubformMagicService {
436
525
  task;
437
526
  activatedRoute;
@@ -443,8 +532,8 @@ class SubformMagicService {
443
532
  loader;
444
533
  injector;
445
534
  compiler;
446
- subformsDict = {};
447
- routesDict = {};
535
+ subformsDict /*:{ [x: string]: SubformDefinition }*/ = {};
536
+ routesDict = {}; // dictionary of router outlet to router path
448
537
  currentRouteDefinition = null;
449
538
  static currentCallerMgSubformServiceRef = null;
450
539
  static routerContainers = new Array();
@@ -460,6 +549,11 @@ class SubformMagicService {
460
549
  this.injector = injector;
461
550
  this.compiler = compiler;
462
551
  }
552
+ /**
553
+ * Finds and returns the component according to the subform name
554
+ * @param subformName
555
+ * @returns
556
+ */
463
557
  mgGetComp(subformName) {
464
558
  if (subformName in this.subformsDict) {
465
559
  let formName = this.subformsDict[subformName].formName;
@@ -468,6 +562,11 @@ class SubformMagicService {
468
562
  }
469
563
  return null;
470
564
  }
565
+ /**
566
+ * Returns the parameters of the subform
567
+ * @param subformName
568
+ * @returns
569
+ */
471
570
  mgGetParameters(subformName) {
472
571
  if (subformName in this.subformsDict) {
473
572
  return this.subformsDict[subformName].parameters;
@@ -475,6 +574,9 @@ class SubformMagicService {
475
574
  else
476
575
  return '';
477
576
  }
577
+ /**
578
+ * @ignore
579
+ */
478
580
  deleteSubformComp(subformControlName, formName) {
479
581
  if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
480
582
  if (this.subformsDict[subformControlName].formName === formName) {
@@ -483,22 +585,27 @@ class SubformMagicService {
483
585
  }
484
586
  }
485
587
  }
588
+ /**
589
+ * @ignore
590
+ */
486
591
  addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
487
592
  this.pendingCommandsCollector.startCollecting();
488
593
  let refreshNeeded = false;
489
- if (isNullOrUndefined(routerPath)) {
594
+ if (isNullOrUndefined(routerPath)) { // call in destination subform
490
595
  if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
491
596
  if (this.subformsDict[subformControlName].formName === formName) {
492
597
  this.subformsDict[subformControlName] = {};
493
598
  this.task.refreshView();
494
599
  }
495
600
  }
601
+ // Load the lazy load module, if needed
496
602
  let moduleRef = this.componentListMagicService.getModuleRef(formName);
497
603
  if (moduleRef == null) {
498
604
  let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(formName);
499
605
  if (lazyLoadModule != null) {
500
606
  const Magic = 'Magic';
501
607
  const Module = 'Module';
608
+ // extract name of module(XX) from 'MagicXXModule'
502
609
  const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
503
610
  this.loader.Load(moduleName).then(m => {
504
611
  const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
@@ -516,10 +623,11 @@ class SubformMagicService {
516
623
  formName,
517
624
  parameters: { taskIdParam: taskId, taskDescription: taskDescription }
518
625
  };
626
+ //this.ref.detectChanges();
519
627
  refreshNeeded = true;
520
628
  }
521
629
  }
522
- else {
630
+ else { // call route
523
631
  if (inDefaultOutlet)
524
632
  subformControlName = 'primary';
525
633
  let routeParams = new List();
@@ -534,6 +642,10 @@ class SubformMagicService {
534
642
  parameters: { taskIdParam: taskId, taskDescription: taskDescription },
535
643
  routeParams: routeParams
536
644
  };
645
+ // If SubformMagicService.currentCallerMgSubformServiceRef !== null means that router.navigate() is already
646
+ // called once, but angular has not yet executed it (ngOnInit of the new component is not called).
647
+ // In such a case, do not executed router.navigate() again. Because, angular ignores the previous one.
648
+ // So, put a command in the queue which will be executed after the first one is executed.
537
649
  if (SubformMagicService.currentCallerMgSubformServiceRef === null)
538
650
  this.ExecuteRouteCommand(routeCommand);
539
651
  else
@@ -542,10 +654,15 @@ class SubformMagicService {
542
654
  if (refreshNeeded)
543
655
  this.task.refreshView();
544
656
  }
657
+ /**
658
+ * Open the subform using a route command
659
+ */
545
660
  ExecuteRouteCommand(routeCommand) {
546
661
  let currentSubformMagicService = routeCommand.callerMgSubformServiceRef;
547
662
  let relativeRoute = SubformMagicService.getRelativeRoute(currentSubformMagicService.activatedRoute);
548
663
  if (currentSubformMagicService.routesDict[routeCommand.routerOutletName] === routeCommand.routeParams[0]) {
664
+ // If the specified router outlet already hosts the same router path, router.navigate() doesn't actually navigate.
665
+ // So, first clear the outlet (passing null route params, clears the outlet) and then navigate again.
549
666
  currentSubformMagicService.router.navigate([{ outlets: { [routeCommand.routerOutletName]: null } }], { relativeTo: relativeRoute })
550
667
  .then((result) => {
551
668
  SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
@@ -585,7 +702,12 @@ class SubformMagicService {
585
702
  }
586
703
  });
587
704
  }
705
+ /**
706
+ * @ignore
707
+ */
588
708
  init() {
709
+ // If commands were issued for this task before ngOnInit(), they were not executed because task had not registered for them.
710
+ // So, execute them now.
589
711
  const pendingCommands = this.pendingCommandsCollector.GetCommands(this.task.taskId);
590
712
  if (pendingCommands.length > 0) {
591
713
  pendingCommands.forEach(command => { this.task.executeCommand(command); });
@@ -593,9 +715,15 @@ class SubformMagicService {
593
715
  }
594
716
  this.pendingCommandsCollector.stopCollecting();
595
717
  }
718
+ /**
719
+ * @ignore
720
+ */
596
721
  refreshView() {
597
722
  this.task.refreshView();
598
723
  }
724
+ ///
725
+ // return the relative route
726
+ //
599
727
  static getRelativeRoute(sendActivatedRoute) {
600
728
  let currentActiveRoute = sendActivatedRoute;
601
729
  if (currentActiveRoute.snapshot.routeConfig !== null && currentActiveRoute.snapshot.routeConfig.path === '') {
@@ -605,13 +733,16 @@ class SubformMagicService {
605
733
  }
606
734
  return currentActiveRoute;
607
735
  }
608
- static ɵ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(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler)); };
609
- static ɵprov = i0.ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
736
+ /** @nocollapse */ static ɵfac = function SubformMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || 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(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler)); };
737
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
610
738
  }
611
739
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SubformMagicService, [{
612
740
  type: Injectable
613
741
  }], () => [{ type: TaskMagicService }, { type: i2.ActivatedRoute }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: i2.Router }, { type: RouterCommandsMagicService }, { type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.Compiler }], null); })();
614
742
 
743
+ /**
744
+ * Mock component, implements routing by connecting the requested URL with the appropriate Magic task
745
+ */
615
746
  class RouterContainerMagicComponent {
616
747
  activatedRoute;
617
748
  router;
@@ -627,6 +758,16 @@ class RouterContainerMagicComponent {
627
758
  static get LastRoute() {
628
759
  return RouterContainerMagicComponent.lastRoute;
629
760
  }
761
+ /**
762
+ *
763
+ * @param changeDetectorRef
764
+ * @param activatedRoute
765
+ * @param magic
766
+ * @param componentFactoryResolver
767
+ * @param viewContainerRef
768
+ * @param componentList
769
+ * @param pendingCommandsCollector
770
+ */
630
771
  constructor(activatedRoute, router, magic, containerTaskService, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
631
772
  this.activatedRoute = activatedRoute;
632
773
  this.router = router;
@@ -637,6 +778,9 @@ class RouterContainerMagicComponent {
637
778
  this.pendingCommandsCollector = pendingCommandsCollector;
638
779
  this.routerCommandsMagicService = routerCommandsMagicService;
639
780
  }
781
+ /**
782
+ * Initialization
783
+ */
640
784
  ngOnInit() {
641
785
  let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
642
786
  let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
@@ -654,7 +798,10 @@ class RouterContainerMagicComponent {
654
798
  guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
655
799
  if (currentActiveRoute.snapshot.outlet !== 'primary')
656
800
  guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
801
+ // if this is LoadOnDemandModuleMagicComponent it's mean that this is load on demand module and we
802
+ // need to take the path form routeConfig.path
657
803
  let calcRouterPath = currentActiveRoute.routeConfig.path;
804
+ // add the RouterPath only if exist
658
805
  if (calcRouterPath.length > 0) {
659
806
  let routerPath = calcRouterPath;
660
807
  let tokens = StrUtil.tokenize(routerPath, "/:");
@@ -667,6 +814,7 @@ class RouterContainerMagicComponent {
667
814
  this.containerTaskService.insertEvent(guiEvent);
668
815
  }
669
816
  initializeComponent() {
817
+ // re-init subformMagicService since it may change after executing "RouterNavigate" event.
670
818
  let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
671
819
  if (subformMagicService.currentRouteDefinition !== null) {
672
820
  let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
@@ -678,6 +826,9 @@ class RouterContainerMagicComponent {
678
826
  this.parentMgSubformService = subformMagicService;
679
827
  subformMagicService.currentRouteDefinition = null;
680
828
  SubformMagicService.currentCallerMgSubformServiceRef = null;
829
+ //When the component is initialized, then also we get the notification for paramMap subscription.
830
+ //But in this case, we do not have to raise the event, because magic engine itself has initiated the route with the same parameters.
831
+ //So, control it via ignoreParamChange flag.
681
832
  let ignoreParamChange = true;
682
833
  myActiveRoute.paramMap.subscribe(params => {
683
834
  if (!ignoreParamChange)
@@ -688,7 +839,12 @@ class RouterContainerMagicComponent {
688
839
  this.routerCommandsMagicService.ExecuteNextCommand();
689
840
  }
690
841
  }
842
+ /**
843
+ * Cleanup
844
+ */
691
845
  ngOnDestroy() {
846
+ // TODO Routing: Call close() only if the task is not already closed.
847
+ // Task can be closed when a router is overlayed by another task via call operation.
692
848
  if (this.componentRef != null) {
693
849
  this.componentRef.instance.task.close();
694
850
  let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
@@ -696,25 +852,30 @@ class RouterContainerMagicComponent {
696
852
  RouterContainerMagicComponent.lastRoute = this.router.url;
697
853
  }
698
854
  }
699
- static ɵ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.ViewContainerRef), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(RouterCommandsMagicService)); };
700
- static ɵcmp = i0.ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
855
+ /** @nocollapse */ static ɵfac = function RouterContainerMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RouterContainerMagicComponent)(i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(RouterCommandsMagicService)); };
856
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], standalone: false, decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
701
857
  }
702
858
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouterContainerMagicComponent, [{
703
859
  type: Component,
704
860
  args: [{
705
861
  selector: 'magic-route-outlet',
706
862
  template: `
707
- `
863
+ `,
864
+ standalone: false
708
865
  }]
709
866
  }], () => [{ type: i2.ActivatedRoute }, { type: i2.Router }, { type: EngineMagicService }, { type: TaskMagicService }, { type: i0.ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }], null); })();
710
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RouterContainerMagicComponent, { className: "RouterContainerMagicComponent", filePath: "src\\ui\\router-container.magic.component.ts", lineNumber: 22 }); })();
867
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RouterContainerMagicComponent, { className: "RouterContainerMagicComponent", filePath: "src/ui/router-container.magic.component.ts", lineNumber: 23 }); })();
711
868
 
869
+ /**
870
+ * @ignore
871
+ */
712
872
  class GuiInteractiveExecutor {
713
873
  command;
714
874
  component;
715
875
  task;
716
876
  overlayService;
717
877
  Run() {
878
+ // Sets the currentContextID
718
879
  try {
719
880
  switch (this.command._commandType) {
720
881
  case InteractiveCommandType.GET_VALUE:
@@ -751,6 +912,7 @@ class GuiInteractiveExecutor {
751
912
  }
752
913
  catch (ex) {
753
914
  throw ex;
915
+ //want to see all the exceptions for now
754
916
  }
755
917
  }
756
918
  static executeInteractiveCommand(task, guiIntactiveCommand, overlayService) {
@@ -769,6 +931,7 @@ class GuiInteractiveExecutor {
769
931
  }
770
932
  else if (this.task.isTableControl(this.command.controlName))
771
933
  val = this.task.getValue(this.command.controlName, guiRowId.toString());
934
+ // If this is Three State Checkbox, then check if value is indeterminate.
772
935
  if (this.command._boolVal) {
773
936
  const indeterminate = this.task.getProperty(this.command.controlName, HtmlProperties.CheckBoxIndeterminate, guiRowId.toString());
774
937
  if (indeterminate)
@@ -839,20 +1002,25 @@ BaseMagicOverlayContainer = __decorate([
839
1002
  Output()
840
1003
  ], BaseMagicOverlayContainer);
841
1004
 
1005
+ /**
1006
+ * Directive for setting ViewContainerRef on element
1007
+ */
842
1008
  class MagicViewContainerRef {
843
1009
  vcRef;
844
1010
  constructor(vcRef) {
845
1011
  this.vcRef = vcRef;
1012
+ // For angular 10 - find the component from the views
846
1013
  let comp = (this.vcRef._hostLView).find(v => v != null && !isNullOrUndefined(v.setViewContainerRef));
847
1014
  comp.setViewContainerRef(vcRef);
848
1015
  }
849
- static ɵfac = function MagicViewContainerRef_Factory(t) { return new (t || MagicViewContainerRef)(i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
850
- static ɵdir = i0.ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]] });
1016
+ /** @nocollapse */ static ɵfac = function MagicViewContainerRef_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicViewContainerRef)(i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
1017
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]], standalone: false });
851
1018
  }
852
1019
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicViewContainerRef, [{
853
1020
  type: Directive,
854
1021
  args: [{
855
1022
  selector: '[magicViewContainerRef]',
1023
+ standalone: false
856
1024
  }]
857
1025
  }], () => [{ type: i0.ViewContainerRef }], null); })();
858
1026
 
@@ -860,42 +1028,101 @@ const _c0$3 = ["modalheader"];
860
1028
  const _c1$1 = ["modalForeground"];
861
1029
  function MagicOverlayContainer_button_2_Template(rf, ctx) { if (rf & 1) {
862
1030
  const _r2 = i0.ɵɵgetCurrentView();
863
- i0.ɵɵelementStart(0, "button", 9);
1031
+ i0.ɵɵelementStart(0, "button", 16);
864
1032
  i0.ɵɵlistener("click", function MagicOverlayContainer_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.OnClose()); });
865
1033
  i0.ɵɵtext(1, "X");
866
1034
  i0.ɵɵelementEnd();
867
1035
  } }
868
- function MagicOverlayContainer_div_5_Template(rf, ctx) { if (rf & 1) {
1036
+ function MagicOverlayContainer_span_5_Template(rf, ctx) { if (rf & 1) {
869
1037
  const _r4 = i0.ɵɵgetCurrentView();
870
- i0.ɵɵelementStart(0, "div", 10, 2);
1038
+ i0.ɵɵelementStart(0, "span", 17, 2);
1039
+ i0.ɵɵlistener("mousedown", function MagicOverlayContainer_span_5_Template_span_mousedown_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onResizeStart($event, "corner")); });
1040
+ i0.ɵɵelementEnd();
1041
+ } }
1042
+ function MagicOverlayContainer_span_6_Template(rf, ctx) { if (rf & 1) {
1043
+ const _r5 = i0.ɵɵgetCurrentView();
1044
+ i0.ɵɵelementStart(0, "span", 18, 3);
1045
+ i0.ɵɵlistener("mousedown", function MagicOverlayContainer_span_6_Template_span_mousedown_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onResizeStart($event, "right")); });
1046
+ i0.ɵɵelementEnd();
1047
+ } }
1048
+ function MagicOverlayContainer_span_7_Template(rf, ctx) { if (rf & 1) {
1049
+ const _r6 = i0.ɵɵgetCurrentView();
1050
+ i0.ɵɵelementStart(0, "span", 19, 4);
1051
+ i0.ɵɵlistener("mousedown", function MagicOverlayContainer_span_7_Template_span_mousedown_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onResizeStart($event, "bottom")); });
1052
+ i0.ɵɵelementEnd();
1053
+ } }
1054
+ function MagicOverlayContainer_div_8_Template(rf, ctx) { if (rf & 1) {
1055
+ const _r7 = i0.ɵɵgetCurrentView();
1056
+ i0.ɵɵelementStart(0, "div", 20, 5);
871
1057
  i0.ɵɵtext(2);
872
- i0.ɵɵelementStart(3, "button", 11);
873
- i0.ɵɵlistener("click", function MagicOverlayContainer_div_5_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r4); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.OnClose()); });
1058
+ i0.ɵɵelementStart(3, "button", 21);
1059
+ i0.ɵɵlistener("click", function MagicOverlayContainer_div_8_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r7); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.OnClose()); });
874
1060
  i0.ɵɵtext(4, "X");
875
1061
  i0.ɵɵelementEnd()();
876
1062
  } if (rf & 2) {
877
1063
  const ctx_r2 = i0.ɵɵnextContext();
1064
+ i0.ɵɵclassProp("movable", ctx_r2.IsMovable());
878
1065
  i0.ɵɵadvance(2);
879
1066
  i0.ɵɵtextInterpolate1(" ", ctx_r2.getText(), " ");
880
1067
  } }
1068
+ /**
1069
+ * Creates a modal window for Magic modal window components
1070
+ */
881
1071
  class MagicOverlayContainer extends BaseMagicOverlayContainer {
1072
+ /**
1073
+ * HTML to be displayed in the modal window
1074
+ */
882
1075
  modalbodyViewContainerRef;
1076
+ /**
1077
+ * Header of the modal window
1078
+ */
883
1079
  headerElementRef;
1080
+ /**
1081
+ * Foreground of the modal window
1082
+ */
884
1083
  foregroundElementRef;
1084
+ /**
1085
+ *
1086
+ */
885
1087
  ModalComp = null;
1088
+ /**
1089
+ *
1090
+ */
886
1091
  ModalCompParameters = {};
887
1092
  onClose = new EventEmitter();
1093
+ /**
1094
+ *
1095
+ */
888
1096
  componentRef = null;
1097
+ resizing = false;
1098
+ resizeDirection = null;
1099
+ originalWidth = 0;
1100
+ originalHeight = 0;
1101
+ originalMouseX = 0;
1102
+ originalMouseY = 0;
1103
+ isCenteredToWindow = true;
1104
+ /**
1105
+ *
1106
+ */
889
1107
  constructor() {
890
1108
  super();
891
1109
  }
1110
+ /**
1111
+ *
1112
+ */
892
1113
  ngOnInit() {
893
1114
  this.componentRef = this.modalbodyViewContainerRef.createComponent(this.ModalComp);
894
1115
  Object.assign(this.componentRef.instance, this.ModalCompParameters);
1116
+ let comp = this.componentRef.instance;
1117
+ this.isCenteredToWindow = comp.IsCenteredToWindow();
895
1118
  }
896
1119
  setViewContainerRef(vcRef) {
897
1120
  this.modalbodyViewContainerRef = vcRef;
898
1121
  }
1122
+ /**
1123
+ * Returns the form name
1124
+ * @returns
1125
+ */
899
1126
  getText() {
900
1127
  if (this.componentRef !== null) {
901
1128
  let comp = this.componentRef.instance;
@@ -904,13 +1131,17 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
904
1131
  else
905
1132
  return '';
906
1133
  }
1134
+ /**
1135
+ * Returns CSS styles for the window
1136
+ * @returns
1137
+ */
907
1138
  getStyle() {
908
1139
  let styles = {};
909
1140
  if (this.componentRef != undefined) {
910
1141
  let comp = this.componentRef.instance;
911
1142
  styles['width'] = comp.Width();
912
1143
  styles['height'] = comp.Height();
913
- if (comp.IsCenteredToWindow()) {
1144
+ if (this.isCenteredToWindow) {
914
1145
  styles['margin'] = 'auto';
915
1146
  }
916
1147
  else {
@@ -920,6 +1151,10 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
920
1151
  }
921
1152
  return styles;
922
1153
  }
1154
+ /**
1155
+ * Returns the CSS styles for the client area
1156
+ * @returns
1157
+ */
923
1158
  getClientAreaStyles() {
924
1159
  let styles = {};
925
1160
  if (this.componentRef != undefined) {
@@ -934,69 +1169,161 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
934
1169
  }
935
1170
  return styles;
936
1171
  }
1172
+ /**
1173
+ * Should the title bar be displayed
1174
+ * @returns
1175
+ */
937
1176
  getShowTitleBar() {
938
1177
  if (this.componentRef != undefined) {
939
1178
  let comp = this.componentRef.instance;
940
1179
  return comp.ShowTitleBar();
941
1180
  }
942
1181
  }
1182
+ /**
1183
+ *
1184
+ */
943
1185
  OnClose() {
944
1186
  this.onClose.emit();
945
1187
  }
1188
+ /**
1189
+ * Handles click in the background window
1190
+ */
946
1191
  OnBackgroundClick() {
947
1192
  let comp = this.componentRef.instance;
948
1193
  if (comp.ShouldCloseOnBackgroundClick())
949
1194
  this.OnClose();
950
1195
  }
951
- static ɵfac = function MagicOverlayContainer_Factory(t) { return new (t || MagicOverlayContainer)(); };
952
- static ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
1196
+ /**
1197
+ * Checks if the overlay component allows to be resized.
1198
+ * @returns {boolean} True if the overlay is resizable, false otherwise.
1199
+ */
1200
+ IsResizable() {
1201
+ let comp = this.componentRef.instance;
1202
+ return comp.IsResizable();
1203
+ }
1204
+ /**
1205
+ * Checks if the overlay component allows to be moved (dragged).
1206
+ * @returns {boolean} True if the overlay is movable, false otherwise.
1207
+ */
1208
+ IsMovable() {
1209
+ let comp = this.componentRef.instance;
1210
+ return comp.IsMovable();
1211
+ }
1212
+ /**
1213
+ * Initiates the resize process when a mousedown event occurs on a resize handle.
1214
+ * Stores the initial state (dimensions, mouse position) and sets flags.
1215
+ * @param {MouseEvent} event - The mousedown event triggering the resize.
1216
+ * @param {'right' | 'bottom' | 'corner'} direction - Indicates which resize handle was activated.
1217
+ */
1218
+ onResizeStart(event, direction) {
1219
+ this.resizing = true;
1220
+ this.resizeDirection = direction;
1221
+ const element = this.foregroundElementRef.nativeElement;
1222
+ this.originalWidth = element.offsetWidth;
1223
+ this.originalHeight = element.offsetHeight;
1224
+ this.originalMouseX = event.clientX;
1225
+ this.originalMouseY = event.clientY;
1226
+ event.preventDefault();
1227
+ event.stopPropagation();
1228
+ }
1229
+ /**
1230
+ * Handles the resizing logic as the mouse moves across the window.
1231
+ * This listener is active globally on the window during a resize operation via @HostListener.
1232
+ * Calculates and applies the new dimensions to the element based on mouse movement.
1233
+ * @param {MouseEvent} event - The mousemove event passed by the HostListener.
1234
+ */
1235
+ onResize(event) {
1236
+ if (!this.resizing)
1237
+ return;
1238
+ const element = this.foregroundElementRef.nativeElement;
1239
+ if (this.resizeDirection === 'right' || this.resizeDirection === 'corner') {
1240
+ let dx = (event.clientX - this.originalMouseX);
1241
+ let newWidth = this.originalWidth + dx;
1242
+ if (this.isCenteredToWindow)
1243
+ newWidth = this.originalWidth + (2 * dx);
1244
+ element.style.width = `${newWidth}px`;
1245
+ }
1246
+ if (this.resizeDirection === 'bottom' || this.resizeDirection === 'corner') {
1247
+ let dy = (event.clientY - this.originalMouseY);
1248
+ let newHeight = this.originalHeight + dy;
1249
+ if (this.isCenteredToWindow)
1250
+ newHeight = this.originalHeight + (2 * dy);
1251
+ element.style.height = `${newHeight}px`;
1252
+ }
1253
+ }
1254
+ /**
1255
+ * Finalizes the resize operation when the mouse button is released anywhere on the window.
1256
+ * Resets the resizing state flags. Triggered globally via @HostListener.
1257
+ */
1258
+ onResizeEnd() {
1259
+ this.resizing = false;
1260
+ this.resizeDirection = null;
1261
+ }
1262
+ /** @nocollapse */ static ɵfac = function MagicOverlayContainer_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainer)(); };
1263
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
953
1264
  i0.ɵɵviewQuery(_c0$3, 5);
954
1265
  i0.ɵɵviewQuery(_c1$1, 5);
955
1266
  } if (rf & 2) {
956
1267
  let _t;
957
1268
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
958
1269
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.foregroundElementRef = _t.first);
959
- } }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 9, vars: 4, consts: [["modalForeground", ""], ["modalbody", ""], ["modalheader", ""], [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"], ["class", "modal-header", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "modal-header"], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) { if (rf & 1) {
1270
+ } }, hostBindings: function MagicOverlayContainer_HostBindings(rf, ctx) { if (rf & 1) {
1271
+ i0.ɵɵlistener("mousemove", function MagicOverlayContainer_mousemove_HostBindingHandler($event) { return ctx.onResize($event); }, false, i0.ɵɵresolveWindow)("mouseup", function MagicOverlayContainer_mouseup_HostBindingHandler() { return ctx.onResizeEnd(); }, false, i0.ɵɵresolveWindow);
1272
+ } }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 12, vars: 8, consts: [["modalForeground", ""], ["modalbody", ""], ["dragHandleCorner", ""], ["dragHandleRight", ""], ["dragHandleBottom", ""], ["modalheader", ""], [1, "boundary-line"], [1, "modal-background", 3, "click"], ["tabindex", "-1", "style", "float:right; border: none; background-color: transparent; outline: none; color: white", 3, "click", 4, "ngIf"], ["cdkDragBoundary", ".boundary-line", "cdkDrag", "", 1, "modal-foreground", 3, "ngStyle", "cdkDragDisabled"], ["class", "dragHandle corner", 3, "mousedown", 4, "ngIf"], ["class", "dragHandle right", 3, "mousedown", 4, "ngIf"], ["class", "dragHandle bottom", 3, "mousedown", 4, "ngIf"], ["class", "modal-header", "cdkDragHandle", "", 3, "movable", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "dragHandle", "corner", 3, "mousedown"], [1, "dragHandle", "right", 3, "mousedown"], [1, "dragHandle", "bottom", 3, "mousedown"], ["cdkDragHandle", "", 1, "modal-header"], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) { if (rf & 1) {
960
1273
  const _r1 = i0.ɵɵgetCurrentView();
961
- i0.ɵɵelementStart(0, "div")(1, "div", 3);
1274
+ i0.ɵɵelementStart(0, "div", 6)(1, "div", 7);
962
1275
  i0.ɵɵlistener("click", function MagicOverlayContainer_Template_div_click_1_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnBackgroundClick()); });
963
- i0.ɵɵtemplate(2, MagicOverlayContainer_button_2_Template, 2, 0, "button", 4);
1276
+ i0.ɵɵtemplate(2, MagicOverlayContainer_button_2_Template, 2, 0, "button", 8);
964
1277
  i0.ɵɵelementEnd();
965
- i0.ɵɵelementStart(3, "div", 5, 0);
966
- i0.ɵɵtemplate(5, MagicOverlayContainer_div_5_Template, 5, 1, "div", 6);
967
- i0.ɵɵelementStart(6, "div", 7);
968
- i0.ɵɵelement(7, "div", 8, 1);
1278
+ i0.ɵɵelementStart(3, "div", 9, 0);
1279
+ i0.ɵɵtemplate(5, MagicOverlayContainer_span_5_Template, 2, 0, "span", 10)(6, MagicOverlayContainer_span_6_Template, 2, 0, "span", 11)(7, MagicOverlayContainer_span_7_Template, 2, 0, "span", 12)(8, MagicOverlayContainer_div_8_Template, 5, 3, "div", 13);
1280
+ i0.ɵɵelementStart(9, "div", 14);
1281
+ i0.ɵɵelement(10, "div", 15, 1);
969
1282
  i0.ɵɵelementEnd()()();
970
1283
  } if (rf & 2) {
971
1284
  i0.ɵɵadvance(2);
972
1285
  i0.ɵɵproperty("ngIf", !ctx.getShowTitleBar());
973
1286
  i0.ɵɵadvance();
974
- i0.ɵɵproperty("ngStyle", ctx.getStyle());
1287
+ i0.ɵɵproperty("ngStyle", ctx.getStyle())("cdkDragDisabled", !ctx.IsMovable());
975
1288
  i0.ɵɵadvance(2);
1289
+ i0.ɵɵproperty("ngIf", ctx.IsResizable());
1290
+ i0.ɵɵadvance();
1291
+ i0.ɵɵproperty("ngIf", ctx.IsResizable());
1292
+ i0.ɵɵadvance();
1293
+ i0.ɵɵproperty("ngIf", ctx.IsResizable());
1294
+ i0.ɵɵadvance();
976
1295
  i0.ɵɵproperty("ngIf", ctx.getShowTitleBar());
977
1296
  i0.ɵɵadvance();
978
1297
  i0.ɵɵproperty("ngStyle", ctx.getClientAreaStyles());
979
- } }, dependencies: [i1.NgIf, i1.NgStyle, MagicViewContainerRef], styles: [".modal-foreground[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#fff}.modal-background[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header[_ngcontent-%COMP%]{background-color:beige;border-bottom:2px solid red}"] });
1298
+ } }, dependencies: [i1.NgIf, i1.NgStyle, i2$1.CdkDragHandle, i2$1.CdkDrag, MagicViewContainerRef], styles: [".modal-foreground[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#fff}.modal-background[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header[_ngcontent-%COMP%]{background-color:beige;border-bottom:2px solid red}.modal-header.movable[_ngcontent-%COMP%]:active{cursor:move}.container[_ngcontent-%COMP%]{position:relative}.dragHandle[_ngcontent-%COMP%]{position:absolute}.dragHandle.corner[_ngcontent-%COMP%]{width:10px;right:0;bottom:0;height:10px;cursor:nwse-resize;background:linear-gradient(135deg,rgba(0,0,0,.4) 50%,transparent 50%)}.dragHandle.right[_ngcontent-%COMP%]{width:2px;right:-2px;height:100%;cursor:ew-resize}.dragHandle.bottom[_ngcontent-%COMP%]{height:2px;bottom:-2px;width:100%;cursor:ns-resize}.boundary-line[_ngcontent-%COMP%]{width:100%;height:100%;max-width:100%}"] });
980
1299
  }
981
1300
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainer, [{
982
1301
  type: Component,
983
1302
  args: [{ selector: 'app-magic-overlay-container', template: `
984
- <div>
1303
+ <div class="boundary-line">
1304
+
985
1305
  <div class="modal-background" (click)="OnBackgroundClick()">
986
1306
  <button (click)="OnClose()" tabindex="-1" style="float:right; border: none; background-color: transparent; outline: none; color: white" *ngIf="!getShowTitleBar()">X</button>
987
1307
  </div>
988
- <div #modalForeground class="modal-foreground" [ngStyle]="getStyle()">
989
- <div #modalheader class="modal-header" *ngIf="getShowTitleBar()">
1308
+
1309
+ <div #modalForeground class="modal-foreground" [ngStyle]="getStyle()" cdkDragBoundary=".boundary-line" cdkDrag [cdkDragDisabled]="!IsMovable()">
1310
+
1311
+ <span #dragHandleCorner *ngIf="IsResizable()" class="dragHandle corner" (mousedown)="onResizeStart($event, 'corner')"></span>
1312
+ <span #dragHandleRight *ngIf="IsResizable()" class="dragHandle right" (mousedown)="onResizeStart($event, 'right')"></span>
1313
+ <span #dragHandleBottom *ngIf="IsResizable()" class="dragHandle bottom" (mousedown)="onResizeStart($event, 'bottom')"></span>
1314
+
1315
+ <div #modalheader class="modal-header" *ngIf="getShowTitleBar()" cdkDragHandle [class.movable]="IsMovable()">
990
1316
  {{getText()}}
991
1317
  <button (click)="OnClose()" style="float:right" tabindex="-1">X</button>
992
1318
  </div>
1319
+
993
1320
  <div [ngStyle]="getClientAreaStyles()">
994
1321
  <div #modalbody magicViewContainerRef>
995
1322
  </div>
996
1323
  </div>
997
1324
  </div>
998
1325
  </div>
999
- `, styles: [".modal-foreground{position:fixed;inset:0;background-color:#fff}.modal-background{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header{background-color:beige;border-bottom:2px solid red}\n"] }]
1326
+ `, standalone: false, styles: [".modal-foreground{position:fixed;inset:0;background-color:#fff}.modal-background{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header{background-color:beige;border-bottom:2px solid red}.modal-header.movable:active{cursor:move}.container{position:relative}.dragHandle{position:absolute}.dragHandle.corner{width:10px;right:0;bottom:0;height:10px;cursor:nwse-resize;background:linear-gradient(135deg,rgba(0,0,0,.4) 50%,transparent 50%)}.dragHandle.right{width:2px;right:-2px;height:100%;cursor:ew-resize}.dragHandle.bottom{height:2px;bottom:-2px;width:100%;cursor:ns-resize}.boundary-line{width:100%;height:100%;max-width:100%}\n"] }]
1000
1327
  }], () => [], { headerElementRef: [{
1001
1328
  type: ViewChild,
1002
1329
  args: ['modalheader', { static: false }]
@@ -1009,33 +1336,61 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
1009
1336
  type: Input
1010
1337
  }], onClose: [{
1011
1338
  type: Output
1339
+ }], onResize: [{
1340
+ type: HostListener,
1341
+ args: ['window:mousemove', ['$event']]
1342
+ }], onResizeEnd: [{
1343
+ type: HostListener,
1344
+ args: ['window:mouseup']
1012
1345
  }] }); })();
1013
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainer, { className: "MagicOverlayContainer", filePath: "src\\ui\\magic-modal\\magic-overlay-container.ts", lineNumber: 40 }); })();
1346
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainer, { className: "MagicOverlayContainer", filePath: "src/ui/magic-modal/magic-overlay-container.ts", lineNumber: 50 }); })();
1014
1347
 
1348
+ /**
1349
+ * Service managing overlay windows
1350
+ * This is Magic's default provider
1351
+ */
1015
1352
  class OverlayContainerMagicProvider {
1016
1353
  getComponent() {
1017
1354
  return MagicOverlayContainer;
1018
1355
  }
1019
- static ɵfac = function OverlayContainerMagicProvider_Factory(t) { return new (t || OverlayContainerMagicProvider)(); };
1020
- static ɵprov = i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
1356
+ /** @nocollapse */ static ɵfac = function OverlayContainerMagicProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OverlayContainerMagicProvider)(); };
1357
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
1021
1358
  }
1022
1359
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayContainerMagicProvider, [{
1023
1360
  type: Injectable
1024
1361
  }], null, null); })();
1025
1362
 
1363
+ /**
1364
+ * This is a base class for the magic confirm components
1365
+ */
1026
1366
  class BaseMagicConfirmComponent {
1367
+ /**
1368
+ * title of the component
1369
+ */
1027
1370
  title;
1371
+ /**
1372
+ * message of the component
1373
+ */
1028
1374
  message;
1375
+ /**
1376
+ * onClose Event - to be raised when the component is closed
1377
+ * should pass true when OK is pressed and false when cancel is pressed
1378
+ */
1029
1379
  onClose = new EventEmitter();
1380
+ /**
1381
+ * raises close Event
1382
+ * @param result true when OK is pressed and false when cancel is pressed
1383
+ *
1384
+ */
1030
1385
  OnClose(result) {
1031
1386
  this.onClose.emit(result);
1032
1387
  }
1033
- static ɵfac = function BaseMagicConfirmComponent_Factory(t) { return new (t || BaseMagicConfirmComponent)(); };
1034
- static ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-confirm"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { } });
1388
+ /** @nocollapse */ static ɵfac = function BaseMagicConfirmComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicConfirmComponent)(); };
1389
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-confirm"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, standalone: false, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, encapsulation: 2 });
1035
1390
  }
1036
1391
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
1037
1392
  type: Component,
1038
- args: [{ selector: 'mg-base-confirm', template: '' }]
1393
+ args: [{ selector: 'mg-base-confirm', template: '', standalone: false }]
1039
1394
  }], null, { title: [{
1040
1395
  type: Input
1041
1396
  }], message: [{
@@ -1043,21 +1398,37 @@ class BaseMagicConfirmComponent {
1043
1398
  }], onClose: [{
1044
1399
  type: Output
1045
1400
  }] }); })();
1046
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src\\ui\\components\\base-magic-confirm.component.ts", lineNumber: 12 }); })();
1401
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src/ui/components/base-magic-confirm.component.ts", lineNumber: 13 }); })();
1047
1402
 
1403
+ /**
1404
+ * This is a base class for the magic alert components
1405
+ */
1048
1406
  class BaseMagicAlertComponent {
1407
+ /**
1408
+ * title of the component
1409
+ */
1049
1410
  title;
1411
+ /**
1412
+ * message of the component
1413
+ */
1050
1414
  message;
1415
+ /**
1416
+ * onClose Event - to be raised when the component is closed
1417
+
1418
+ */
1051
1419
  onClose = new EventEmitter();
1420
+ /**
1421
+ * close magic alert
1422
+ */
1052
1423
  OnClose() {
1053
1424
  this.onClose.emit();
1054
1425
  }
1055
- static ɵfac = function BaseMagicAlertComponent_Factory(t) { return new (t || BaseMagicAlertComponent)(); };
1056
- static ɵ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) { } });
1426
+ /** @nocollapse */ static ɵfac = function BaseMagicAlertComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicAlertComponent)(); };
1427
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: BaseMagicAlertComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, standalone: false, decls: 0, vars: 0, template: function BaseMagicAlertComponent_Template(rf, ctx) { }, encapsulation: 2 });
1057
1428
  }
1058
1429
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicAlertComponent, [{
1059
1430
  type: Component,
1060
- args: [{ selector: 'mg-base-alert', template: '' }]
1431
+ args: [{ selector: 'mg-base-alert', template: '', standalone: false }]
1061
1432
  }], null, { title: [{
1062
1433
  type: Input
1063
1434
  }], message: [{
@@ -1065,8 +1436,11 @@ class BaseMagicAlertComponent {
1065
1436
  }], onClose: [{
1066
1437
  type: Output
1067
1438
  }] }); })();
1068
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicAlertComponent, { className: "BaseMagicAlertComponent", filePath: "src\\ui\\components\\base-magic-alert.component.ts", lineNumber: 13 }); })();
1439
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicAlertComponent, { className: "BaseMagicAlertComponent", filePath: "src/ui/components/base-magic-alert.component.ts", lineNumber: 14 }); })();
1069
1440
 
1441
+ /**
1442
+ * Directive for setting focus on element
1443
+ */
1070
1444
  class MagicFocusDirective {
1071
1445
  hostElement;
1072
1446
  constructor(hostElement) {
@@ -1075,13 +1449,14 @@ class MagicFocusDirective {
1075
1449
  ngAfterViewInit() {
1076
1450
  this.hostElement.nativeElement.focus();
1077
1451
  }
1078
- static ɵfac = function MagicFocusDirective_Factory(t) { return new (t || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
1079
- static ɵdir = i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]] });
1452
+ /** @nocollapse */ static ɵfac = function MagicFocusDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
1453
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]], standalone: false });
1080
1454
  }
1081
1455
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicFocusDirective, [{
1082
1456
  type: Directive,
1083
1457
  args: [{
1084
- selector: '[magicFocus]'
1458
+ selector: '[magicFocus]',
1459
+ standalone: false
1085
1460
  }]
1086
1461
  }], () => [{ type: i0.ElementRef }], null); })();
1087
1462
 
@@ -1092,17 +1467,34 @@ class MagicOverlayContainerWrapper {
1092
1467
  injector;
1093
1468
  changeDetectorRef;
1094
1469
  compiler;
1470
+ /**
1471
+ *
1472
+ */
1095
1473
  Component = null;
1474
+ /**
1475
+ *
1476
+ */
1096
1477
  Parameters = {};
1097
1478
  OverlayTypeParam;
1098
1479
  onClose = new EventEmitter();
1480
+ /**
1481
+ * HTML to be displayed in the modal window
1482
+ */
1099
1483
  overlayContentViewContainerRef;
1100
1484
  overlayContainerWrapperElementRef;
1485
+ /**
1486
+ * @ignore
1487
+ * contais data of allowed base components to use
1488
+ */
1101
1489
  static allowedBaseComps = new Map([
1102
1490
  [OverlayType.Overlay, { comp: BaseMagicOverlayContainer, error: 'BaseMagicOverlayContainer . Overlay ' }],
1103
1491
  [OverlayType.Alert, { comp: BaseMagicAlertComponent, error: 'BaseMagicAlertComponent. Alert ' }],
1104
1492
  [OverlayType.ConfirmationBox, { comp: BaseMagicConfirmComponent, error: 'BaseMagicConfirmComponent. Confirmation ' }]
1105
1493
  ]);
1494
+ /**
1495
+ *
1496
+ * @param componentFactoryResolver
1497
+ */
1106
1498
  constructor(componentListMagicService, magicLazyModuleLoader, injector, changeDetectorRef, compiler) {
1107
1499
  this.componentListMagicService = componentListMagicService;
1108
1500
  this.magicLazyModuleLoader = magicLazyModuleLoader;
@@ -1110,6 +1502,9 @@ class MagicOverlayContainerWrapper {
1110
1502
  this.changeDetectorRef = changeDetectorRef;
1111
1503
  this.compiler = compiler;
1112
1504
  }
1505
+ /**
1506
+ *
1507
+ */
1113
1508
  ngOnInit() {
1114
1509
  let moduleRef = this.componentListMagicService.getModuleRef(this.Parameters.MagicFormName);
1115
1510
  if (moduleRef == null) {
@@ -1117,6 +1512,7 @@ class MagicOverlayContainerWrapper {
1117
1512
  if (lazyLoadModule != null) {
1118
1513
  const Magic = 'Magic';
1119
1514
  const Module = 'Module';
1515
+ // extract name of module(XX) from 'MagicXXModule'
1120
1516
  const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
1121
1517
  this.magicLazyModuleLoader.Load(moduleName).then(m => {
1122
1518
  const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
@@ -1155,13 +1551,13 @@ class MagicOverlayContainerWrapper {
1155
1551
  DetectChanges() {
1156
1552
  this.changeDetectorRef.detectChanges();
1157
1553
  }
1158
- static ɵfac = function MagicOverlayContainerWrapper_Factory(t) { return new (t || MagicOverlayContainerWrapper)(i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(MagicLazyLoaderService), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.Compiler)); };
1159
- static ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
1554
+ /** @nocollapse */ static ɵfac = function MagicOverlayContainerWrapper_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainerWrapper)(i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(MagicLazyLoaderService), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.Compiler)); };
1555
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
1160
1556
  i0.ɵɵviewQuery(_c0$2, 7);
1161
1557
  } if (rf & 2) {
1162
1558
  let _t;
1163
1559
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.overlayContainerWrapperElementRef = _t.first);
1164
- } }, inputs: { Component: "Component", Parameters: "Parameters", OverlayTypeParam: "OverlayTypeParam" }, outputs: { onClose: "onClose" }, decls: 7, vars: 0, consts: [["overlayContainerWrapper", ""], ["overlayContent", ""], ["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["magicViewContainerRef", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) { if (rf & 1) {
1560
+ } }, inputs: { Component: "Component", Parameters: "Parameters", OverlayTypeParam: "OverlayTypeParam" }, outputs: { onClose: "onClose" }, standalone: false, decls: 7, vars: 0, consts: [["overlayContainerWrapper", ""], ["overlayContent", ""], ["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["magicViewContainerRef", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) { if (rf & 1) {
1165
1561
  i0.ɵɵelementStart(0, "div");
1166
1562
  i0.ɵɵelement(1, "div", 2);
1167
1563
  i0.ɵɵelementStart(2, "div", 3, 0);
@@ -1182,7 +1578,7 @@ class MagicOverlayContainerWrapper {
1182
1578
  </div>
1183
1579
  <div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" ></div>
1184
1580
  </div>
1185
- `, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
1581
+ `, standalone: false, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
1186
1582
  }], () => [{ type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i0.Compiler }], { Component: [{
1187
1583
  type: Input
1188
1584
  }], Parameters: [{
@@ -1195,11 +1591,14 @@ class MagicOverlayContainerWrapper {
1195
1591
  type: ViewChild,
1196
1592
  args: ['overlayContainerWrapper', { static: true }]
1197
1593
  }] }); })();
1198
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src\\ui\\magic-modal\\magic-overlay-container-wrapper.ts", lineNumber: 45 }); })();
1594
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src/ui/magic-modal/magic-overlay-container-wrapper.ts", lineNumber: 46 }); })();
1199
1595
 
1596
+ /***
1597
+ * This is sample component for the alert message
1598
+ */
1200
1599
  class MagicAlertComponent extends BaseMagicAlertComponent {
1201
- static ɵfac = (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(t) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(t || MagicAlertComponent); }; })();
1202
- static ɵ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) {
1600
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(__ngFactoryType__) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(__ngFactoryType__ || MagicAlertComponent); }; })();
1601
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
1203
1602
  i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1204
1603
  i0.ɵɵtext(3);
1205
1604
  i0.ɵɵelementEnd();
@@ -1226,13 +1625,16 @@ class MagicAlertComponent extends BaseMagicAlertComponent {
1226
1625
 
1227
1626
  <button (click)="OnClose()">OK</button>
1228
1627
  </div>
1229
- </div>`, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
1628
+ </div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
1230
1629
  }], null, null); })();
1231
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src\\ui\\components\\magic-alert.component.ts", lineNumber: 48 }); })();
1630
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src/ui/components/magic-alert.component.ts", lineNumber: 49 }); })();
1232
1631
 
1632
+ /***
1633
+ * This is sample component for the confirmation box
1634
+ */
1233
1635
  class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1234
- static ɵfac = (() => { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(t) { return (ɵMagicConfirmationBoxComponent_BaseFactory || (ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent)))(t || MagicConfirmationBoxComponent); }; })();
1235
- static ɵ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) {
1636
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(__ngFactoryType__) { return (ɵMagicConfirmationBoxComponent_BaseFactory || (ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent)))(__ngFactoryType__ || MagicConfirmationBoxComponent); }; })();
1637
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], standalone: false, 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) {
1236
1638
  i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1237
1639
  i0.ɵɵtext(3);
1238
1640
  i0.ɵɵelementEnd();
@@ -1265,29 +1667,56 @@ class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1265
1667
  <button (click)="OnClose(true)">OK</button>
1266
1668
  <button class="cancel" (click)="OnClose(false)">Cancel</button>
1267
1669
  </div>
1268
- </div>`, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
1670
+ </div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
1269
1671
  }], null, null); })();
1270
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src\\ui\\components\\magic-confirmation-box.component.ts", lineNumber: 54 }); })();
1672
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src/ui/components/magic-confirmation-box.component.ts", lineNumber: 55 }); })();
1271
1673
 
1674
+ /**
1675
+ * Service managing overlay windows
1676
+ * This is Magic's default provider
1677
+ */
1678
+ /**
1679
+ * Service managing alert and confirmation windows
1680
+ * This is Magic's default provider
1681
+ */
1272
1682
  class ConfirmationComponentsMagicProvider {
1683
+ /**
1684
+ * Return true when use default javascript alert and confirmation or return false to provide custom components
1685
+ * @returns true is we want to use default javascript alert and confirmation
1686
+ */
1273
1687
  showDefaultConfirmations() {
1274
1688
  return true;
1275
1689
  }
1690
+ /**
1691
+ * Returns component that will replace javascript alert. The component will be used only if showDefaultConfirmations = false
1692
+ * @returns component that will replace javascript Alert
1693
+ */
1276
1694
  getAlertComponent() {
1277
1695
  return MagicAlertComponent;
1278
1696
  }
1697
+ /**
1698
+ * Returns component that will replace javascript confirmation box. The component will be used only if showDefaultConfirmations = false
1699
+ * @returns component that will replace javascript confirmation box
1700
+ */
1279
1701
  getConfirmtionComponent() {
1280
1702
  return MagicConfirmationBoxComponent;
1281
1703
  }
1282
- static ɵfac = function ConfirmationComponentsMagicProvider_Factory(t) { return new (t || ConfirmationComponentsMagicProvider)(); };
1283
- static ɵprov = i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1704
+ /** @nocollapse */ static ɵfac = function ConfirmationComponentsMagicProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConfirmationComponentsMagicProvider)(); };
1705
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1284
1706
  }
1285
1707
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmationComponentsMagicProvider, [{
1286
1708
  type: Injectable
1287
1709
  }], null, null); })();
1288
1710
 
1711
+ /**
1712
+ * Displays a message-box
1713
+ */
1289
1714
  class confirmationBox {
1715
+ /**
1716
+ * @ignore
1717
+ */
1290
1718
  static isConfirmBox(style) {
1719
+ // button format mask is in first nibble from right
1291
1720
  let buttonMode = style & 0x0F;
1292
1721
  var isConfirm = (buttonMode === Styles.MSGBOX_BUTTON_OK_CANCEL) ||
1293
1722
  (buttonMode === Styles.MSGBOX_BUTTON_ABORT_RETRY_IGNORE) ||
@@ -1296,7 +1725,14 @@ class confirmationBox {
1296
1725
  (buttonMode === Styles.MSGBOX_BUTTON_RETRY_CANCEL);
1297
1726
  return (isConfirm);
1298
1727
  }
1728
+ /**
1729
+ * Converts the result from the HTML window to the expected result type
1730
+ * @param style Result received from HTML window
1731
+ * @param okWasPressed Was the "OK" pressed
1732
+ * @returns MessageBox result type
1733
+ */
1299
1734
  static convertToExcpectedResultBox(style, okWasPressed) {
1735
+ // button format mask is in first nibble from right
1300
1736
  let buttonMode = style & 0x0F;
1301
1737
  let retValue = Styles.MSGBOX_RESULT_OK;
1302
1738
  if (buttonMode === Styles.MSGBOX_BUTTON_OK)
@@ -1313,9 +1749,18 @@ class confirmationBox {
1313
1749
  retValue = okWasPressed ? Styles.MSGBOX_RESULT_RETRY : Styles.MSGBOX_RESULT_CANCEL;
1314
1750
  return retValue;
1315
1751
  }
1752
+ /**
1753
+ * Show a message box as an HTML window
1754
+ * @param title Title of the message box
1755
+ * @param message Message that will be display in the message box
1756
+ * @param style Style that include buttons \ Icons
1757
+ * @returns MessageBox result
1758
+ */
1316
1759
  static showConfirmationBox(title, message, style) {
1317
1760
  let okWasPressed = false;
1761
+ // check if it is confirmation box
1318
1762
  let isConfirm = this.isConfirmBox(style);
1763
+ // the title will be added to the string and we will add new line after the title
1319
1764
  let titleAndString = title + '\n' + '\n' + message;
1320
1765
  if (isConfirm)
1321
1766
  okWasPressed = confirm(titleAndString);
@@ -1323,10 +1768,14 @@ class confirmationBox {
1323
1768
  alert(titleAndString);
1324
1769
  okWasPressed = true;
1325
1770
  }
1771
+ // return the result from the user
1326
1772
  return okWasPressed;
1327
1773
  }
1328
1774
  }
1329
1775
 
1776
+ /**
1777
+ * Service managing overlay windows
1778
+ */
1330
1779
  class OverlayWindowService {
1331
1780
  componentList;
1332
1781
  engineMagicService;
@@ -1344,6 +1793,7 @@ class OverlayWindowService {
1344
1793
  this.overlayContainerMagicProvider = overlayContainerMagicProvider;
1345
1794
  this.confirmationComponentsMagicProvider = confirmationComponentsMagicProvider;
1346
1795
  }
1796
+ // The view reference of container of overlay window
1347
1797
  overlayWindowsContainerViewRef;
1348
1798
  overlayWindowFocusManager = null;
1349
1799
  changeDetectorRef = null;
@@ -1359,6 +1809,7 @@ class OverlayWindowService {
1359
1809
  if (lazyLoadModule != null) {
1360
1810
  const Magic = 'Magic';
1361
1811
  const Module = 'Module';
1812
+ // extract name of module(XX) from 'MagicXXModule'
1362
1813
  const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
1363
1814
  this.magicLazyModuleLoader.Load(moduleName).then(m => {
1364
1815
  const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
@@ -1374,6 +1825,7 @@ class OverlayWindowService {
1374
1825
  }
1375
1826
  }
1376
1827
  open(formName, taskId, taskDescription) {
1828
+ // for overlay which are lazy loaded don't find data in component-list
1377
1829
  let comp = this.componentList.lazyLoadModulesMap != null && this.componentList.lazyLoadModulesMap.hasOwnProperty(formName) ? null : this.componentList.getComponent(formName);
1378
1830
  let parameters = { taskIdParam: taskId, taskDescription: taskDescription };
1379
1831
  let componentRef = this.createModalComponent({ MagicFormName: formName, ModalComp: comp, ModalCompParameters: parameters }, this.overlayContainerMagicProvider.getComponent(), OverlayType.Overlay);
@@ -1382,21 +1834,31 @@ class OverlayWindowService {
1382
1834
  guiEvent.TaskID = taskId;
1383
1835
  this.engineMagicService.insertEvent(guiEvent);
1384
1836
  });
1837
+ //using the same changeDetectorRef from root-component
1385
1838
  this.changeDetectorRef.detectChanges();
1386
1839
  }
1387
1840
  close(commandStr) {
1841
+ // Close the overlay by removing the overlay window from its container
1388
1842
  this.overlayWindowsContainerViewRef.remove();
1389
1843
  this.overlayWindowFocusManager.popDialog();
1390
1844
  let guiEvent1 = getGuiEventObj("dispose", null, 0);
1391
1845
  guiEvent1.TaskID = commandStr;
1392
1846
  this.engineMagicService.insertEvent(guiEvent1);
1393
1847
  }
1848
+ /**
1849
+ * Open Confirmation box
1850
+ * @param title title of the box
1851
+ * @param msg message
1852
+ * @param style Magic style
1853
+ */
1394
1854
  openConfirmationBox(title, msg, style) {
1855
+ //show default confirmations
1395
1856
  if (this.confirmationComponentsMagicProvider.showDefaultConfirmations()) {
1396
1857
  let res = confirmationBox.showConfirmationBox(title, msg, style);
1397
1858
  this.finishConfirmation(style, res);
1398
1859
  }
1399
1860
  else {
1861
+ //show custom confirmations
1400
1862
  let comp = confirmationBox.isConfirmBox(style) ? this.confirmationComponentsMagicProvider.getConfirmtionComponent() : this.confirmationComponentsMagicProvider.getAlertComponent();
1401
1863
  let overlayType = confirmationBox.isConfirmBox(style) ? OverlayType.ConfirmationBox : OverlayType.Alert;
1402
1864
  let componentRef = this.createModalComponent({ title: title, message: msg }, comp, overlayType);
@@ -1407,11 +1869,21 @@ class OverlayWindowService {
1407
1869
  });
1408
1870
  }
1409
1871
  }
1872
+ /**
1873
+ * This method is called on close of the confirmation
1874
+ * @param style Magic style
1875
+ * @param result
1876
+ */
1410
1877
  finishConfirmation(style, result) {
1411
1878
  let guiEvent = getGuiEventObj("confirmationClosed", null, 0);
1412
1879
  guiEvent.keyCode = confirmationBox.convertToExcpectedResultBox(style, result);
1413
1880
  this.engineMagicService.insertEvent(guiEvent);
1414
1881
  }
1882
+ /**
1883
+ * creates a modal component. Can be used for overlay, message box or confirmation box
1884
+ * @param parameters component's parameters
1885
+ * @param component components to create
1886
+ */
1415
1887
  createModalComponent(parameters, component, overlayType) {
1416
1888
  let componentRef;
1417
1889
  let magicModalContainerParameters = {
@@ -1419,15 +1891,17 @@ class OverlayWindowService {
1419
1891
  Parameters: parameters,
1420
1892
  OverlayTypeParam: overlayType
1421
1893
  };
1894
+ // Create the UI component of modal window
1422
1895
  let viewCRef = this.overlayWindowsContainerViewRef;
1423
1896
  componentRef = viewCRef.createComponent(MagicOverlayContainerWrapper);
1897
+ // Set the data to newly created component
1424
1898
  Object.assign(componentRef.instance, magicModalContainerParameters);
1425
1899
  this.overlayWindowFocusManager.pushDialog(componentRef.instance.GetRootElement());
1426
1900
  componentRef.instance.DetectChanges();
1427
1901
  return componentRef;
1428
1902
  }
1429
- static ɵfac = function OverlayWindowService_Factory(t) { return new (t || OverlayWindowService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(OverlayContainerMagicProvider), i0.ɵɵinject(ConfirmationComponentsMagicProvider)); };
1430
- static ɵprov = i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac, providedIn: 'root' });
1903
+ /** @nocollapse */ static ɵfac = function OverlayWindowService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OverlayWindowService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(OverlayContainerMagicProvider), i0.ɵɵinject(ConfirmationComponentsMagicProvider)); };
1904
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac, providedIn: 'root' });
1431
1905
  }
1432
1906
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayWindowService, [{
1433
1907
  type: Injectable,
@@ -1555,50 +2029,135 @@ class DialogInfo {
1555
2029
  }
1556
2030
  }
1557
2031
 
2032
+ /**
2033
+ * Main service to connect the UI with the Magic WebCLient
2034
+ */
1558
2035
  class TaskMagicService {
1559
2036
  magic;
1560
2037
  overlayWindowService;
2038
+ /**
2039
+ * Service to provide table-related functionalities
2040
+ */
1561
2041
  tableService;
2042
+ /**
2043
+ * Collection of data for all controls
2044
+ */
1562
2045
  Records = new Records();
2046
+ /**
2047
+ * FormGroup collection for line mode
2048
+ */
1563
2049
  formGroups = [];
2050
+ /**
2051
+ * FormGroup for all controls in screen mode
2052
+ */
1564
2053
  ScreenModeControls;
2054
+ /**
2055
+ * @ignore
2056
+ */
1565
2057
  refreshDom = new Subject();
2058
+ /**
2059
+ * @ignore
2060
+ */
1566
2061
  subscribeRefreshDom;
2062
+ /**
2063
+ * @ignore
2064
+ */
1567
2065
  detectChanges = new Subject();
2066
+ /**
2067
+ * @ignore
2068
+ */
1568
2069
  subscribeInteractiveCommands;
2070
+ /**
2071
+ * @ignore
2072
+ */
1569
2073
  interactiveCommands = new Subject();
2074
+ /**
2075
+ * @ignore
2076
+ * This event is emitted when the selected row in a table changes.
2077
+ */
1570
2078
  OnSelectedRowChanged = new EventEmitter();
2079
+ /**
2080
+ * @ignore
2081
+ */
1571
2082
  customPropertiesSubject = new Subject();
2083
+ /**
2084
+ * @ignore
2085
+ */
1572
2086
  recordsCountChangeSubject = new Subject();
1573
2087
  mgLoadSubject = new Subject();
2088
+ /**
2089
+ * @ignore
2090
+ */
1574
2091
  template;
2092
+ /**
2093
+ * Service to provide subform-related functionalities
2094
+ */
1575
2095
  mgSubformService;
2096
+ /**
2097
+ * Service to provide the title-change functionality
2098
+ */
1576
2099
  mgTitleService;
2100
+ /**
2101
+ * Service which enables getting/setting values from/to the Magic WebClient engine
2102
+ */
1577
2103
  mgAccessorService;
1578
2104
  mgInputDateFormat;
2105
+ /**
2106
+ * @ignore
2107
+ */
1579
2108
  oldPageSize = 0;
2109
+ /**
2110
+ *
2111
+ * @param magic
2112
+ */
1580
2113
  constructor(magic, overlayWindowService) {
1581
2114
  this.magic = magic;
1582
2115
  this.overlayWindowService = overlayWindowService;
1583
2116
  this.Records.setGuiTopIndex(0);
1584
2117
  this.mgInputDateFormat = null;
1585
2118
  }
2119
+ /**
2120
+ * returns true if used is logged in
2121
+ * @returns
2122
+ */
1586
2123
  getIsLoggenIn() {
1587
2124
  return this.magic.getIsLoggedIn();
1588
2125
  }
2126
+ /**
2127
+ * Id of task to which this service refers
2128
+ */
1589
2129
  _taskId;
2130
+ /**
2131
+ * returns the task Id
2132
+ * @returns
2133
+ */
1590
2134
  get taskId() {
1591
2135
  return this._taskId;
1592
2136
  }
2137
+ /**
2138
+ * Sets the task Id
2139
+ * @param value the task id to set
2140
+ */
1593
2141
  set taskId(value) {
2142
+ // debugger;
1594
2143
  this._taskId = value;
1595
2144
  }
2145
+ /**
2146
+ * Returns the task's data in Screen mode
2147
+ * @returns
2148
+ */
1596
2149
  get ScreenControlsData() {
1597
2150
  return this.Records.list['0'];
1598
2151
  }
2152
+ /**
2153
+ * @ignore
2154
+ */
1599
2155
  settemplate(value) {
1600
2156
  this.template = value;
1601
2157
  }
2158
+ /**
2159
+ * Builds the FormControl for each and every control
2160
+ */
1602
2161
  buildScreenModeControls() {
1603
2162
  const group = new FormGroup({});
1604
2163
  for (const key in this.template) {
@@ -1610,10 +2169,21 @@ class TaskMagicService {
1610
2169
  }
1611
2170
  this.ScreenModeControls = group;
1612
2171
  }
2172
+ /**
2173
+ * Is the control a table control
2174
+ * @param id Id of the control
2175
+ * @returns
2176
+ */
1613
2177
  isTableControl(id) {
1614
2178
  return this.template[id] == '1';
1615
2179
  }
1616
2180
  getMgInputDateFormat() { return this.mgInputDateFormat; }
2181
+ /**
2182
+ * Returns the FormControl of a control
2183
+ * @param guiRowid Id of the requested row
2184
+ * @param id Id of the control
2185
+ * @returns
2186
+ */
1617
2187
  getFormControl(guiRowid, id) {
1618
2188
  let c;
1619
2189
  let group = this.isTableControl(id) ? this.formGroups[guiRowid] : this.ScreenModeControls;
@@ -1623,12 +2193,21 @@ class TaskMagicService {
1623
2193
  }
1624
2194
  return c;
1625
2195
  }
2196
+ /**
2197
+ * handle the change of text for input control inside table
2198
+ * @param guiRowId Id of the row for which the FormControls are built
2199
+ * set the new value of the formcontrol
2200
+ */
1626
2201
  setInputTextValue(controlId, guiRowid, val) {
1627
2202
  this.setValue(controlId, guiRowid, this.ConvertValToNative(controlId, 0, val));
1628
2203
  const fc = this.getFormControl(guiRowid, controlId);
1629
2204
  if (!isNullOrUndefined(val))
1630
2205
  fc.setValue(val);
1631
2206
  }
2207
+ /**
2208
+ * Build the FormControls for a table row
2209
+ * @param guiRowId Id of the row for which the FormControls are built
2210
+ */
1632
2211
  buildTableRowControls(guiRowId) {
1633
2212
  const group = new FormGroup({});
1634
2213
  for (const key in this.template) {
@@ -1640,30 +2219,58 @@ class TaskMagicService {
1640
2219
  }
1641
2220
  this.formGroups[guiRowId] = group;
1642
2221
  }
2222
+ /**
2223
+ *
2224
+ * @ignore
2225
+ */
1643
2226
  updateRecordsBeforeCurrentView(value) {
1644
2227
  this.Records.recordsBeforeCurrentView = value;
1645
2228
  }
2229
+ /**
2230
+ * @ignore
2231
+ */
1646
2232
  setIncludesFirst(value) {
1647
2233
  this.Records.includesFirst = value;
1648
2234
  }
2235
+ /**
2236
+ * @ignore
2237
+ */
1649
2238
  setIncludesLast(value) {
1650
2239
  this.Records.includesLast = value;
1651
2240
  }
2241
+ /**
2242
+ * @ignore
2243
+ */
1652
2244
  markRowAsCreated(guiRowId) {
1653
2245
  this.Records.markRowAsCreated(guiRowId);
1654
2246
  }
2247
+ /**
2248
+ * @ignore
2249
+ */
1655
2250
  markRowAsNotCreated(guiRowId) {
1656
2251
  this.Records.markRowAsNotCreated(guiRowId);
1657
2252
  }
2253
+ /**
2254
+ * @ignore
2255
+ */
1658
2256
  startRowEditing(guiRowId) {
1659
2257
  this.Records.startRowEditing(guiRowId);
1660
2258
  }
2259
+ /**
2260
+ * @ignore
2261
+ */
1661
2262
  stopRowEditing(guiRowId) {
1662
2263
  this.Records.stopRowEditing(guiRowId);
1663
2264
  }
2265
+ /**
2266
+ * @ignore
2267
+ */
1664
2268
  isRowInRowEditing(guiRowId) {
1665
2269
  return this.Records.isRowInRowEditing(guiRowId);
1666
2270
  }
2271
+ /**
2272
+ * @ignore
2273
+ */
1667
2274
  setIsEmptyDataView(isEmpty) {
1668
2275
  if (this.Records.isEmptyDataView !== isEmpty) {
1669
2276
  if (isEmpty)
@@ -1673,6 +2280,11 @@ class TaskMagicService {
1673
2280
  this.refreshView();
1674
2281
  }
1675
2282
  }
2283
+ /**
2284
+ * Initialize the service to work with the task
2285
+ * @param taskId Id of the task
2286
+ * @param taskDescription
2287
+ */
1676
2288
  initTask(taskId, taskDescription) {
1677
2289
  this.Records.createFirst();
1678
2290
  this.oldPageSize = 0;
@@ -1684,39 +2296,80 @@ class TaskMagicService {
1684
2296
  this.settemplate(taskDescription);
1685
2297
  }
1686
2298
  this.buildScreenModeControls();
2299
+ // remove previous subscriptions
1687
2300
  if (!isNullOrUndefined(this.subscribeRefreshDom))
1688
2301
  this.subscribeRefreshDom.unsubscribe();
1689
2302
  if (!isNullOrUndefined(this.subscribeInteractiveCommands))
1690
2303
  this.subscribeInteractiveCommands.unsubscribe();
1691
2304
  this.subscribeRefreshDom = this.magic.refreshDom.pipe(filter(command => command.TaskTag === this.taskId))
1692
2305
  .subscribe(command => {
2306
+ // console.log("Task " + command.TaskTag + "command " + command.CommandType);
1693
2307
  this.executeCommand(command);
1694
2308
  });
1695
2309
  this.subscribeInteractiveCommands = this.magic.interactiveCommands
1696
2310
  .pipe(filter(command => command.TaskTag === this.taskId))
1697
2311
  .subscribe(command => {
2312
+ // console.log("Task " + command.TaskTag + "command " + command.CommandType);
1698
2313
  this.executeInteractiveCommand(command);
1699
2314
  });
1700
2315
  }
2316
+ /**
2317
+ * @ignore
2318
+ */
1701
2319
  refreshView() {
1702
2320
  this.detectChanges.next('');
1703
2321
  }
2322
+ /**
2323
+ * Insert an event to the Magic WebClient event queue
2324
+ * @param guiEvent The event to insert
2325
+ */
1704
2326
  insertEvent(guiEvent) {
1705
2327
  guiEvent.TaskID = this.taskId;
1706
2328
  this.magic.insertEvent(guiEvent);
1707
2329
  }
2330
+ /**
2331
+ * @ignore
2332
+ */
1708
2333
  GetControlPictureMask(controlName) {
1709
2334
  return this.magic.GetControlPictureMask(this.taskId, controlName);
1710
2335
  }
2336
+ /**
2337
+ * @ignore
2338
+ */
2339
+ UploadFileToServer(fileContent, serverFileName) {
2340
+ return this.magic.UploadFileToServer(fileContent, serverFileName);
2341
+ }
2342
+ async DownloadFileFromServer(serverFileName) {
2343
+ return await this.magic.DownloadFileFromServer(serverFileName);
2344
+ }
2345
+ /**
2346
+ * Validates the control value, using the Magic WebClient
2347
+ * @param controlName Id of validated control
2348
+ * @param value value to be validated
2349
+ * @returns If validation fails, returns error message, else returns null
2350
+ */
1711
2351
  ValidateControlValue(controlName, value) {
1712
2352
  return this.magic.ValidateControlValue(this.taskId, controlName, value);
1713
2353
  }
2354
+ /**
2355
+ * @ignore
2356
+ */
1714
2357
  GetRangedValue(controlName, value) {
1715
2358
  return this.magic.GetRangedValue(this.taskId, controlName, value);
1716
2359
  }
2360
+ /**
2361
+ * @ignore
2362
+ */
1717
2363
  GetFldRanges(controlName) {
1718
2364
  return this.magic.GetFldRanges(this.taskId, controlName);
1719
2365
  }
2366
+ /**
2367
+ * returns the value of a property of the control
2368
+ * @param controlId Id of control
2369
+ * @param prop Property
2370
+ * @param guiRowId Row Id, if applicable
2371
+ * @returns Property value
2372
+ */
1720
2373
  getProperty(controlId, prop, guiRowId) {
1721
2374
  if (isNullOrUndefined(guiRowId))
1722
2375
  guiRowId = '0';
@@ -1730,6 +2383,9 @@ class TaskMagicService {
1730
2383
  return this.Records.list[guiRowId].getProperty(controlId, prop);
1731
2384
  }
1732
2385
  }
2386
+ /**
2387
+ * @ignore
2388
+ */
1733
2389
  getPropertyStub(ControlsProperties, controlId, prop) {
1734
2390
  ControlsProperties = ControlsProperties.ControlsProperties;
1735
2391
  if (controlId in ControlsProperties) {
@@ -1739,15 +2395,31 @@ class TaskMagicService {
1739
2395
  }
1740
2396
  return '';
1741
2397
  }
2398
+ /**
2399
+ * @ignore
2400
+ */
1742
2401
  getStyleStub(ControlsProperties, controlId, styleName) {
1743
2402
  ControlsProperties = ControlsProperties.ControlsProperties;
1744
2403
  return ControlsProperties[controlId].stylesMap.get(styleName);
1745
2404
  }
2405
+ /**
2406
+ * Return the CSS classes used for this control
2407
+ * @param controlId Id of control
2408
+ * @param guiRowId Row Id, if applicable
2409
+ * @returns String containing the classes currently defined for this control
2410
+ */
1746
2411
  getClasses(controlId, guiRowId) {
1747
2412
  if (isNullOrUndefined(guiRowId))
1748
2413
  guiRowId = '0';
1749
2414
  return this.Records.list[guiRowId].getControlMetadata(controlId).classes;
1750
2415
  }
2416
+ /**
2417
+ * Return the value of a style used for a control
2418
+ * @param controlId Id of control
2419
+ * @param styleName Name of style
2420
+ * @param guiRowId Row Id, if applicable
2421
+ * @returns value of style of the control
2422
+ */
1751
2423
  getStyle(controlId, styleName, guiRowId) {
1752
2424
  if (isNullOrUndefined(guiRowId))
1753
2425
  guiRowId = '0';
@@ -1758,21 +2430,45 @@ class TaskMagicService {
1758
2430
  return StylesMapManager.magicValueGetStyle(styleName, magicValue);
1759
2431
  }
1760
2432
  }
2433
+ /**
2434
+ * Return the value of a control
2435
+ * @param controlId Id of control
2436
+ * @param guiRowId Row Id, if applicable
2437
+ * @returns value of the control
2438
+ */
1761
2439
  getValue(controlId, guiRowId) {
1762
2440
  if (isNullOrUndefined(guiRowId))
1763
2441
  guiRowId = '0';
1764
2442
  return this.Records.list.length > +guiRowId ? this.Records.list[guiRowId].values[controlId] : '';
1765
2443
  }
2444
+ /**
2445
+ * Return the formatted value of a control
2446
+ * @param controlId Id of control
2447
+ * @param guiRowId Row Id, if applicable
2448
+ * @returns value of the control
2449
+ */
1766
2450
  getFormattedValue(controlName, val, rowId) {
1767
2451
  return this.magic.GetFormattedValue(this.taskId, controlName, val, rowId);
1768
2452
  }
2453
+ /**
2454
+ * Sets the value of a control
2455
+ * @param controlId Id of control
2456
+ * @param guiRowId Row Id, if applicable
2457
+ * @param value Value to set
2458
+ */
1769
2459
  setValue(controlId, guiRowId, value) {
1770
2460
  return this.Records.list[guiRowId].setValue(controlId, value);
1771
2461
  }
2462
+ /**
2463
+ * @ignore
2464
+ */
1772
2465
  executeInteractiveCommand(guiInteractiveCommand) {
1773
2466
  GuiInteractiveExecutor.executeInteractiveCommand(this, guiInteractiveCommand, this.overlayWindowService);
1774
2467
  this.interactiveCommands.next(guiInteractiveCommand);
1775
2468
  }
2469
+ /**
2470
+ * @ignore
2471
+ */
1776
2472
  handleSetProperty(command, isTableChild) {
1777
2473
  let controlId = command.CtrlName;
1778
2474
  let dvRowId = (command.line || 0);
@@ -1809,6 +2505,7 @@ class TaskMagicService {
1809
2505
  let controlId = command.CtrlName;
1810
2506
  let properties;
1811
2507
  let isTableChild = this.isTableControl(controlId);
2508
+ // For non-input type controls on table.
1812
2509
  if (command.obj !== null)
1813
2510
  isTableChild = isTableChild || command.obj.IsTableChild;
1814
2511
  guiRowId = this.getGuiRowId(dvRowId, isTableChild);
@@ -1871,8 +2568,10 @@ class TaskMagicService {
1871
2568
  break;
1872
2569
  case CommandType.PROP_SET_USER_PROPERTY:
1873
2570
  properties = this.Records.list[guiRowId].getControlMetadata(controlId);
2571
+ // if the property has changed, set the property and raise the subject
1874
2572
  if (properties.userProperties.get(command.Operation) !== command.obj1) {
1875
2573
  properties.userProperties.set(command.Operation, command.obj1);
2574
+ // the property name is of format <controlName>~<propertyName>
1876
2575
  this.customPropertiesSubject.next({ propertyName: controlId + '~' + command.Operation, value: command.obj1, rowId: guiRowId });
1877
2576
  }
1878
2577
  break;
@@ -1926,6 +2625,9 @@ class TaskMagicService {
1926
2625
  break;
1927
2626
  }
1928
2627
  }
2628
+ /**
2629
+ custom validator
2630
+ */
1929
2631
  customValidator(rowid, id) {
1930
2632
  return (control) => {
1931
2633
  let controlMetadata;
@@ -1939,6 +2641,13 @@ class TaskMagicService {
1939
2641
  return null;
1940
2642
  };
1941
2643
  }
2644
+ /**
2645
+ * COnvert a value from Magic format to native format
2646
+ * @param controlId Id of control
2647
+ * @param rowId Row Id, if applicable
2648
+ * @param val Value to convert
2649
+ * @returns Converted value
2650
+ */
1942
2651
  ConvertValToNative(controlId, rowId, val) {
1943
2652
  let properties;
1944
2653
  properties = this.Records.list[0].getControlMetadata(controlId);
@@ -1990,6 +2699,13 @@ class TaskMagicService {
1990
2699
  return val;
1991
2700
  }
1992
2701
  }
2702
+ /**
2703
+ * Convert a value from native to Magic format
2704
+ * @param controlId Id of control
2705
+ * @param rowId Row Id, if applicable
2706
+ * @param val Value to convert
2707
+ * @returns Converted value
2708
+ */
1993
2709
  ConvertValFromNative(controlId, rowId, val) {
1994
2710
  let properties;
1995
2711
  properties = this.Records.list[0].getControlMetadata(controlId);
@@ -2032,12 +2748,22 @@ class TaskMagicService {
2032
2748
  return val;
2033
2749
  }
2034
2750
  }
2751
+ /**
2752
+ * Handle resize and also fetch chunk of records if having an empty view.
2753
+ * @ignore
2754
+ * @param pageSize : PageSize
2755
+ * @param topGuiRowId : GuiRowId of first record in view.
2756
+ */
2035
2757
  resize(pageSize, topGuiRowId) {
2036
2758
  let guiEvent = getGuiEventObj('resize', 'table', 0);
2037
2759
  guiEvent.PageSize = pageSize;
2760
+ //As 'getRows' event also gets executed, set the guiEvent.Line parameter.
2038
2761
  guiEvent.Line = topGuiRowId;
2039
2762
  this.insertEvent(guiEvent);
2040
2763
  }
2764
+ /**
2765
+ * Fetches data for new table rows when scrolling done
2766
+ */
2041
2767
  onScrollDown() {
2042
2768
  if (!this.Records.includesLast) {
2043
2769
  let guiEvent = getGuiEventObj('getRows', '', 0);
@@ -2045,15 +2771,29 @@ class TaskMagicService {
2045
2771
  this.insertEvent(guiEvent);
2046
2772
  }
2047
2773
  }
2774
+ /**
2775
+ * Sets the new browser window title
2776
+ * @param newTitle New window title
2777
+ */
2048
2778
  setTitle(newTitle) {
2049
2779
  this.mgTitleService.setTitle(newTitle);
2050
2780
  }
2781
+ /**
2782
+ * @ignore
2783
+ */
2051
2784
  getGuiRowId(dvRowId, isTableControl) {
2052
2785
  return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
2053
2786
  }
2787
+ /**
2788
+ *
2789
+ * @ignore
2790
+ */
2054
2791
  getDvRowId(guiRowId) {
2055
2792
  return (guiRowId - this.Records.recordsBeforeCurrentView);
2056
2793
  }
2794
+ /**
2795
+ * Clean up the service when it is no longer needed
2796
+ */
2057
2797
  dispose() {
2058
2798
  this.refreshDom.complete();
2059
2799
  this.detectChanges.complete();
@@ -2063,6 +2803,14 @@ class TaskMagicService {
2063
2803
  this.customPropertiesSubject.complete();
2064
2804
  this.OnSelectedRowChanged.complete();
2065
2805
  }
2806
+ ///////////////////////////////
2807
+ //Events:
2808
+ /**
2809
+ * Handle the Combobox "change" event
2810
+ * @param event The event received from the UI
2811
+ * @param idx Id of the control raising the event
2812
+ * @param line Row Id, if applicable
2813
+ */
2066
2814
  onComboboxSelectionChanged(event, idx, line) {
2067
2815
  let guiEvent = getGuiEventObj('selectionchanged', idx, line);
2068
2816
  if (typeof (event) == 'number') {
@@ -2081,6 +2829,11 @@ class TaskMagicService {
2081
2829
  }
2082
2830
  this.insertEvent(guiEvent);
2083
2831
  }
2832
+ /**
2833
+ * Handle the Listbox "change" event
2834
+ * @param event The event received from the UI
2835
+ * @param idx Id of the control raising the event
2836
+ */
2084
2837
  onListBoxSelectionChanged(event, idx) {
2085
2838
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2086
2839
  let selectedOptions;
@@ -2096,9 +2849,15 @@ class TaskMagicService {
2096
2849
  else
2097
2850
  indexes[i] = (selectedOptions[i]).value;
2098
2851
  }
2099
- guiEvent.Value = indexes;
2852
+ guiEvent.Value = indexes; // TODO: fix
2100
2853
  this.insertEvent(guiEvent);
2101
2854
  }
2855
+ /**
2856
+ * Handle the Checkbox "change" event
2857
+ * @param event The event received from the UI
2858
+ * @param idx Id of the control raising the event
2859
+ * @param rowId Row Id, if applicable
2860
+ */
2102
2861
  onCheckChanged(event, idx, rowId) {
2103
2862
  if (typeof rowId === 'undefined')
2104
2863
  rowId = 0;
@@ -2107,12 +2866,12 @@ class TaskMagicService {
2107
2866
  guiEvent.Value = event;
2108
2867
  }
2109
2868
  else if (typeof (event) == 'string') {
2110
- if (event == "unchecked") {
2869
+ if (event == "unchecked") { // @ts-ignore
2111
2870
  guiEvent.Value = false;
2112
2871
  }
2113
2872
  else if (event == 'indeterminate')
2114
2873
  guiEvent.Value = null;
2115
- else if (event == 'checked') {
2874
+ else if (event == 'checked') { // @ts-ignore
2116
2875
  guiEvent.Value = true;
2117
2876
  }
2118
2877
  }
@@ -2124,11 +2883,21 @@ class TaskMagicService {
2124
2883
  }
2125
2884
  this.insertEvent(guiEvent);
2126
2885
  }
2886
+ /**
2887
+ * Handle tab selection change, caused by UI events
2888
+ * @param idx Id of the control raising the event
2889
+ * @param layer Id of selected tabpage
2890
+ */
2127
2891
  mgOnTabSelectionChanged(idx, layer) {
2128
2892
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2129
2893
  guiEvent.Value = layer.toString();
2130
2894
  this.insertEvent(guiEvent);
2131
2895
  }
2896
+ /**
2897
+ * Handle the Radio button "change" event
2898
+ * @param event The event received from the UI
2899
+ * @param idx Id of the control raising the event
2900
+ */
2132
2901
  mgOnRadioSelectionChanged(idx) {
2133
2902
  let result = this.getFormControl('0', idx);
2134
2903
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
@@ -2138,16 +2907,34 @@ class TaskMagicService {
2138
2907
  guiEvent.Value = result.value.toString();
2139
2908
  this.insertEvent(guiEvent);
2140
2909
  }
2910
+ /**
2911
+ * Inserts the "close" event to the magic WebClient event queue
2912
+ */
2141
2913
  close() {
2142
2914
  this.insertEvent(getGuiEventObj('close', null, 0));
2143
2915
  }
2916
+ ///////////////////////////////
2917
+ /**
2918
+ * @ignore
2919
+ */
2144
2920
  IsStub() {
2145
2921
  return this.magic.isStub;
2146
2922
  }
2923
+ //////////////////////////////////////////////////////////////
2924
+ ///Stub handling
2925
+ /**
2926
+ * @ignore
2927
+ */
2147
2928
  jsonData;
2929
+ /**
2930
+ * @ignore
2931
+ */
2148
2932
  saveData(data) {
2149
2933
  this.magic.saveData(data);
2150
2934
  }
2935
+ /**
2936
+ * @ignore
2937
+ */
2151
2938
  createData() {
2152
2939
  let myData = {
2153
2940
  records: this.Records,
@@ -2159,6 +2946,9 @@ class TaskMagicService {
2159
2946
  console.log(text);
2160
2947
  this.saveData(text);
2161
2948
  }
2949
+ /**
2950
+ * @ignore
2951
+ */
2162
2952
  loadStubData(stubData) {
2163
2953
  this.Records = stubData.records;
2164
2954
  this.settemplate(stubData.template);
@@ -2166,9 +2956,15 @@ class TaskMagicService {
2166
2956
  for (let i = 0; i < this.Records.list.length; i++)
2167
2957
  this.buildTableRowControls(i);
2168
2958
  }
2959
+ /**
2960
+ * @ignore
2961
+ */
2169
2962
  loadData() {
2170
2963
  alert('Please, overwrite method loadData');
2171
2964
  }
2965
+ /**
2966
+ * @ignore
2967
+ */
2172
2968
  setStubValue(guiRowId, fc, name) {
2173
2969
  if (this.IsStub()) {
2174
2970
  try {
@@ -2179,45 +2975,79 @@ class TaskMagicService {
2179
2975
  }
2180
2976
  }
2181
2977
  }
2182
- static ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayWindowService)); };
2183
- static ɵprov = i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
2978
+ /** @nocollapse */ static ɵfac = function TaskMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TaskMagicService)(i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayWindowService)); };
2979
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
2184
2980
  }
2185
2981
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskMagicService, [{
2186
2982
  type: Injectable
2187
2983
  }], () => [{ type: EngineMagicService }, { type: OverlayWindowService }], null); })();
2188
2984
 
2985
+ /**
2986
+ * Implements various table-related functionalities
2987
+ */
2189
2988
  class TableMagicService {
2190
2989
  componentList;
2191
2990
  task;
2192
2991
  selectedItem;
2193
2992
  chunkSize;
2993
+ /**
2994
+ *
2995
+ * @param componentList Component-mapping service
2996
+ * @param task Magic task service
2997
+ */
2194
2998
  constructor(componentList, task) {
2195
2999
  this.componentList = componentList;
2196
3000
  this.task = task;
2197
3001
  }
2198
3002
  shouldOpenFieldTextEditor = true;
3003
+ /**
3004
+ * Refreshes the DataSource
3005
+ */
2199
3006
  refreshDataSource() {
2200
3007
  }
3008
+ /**
3009
+ * Returns the table page size
3010
+ * chunkSize as default value for non-paginated tables.
3011
+ */
2201
3012
  getPageSize() {
2202
3013
  return this.chunkSize;
2203
3014
  }
2204
3015
  setChunkSize(size) {
2205
3016
  this.chunkSize = size;
2206
3017
  }
3018
+ /**
3019
+ * Returns max no of rows in the table.
3020
+ */
2207
3021
  getMaxRowsInTable() {
2208
3022
  return this.task.Records.list.length;
2209
3023
  }
3024
+ /**
3025
+ * Selects the specified row
3026
+ * @param rowId The row to select
3027
+ */
2210
3028
  selectRow(rowId) {
2211
3029
  this.selectedItem = rowId;
2212
3030
  }
2213
3031
  getSelectedRow() {
2214
3032
  return this.selectedItem;
2215
3033
  }
3034
+ /**
3035
+ * Returns the selected row
3036
+ */
2216
3037
  selectedRow() {
2217
3038
  return null;
2218
3039
  }
3040
+ /**
3041
+ * Selects the specified page
3042
+ * @param pageId The page to select
3043
+ */
2219
3044
  selectPage(pageId) {
2220
3045
  }
3046
+ /**
3047
+ * Returns whether a dialog should be opened for the HTML element
3048
+ * @param element The HTML element for which a dialog may be needed
3049
+ * @returns
3050
+ */
2221
3051
  OpenDialogForControl(element) {
2222
3052
  if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
2223
3053
  element.tagName === "INPUT" ||
@@ -2225,17 +3055,34 @@ class TableMagicService {
2225
3055
  return false;
2226
3056
  return true;
2227
3057
  }
3058
+ /**
3059
+ * Returns the dialog used to edit values
3060
+ */
2228
3061
  getDialog() {
2229
3062
  return null;
2230
3063
  }
3064
+ /**
3065
+ * Handles the table "scrolled" event
3066
+ */
2231
3067
  onScrollDown() {
2232
3068
  this.task.onScrollDown();
2233
3069
  }
3070
+ /**
3071
+ * To be overwitten in specific implelemtations
3072
+ */
2234
3073
  sortData(e) { }
3074
+ /**
3075
+ * To be overwitten in specific implelemtations
3076
+ */
2235
3077
  mgOnPaginateChange(e, changeSelectedRow) { }
2236
3078
  mgOptionChanged(e) { }
3079
+ /**
3080
+ * Change the number of lines in a table
3081
+ * @param size New number of lines in table
3082
+ */
2237
3083
  updateTableSize(size) {
2238
- if (size === 0) {
3084
+ if (size === 0) // never remove row 0 for now
3085
+ {
2239
3086
  size = 1;
2240
3087
  this.task.Records.clearFirstTableRecord(this.task.template);
2241
3088
  }
@@ -2243,34 +3090,51 @@ class TableMagicService {
2243
3090
  this.task.Records.updateSize(size);
2244
3091
  this.task.setIncludesFirst(false);
2245
3092
  }
3093
+ /**
3094
+ * @ignore
3095
+ */
2246
3096
  setTableTopIndex(value) {
2247
3097
  if (!this.task.Records.includesFirst)
2248
3098
  value++;
2249
3099
  this.task.Records.setGuiTopIndex(value);
2250
3100
  }
3101
+ /**
3102
+ * @ignore
3103
+ */
2251
3104
  getTableTopIndex() {
2252
3105
  let topIndex = this.task.Records.getGuiTopIndex();
2253
3106
  if (!this.task.Records.includesFirst)
2254
3107
  topIndex--;
2255
3108
  return topIndex;
2256
3109
  }
2257
- static ɵfac = function TableMagicService_Factory(t) { return new (t || TableMagicService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(TaskMagicService)); };
2258
- static ɵprov = i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
3110
+ /** @nocollapse */ static ɵfac = function TableMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TableMagicService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(TaskMagicService)); };
3111
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
2259
3112
  }
2260
3113
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableMagicService, [{
2261
3114
  type: Injectable
2262
3115
  }], () => [{ type: ComponentListMagicService }, { type: TaskMagicService }], null); })();
2263
3116
 
3117
+ /**
3118
+ * Enables changing the browser title using Magic expression (SetTitle)
3119
+ */
2264
3120
  class TitleMagicService {
2265
3121
  titleService;
3122
+ /**
3123
+ *
3124
+ * @param titleService Angular's title-changing class
3125
+ */
2266
3126
  constructor(titleService) {
2267
3127
  this.titleService = titleService;
2268
3128
  }
3129
+ /**
3130
+ * Set the new title of the window
3131
+ * @param newTitle New title of the window
3132
+ */
2269
3133
  setTitle(newTitle) {
2270
3134
  this.titleService.setTitle(newTitle);
2271
3135
  }
2272
- static ɵfac = function TitleMagicService_Factory(t) { return new (t || TitleMagicService)(i0.ɵɵinject(i1$1.Title)); };
2273
- static ɵprov = i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
3136
+ /** @nocollapse */ static ɵfac = function TitleMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TitleMagicService)(i0.ɵɵinject(i1$1.Title)); };
3137
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
2274
3138
  }
2275
3139
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TitleMagicService, [{
2276
3140
  type: Injectable
@@ -2294,6 +3158,7 @@ class MagicColorService {
2294
3158
  }
2295
3159
  colorsData;
2296
3160
  fileNotFound = false;
3161
+ // public static FILE_NAME;
2297
3162
  constructor(http, colorFile1 = 'clr_rnt.eng') {
2298
3163
  this.http = http;
2299
3164
  if (colorFile1)
@@ -2313,6 +3178,7 @@ class MagicColorService {
2313
3178
  }
2314
3179
  hexToRgba(hex, isTransperent) {
2315
3180
  let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i;
3181
+ // convert it to format : aarrggbb
2316
3182
  hex = hex.replace(shorthandRegex, function (m, r, g, b, a) {
2317
3183
  return a + a + r + r + g + g + b + b;
2318
3184
  });
@@ -2327,16 +3193,24 @@ class MagicColorService {
2327
3193
  rgb.alpha = 0;
2328
3194
  return 'rgba(' + rgb.red + ',' + rgb.green + ',' + rgb.blue + ',' + rgb.alpha + ')';
2329
3195
  }
3196
+ /**
3197
+ * Returns the rgba value of specified color
3198
+ * @returns : value in format rgba(128,128,128,1)
3199
+ * @param : colorNumber -0 based index of color for which RGBA values are returned
3200
+ * @param: colorType : 1-MAGIC_FG_COLOR, 2-MAGIC_BG_COLOR
3201
+ */
2330
3202
  getColor(colorIndex, colorType) {
2331
3203
  let isTransperent = false;
2332
3204
  if (!this.colorsData && !this.fileNotFound)
2333
3205
  this.getColorData();
2334
- if (this.colorsData) {
3206
+ if (this.colorsData) { // color exists
2335
3207
  if (this.colorsData[colorIndex - 1]) {
2336
3208
  const grayHashCode = '00808080';
2337
3209
  let hex = grayHashCode;
2338
- let color = this.colorsData[colorIndex - 1].split(',');
3210
+ let color = this.colorsData[colorIndex - 1].split(','); // get the color details
2339
3211
  let colorAtrributes = +color[3];
3212
+ // color[0] - name, color[1] - FG color, color[2] - BG color
3213
+ // color[3] - attr flags (1 - transperent, 2 - system FG, 4 - system bg)
2340
3214
  switch (colorType) {
2341
3215
  case MAGIC_FG_COLOR:
2342
3216
  if (colorAtrributes != SYSTEM_FG && colorAtrributes != SYSTEM_FG_AND_SYSTEM_BG)
@@ -2360,8 +3234,8 @@ class MagicColorService {
2360
3234
  }
2361
3235
  return '';
2362
3236
  }
2363
- static ɵfac = function MagicColorService_Factory(t) { return new (t || MagicColorService)(i0.ɵɵinject(i1$2.HttpClient), i0.ɵɵinject(COLOR_FILE_NAME)); };
2364
- static ɵprov = i0.ɵɵdefineInjectable({ token: MagicColorService, factory: MagicColorService.ɵfac, providedIn: 'root' });
3237
+ /** @nocollapse */ static ɵfac = function MagicColorService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicColorService)(i0.ɵɵinject(i1$2.HttpClient), i0.ɵɵinject(COLOR_FILE_NAME)); };
3238
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicColorService, factory: MagicColorService.ɵfac, providedIn: 'root' });
2365
3239
  }
2366
3240
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicColorService, [{
2367
3241
  type: Injectable,
@@ -2373,17 +3247,35 @@ class MagicColorService {
2373
3247
  args: [COLOR_FILE_NAME]
2374
3248
  }] }], null); })();
2375
3249
 
3250
+ /**
3251
+ * Provides the UI with values calculated by the Magic WebClient
3252
+ */
2376
3253
  class AccessorMagicService {
2377
3254
  task;
2378
3255
  magicColor;
2379
3256
  Logger = null;
2380
3257
  hhmm = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
2381
3258
  hhmmss = maskitoTimeOptionsGenerator({ mode: 'HH:MM:SS' });
3259
+ /**
3260
+ * @ignore
3261
+ */
2382
3262
  constructor(task, magicColor) {
2383
3263
  this.task = task;
2384
3264
  this.magicColor = magicColor;
2385
3265
  this.Logger = Logger.Instance;
2386
3266
  }
3267
+ UploadFileToServer(fileContent, serverFileName) {
3268
+ return this.task.UploadFileToServer(fileContent, serverFileName);
3269
+ }
3270
+ async DownloadFileFromServer(serverFileName) {
3271
+ return await this.task.DownloadFileFromServer(serverFileName);
3272
+ }
3273
+ /**
3274
+ * Checks if the control is read-only
3275
+ * @param controlId Id of control
3276
+ * @returns Is the control not read-only
3277
+ */
3278
+ // CheckReadOnly
2387
3279
  checkIsReadOnly(controlId) {
2388
3280
  let properties;
2389
3281
  properties = this.task.Records.list[0].getControlMetadata(controlId);
@@ -2392,34 +3284,91 @@ class AccessorMagicService {
2392
3284
  else
2393
3285
  return false;
2394
3286
  }
3287
+ /**
3288
+ * Returns the text of the control
3289
+ * @param controlId Id of control
3290
+ * @param rowId Id of row, if applicable
3291
+ * @returns The text of the control
3292
+ */
3293
+ // mgGetText
2395
3294
  getText(controlId, rowId) {
2396
3295
  return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
2397
3296
  }
3297
+ /**
3298
+ * Gets the text of the tab page
3299
+ * @param controlId Id of control
3300
+ * @param layer Id of tabpage
3301
+ * @returns Text of tabpage
3302
+ */
3303
+ // mgGetTabpageText
2398
3304
  getTabpageText(controlId, layer) {
2399
3305
  const items = this.task.getProperty(controlId, HtmlProperties.ItemsList);
2400
3306
  if (typeof items !== "undefined")
2401
3307
  return items[layer].displayValue;
2402
3308
  return "";
2403
3309
  }
3310
+ /**
3311
+ * Gets the image defined for the control
3312
+ * @param controlId Id of control
3313
+ * @param rowId Id of row, if applicable
3314
+ * @returns Image set on control
3315
+ */
3316
+ // mgGetImage
2404
3317
  getImage(controlId, rowId) {
2405
3318
  let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2406
3319
  return result;
2407
3320
  }
3321
+ /**
3322
+ * Returns whether an image is set for this control
3323
+ * @param controlId Id of control
3324
+ * @param rowId Id of row, if applicable
3325
+ * @returns returns true if control has an image set on it
3326
+ */
3327
+ // mgIsImageExists
2408
3328
  isImageExists(controlId, rowId) {
2409
3329
  let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2410
3330
  return !isNullOrUndefined(result);
2411
3331
  }
3332
+ /**
3333
+ * Gets the CSS classes set on the control
3334
+ * @param controlId Id of control
3335
+ * @param rowId Id of row, if applicable
3336
+ * @returns The classes for this control
3337
+ */
3338
+ // mgGetClasses
2412
3339
  getClasses(controlId, rowId) {
2413
3340
  return this.task.getClasses(controlId, rowId);
2414
3341
  }
3342
+ /**
3343
+ * Gets the CSS styles set on the control
3344
+ * @param controlId Id of control
3345
+ * @param styleName NAme of style requested
3346
+ * @param rowId Id of row, if applicable
3347
+ * @returns The style set on the control
3348
+ */
3349
+ // mgGetStyle
2415
3350
  getStyle(controlId, styleName, rowId) {
2416
3351
  let style = this.task.getStyle(controlId, styleName, rowId);
2417
3352
  return style;
2418
3353
  }
3354
+ /**
3355
+ * Returns whether a control is visible or not
3356
+ * @param controlId Id of control
3357
+ * @param rowId Id of row, if applicable
3358
+ * @returns Is the control visible or hidden
3359
+ */
3360
+ // mgGetVisible
2419
3361
  getVisible(controlId, rowId) {
2420
3362
  let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
2421
3363
  return vis ? 'visible' : 'hidden';
2422
3364
  }
3365
+ /**
3366
+ * Returns alpha mask of a control
3367
+ * @param controlId Id of control
3368
+ * @param rowId Id of row, if applicable
3369
+ * @returns alpha mask of the control
3370
+ */
3371
+ // getAlphaMask
2423
3372
  getAlphaMask(controlId, rowId) {
2424
3373
  if (isNullOrUndefined(controlId))
2425
3374
  return null;
@@ -2443,6 +3392,12 @@ class AccessorMagicService {
2443
3392
  }
2444
3393
  return (pic != null) ? valueStr.toString() : null;
2445
3394
  }
3395
+ /**
3396
+ * Returns object representing numeric picture
3397
+ * @param picture string which is defined in magic
3398
+ * @returns object representing numeric picture
3399
+ */
3400
+ // mgGetNumericPicture
2446
3401
  getNumericPicture(picture) {
2447
3402
  var obj = {};
2448
3403
  if (isNullOrUndefined(picture))
@@ -2475,51 +3430,140 @@ class AccessorMagicService {
2475
3430
  obj['wholes'] = pic.getWholes();
2476
3431
  return obj;
2477
3432
  }
3433
+ /**
3434
+ * Returns whether a control should have the "required" attribute set on it
3435
+ * @param controlId Id of control
3436
+ * @param rowId Id of row, if applicable
3437
+ * @returns
3438
+ */
3439
+ // mgGetMustInput
2478
3440
  getMustInput(controlId, rowId) {
2479
3441
  let vis = this.getProperty(controlId, HtmlProperties.MustInput, rowId);
2480
3442
  return vis ? 'true' : 'false';
2481
3443
  }
3444
+ /**
3445
+ * Returns whether a control is disabled
3446
+ * @param controlId Id of control
3447
+ * @param rowId Id of row, if applicable
3448
+ * @returns
3449
+ */
3450
+ // mgIsDisabled
2482
3451
  isDisabled(controlId, rowId) {
2483
3452
  let result = this.getProperty(controlId, HtmlProperties.Enabled, rowId);
2484
3453
  return result === true ? null : true;
2485
3454
  }
3455
+ /**
3456
+ * @ignore
3457
+ */
3458
+ // getProperty (not changed)
2486
3459
  getProperty(controlId, prop, rowId) {
2487
3460
  return this.task.getProperty(controlId, prop, rowId);
2488
3461
  }
3462
+ /**
3463
+ * Returns the title (tooltip) text of the control
3464
+ * @param controlId Id of control
3465
+ * @param rowId Id of row, if applicable
3466
+ * @returns
3467
+ */
3468
+ // mgGetTitle
2489
3469
  getTitle(controlId, rowId) {
2490
3470
  return this.task.getProperty(controlId, HtmlProperties.Tooltip, rowId);
2491
3471
  }
3472
+ /**
3473
+ * Returns the title (tooltip) text of the control
3474
+ * @param controlId Id of control
3475
+ * @param rowId Id of row, if applicable
3476
+ * @returns
3477
+ */
3478
+ // mgGetTitle for zoom button
2492
3479
  getZoomButtonTitle(controlId, rowId) {
2493
3480
  return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
2494
3481
  }
3482
+ /**
3483
+ * Gets the selection control's selected value
3484
+ * @param controlId Id of control
3485
+ * @param rowId Id of row, if applicable
3486
+ * @returns
3487
+ */
3488
+ // getSelectedValue
2495
3489
  getSelectedValue(controlId, rowId) {
2496
3490
  return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
2497
3491
  }
3492
+ /**
3493
+ * Gets the place-holder text of the control
3494
+ * @param controlId Id of control
3495
+ * @param rowId Id of row, if applicable
3496
+ * @returns
3497
+ */
3498
+ // mgGetPlaceholder
2498
3499
  getPlaceholder(controlId, rowId) {
2499
3500
  return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
2500
3501
  }
3502
+ /**
3503
+ * Returns a type for input controls - should the control be a simple text or a password control
3504
+ * @param controlId Id of control
3505
+ * @param rowId Id of row, if applicable
3506
+ * @returns
3507
+ */
3508
+ // mgGetType
2501
3509
  getType(controlId, rowId) {
2502
3510
  let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
2503
3511
  return result ? "password" : "text";
2504
3512
  }
3513
+ /**
3514
+ * Returns the tab-index of the control
3515
+ * @param controlId Id of control
3516
+ * @param rowId Id of row, if applicable
3517
+ * @returns
3518
+ */
3519
+ // mgGetTabIndex
2505
3520
  getTabIndex(controlId, rowId) {
2506
3521
  return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
2507
3522
  }
3523
+ /**
3524
+ * Returns the value of the control
3525
+ * @param controlId Id of control
3526
+ * @param rowId Id of row, if applicable
3527
+ * @returns
3528
+ */
3529
+ /// mgGetValue -->
2508
3530
  getValue(controlId, rowId) {
2509
3531
  let val = this.task.getValue(controlId, rowId);
2510
3532
  return val;
2511
3533
  }
3534
+ /**
3535
+ * Returns the formatted value of the control
3536
+ * @param controlId Id of control
3537
+ * @param rowId Id of row, if applicable
3538
+ * @returns
3539
+ */
3540
+ /// mgGetValue -->
2512
3541
  getFormattedValue(controlId, rowId) {
2513
3542
  let val = this.task.getValue(controlId, rowId);
2514
3543
  val = this.task.getFormattedValue(controlId, val, rowId);
2515
3544
  return val;
2516
3545
  }
3546
+ /**
3547
+ * Returns the Picture of the control
3548
+ * @param controlId Id of control
3549
+ * @param rowId Id of row, if applicable
3550
+ * @returns
3551
+ */
3552
+ /// getPicture -->
2517
3553
  getPicture(controlId, rowId) {
2518
3554
  if (isNullOrUndefined(controlId))
2519
3555
  return null;
2520
3556
  let pic = this.task.GetControlPictureMask(controlId);
2521
3557
  return (pic != null) ? pic.getFormat().toString() : null;
2522
3558
  }
3559
+ /**
3560
+ * Returns the custom (user) properties of the control
3561
+ * @param controlId Id of control
3562
+ * @param propertyName Name of requested property
3563
+ * @param rowId Id of row, if applicable
3564
+ * @returns
3565
+ */
3566
+ // mgGetCustomProperty
2523
3567
  getCustomProperty(controlId, propertyNameOrRowID, rowId) {
2524
3568
  if (controlId.indexOf('~') == -1)
2525
3569
  return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
@@ -2544,9 +3588,22 @@ class AccessorMagicService {
2544
3588
  }
2545
3589
  return userProperties;
2546
3590
  }
3591
+ /**
3592
+ * Gets the values of the items of a selection control
3593
+ * @param id Id of control
3594
+ * @param rowId Id of row, if applicable
3595
+ * @returns
3596
+ */
3597
+ // mgGetItemListValues
2547
3598
  getItemListValues(id, rowId) {
2548
3599
  return this.getProperty(id, HtmlProperties.ItemsList, rowId);
2549
3600
  }
3601
+ /**
3602
+ * Gets the filtered items list based on the current value of the control
3603
+ * @param controlId Id of control
3604
+ * @param rowId Id of row, if applicable
3605
+ * @returns
3606
+ */
2550
3607
  getFilteredList(controlId, rowId) {
2551
3608
  if (isNullOrUndefined(rowId))
2552
3609
  rowId = '0';
@@ -2559,6 +3616,12 @@ class AccessorMagicService {
2559
3616
  else
2560
3617
  return items;
2561
3618
  }
3619
+ /**
3620
+ * Gets the display value of the item from items of a selection control
3621
+ * @param id Id of control
3622
+ * @param rowId Id of row, if applicable
3623
+ * @returns
3624
+ */
2562
3625
  getDisplayValue(id, rowId) {
2563
3626
  let displayValue = "";
2564
3627
  let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
@@ -2567,6 +3630,12 @@ class AccessorMagicService {
2567
3630
  displayValue = o[value].displayValue;
2568
3631
  return displayValue;
2569
3632
  }
3633
+ /**
3634
+ * Returns whether a tab page is selected or not
3635
+ * @param index of current option in iterarotr
3636
+ * @param control Id of list control
3637
+ * @returns
3638
+ */ // isOptionSelected
2570
3639
  isOptionSelected(index, controlId) {
2571
3640
  let val = this.task.getValue(controlId, "0");
2572
3641
  for (let item of val) {
@@ -2575,18 +3644,40 @@ class AccessorMagicService {
2575
3644
  }
2576
3645
  return false;
2577
3646
  }
3647
+ /**
3648
+ * Returns whether a tab page is selected or not - used for the tab buttons
3649
+ * @param controlId Id of control
3650
+ * @param layer Id of the tab page
3651
+ * @returns
3652
+ */ // mgIsTabPageSelected
2578
3653
  isTabPageSelected(controlId, layer) {
2579
3654
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
2580
- return val == (layer - 1);
2581
- }
3655
+ return val == (layer - 1); // comparing string to number!
3656
+ }
3657
+ /**
3658
+ * Returns whether a tab page layer is selected or not - used for the div which represents the tab page
3659
+ * @param controlId Id of control
3660
+ * @param layer Id of the tab page
3661
+ * @returns
3662
+ */ // mgIsTabLayerSelected
2582
3663
  isTabPageLayerSelected(controlId, layer) {
2583
3664
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
2584
- return val == (layer - 1);
3665
+ return val == (layer - 1); // comparing string to number!
2585
3666
  }
3667
+ /**
3668
+ * Returns the index of the selected tab page
3669
+ * @param controlId Id of control
3670
+ * @returns
3671
+ */
2586
3672
  getTabSelectedIndex(controlId) {
2587
3673
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
2588
- return val;
3674
+ return val; // comparing string to number!
2589
3675
  }
3676
+ // private methodes
3677
+ /**
3678
+ * @ignore
3679
+ */
3680
+ // mgIfRowCreated
2590
3681
  ifRowCreated(row) {
2591
3682
  if (row == null)
2592
3683
  return false;
@@ -2594,59 +3685,83 @@ class AccessorMagicService {
2594
3685
  let result = this.getFormGroupByRow(rowId);
2595
3686
  return !isNullOrUndefined(result);
2596
3687
  }
3688
+ /**
3689
+ * @ignore
3690
+ */
3691
+ // mgGetFormGroupByRow
2597
3692
  getFormGroupByRow(id) {
2598
3693
  return this.task.formGroups[id];
2599
3694
  }
3695
+ /**
3696
+ * @ignore
3697
+ */
3698
+ // isRowSelected (not changed)
2600
3699
  isRowSelected(controlId, rowId) {
2601
3700
  const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
2602
3701
  return selectedRow == rowId;
2603
3702
  }
3703
+ /**
3704
+ * Returns whether a row is in edit state
3705
+ * @param row
3706
+ */
2604
3707
  isRowInRowEditing(row) {
2605
3708
  let guiRowId = '0';
2606
3709
  guiRowId = typeof row == "number" ? row.toString() : row.rowId;
2607
3710
  return this.task.isRowInRowEditing(guiRowId);
2608
3711
  }
3712
+ /**
3713
+ * Returns whether a row is in edit state, use this method while control outside table control
3714
+ * @param row
3715
+ */
2609
3716
  isCurrentInRowEditing() {
2610
3717
  let row = this.task.tableService.getSelectedRow();
2611
3718
  return this.task.isRowInRowEditing(row);
2612
3719
  }
3720
+ /**
3721
+ * @ignore
3722
+ */
3723
+ // GetGuiTopIndex
2613
3724
  guiTopIndex() {
2614
3725
  return this.task.tableService.getTableTopIndex();
2615
3726
  }
3727
+ /**
3728
+ * @ignore
3729
+ */
2616
3730
  getErrMsg(id, rowId) {
2617
3731
  let c = this.task.getFormControl(rowId, id);
2618
3732
  if (c.hasError('required'))
2619
- return 'Control must be updated.';
3733
+ return Events.GetMessageString(MsgInterface.RT_STR_FLD_MUST_UPDATED);
2620
3734
  if (c.hasError('pattern')) {
3735
+ //To check whether the numeric field allowed only positive values or not.
2621
3736
  if (c.errors.pattern.actualValue < 0 && !c.errors.pattern.requiredPattern.includes('-'))
2622
- return 'Value must be non-negative';
3737
+ return Events.GetMessageString(MsgInterface.STR_ERR_NEGETIVE);
2623
3738
  if (c.errors.pattern.requiredPattern.includes('.')) {
2624
3739
  const numericFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[0];
2625
3740
  const decimalFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[1];
2626
3741
  const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2627
3742
  const actualDecimalLimit = c.errors.pattern.requiredPattern.match(/(?:[^,]+,){2}(\d+)/)[1];
2628
3743
  if (numericFormat.length > actualNumericLimit || decimalFormat.length > actualDecimalLimit) {
2629
- return "Numeric format is limited to " + actualNumericLimit + "." + actualDecimalLimit + " digits";
3744
+ return this.getNumericFormatErrorString(actualNumericLimit, actualDecimalLimit);
2630
3745
  }
2631
3746
  }
2632
3747
  else if (!c.errors.pattern.requiredPattern.includes('.') && !Number.isInteger(c.errors.pattern.actualValue)) {
2633
3748
  const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2634
- return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
3749
+ return this.getNumericFormatErrorString(actualNumericLimit, 0);
2635
3750
  }
2636
3751
  else {
2637
3752
  const numericFormat = Math.abs(c.errors.pattern.actualValue).toString();
2638
3753
  const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2639
3754
  if (numericFormat.length > actualNumericLimit) {
2640
- return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
3755
+ return this.getNumericFormatErrorString(actualNumericLimit, 0);
2641
3756
  }
2642
3757
  }
2643
3758
  }
2644
3759
  if (c.hasError('rangevalidator'))
2645
3760
  return c.errors.rangevalidator.errorMsg;
2646
3761
  if (c.hasError('maxlength'))
2647
- return 'Max length allowed is : ' + c.errors.maxlength.requiredLength;
3762
+ return Events.GetMessageString(MsgInterface.STR_ERR_MAX_ALLOWED_LENGTH) + c.errors.maxlength.requiredLength;
2648
3763
  if (c.hasError('max'))
2649
- return 'Max value allowed is : ' + c.errors.max.max;
3764
+ return Events.GetMessageString(MsgInterface.STR_ERR_MAX_ALLOWED_VALUE) + c.errors.max.max;
2650
3765
  let controlMetadata = this.task.Records.list[rowId].getControlMetadata(id);
2651
3766
  for (let key of controlMetadata.customValidators.keys()) {
2652
3767
  if (c.hasError(key)) {
@@ -2656,6 +3771,19 @@ class AccessorMagicService {
2656
3771
  }
2657
3772
  return 'unknown error';
2658
3773
  }
3774
+ getNumericFormatErrorString(wholeLimit, decimalLimit) {
3775
+ let token = "%d";
3776
+ let messageString = Events.GetMessageString(MsgInterface.EDT_ERR_STR_1);
3777
+ messageString = StrUtil.replaceStringTokens(messageString, token, 1, wholeLimit.toString());
3778
+ messageString = StrUtil.replaceStringTokens(messageString, token, 1, decimalLimit.toString());
3779
+ return messageString;
3780
+ }
3781
+ /**
3782
+ * Sets a user-supplied value to the specified control
3783
+ * @param controlName
3784
+ * @param value
3785
+ * @param refreshDisplay
3786
+ */
2659
3787
  setValueToControl(controlName, value, refreshDisplay) {
2660
3788
  if (typeof refreshDisplay === "undefined")
2661
3789
  refreshDisplay = true;
@@ -2664,28 +3792,44 @@ class AccessorMagicService {
2664
3792
  guiEvent.param = refreshDisplay;
2665
3793
  this.task.insertEvent(guiEvent);
2666
3794
  }
3795
+ /**
3796
+ * @ignore
3797
+ */
2667
3798
  isDataviewEmpty() {
2668
3799
  return this.task.Records.isEmptyDataView;
2669
3800
  }
3801
+ /**
3802
+ * simulates a click event on the specified control, for the Magic engine
3803
+ * @param controlName
3804
+ * @param rowId
3805
+ */
2670
3806
  simulateClick(controlName, rowId) {
2671
3807
  if (typeof rowId === "undefined")
2672
3808
  rowId = 0;
2673
3809
  this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
2674
3810
  }
3811
+ /**
3812
+ * Return Boolean TRUE if user logged in Else it will return FALSE
3813
+ */
2675
3814
  isLoggedIn() {
2676
3815
  return this.task.getIsLoggenIn();
2677
3816
  }
3817
+ /**
3818
+ * Returns JS object containing the records with all table fields.
3819
+ */
2678
3820
  GetFormRecords() {
2679
3821
  let rowId = 0;
2680
3822
  let recArray;
2681
3823
  if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
2682
3824
  let recList = this.task.Records.list;
2683
3825
  let tableControls = new Array();
3826
+ //Generate list of table fields names
2684
3827
  for (const key in this.task.template) {
2685
3828
  if (this.task.template[key] == '1')
2686
3829
  tableControls.push(key);
2687
3830
  }
2688
3831
  recArray = new Array();
3832
+ //Update the records as list of objects with values for table fields.
2689
3833
  if (tableControls.length > 0) {
2690
3834
  recList.forEach((ctrlMetaData) => {
2691
3835
  if (this.task.Records.isRowCreated(rowId)) {
@@ -2701,31 +3845,54 @@ class AccessorMagicService {
2701
3845
  }
2702
3846
  return recArray;
2703
3847
  }
3848
+ /**
3849
+ * SetCookie : set the cookie with specified name and value in browser
3850
+ * expires - expiration time
3851
+ * path - path which much exists in order so that cookie is sent as header
3852
+ * domain - specifies which hosts are allowed to receive the cookie
3853
+ * secure - specifies if cookie is secure ( works only with HTTPS)
3854
+ * sameSite - lets servers specify whether/when cookies are sent with cross-site requests
3855
+ */
2704
3856
  SetCookie(name, value, expires, path, domain, secure, sameSite) {
2705
3857
  CookieService.setCookie(name, value, expires, path, domain, secure, sameSite);
2706
3858
  }
3859
+ /**
3860
+ * GetCookie : get the cookie with specified name and value in browser
3861
+ */
2707
3862
  GetCookie(name) {
2708
3863
  return CookieService.getCookie(name);
2709
3864
  }
3865
+ /**
3866
+ * DeleteCookie : deletes the cookie
3867
+ */
2710
3868
  DeleteCookie(name) {
2711
3869
  return CookieService.deleteCookie(name);
2712
3870
  }
3871
+ /**
3872
+ * get RGBA color from color file
3873
+ */
2713
3874
  getColor(colorNumber, colorType) {
2714
3875
  return this.magicColor.getColor(colorNumber, colorType);
2715
3876
  }
2716
- static ɵfac = function AccessorMagicService_Factory(t) { return new (t || AccessorMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MagicColorService)); };
2717
- static ɵprov = i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
3877
+ /** @nocollapse */ static ɵfac = function AccessorMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AccessorMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MagicColorService)); };
3878
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
2718
3879
  }
2719
3880
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AccessorMagicService, [{
2720
3881
  type: Injectable
2721
3882
  }], () => [{ type: TaskMagicService }, { type: MagicColorService }], null); })();
2722
3883
 
3884
+ /**
3885
+ * Central place for adding the Magic services
3886
+ */
2723
3887
  class MagicServices {
2724
3888
  task;
2725
3889
  subformService;
2726
3890
  tableService;
2727
3891
  titleService;
2728
3892
  mgAccessorService;
3893
+ /**
3894
+ * @ignore
3895
+ */
2729
3896
  constructor(task, subformService, tableService, titleService, mgAccessorService) {
2730
3897
  this.task = task;
2731
3898
  this.subformService = subformService;
@@ -2737,41 +3904,85 @@ class MagicServices {
2737
3904
  task.mgTitleService = titleService;
2738
3905
  task.mgAccessorService = mgAccessorService;
2739
3906
  }
2740
- static ɵfac = function MagicServices_Factory(t) { return new (t || MagicServices)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(SubformMagicService), i0.ɵɵinject(TableMagicService), i0.ɵɵinject(TitleMagicService), i0.ɵɵinject(AccessorMagicService)); };
2741
- static ɵprov = i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
3907
+ /** @nocollapse */ static ɵfac = function MagicServices_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicServices)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(SubformMagicService), i0.ɵɵinject(TableMagicService), i0.ɵɵinject(TitleMagicService), i0.ɵɵinject(AccessorMagicService)); };
3908
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
2742
3909
  }
2743
3910
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicServices, [{
2744
3911
  type: Injectable
2745
3912
  }], () => [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }], null); })();
2746
3913
 
3914
+ /**
3915
+ * Base component representing a Magic task
3916
+ */
2747
3917
  class TaskBaseMagicComponent {
2748
3918
  ref;
2749
3919
  magicServices;
3920
+ /**
3921
+ * Id of task, used for initializing the task service
3922
+ */
2750
3923
  taskIdParam;
3924
+ /**
3925
+ * @ignore
3926
+ */
2751
3927
  taskDescription;
3928
+ /**
3929
+ * @ignore
3930
+ */
2752
3931
  magicProperties = MagicProperties;
3932
+ /**
3933
+ *
3934
+ * @param ref changes-detector object
3935
+ * @param magicServices Access point for all Magic services
3936
+ */
2753
3937
  constructor(ref, magicServices) {
2754
3938
  this.ref = ref;
2755
3939
  this.magicServices = magicServices;
2756
3940
  }
3941
+ /**
3942
+ * Returns the Magic task service
3943
+ * @returns
3944
+ */
2757
3945
  get task() {
2758
3946
  return this.magicServices.task;
2759
3947
  }
3948
+ /**
3949
+ * Returns the Magic subform service
3950
+ * @returns
3951
+ */
2760
3952
  get mgSub() {
2761
3953
  return this.magicServices.subformService;
2762
3954
  }
3955
+ /**
3956
+ * Returns the Magic table service
3957
+ * @returns
3958
+ */
2763
3959
  get tableService() {
2764
3960
  return this.magicServices.tableService;
2765
3961
  }
3962
+ /**
3963
+ * Returns the Magic accessor service
3964
+ * @returns
3965
+ */
2766
3966
  get mg() {
2767
3967
  return this.magicServices.mgAccessorService;
2768
3968
  }
3969
+ /**
3970
+ * Returns the task Id
3971
+ * @returns
3972
+ */
2769
3973
  get taskId() {
2770
3974
  return this.task.taskId;
2771
3975
  }
3976
+ /**
3977
+ * Returns the FormGroup for screen-mode forms
3978
+ * @returns
3979
+ */
2772
3980
  get screenFormGroup() {
2773
3981
  return this.task.ScreenModeControls;
2774
3982
  }
3983
+ /**
3984
+ * Interface implementation
3985
+ */
2775
3986
  ngOnInit() {
2776
3987
  this.task.detectChanges.pipe().subscribe(c => {
2777
3988
  this.ref.detectChanges();
@@ -2779,24 +3990,61 @@ class TaskBaseMagicComponent {
2779
3990
  this.task.initTask(this.taskIdParam, this.taskDescription);
2780
3991
  this.createFormControlsAccessor(this.screenFormGroup);
2781
3992
  this.setInputDateFormat();
3993
+ // subcribe to custom property changes
2782
3994
  this.task.customPropertiesSubject.pipe().subscribe(property => {
2783
3995
  this.PropertyChanged(property.propertyName, property.rowId, property.value);
2784
3996
  });
3997
+ // subcribe to records count changes
2785
3998
  this.task.recordsCountChangeSubject.pipe().subscribe(value => {
2786
3999
  this.RecordsCountChanged(value);
2787
4000
  });
4001
+ // subcribe to mgLoad change
2788
4002
  this.task.mgLoadSubject.pipe().subscribe(value => {
2789
4003
  this.mgOnLoad();
2790
4004
  });
2791
4005
  }
4006
+ /**
4007
+ * @ignore
4008
+ */
2792
4009
  createFormControlsAccessor(formGroup) { }
4010
+ /**
4011
+ * @ignore
4012
+ */
2793
4013
  setInputDateFormat() { }
4014
+ /**
4015
+ * This method is called when the value of any custom property is updated in Magic
4016
+ * propertyName : name of property which is updated. The format is <controlname>~<propertyname>
4017
+ * rowId : row number of the updated property for controls in table control (0 for controls outside table)
4018
+ * value : updated value of the property
4019
+ * @returns : void
4020
+ * To use the method override it in your component and check the property name and write you code ..for eg
4021
+ * if(propertyName == 'controlname~propertyName') {// your code}
4022
+ * else { // your code}
4023
+ */
2794
4024
  PropertyChanged(propertyName, rowId, value) {
2795
- }
4025
+ // intentionally left blank because the implementation should be in the derived class
4026
+ }
4027
+ /**
4028
+ * Records count change subject is subscribed to change in its value. This method will be called
4029
+ * as the value of records count is received at from server.
4030
+ * @returns : void
4031
+ * To use the method override it in your component.
4032
+ */
2796
4033
  RecordsCountChanged(recordsCount) {
2797
- }
4034
+ // intentionally left blank because the implementation should be in the derived class
4035
+ }
4036
+ /**
4037
+ * This method will be called once engine informs UI about loading of first set of data is sent to client
4038
+ * and client has reached its first idle time.
4039
+ * @returns : void
4040
+ * To use the method override it in your component.
4041
+ */
2798
4042
  mgOnLoad() {
4043
+ // intentionally left blank because the implementation should be in the derived class
2799
4044
  }
4045
+ /**
4046
+ * Interface implementation
4047
+ */
2800
4048
  ngAfterViewInit() {
2801
4049
  this.mgSub.init();
2802
4050
  }
@@ -2806,37 +4054,53 @@ class TaskBaseMagicComponent {
2806
4054
  this.task.oldPageSize = this.tableService.getPageSize();
2807
4055
  }
2808
4056
  }
4057
+ /**
4058
+ * Interface implementation
4059
+ */
2809
4060
  ngOnDestroy() {
2810
4061
  this.task.dispose();
2811
4062
  }
2812
- static ɵfac = function TaskBaseMagicComponent_Factory(t) { return new (t || TaskBaseMagicComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(MagicServices)); };
2813
- static ɵ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 });
4063
+ /** @nocollapse */ static ɵfac = function TaskBaseMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TaskBaseMagicComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(MagicServices)); };
4064
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: TaskBaseMagicComponent, selectors: [["task-magic"]], inputs: { taskIdParam: "taskIdParam", taskDescription: "taskDescription" }, standalone: false, features: [i0.ɵɵProvidersFeature([TaskMagicService, SubformMagicService, TableMagicService])], decls: 0, vars: 0, template: function TaskBaseMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
2814
4065
  }
2815
4066
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskBaseMagicComponent, [{
2816
4067
  type: Component,
2817
4068
  args: [{
2818
4069
  selector: 'task-magic',
2819
4070
  providers: [TaskMagicService, SubformMagicService, TableMagicService],
2820
- template: ''
4071
+ template: '',
4072
+ standalone: false
2821
4073
  }]
2822
4074
  }], () => [{ type: i0.ChangeDetectorRef }, { type: MagicServices }], { taskIdParam: [{
2823
4075
  type: Input
2824
4076
  }], taskDescription: [{
2825
4077
  type: Input
2826
4078
  }] }); })();
2827
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskBaseMagicComponent, { className: "TaskBaseMagicComponent", filePath: "src\\ui\\task-base.magic.component.ts", lineNumber: 20 }); })();
4079
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskBaseMagicComponent, { className: "TaskBaseMagicComponent", filePath: "src/ui/task-base.magic.component.ts", lineNumber: 21 }); })();
2828
4080
 
4081
+ /**
4082
+ * @ignore
4083
+ */
2829
4084
  class RowMagicDirective {
2830
4085
  _task;
2831
4086
  element;
2832
4087
  rowId;
4088
+ /**
4089
+ * The HTML element connected to this directive
4090
+ */
2833
4091
  htmlElement;
4092
+ /**
4093
+ * @ignore
4094
+ */
2834
4095
  rowChangedSubscriber = null;
2835
4096
  constructor(_task, element) {
2836
4097
  this._task = _task;
2837
4098
  this.element = element;
2838
4099
  this.htmlElement = this.element.nativeElement;
2839
4100
  }
4101
+ /**
4102
+ * Initializes this object
4103
+ */
2840
4104
  ngOnInit() {
2841
4105
  this.rowChangedSubscriber = this._task
2842
4106
  .OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
@@ -2851,7 +4115,16 @@ class RowMagicDirective {
2851
4115
  return (rect.top >= parentRect.top &&
2852
4116
  rect.bottom <= parentRect.bottom);
2853
4117
  }
4118
+ /**
4119
+ * Cleanup
4120
+ */
2854
4121
  ngOnDestroy() {
4122
+ // Don't know why, but when the table is loaded for the first time, we
4123
+ // get ngOnInit() for the 1st row (rowId = "0") and then ngOnDestroy()
4124
+ // for number of rows in the page but here this.rowId is undefined.
4125
+ // Since ngOnInit() was not called for all these rows, this.rowChangedSubscriber
4126
+ // is null and hence crashes.
4127
+ // So, the condition to check nulity is added.
2855
4128
  if (this.rowChangedSubscriber !== null) {
2856
4129
  this.rowChangedSubscriber.unsubscribe();
2857
4130
  }
@@ -2863,15 +4136,16 @@ class RowMagicDirective {
2863
4136
  event.cancelBubble = true;
2864
4137
  }
2865
4138
  }
2866
- static ɵfac = function RowMagicDirective_Factory(t) { return new (t || RowMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
2867
- static ɵdir = i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4139
+ /** @nocollapse */ static ɵfac = function RowMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RowMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
4140
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
2868
4141
  i0.ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
2869
- } }, inputs: { rowId: [i0.ɵɵInputFlags.None, "magicRow", "rowId"] } });
4142
+ } }, inputs: { rowId: [0, "magicRow", "rowId"] }, standalone: false });
2870
4143
  }
2871
4144
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RowMagicDirective, [{
2872
4145
  type: Directive,
2873
4146
  args: [{
2874
- selector: '[magicRow]'
4147
+ selector: '[magicRow]',
4148
+ standalone: false
2875
4149
  }]
2876
4150
  }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }], { rowId: [{
2877
4151
  type: Input,
@@ -2881,6 +4155,9 @@ class RowMagicDirective {
2881
4155
  args: ['click', ['$event']]
2882
4156
  }] }); })();
2883
4157
 
4158
+ /**
4159
+ * Connects HTML elements to the Magic Web Client engine
4160
+ */
2884
4161
  class MagicDirective {
2885
4162
  _task;
2886
4163
  element;
@@ -2893,24 +4170,64 @@ class MagicDirective {
2893
4170
  this.selector = "magic";
2894
4171
  }
2895
4172
  ;
4173
+ /**
4174
+ * This flag is used when we only want to register to events, but do not want to execute commands sent from server
4175
+ */
2896
4176
  set eventsOnly(val) {
2897
4177
  console.log("eventsOnly");
2898
4178
  this.eventsOnlyVal = true;
2899
4179
  }
2900
4180
  ;
4181
+ /**
4182
+ * pollTime: after which value will be sent to magic
4183
+ */
2901
4184
  pollTime = 200;
4185
+ /**
4186
+ * Row id of the control, for when it is on a table
4187
+ */
2902
4188
  rowId;
4189
+ /**
4190
+ *
4191
+ */
4192
+ //@Input() events: any[] = [];
4193
+ /**
4194
+ * The HTML element connected to this directive
4195
+ */
2903
4196
  htmlElement;
4197
+ /**
4198
+ * Magic's component handling this control
4199
+ */
2904
4200
  component;
4201
+ /**
4202
+ * Collection of event handlers for this element
4203
+ */
2905
4204
  eventHandlers = {};
4205
+ /**
4206
+ * Id of this element
4207
+ */
2906
4208
  id;
4209
+ /**
4210
+ * @ignore
4211
+ */
2907
4212
  selector;
4213
+ /**
4214
+ * @ignore
4215
+ */
2908
4216
  subscribeRefreshDom;
2909
4217
  focusUnlistener;
2910
4218
  eventsOnlyVal = false;
2911
4219
  static opened = false;
2912
4220
  static noOfAutoCompleteBoxesOpened = 0;
2913
4221
  subscribeInteractiveCommands;
4222
+ /**
4223
+ *
4224
+ * @param _task The task service
4225
+ * @param element The element for which the directive is applied
4226
+ * @param renderer Renderer for the element
4227
+ * @param vcRef
4228
+ * @param platform
4229
+ * @param magicRow
4230
+ */
2914
4231
  constructor(_task, element, renderer, vcRef, platform, magicRow) {
2915
4232
  this._task = _task;
2916
4233
  this.element = element;
@@ -2919,23 +4236,43 @@ class MagicDirective {
2919
4236
  this.platform = platform;
2920
4237
  this.magicRow = magicRow;
2921
4238
  this.htmlElement = this.element.nativeElement;
4239
+ //let c = (<any>this.vcRef)._view;
4240
+ //while (!(c instanceof TaskBaseMagicComponent)) {
4241
+ // c = c.component;
4242
+ //}
4243
+ //this.component = c;
2922
4244
  if (!(typeof magicRow === "undefined" || magicRow === null))
2923
4245
  this.rowId = magicRow.rowId;
2924
4246
  }
4247
+ /**
4248
+ * Get the task service
4249
+ * @returns
4250
+ */
2925
4251
  get task() {
2926
4252
  return this._task;
2927
4253
  }
4254
+ /**
4255
+ * Register to the events this element may need to handle
4256
+ */
2928
4257
  regEvents() {
4258
+ // Handle events for which event handler may be removed and restored
2929
4259
  this.eventHandlers["focusin"] = this.OnFocus.bind(this);
2930
4260
  Object.keys(this.eventHandlers).forEach((key) => {
2931
4261
  this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
2932
4262
  });
2933
- let events = ["click", "mousedown", "dblclick"];
4263
+ // Handle events with anonymous event handlers
4264
+ let events = ["click", "mousedown", "dblclick"]; // ,'resize', 'load', 'unload'
2934
4265
  events.forEach(event => {
2935
4266
  this.renderer.listen(this.htmlElement, event, (e) => {
4267
+ // check if the event is fired from zoom button ( to identify the connected zoom button in engine)
2936
4268
  let fromButton = false;
2937
4269
  if (this.htmlElement instanceof HTMLButtonElement)
2938
4270
  fromButton = true;
4271
+ /**
4272
+ * In the case of Safari or Chrome browser on IOS, when a button is clicked, the browser does not receive
4273
+ * focus event hence the zoom action is not executed. So in order to receive focus event, enabling it exclusively
4274
+ * in the case of Safari or Chrome browser on IOS and Safari browser on Mac.
4275
+ */
2939
4276
  if (fromButton && (this.platform.IOS || this.platform.SAFARI))
2940
4277
  this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
2941
4278
  this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
@@ -2951,10 +4288,13 @@ class MagicDirective {
2951
4288
  this.task.insertEvent(guiEvent);
2952
4289
  }
2953
4290
  });
4291
+ // handle the input event
2954
4292
  fromEvent(this.htmlElement, "input").pipe(map((event) => {
2955
4293
  return event.target.value;
2956
- }), debounceTime(this.pollTime)).subscribe((x) => {
4294
+ }), debounceTime(this.pollTime) // time after which value will be sent to magic
4295
+ ).subscribe((x) => {
2957
4296
  if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
4297
+ // Don't support character binding for date/time values
2958
4298
  let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
2959
4299
  if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
2960
4300
  this.task.mgAccessorService.setValueToControl(this.id, x, true);
@@ -2980,16 +4320,25 @@ class MagicDirective {
2980
4320
  (e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
2981
4321
  if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
2982
4322
  guiEvent.keyCode = e.keyCode;
4323
+ // Defect 160021 fixed - don't set e.cancelBubble when combobox is opened and esc key is pressed
2983
4324
  if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
2984
4325
  e.cancelBubble = true;
2985
4326
  this.task.insertEvent(guiEvent);
2986
4327
  }
2987
4328
  });
2988
4329
  }
4330
+ /**
4331
+ * Handle focus event
4332
+ */
2989
4333
  OnFocus() {
2990
4334
  this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
2991
4335
  event.cancelBubble = true;
2992
4336
  }
4337
+ /**
4338
+ * Is the command's element the same as this directive's element
4339
+ * @param command
4340
+ * @returns true/false
4341
+ */
2993
4342
  IsSameElement(command) {
2994
4343
  let line = command.line;
2995
4344
  if (this.task.isTableControl(command.CtrlName))
@@ -2998,9 +4347,17 @@ class MagicDirective {
2998
4347
  (line === +this.rowId ||
2999
4348
  (line === 0 && isNullOrUndefined(this.rowId))));
3000
4349
  }
4350
+ /**
4351
+ * Is the command's element the same as this directive's component
4352
+ * @param command
4353
+ * @returns true/false
4354
+ */
3001
4355
  IsSameComponent(command) {
3002
4356
  return (command.controlName === this.id);
3003
4357
  }
4358
+ /**
4359
+ * @ignore
4360
+ */
3004
4361
  regUpdatesUI() {
3005
4362
  this.subscribeRefreshDom = this.task
3006
4363
  .refreshDom.pipe(filter(c => this.IsSameElement(c)))
@@ -3022,10 +4379,17 @@ class MagicDirective {
3022
4379
  this.handleInteractiveCommands(command);
3023
4380
  });
3024
4381
  }
4382
+ /**
4383
+ * Initializes this object
4384
+ */
3025
4385
  ngOnInit() {
3026
4386
  this.regEvents();
3027
4387
  this.regUpdatesUI();
3028
4388
  }
4389
+ /**
4390
+ * Handles the commands received from the Magic WebClient engine
4391
+ * @param command
4392
+ */
3029
4393
  handleCommand(command) {
3030
4394
  switch (command.CommandType) {
3031
4395
  case CommandType.SET_PROPERTY:
@@ -3033,12 +4397,16 @@ class MagicDirective {
3033
4397
  break;
3034
4398
  case CommandType.SET_FOCUS:
3035
4399
  this.focusUnlistener();
4400
+ // Do not set focus on connected zoom button
3036
4401
  if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
3037
4402
  this.htmlElement.focus();
3038
4403
  this.focusUnlistener = this.renderer.listen(this.htmlElement, "focusin", this.eventHandlers["focusin"]);
3039
4404
  break;
3040
4405
  }
3041
4406
  }
4407
+ /**
4408
+ * handle the interactive commands like CallJS
4409
+ */
3042
4410
  handleInteractiveCommands(command) {
3043
4411
  switch (command._commandType) {
3044
4412
  case InteractiveCommandType.CALL_JS:
@@ -3048,18 +4416,24 @@ class MagicDirective {
3048
4416
  let resultString = "";
3049
4417
  try {
3050
4418
  if (!isNullOrUndefined(magicComponent[methodName])) {
4419
+ // invoke the method on instance of magic componenet
3051
4420
  resultString = magicComponent[methodName].apply(magicComponent, args);
3052
4421
  }
3053
4422
  else
3054
- console.error("Instance method " + methodName + " does not exists");
4423
+ console.error("Instance method " + methodName + " does not exists"); // when method is not found
3055
4424
  }
3056
4425
  catch (e) {
4426
+ // any other exception
3057
4427
  console.error(e.message);
3058
4428
  }
3059
- command.resultString = resultString;
4429
+ command.resultString = resultString; // update the return value
3060
4430
  break;
3061
4431
  }
3062
4432
  }
4433
+ /**
4434
+ * Handle the Magic set-property command
4435
+ * @param command
4436
+ */
3063
4437
  handleSetProperty(command) {
3064
4438
  switch (command.Operation) {
3065
4439
  case HtmlProperties.ReadOnly:
@@ -3073,18 +4447,22 @@ class MagicDirective {
3073
4447
  break;
3074
4448
  }
3075
4449
  }
4450
+ /**
4451
+ * Cleanup
4452
+ */
3076
4453
  ngOnDestroy() {
3077
4454
  this.subscribeRefreshDom.unsubscribe();
3078
4455
  }
3079
- static ɵ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(i2$1.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
3080
- static ɵdir = i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", pollTime: "pollTime", rowId: "rowId" } });
4456
+ /** @nocollapse */ static ɵfac = function MagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i2$2.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
4457
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", pollTime: "pollTime", rowId: "rowId" }, standalone: false });
3081
4458
  }
3082
4459
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDirective, [{
3083
4460
  type: Directive,
3084
4461
  args: [{
3085
- selector: "[magic]"
4462
+ selector: "[magic]",
4463
+ standalone: false
3086
4464
  }]
3087
- }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
4465
+ }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$2.Platform }, { type: RowMagicDirective, decorators: [{
3088
4466
  type: Optional
3089
4467
  }] }], { magic: [{
3090
4468
  type: Input,
@@ -3098,6 +4476,9 @@ class MagicDirective {
3098
4476
  type: Input
3099
4477
  }] }); })();
3100
4478
 
4479
+ /**
4480
+ * @ignore
4481
+ */
3101
4482
  class NoControlMagicDirective extends MagicDirective {
3102
4483
  set magic(val) { this.id = val; this.selector = 'magicnc'; }
3103
4484
  ;
@@ -3131,10 +4512,12 @@ class NoControlMagicDirective extends MagicDirective {
3131
4512
  }
3132
4513
  }
3133
4514
  }
4515
+ // is the div a tab control
3134
4516
  isTabControl() {
3135
4517
  return this.htmlElement instanceof HTMLDivElement &&
3136
4518
  this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
3137
4519
  }
4520
+ // is the div a radio buttons wrapper
3138
4521
  isRadio() {
3139
4522
  return this.htmlElement instanceof HTMLDivElement &&
3140
4523
  this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
@@ -3143,6 +4526,7 @@ class NoControlMagicDirective extends MagicDirective {
3143
4526
  super.handleCommand(command);
3144
4527
  switch (command.CommandType) {
3145
4528
  case CommandType.SET_CLASS:
4529
+ //remove the class which was replaced by this new one, as registered in the ControlMetadata
3146
4530
  const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
3147
4531
  if (controlMetadata.removedClass != '') {
3148
4532
  this.htmlElement.classList.remove(controlMetadata.removedClass);
@@ -3155,7 +4539,7 @@ class NoControlMagicDirective extends MagicDirective {
3155
4539
  this.htmlElement.innerText = command.value;
3156
4540
  if (this.htmlElement instanceof HTMLSelectElement)
3157
4541
  this.htmlElement.value = command.value;
3158
- if (this.htmlElement instanceof HTMLAnchorElement)
4542
+ if (this.htmlElement instanceof HTMLAnchorElement) //hyper-text button
3159
4543
  this.htmlElement.text = command.value;
3160
4544
  if (this.htmlElement instanceof HTMLInputElement) {
3161
4545
  if (this.htmlElement.type === "checkbox") {
@@ -3179,6 +4563,7 @@ class NoControlMagicDirective extends MagicDirective {
3179
4563
  break;
3180
4564
  }
3181
4565
  }
4566
+ // handle set-property commands
3182
4567
  handleSetProperty(command) {
3183
4568
  super.handleSetProperty(command);
3184
4569
  switch (command.Operation) {
@@ -3194,6 +4579,7 @@ class NoControlMagicDirective extends MagicDirective {
3194
4579
  break;
3195
4580
  case HtmlProperties.ItemsList:
3196
4581
  if (this.htmlElement instanceof HTMLSelectElement) {
4582
+ // clear the list
3197
4583
  var len = this.htmlElement.length;
3198
4584
  for (var i = len - 1; i >= 0; i--) {
3199
4585
  this.htmlElement.remove(i);
@@ -3235,7 +4621,8 @@ class NoControlMagicDirective extends MagicDirective {
3235
4621
  let child = tabControl.children[i];
3236
4622
  const layer = child.getAttribute('layer') - 1;
3237
4623
  if (child instanceof HTMLButtonElement) {
3238
- if (layer == command.obj1) {
4624
+ // set button style
4625
+ if (layer == command.obj1) { // compare int to string
3239
4626
  child.classList.add('tab_button_active');
3240
4627
  }
3241
4628
  else {
@@ -3243,6 +4630,7 @@ class NoControlMagicDirective extends MagicDirective {
3243
4630
  }
3244
4631
  }
3245
4632
  else {
4633
+ // not a buton - hide unselected tabpages
3246
4634
  let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
3247
4635
  child.setAttribute('style', style);
3248
4636
  }
@@ -3263,24 +4651,31 @@ class NoControlMagicDirective extends MagicDirective {
3263
4651
  break;
3264
4652
  }
3265
4653
  }
3266
- static ɵ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(i2$1.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
3267
- static ɵdir = i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: [i0.ɵɵInputFlags.None, "magicnc", "magic"] }, features: [i0.ɵɵInheritDefinitionFeature] });
4654
+ /** @nocollapse */ static ɵfac = function NoControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || NoControlMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i2$2.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
4655
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: [0, "magicnc", "magic"] }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature] });
3268
4656
  }
3269
4657
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NoControlMagicDirective, [{
3270
4658
  type: Directive,
3271
4659
  args: [{
3272
- selector: '[magicnc]'
4660
+ selector: '[magicnc]',
4661
+ standalone: false
3273
4662
  }]
3274
- }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
4663
+ }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$2.Platform }, { type: RowMagicDirective, decorators: [{
3275
4664
  type: Optional
3276
4665
  }] }], { magic: [{
3277
4666
  type: Input,
3278
4667
  args: ['magicnc']
3279
4668
  }] }); })();
3280
4669
 
4670
+ /**
4671
+ * @ignore
4672
+ */
3281
4673
  class Constants {
3282
4674
  static DATE_FMT = 'dd/MMM/yyyy';
3283
4675
  }
4676
+ /**
4677
+ * @ignore
4678
+ */
3284
4679
  class DateMagicPipe extends DatePipe {
3285
4680
  _task;
3286
4681
  constructor(_task) {
@@ -3293,6 +4688,7 @@ class DateMagicPipe extends DatePipe {
3293
4688
  let mgDateFormatter = new MgDateFormatter();
3294
4689
  if (!isNullOrUndefined(value) && mask !== null) {
3295
4690
  formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
4691
+ // If control is label control of table, due to query mode, then save the format here.
3296
4692
  if (formatStr != null && this._task.isTableControl(controlId)) {
3297
4693
  if (this._task.mgInputDateFormat == null)
3298
4694
  this._task.mgInputDateFormat = formatStr;
@@ -3305,13 +4701,14 @@ class DateMagicPipe extends DatePipe {
3305
4701
  value = "";
3306
4702
  return value;
3307
4703
  }
3308
- static ɵfac = function DateMagicPipe_Factory(t) { return new (t || DateMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
3309
- static ɵpipe = i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
4704
+ /** @nocollapse */ static ɵfac = function DateMagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DateMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
4705
+ /** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true, standalone: false });
3310
4706
  }
3311
4707
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateMagicPipe, [{
3312
4708
  type: Pipe,
3313
4709
  args: [{
3314
- name: 'magicDate'
4710
+ name: 'magicDate',
4711
+ standalone: false
3315
4712
  }]
3316
4713
  }], () => [{ type: TaskMagicService }], null); })();
3317
4714
  class MgDateFormatter {
@@ -3373,14 +4770,20 @@ class MgDateFormatter {
3373
4770
  return formatStr.ToString();
3374
4771
  }
3375
4772
  else
3376
- return "dd-mm-yyyy";
4773
+ return "dd-mm-yyyy"; // return default format.
3377
4774
  }
3378
4775
  }
3379
4776
 
4777
+ /**
4778
+ * Perform Magic validation on input controls which hold alphanumeric strings
4779
+ */
3380
4780
  class MgformatMagicDirective {
3381
4781
  magicDir;
3382
4782
  _task;
3383
4783
  datePasteFlag = false;
4784
+ /**
4785
+ * @ignore
4786
+ */
3384
4787
  constructor(magicDir, _task) {
3385
4788
  this.magicDir = magicDir;
3386
4789
  this._task = _task;
@@ -3388,16 +4791,30 @@ class MgformatMagicDirective {
3388
4791
  ngAfterViewInit() {
3389
4792
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3390
4793
  if (control != null && this._task.mgInputDateFormat == null) {
4794
+ // get the first date control's format.
3391
4795
  let pic = this._task.GetControlPictureMask(this.magicDir.id);
3392
4796
  if (pic.getAttr() == StorageAttribute.DATE) {
3393
4797
  this.formatDate(pic);
3394
4798
  }
3395
4799
  }
3396
4800
  }
4801
+ /**
4802
+ * @ignore
4803
+ */
4804
+ /**
4805
+ * This can be used to set pattern
4806
+ * On input, verifies the input matches the required mask
4807
+ */
3397
4808
  onFocusEvent($event) {
3398
4809
  this.calculatePattern();
3399
4810
  }
3400
4811
  onPaste(event) {
4812
+ /**
4813
+ * This flag is needed to skip execution of dateMasking() method when user paste date in input control.
4814
+ * This is only needed when "StorageAttribute" is DATE. But to check type of "StorageAttribute", we
4815
+ need to execute getControlMetadata() method. So, to reduce this execution overload we set
4816
+ "datePasteFlag" directly.
4817
+ */
3401
4818
  this.datePasteFlag = true;
3402
4819
  }
3403
4820
  onInputEvent(event) {
@@ -3409,6 +4826,8 @@ class MgformatMagicDirective {
3409
4826
  }
3410
4827
  this.calculatePattern();
3411
4828
  }
4829
+ //This method inserts '/' as a separator while entering date in the textbox.
4830
+ //Example: 10/10/2023
3412
4831
  dateMasking(event) {
3413
4832
  const input = event.target;
3414
4833
  let cursorPos = event.target.selectionStart;
@@ -3561,6 +4980,10 @@ class MgformatMagicDirective {
3561
4980
  input.setSelectionRange(start, end);
3562
4981
  }
3563
4982
  }
4983
+ /**
4984
+ * @ignore
4985
+ */
4986
+ // This can be used to implement uppercase/lower case
3564
4987
  onChangeEvent(event) {
3565
4988
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3566
4989
  let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
@@ -3582,6 +5005,7 @@ class MgformatMagicDirective {
3582
5005
  this.formatDateWithCentury(event.target.value, century, control);
3583
5006
  }
3584
5007
  }
5008
+ /** Format year, if user enters 2 digits instead of 4 digits as per the century given in Magic.ini file */
3585
5009
  formatDateWithCentury(userInput, century, control) {
3586
5010
  const dateFormat = this._task.mgInputDateFormat;
3587
5011
  const separator = userInput.includes('/') ? '/' : "-";
@@ -3739,6 +5163,9 @@ class MgformatMagicDirective {
3739
5163
  const year = Number(dateArray[0]);
3740
5164
  return [day, month, year];
3741
5165
  }
5166
+ /**
5167
+ * @ignore
5168
+ */
3742
5169
  calculatePattern() {
3743
5170
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3744
5171
  if (control != null) {
@@ -3757,6 +5184,7 @@ class MgformatMagicDirective {
3757
5184
  if (control.validator == null)
3758
5185
  control.setValidators(Validators.maxLength(pic.getMaskLength()));
3759
5186
  else {
5187
+ // re-set all validators again
3760
5188
  if (pic.isFormatExp()) {
3761
5189
  control.setValidators(Validators.maxLength(pic.getMaskLength()));
3762
5190
  if (isUndefined(this.magicDir.rowId))
@@ -3766,6 +5194,7 @@ class MgformatMagicDirective {
3766
5194
  else
3767
5195
  control.setValidators([control.validator, Validators.maxLength(pic.getMaskLength())]);
3768
5196
  }
5197
+ // control.setValidators(Validators.maxLength(pic.getMaskLength()));
3769
5198
  control.updateValueAndValidity();
3770
5199
  }
3771
5200
  }
@@ -3776,6 +5205,9 @@ class MgformatMagicDirective {
3776
5205
  let mgDateFormatter = new MgDateFormatter();
3777
5206
  this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
3778
5207
  }
5208
+ /**
5209
+ * @ignore
5210
+ */
3779
5211
  formatAlphaUnicode(control) {
3780
5212
  let value = control.value;
3781
5213
  if (value !== null && value.length > 0) {
@@ -3801,6 +5233,9 @@ class MgformatMagicDirective {
3801
5233
  control.setValue(valueStr.ToString());
3802
5234
  }
3803
5235
  }
5236
+ /**
5237
+ * @ignore
5238
+ */
3804
5239
  formatBoolean(control) {
3805
5240
  let value = control.value;
3806
5241
  if (value !== null && value.length > 0) {
@@ -3813,6 +5248,12 @@ class MgformatMagicDirective {
3813
5248
  }
3814
5249
  }
3815
5250
  }
5251
+ /**
5252
+ * @ignore
5253
+ */
5254
+ /// <summary>
5255
+ /// generate pattern from fld's format
5256
+ /// </summary>
3816
5257
  generatePattern(attribute, pic) {
3817
5258
  let pattern = '';
3818
5259
  switch (attribute) {
@@ -3826,6 +5267,12 @@ class MgformatMagicDirective {
3826
5267
  }
3827
5268
  return pattern;
3828
5269
  }
5270
+ /**
5271
+ * @ignore
5272
+ */
5273
+ /// <summary>
5274
+ /// generate pattern for Alpha
5275
+ /// </summary>
3829
5276
  generatePatternForNumber(pic) {
3830
5277
  let patternStr = new StringBuilder();
3831
5278
  patternStr.Append('^');
@@ -3838,6 +5285,9 @@ class MgformatMagicDirective {
3838
5285
  patternStr.Append('$');
3839
5286
  return patternStr.ToString();
3840
5287
  }
5288
+ /**
5289
+ * @ignore
5290
+ */
3841
5291
  isPatternGenerationNeeded(attr, pic) {
3842
5292
  switch (attr) {
3843
5293
  case StorageAttribute.NUMERIC:
@@ -3847,6 +5297,12 @@ class MgformatMagicDirective {
3847
5297
  return (pic.getMaskChars() > 0) ? true : false;
3848
5298
  }
3849
5299
  }
5300
+ /**
5301
+ * @ignore
5302
+ */
5303
+ /// <summary>
5304
+ /// generate pattern for Alpha
5305
+ /// </summary>
3850
5306
  generatePatternForAlpha(pic) {
3851
5307
  let cnt = 0;
3852
5308
  let inputAllChars = false;
@@ -3855,6 +5311,7 @@ class MgformatMagicDirective {
3855
5311
  let pattern = new StringBuilder();
3856
5312
  pattern.Append('^');
3857
5313
  for (let i = 0; i < mask.length;) {
5314
+ //start new subset , if mask[i] is one of these.
3858
5315
  if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
3859
5316
  || mask.charCodeAt(i) == PICInterface.PIC_X)) {
3860
5317
  pattern.Append('(');
@@ -3900,9 +5357,13 @@ class MgformatMagicDirective {
3900
5357
  pattern.Append('$');
3901
5358
  return pattern.ToString();
3902
5359
  }
5360
+ /**
5361
+ * @ignore
5362
+ */
3903
5363
  getDirectiveCount(mask, idx, pattern, changeInPattern) {
3904
5364
  changeInPattern.value = false;
3905
5365
  let patternCount = 0;
5366
+ // find max chars
3906
5367
  while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
3907
5368
  patternCount++;
3908
5369
  idx++;
@@ -3911,21 +5372,25 @@ class MgformatMagicDirective {
3911
5372
  changeInPattern.value = true;
3912
5373
  return patternCount;
3913
5374
  }
5375
+ /**
5376
+ * @ignore
5377
+ */
3914
5378
  IsPatternMatches(mask, pattern) {
3915
5379
  for (let i = 0; i < pattern.length; i++)
3916
5380
  if (mask == pattern[i])
3917
5381
  return true;
3918
5382
  return false;
3919
5383
  }
3920
- static ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
3921
- static ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
5384
+ /** @nocollapse */ static ɵfac = function MgformatMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
5385
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3922
5386
  i0.ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("paste", function MgformatMagicDirective_paste_HostBindingHandler($event) { return ctx.onPaste($event); })("input", function MgformatMagicDirective_input_HostBindingHandler($event) { return ctx.onInputEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); })("blur", function MgformatMagicDirective_blur_HostBindingHandler($event) { return ctx.onBlurEvent($event); });
3923
- } } });
5387
+ } }, standalone: false });
3924
5388
  }
3925
5389
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgformatMagicDirective, [{
3926
5390
  type: Directive,
3927
5391
  args: [{
3928
- selector: '[mgFormat]'
5392
+ selector: '[mgFormat]',
5393
+ standalone: false
3929
5394
  }]
3930
5395
  }], () => [{ type: MagicDirective }, { type: TaskMagicService }], { onFocusEvent: [{
3931
5396
  type: HostListener,
@@ -3944,6 +5409,9 @@ class MgformatMagicDirective {
3944
5409
  args: ['blur', ['$event']]
3945
5410
  }] }); })();
3946
5411
 
5412
+ /**
5413
+ * @ignore
5414
+ */
3947
5415
  class TimeMagicPipe extends DatePipe {
3948
5416
  _task;
3949
5417
  constructor(_task) {
@@ -3979,23 +5447,37 @@ class TimeMagicPipe extends DatePipe {
3979
5447
  }
3980
5448
  return value;
3981
5449
  }
3982
- static ɵfac = function TimeMagicPipe_Factory(t) { return new (t || TimeMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
3983
- static ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
5450
+ /** @nocollapse */ static ɵfac = function TimeMagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TimeMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
5451
+ /** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true, standalone: false });
3984
5452
  }
3985
5453
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimeMagicPipe, [{
3986
5454
  type: Pipe,
3987
5455
  args: [{
3988
- name: 'magicTime'
5456
+ name: 'magicTime',
5457
+ standalone: false
3989
5458
  }]
3990
5459
  }], () => [{ type: TaskMagicService }], null); })();
3991
5460
 
5461
+ /**
5462
+ * Validates the field range.
5463
+ */
3992
5464
  class RangeValidatorMagicDirective {
3993
5465
  _task;
3994
5466
  vcRef;
5467
+ /**
5468
+ *
5469
+ * @param _task The task service
5470
+ * @param vcRef
5471
+ */
3995
5472
  constructor(_task, vcRef) {
3996
5473
  this._task = _task;
3997
5474
  this.vcRef = vcRef;
3998
5475
  }
5476
+ /**
5477
+ * Validation method
5478
+ * @param c FormControl to validate
5479
+ * @returns If validation fails, return error message, else returns null
5480
+ */
3999
5481
  validate(c) {
4000
5482
  let controlName;
4001
5483
  controlName = this.getControlName(c);
@@ -4017,12 +5499,15 @@ class RangeValidatorMagicDirective {
4017
5499
  };
4018
5500
  }
4019
5501
  }
5502
+ /**
5503
+ * @ignore
5504
+ */
4020
5505
  getControlName(c) {
4021
5506
  const formGroup = c.parent.controls;
4022
5507
  return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
4023
5508
  }
4024
- static ɵfac = function RangeValidatorMagicDirective_Factory(t) { return new (t || RangeValidatorMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
4025
- static ɵdir = i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [i0.ɵɵProvidersFeature([
5509
+ /** @nocollapse */ static ɵfac = function RangeValidatorMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RangeValidatorMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
5510
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], standalone: false, features: [i0.ɵɵProvidersFeature([
4026
5511
  {
4027
5512
  provide: NG_VALIDATORS,
4028
5513
  useExisting: RangeValidatorMagicDirective,
@@ -4040,7 +5525,8 @@ class RangeValidatorMagicDirective {
4040
5525
  useExisting: RangeValidatorMagicDirective,
4041
5526
  multi: true,
4042
5527
  }
4043
- ]
5528
+ ],
5529
+ standalone: false
4044
5530
  }]
4045
5531
  }], () => [{ type: TaskMagicService }, { type: i0.ViewContainerRef }], null); })();
4046
5532
 
@@ -4050,26 +5536,48 @@ function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) { if (rf & 1) {
4050
5536
  const ctx_r0 = i0.ɵɵnextContext();
4051
5537
  i0.ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
4052
5538
  } }
5539
+ /**
5540
+ * Represents a Magic subform
5541
+ */
4053
5542
  class SubformMagicComponent {
4054
5543
  vcRef;
4055
5544
  mgSub;
5545
+ /**
5546
+ * @ignore
5547
+ */
4056
5548
  id;
5549
+ /**
5550
+ * @ignore
5551
+ */
4057
5552
  set magic(val) { this.id = val; }
4058
5553
  ;
5554
+ /**
5555
+ * @ignore
5556
+ */
4059
5557
  component = null;
5558
+ /**
5559
+ * @ignore
5560
+ */
4060
5561
  constructor(vcRef, mgSub) {
4061
5562
  this.vcRef = vcRef;
4062
5563
  this.mgSub = mgSub;
5564
+ // For angular 13 - find the component from _hostLView
4063
5565
  this.component = (this.vcRef._hostLView).find(v => !isNullOrUndefined(v));
4064
5566
  }
5567
+ /**
5568
+ * @ignore
5569
+ */
4065
5570
  get Component() {
4066
5571
  return this.mgSub.mgGetComp(this.id);
4067
5572
  }
5573
+ /**
5574
+ * @ignore
5575
+ */
4068
5576
  get Parameters() {
4069
5577
  return this.mgSub.mgGetParameters(this.id);
4070
5578
  }
4071
- static ɵfac = function SubformMagicComponent_Factory(t) { return new (t || SubformMagicComponent)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(SubformMagicService)); };
4072
- static ɵ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) {
5579
+ /** @nocollapse */ static ɵfac = function SubformMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SubformMagicComponent)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(SubformMagicService)); };
5580
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: SubformMagicComponent, selectors: [["magic-subform"]], inputs: { magic: "magic" }, standalone: false, decls: 1, vars: 1, consts: [[3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"]], template: function SubformMagicComponent_Template(rf, ctx) { if (rf & 1) {
4073
5581
  i0.ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
4074
5582
  } if (rf & 2) {
4075
5583
  i0.ɵɵproperty("ngIf", ctx.Component);
@@ -4085,13 +5593,14 @@ class SubformMagicComponent {
4085
5593
  [ndcDynamicComponent]="Component"
4086
5594
  [ndcDynamicInputs]="Parameters">
4087
5595
  </ndc-dynamic>
4088
- `
5596
+ `,
5597
+ standalone: false
4089
5598
  }]
4090
5599
  }], () => [{ type: i0.ViewContainerRef }, { type: SubformMagicService }], { magic: [{
4091
5600
  type: Input,
4092
5601
  args: ['magic']
4093
5602
  }] }); })();
4094
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SubformMagicComponent, { className: "SubformMagicComponent", filePath: "src\\ui\\subform.magic.component.ts", lineNumber: 20 }); })();
5603
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SubformMagicComponent, { className: "SubformMagicComponent", filePath: "src/ui/subform.magic.component.ts", lineNumber: 22 }); })();
4095
5604
 
4096
5605
  const _c0$1 = ["customContent"];
4097
5606
  const _c1 = ["*"];
@@ -4115,12 +5624,21 @@ function ErrorMagicComponent_div_0_Template(rf, ctx) { if (rf & 1) {
4115
5624
  i0.ɵɵadvance(4);
4116
5625
  i0.ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
4117
5626
  } }
5627
+ /**
5628
+ * Represents a Magic subform
5629
+ */
4118
5630
  class ErrorMagicComponent {
4119
5631
  _task;
4120
5632
  mgService;
4121
5633
  changeDetectorRef;
5634
+ /**
5635
+ * @ignore
5636
+ */
4122
5637
  id;
4123
5638
  rowId;
5639
+ /**
5640
+ * @ignore
5641
+ */
4124
5642
  set magic(val) {
4125
5643
  this.id = val;
4126
5644
  }
@@ -4129,18 +5647,26 @@ class ErrorMagicComponent {
4129
5647
  this.rowId = val;
4130
5648
  }
4131
5649
  ;
5650
+ // if true - display standard magic error message, if false - customer has provides his own content and we'll use it
4132
5651
  defaultDisplay = true;
4133
5652
  set CustomContent(innerComponent) {
4134
5653
  this.defaultDisplay = innerComponent == undefined || this.isEmpty(innerComponent.nativeElement);
4135
5654
  this.changeDetectorRef.detectChanges();
4136
5655
  }
4137
5656
  ;
5657
+ /**
5658
+ * @ignore
5659
+ */
4138
5660
  constructor(_task, mgService, changeDetectorRef) {
4139
5661
  this._task = _task;
4140
5662
  this.mgService = mgService;
4141
5663
  this.changeDetectorRef = changeDetectorRef;
4142
5664
  this.rowId = "0";
4143
5665
  }
5666
+ /**
5667
+ * returns true if the html element has no children
5668
+ * @param element
5669
+ */
4144
5670
  isEmpty(element) {
4145
5671
  const nodes = element.childNodes;
4146
5672
  for (let i = 0; i < nodes.length; i++) {
@@ -4151,6 +5677,9 @@ class ErrorMagicComponent {
4151
5677
  }
4152
5678
  return true;
4153
5679
  }
5680
+ /**
5681
+ * @ignore
5682
+ */
4154
5683
  HasErrors(id) {
4155
5684
  if (!isUndefined(id)) {
4156
5685
  let control = this._task.getFormControl(this.rowId, id);
@@ -4171,13 +5700,13 @@ class ErrorMagicComponent {
4171
5700
  }
4172
5701
  return false;
4173
5702
  }
4174
- static ɵfac = function ErrorMagicComponent_Factory(t) { return new (t || ErrorMagicComponent)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(AccessorMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
4175
- static ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
5703
+ /** @nocollapse */ static ɵfac = function ErrorMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ErrorMagicComponent)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(AccessorMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
5704
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
4176
5705
  i0.ɵɵviewQuery(_c0$1, 5);
4177
5706
  } if (rf & 2) {
4178
5707
  let _t;
4179
5708
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.CustomContent = _t.first);
4180
- } }, inputs: { magic: "magic", rowId1: [i0.ɵɵInputFlags.None, "rowId", "rowId1"] }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [["customContent", ""], [4, "ngIf"]], template: function ErrorMagicComponent_Template(rf, ctx) { if (rf & 1) {
5709
+ } }, inputs: { magic: "magic", rowId1: [0, "rowId", "rowId1"] }, standalone: false, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [["customContent", ""], [4, "ngIf"]], template: function ErrorMagicComponent_Template(rf, ctx) { if (rf & 1) {
4181
5710
  i0.ɵɵprojectionDef();
4182
5711
  i0.ɵɵtemplate(0, ErrorMagicComponent_div_0_Template, 5, 1, "div", 1);
4183
5712
  } if (rf & 2) {
@@ -4196,7 +5725,8 @@ class ErrorMagicComponent {
4196
5725
  {{mgService.getErrMsg(id, rowId)}}
4197
5726
  </span>
4198
5727
  </div>
4199
- `
5728
+ `,
5729
+ standalone: false
4200
5730
  }]
4201
5731
  }], () => [{ type: TaskMagicService }, { type: AccessorMagicService }, { type: i0.ChangeDetectorRef }], { magic: [{
4202
5732
  type: Input,
@@ -4208,8 +5738,11 @@ class ErrorMagicComponent {
4208
5738
  type: ViewChild,
4209
5739
  args: ['customContent', { static: false }]
4210
5740
  }] }); })();
4211
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ErrorMagicComponent, { className: "ErrorMagicComponent", filePath: "src\\ui\\mgerror.magic.component.ts", lineNumber: 22 }); })();
5741
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ErrorMagicComponent, { className: "ErrorMagicComponent", filePath: "src/ui/mgerror.magic.component.ts", lineNumber: 24 }); })();
4212
5742
 
5743
+ /**
5744
+ * Directive for checkboxes, to handle the 'change' event
5745
+ */
4213
5746
  class CheckboxMagicDirective {
4214
5747
  magicDirective;
4215
5748
  el;
@@ -4217,11 +5750,17 @@ class CheckboxMagicDirective {
4217
5750
  threeState = false;
4218
5751
  subscribeRefreshDom = null;
4219
5752
  isIndeterminate = false;
5753
+ /**
5754
+ * @ignore
5755
+ */
4220
5756
  constructor(magicDirective, el, task) {
4221
5757
  this.magicDirective = magicDirective;
4222
5758
  this.el = el;
4223
5759
  this.task = task;
4224
5760
  }
5761
+ /**
5762
+ * Handles the Checkbox 'change' event - pass it to the Magic engine
5763
+ */
4225
5764
  onChange($event) {
4226
5765
  if (this.threeState) {
4227
5766
  this.handleThreeState();
@@ -4276,16 +5815,20 @@ class CheckboxMagicDirective {
4276
5815
  checkbox.indeterminate = false;
4277
5816
  value = 'checked';
4278
5817
  }
5818
+ // @ts-ignore
4279
5819
  this.magicDirective.task.onCheckChanged(value, this.magicDirective.id, +this.magicDirective.rowId);
4280
5820
  }
5821
+ /**
5822
+ * Cleanup
5823
+ */
4281
5824
  ngOnDestroy() {
4282
5825
  if (this.subscribeRefreshDom !== null)
4283
5826
  this.subscribeRefreshDom.unsubscribe();
4284
5827
  }
4285
- static ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(TaskMagicService)); };
4286
- static ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
5828
+ /** @nocollapse */ static ɵfac = function CheckboxMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(TaskMagicService)); };
5829
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4287
5830
  i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4288
- } }, inputs: { threeState: "threeState" } });
5831
+ } }, inputs: { threeState: "threeState" }, standalone: false });
4289
5832
  }
4290
5833
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
4291
5834
  type: Directive,
@@ -4293,6 +5836,7 @@ class CheckboxMagicDirective {
4293
5836
  selector: `
4294
5837
  input[type=checkbox][magic]:not([noFormControl])
4295
5838
  `,
5839
+ standalone: false
4296
5840
  }]
4297
5841
  }], () => [{ type: MagicDirective }, { type: i0.ElementRef }, { type: TaskMagicService }], { threeState: [{
4298
5842
  type: Input
@@ -4301,43 +5845,62 @@ class CheckboxMagicDirective {
4301
5845
  args: ['change', ['$event']]
4302
5846
  }] }); })();
4303
5847
 
5848
+ /**
5849
+ * Directive for comboboxes, to handle the 'change' event
5850
+ */
4304
5851
  class ComboboxMagicDirective {
4305
5852
  magicDirective;
4306
5853
  constructor(magicDirective) {
4307
5854
  this.magicDirective = magicDirective;
5855
+ // subcribe to refreshDom. This is a special case for native select HTML control.
5856
+ // to refresh the selected property. Else by default, HTML element doesn't get refreshed as per
5857
+ // selected value and 1st element remains selected.
4308
5858
  this.magicDirective.task.refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c))).subscribe(value => {
4309
5859
  let command = value;
4310
5860
  if (command.Operation === HtmlProperties.ItemsList)
4311
5861
  this.onComboboxItemsListChanged();
4312
5862
  });
4313
5863
  }
5864
+ /**
5865
+ * Handles the Combobox 'change' event - pass it to the Magic engine
5866
+ */
4314
5867
  onChange($event) {
4315
5868
  this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4316
5869
  }
5870
+ /**
5871
+ * To refresh Combobox selection as per selected property.
5872
+ */
4317
5873
  onComboboxItemsListChanged() {
4318
5874
  this.magicDirective.task.refreshView();
4319
5875
  }
4320
- static ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4321
- static ɵdir = i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
5876
+ /** @nocollapse */ static ɵfac = function ComboboxMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
5877
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4322
5878
  i0.ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4323
- } } });
5879
+ } }, standalone: false });
4324
5880
  }
4325
5881
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComboboxMagicDirective, [{
4326
5882
  type: Directive,
4327
5883
  args: [{
4328
5884
  selector: `select[magic]:not([multiple])`,
5885
+ standalone: false
4329
5886
  }]
4330
5887
  }], () => [{ type: MagicDirective }], { onChange: [{
4331
5888
  type: HostListener,
4332
5889
  args: ['change', ['$event']]
4333
5890
  }] }); })();
4334
5891
 
5892
+ /**
5893
+ * This service supports custom actions on magic exit
5894
+ */
4335
5895
  class ExitMagicService {
5896
+ /**
5897
+ * Override this method to implement custom logic on magic exit
5898
+ */
4336
5899
  exitMagic() {
4337
5900
  console.log("Magic application terminated");
4338
5901
  }
4339
- static ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
4340
- static ɵprov = i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
5902
+ /** @nocollapse */ static ɵfac = function ExitMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ExitMagicService)(); };
5903
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
4341
5904
  }
4342
5905
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ExitMagicService, [{
4343
5906
  type: Injectable
@@ -4363,6 +5926,9 @@ function MagicShellComponent_div_5_Template(rf, ctx) { if (rf & 1) {
4363
5926
  function MagicShellComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
4364
5927
  i0.ɵɵelement(0, "div", 9);
4365
5928
  } }
5929
+ /**
5930
+ * Root Magic component
5931
+ */
4366
5932
  class MagicShellComponent {
4367
5933
  engineMagicService;
4368
5934
  componentList;
@@ -4374,13 +5940,28 @@ class MagicShellComponent {
4374
5940
  route;
4375
5941
  router;
4376
5942
  exitMagicService;
5943
+ /**
5944
+ * Root component to be displayed in the window
5945
+ */
4377
5946
  RootComponent = null;
5947
+ /**
5948
+ * parameters for the Root Component
5949
+ */
4378
5950
  RootComponentParameters;
4379
5951
  overlayWindowsContainerViewRef;
4380
5952
  rootMagicElementRef;
4381
5953
  SpinnerTemplate;
4382
5954
  showSpinner;
4383
5955
  magicEngineTerminated = false;
5956
+ /**
5957
+ *
5958
+ * @param magic Magic's service
5959
+ * @param componentList Magic component list
5960
+ * @param changeDetectorRef Changes detector
5961
+ * @param titleService Title setting service
5962
+ * @param httpClient The native httpClient instance
5963
+ * @param exitMagicService Magic exit service
5964
+ */
4384
5965
  constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, route, router, exitMagicService) {
4385
5966
  this.engineMagicService = engineMagicService;
4386
5967
  this.componentList = componentList;
@@ -4395,17 +5976,24 @@ class MagicShellComponent {
4395
5976
  this.initialize();
4396
5977
  this.setTitle();
4397
5978
  }
5979
+ /**
5980
+ * Before-unload event listener
5981
+ * @param event
5982
+ */
4398
5983
  onBeforeUnload(event) {
4399
5984
  if (this.engineMagicService.TransCacheExists()) {
5985
+ // Show the confirmation box before unloading the browser
4400
5986
  event.returnValue = 'Are you sure?';
4401
5987
  return 'Are you sure?';
4402
5988
  }
4403
5989
  else {
5990
+ // terminate the magic server context using fetch API with keep-alive
4404
5991
  this.engineMagicService.TerminateContextUsingFetchAPI();
4405
5992
  this.magicEngineTerminated = true;
4406
5993
  }
4407
5994
  }
4408
5995
  onUnload(event) {
5996
+ // Chrome provides an opportunity to terminate the context after user approves the browser unload alert
4409
5997
  if (!this.magicEngineTerminated)
4410
5998
  this.engineMagicService.TerminateContextUsingFetchAPI();
4411
5999
  }
@@ -4417,6 +6005,7 @@ class MagicShellComponent {
4417
6005
  if (this.router.navigated) {
4418
6006
  const queryParams = this.route.snapshot.queryParams;
4419
6007
  const queryParamsMap = new Map();
6008
+ // Iterate over the queryParams object and populate the Map
4420
6009
  for (const key in queryParams) {
4421
6010
  if (queryParams.hasOwnProperty(key)) {
4422
6011
  queryParamsMap.set(key, queryParams[key].toString());
@@ -4430,13 +6019,26 @@ class MagicShellComponent {
4430
6019
  setViewContainerRef(vcRef) {
4431
6020
  this.overlayWindowsContainerViewRef = vcRef;
4432
6021
  }
6022
+ /**
6023
+ * Initialization of Magic mechanisms
6024
+ */
4433
6025
  initialize() {
4434
6026
  this.registerUICommands();
4435
6027
  }
6028
+ /**
6029
+ * Set the title
6030
+ */
4436
6031
  setTitle() {
4437
6032
  const newTitle = this.componentList.title;
4438
6033
  this.titleService.setTitle(newTitle);
4439
6034
  }
6035
+ /**
6036
+ * Set the component according to requested form
6037
+ * @param formName Name of the form to open
6038
+ * @param taskId Id of opening task
6039
+ * @param taskDescription TODO
6040
+ * @param isModal whether modal window is being opened
6041
+ */
4440
6042
  setComponent(formName, taskId, taskDescription, isModal) {
4441
6043
  this.pendingCommandsCollector.startCollecting();
4442
6044
  if (isModal) {
@@ -4448,6 +6050,9 @@ class MagicShellComponent {
4448
6050
  }
4449
6051
  this.changeDetectorRef.detectChanges();
4450
6052
  }
6053
+ /**
6054
+ * @ignore
6055
+ */
4451
6056
  registerUICommands() {
4452
6057
  this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
4453
6058
  .subscribe(command => {
@@ -4459,6 +6064,10 @@ class MagicShellComponent {
4459
6064
  GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
4460
6065
  });
4461
6066
  }
6067
+ /**
6068
+ * Execute commands received from the Magic WebClient engine
6069
+ * @param command
6070
+ */
4462
6071
  executeCommand(command) {
4463
6072
  switch (command.CommandType) {
4464
6073
  case CommandType.OPEN_FORM:
@@ -4473,7 +6082,7 @@ class MagicShellComponent {
4473
6082
  this.RootComponentParameters = {};
4474
6083
  this.changeDetectorRef.detectChanges();
4475
6084
  }
4476
- else {
6085
+ else { // Close modal window
4477
6086
  this.overlayWindowService.close(command.str);
4478
6087
  this.changeDetectorRef.detectChanges();
4479
6088
  }
@@ -4496,15 +6105,17 @@ class MagicShellComponent {
4496
6105
  break;
4497
6106
  }
4498
6107
  }
4499
- static ɵ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(i1$2.HttpClient), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(ExitMagicService, 8)); };
4500
- static ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
6108
+ /** @nocollapse */ static ɵfac = function MagicShellComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicShellComponent)(i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$1.Title), i0.ɵɵdirectiveInject(OverlayWindowService), i0.ɵɵdirectiveInject(i1$2.HttpClient), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(ExitMagicService, 8)); };
6109
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
4501
6110
  i0.ɵɵviewQuery(_c0, 7);
4502
6111
  } if (rf & 2) {
4503
6112
  let _t;
4504
6113
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
4505
6114
  } }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) { if (rf & 1) {
4506
6115
  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);
4507
- } }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, features: [i0.ɵɵProvidersFeature([])], decls: 8, vars: 2, consts: [["magicRoot", ""], ["overlayWindowsContainer", ""], ["defaultSpinner", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], ["magicViewContainerRef", ""], ["class", "spinner-background", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"], [1, "spinner-background"], [3, "ngTemplateOutlet"], [1, "mgSpinnerClass"]], template: function MagicShellComponent_Template(rf, ctx) { if (rf & 1) {
6116
+ } }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, standalone: false, features: [i0.ɵɵProvidersFeature([
6117
+ // ExitMagicService
6118
+ ])], decls: 8, vars: 2, consts: [["magicRoot", ""], ["overlayWindowsContainer", ""], ["defaultSpinner", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], ["magicViewContainerRef", ""], ["class", "spinner-background", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"], [1, "spinner-background"], [3, "ngTemplateOutlet"], [1, "mgSpinnerClass"]], template: function MagicShellComponent_Template(rf, ctx) { if (rf & 1) {
4508
6119
  i0.ɵɵelementStart(0, "div", null, 0);
4509
6120
  i0.ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 3);
4510
6121
  i0.ɵɵelement(3, "div", 4, 1);
@@ -4519,7 +6130,9 @@ class MagicShellComponent {
4519
6130
  }
4520
6131
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicShellComponent, [{
4521
6132
  type: Component,
4522
- args: [{ selector: 'magic-root', providers: [], template: `
6133
+ args: [{ selector: 'magic-root', providers: [
6134
+ // ExitMagicService
6135
+ ], template: `
4523
6136
  <div #magicRoot>
4524
6137
  <ndc-dynamic
4525
6138
  *ngIf = "RootComponent !== null"
@@ -4538,7 +6151,7 @@ class MagicShellComponent {
4538
6151
  <ng-template #defaultSpinner>
4539
6152
  <div class="mgSpinnerClass"></div>
4540
6153
  </ng-template>
4541
- `, styles: [".mgSpinnerClass{border:10px solid #cccccc;border-top:10px solid black;border-radius:50%;position:fixed;margin:auto;inset:0;width:100px;height:100px;animation:spin 2s linear infinite}.spinner-background{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
6154
+ `, standalone: false, styles: [".mgSpinnerClass{border:10px solid #cccccc;border-top:10px solid black;border-radius:50%;position:fixed;margin:auto;inset:0;width:100px;height:100px;animation:spin 2s linear infinite}.spinner-background{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
4542
6155
  }], () => [{ type: EngineMagicService }, { type: ComponentListMagicService }, { type: i0.ChangeDetectorRef }, { type: i1$1.Title }, { type: OverlayWindowService }, { type: i1$2.HttpClient }, { type: CommandsCollectorMagicService }, { type: i2.ActivatedRoute }, { type: i2.Router }, { type: ExitMagicService, decorators: [{
4543
6156
  type: Optional
4544
6157
  }] }], { rootMagicElementRef: [{
@@ -4553,18 +6166,24 @@ class MagicShellComponent {
4553
6166
  type: HostListener,
4554
6167
  args: ['window:unload', ['$event']]
4555
6168
  }] }); })();
4556
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicShellComponent, { className: "MagicShellComponent", filePath: "src\\ui\\magic-root.component.ts", lineNumber: 85 }); })();
6169
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicShellComponent, { className: "MagicShellComponent", filePath: "src/ui/magic-root.component.ts", lineNumber: 86 }); })();
4557
6170
 
6171
+ /**
6172
+ * @ignore
6173
+ */
4558
6174
  const CHECKBOX_VALUE_ACCESSOR = {
4559
6175
  provide: NG_VALUE_ACCESSOR,
4560
6176
  useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
4561
6177
  multi: true,
4562
6178
  };
6179
+ /**
6180
+ * Value accessor for Checkbox without a FormControl
6181
+ */
4563
6182
  class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
4564
- static ɵfac = (() => { let ɵMagicCheckboxControlValueAccessor_BaseFactory; return function MagicCheckboxControlValueAccessor_Factory(t) { return (ɵMagicCheckboxControlValueAccessor_BaseFactory || (ɵMagicCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor)))(t || MagicCheckboxControlValueAccessor); }; })();
4565
- static ɵ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) {
6183
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicCheckboxControlValueAccessor_BaseFactory; return function MagicCheckboxControlValueAccessor_Factory(__ngFactoryType__) { return (ɵMagicCheckboxControlValueAccessor_BaseFactory || (ɵMagicCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor)))(__ngFactoryType__ || MagicCheckboxControlValueAccessor); }; })();
6184
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ 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) {
4566
6185
  i0.ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
4567
- } }, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
6186
+ } }, standalone: false, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
4568
6187
  }
4569
6188
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
4570
6189
  type: Directive,
@@ -4575,20 +6194,27 @@ class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
4575
6194
  input[type=checkbox][magic]:not([ngModel])
4576
6195
  `,
4577
6196
  host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
4578
- providers: [CHECKBOX_VALUE_ACCESSOR]
6197
+ providers: [CHECKBOX_VALUE_ACCESSOR],
6198
+ standalone: false
4579
6199
  }]
4580
6200
  }], null, null); })();
4581
6201
 
6202
+ /**
6203
+ * @ignore
6204
+ */
4582
6205
  const MAGIC_DEFAULT_VALUE_ACCESSOR = {
4583
6206
  provide: NG_VALUE_ACCESSOR,
4584
6207
  useExisting: forwardRef(() => MagicDefaultValueAccessor),
4585
6208
  multi: true
4586
6209
  };
6210
+ /**
6211
+ * @ignore
6212
+ */
4587
6213
  class MagicDefaultValueAccessor extends DefaultValueAccessor {
4588
- static ɵfac = (() => { let ɵMagicDefaultValueAccessor_BaseFactory; return function MagicDefaultValueAccessor_Factory(t) { return (ɵMagicDefaultValueAccessor_BaseFactory || (ɵMagicDefaultValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicDefaultValueAccessor)))(t || MagicDefaultValueAccessor); }; })();
4589
- static ɵ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) {
6214
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicDefaultValueAccessor_BaseFactory; return function MagicDefaultValueAccessor_Factory(__ngFactoryType__) { return (ɵMagicDefaultValueAccessor_BaseFactory || (ɵMagicDefaultValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicDefaultValueAccessor)))(__ngFactoryType__ || MagicDefaultValueAccessor); }; })();
6215
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ 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) {
4590
6216
  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); });
4591
- } }, exportAs: ["magic"], features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
6217
+ } }, exportAs: ["magic"], standalone: false, features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
4592
6218
  }
4593
6219
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDefaultValueAccessor, [{
4594
6220
  type: Directive,
@@ -4604,22 +6230,29 @@ class MagicDefaultValueAccessor extends DefaultValueAccessor {
4604
6230
  '(compositionend)': '$any(this)._compositionEnd($event.target.value)'
4605
6231
  },
4606
6232
  providers: [MAGIC_DEFAULT_VALUE_ACCESSOR],
4607
- exportAs: 'magic'
6233
+ exportAs: 'magic',
6234
+ standalone: false
4608
6235
  }]
4609
6236
  }], null, null); })();
4610
6237
 
6238
+ /**
6239
+ * Directive for checkboxes which should not have a form control
6240
+ */
4611
6241
  class CheckboxNoFormControlMagicDirective {
4612
6242
  magicDirective;
4613
6243
  constructor(magicDirective) {
4614
6244
  this.magicDirective = magicDirective;
4615
6245
  }
6246
+ /**
6247
+ * Handle the 'Checkbox' change event - pass it to the Magic engine
6248
+ */
4616
6249
  onChange($event) {
4617
6250
  this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4618
6251
  }
4619
- static ɵfac = function CheckboxNoFormControlMagicDirective_Factory(t) { return new (t || CheckboxNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4620
- static ɵdir = i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
6252
+ /** @nocollapse */ static ɵfac = function CheckboxNoFormControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckboxNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
6253
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4621
6254
  i0.ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4622
- } } });
6255
+ } }, standalone: false });
4623
6256
  }
4624
6257
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
4625
6258
  type: Directive,
@@ -4627,30 +6260,38 @@ class CheckboxNoFormControlMagicDirective {
4627
6260
  selector: `
4628
6261
  input[type=checkbox][magic]:([noFormControl])
4629
6262
  `,
6263
+ standalone: false
4630
6264
  }]
4631
6265
  }], () => [{ type: MagicDirective }], { onChange: [{
4632
6266
  type: HostListener,
4633
6267
  args: ['change', ['$event']]
4634
6268
  }] }); })();
4635
6269
 
6270
+ /**
6271
+ * Directive for non-checkbox input controls which do not have a form control
6272
+ */
4636
6273
  class InputNoFormControlMagicDirective {
4637
6274
  magicDirective;
4638
6275
  constructor(magicDirective) {
4639
6276
  this.magicDirective = magicDirective;
4640
6277
  }
6278
+ /**
6279
+ * Handles the 'change' event - pass it to the Magic engine
6280
+ */
4641
6281
  onChange($event) {
4642
6282
  this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
4643
6283
  }
4644
- static ɵfac = function InputNoFormControlMagicDirective_Factory(t) { return new (t || InputNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4645
- static ɵ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) {
6284
+ /** @nocollapse */ static ɵfac = function InputNoFormControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || InputNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
6285
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ 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) {
4646
6286
  i0.ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4647
- } } });
6287
+ } }, standalone: false });
4648
6288
  }
4649
6289
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
4650
6290
  type: Directive,
4651
6291
  args: [{
4652
6292
  selector: `input[magic]:([noFormControl]):not([type=checkbox]),
4653
- textarea[magic]:([noFormControl]):not([type=checkbox])`
6293
+ textarea[magic]:([noFormControl]):not([type=checkbox])`,
6294
+ standalone: false
4654
6295
  }]
4655
6296
  }], () => [{ type: MagicDirective }], { onChange: [{
4656
6297
  type: HostListener,
@@ -4662,6 +6303,14 @@ const DATE_VALUE_ACCESSOR = {
4662
6303
  useExisting: forwardRef(() => DateValueAccessor),
4663
6304
  multi: true
4664
6305
  };
6306
+ /**
6307
+ * The accessor for writing a value and listening to changes on a date input element
6308
+ *
6309
+ * ### Example
6310
+ * `<input type="date" name="birthday" ngModel dateInput>`
6311
+ * OR
6312
+ * `<input type="date" formControlName="birthday" dateInput>`
6313
+ */
4665
6314
  class DateValueAccessor {
4666
6315
  renderer;
4667
6316
  elementRef;
@@ -4680,6 +6329,7 @@ class DateValueAccessor {
4680
6329
  this.magicDir = magicDir;
4681
6330
  this._task = _task;
4682
6331
  }
6332
+ /** Format year, if user enters 2 digits instead of 4 digits as per the century given in Magic.ini file */
4683
6333
  formatDateWithCentury(userInput, century, control) {
4684
6334
  const separator = userInput.includes('/') ? '/' : "-";
4685
6335
  let centuryVal = parseInt(century.toString().slice(0, 2));
@@ -4694,6 +6344,7 @@ class DateValueAccessor {
4694
6344
  year;
4695
6345
  control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
4696
6346
  }
6347
+ /** Writes a new value to the element (model -> view) */
4697
6348
  writeValue(value) {
4698
6349
  if (!value) {
4699
6350
  this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
@@ -4701,27 +6352,31 @@ class DateValueAccessor {
4701
6352
  }
4702
6353
  this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
4703
6354
  }
6355
+ /** Registers a callback function, called when value changes (view -> model) */
4704
6356
  registerOnChange(fn) {
4705
6357
  this.onChange = v => fn(v instanceof Date
4706
6358
  ? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
4707
6359
  : v);
4708
6360
  }
6361
+ /** Registers a callback function, called when the control is blurred */
4709
6362
  registerOnTouched(fn) {
4710
6363
  this.onTouched = fn;
4711
6364
  }
6365
+ /** Enables or disables the element when the control status changes */
4712
6366
  setDisabledState(isDisabled) {
4713
6367
  this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
4714
6368
  }
4715
- static ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
4716
- static ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
6369
+ /** @nocollapse */ static ɵfac = function DateValueAccessor_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
6370
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
4717
6371
  i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler($event) { return ctx.onBlurEvent($event); });
4718
- } }, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
6372
+ } }, standalone: false, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
4719
6373
  }
4720
6374
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateValueAccessor, [{
4721
6375
  type: Directive,
4722
6376
  args: [{
4723
6377
  selector: "[dateInput]",
4724
- providers: [DATE_VALUE_ACCESSOR]
6378
+ providers: [DATE_VALUE_ACCESSOR],
6379
+ standalone: false
4725
6380
  }]
4726
6381
  }], () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: MagicDirective }, { type: TaskMagicService }], { onChange: [{
4727
6382
  type: HostListener,
@@ -4734,6 +6389,9 @@ class DateValueAccessor {
4734
6389
  args: ['blur', ['$event']]
4735
6390
  }] }); })();
4736
6391
 
6392
+ /**
6393
+ * 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
6394
+ */
4737
6395
  class NonMagicControlDirective {
4738
6396
  _task;
4739
6397
  element;
@@ -4744,13 +6402,38 @@ class NonMagicControlDirective {
4744
6402
  this.selector = 'NonMagicControl';
4745
6403
  }
4746
6404
  ;
6405
+ /**
6406
+ * The HTML element connected to this directive
6407
+ */
4747
6408
  htmlElement;
6409
+ /**
6410
+ * Magic's component handling this control
6411
+ */
4748
6412
  component;
6413
+ /**
6414
+ * Collection of event handlers for this element
6415
+ */
4749
6416
  eventHandlers = {};
6417
+ /**
6418
+ * Id of this element
6419
+ */
4750
6420
  id;
6421
+ /**
6422
+ * @ignore
6423
+ */
4751
6424
  selector;
6425
+ /**
6426
+ * @ignore
6427
+ */
4752
6428
  subscribeRefreshDom;
4753
6429
  eventsOnlyVal = false;
6430
+ /**
6431
+ *
6432
+ * @param _task The task service
6433
+ * @param element The element for which the directive is applied
6434
+ * @param renderer Renderer for the element
6435
+ * @param vcRef
6436
+ */
4754
6437
  constructor(_task, element, renderer, vcRef) {
4755
6438
  this._task = _task;
4756
6439
  this.element = element;
@@ -4758,29 +6441,44 @@ class NonMagicControlDirective {
4758
6441
  this.vcRef = vcRef;
4759
6442
  this.htmlElement = this.element.nativeElement;
4760
6443
  }
6444
+ /**
6445
+ * Get the task service
6446
+ * @returns
6447
+ */
4761
6448
  get task() {
4762
6449
  return this._task;
4763
6450
  }
6451
+ /**
6452
+ * Register to the events this element may need to handle
6453
+ */
4764
6454
  regEvents() {
6455
+ // Handle events for which event handler may be removed and restored
4765
6456
  this.eventHandlers['focusin'] = this.OnFocus.bind(this);
4766
6457
  Object.keys(this.eventHandlers).forEach((key) => {
4767
6458
  this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
4768
6459
  });
4769
6460
  }
6461
+ /**
6462
+ * Handle focus event
6463
+ */
4770
6464
  OnFocus() {
4771
6465
  this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', '', -1));
4772
6466
  event.cancelBubble = true;
4773
6467
  }
6468
+ /**
6469
+ * Initialize this object
6470
+ */
4774
6471
  ngOnInit() {
4775
6472
  this.regEvents();
4776
6473
  }
4777
- static ɵfac = function NonMagicControlDirective_Factory(t) { return new (t || NonMagicControlDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
4778
- static ɵdir = i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: [i0.ɵɵInputFlags.None, "NonMagicControl", "magic"] } });
6474
+ /** @nocollapse */ static ɵfac = function NonMagicControlDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || NonMagicControlDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
6475
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: [0, "NonMagicControl", "magic"] }, standalone: false });
4779
6476
  }
4780
6477
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NonMagicControlDirective, [{
4781
6478
  type: Directive,
4782
6479
  args: [{
4783
- selector: '[NonMagicControl]'
6480
+ selector: '[NonMagicControl]',
6481
+ standalone: false
4784
6482
  }]
4785
6483
  }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }], { magic: [{
4786
6484
  type: Input,
@@ -4808,16 +6506,20 @@ class Time24MagicPipe {
4808
6506
  }
4809
6507
  return value;
4810
6508
  }
4811
- static ɵfac = function Time24MagicPipe_Factory(t) { return new (t || Time24MagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
4812
- static ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true });
6509
+ /** @nocollapse */ static ɵfac = function Time24MagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Time24MagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
6510
+ /** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true, standalone: false });
4813
6511
  }
4814
6512
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Time24MagicPipe, [{
4815
6513
  type: Pipe,
4816
6514
  args: [{
4817
- name: 'magicTime24'
6515
+ name: 'magicTime24',
6516
+ standalone: false
4818
6517
  }]
4819
6518
  }], () => [{ type: TaskMagicService }], null); })();
4820
6519
 
6520
+ /**
6521
+ * @ignore
6522
+ */
4821
6523
  const decs = [
4822
6524
  MagicDirective,
4823
6525
  CheckboxMagicDirective,
@@ -4849,30 +6551,33 @@ const decs = [
4849
6551
  MagicViewContainerRef,
4850
6552
  Time24MagicPipe
4851
6553
  ];
6554
+ /**
6555
+ * @ignore
6556
+ */
4852
6557
  class MagicModule {
4853
- static ɵfac = function MagicModule_Factory(t) { return new (t || MagicModule)(); };
4854
- static ɵmod = i0.ɵɵdefineNgModule({ type: MagicModule });
4855
- static ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [CommonModule,
6558
+ /** @nocollapse */ static ɵfac = function MagicModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicModule)(); };
6559
+ /** @nocollapse */ static ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: MagicModule });
6560
+ /** @nocollapse */ static ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider, provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
4856
6561
  FormsModule,
4857
6562
  ReactiveFormsModule,
4858
6563
  RouterModule,
4859
6564
  DynamicModule,
4860
- HttpClientModule, MaskitoModule] });
6565
+ DragDropModule, MaskitoModule] });
4861
6566
  }
4862
6567
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicModule, [{
4863
6568
  type: NgModule,
4864
6569
  args: [{
4865
6570
  declarations: [...decs],
4866
6571
  exports: [...decs, MaskitoModule],
4867
- imports: [
4868
- CommonModule,
6572
+ imports: [CommonModule,
4869
6573
  FormsModule,
4870
6574
  ReactiveFormsModule,
4871
6575
  RouterModule,
4872
6576
  DynamicModule,
4873
- HttpClientModule
4874
- ],
4875
- providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
6577
+ CdkDragHandle,
6578
+ CdkDrag,
6579
+ DragDropModule],
6580
+ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider, provideHttpClient(withInterceptorsFromDi())]
4876
6581
  }]
4877
6582
  }], null, null); })();
4878
6583
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MagicModule, { declarations: [MagicDirective,
@@ -4908,7 +6613,9 @@ class MagicModule {
4908
6613
  ReactiveFormsModule,
4909
6614
  RouterModule,
4910
6615
  DynamicModule,
4911
- HttpClientModule], exports: [MagicDirective,
6616
+ CdkDragHandle,
6617
+ CdkDrag,
6618
+ DragDropModule], exports: [MagicDirective,
4912
6619
  CheckboxMagicDirective,
4913
6620
  CheckboxNoFormControlMagicDirective,
4914
6621
  InputNoFormControlMagicDirective,
@@ -5023,15 +6730,15 @@ class MgDateAdapter extends NativeDateAdapter {
5023
6730
  this.mgdtfmt = this.task.mgInputDateFormat;
5024
6731
  if (displayFormat === 'input') {
5025
6732
  if (this.mgdtfmt == null)
5026
- this.mgdtfmt = 'M/d/yyyy';
6733
+ this.mgdtfmt = 'M/d/yyyy'; //default format
5027
6734
  return formatDate(date, this.mgdtfmt, this.locale);
5028
6735
  }
5029
6736
  else {
5030
6737
  return date.toDateString();
5031
6738
  }
5032
6739
  }
5033
- static ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MAT_DATE_LOCALE)); };
5034
- static ɵprov = i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
6740
+ /** @nocollapse */ static ɵfac = function MgDateAdapter_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MgDateAdapter)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MAT_DATE_LOCALE)); };
6741
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
5035
6742
  }
5036
6743
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgDateAdapter, [{
5037
6744
  type: Injectable
@@ -5044,6 +6751,9 @@ const matDateProviders = [
5044
6751
  { provide: DateAdapter, useClass: MgDateAdapter },
5045
6752
  { provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
5046
6753
  ];
6754
+ /**
6755
+ * Magic service providers
6756
+ */
5047
6757
  const basicMagicProviders = [
5048
6758
  MagicServices,
5049
6759
  TaskMagicService,
@@ -5057,7 +6767,16 @@ const magicProviders = [
5057
6767
  TableMagicService
5058
6768
  ];
5059
6769
 
6770
+ /**
6771
+ * @ignore
6772
+ */
6773
+ ///////////////////////////////////////////////////////////
6774
+ // class to hold gui-related helper methods
6775
+ ///////////////////////////////////////////////////////////
5060
6776
  class utils {
6777
+ ///////////////////////////////////////////////////////////
6778
+ // Calculate the distance between the control and the supplied x,y coordinates
6779
+ ///////////////////////////////////////////////////////////
5061
6780
  static getDistance(control, x, y) {
5062
6781
  let left = control.clientLeft, top = control.clientTop;
5063
6782
  let dx, dy;
@@ -5084,6 +6803,9 @@ class utils {
5084
6803
  const ret = (dx * dx + dy * dy);
5085
6804
  return ret;
5086
6805
  }
6806
+ ///////////////////////////////////////////////////////////
6807
+ //
6808
+ ///////////////////////////////////////////////////////////
5087
6809
  static getDimentions(el) {
5088
6810
  let xPos = 0;
5089
6811
  let yPos = 0;
@@ -5091,12 +6813,14 @@ class utils {
5091
6813
  let height = el.height;
5092
6814
  while (el) {
5093
6815
  if (el.tagName == "BODY") {
6816
+ // deal with browser quirks with body/window/document and page scroll
5094
6817
  let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
5095
6818
  let yScroll = el.scrollTop || document.documentElement.scrollTop;
5096
6819
  xPos += (el.offsetLeft - xScroll + el.clientLeft);
5097
6820
  yPos += (el.offsetTop - yScroll + el.clientTop);
5098
6821
  }
5099
6822
  else {
6823
+ // for all other non-BODY elements
5100
6824
  xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
5101
6825
  yPos += (el.offsetTop - el.scrollTop + el.clientTop);
5102
6826
  }
@@ -5111,11 +6835,22 @@ class utils {
5111
6835
  }
5112
6836
  }
5113
6837
 
6838
+ /**
6839
+ * @ignore
6840
+ */
5114
6841
  class ModalFormDefinition {
5115
6842
  taskId = "";
5116
6843
  comp = null;
5117
6844
  parameters = {};
5118
6845
  }
5119
6846
 
6847
+ /**
6848
+ * @file Automatically generated by barrelsby.
6849
+ */
6850
+
6851
+ /**
6852
+ * Generated bundle index. Do not edit.
6853
+ */
6854
+
5120
6855
  export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, CHECKBOX_VALUE_ACCESSOR, COLOR_FILE_NAME, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_BG_COLOR, MAGIC_DEFAULT_VALUE_ACCESSOR, MAGIC_FG_COLOR, MG_FORMATS, MagicAlertComponent, MagicCheckboxControlValueAccessor, MagicColorService, MagicConfirmationBoxComponent, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicLazyLoaderService, 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, Time24MagicPipe, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
5121
6856
  //# sourceMappingURL=magic-xpa-angular.mjs.map