@magic-xpa/angular 4.1200.0-dev4120.15 → 4.1200.0-dev4120.151

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 +1968 -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 +87 -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,103 @@ 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
+ static minAllowedWidth = 30;
1105
+ static minAllowedHeight = 30;
1106
+ /**
1107
+ *
1108
+ */
889
1109
  constructor() {
890
1110
  super();
891
1111
  }
1112
+ /**
1113
+ *
1114
+ */
892
1115
  ngOnInit() {
893
1116
  this.componentRef = this.modalbodyViewContainerRef.createComponent(this.ModalComp);
894
1117
  Object.assign(this.componentRef.instance, this.ModalCompParameters);
1118
+ let comp = this.componentRef.instance;
1119
+ this.isCenteredToWindow = comp.IsCenteredToWindow();
895
1120
  }
896
1121
  setViewContainerRef(vcRef) {
897
1122
  this.modalbodyViewContainerRef = vcRef;
898
1123
  }
1124
+ /**
1125
+ * Returns the form name
1126
+ * @returns
1127
+ */
899
1128
  getText() {
900
1129
  if (this.componentRef !== null) {
901
1130
  let comp = this.componentRef.instance;
@@ -904,13 +1133,17 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
904
1133
  else
905
1134
  return '';
906
1135
  }
1136
+ /**
1137
+ * Returns CSS styles for the window
1138
+ * @returns
1139
+ */
907
1140
  getStyle() {
908
1141
  let styles = {};
909
1142
  if (this.componentRef != undefined) {
910
1143
  let comp = this.componentRef.instance;
911
1144
  styles['width'] = comp.Width();
912
1145
  styles['height'] = comp.Height();
913
- if (comp.IsCenteredToWindow()) {
1146
+ if (this.isCenteredToWindow) {
914
1147
  styles['margin'] = 'auto';
915
1148
  }
916
1149
  else {
@@ -920,6 +1153,10 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
920
1153
  }
921
1154
  return styles;
922
1155
  }
1156
+ /**
1157
+ * Returns the CSS styles for the client area
1158
+ * @returns
1159
+ */
923
1160
  getClientAreaStyles() {
924
1161
  let styles = {};
925
1162
  if (this.componentRef != undefined) {
@@ -934,69 +1171,182 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
934
1171
  }
935
1172
  return styles;
936
1173
  }
1174
+ /**
1175
+ * Should the title bar be displayed
1176
+ * @returns
1177
+ */
937
1178
  getShowTitleBar() {
938
1179
  if (this.componentRef != undefined) {
939
1180
  let comp = this.componentRef.instance;
940
1181
  return comp.ShowTitleBar();
941
1182
  }
942
1183
  }
1184
+ /**
1185
+ *
1186
+ */
943
1187
  OnClose() {
944
1188
  this.onClose.emit();
945
1189
  }
1190
+ /**
1191
+ * Handles click in the background window
1192
+ */
946
1193
  OnBackgroundClick() {
947
1194
  let comp = this.componentRef.instance;
948
1195
  if (comp.ShouldCloseOnBackgroundClick())
949
1196
  this.OnClose();
950
1197
  }
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) {
1198
+ /**
1199
+ * Checks if the overlay component allows to be resized.
1200
+ * @returns {boolean} True if the overlay is resizable, false otherwise.
1201
+ */
1202
+ IsResizable() {
1203
+ let comp = this.componentRef.instance;
1204
+ return comp.IsResizable();
1205
+ }
1206
+ /**
1207
+ * Checks if the overlay component allows to be moved (dragged).
1208
+ * @returns {boolean} True if the overlay is movable, false otherwise.
1209
+ */
1210
+ IsMovable() {
1211
+ let comp = this.componentRef.instance;
1212
+ return comp.IsMovable();
1213
+ }
1214
+ /**
1215
+ * Initiates the resize process when a mousedown event occurs on a resize handle.
1216
+ * Stores the initial state (dimensions, mouse position) and sets flags.
1217
+ * @param {MouseEvent} event - The mousedown event triggering the resize.
1218
+ * @param {'right' | 'bottom' | 'corner'} direction - Indicates which resize handle was activated.
1219
+ */
1220
+ onResizeStart(event, direction) {
1221
+ this.resizing = true;
1222
+ this.resizeDirection = direction;
1223
+ const element = this.foregroundElementRef.nativeElement;
1224
+ this.originalWidth = element.offsetWidth;
1225
+ this.originalHeight = element.offsetHeight;
1226
+ this.originalMouseX = event.clientX;
1227
+ this.originalMouseY = event.clientY;
1228
+ // Removes auto margin and set left and top style
1229
+ if (this.isCenteredToWindow) {
1230
+ element.style.left = element.offsetLeft + 'px';
1231
+ element.style.top = element.offsetTop + 'px';
1232
+ element.style.margin = '';
1233
+ this.isCenteredToWindow = false;
1234
+ }
1235
+ event.preventDefault();
1236
+ event.stopPropagation();
1237
+ }
1238
+ /**
1239
+ * Handles the resizing logic as the mouse moves across the window.
1240
+ * This listener is active globally on the window during a resize operation via @HostListener.
1241
+ * Calculates and applies the new dimensions to the element based on mouse movement.
1242
+ * @param {MouseEvent} event - The mousemove event passed by the HostListener.
1243
+ */
1244
+ onResize(event) {
1245
+ if (!this.resizing)
1246
+ return;
1247
+ const element = this.foregroundElementRef.nativeElement;
1248
+ const parentElement = element.parentNode;
1249
+ const parentWidth = parentElement.offsetWidth;
1250
+ const parentHeight = parentElement.offsetHeight;
1251
+ const rect = element.getBoundingClientRect();
1252
+ const left = rect.left;
1253
+ const top = rect.top;
1254
+ // When the user extends the overlay window to its edge, it becomes hard to grab the border for resizing.
1255
+ // To improve this, 2px are subtracted from maxAllowedWidth and maxAllowedHeight, making it easier to grab the overlay's border for resizing.
1256
+ const maxAllowedWidth = parentWidth - left - 2;
1257
+ const maxAllowedHeight = parentHeight - top - 2;
1258
+ let dx = (event.clientX - this.originalMouseX);
1259
+ let dy = (event.clientY - this.originalMouseY);
1260
+ if (this.resizeDirection === 'right' || this.resizeDirection === 'corner') {
1261
+ let newWidth = this.originalWidth + dx;
1262
+ if (newWidth > maxAllowedWidth)
1263
+ newWidth = maxAllowedWidth;
1264
+ else if (newWidth < MagicOverlayContainer.minAllowedWidth)
1265
+ newWidth = MagicOverlayContainer.minAllowedWidth;
1266
+ element.style.width = `${newWidth}px`;
1267
+ }
1268
+ if (this.resizeDirection === 'bottom' || this.resizeDirection === 'corner') {
1269
+ let newHeight = this.originalHeight + dy;
1270
+ if (newHeight > maxAllowedHeight)
1271
+ newHeight = maxAllowedHeight;
1272
+ else if (newHeight < MagicOverlayContainer.minAllowedHeight)
1273
+ newHeight = MagicOverlayContainer.minAllowedHeight;
1274
+ element.style.height = `${newHeight}px`;
1275
+ }
1276
+ }
1277
+ /**
1278
+ * Finalizes the resize operation when the mouse button is released anywhere on the window.
1279
+ * Resets the resizing state flags. Triggered globally via @HostListener.
1280
+ */
1281
+ onResizeEnd() {
1282
+ this.resizing = false;
1283
+ this.resizeDirection = null;
1284
+ }
1285
+ /** @nocollapse */ static ɵfac = function MagicOverlayContainer_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainer)(); };
1286
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
953
1287
  i0.ɵɵviewQuery(_c0$3, 5);
954
1288
  i0.ɵɵviewQuery(_c1$1, 5);
955
1289
  } if (rf & 2) {
956
1290
  let _t;
957
1291
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
958
1292
  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) {
1293
+ } }, hostBindings: function MagicOverlayContainer_HostBindings(rf, ctx) { if (rf & 1) {
1294
+ 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);
1295
+ } }, 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
1296
  const _r1 = i0.ɵɵgetCurrentView();
961
- i0.ɵɵelementStart(0, "div")(1, "div", 3);
1297
+ i0.ɵɵelementStart(0, "div", 6)(1, "div", 7);
962
1298
  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);
1299
+ i0.ɵɵtemplate(2, MagicOverlayContainer_button_2_Template, 2, 0, "button", 8);
964
1300
  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);
1301
+ i0.ɵɵelementStart(3, "div", 9, 0);
1302
+ 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);
1303
+ i0.ɵɵelementStart(9, "div", 14);
1304
+ i0.ɵɵelement(10, "div", 15, 1);
969
1305
  i0.ɵɵelementEnd()()();
970
1306
  } if (rf & 2) {
971
1307
  i0.ɵɵadvance(2);
972
1308
  i0.ɵɵproperty("ngIf", !ctx.getShowTitleBar());
973
1309
  i0.ɵɵadvance();
974
- i0.ɵɵproperty("ngStyle", ctx.getStyle());
1310
+ i0.ɵɵproperty("ngStyle", ctx.getStyle())("cdkDragDisabled", !ctx.IsMovable());
975
1311
  i0.ɵɵadvance(2);
1312
+ i0.ɵɵproperty("ngIf", ctx.IsResizable());
1313
+ i0.ɵɵadvance();
1314
+ i0.ɵɵproperty("ngIf", ctx.IsResizable());
1315
+ i0.ɵɵadvance();
1316
+ i0.ɵɵproperty("ngIf", ctx.IsResizable());
1317
+ i0.ɵɵadvance();
976
1318
  i0.ɵɵproperty("ngIf", ctx.getShowTitleBar());
977
1319
  i0.ɵɵadvance();
978
1320
  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}"] });
1321
+ } }, 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
1322
  }
981
1323
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainer, [{
982
1324
  type: Component,
983
1325
  args: [{ selector: 'app-magic-overlay-container', template: `
984
- <div>
1326
+ <div class="boundary-line">
1327
+
985
1328
  <div class="modal-background" (click)="OnBackgroundClick()">
986
1329
  <button (click)="OnClose()" tabindex="-1" style="float:right; border: none; background-color: transparent; outline: none; color: white" *ngIf="!getShowTitleBar()">X</button>
987
1330
  </div>
988
- <div #modalForeground class="modal-foreground" [ngStyle]="getStyle()">
989
- <div #modalheader class="modal-header" *ngIf="getShowTitleBar()">
1331
+
1332
+ <div #modalForeground class="modal-foreground" [ngStyle]="getStyle()" cdkDragBoundary=".boundary-line" cdkDrag [cdkDragDisabled]="!IsMovable()">
1333
+
1334
+ <span #dragHandleCorner *ngIf="IsResizable()" class="dragHandle corner" (mousedown)="onResizeStart($event, 'corner')"></span>
1335
+ <span #dragHandleRight *ngIf="IsResizable()" class="dragHandle right" (mousedown)="onResizeStart($event, 'right')"></span>
1336
+ <span #dragHandleBottom *ngIf="IsResizable()" class="dragHandle bottom" (mousedown)="onResizeStart($event, 'bottom')"></span>
1337
+
1338
+ <div #modalheader class="modal-header" *ngIf="getShowTitleBar()" cdkDragHandle [class.movable]="IsMovable()">
990
1339
  {{getText()}}
991
1340
  <button (click)="OnClose()" style="float:right" tabindex="-1">X</button>
992
1341
  </div>
1342
+
993
1343
  <div [ngStyle]="getClientAreaStyles()">
994
1344
  <div #modalbody magicViewContainerRef>
995
1345
  </div>
996
1346
  </div>
997
1347
  </div>
998
1348
  </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"] }]
1349
+ `, 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
1350
  }], () => [], { headerElementRef: [{
1001
1351
  type: ViewChild,
1002
1352
  args: ['modalheader', { static: false }]
@@ -1009,33 +1359,61 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
1009
1359
  type: Input
1010
1360
  }], onClose: [{
1011
1361
  type: Output
1362
+ }], onResize: [{
1363
+ type: HostListener,
1364
+ args: ['window:mousemove', ['$event']]
1365
+ }], onResizeEnd: [{
1366
+ type: HostListener,
1367
+ args: ['window:mouseup']
1012
1368
  }] }); })();
1013
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainer, { className: "MagicOverlayContainer", filePath: "src\\ui\\magic-modal\\magic-overlay-container.ts", lineNumber: 40 }); })();
1369
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainer, { className: "MagicOverlayContainer", filePath: "src/ui/magic-modal/magic-overlay-container.ts", lineNumber: 50 }); })();
1014
1370
 
1371
+ /**
1372
+ * Service managing overlay windows
1373
+ * This is Magic's default provider
1374
+ */
1015
1375
  class OverlayContainerMagicProvider {
1016
1376
  getComponent() {
1017
1377
  return MagicOverlayContainer;
1018
1378
  }
1019
- static ɵfac = function OverlayContainerMagicProvider_Factory(t) { return new (t || OverlayContainerMagicProvider)(); };
1020
- static ɵprov = i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
1379
+ /** @nocollapse */ static ɵfac = function OverlayContainerMagicProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OverlayContainerMagicProvider)(); };
1380
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
1021
1381
  }
1022
1382
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayContainerMagicProvider, [{
1023
1383
  type: Injectable
1024
1384
  }], null, null); })();
1025
1385
 
1386
+ /**
1387
+ * This is a base class for the magic confirm components
1388
+ */
1026
1389
  class BaseMagicConfirmComponent {
1390
+ /**
1391
+ * title of the component
1392
+ */
1027
1393
  title;
1394
+ /**
1395
+ * message of the component
1396
+ */
1028
1397
  message;
1398
+ /**
1399
+ * onClose Event - to be raised when the component is closed
1400
+ * should pass true when OK is pressed and false when cancel is pressed
1401
+ */
1029
1402
  onClose = new EventEmitter();
1403
+ /**
1404
+ * raises close Event
1405
+ * @param result true when OK is pressed and false when cancel is pressed
1406
+ *
1407
+ */
1030
1408
  OnClose(result) {
1031
1409
  this.onClose.emit(result);
1032
1410
  }
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) { } });
1411
+ /** @nocollapse */ static ɵfac = function BaseMagicConfirmComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicConfirmComponent)(); };
1412
+ /** @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
1413
  }
1036
1414
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
1037
1415
  type: Component,
1038
- args: [{ selector: 'mg-base-confirm', template: '' }]
1416
+ args: [{ selector: 'mg-base-confirm', template: '', standalone: false }]
1039
1417
  }], null, { title: [{
1040
1418
  type: Input
1041
1419
  }], message: [{
@@ -1043,21 +1421,37 @@ class BaseMagicConfirmComponent {
1043
1421
  }], onClose: [{
1044
1422
  type: Output
1045
1423
  }] }); })();
1046
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src\\ui\\components\\base-magic-confirm.component.ts", lineNumber: 12 }); })();
1424
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src/ui/components/base-magic-confirm.component.ts", lineNumber: 13 }); })();
1047
1425
 
1426
+ /**
1427
+ * This is a base class for the magic alert components
1428
+ */
1048
1429
  class BaseMagicAlertComponent {
1430
+ /**
1431
+ * title of the component
1432
+ */
1049
1433
  title;
1434
+ /**
1435
+ * message of the component
1436
+ */
1050
1437
  message;
1438
+ /**
1439
+ * onClose Event - to be raised when the component is closed
1440
+
1441
+ */
1051
1442
  onClose = new EventEmitter();
1443
+ /**
1444
+ * close magic alert
1445
+ */
1052
1446
  OnClose() {
1053
1447
  this.onClose.emit();
1054
1448
  }
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) { } });
1449
+ /** @nocollapse */ static ɵfac = function BaseMagicAlertComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicAlertComponent)(); };
1450
+ /** @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
1451
  }
1058
1452
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicAlertComponent, [{
1059
1453
  type: Component,
1060
- args: [{ selector: 'mg-base-alert', template: '' }]
1454
+ args: [{ selector: 'mg-base-alert', template: '', standalone: false }]
1061
1455
  }], null, { title: [{
1062
1456
  type: Input
1063
1457
  }], message: [{
@@ -1065,8 +1459,11 @@ class BaseMagicAlertComponent {
1065
1459
  }], onClose: [{
1066
1460
  type: Output
1067
1461
  }] }); })();
1068
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicAlertComponent, { className: "BaseMagicAlertComponent", filePath: "src\\ui\\components\\base-magic-alert.component.ts", lineNumber: 13 }); })();
1462
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicAlertComponent, { className: "BaseMagicAlertComponent", filePath: "src/ui/components/base-magic-alert.component.ts", lineNumber: 14 }); })();
1069
1463
 
1464
+ /**
1465
+ * Directive for setting focus on element
1466
+ */
1070
1467
  class MagicFocusDirective {
1071
1468
  hostElement;
1072
1469
  constructor(hostElement) {
@@ -1075,13 +1472,14 @@ class MagicFocusDirective {
1075
1472
  ngAfterViewInit() {
1076
1473
  this.hostElement.nativeElement.focus();
1077
1474
  }
1078
- static ɵfac = function MagicFocusDirective_Factory(t) { return new (t || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
1079
- static ɵdir = i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]] });
1475
+ /** @nocollapse */ static ɵfac = function MagicFocusDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
1476
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]], standalone: false });
1080
1477
  }
1081
1478
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicFocusDirective, [{
1082
1479
  type: Directive,
1083
1480
  args: [{
1084
- selector: '[magicFocus]'
1481
+ selector: '[magicFocus]',
1482
+ standalone: false
1085
1483
  }]
1086
1484
  }], () => [{ type: i0.ElementRef }], null); })();
1087
1485
 
@@ -1092,17 +1490,34 @@ class MagicOverlayContainerWrapper {
1092
1490
  injector;
1093
1491
  changeDetectorRef;
1094
1492
  compiler;
1493
+ /**
1494
+ *
1495
+ */
1095
1496
  Component = null;
1497
+ /**
1498
+ *
1499
+ */
1096
1500
  Parameters = {};
1097
1501
  OverlayTypeParam;
1098
1502
  onClose = new EventEmitter();
1503
+ /**
1504
+ * HTML to be displayed in the modal window
1505
+ */
1099
1506
  overlayContentViewContainerRef;
1100
1507
  overlayContainerWrapperElementRef;
1508
+ /**
1509
+ * @ignore
1510
+ * contais data of allowed base components to use
1511
+ */
1101
1512
  static allowedBaseComps = new Map([
1102
1513
  [OverlayType.Overlay, { comp: BaseMagicOverlayContainer, error: 'BaseMagicOverlayContainer . Overlay ' }],
1103
1514
  [OverlayType.Alert, { comp: BaseMagicAlertComponent, error: 'BaseMagicAlertComponent. Alert ' }],
1104
1515
  [OverlayType.ConfirmationBox, { comp: BaseMagicConfirmComponent, error: 'BaseMagicConfirmComponent. Confirmation ' }]
1105
1516
  ]);
1517
+ /**
1518
+ *
1519
+ * @param componentFactoryResolver
1520
+ */
1106
1521
  constructor(componentListMagicService, magicLazyModuleLoader, injector, changeDetectorRef, compiler) {
1107
1522
  this.componentListMagicService = componentListMagicService;
1108
1523
  this.magicLazyModuleLoader = magicLazyModuleLoader;
@@ -1110,6 +1525,9 @@ class MagicOverlayContainerWrapper {
1110
1525
  this.changeDetectorRef = changeDetectorRef;
1111
1526
  this.compiler = compiler;
1112
1527
  }
1528
+ /**
1529
+ *
1530
+ */
1113
1531
  ngOnInit() {
1114
1532
  let moduleRef = this.componentListMagicService.getModuleRef(this.Parameters.MagicFormName);
1115
1533
  if (moduleRef == null) {
@@ -1117,6 +1535,7 @@ class MagicOverlayContainerWrapper {
1117
1535
  if (lazyLoadModule != null) {
1118
1536
  const Magic = 'Magic';
1119
1537
  const Module = 'Module';
1538
+ // extract name of module(XX) from 'MagicXXModule'
1120
1539
  const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
1121
1540
  this.magicLazyModuleLoader.Load(moduleName).then(m => {
1122
1541
  const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
@@ -1155,13 +1574,13 @@ class MagicOverlayContainerWrapper {
1155
1574
  DetectChanges() {
1156
1575
  this.changeDetectorRef.detectChanges();
1157
1576
  }
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) {
1577
+ /** @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)); };
1578
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
1160
1579
  i0.ɵɵviewQuery(_c0$2, 7);
1161
1580
  } if (rf & 2) {
1162
1581
  let _t;
1163
1582
  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) {
1583
+ } }, 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
1584
  i0.ɵɵelementStart(0, "div");
1166
1585
  i0.ɵɵelement(1, "div", 2);
1167
1586
  i0.ɵɵelementStart(2, "div", 3, 0);
@@ -1182,7 +1601,7 @@ class MagicOverlayContainerWrapper {
1182
1601
  </div>
1183
1602
  <div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" ></div>
1184
1603
  </div>
1185
- `, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
1604
+ `, standalone: false, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
1186
1605
  }], () => [{ type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i0.Compiler }], { Component: [{
1187
1606
  type: Input
1188
1607
  }], Parameters: [{
@@ -1195,11 +1614,14 @@ class MagicOverlayContainerWrapper {
1195
1614
  type: ViewChild,
1196
1615
  args: ['overlayContainerWrapper', { static: true }]
1197
1616
  }] }); })();
1198
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src\\ui\\magic-modal\\magic-overlay-container-wrapper.ts", lineNumber: 45 }); })();
1617
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src/ui/magic-modal/magic-overlay-container-wrapper.ts", lineNumber: 46 }); })();
1199
1618
 
1619
+ /***
1620
+ * This is sample component for the alert message
1621
+ */
1200
1622
  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) {
1623
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(__ngFactoryType__) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(__ngFactoryType__ || MagicAlertComponent); }; })();
1624
+ /** @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
1625
  i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1204
1626
  i0.ɵɵtext(3);
1205
1627
  i0.ɵɵelementEnd();
@@ -1226,13 +1648,16 @@ class MagicAlertComponent extends BaseMagicAlertComponent {
1226
1648
 
1227
1649
  <button (click)="OnClose()">OK</button>
1228
1650
  </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"] }]
1651
+ </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
1652
  }], null, null); })();
1231
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src\\ui\\components\\magic-alert.component.ts", lineNumber: 48 }); })();
1653
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src/ui/components/magic-alert.component.ts", lineNumber: 49 }); })();
1232
1654
 
1655
+ /***
1656
+ * This is sample component for the confirmation box
1657
+ */
1233
1658
  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) {
1659
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(__ngFactoryType__) { return (ɵMagicConfirmationBoxComponent_BaseFactory || (ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent)))(__ngFactoryType__ || MagicConfirmationBoxComponent); }; })();
1660
+ /** @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
1661
  i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1237
1662
  i0.ɵɵtext(3);
1238
1663
  i0.ɵɵelementEnd();
@@ -1265,29 +1690,56 @@ class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1265
1690
  <button (click)="OnClose(true)">OK</button>
1266
1691
  <button class="cancel" (click)="OnClose(false)">Cancel</button>
1267
1692
  </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"] }]
1693
+ </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
1694
  }], null, null); })();
1270
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src\\ui\\components\\magic-confirmation-box.component.ts", lineNumber: 54 }); })();
1695
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src/ui/components/magic-confirmation-box.component.ts", lineNumber: 55 }); })();
1271
1696
 
1697
+ /**
1698
+ * Service managing overlay windows
1699
+ * This is Magic's default provider
1700
+ */
1701
+ /**
1702
+ * Service managing alert and confirmation windows
1703
+ * This is Magic's default provider
1704
+ */
1272
1705
  class ConfirmationComponentsMagicProvider {
1706
+ /**
1707
+ * Return true when use default javascript alert and confirmation or return false to provide custom components
1708
+ * @returns true is we want to use default javascript alert and confirmation
1709
+ */
1273
1710
  showDefaultConfirmations() {
1274
1711
  return true;
1275
1712
  }
1713
+ /**
1714
+ * Returns component that will replace javascript alert. The component will be used only if showDefaultConfirmations = false
1715
+ * @returns component that will replace javascript Alert
1716
+ */
1276
1717
  getAlertComponent() {
1277
1718
  return MagicAlertComponent;
1278
1719
  }
1720
+ /**
1721
+ * Returns component that will replace javascript confirmation box. The component will be used only if showDefaultConfirmations = false
1722
+ * @returns component that will replace javascript confirmation box
1723
+ */
1279
1724
  getConfirmtionComponent() {
1280
1725
  return MagicConfirmationBoxComponent;
1281
1726
  }
1282
- static ɵfac = function ConfirmationComponentsMagicProvider_Factory(t) { return new (t || ConfirmationComponentsMagicProvider)(); };
1283
- static ɵprov = i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1727
+ /** @nocollapse */ static ɵfac = function ConfirmationComponentsMagicProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConfirmationComponentsMagicProvider)(); };
1728
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1284
1729
  }
1285
1730
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmationComponentsMagicProvider, [{
1286
1731
  type: Injectable
1287
1732
  }], null, null); })();
1288
1733
 
1734
+ /**
1735
+ * Displays a message-box
1736
+ */
1289
1737
  class confirmationBox {
1738
+ /**
1739
+ * @ignore
1740
+ */
1290
1741
  static isConfirmBox(style) {
1742
+ // button format mask is in first nibble from right
1291
1743
  let buttonMode = style & 0x0F;
1292
1744
  var isConfirm = (buttonMode === Styles.MSGBOX_BUTTON_OK_CANCEL) ||
1293
1745
  (buttonMode === Styles.MSGBOX_BUTTON_ABORT_RETRY_IGNORE) ||
@@ -1296,7 +1748,14 @@ class confirmationBox {
1296
1748
  (buttonMode === Styles.MSGBOX_BUTTON_RETRY_CANCEL);
1297
1749
  return (isConfirm);
1298
1750
  }
1751
+ /**
1752
+ * Converts the result from the HTML window to the expected result type
1753
+ * @param style Result received from HTML window
1754
+ * @param okWasPressed Was the "OK" pressed
1755
+ * @returns MessageBox result type
1756
+ */
1299
1757
  static convertToExcpectedResultBox(style, okWasPressed) {
1758
+ // button format mask is in first nibble from right
1300
1759
  let buttonMode = style & 0x0F;
1301
1760
  let retValue = Styles.MSGBOX_RESULT_OK;
1302
1761
  if (buttonMode === Styles.MSGBOX_BUTTON_OK)
@@ -1313,9 +1772,18 @@ class confirmationBox {
1313
1772
  retValue = okWasPressed ? Styles.MSGBOX_RESULT_RETRY : Styles.MSGBOX_RESULT_CANCEL;
1314
1773
  return retValue;
1315
1774
  }
1775
+ /**
1776
+ * Show a message box as an HTML window
1777
+ * @param title Title of the message box
1778
+ * @param message Message that will be display in the message box
1779
+ * @param style Style that include buttons \ Icons
1780
+ * @returns MessageBox result
1781
+ */
1316
1782
  static showConfirmationBox(title, message, style) {
1317
1783
  let okWasPressed = false;
1784
+ // check if it is confirmation box
1318
1785
  let isConfirm = this.isConfirmBox(style);
1786
+ // the title will be added to the string and we will add new line after the title
1319
1787
  let titleAndString = title + '\n' + '\n' + message;
1320
1788
  if (isConfirm)
1321
1789
  okWasPressed = confirm(titleAndString);
@@ -1323,10 +1791,14 @@ class confirmationBox {
1323
1791
  alert(titleAndString);
1324
1792
  okWasPressed = true;
1325
1793
  }
1794
+ // return the result from the user
1326
1795
  return okWasPressed;
1327
1796
  }
1328
1797
  }
1329
1798
 
1799
+ /**
1800
+ * Service managing overlay windows
1801
+ */
1330
1802
  class OverlayWindowService {
1331
1803
  componentList;
1332
1804
  engineMagicService;
@@ -1344,6 +1816,7 @@ class OverlayWindowService {
1344
1816
  this.overlayContainerMagicProvider = overlayContainerMagicProvider;
1345
1817
  this.confirmationComponentsMagicProvider = confirmationComponentsMagicProvider;
1346
1818
  }
1819
+ // The view reference of container of overlay window
1347
1820
  overlayWindowsContainerViewRef;
1348
1821
  overlayWindowFocusManager = null;
1349
1822
  changeDetectorRef = null;
@@ -1359,6 +1832,7 @@ class OverlayWindowService {
1359
1832
  if (lazyLoadModule != null) {
1360
1833
  const Magic = 'Magic';
1361
1834
  const Module = 'Module';
1835
+ // extract name of module(XX) from 'MagicXXModule'
1362
1836
  const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
1363
1837
  this.magicLazyModuleLoader.Load(moduleName).then(m => {
1364
1838
  const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
@@ -1374,6 +1848,7 @@ class OverlayWindowService {
1374
1848
  }
1375
1849
  }
1376
1850
  open(formName, taskId, taskDescription) {
1851
+ // for overlay which are lazy loaded don't find data in component-list
1377
1852
  let comp = this.componentList.lazyLoadModulesMap != null && this.componentList.lazyLoadModulesMap.hasOwnProperty(formName) ? null : this.componentList.getComponent(formName);
1378
1853
  let parameters = { taskIdParam: taskId, taskDescription: taskDescription };
1379
1854
  let componentRef = this.createModalComponent({ MagicFormName: formName, ModalComp: comp, ModalCompParameters: parameters }, this.overlayContainerMagicProvider.getComponent(), OverlayType.Overlay);
@@ -1382,21 +1857,31 @@ class OverlayWindowService {
1382
1857
  guiEvent.TaskID = taskId;
1383
1858
  this.engineMagicService.insertEvent(guiEvent);
1384
1859
  });
1860
+ //using the same changeDetectorRef from root-component
1385
1861
  this.changeDetectorRef.detectChanges();
1386
1862
  }
1387
1863
  close(commandStr) {
1864
+ // Close the overlay by removing the overlay window from its container
1388
1865
  this.overlayWindowsContainerViewRef.remove();
1389
1866
  this.overlayWindowFocusManager.popDialog();
1390
1867
  let guiEvent1 = getGuiEventObj("dispose", null, 0);
1391
1868
  guiEvent1.TaskID = commandStr;
1392
1869
  this.engineMagicService.insertEvent(guiEvent1);
1393
1870
  }
1871
+ /**
1872
+ * Open Confirmation box
1873
+ * @param title title of the box
1874
+ * @param msg message
1875
+ * @param style Magic style
1876
+ */
1394
1877
  openConfirmationBox(title, msg, style) {
1878
+ //show default confirmations
1395
1879
  if (this.confirmationComponentsMagicProvider.showDefaultConfirmations()) {
1396
1880
  let res = confirmationBox.showConfirmationBox(title, msg, style);
1397
1881
  this.finishConfirmation(style, res);
1398
1882
  }
1399
1883
  else {
1884
+ //show custom confirmations
1400
1885
  let comp = confirmationBox.isConfirmBox(style) ? this.confirmationComponentsMagicProvider.getConfirmtionComponent() : this.confirmationComponentsMagicProvider.getAlertComponent();
1401
1886
  let overlayType = confirmationBox.isConfirmBox(style) ? OverlayType.ConfirmationBox : OverlayType.Alert;
1402
1887
  let componentRef = this.createModalComponent({ title: title, message: msg }, comp, overlayType);
@@ -1407,11 +1892,21 @@ class OverlayWindowService {
1407
1892
  });
1408
1893
  }
1409
1894
  }
1895
+ /**
1896
+ * This method is called on close of the confirmation
1897
+ * @param style Magic style
1898
+ * @param result
1899
+ */
1410
1900
  finishConfirmation(style, result) {
1411
1901
  let guiEvent = getGuiEventObj("confirmationClosed", null, 0);
1412
1902
  guiEvent.keyCode = confirmationBox.convertToExcpectedResultBox(style, result);
1413
1903
  this.engineMagicService.insertEvent(guiEvent);
1414
1904
  }
1905
+ /**
1906
+ * creates a modal component. Can be used for overlay, message box or confirmation box
1907
+ * @param parameters component's parameters
1908
+ * @param component components to create
1909
+ */
1415
1910
  createModalComponent(parameters, component, overlayType) {
1416
1911
  let componentRef;
1417
1912
  let magicModalContainerParameters = {
@@ -1419,15 +1914,17 @@ class OverlayWindowService {
1419
1914
  Parameters: parameters,
1420
1915
  OverlayTypeParam: overlayType
1421
1916
  };
1917
+ // Create the UI component of modal window
1422
1918
  let viewCRef = this.overlayWindowsContainerViewRef;
1423
1919
  componentRef = viewCRef.createComponent(MagicOverlayContainerWrapper);
1920
+ // Set the data to newly created component
1424
1921
  Object.assign(componentRef.instance, magicModalContainerParameters);
1425
1922
  this.overlayWindowFocusManager.pushDialog(componentRef.instance.GetRootElement());
1426
1923
  componentRef.instance.DetectChanges();
1427
1924
  return componentRef;
1428
1925
  }
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' });
1926
+ /** @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)); };
1927
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac, providedIn: 'root' });
1431
1928
  }
1432
1929
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayWindowService, [{
1433
1930
  type: Injectable,
@@ -1555,50 +2052,135 @@ class DialogInfo {
1555
2052
  }
1556
2053
  }
1557
2054
 
2055
+ /**
2056
+ * Main service to connect the UI with the Magic WebCLient
2057
+ */
1558
2058
  class TaskMagicService {
1559
2059
  magic;
1560
2060
  overlayWindowService;
2061
+ /**
2062
+ * Service to provide table-related functionalities
2063
+ */
1561
2064
  tableService;
2065
+ /**
2066
+ * Collection of data for all controls
2067
+ */
1562
2068
  Records = new Records();
2069
+ /**
2070
+ * FormGroup collection for line mode
2071
+ */
1563
2072
  formGroups = [];
2073
+ /**
2074
+ * FormGroup for all controls in screen mode
2075
+ */
1564
2076
  ScreenModeControls;
2077
+ /**
2078
+ * @ignore
2079
+ */
1565
2080
  refreshDom = new Subject();
2081
+ /**
2082
+ * @ignore
2083
+ */
1566
2084
  subscribeRefreshDom;
2085
+ /**
2086
+ * @ignore
2087
+ */
1567
2088
  detectChanges = new Subject();
2089
+ /**
2090
+ * @ignore
2091
+ */
1568
2092
  subscribeInteractiveCommands;
2093
+ /**
2094
+ * @ignore
2095
+ */
1569
2096
  interactiveCommands = new Subject();
2097
+ /**
2098
+ * @ignore
2099
+ * This event is emitted when the selected row in a table changes.
2100
+ */
1570
2101
  OnSelectedRowChanged = new EventEmitter();
2102
+ /**
2103
+ * @ignore
2104
+ */
1571
2105
  customPropertiesSubject = new Subject();
2106
+ /**
2107
+ * @ignore
2108
+ */
1572
2109
  recordsCountChangeSubject = new Subject();
1573
2110
  mgLoadSubject = new Subject();
2111
+ /**
2112
+ * @ignore
2113
+ */
1574
2114
  template;
2115
+ /**
2116
+ * Service to provide subform-related functionalities
2117
+ */
1575
2118
  mgSubformService;
2119
+ /**
2120
+ * Service to provide the title-change functionality
2121
+ */
1576
2122
  mgTitleService;
2123
+ /**
2124
+ * Service which enables getting/setting values from/to the Magic WebClient engine
2125
+ */
1577
2126
  mgAccessorService;
1578
2127
  mgInputDateFormat;
2128
+ /**
2129
+ * @ignore
2130
+ */
1579
2131
  oldPageSize = 0;
2132
+ /**
2133
+ *
2134
+ * @param magic
2135
+ */
1580
2136
  constructor(magic, overlayWindowService) {
1581
2137
  this.magic = magic;
1582
2138
  this.overlayWindowService = overlayWindowService;
1583
2139
  this.Records.setGuiTopIndex(0);
1584
2140
  this.mgInputDateFormat = null;
1585
2141
  }
2142
+ /**
2143
+ * returns true if used is logged in
2144
+ * @returns
2145
+ */
1586
2146
  getIsLoggenIn() {
1587
2147
  return this.magic.getIsLoggedIn();
1588
2148
  }
2149
+ /**
2150
+ * Id of task to which this service refers
2151
+ */
1589
2152
  _taskId;
2153
+ /**
2154
+ * returns the task Id
2155
+ * @returns
2156
+ */
1590
2157
  get taskId() {
1591
2158
  return this._taskId;
1592
2159
  }
2160
+ /**
2161
+ * Sets the task Id
2162
+ * @param value the task id to set
2163
+ */
1593
2164
  set taskId(value) {
2165
+ // debugger;
1594
2166
  this._taskId = value;
1595
2167
  }
2168
+ /**
2169
+ * Returns the task's data in Screen mode
2170
+ * @returns
2171
+ */
1596
2172
  get ScreenControlsData() {
1597
2173
  return this.Records.list['0'];
1598
2174
  }
2175
+ /**
2176
+ * @ignore
2177
+ */
1599
2178
  settemplate(value) {
1600
2179
  this.template = value;
1601
2180
  }
2181
+ /**
2182
+ * Builds the FormControl for each and every control
2183
+ */
1602
2184
  buildScreenModeControls() {
1603
2185
  const group = new FormGroup({});
1604
2186
  for (const key in this.template) {
@@ -1610,10 +2192,21 @@ class TaskMagicService {
1610
2192
  }
1611
2193
  this.ScreenModeControls = group;
1612
2194
  }
2195
+ /**
2196
+ * Is the control a table control
2197
+ * @param id Id of the control
2198
+ * @returns
2199
+ */
1613
2200
  isTableControl(id) {
1614
2201
  return this.template[id] == '1';
1615
2202
  }
1616
2203
  getMgInputDateFormat() { return this.mgInputDateFormat; }
2204
+ /**
2205
+ * Returns the FormControl of a control
2206
+ * @param guiRowid Id of the requested row
2207
+ * @param id Id of the control
2208
+ * @returns
2209
+ */
1617
2210
  getFormControl(guiRowid, id) {
1618
2211
  let c;
1619
2212
  let group = this.isTableControl(id) ? this.formGroups[guiRowid] : this.ScreenModeControls;
@@ -1623,12 +2216,21 @@ class TaskMagicService {
1623
2216
  }
1624
2217
  return c;
1625
2218
  }
2219
+ /**
2220
+ * handle the change of text for input control inside table
2221
+ * @param guiRowId Id of the row for which the FormControls are built
2222
+ * set the new value of the formcontrol
2223
+ */
1626
2224
  setInputTextValue(controlId, guiRowid, val) {
1627
2225
  this.setValue(controlId, guiRowid, this.ConvertValToNative(controlId, 0, val));
1628
2226
  const fc = this.getFormControl(guiRowid, controlId);
1629
2227
  if (!isNullOrUndefined(val))
1630
2228
  fc.setValue(val);
1631
2229
  }
2230
+ /**
2231
+ * Build the FormControls for a table row
2232
+ * @param guiRowId Id of the row for which the FormControls are built
2233
+ */
1632
2234
  buildTableRowControls(guiRowId) {
1633
2235
  const group = new FormGroup({});
1634
2236
  for (const key in this.template) {
@@ -1640,30 +2242,58 @@ class TaskMagicService {
1640
2242
  }
1641
2243
  this.formGroups[guiRowId] = group;
1642
2244
  }
2245
+ /**
2246
+ *
2247
+ * @ignore
2248
+ */
1643
2249
  updateRecordsBeforeCurrentView(value) {
1644
2250
  this.Records.recordsBeforeCurrentView = value;
1645
2251
  }
2252
+ /**
2253
+ * @ignore
2254
+ */
1646
2255
  setIncludesFirst(value) {
1647
2256
  this.Records.includesFirst = value;
1648
2257
  }
2258
+ /**
2259
+ * @ignore
2260
+ */
1649
2261
  setIncludesLast(value) {
1650
2262
  this.Records.includesLast = value;
1651
2263
  }
2264
+ /**
2265
+ * @ignore
2266
+ */
1652
2267
  markRowAsCreated(guiRowId) {
1653
2268
  this.Records.markRowAsCreated(guiRowId);
1654
2269
  }
2270
+ /**
2271
+ * @ignore
2272
+ */
1655
2273
  markRowAsNotCreated(guiRowId) {
1656
2274
  this.Records.markRowAsNotCreated(guiRowId);
1657
2275
  }
2276
+ /**
2277
+ * @ignore
2278
+ */
1658
2279
  startRowEditing(guiRowId) {
1659
2280
  this.Records.startRowEditing(guiRowId);
1660
2281
  }
2282
+ /**
2283
+ * @ignore
2284
+ */
1661
2285
  stopRowEditing(guiRowId) {
1662
2286
  this.Records.stopRowEditing(guiRowId);
1663
2287
  }
2288
+ /**
2289
+ * @ignore
2290
+ */
1664
2291
  isRowInRowEditing(guiRowId) {
1665
2292
  return this.Records.isRowInRowEditing(guiRowId);
1666
2293
  }
2294
+ /**
2295
+ * @ignore
2296
+ */
1667
2297
  setIsEmptyDataView(isEmpty) {
1668
2298
  if (this.Records.isEmptyDataView !== isEmpty) {
1669
2299
  if (isEmpty)
@@ -1673,6 +2303,11 @@ class TaskMagicService {
1673
2303
  this.refreshView();
1674
2304
  }
1675
2305
  }
2306
+ /**
2307
+ * Initialize the service to work with the task
2308
+ * @param taskId Id of the task
2309
+ * @param taskDescription
2310
+ */
1676
2311
  initTask(taskId, taskDescription) {
1677
2312
  this.Records.createFirst();
1678
2313
  this.oldPageSize = 0;
@@ -1684,39 +2319,80 @@ class TaskMagicService {
1684
2319
  this.settemplate(taskDescription);
1685
2320
  }
1686
2321
  this.buildScreenModeControls();
2322
+ // remove previous subscriptions
1687
2323
  if (!isNullOrUndefined(this.subscribeRefreshDom))
1688
2324
  this.subscribeRefreshDom.unsubscribe();
1689
2325
  if (!isNullOrUndefined(this.subscribeInteractiveCommands))
1690
2326
  this.subscribeInteractiveCommands.unsubscribe();
1691
2327
  this.subscribeRefreshDom = this.magic.refreshDom.pipe(filter(command => command.TaskTag === this.taskId))
1692
2328
  .subscribe(command => {
2329
+ // console.log("Task " + command.TaskTag + "command " + command.CommandType);
1693
2330
  this.executeCommand(command);
1694
2331
  });
1695
2332
  this.subscribeInteractiveCommands = this.magic.interactiveCommands
1696
2333
  .pipe(filter(command => command.TaskTag === this.taskId))
1697
2334
  .subscribe(command => {
2335
+ // console.log("Task " + command.TaskTag + "command " + command.CommandType);
1698
2336
  this.executeInteractiveCommand(command);
1699
2337
  });
1700
2338
  }
2339
+ /**
2340
+ * @ignore
2341
+ */
1701
2342
  refreshView() {
1702
2343
  this.detectChanges.next('');
1703
2344
  }
2345
+ /**
2346
+ * Insert an event to the Magic WebClient event queue
2347
+ * @param guiEvent The event to insert
2348
+ */
1704
2349
  insertEvent(guiEvent) {
1705
2350
  guiEvent.TaskID = this.taskId;
1706
2351
  this.magic.insertEvent(guiEvent);
1707
2352
  }
2353
+ /**
2354
+ * @ignore
2355
+ */
1708
2356
  GetControlPictureMask(controlName) {
1709
2357
  return this.magic.GetControlPictureMask(this.taskId, controlName);
1710
2358
  }
2359
+ /**
2360
+ * @ignore
2361
+ */
2362
+ UploadFileToServer(fileContent, serverFileName) {
2363
+ return this.magic.UploadFileToServer(fileContent, serverFileName);
2364
+ }
2365
+ async DownloadFileFromServer(serverFileName) {
2366
+ return await this.magic.DownloadFileFromServer(serverFileName);
2367
+ }
2368
+ /**
2369
+ * Validates the control value, using the Magic WebClient
2370
+ * @param controlName Id of validated control
2371
+ * @param value value to be validated
2372
+ * @returns If validation fails, returns error message, else returns null
2373
+ */
1711
2374
  ValidateControlValue(controlName, value) {
1712
2375
  return this.magic.ValidateControlValue(this.taskId, controlName, value);
1713
2376
  }
2377
+ /**
2378
+ * @ignore
2379
+ */
1714
2380
  GetRangedValue(controlName, value) {
1715
2381
  return this.magic.GetRangedValue(this.taskId, controlName, value);
1716
2382
  }
2383
+ /**
2384
+ * @ignore
2385
+ */
1717
2386
  GetFldRanges(controlName) {
1718
2387
  return this.magic.GetFldRanges(this.taskId, controlName);
1719
2388
  }
2389
+ /**
2390
+ * returns the value of a property of the control
2391
+ * @param controlId Id of control
2392
+ * @param prop Property
2393
+ * @param guiRowId Row Id, if applicable
2394
+ * @returns Property value
2395
+ */
1720
2396
  getProperty(controlId, prop, guiRowId) {
1721
2397
  if (isNullOrUndefined(guiRowId))
1722
2398
  guiRowId = '0';
@@ -1730,6 +2406,9 @@ class TaskMagicService {
1730
2406
  return this.Records.list[guiRowId].getProperty(controlId, prop);
1731
2407
  }
1732
2408
  }
2409
+ /**
2410
+ * @ignore
2411
+ */
1733
2412
  getPropertyStub(ControlsProperties, controlId, prop) {
1734
2413
  ControlsProperties = ControlsProperties.ControlsProperties;
1735
2414
  if (controlId in ControlsProperties) {
@@ -1739,15 +2418,31 @@ class TaskMagicService {
1739
2418
  }
1740
2419
  return '';
1741
2420
  }
2421
+ /**
2422
+ * @ignore
2423
+ */
1742
2424
  getStyleStub(ControlsProperties, controlId, styleName) {
1743
2425
  ControlsProperties = ControlsProperties.ControlsProperties;
1744
2426
  return ControlsProperties[controlId].stylesMap.get(styleName);
1745
2427
  }
2428
+ /**
2429
+ * Return the CSS classes used for this control
2430
+ * @param controlId Id of control
2431
+ * @param guiRowId Row Id, if applicable
2432
+ * @returns String containing the classes currently defined for this control
2433
+ */
1746
2434
  getClasses(controlId, guiRowId) {
1747
2435
  if (isNullOrUndefined(guiRowId))
1748
2436
  guiRowId = '0';
1749
2437
  return this.Records.list[guiRowId].getControlMetadata(controlId).classes;
1750
2438
  }
2439
+ /**
2440
+ * Return the value of a style used for a control
2441
+ * @param controlId Id of control
2442
+ * @param styleName Name of style
2443
+ * @param guiRowId Row Id, if applicable
2444
+ * @returns value of style of the control
2445
+ */
1751
2446
  getStyle(controlId, styleName, guiRowId) {
1752
2447
  if (isNullOrUndefined(guiRowId))
1753
2448
  guiRowId = '0';
@@ -1758,21 +2453,45 @@ class TaskMagicService {
1758
2453
  return StylesMapManager.magicValueGetStyle(styleName, magicValue);
1759
2454
  }
1760
2455
  }
2456
+ /**
2457
+ * Return the value of a control
2458
+ * @param controlId Id of control
2459
+ * @param guiRowId Row Id, if applicable
2460
+ * @returns value of the control
2461
+ */
1761
2462
  getValue(controlId, guiRowId) {
1762
2463
  if (isNullOrUndefined(guiRowId))
1763
2464
  guiRowId = '0';
1764
2465
  return this.Records.list.length > +guiRowId ? this.Records.list[guiRowId].values[controlId] : '';
1765
2466
  }
2467
+ /**
2468
+ * Return the formatted value of a control
2469
+ * @param controlId Id of control
2470
+ * @param guiRowId Row Id, if applicable
2471
+ * @returns value of the control
2472
+ */
1766
2473
  getFormattedValue(controlName, val, rowId) {
1767
2474
  return this.magic.GetFormattedValue(this.taskId, controlName, val, rowId);
1768
2475
  }
2476
+ /**
2477
+ * Sets the value of a control
2478
+ * @param controlId Id of control
2479
+ * @param guiRowId Row Id, if applicable
2480
+ * @param value Value to set
2481
+ */
1769
2482
  setValue(controlId, guiRowId, value) {
1770
2483
  return this.Records.list[guiRowId].setValue(controlId, value);
1771
2484
  }
2485
+ /**
2486
+ * @ignore
2487
+ */
1772
2488
  executeInteractiveCommand(guiInteractiveCommand) {
1773
2489
  GuiInteractiveExecutor.executeInteractiveCommand(this, guiInteractiveCommand, this.overlayWindowService);
1774
2490
  this.interactiveCommands.next(guiInteractiveCommand);
1775
2491
  }
2492
+ /**
2493
+ * @ignore
2494
+ */
1776
2495
  handleSetProperty(command, isTableChild) {
1777
2496
  let controlId = command.CtrlName;
1778
2497
  let dvRowId = (command.line || 0);
@@ -1809,6 +2528,7 @@ class TaskMagicService {
1809
2528
  let controlId = command.CtrlName;
1810
2529
  let properties;
1811
2530
  let isTableChild = this.isTableControl(controlId);
2531
+ // For non-input type controls on table.
1812
2532
  if (command.obj !== null)
1813
2533
  isTableChild = isTableChild || command.obj.IsTableChild;
1814
2534
  guiRowId = this.getGuiRowId(dvRowId, isTableChild);
@@ -1871,8 +2591,10 @@ class TaskMagicService {
1871
2591
  break;
1872
2592
  case CommandType.PROP_SET_USER_PROPERTY:
1873
2593
  properties = this.Records.list[guiRowId].getControlMetadata(controlId);
2594
+ // if the property has changed, set the property and raise the subject
1874
2595
  if (properties.userProperties.get(command.Operation) !== command.obj1) {
1875
2596
  properties.userProperties.set(command.Operation, command.obj1);
2597
+ // the property name is of format <controlName>~<propertyName>
1876
2598
  this.customPropertiesSubject.next({ propertyName: controlId + '~' + command.Operation, value: command.obj1, rowId: guiRowId });
1877
2599
  }
1878
2600
  break;
@@ -1926,6 +2648,9 @@ class TaskMagicService {
1926
2648
  break;
1927
2649
  }
1928
2650
  }
2651
+ /**
2652
+ custom validator
2653
+ */
1929
2654
  customValidator(rowid, id) {
1930
2655
  return (control) => {
1931
2656
  let controlMetadata;
@@ -1939,6 +2664,13 @@ class TaskMagicService {
1939
2664
  return null;
1940
2665
  };
1941
2666
  }
2667
+ /**
2668
+ * COnvert a value from Magic format to native format
2669
+ * @param controlId Id of control
2670
+ * @param rowId Row Id, if applicable
2671
+ * @param val Value to convert
2672
+ * @returns Converted value
2673
+ */
1942
2674
  ConvertValToNative(controlId, rowId, val) {
1943
2675
  let properties;
1944
2676
  properties = this.Records.list[0].getControlMetadata(controlId);
@@ -1990,6 +2722,13 @@ class TaskMagicService {
1990
2722
  return val;
1991
2723
  }
1992
2724
  }
2725
+ /**
2726
+ * Convert a value from native to Magic format
2727
+ * @param controlId Id of control
2728
+ * @param rowId Row Id, if applicable
2729
+ * @param val Value to convert
2730
+ * @returns Converted value
2731
+ */
1993
2732
  ConvertValFromNative(controlId, rowId, val) {
1994
2733
  let properties;
1995
2734
  properties = this.Records.list[0].getControlMetadata(controlId);
@@ -2032,12 +2771,22 @@ class TaskMagicService {
2032
2771
  return val;
2033
2772
  }
2034
2773
  }
2774
+ /**
2775
+ * Handle resize and also fetch chunk of records if having an empty view.
2776
+ * @ignore
2777
+ * @param pageSize : PageSize
2778
+ * @param topGuiRowId : GuiRowId of first record in view.
2779
+ */
2035
2780
  resize(pageSize, topGuiRowId) {
2036
2781
  let guiEvent = getGuiEventObj('resize', 'table', 0);
2037
2782
  guiEvent.PageSize = pageSize;
2783
+ //As 'getRows' event also gets executed, set the guiEvent.Line parameter.
2038
2784
  guiEvent.Line = topGuiRowId;
2039
2785
  this.insertEvent(guiEvent);
2040
2786
  }
2787
+ /**
2788
+ * Fetches data for new table rows when scrolling done
2789
+ */
2041
2790
  onScrollDown() {
2042
2791
  if (!this.Records.includesLast) {
2043
2792
  let guiEvent = getGuiEventObj('getRows', '', 0);
@@ -2045,15 +2794,29 @@ class TaskMagicService {
2045
2794
  this.insertEvent(guiEvent);
2046
2795
  }
2047
2796
  }
2797
+ /**
2798
+ * Sets the new browser window title
2799
+ * @param newTitle New window title
2800
+ */
2048
2801
  setTitle(newTitle) {
2049
2802
  this.mgTitleService.setTitle(newTitle);
2050
2803
  }
2804
+ /**
2805
+ * @ignore
2806
+ */
2051
2807
  getGuiRowId(dvRowId, isTableControl) {
2052
2808
  return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
2053
2809
  }
2810
+ /**
2811
+ *
2812
+ * @ignore
2813
+ */
2054
2814
  getDvRowId(guiRowId) {
2055
2815
  return (guiRowId - this.Records.recordsBeforeCurrentView);
2056
2816
  }
2817
+ /**
2818
+ * Clean up the service when it is no longer needed
2819
+ */
2057
2820
  dispose() {
2058
2821
  this.refreshDom.complete();
2059
2822
  this.detectChanges.complete();
@@ -2063,6 +2826,14 @@ class TaskMagicService {
2063
2826
  this.customPropertiesSubject.complete();
2064
2827
  this.OnSelectedRowChanged.complete();
2065
2828
  }
2829
+ ///////////////////////////////
2830
+ //Events:
2831
+ /**
2832
+ * Handle the Combobox "change" event
2833
+ * @param event The event received from the UI
2834
+ * @param idx Id of the control raising the event
2835
+ * @param line Row Id, if applicable
2836
+ */
2066
2837
  onComboboxSelectionChanged(event, idx, line) {
2067
2838
  let guiEvent = getGuiEventObj('selectionchanged', idx, line);
2068
2839
  if (typeof (event) == 'number') {
@@ -2081,6 +2852,11 @@ class TaskMagicService {
2081
2852
  }
2082
2853
  this.insertEvent(guiEvent);
2083
2854
  }
2855
+ /**
2856
+ * Handle the Listbox "change" event
2857
+ * @param event The event received from the UI
2858
+ * @param idx Id of the control raising the event
2859
+ */
2084
2860
  onListBoxSelectionChanged(event, idx) {
2085
2861
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2086
2862
  let selectedOptions;
@@ -2096,9 +2872,15 @@ class TaskMagicService {
2096
2872
  else
2097
2873
  indexes[i] = (selectedOptions[i]).value;
2098
2874
  }
2099
- guiEvent.Value = indexes;
2875
+ guiEvent.Value = indexes; // TODO: fix
2100
2876
  this.insertEvent(guiEvent);
2101
2877
  }
2878
+ /**
2879
+ * Handle the Checkbox "change" event
2880
+ * @param event The event received from the UI
2881
+ * @param idx Id of the control raising the event
2882
+ * @param rowId Row Id, if applicable
2883
+ */
2102
2884
  onCheckChanged(event, idx, rowId) {
2103
2885
  if (typeof rowId === 'undefined')
2104
2886
  rowId = 0;
@@ -2107,12 +2889,12 @@ class TaskMagicService {
2107
2889
  guiEvent.Value = event;
2108
2890
  }
2109
2891
  else if (typeof (event) == 'string') {
2110
- if (event == "unchecked") {
2892
+ if (event == "unchecked") { // @ts-ignore
2111
2893
  guiEvent.Value = false;
2112
2894
  }
2113
2895
  else if (event == 'indeterminate')
2114
2896
  guiEvent.Value = null;
2115
- else if (event == 'checked') {
2897
+ else if (event == 'checked') { // @ts-ignore
2116
2898
  guiEvent.Value = true;
2117
2899
  }
2118
2900
  }
@@ -2124,11 +2906,21 @@ class TaskMagicService {
2124
2906
  }
2125
2907
  this.insertEvent(guiEvent);
2126
2908
  }
2909
+ /**
2910
+ * Handle tab selection change, caused by UI events
2911
+ * @param idx Id of the control raising the event
2912
+ * @param layer Id of selected tabpage
2913
+ */
2127
2914
  mgOnTabSelectionChanged(idx, layer) {
2128
2915
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2129
2916
  guiEvent.Value = layer.toString();
2130
2917
  this.insertEvent(guiEvent);
2131
2918
  }
2919
+ /**
2920
+ * Handle the Radio button "change" event
2921
+ * @param event The event received from the UI
2922
+ * @param idx Id of the control raising the event
2923
+ */
2132
2924
  mgOnRadioSelectionChanged(idx) {
2133
2925
  let result = this.getFormControl('0', idx);
2134
2926
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
@@ -2138,16 +2930,34 @@ class TaskMagicService {
2138
2930
  guiEvent.Value = result.value.toString();
2139
2931
  this.insertEvent(guiEvent);
2140
2932
  }
2933
+ /**
2934
+ * Inserts the "close" event to the magic WebClient event queue
2935
+ */
2141
2936
  close() {
2142
2937
  this.insertEvent(getGuiEventObj('close', null, 0));
2143
2938
  }
2939
+ ///////////////////////////////
2940
+ /**
2941
+ * @ignore
2942
+ */
2144
2943
  IsStub() {
2145
2944
  return this.magic.isStub;
2146
2945
  }
2946
+ //////////////////////////////////////////////////////////////
2947
+ ///Stub handling
2948
+ /**
2949
+ * @ignore
2950
+ */
2147
2951
  jsonData;
2952
+ /**
2953
+ * @ignore
2954
+ */
2148
2955
  saveData(data) {
2149
2956
  this.magic.saveData(data);
2150
2957
  }
2958
+ /**
2959
+ * @ignore
2960
+ */
2151
2961
  createData() {
2152
2962
  let myData = {
2153
2963
  records: this.Records,
@@ -2159,6 +2969,9 @@ class TaskMagicService {
2159
2969
  console.log(text);
2160
2970
  this.saveData(text);
2161
2971
  }
2972
+ /**
2973
+ * @ignore
2974
+ */
2162
2975
  loadStubData(stubData) {
2163
2976
  this.Records = stubData.records;
2164
2977
  this.settemplate(stubData.template);
@@ -2166,9 +2979,15 @@ class TaskMagicService {
2166
2979
  for (let i = 0; i < this.Records.list.length; i++)
2167
2980
  this.buildTableRowControls(i);
2168
2981
  }
2982
+ /**
2983
+ * @ignore
2984
+ */
2169
2985
  loadData() {
2170
2986
  alert('Please, overwrite method loadData');
2171
2987
  }
2988
+ /**
2989
+ * @ignore
2990
+ */
2172
2991
  setStubValue(guiRowId, fc, name) {
2173
2992
  if (this.IsStub()) {
2174
2993
  try {
@@ -2179,45 +2998,79 @@ class TaskMagicService {
2179
2998
  }
2180
2999
  }
2181
3000
  }
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 });
3001
+ /** @nocollapse */ static ɵfac = function TaskMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TaskMagicService)(i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayWindowService)); };
3002
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
2184
3003
  }
2185
3004
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskMagicService, [{
2186
3005
  type: Injectable
2187
3006
  }], () => [{ type: EngineMagicService }, { type: OverlayWindowService }], null); })();
2188
3007
 
3008
+ /**
3009
+ * Implements various table-related functionalities
3010
+ */
2189
3011
  class TableMagicService {
2190
3012
  componentList;
2191
3013
  task;
2192
3014
  selectedItem;
2193
3015
  chunkSize;
3016
+ /**
3017
+ *
3018
+ * @param componentList Component-mapping service
3019
+ * @param task Magic task service
3020
+ */
2194
3021
  constructor(componentList, task) {
2195
3022
  this.componentList = componentList;
2196
3023
  this.task = task;
2197
3024
  }
2198
3025
  shouldOpenFieldTextEditor = true;
3026
+ /**
3027
+ * Refreshes the DataSource
3028
+ */
2199
3029
  refreshDataSource() {
2200
3030
  }
3031
+ /**
3032
+ * Returns the table page size
3033
+ * chunkSize as default value for non-paginated tables.
3034
+ */
2201
3035
  getPageSize() {
2202
3036
  return this.chunkSize;
2203
3037
  }
2204
3038
  setChunkSize(size) {
2205
3039
  this.chunkSize = size;
2206
3040
  }
3041
+ /**
3042
+ * Returns max no of rows in the table.
3043
+ */
2207
3044
  getMaxRowsInTable() {
2208
3045
  return this.task.Records.list.length;
2209
3046
  }
3047
+ /**
3048
+ * Selects the specified row
3049
+ * @param rowId The row to select
3050
+ */
2210
3051
  selectRow(rowId) {
2211
3052
  this.selectedItem = rowId;
2212
3053
  }
2213
3054
  getSelectedRow() {
2214
3055
  return this.selectedItem;
2215
3056
  }
3057
+ /**
3058
+ * Returns the selected row
3059
+ */
2216
3060
  selectedRow() {
2217
3061
  return null;
2218
3062
  }
3063
+ /**
3064
+ * Selects the specified page
3065
+ * @param pageId The page to select
3066
+ */
2219
3067
  selectPage(pageId) {
2220
3068
  }
3069
+ /**
3070
+ * Returns whether a dialog should be opened for the HTML element
3071
+ * @param element The HTML element for which a dialog may be needed
3072
+ * @returns
3073
+ */
2221
3074
  OpenDialogForControl(element) {
2222
3075
  if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
2223
3076
  element.tagName === "INPUT" ||
@@ -2225,17 +3078,34 @@ class TableMagicService {
2225
3078
  return false;
2226
3079
  return true;
2227
3080
  }
3081
+ /**
3082
+ * Returns the dialog used to edit values
3083
+ */
2228
3084
  getDialog() {
2229
3085
  return null;
2230
3086
  }
3087
+ /**
3088
+ * Handles the table "scrolled" event
3089
+ */
2231
3090
  onScrollDown() {
2232
3091
  this.task.onScrollDown();
2233
3092
  }
3093
+ /**
3094
+ * To be overwitten in specific implelemtations
3095
+ */
2234
3096
  sortData(e) { }
3097
+ /**
3098
+ * To be overwitten in specific implelemtations
3099
+ */
2235
3100
  mgOnPaginateChange(e, changeSelectedRow) { }
2236
3101
  mgOptionChanged(e) { }
3102
+ /**
3103
+ * Change the number of lines in a table
3104
+ * @param size New number of lines in table
3105
+ */
2237
3106
  updateTableSize(size) {
2238
- if (size === 0) {
3107
+ if (size === 0) // never remove row 0 for now
3108
+ {
2239
3109
  size = 1;
2240
3110
  this.task.Records.clearFirstTableRecord(this.task.template);
2241
3111
  }
@@ -2243,34 +3113,51 @@ class TableMagicService {
2243
3113
  this.task.Records.updateSize(size);
2244
3114
  this.task.setIncludesFirst(false);
2245
3115
  }
3116
+ /**
3117
+ * @ignore
3118
+ */
2246
3119
  setTableTopIndex(value) {
2247
3120
  if (!this.task.Records.includesFirst)
2248
3121
  value++;
2249
3122
  this.task.Records.setGuiTopIndex(value);
2250
3123
  }
3124
+ /**
3125
+ * @ignore
3126
+ */
2251
3127
  getTableTopIndex() {
2252
3128
  let topIndex = this.task.Records.getGuiTopIndex();
2253
3129
  if (!this.task.Records.includesFirst)
2254
3130
  topIndex--;
2255
3131
  return topIndex;
2256
3132
  }
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 });
3133
+ /** @nocollapse */ static ɵfac = function TableMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TableMagicService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(TaskMagicService)); };
3134
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
2259
3135
  }
2260
3136
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableMagicService, [{
2261
3137
  type: Injectable
2262
3138
  }], () => [{ type: ComponentListMagicService }, { type: TaskMagicService }], null); })();
2263
3139
 
3140
+ /**
3141
+ * Enables changing the browser title using Magic expression (SetTitle)
3142
+ */
2264
3143
  class TitleMagicService {
2265
3144
  titleService;
3145
+ /**
3146
+ *
3147
+ * @param titleService Angular's title-changing class
3148
+ */
2266
3149
  constructor(titleService) {
2267
3150
  this.titleService = titleService;
2268
3151
  }
3152
+ /**
3153
+ * Set the new title of the window
3154
+ * @param newTitle New title of the window
3155
+ */
2269
3156
  setTitle(newTitle) {
2270
3157
  this.titleService.setTitle(newTitle);
2271
3158
  }
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 });
3159
+ /** @nocollapse */ static ɵfac = function TitleMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TitleMagicService)(i0.ɵɵinject(i1$1.Title)); };
3160
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
2274
3161
  }
2275
3162
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TitleMagicService, [{
2276
3163
  type: Injectable
@@ -2294,6 +3181,7 @@ class MagicColorService {
2294
3181
  }
2295
3182
  colorsData;
2296
3183
  fileNotFound = false;
3184
+ // public static FILE_NAME;
2297
3185
  constructor(http, colorFile1 = 'clr_rnt.eng') {
2298
3186
  this.http = http;
2299
3187
  if (colorFile1)
@@ -2313,6 +3201,7 @@ class MagicColorService {
2313
3201
  }
2314
3202
  hexToRgba(hex, isTransperent) {
2315
3203
  let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i;
3204
+ // convert it to format : aarrggbb
2316
3205
  hex = hex.replace(shorthandRegex, function (m, r, g, b, a) {
2317
3206
  return a + a + r + r + g + g + b + b;
2318
3207
  });
@@ -2327,16 +3216,24 @@ class MagicColorService {
2327
3216
  rgb.alpha = 0;
2328
3217
  return 'rgba(' + rgb.red + ',' + rgb.green + ',' + rgb.blue + ',' + rgb.alpha + ')';
2329
3218
  }
3219
+ /**
3220
+ * Returns the rgba value of specified color
3221
+ * @returns : value in format rgba(128,128,128,1)
3222
+ * @param : colorNumber -0 based index of color for which RGBA values are returned
3223
+ * @param: colorType : 1-MAGIC_FG_COLOR, 2-MAGIC_BG_COLOR
3224
+ */
2330
3225
  getColor(colorIndex, colorType) {
2331
3226
  let isTransperent = false;
2332
3227
  if (!this.colorsData && !this.fileNotFound)
2333
3228
  this.getColorData();
2334
- if (this.colorsData) {
3229
+ if (this.colorsData) { // color exists
2335
3230
  if (this.colorsData[colorIndex - 1]) {
2336
3231
  const grayHashCode = '00808080';
2337
3232
  let hex = grayHashCode;
2338
- let color = this.colorsData[colorIndex - 1].split(',');
3233
+ let color = this.colorsData[colorIndex - 1].split(','); // get the color details
2339
3234
  let colorAtrributes = +color[3];
3235
+ // color[0] - name, color[1] - FG color, color[2] - BG color
3236
+ // color[3] - attr flags (1 - transperent, 2 - system FG, 4 - system bg)
2340
3237
  switch (colorType) {
2341
3238
  case MAGIC_FG_COLOR:
2342
3239
  if (colorAtrributes != SYSTEM_FG && colorAtrributes != SYSTEM_FG_AND_SYSTEM_BG)
@@ -2360,8 +3257,8 @@ class MagicColorService {
2360
3257
  }
2361
3258
  return '';
2362
3259
  }
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' });
3260
+ /** @nocollapse */ static ɵfac = function MagicColorService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicColorService)(i0.ɵɵinject(i1$2.HttpClient), i0.ɵɵinject(COLOR_FILE_NAME)); };
3261
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicColorService, factory: MagicColorService.ɵfac, providedIn: 'root' });
2365
3262
  }
2366
3263
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicColorService, [{
2367
3264
  type: Injectable,
@@ -2373,17 +3270,35 @@ class MagicColorService {
2373
3270
  args: [COLOR_FILE_NAME]
2374
3271
  }] }], null); })();
2375
3272
 
3273
+ /**
3274
+ * Provides the UI with values calculated by the Magic WebClient
3275
+ */
2376
3276
  class AccessorMagicService {
2377
3277
  task;
2378
3278
  magicColor;
2379
3279
  Logger = null;
2380
3280
  hhmm = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
2381
3281
  hhmmss = maskitoTimeOptionsGenerator({ mode: 'HH:MM:SS' });
3282
+ /**
3283
+ * @ignore
3284
+ */
2382
3285
  constructor(task, magicColor) {
2383
3286
  this.task = task;
2384
3287
  this.magicColor = magicColor;
2385
3288
  this.Logger = Logger.Instance;
2386
3289
  }
3290
+ UploadFileToServer(fileContent, serverFileName) {
3291
+ return this.task.UploadFileToServer(fileContent, serverFileName);
3292
+ }
3293
+ async DownloadFileFromServer(serverFileName) {
3294
+ return await this.task.DownloadFileFromServer(serverFileName);
3295
+ }
3296
+ /**
3297
+ * Checks if the control is read-only
3298
+ * @param controlId Id of control
3299
+ * @returns Is the control not read-only
3300
+ */
3301
+ // CheckReadOnly
2387
3302
  checkIsReadOnly(controlId) {
2388
3303
  let properties;
2389
3304
  properties = this.task.Records.list[0].getControlMetadata(controlId);
@@ -2392,34 +3307,91 @@ class AccessorMagicService {
2392
3307
  else
2393
3308
  return false;
2394
3309
  }
3310
+ /**
3311
+ * Returns the text of the control
3312
+ * @param controlId Id of control
3313
+ * @param rowId Id of row, if applicable
3314
+ * @returns The text of the control
3315
+ */
3316
+ // mgGetText
2395
3317
  getText(controlId, rowId) {
2396
3318
  return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
2397
3319
  }
3320
+ /**
3321
+ * Gets the text of the tab page
3322
+ * @param controlId Id of control
3323
+ * @param layer Id of tabpage
3324
+ * @returns Text of tabpage
3325
+ */
3326
+ // mgGetTabpageText
2398
3327
  getTabpageText(controlId, layer) {
2399
3328
  const items = this.task.getProperty(controlId, HtmlProperties.ItemsList);
2400
3329
  if (typeof items !== "undefined")
2401
3330
  return items[layer].displayValue;
2402
3331
  return "";
2403
3332
  }
3333
+ /**
3334
+ * Gets the image defined for the control
3335
+ * @param controlId Id of control
3336
+ * @param rowId Id of row, if applicable
3337
+ * @returns Image set on control
3338
+ */
3339
+ // mgGetImage
2404
3340
  getImage(controlId, rowId) {
2405
3341
  let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2406
3342
  return result;
2407
3343
  }
3344
+ /**
3345
+ * Returns whether an image is set for this control
3346
+ * @param controlId Id of control
3347
+ * @param rowId Id of row, if applicable
3348
+ * @returns returns true if control has an image set on it
3349
+ */
3350
+ // mgIsImageExists
2408
3351
  isImageExists(controlId, rowId) {
2409
3352
  let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2410
3353
  return !isNullOrUndefined(result);
2411
3354
  }
3355
+ /**
3356
+ * Gets the CSS classes set on the control
3357
+ * @param controlId Id of control
3358
+ * @param rowId Id of row, if applicable
3359
+ * @returns The classes for this control
3360
+ */
3361
+ // mgGetClasses
2412
3362
  getClasses(controlId, rowId) {
2413
3363
  return this.task.getClasses(controlId, rowId);
2414
3364
  }
3365
+ /**
3366
+ * Gets the CSS styles set on the control
3367
+ * @param controlId Id of control
3368
+ * @param styleName NAme of style requested
3369
+ * @param rowId Id of row, if applicable
3370
+ * @returns The style set on the control
3371
+ */
3372
+ // mgGetStyle
2415
3373
  getStyle(controlId, styleName, rowId) {
2416
3374
  let style = this.task.getStyle(controlId, styleName, rowId);
2417
3375
  return style;
2418
3376
  }
3377
+ /**
3378
+ * Returns whether a control is visible or not
3379
+ * @param controlId Id of control
3380
+ * @param rowId Id of row, if applicable
3381
+ * @returns Is the control visible or hidden
3382
+ */
3383
+ // mgGetVisible
2419
3384
  getVisible(controlId, rowId) {
2420
3385
  let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
2421
3386
  return vis ? 'visible' : 'hidden';
2422
3387
  }
3388
+ /**
3389
+ * Returns alpha mask of a control
3390
+ * @param controlId Id of control
3391
+ * @param rowId Id of row, if applicable
3392
+ * @returns alpha mask of the control
3393
+ */
3394
+ // getAlphaMask
2423
3395
  getAlphaMask(controlId, rowId) {
2424
3396
  if (isNullOrUndefined(controlId))
2425
3397
  return null;
@@ -2443,6 +3415,12 @@ class AccessorMagicService {
2443
3415
  }
2444
3416
  return (pic != null) ? valueStr.toString() : null;
2445
3417
  }
3418
+ /**
3419
+ * Returns object representing numeric picture
3420
+ * @param picture string which is defined in magic
3421
+ * @returns object representing numeric picture
3422
+ */
3423
+ // mgGetNumericPicture
2446
3424
  getNumericPicture(picture) {
2447
3425
  var obj = {};
2448
3426
  if (isNullOrUndefined(picture))
@@ -2475,51 +3453,140 @@ class AccessorMagicService {
2475
3453
  obj['wholes'] = pic.getWholes();
2476
3454
  return obj;
2477
3455
  }
3456
+ /**
3457
+ * Returns whether a control should have the "required" attribute set on it
3458
+ * @param controlId Id of control
3459
+ * @param rowId Id of row, if applicable
3460
+ * @returns
3461
+ */
3462
+ // mgGetMustInput
2478
3463
  getMustInput(controlId, rowId) {
2479
3464
  let vis = this.getProperty(controlId, HtmlProperties.MustInput, rowId);
2480
3465
  return vis ? 'true' : 'false';
2481
3466
  }
3467
+ /**
3468
+ * Returns whether a control is disabled
3469
+ * @param controlId Id of control
3470
+ * @param rowId Id of row, if applicable
3471
+ * @returns
3472
+ */
3473
+ // mgIsDisabled
2482
3474
  isDisabled(controlId, rowId) {
2483
3475
  let result = this.getProperty(controlId, HtmlProperties.Enabled, rowId);
2484
3476
  return result === true ? null : true;
2485
3477
  }
3478
+ /**
3479
+ * @ignore
3480
+ */
3481
+ // getProperty (not changed)
2486
3482
  getProperty(controlId, prop, rowId) {
2487
3483
  return this.task.getProperty(controlId, prop, rowId);
2488
3484
  }
3485
+ /**
3486
+ * Returns the title (tooltip) text of the control
3487
+ * @param controlId Id of control
3488
+ * @param rowId Id of row, if applicable
3489
+ * @returns
3490
+ */
3491
+ // mgGetTitle
2489
3492
  getTitle(controlId, rowId) {
2490
3493
  return this.task.getProperty(controlId, HtmlProperties.Tooltip, rowId);
2491
3494
  }
3495
+ /**
3496
+ * Returns the title (tooltip) text of the control
3497
+ * @param controlId Id of control
3498
+ * @param rowId Id of row, if applicable
3499
+ * @returns
3500
+ */
3501
+ // mgGetTitle for zoom button
2492
3502
  getZoomButtonTitle(controlId, rowId) {
2493
3503
  return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
2494
3504
  }
3505
+ /**
3506
+ * Gets the selection control's selected value
3507
+ * @param controlId Id of control
3508
+ * @param rowId Id of row, if applicable
3509
+ * @returns
3510
+ */
3511
+ // getSelectedValue
2495
3512
  getSelectedValue(controlId, rowId) {
2496
3513
  return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
2497
3514
  }
3515
+ /**
3516
+ * Gets the place-holder text of the control
3517
+ * @param controlId Id of control
3518
+ * @param rowId Id of row, if applicable
3519
+ * @returns
3520
+ */
3521
+ // mgGetPlaceholder
2498
3522
  getPlaceholder(controlId, rowId) {
2499
3523
  return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
2500
3524
  }
3525
+ /**
3526
+ * Returns a type for input controls - should the control be a simple text or a password control
3527
+ * @param controlId Id of control
3528
+ * @param rowId Id of row, if applicable
3529
+ * @returns
3530
+ */
3531
+ // mgGetType
2501
3532
  getType(controlId, rowId) {
2502
3533
  let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
2503
3534
  return result ? "password" : "text";
2504
3535
  }
3536
+ /**
3537
+ * Returns the tab-index of the control
3538
+ * @param controlId Id of control
3539
+ * @param rowId Id of row, if applicable
3540
+ * @returns
3541
+ */
3542
+ // mgGetTabIndex
2505
3543
  getTabIndex(controlId, rowId) {
2506
3544
  return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
2507
3545
  }
3546
+ /**
3547
+ * Returns the value of the control
3548
+ * @param controlId Id of control
3549
+ * @param rowId Id of row, if applicable
3550
+ * @returns
3551
+ */
3552
+ /// mgGetValue -->
2508
3553
  getValue(controlId, rowId) {
2509
3554
  let val = this.task.getValue(controlId, rowId);
2510
3555
  return val;
2511
3556
  }
3557
+ /**
3558
+ * Returns the formatted value of the control
3559
+ * @param controlId Id of control
3560
+ * @param rowId Id of row, if applicable
3561
+ * @returns
3562
+ */
3563
+ /// mgGetValue -->
2512
3564
  getFormattedValue(controlId, rowId) {
2513
3565
  let val = this.task.getValue(controlId, rowId);
2514
3566
  val = this.task.getFormattedValue(controlId, val, rowId);
2515
3567
  return val;
2516
3568
  }
3569
+ /**
3570
+ * Returns the Picture of the control
3571
+ * @param controlId Id of control
3572
+ * @param rowId Id of row, if applicable
3573
+ * @returns
3574
+ */
3575
+ /// getPicture -->
2517
3576
  getPicture(controlId, rowId) {
2518
3577
  if (isNullOrUndefined(controlId))
2519
3578
  return null;
2520
3579
  let pic = this.task.GetControlPictureMask(controlId);
2521
3580
  return (pic != null) ? pic.getFormat().toString() : null;
2522
3581
  }
3582
+ /**
3583
+ * Returns the custom (user) properties of the control
3584
+ * @param controlId Id of control
3585
+ * @param propertyName Name of requested property
3586
+ * @param rowId Id of row, if applicable
3587
+ * @returns
3588
+ */
3589
+ // mgGetCustomProperty
2523
3590
  getCustomProperty(controlId, propertyNameOrRowID, rowId) {
2524
3591
  if (controlId.indexOf('~') == -1)
2525
3592
  return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
@@ -2544,9 +3611,22 @@ class AccessorMagicService {
2544
3611
  }
2545
3612
  return userProperties;
2546
3613
  }
3614
+ /**
3615
+ * Gets the values of the items of a selection control
3616
+ * @param id Id of control
3617
+ * @param rowId Id of row, if applicable
3618
+ * @returns
3619
+ */
3620
+ // mgGetItemListValues
2547
3621
  getItemListValues(id, rowId) {
2548
3622
  return this.getProperty(id, HtmlProperties.ItemsList, rowId);
2549
3623
  }
3624
+ /**
3625
+ * Gets the filtered items list based on the current value of the control
3626
+ * @param controlId Id of control
3627
+ * @param rowId Id of row, if applicable
3628
+ * @returns
3629
+ */
2550
3630
  getFilteredList(controlId, rowId) {
2551
3631
  if (isNullOrUndefined(rowId))
2552
3632
  rowId = '0';
@@ -2559,6 +3639,12 @@ class AccessorMagicService {
2559
3639
  else
2560
3640
  return items;
2561
3641
  }
3642
+ /**
3643
+ * Gets the display value of the item from items of a selection control
3644
+ * @param id Id of control
3645
+ * @param rowId Id of row, if applicable
3646
+ * @returns
3647
+ */
2562
3648
  getDisplayValue(id, rowId) {
2563
3649
  let displayValue = "";
2564
3650
  let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
@@ -2567,6 +3653,12 @@ class AccessorMagicService {
2567
3653
  displayValue = o[value].displayValue;
2568
3654
  return displayValue;
2569
3655
  }
3656
+ /**
3657
+ * Returns whether a tab page is selected or not
3658
+ * @param index of current option in iterarotr
3659
+ * @param control Id of list control
3660
+ * @returns
3661
+ */ // isOptionSelected
2570
3662
  isOptionSelected(index, controlId) {
2571
3663
  let val = this.task.getValue(controlId, "0");
2572
3664
  for (let item of val) {
@@ -2575,18 +3667,40 @@ class AccessorMagicService {
2575
3667
  }
2576
3668
  return false;
2577
3669
  }
3670
+ /**
3671
+ * Returns whether a tab page is selected or not - used for the tab buttons
3672
+ * @param controlId Id of control
3673
+ * @param layer Id of the tab page
3674
+ * @returns
3675
+ */ // mgIsTabPageSelected
2578
3676
  isTabPageSelected(controlId, layer) {
2579
3677
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
2580
- return val == (layer - 1);
2581
- }
3678
+ return val == (layer - 1); // comparing string to number!
3679
+ }
3680
+ /**
3681
+ * Returns whether a tab page layer is selected or not - used for the div which represents the tab page
3682
+ * @param controlId Id of control
3683
+ * @param layer Id of the tab page
3684
+ * @returns
3685
+ */ // mgIsTabLayerSelected
2582
3686
  isTabPageLayerSelected(controlId, layer) {
2583
3687
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
2584
- return val == (layer - 1);
3688
+ return val == (layer - 1); // comparing string to number!
2585
3689
  }
3690
+ /**
3691
+ * Returns the index of the selected tab page
3692
+ * @param controlId Id of control
3693
+ * @returns
3694
+ */
2586
3695
  getTabSelectedIndex(controlId) {
2587
3696
  let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
2588
- return val;
3697
+ return val; // comparing string to number!
2589
3698
  }
3699
+ // private methodes
3700
+ /**
3701
+ * @ignore
3702
+ */
3703
+ // mgIfRowCreated
2590
3704
  ifRowCreated(row) {
2591
3705
  if (row == null)
2592
3706
  return false;
@@ -2594,59 +3708,83 @@ class AccessorMagicService {
2594
3708
  let result = this.getFormGroupByRow(rowId);
2595
3709
  return !isNullOrUndefined(result);
2596
3710
  }
3711
+ /**
3712
+ * @ignore
3713
+ */
3714
+ // mgGetFormGroupByRow
2597
3715
  getFormGroupByRow(id) {
2598
3716
  return this.task.formGroups[id];
2599
3717
  }
3718
+ /**
3719
+ * @ignore
3720
+ */
3721
+ // isRowSelected (not changed)
2600
3722
  isRowSelected(controlId, rowId) {
2601
3723
  const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
2602
3724
  return selectedRow == rowId;
2603
3725
  }
3726
+ /**
3727
+ * Returns whether a row is in edit state
3728
+ * @param row
3729
+ */
2604
3730
  isRowInRowEditing(row) {
2605
3731
  let guiRowId = '0';
2606
3732
  guiRowId = typeof row == "number" ? row.toString() : row.rowId;
2607
3733
  return this.task.isRowInRowEditing(guiRowId);
2608
3734
  }
3735
+ /**
3736
+ * Returns whether a row is in edit state, use this method while control outside table control
3737
+ * @param row
3738
+ */
2609
3739
  isCurrentInRowEditing() {
2610
3740
  let row = this.task.tableService.getSelectedRow();
2611
3741
  return this.task.isRowInRowEditing(row);
2612
3742
  }
3743
+ /**
3744
+ * @ignore
3745
+ */
3746
+ // GetGuiTopIndex
2613
3747
  guiTopIndex() {
2614
3748
  return this.task.tableService.getTableTopIndex();
2615
3749
  }
3750
+ /**
3751
+ * @ignore
3752
+ */
2616
3753
  getErrMsg(id, rowId) {
2617
3754
  let c = this.task.getFormControl(rowId, id);
2618
3755
  if (c.hasError('required'))
2619
- return 'Control must be updated.';
3756
+ return Events.GetMessageString(MsgInterface.RT_STR_FLD_MUST_UPDATED);
2620
3757
  if (c.hasError('pattern')) {
3758
+ //To check whether the numeric field allowed only positive values or not.
2621
3759
  if (c.errors.pattern.actualValue < 0 && !c.errors.pattern.requiredPattern.includes('-'))
2622
- return 'Value must be non-negative';
3760
+ return Events.GetMessageString(MsgInterface.STR_ERR_NEGETIVE);
2623
3761
  if (c.errors.pattern.requiredPattern.includes('.')) {
2624
3762
  const numericFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[0];
2625
3763
  const decimalFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[1];
2626
3764
  const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2627
3765
  const actualDecimalLimit = c.errors.pattern.requiredPattern.match(/(?:[^,]+,){2}(\d+)/)[1];
2628
3766
  if (numericFormat.length > actualNumericLimit || decimalFormat.length > actualDecimalLimit) {
2629
- return "Numeric format is limited to " + actualNumericLimit + "." + actualDecimalLimit + " digits";
3767
+ return this.getNumericFormatErrorString(actualNumericLimit, actualDecimalLimit);
2630
3768
  }
2631
3769
  }
2632
3770
  else if (!c.errors.pattern.requiredPattern.includes('.') && !Number.isInteger(c.errors.pattern.actualValue)) {
2633
3771
  const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2634
- return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
3772
+ return this.getNumericFormatErrorString(actualNumericLimit, 0);
2635
3773
  }
2636
3774
  else {
2637
3775
  const numericFormat = Math.abs(c.errors.pattern.actualValue).toString();
2638
3776
  const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2639
3777
  if (numericFormat.length > actualNumericLimit) {
2640
- return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
3778
+ return this.getNumericFormatErrorString(actualNumericLimit, 0);
2641
3779
  }
2642
3780
  }
2643
3781
  }
2644
3782
  if (c.hasError('rangevalidator'))
2645
3783
  return c.errors.rangevalidator.errorMsg;
2646
3784
  if (c.hasError('maxlength'))
2647
- return 'Max length allowed is : ' + c.errors.maxlength.requiredLength;
3785
+ return Events.GetMessageString(MsgInterface.STR_ERR_MAX_ALLOWED_LENGTH) + c.errors.maxlength.requiredLength;
2648
3786
  if (c.hasError('max'))
2649
- return 'Max value allowed is : ' + c.errors.max.max;
3787
+ return Events.GetMessageString(MsgInterface.STR_ERR_MAX_ALLOWED_VALUE) + c.errors.max.max;
2650
3788
  let controlMetadata = this.task.Records.list[rowId].getControlMetadata(id);
2651
3789
  for (let key of controlMetadata.customValidators.keys()) {
2652
3790
  if (c.hasError(key)) {
@@ -2656,6 +3794,19 @@ class AccessorMagicService {
2656
3794
  }
2657
3795
  return 'unknown error';
2658
3796
  }
3797
+ getNumericFormatErrorString(wholeLimit, decimalLimit) {
3798
+ let token = "%d";
3799
+ let messageString = Events.GetMessageString(MsgInterface.EDT_ERR_STR_1);
3800
+ messageString = StrUtil.replaceStringTokens(messageString, token, 1, wholeLimit.toString());
3801
+ messageString = StrUtil.replaceStringTokens(messageString, token, 1, decimalLimit.toString());
3802
+ return messageString;
3803
+ }
3804
+ /**
3805
+ * Sets a user-supplied value to the specified control
3806
+ * @param controlName
3807
+ * @param value
3808
+ * @param refreshDisplay
3809
+ */
2659
3810
  setValueToControl(controlName, value, refreshDisplay) {
2660
3811
  if (typeof refreshDisplay === "undefined")
2661
3812
  refreshDisplay = true;
@@ -2664,28 +3815,44 @@ class AccessorMagicService {
2664
3815
  guiEvent.param = refreshDisplay;
2665
3816
  this.task.insertEvent(guiEvent);
2666
3817
  }
3818
+ /**
3819
+ * @ignore
3820
+ */
2667
3821
  isDataviewEmpty() {
2668
3822
  return this.task.Records.isEmptyDataView;
2669
3823
  }
3824
+ /**
3825
+ * simulates a click event on the specified control, for the Magic engine
3826
+ * @param controlName
3827
+ * @param rowId
3828
+ */
2670
3829
  simulateClick(controlName, rowId) {
2671
3830
  if (typeof rowId === "undefined")
2672
3831
  rowId = 0;
2673
3832
  this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
2674
3833
  }
3834
+ /**
3835
+ * Return Boolean TRUE if user logged in Else it will return FALSE
3836
+ */
2675
3837
  isLoggedIn() {
2676
3838
  return this.task.getIsLoggenIn();
2677
3839
  }
3840
+ /**
3841
+ * Returns JS object containing the records with all table fields.
3842
+ */
2678
3843
  GetFormRecords() {
2679
3844
  let rowId = 0;
2680
3845
  let recArray;
2681
3846
  if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
2682
3847
  let recList = this.task.Records.list;
2683
3848
  let tableControls = new Array();
3849
+ //Generate list of table fields names
2684
3850
  for (const key in this.task.template) {
2685
3851
  if (this.task.template[key] == '1')
2686
3852
  tableControls.push(key);
2687
3853
  }
2688
3854
  recArray = new Array();
3855
+ //Update the records as list of objects with values for table fields.
2689
3856
  if (tableControls.length > 0) {
2690
3857
  recList.forEach((ctrlMetaData) => {
2691
3858
  if (this.task.Records.isRowCreated(rowId)) {
@@ -2701,31 +3868,54 @@ class AccessorMagicService {
2701
3868
  }
2702
3869
  return recArray;
2703
3870
  }
3871
+ /**
3872
+ * SetCookie : set the cookie with specified name and value in browser
3873
+ * expires - expiration time
3874
+ * path - path which much exists in order so that cookie is sent as header
3875
+ * domain - specifies which hosts are allowed to receive the cookie
3876
+ * secure - specifies if cookie is secure ( works only with HTTPS)
3877
+ * sameSite - lets servers specify whether/when cookies are sent with cross-site requests
3878
+ */
2704
3879
  SetCookie(name, value, expires, path, domain, secure, sameSite) {
2705
3880
  CookieService.setCookie(name, value, expires, path, domain, secure, sameSite);
2706
3881
  }
3882
+ /**
3883
+ * GetCookie : get the cookie with specified name and value in browser
3884
+ */
2707
3885
  GetCookie(name) {
2708
3886
  return CookieService.getCookie(name);
2709
3887
  }
3888
+ /**
3889
+ * DeleteCookie : deletes the cookie
3890
+ */
2710
3891
  DeleteCookie(name) {
2711
3892
  return CookieService.deleteCookie(name);
2712
3893
  }
3894
+ /**
3895
+ * get RGBA color from color file
3896
+ */
2713
3897
  getColor(colorNumber, colorType) {
2714
3898
  return this.magicColor.getColor(colorNumber, colorType);
2715
3899
  }
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 });
3900
+ /** @nocollapse */ static ɵfac = function AccessorMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AccessorMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MagicColorService)); };
3901
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
2718
3902
  }
2719
3903
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AccessorMagicService, [{
2720
3904
  type: Injectable
2721
3905
  }], () => [{ type: TaskMagicService }, { type: MagicColorService }], null); })();
2722
3906
 
3907
+ /**
3908
+ * Central place for adding the Magic services
3909
+ */
2723
3910
  class MagicServices {
2724
3911
  task;
2725
3912
  subformService;
2726
3913
  tableService;
2727
3914
  titleService;
2728
3915
  mgAccessorService;
3916
+ /**
3917
+ * @ignore
3918
+ */
2729
3919
  constructor(task, subformService, tableService, titleService, mgAccessorService) {
2730
3920
  this.task = task;
2731
3921
  this.subformService = subformService;
@@ -2737,41 +3927,85 @@ class MagicServices {
2737
3927
  task.mgTitleService = titleService;
2738
3928
  task.mgAccessorService = mgAccessorService;
2739
3929
  }
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 });
3930
+ /** @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)); };
3931
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
2742
3932
  }
2743
3933
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicServices, [{
2744
3934
  type: Injectable
2745
3935
  }], () => [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }], null); })();
2746
3936
 
3937
+ /**
3938
+ * Base component representing a Magic task
3939
+ */
2747
3940
  class TaskBaseMagicComponent {
2748
3941
  ref;
2749
3942
  magicServices;
3943
+ /**
3944
+ * Id of task, used for initializing the task service
3945
+ */
2750
3946
  taskIdParam;
3947
+ /**
3948
+ * @ignore
3949
+ */
2751
3950
  taskDescription;
3951
+ /**
3952
+ * @ignore
3953
+ */
2752
3954
  magicProperties = MagicProperties;
3955
+ /**
3956
+ *
3957
+ * @param ref changes-detector object
3958
+ * @param magicServices Access point for all Magic services
3959
+ */
2753
3960
  constructor(ref, magicServices) {
2754
3961
  this.ref = ref;
2755
3962
  this.magicServices = magicServices;
2756
3963
  }
3964
+ /**
3965
+ * Returns the Magic task service
3966
+ * @returns
3967
+ */
2757
3968
  get task() {
2758
3969
  return this.magicServices.task;
2759
3970
  }
3971
+ /**
3972
+ * Returns the Magic subform service
3973
+ * @returns
3974
+ */
2760
3975
  get mgSub() {
2761
3976
  return this.magicServices.subformService;
2762
3977
  }
3978
+ /**
3979
+ * Returns the Magic table service
3980
+ * @returns
3981
+ */
2763
3982
  get tableService() {
2764
3983
  return this.magicServices.tableService;
2765
3984
  }
3985
+ /**
3986
+ * Returns the Magic accessor service
3987
+ * @returns
3988
+ */
2766
3989
  get mg() {
2767
3990
  return this.magicServices.mgAccessorService;
2768
3991
  }
3992
+ /**
3993
+ * Returns the task Id
3994
+ * @returns
3995
+ */
2769
3996
  get taskId() {
2770
3997
  return this.task.taskId;
2771
3998
  }
3999
+ /**
4000
+ * Returns the FormGroup for screen-mode forms
4001
+ * @returns
4002
+ */
2772
4003
  get screenFormGroup() {
2773
4004
  return this.task.ScreenModeControls;
2774
4005
  }
4006
+ /**
4007
+ * Interface implementation
4008
+ */
2775
4009
  ngOnInit() {
2776
4010
  this.task.detectChanges.pipe().subscribe(c => {
2777
4011
  this.ref.detectChanges();
@@ -2779,24 +4013,61 @@ class TaskBaseMagicComponent {
2779
4013
  this.task.initTask(this.taskIdParam, this.taskDescription);
2780
4014
  this.createFormControlsAccessor(this.screenFormGroup);
2781
4015
  this.setInputDateFormat();
4016
+ // subcribe to custom property changes
2782
4017
  this.task.customPropertiesSubject.pipe().subscribe(property => {
2783
4018
  this.PropertyChanged(property.propertyName, property.rowId, property.value);
2784
4019
  });
4020
+ // subcribe to records count changes
2785
4021
  this.task.recordsCountChangeSubject.pipe().subscribe(value => {
2786
4022
  this.RecordsCountChanged(value);
2787
4023
  });
4024
+ // subcribe to mgLoad change
2788
4025
  this.task.mgLoadSubject.pipe().subscribe(value => {
2789
4026
  this.mgOnLoad();
2790
4027
  });
2791
4028
  }
4029
+ /**
4030
+ * @ignore
4031
+ */
2792
4032
  createFormControlsAccessor(formGroup) { }
4033
+ /**
4034
+ * @ignore
4035
+ */
2793
4036
  setInputDateFormat() { }
4037
+ /**
4038
+ * This method is called when the value of any custom property is updated in Magic
4039
+ * propertyName : name of property which is updated. The format is <controlname>~<propertyname>
4040
+ * rowId : row number of the updated property for controls in table control (0 for controls outside table)
4041
+ * value : updated value of the property
4042
+ * @returns : void
4043
+ * To use the method override it in your component and check the property name and write you code ..for eg
4044
+ * if(propertyName == 'controlname~propertyName') {// your code}
4045
+ * else { // your code}
4046
+ */
2794
4047
  PropertyChanged(propertyName, rowId, value) {
2795
- }
4048
+ // intentionally left blank because the implementation should be in the derived class
4049
+ }
4050
+ /**
4051
+ * Records count change subject is subscribed to change in its value. This method will be called
4052
+ * as the value of records count is received at from server.
4053
+ * @returns : void
4054
+ * To use the method override it in your component.
4055
+ */
2796
4056
  RecordsCountChanged(recordsCount) {
2797
- }
4057
+ // intentionally left blank because the implementation should be in the derived class
4058
+ }
4059
+ /**
4060
+ * This method will be called once engine informs UI about loading of first set of data is sent to client
4061
+ * and client has reached its first idle time.
4062
+ * @returns : void
4063
+ * To use the method override it in your component.
4064
+ */
2798
4065
  mgOnLoad() {
4066
+ // intentionally left blank because the implementation should be in the derived class
2799
4067
  }
4068
+ /**
4069
+ * Interface implementation
4070
+ */
2800
4071
  ngAfterViewInit() {
2801
4072
  this.mgSub.init();
2802
4073
  }
@@ -2806,37 +4077,53 @@ class TaskBaseMagicComponent {
2806
4077
  this.task.oldPageSize = this.tableService.getPageSize();
2807
4078
  }
2808
4079
  }
4080
+ /**
4081
+ * Interface implementation
4082
+ */
2809
4083
  ngOnDestroy() {
2810
4084
  this.task.dispose();
2811
4085
  }
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 });
4086
+ /** @nocollapse */ static ɵfac = function TaskBaseMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TaskBaseMagicComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(MagicServices)); };
4087
+ /** @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
4088
  }
2815
4089
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskBaseMagicComponent, [{
2816
4090
  type: Component,
2817
4091
  args: [{
2818
4092
  selector: 'task-magic',
2819
4093
  providers: [TaskMagicService, SubformMagicService, TableMagicService],
2820
- template: ''
4094
+ template: '',
4095
+ standalone: false
2821
4096
  }]
2822
4097
  }], () => [{ type: i0.ChangeDetectorRef }, { type: MagicServices }], { taskIdParam: [{
2823
4098
  type: Input
2824
4099
  }], taskDescription: [{
2825
4100
  type: Input
2826
4101
  }] }); })();
2827
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskBaseMagicComponent, { className: "TaskBaseMagicComponent", filePath: "src\\ui\\task-base.magic.component.ts", lineNumber: 20 }); })();
4102
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskBaseMagicComponent, { className: "TaskBaseMagicComponent", filePath: "src/ui/task-base.magic.component.ts", lineNumber: 21 }); })();
2828
4103
 
4104
+ /**
4105
+ * @ignore
4106
+ */
2829
4107
  class RowMagicDirective {
2830
4108
  _task;
2831
4109
  element;
2832
4110
  rowId;
4111
+ /**
4112
+ * The HTML element connected to this directive
4113
+ */
2833
4114
  htmlElement;
4115
+ /**
4116
+ * @ignore
4117
+ */
2834
4118
  rowChangedSubscriber = null;
2835
4119
  constructor(_task, element) {
2836
4120
  this._task = _task;
2837
4121
  this.element = element;
2838
4122
  this.htmlElement = this.element.nativeElement;
2839
4123
  }
4124
+ /**
4125
+ * Initializes this object
4126
+ */
2840
4127
  ngOnInit() {
2841
4128
  this.rowChangedSubscriber = this._task
2842
4129
  .OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
@@ -2851,7 +4138,16 @@ class RowMagicDirective {
2851
4138
  return (rect.top >= parentRect.top &&
2852
4139
  rect.bottom <= parentRect.bottom);
2853
4140
  }
4141
+ /**
4142
+ * Cleanup
4143
+ */
2854
4144
  ngOnDestroy() {
4145
+ // Don't know why, but when the table is loaded for the first time, we
4146
+ // get ngOnInit() for the 1st row (rowId = "0") and then ngOnDestroy()
4147
+ // for number of rows in the page but here this.rowId is undefined.
4148
+ // Since ngOnInit() was not called for all these rows, this.rowChangedSubscriber
4149
+ // is null and hence crashes.
4150
+ // So, the condition to check nulity is added.
2855
4151
  if (this.rowChangedSubscriber !== null) {
2856
4152
  this.rowChangedSubscriber.unsubscribe();
2857
4153
  }
@@ -2863,15 +4159,16 @@ class RowMagicDirective {
2863
4159
  event.cancelBubble = true;
2864
4160
  }
2865
4161
  }
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) {
4162
+ /** @nocollapse */ static ɵfac = function RowMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RowMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
4163
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
2868
4164
  i0.ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
2869
- } }, inputs: { rowId: [i0.ɵɵInputFlags.None, "magicRow", "rowId"] } });
4165
+ } }, inputs: { rowId: [0, "magicRow", "rowId"] }, standalone: false });
2870
4166
  }
2871
4167
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RowMagicDirective, [{
2872
4168
  type: Directive,
2873
4169
  args: [{
2874
- selector: '[magicRow]'
4170
+ selector: '[magicRow]',
4171
+ standalone: false
2875
4172
  }]
2876
4173
  }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }], { rowId: [{
2877
4174
  type: Input,
@@ -2881,6 +4178,9 @@ class RowMagicDirective {
2881
4178
  args: ['click', ['$event']]
2882
4179
  }] }); })();
2883
4180
 
4181
+ /**
4182
+ * Connects HTML elements to the Magic Web Client engine
4183
+ */
2884
4184
  class MagicDirective {
2885
4185
  _task;
2886
4186
  element;
@@ -2893,24 +4193,64 @@ class MagicDirective {
2893
4193
  this.selector = "magic";
2894
4194
  }
2895
4195
  ;
4196
+ /**
4197
+ * This flag is used when we only want to register to events, but do not want to execute commands sent from server
4198
+ */
2896
4199
  set eventsOnly(val) {
2897
4200
  console.log("eventsOnly");
2898
4201
  this.eventsOnlyVal = true;
2899
4202
  }
2900
4203
  ;
4204
+ /**
4205
+ * pollTime: after which value will be sent to magic
4206
+ */
2901
4207
  pollTime = 200;
4208
+ /**
4209
+ * Row id of the control, for when it is on a table
4210
+ */
2902
4211
  rowId;
4212
+ /**
4213
+ *
4214
+ */
4215
+ //@Input() events: any[] = [];
4216
+ /**
4217
+ * The HTML element connected to this directive
4218
+ */
2903
4219
  htmlElement;
4220
+ /**
4221
+ * Magic's component handling this control
4222
+ */
2904
4223
  component;
4224
+ /**
4225
+ * Collection of event handlers for this element
4226
+ */
2905
4227
  eventHandlers = {};
4228
+ /**
4229
+ * Id of this element
4230
+ */
2906
4231
  id;
4232
+ /**
4233
+ * @ignore
4234
+ */
2907
4235
  selector;
4236
+ /**
4237
+ * @ignore
4238
+ */
2908
4239
  subscribeRefreshDom;
2909
4240
  focusUnlistener;
2910
4241
  eventsOnlyVal = false;
2911
4242
  static opened = false;
2912
4243
  static noOfAutoCompleteBoxesOpened = 0;
2913
4244
  subscribeInteractiveCommands;
4245
+ /**
4246
+ *
4247
+ * @param _task The task service
4248
+ * @param element The element for which the directive is applied
4249
+ * @param renderer Renderer for the element
4250
+ * @param vcRef
4251
+ * @param platform
4252
+ * @param magicRow
4253
+ */
2914
4254
  constructor(_task, element, renderer, vcRef, platform, magicRow) {
2915
4255
  this._task = _task;
2916
4256
  this.element = element;
@@ -2919,23 +4259,43 @@ class MagicDirective {
2919
4259
  this.platform = platform;
2920
4260
  this.magicRow = magicRow;
2921
4261
  this.htmlElement = this.element.nativeElement;
4262
+ //let c = (<any>this.vcRef)._view;
4263
+ //while (!(c instanceof TaskBaseMagicComponent)) {
4264
+ // c = c.component;
4265
+ //}
4266
+ //this.component = c;
2922
4267
  if (!(typeof magicRow === "undefined" || magicRow === null))
2923
4268
  this.rowId = magicRow.rowId;
2924
4269
  }
4270
+ /**
4271
+ * Get the task service
4272
+ * @returns
4273
+ */
2925
4274
  get task() {
2926
4275
  return this._task;
2927
4276
  }
4277
+ /**
4278
+ * Register to the events this element may need to handle
4279
+ */
2928
4280
  regEvents() {
4281
+ // Handle events for which event handler may be removed and restored
2929
4282
  this.eventHandlers["focusin"] = this.OnFocus.bind(this);
2930
4283
  Object.keys(this.eventHandlers).forEach((key) => {
2931
4284
  this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
2932
4285
  });
2933
- let events = ["click", "mousedown", "dblclick"];
4286
+ // Handle events with anonymous event handlers
4287
+ let events = ["click", "mousedown", "dblclick"]; // ,'resize', 'load', 'unload'
2934
4288
  events.forEach(event => {
2935
4289
  this.renderer.listen(this.htmlElement, event, (e) => {
4290
+ // check if the event is fired from zoom button ( to identify the connected zoom button in engine)
2936
4291
  let fromButton = false;
2937
4292
  if (this.htmlElement instanceof HTMLButtonElement)
2938
4293
  fromButton = true;
4294
+ /**
4295
+ * In the case of Safari or Chrome browser on IOS, when a button is clicked, the browser does not receive
4296
+ * focus event hence the zoom action is not executed. So in order to receive focus event, enabling it exclusively
4297
+ * in the case of Safari or Chrome browser on IOS and Safari browser on Mac.
4298
+ */
2939
4299
  if (fromButton && (this.platform.IOS || this.platform.SAFARI))
2940
4300
  this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
2941
4301
  this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
@@ -2951,10 +4311,13 @@ class MagicDirective {
2951
4311
  this.task.insertEvent(guiEvent);
2952
4312
  }
2953
4313
  });
4314
+ // handle the input event
2954
4315
  fromEvent(this.htmlElement, "input").pipe(map((event) => {
2955
4316
  return event.target.value;
2956
- }), debounceTime(this.pollTime)).subscribe((x) => {
4317
+ }), debounceTime(this.pollTime) // time after which value will be sent to magic
4318
+ ).subscribe((x) => {
2957
4319
  if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
4320
+ // Don't support character binding for date/time values
2958
4321
  let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
2959
4322
  if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
2960
4323
  this.task.mgAccessorService.setValueToControl(this.id, x, true);
@@ -2980,16 +4343,25 @@ class MagicDirective {
2980
4343
  (e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
2981
4344
  if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
2982
4345
  guiEvent.keyCode = e.keyCode;
4346
+ // Defect 160021 fixed - don't set e.cancelBubble when combobox is opened and esc key is pressed
2983
4347
  if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
2984
4348
  e.cancelBubble = true;
2985
4349
  this.task.insertEvent(guiEvent);
2986
4350
  }
2987
4351
  });
2988
4352
  }
4353
+ /**
4354
+ * Handle focus event
4355
+ */
2989
4356
  OnFocus() {
2990
4357
  this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
2991
4358
  event.cancelBubble = true;
2992
4359
  }
4360
+ /**
4361
+ * Is the command's element the same as this directive's element
4362
+ * @param command
4363
+ * @returns true/false
4364
+ */
2993
4365
  IsSameElement(command) {
2994
4366
  let line = command.line;
2995
4367
  if (this.task.isTableControl(command.CtrlName))
@@ -2998,9 +4370,17 @@ class MagicDirective {
2998
4370
  (line === +this.rowId ||
2999
4371
  (line === 0 && isNullOrUndefined(this.rowId))));
3000
4372
  }
4373
+ /**
4374
+ * Is the command's element the same as this directive's component
4375
+ * @param command
4376
+ * @returns true/false
4377
+ */
3001
4378
  IsSameComponent(command) {
3002
4379
  return (command.controlName === this.id);
3003
4380
  }
4381
+ /**
4382
+ * @ignore
4383
+ */
3004
4384
  regUpdatesUI() {
3005
4385
  this.subscribeRefreshDom = this.task
3006
4386
  .refreshDom.pipe(filter(c => this.IsSameElement(c)))
@@ -3022,10 +4402,17 @@ class MagicDirective {
3022
4402
  this.handleInteractiveCommands(command);
3023
4403
  });
3024
4404
  }
4405
+ /**
4406
+ * Initializes this object
4407
+ */
3025
4408
  ngOnInit() {
3026
4409
  this.regEvents();
3027
4410
  this.regUpdatesUI();
3028
4411
  }
4412
+ /**
4413
+ * Handles the commands received from the Magic WebClient engine
4414
+ * @param command
4415
+ */
3029
4416
  handleCommand(command) {
3030
4417
  switch (command.CommandType) {
3031
4418
  case CommandType.SET_PROPERTY:
@@ -3033,12 +4420,16 @@ class MagicDirective {
3033
4420
  break;
3034
4421
  case CommandType.SET_FOCUS:
3035
4422
  this.focusUnlistener();
4423
+ // Do not set focus on connected zoom button
3036
4424
  if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
3037
4425
  this.htmlElement.focus();
3038
4426
  this.focusUnlistener = this.renderer.listen(this.htmlElement, "focusin", this.eventHandlers["focusin"]);
3039
4427
  break;
3040
4428
  }
3041
4429
  }
4430
+ /**
4431
+ * handle the interactive commands like CallJS
4432
+ */
3042
4433
  handleInteractiveCommands(command) {
3043
4434
  switch (command._commandType) {
3044
4435
  case InteractiveCommandType.CALL_JS:
@@ -3048,18 +4439,24 @@ class MagicDirective {
3048
4439
  let resultString = "";
3049
4440
  try {
3050
4441
  if (!isNullOrUndefined(magicComponent[methodName])) {
4442
+ // invoke the method on instance of magic componenet
3051
4443
  resultString = magicComponent[methodName].apply(magicComponent, args);
3052
4444
  }
3053
4445
  else
3054
- console.error("Instance method " + methodName + " does not exists");
4446
+ console.error("Instance method " + methodName + " does not exists"); // when method is not found
3055
4447
  }
3056
4448
  catch (e) {
4449
+ // any other exception
3057
4450
  console.error(e.message);
3058
4451
  }
3059
- command.resultString = resultString;
4452
+ command.resultString = resultString; // update the return value
3060
4453
  break;
3061
4454
  }
3062
4455
  }
4456
+ /**
4457
+ * Handle the Magic set-property command
4458
+ * @param command
4459
+ */
3063
4460
  handleSetProperty(command) {
3064
4461
  switch (command.Operation) {
3065
4462
  case HtmlProperties.ReadOnly:
@@ -3073,18 +4470,22 @@ class MagicDirective {
3073
4470
  break;
3074
4471
  }
3075
4472
  }
4473
+ /**
4474
+ * Cleanup
4475
+ */
3076
4476
  ngOnDestroy() {
3077
4477
  this.subscribeRefreshDom.unsubscribe();
3078
4478
  }
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" } });
4479
+ /** @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)); };
4480
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", pollTime: "pollTime", rowId: "rowId" }, standalone: false });
3081
4481
  }
3082
4482
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDirective, [{
3083
4483
  type: Directive,
3084
4484
  args: [{
3085
- selector: "[magic]"
4485
+ selector: "[magic]",
4486
+ standalone: false
3086
4487
  }]
3087
- }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
4488
+ }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$2.Platform }, { type: RowMagicDirective, decorators: [{
3088
4489
  type: Optional
3089
4490
  }] }], { magic: [{
3090
4491
  type: Input,
@@ -3098,6 +4499,9 @@ class MagicDirective {
3098
4499
  type: Input
3099
4500
  }] }); })();
3100
4501
 
4502
+ /**
4503
+ * @ignore
4504
+ */
3101
4505
  class NoControlMagicDirective extends MagicDirective {
3102
4506
  set magic(val) { this.id = val; this.selector = 'magicnc'; }
3103
4507
  ;
@@ -3131,10 +4535,12 @@ class NoControlMagicDirective extends MagicDirective {
3131
4535
  }
3132
4536
  }
3133
4537
  }
4538
+ // is the div a tab control
3134
4539
  isTabControl() {
3135
4540
  return this.htmlElement instanceof HTMLDivElement &&
3136
4541
  this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
3137
4542
  }
4543
+ // is the div a radio buttons wrapper
3138
4544
  isRadio() {
3139
4545
  return this.htmlElement instanceof HTMLDivElement &&
3140
4546
  this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
@@ -3143,6 +4549,7 @@ class NoControlMagicDirective extends MagicDirective {
3143
4549
  super.handleCommand(command);
3144
4550
  switch (command.CommandType) {
3145
4551
  case CommandType.SET_CLASS:
4552
+ //remove the class which was replaced by this new one, as registered in the ControlMetadata
3146
4553
  const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
3147
4554
  if (controlMetadata.removedClass != '') {
3148
4555
  this.htmlElement.classList.remove(controlMetadata.removedClass);
@@ -3155,7 +4562,7 @@ class NoControlMagicDirective extends MagicDirective {
3155
4562
  this.htmlElement.innerText = command.value;
3156
4563
  if (this.htmlElement instanceof HTMLSelectElement)
3157
4564
  this.htmlElement.value = command.value;
3158
- if (this.htmlElement instanceof HTMLAnchorElement)
4565
+ if (this.htmlElement instanceof HTMLAnchorElement) //hyper-text button
3159
4566
  this.htmlElement.text = command.value;
3160
4567
  if (this.htmlElement instanceof HTMLInputElement) {
3161
4568
  if (this.htmlElement.type === "checkbox") {
@@ -3179,6 +4586,7 @@ class NoControlMagicDirective extends MagicDirective {
3179
4586
  break;
3180
4587
  }
3181
4588
  }
4589
+ // handle set-property commands
3182
4590
  handleSetProperty(command) {
3183
4591
  super.handleSetProperty(command);
3184
4592
  switch (command.Operation) {
@@ -3194,6 +4602,7 @@ class NoControlMagicDirective extends MagicDirective {
3194
4602
  break;
3195
4603
  case HtmlProperties.ItemsList:
3196
4604
  if (this.htmlElement instanceof HTMLSelectElement) {
4605
+ // clear the list
3197
4606
  var len = this.htmlElement.length;
3198
4607
  for (var i = len - 1; i >= 0; i--) {
3199
4608
  this.htmlElement.remove(i);
@@ -3235,7 +4644,8 @@ class NoControlMagicDirective extends MagicDirective {
3235
4644
  let child = tabControl.children[i];
3236
4645
  const layer = child.getAttribute('layer') - 1;
3237
4646
  if (child instanceof HTMLButtonElement) {
3238
- if (layer == command.obj1) {
4647
+ // set button style
4648
+ if (layer == command.obj1) { // compare int to string
3239
4649
  child.classList.add('tab_button_active');
3240
4650
  }
3241
4651
  else {
@@ -3243,6 +4653,7 @@ class NoControlMagicDirective extends MagicDirective {
3243
4653
  }
3244
4654
  }
3245
4655
  else {
4656
+ // not a buton - hide unselected tabpages
3246
4657
  let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
3247
4658
  child.setAttribute('style', style);
3248
4659
  }
@@ -3263,24 +4674,31 @@ class NoControlMagicDirective extends MagicDirective {
3263
4674
  break;
3264
4675
  }
3265
4676
  }
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] });
4677
+ /** @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)); };
4678
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: [0, "magicnc", "magic"] }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature] });
3268
4679
  }
3269
4680
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NoControlMagicDirective, [{
3270
4681
  type: Directive,
3271
4682
  args: [{
3272
- selector: '[magicnc]'
4683
+ selector: '[magicnc]',
4684
+ standalone: false
3273
4685
  }]
3274
- }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
4686
+ }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$2.Platform }, { type: RowMagicDirective, decorators: [{
3275
4687
  type: Optional
3276
4688
  }] }], { magic: [{
3277
4689
  type: Input,
3278
4690
  args: ['magicnc']
3279
4691
  }] }); })();
3280
4692
 
4693
+ /**
4694
+ * @ignore
4695
+ */
3281
4696
  class Constants {
3282
4697
  static DATE_FMT = 'dd/MMM/yyyy';
3283
4698
  }
4699
+ /**
4700
+ * @ignore
4701
+ */
3284
4702
  class DateMagicPipe extends DatePipe {
3285
4703
  _task;
3286
4704
  constructor(_task) {
@@ -3293,6 +4711,7 @@ class DateMagicPipe extends DatePipe {
3293
4711
  let mgDateFormatter = new MgDateFormatter();
3294
4712
  if (!isNullOrUndefined(value) && mask !== null) {
3295
4713
  formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
4714
+ // If control is label control of table, due to query mode, then save the format here.
3296
4715
  if (formatStr != null && this._task.isTableControl(controlId)) {
3297
4716
  if (this._task.mgInputDateFormat == null)
3298
4717
  this._task.mgInputDateFormat = formatStr;
@@ -3305,13 +4724,14 @@ class DateMagicPipe extends DatePipe {
3305
4724
  value = "";
3306
4725
  return value;
3307
4726
  }
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 });
4727
+ /** @nocollapse */ static ɵfac = function DateMagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DateMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
4728
+ /** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true, standalone: false });
3310
4729
  }
3311
4730
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateMagicPipe, [{
3312
4731
  type: Pipe,
3313
4732
  args: [{
3314
- name: 'magicDate'
4733
+ name: 'magicDate',
4734
+ standalone: false
3315
4735
  }]
3316
4736
  }], () => [{ type: TaskMagicService }], null); })();
3317
4737
  class MgDateFormatter {
@@ -3373,14 +4793,20 @@ class MgDateFormatter {
3373
4793
  return formatStr.ToString();
3374
4794
  }
3375
4795
  else
3376
- return "dd-mm-yyyy";
4796
+ return "dd-mm-yyyy"; // return default format.
3377
4797
  }
3378
4798
  }
3379
4799
 
4800
+ /**
4801
+ * Perform Magic validation on input controls which hold alphanumeric strings
4802
+ */
3380
4803
  class MgformatMagicDirective {
3381
4804
  magicDir;
3382
4805
  _task;
3383
4806
  datePasteFlag = false;
4807
+ /**
4808
+ * @ignore
4809
+ */
3384
4810
  constructor(magicDir, _task) {
3385
4811
  this.magicDir = magicDir;
3386
4812
  this._task = _task;
@@ -3388,16 +4814,30 @@ class MgformatMagicDirective {
3388
4814
  ngAfterViewInit() {
3389
4815
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3390
4816
  if (control != null && this._task.mgInputDateFormat == null) {
4817
+ // get the first date control's format.
3391
4818
  let pic = this._task.GetControlPictureMask(this.magicDir.id);
3392
4819
  if (pic.getAttr() == StorageAttribute.DATE) {
3393
4820
  this.formatDate(pic);
3394
4821
  }
3395
4822
  }
3396
4823
  }
4824
+ /**
4825
+ * @ignore
4826
+ */
4827
+ /**
4828
+ * This can be used to set pattern
4829
+ * On input, verifies the input matches the required mask
4830
+ */
3397
4831
  onFocusEvent($event) {
3398
4832
  this.calculatePattern();
3399
4833
  }
3400
4834
  onPaste(event) {
4835
+ /**
4836
+ * This flag is needed to skip execution of dateMasking() method when user paste date in input control.
4837
+ * This is only needed when "StorageAttribute" is DATE. But to check type of "StorageAttribute", we
4838
+ need to execute getControlMetadata() method. So, to reduce this execution overload we set
4839
+ "datePasteFlag" directly.
4840
+ */
3401
4841
  this.datePasteFlag = true;
3402
4842
  }
3403
4843
  onInputEvent(event) {
@@ -3409,6 +4849,8 @@ class MgformatMagicDirective {
3409
4849
  }
3410
4850
  this.calculatePattern();
3411
4851
  }
4852
+ //This method inserts '/' as a separator while entering date in the textbox.
4853
+ //Example: 10/10/2023
3412
4854
  dateMasking(event) {
3413
4855
  const input = event.target;
3414
4856
  let cursorPos = event.target.selectionStart;
@@ -3561,6 +5003,10 @@ class MgformatMagicDirective {
3561
5003
  input.setSelectionRange(start, end);
3562
5004
  }
3563
5005
  }
5006
+ /**
5007
+ * @ignore
5008
+ */
5009
+ // This can be used to implement uppercase/lower case
3564
5010
  onChangeEvent(event) {
3565
5011
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3566
5012
  let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
@@ -3582,6 +5028,7 @@ class MgformatMagicDirective {
3582
5028
  this.formatDateWithCentury(event.target.value, century, control);
3583
5029
  }
3584
5030
  }
5031
+ /** Format year, if user enters 2 digits instead of 4 digits as per the century given in Magic.ini file */
3585
5032
  formatDateWithCentury(userInput, century, control) {
3586
5033
  const dateFormat = this._task.mgInputDateFormat;
3587
5034
  const separator = userInput.includes('/') ? '/' : "-";
@@ -3739,6 +5186,9 @@ class MgformatMagicDirective {
3739
5186
  const year = Number(dateArray[0]);
3740
5187
  return [day, month, year];
3741
5188
  }
5189
+ /**
5190
+ * @ignore
5191
+ */
3742
5192
  calculatePattern() {
3743
5193
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3744
5194
  if (control != null) {
@@ -3757,6 +5207,7 @@ class MgformatMagicDirective {
3757
5207
  if (control.validator == null)
3758
5208
  control.setValidators(Validators.maxLength(pic.getMaskLength()));
3759
5209
  else {
5210
+ // re-set all validators again
3760
5211
  if (pic.isFormatExp()) {
3761
5212
  control.setValidators(Validators.maxLength(pic.getMaskLength()));
3762
5213
  if (isUndefined(this.magicDir.rowId))
@@ -3766,6 +5217,7 @@ class MgformatMagicDirective {
3766
5217
  else
3767
5218
  control.setValidators([control.validator, Validators.maxLength(pic.getMaskLength())]);
3768
5219
  }
5220
+ // control.setValidators(Validators.maxLength(pic.getMaskLength()));
3769
5221
  control.updateValueAndValidity();
3770
5222
  }
3771
5223
  }
@@ -3776,6 +5228,9 @@ class MgformatMagicDirective {
3776
5228
  let mgDateFormatter = new MgDateFormatter();
3777
5229
  this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
3778
5230
  }
5231
+ /**
5232
+ * @ignore
5233
+ */
3779
5234
  formatAlphaUnicode(control) {
3780
5235
  let value = control.value;
3781
5236
  if (value !== null && value.length > 0) {
@@ -3801,6 +5256,9 @@ class MgformatMagicDirective {
3801
5256
  control.setValue(valueStr.ToString());
3802
5257
  }
3803
5258
  }
5259
+ /**
5260
+ * @ignore
5261
+ */
3804
5262
  formatBoolean(control) {
3805
5263
  let value = control.value;
3806
5264
  if (value !== null && value.length > 0) {
@@ -3813,6 +5271,12 @@ class MgformatMagicDirective {
3813
5271
  }
3814
5272
  }
3815
5273
  }
5274
+ /**
5275
+ * @ignore
5276
+ */
5277
+ /// <summary>
5278
+ /// generate pattern from fld's format
5279
+ /// </summary>
3816
5280
  generatePattern(attribute, pic) {
3817
5281
  let pattern = '';
3818
5282
  switch (attribute) {
@@ -3826,6 +5290,12 @@ class MgformatMagicDirective {
3826
5290
  }
3827
5291
  return pattern;
3828
5292
  }
5293
+ /**
5294
+ * @ignore
5295
+ */
5296
+ /// <summary>
5297
+ /// generate pattern for Alpha
5298
+ /// </summary>
3829
5299
  generatePatternForNumber(pic) {
3830
5300
  let patternStr = new StringBuilder();
3831
5301
  patternStr.Append('^');
@@ -3838,6 +5308,9 @@ class MgformatMagicDirective {
3838
5308
  patternStr.Append('$');
3839
5309
  return patternStr.ToString();
3840
5310
  }
5311
+ /**
5312
+ * @ignore
5313
+ */
3841
5314
  isPatternGenerationNeeded(attr, pic) {
3842
5315
  switch (attr) {
3843
5316
  case StorageAttribute.NUMERIC:
@@ -3847,6 +5320,12 @@ class MgformatMagicDirective {
3847
5320
  return (pic.getMaskChars() > 0) ? true : false;
3848
5321
  }
3849
5322
  }
5323
+ /**
5324
+ * @ignore
5325
+ */
5326
+ /// <summary>
5327
+ /// generate pattern for Alpha
5328
+ /// </summary>
3850
5329
  generatePatternForAlpha(pic) {
3851
5330
  let cnt = 0;
3852
5331
  let inputAllChars = false;
@@ -3855,6 +5334,7 @@ class MgformatMagicDirective {
3855
5334
  let pattern = new StringBuilder();
3856
5335
  pattern.Append('^');
3857
5336
  for (let i = 0; i < mask.length;) {
5337
+ //start new subset , if mask[i] is one of these.
3858
5338
  if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
3859
5339
  || mask.charCodeAt(i) == PICInterface.PIC_X)) {
3860
5340
  pattern.Append('(');
@@ -3900,9 +5380,13 @@ class MgformatMagicDirective {
3900
5380
  pattern.Append('$');
3901
5381
  return pattern.ToString();
3902
5382
  }
5383
+ /**
5384
+ * @ignore
5385
+ */
3903
5386
  getDirectiveCount(mask, idx, pattern, changeInPattern) {
3904
5387
  changeInPattern.value = false;
3905
5388
  let patternCount = 0;
5389
+ // find max chars
3906
5390
  while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
3907
5391
  patternCount++;
3908
5392
  idx++;
@@ -3911,21 +5395,25 @@ class MgformatMagicDirective {
3911
5395
  changeInPattern.value = true;
3912
5396
  return patternCount;
3913
5397
  }
5398
+ /**
5399
+ * @ignore
5400
+ */
3914
5401
  IsPatternMatches(mask, pattern) {
3915
5402
  for (let i = 0; i < pattern.length; i++)
3916
5403
  if (mask == pattern[i])
3917
5404
  return true;
3918
5405
  return false;
3919
5406
  }
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) {
5407
+ /** @nocollapse */ static ɵfac = function MgformatMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
5408
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
3922
5409
  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
- } } });
5410
+ } }, standalone: false });
3924
5411
  }
3925
5412
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgformatMagicDirective, [{
3926
5413
  type: Directive,
3927
5414
  args: [{
3928
- selector: '[mgFormat]'
5415
+ selector: '[mgFormat]',
5416
+ standalone: false
3929
5417
  }]
3930
5418
  }], () => [{ type: MagicDirective }, { type: TaskMagicService }], { onFocusEvent: [{
3931
5419
  type: HostListener,
@@ -3944,6 +5432,9 @@ class MgformatMagicDirective {
3944
5432
  args: ['blur', ['$event']]
3945
5433
  }] }); })();
3946
5434
 
5435
+ /**
5436
+ * @ignore
5437
+ */
3947
5438
  class TimeMagicPipe extends DatePipe {
3948
5439
  _task;
3949
5440
  constructor(_task) {
@@ -3979,23 +5470,37 @@ class TimeMagicPipe extends DatePipe {
3979
5470
  }
3980
5471
  return value;
3981
5472
  }
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 });
5473
+ /** @nocollapse */ static ɵfac = function TimeMagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TimeMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
5474
+ /** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true, standalone: false });
3984
5475
  }
3985
5476
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimeMagicPipe, [{
3986
5477
  type: Pipe,
3987
5478
  args: [{
3988
- name: 'magicTime'
5479
+ name: 'magicTime',
5480
+ standalone: false
3989
5481
  }]
3990
5482
  }], () => [{ type: TaskMagicService }], null); })();
3991
5483
 
5484
+ /**
5485
+ * Validates the field range.
5486
+ */
3992
5487
  class RangeValidatorMagicDirective {
3993
5488
  _task;
3994
5489
  vcRef;
5490
+ /**
5491
+ *
5492
+ * @param _task The task service
5493
+ * @param vcRef
5494
+ */
3995
5495
  constructor(_task, vcRef) {
3996
5496
  this._task = _task;
3997
5497
  this.vcRef = vcRef;
3998
5498
  }
5499
+ /**
5500
+ * Validation method
5501
+ * @param c FormControl to validate
5502
+ * @returns If validation fails, return error message, else returns null
5503
+ */
3999
5504
  validate(c) {
4000
5505
  let controlName;
4001
5506
  controlName = this.getControlName(c);
@@ -4017,12 +5522,15 @@ class RangeValidatorMagicDirective {
4017
5522
  };
4018
5523
  }
4019
5524
  }
5525
+ /**
5526
+ * @ignore
5527
+ */
4020
5528
  getControlName(c) {
4021
5529
  const formGroup = c.parent.controls;
4022
5530
  return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
4023
5531
  }
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([
5532
+ /** @nocollapse */ static ɵfac = function RangeValidatorMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RangeValidatorMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
5533
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], standalone: false, features: [i0.ɵɵProvidersFeature([
4026
5534
  {
4027
5535
  provide: NG_VALIDATORS,
4028
5536
  useExisting: RangeValidatorMagicDirective,
@@ -4040,7 +5548,8 @@ class RangeValidatorMagicDirective {
4040
5548
  useExisting: RangeValidatorMagicDirective,
4041
5549
  multi: true,
4042
5550
  }
4043
- ]
5551
+ ],
5552
+ standalone: false
4044
5553
  }]
4045
5554
  }], () => [{ type: TaskMagicService }, { type: i0.ViewContainerRef }], null); })();
4046
5555
 
@@ -4050,26 +5559,48 @@ function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) { if (rf & 1) {
4050
5559
  const ctx_r0 = i0.ɵɵnextContext();
4051
5560
  i0.ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
4052
5561
  } }
5562
+ /**
5563
+ * Represents a Magic subform
5564
+ */
4053
5565
  class SubformMagicComponent {
4054
5566
  vcRef;
4055
5567
  mgSub;
5568
+ /**
5569
+ * @ignore
5570
+ */
4056
5571
  id;
5572
+ /**
5573
+ * @ignore
5574
+ */
4057
5575
  set magic(val) { this.id = val; }
4058
5576
  ;
5577
+ /**
5578
+ * @ignore
5579
+ */
4059
5580
  component = null;
5581
+ /**
5582
+ * @ignore
5583
+ */
4060
5584
  constructor(vcRef, mgSub) {
4061
5585
  this.vcRef = vcRef;
4062
5586
  this.mgSub = mgSub;
5587
+ // For angular 13 - find the component from _hostLView
4063
5588
  this.component = (this.vcRef._hostLView).find(v => !isNullOrUndefined(v));
4064
5589
  }
5590
+ /**
5591
+ * @ignore
5592
+ */
4065
5593
  get Component() {
4066
5594
  return this.mgSub.mgGetComp(this.id);
4067
5595
  }
5596
+ /**
5597
+ * @ignore
5598
+ */
4068
5599
  get Parameters() {
4069
5600
  return this.mgSub.mgGetParameters(this.id);
4070
5601
  }
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) {
5602
+ /** @nocollapse */ static ɵfac = function SubformMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SubformMagicComponent)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(SubformMagicService)); };
5603
+ /** @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
5604
  i0.ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
4074
5605
  } if (rf & 2) {
4075
5606
  i0.ɵɵproperty("ngIf", ctx.Component);
@@ -4085,13 +5616,14 @@ class SubformMagicComponent {
4085
5616
  [ndcDynamicComponent]="Component"
4086
5617
  [ndcDynamicInputs]="Parameters">
4087
5618
  </ndc-dynamic>
4088
- `
5619
+ `,
5620
+ standalone: false
4089
5621
  }]
4090
5622
  }], () => [{ type: i0.ViewContainerRef }, { type: SubformMagicService }], { magic: [{
4091
5623
  type: Input,
4092
5624
  args: ['magic']
4093
5625
  }] }); })();
4094
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SubformMagicComponent, { className: "SubformMagicComponent", filePath: "src\\ui\\subform.magic.component.ts", lineNumber: 20 }); })();
5626
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SubformMagicComponent, { className: "SubformMagicComponent", filePath: "src/ui/subform.magic.component.ts", lineNumber: 22 }); })();
4095
5627
 
4096
5628
  const _c0$1 = ["customContent"];
4097
5629
  const _c1 = ["*"];
@@ -4115,12 +5647,21 @@ function ErrorMagicComponent_div_0_Template(rf, ctx) { if (rf & 1) {
4115
5647
  i0.ɵɵadvance(4);
4116
5648
  i0.ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
4117
5649
  } }
5650
+ /**
5651
+ * Represents a Magic subform
5652
+ */
4118
5653
  class ErrorMagicComponent {
4119
5654
  _task;
4120
5655
  mgService;
4121
5656
  changeDetectorRef;
5657
+ /**
5658
+ * @ignore
5659
+ */
4122
5660
  id;
4123
5661
  rowId;
5662
+ /**
5663
+ * @ignore
5664
+ */
4124
5665
  set magic(val) {
4125
5666
  this.id = val;
4126
5667
  }
@@ -4129,18 +5670,26 @@ class ErrorMagicComponent {
4129
5670
  this.rowId = val;
4130
5671
  }
4131
5672
  ;
5673
+ // if true - display standard magic error message, if false - customer has provides his own content and we'll use it
4132
5674
  defaultDisplay = true;
4133
5675
  set CustomContent(innerComponent) {
4134
5676
  this.defaultDisplay = innerComponent == undefined || this.isEmpty(innerComponent.nativeElement);
4135
5677
  this.changeDetectorRef.detectChanges();
4136
5678
  }
4137
5679
  ;
5680
+ /**
5681
+ * @ignore
5682
+ */
4138
5683
  constructor(_task, mgService, changeDetectorRef) {
4139
5684
  this._task = _task;
4140
5685
  this.mgService = mgService;
4141
5686
  this.changeDetectorRef = changeDetectorRef;
4142
5687
  this.rowId = "0";
4143
5688
  }
5689
+ /**
5690
+ * returns true if the html element has no children
5691
+ * @param element
5692
+ */
4144
5693
  isEmpty(element) {
4145
5694
  const nodes = element.childNodes;
4146
5695
  for (let i = 0; i < nodes.length; i++) {
@@ -4151,6 +5700,9 @@ class ErrorMagicComponent {
4151
5700
  }
4152
5701
  return true;
4153
5702
  }
5703
+ /**
5704
+ * @ignore
5705
+ */
4154
5706
  HasErrors(id) {
4155
5707
  if (!isUndefined(id)) {
4156
5708
  let control = this._task.getFormControl(this.rowId, id);
@@ -4171,13 +5723,13 @@ class ErrorMagicComponent {
4171
5723
  }
4172
5724
  return false;
4173
5725
  }
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) {
5726
+ /** @nocollapse */ static ɵfac = function ErrorMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ErrorMagicComponent)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(AccessorMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
5727
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
4176
5728
  i0.ɵɵviewQuery(_c0$1, 5);
4177
5729
  } if (rf & 2) {
4178
5730
  let _t;
4179
5731
  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) {
5732
+ } }, 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
5733
  i0.ɵɵprojectionDef();
4182
5734
  i0.ɵɵtemplate(0, ErrorMagicComponent_div_0_Template, 5, 1, "div", 1);
4183
5735
  } if (rf & 2) {
@@ -4196,7 +5748,8 @@ class ErrorMagicComponent {
4196
5748
  {{mgService.getErrMsg(id, rowId)}}
4197
5749
  </span>
4198
5750
  </div>
4199
- `
5751
+ `,
5752
+ standalone: false
4200
5753
  }]
4201
5754
  }], () => [{ type: TaskMagicService }, { type: AccessorMagicService }, { type: i0.ChangeDetectorRef }], { magic: [{
4202
5755
  type: Input,
@@ -4208,8 +5761,11 @@ class ErrorMagicComponent {
4208
5761
  type: ViewChild,
4209
5762
  args: ['customContent', { static: false }]
4210
5763
  }] }); })();
4211
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ErrorMagicComponent, { className: "ErrorMagicComponent", filePath: "src\\ui\\mgerror.magic.component.ts", lineNumber: 22 }); })();
5764
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ErrorMagicComponent, { className: "ErrorMagicComponent", filePath: "src/ui/mgerror.magic.component.ts", lineNumber: 24 }); })();
4212
5765
 
5766
+ /**
5767
+ * Directive for checkboxes, to handle the 'change' event
5768
+ */
4213
5769
  class CheckboxMagicDirective {
4214
5770
  magicDirective;
4215
5771
  el;
@@ -4217,11 +5773,17 @@ class CheckboxMagicDirective {
4217
5773
  threeState = false;
4218
5774
  subscribeRefreshDom = null;
4219
5775
  isIndeterminate = false;
5776
+ /**
5777
+ * @ignore
5778
+ */
4220
5779
  constructor(magicDirective, el, task) {
4221
5780
  this.magicDirective = magicDirective;
4222
5781
  this.el = el;
4223
5782
  this.task = task;
4224
5783
  }
5784
+ /**
5785
+ * Handles the Checkbox 'change' event - pass it to the Magic engine
5786
+ */
4225
5787
  onChange($event) {
4226
5788
  if (this.threeState) {
4227
5789
  this.handleThreeState();
@@ -4276,16 +5838,20 @@ class CheckboxMagicDirective {
4276
5838
  checkbox.indeterminate = false;
4277
5839
  value = 'checked';
4278
5840
  }
5841
+ // @ts-ignore
4279
5842
  this.magicDirective.task.onCheckChanged(value, this.magicDirective.id, +this.magicDirective.rowId);
4280
5843
  }
5844
+ /**
5845
+ * Cleanup
5846
+ */
4281
5847
  ngOnDestroy() {
4282
5848
  if (this.subscribeRefreshDom !== null)
4283
5849
  this.subscribeRefreshDom.unsubscribe();
4284
5850
  }
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) {
5851
+ /** @nocollapse */ static ɵfac = function CheckboxMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(TaskMagicService)); };
5852
+ /** @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
5853
  i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4288
- } }, inputs: { threeState: "threeState" } });
5854
+ } }, inputs: { threeState: "threeState" }, standalone: false });
4289
5855
  }
4290
5856
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
4291
5857
  type: Directive,
@@ -4293,6 +5859,7 @@ class CheckboxMagicDirective {
4293
5859
  selector: `
4294
5860
  input[type=checkbox][magic]:not([noFormControl])
4295
5861
  `,
5862
+ standalone: false
4296
5863
  }]
4297
5864
  }], () => [{ type: MagicDirective }, { type: i0.ElementRef }, { type: TaskMagicService }], { threeState: [{
4298
5865
  type: Input
@@ -4301,43 +5868,62 @@ class CheckboxMagicDirective {
4301
5868
  args: ['change', ['$event']]
4302
5869
  }] }); })();
4303
5870
 
5871
+ /**
5872
+ * Directive for comboboxes, to handle the 'change' event
5873
+ */
4304
5874
  class ComboboxMagicDirective {
4305
5875
  magicDirective;
4306
5876
  constructor(magicDirective) {
4307
5877
  this.magicDirective = magicDirective;
5878
+ // subcribe to refreshDom. This is a special case for native select HTML control.
5879
+ // to refresh the selected property. Else by default, HTML element doesn't get refreshed as per
5880
+ // selected value and 1st element remains selected.
4308
5881
  this.magicDirective.task.refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c))).subscribe(value => {
4309
5882
  let command = value;
4310
5883
  if (command.Operation === HtmlProperties.ItemsList)
4311
5884
  this.onComboboxItemsListChanged();
4312
5885
  });
4313
5886
  }
5887
+ /**
5888
+ * Handles the Combobox 'change' event - pass it to the Magic engine
5889
+ */
4314
5890
  onChange($event) {
4315
5891
  this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4316
5892
  }
5893
+ /**
5894
+ * To refresh Combobox selection as per selected property.
5895
+ */
4317
5896
  onComboboxItemsListChanged() {
4318
5897
  this.magicDirective.task.refreshView();
4319
5898
  }
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) {
5899
+ /** @nocollapse */ static ɵfac = function ComboboxMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
5900
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4322
5901
  i0.ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4323
- } } });
5902
+ } }, standalone: false });
4324
5903
  }
4325
5904
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComboboxMagicDirective, [{
4326
5905
  type: Directive,
4327
5906
  args: [{
4328
5907
  selector: `select[magic]:not([multiple])`,
5908
+ standalone: false
4329
5909
  }]
4330
5910
  }], () => [{ type: MagicDirective }], { onChange: [{
4331
5911
  type: HostListener,
4332
5912
  args: ['change', ['$event']]
4333
5913
  }] }); })();
4334
5914
 
5915
+ /**
5916
+ * This service supports custom actions on magic exit
5917
+ */
4335
5918
  class ExitMagicService {
5919
+ /**
5920
+ * Override this method to implement custom logic on magic exit
5921
+ */
4336
5922
  exitMagic() {
4337
5923
  console.log("Magic application terminated");
4338
5924
  }
4339
- static ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
4340
- static ɵprov = i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
5925
+ /** @nocollapse */ static ɵfac = function ExitMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ExitMagicService)(); };
5926
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
4341
5927
  }
4342
5928
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ExitMagicService, [{
4343
5929
  type: Injectable
@@ -4363,6 +5949,9 @@ function MagicShellComponent_div_5_Template(rf, ctx) { if (rf & 1) {
4363
5949
  function MagicShellComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
4364
5950
  i0.ɵɵelement(0, "div", 9);
4365
5951
  } }
5952
+ /**
5953
+ * Root Magic component
5954
+ */
4366
5955
  class MagicShellComponent {
4367
5956
  engineMagicService;
4368
5957
  componentList;
@@ -4374,13 +5963,28 @@ class MagicShellComponent {
4374
5963
  route;
4375
5964
  router;
4376
5965
  exitMagicService;
5966
+ /**
5967
+ * Root component to be displayed in the window
5968
+ */
4377
5969
  RootComponent = null;
5970
+ /**
5971
+ * parameters for the Root Component
5972
+ */
4378
5973
  RootComponentParameters;
4379
5974
  overlayWindowsContainerViewRef;
4380
5975
  rootMagicElementRef;
4381
5976
  SpinnerTemplate;
4382
5977
  showSpinner;
4383
5978
  magicEngineTerminated = false;
5979
+ /**
5980
+ *
5981
+ * @param magic Magic's service
5982
+ * @param componentList Magic component list
5983
+ * @param changeDetectorRef Changes detector
5984
+ * @param titleService Title setting service
5985
+ * @param httpClient The native httpClient instance
5986
+ * @param exitMagicService Magic exit service
5987
+ */
4384
5988
  constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, route, router, exitMagicService) {
4385
5989
  this.engineMagicService = engineMagicService;
4386
5990
  this.componentList = componentList;
@@ -4395,17 +5999,24 @@ class MagicShellComponent {
4395
5999
  this.initialize();
4396
6000
  this.setTitle();
4397
6001
  }
6002
+ /**
6003
+ * Before-unload event listener
6004
+ * @param event
6005
+ */
4398
6006
  onBeforeUnload(event) {
4399
6007
  if (this.engineMagicService.TransCacheExists()) {
6008
+ // Show the confirmation box before unloading the browser
4400
6009
  event.returnValue = 'Are you sure?';
4401
6010
  return 'Are you sure?';
4402
6011
  }
4403
6012
  else {
6013
+ // terminate the magic server context using fetch API with keep-alive
4404
6014
  this.engineMagicService.TerminateContextUsingFetchAPI();
4405
6015
  this.magicEngineTerminated = true;
4406
6016
  }
4407
6017
  }
4408
6018
  onUnload(event) {
6019
+ // Chrome provides an opportunity to terminate the context after user approves the browser unload alert
4409
6020
  if (!this.magicEngineTerminated)
4410
6021
  this.engineMagicService.TerminateContextUsingFetchAPI();
4411
6022
  }
@@ -4417,6 +6028,7 @@ class MagicShellComponent {
4417
6028
  if (this.router.navigated) {
4418
6029
  const queryParams = this.route.snapshot.queryParams;
4419
6030
  const queryParamsMap = new Map();
6031
+ // Iterate over the queryParams object and populate the Map
4420
6032
  for (const key in queryParams) {
4421
6033
  if (queryParams.hasOwnProperty(key)) {
4422
6034
  queryParamsMap.set(key, queryParams[key].toString());
@@ -4430,13 +6042,26 @@ class MagicShellComponent {
4430
6042
  setViewContainerRef(vcRef) {
4431
6043
  this.overlayWindowsContainerViewRef = vcRef;
4432
6044
  }
6045
+ /**
6046
+ * Initialization of Magic mechanisms
6047
+ */
4433
6048
  initialize() {
4434
6049
  this.registerUICommands();
4435
6050
  }
6051
+ /**
6052
+ * Set the title
6053
+ */
4436
6054
  setTitle() {
4437
6055
  const newTitle = this.componentList.title;
4438
6056
  this.titleService.setTitle(newTitle);
4439
6057
  }
6058
+ /**
6059
+ * Set the component according to requested form
6060
+ * @param formName Name of the form to open
6061
+ * @param taskId Id of opening task
6062
+ * @param taskDescription TODO
6063
+ * @param isModal whether modal window is being opened
6064
+ */
4440
6065
  setComponent(formName, taskId, taskDescription, isModal) {
4441
6066
  this.pendingCommandsCollector.startCollecting();
4442
6067
  if (isModal) {
@@ -4448,6 +6073,9 @@ class MagicShellComponent {
4448
6073
  }
4449
6074
  this.changeDetectorRef.detectChanges();
4450
6075
  }
6076
+ /**
6077
+ * @ignore
6078
+ */
4451
6079
  registerUICommands() {
4452
6080
  this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
4453
6081
  .subscribe(command => {
@@ -4459,6 +6087,10 @@ class MagicShellComponent {
4459
6087
  GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
4460
6088
  });
4461
6089
  }
6090
+ /**
6091
+ * Execute commands received from the Magic WebClient engine
6092
+ * @param command
6093
+ */
4462
6094
  executeCommand(command) {
4463
6095
  switch (command.CommandType) {
4464
6096
  case CommandType.OPEN_FORM:
@@ -4473,7 +6105,7 @@ class MagicShellComponent {
4473
6105
  this.RootComponentParameters = {};
4474
6106
  this.changeDetectorRef.detectChanges();
4475
6107
  }
4476
- else {
6108
+ else { // Close modal window
4477
6109
  this.overlayWindowService.close(command.str);
4478
6110
  this.changeDetectorRef.detectChanges();
4479
6111
  }
@@ -4496,15 +6128,17 @@ class MagicShellComponent {
4496
6128
  break;
4497
6129
  }
4498
6130
  }
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) {
6131
+ /** @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)); };
6132
+ /** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
4501
6133
  i0.ɵɵviewQuery(_c0, 7);
4502
6134
  } if (rf & 2) {
4503
6135
  let _t;
4504
6136
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
4505
6137
  } }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) { if (rf & 1) {
4506
6138
  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) {
6139
+ } }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, standalone: false, features: [i0.ɵɵProvidersFeature([
6140
+ // ExitMagicService
6141
+ ])], 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
6142
  i0.ɵɵelementStart(0, "div", null, 0);
4509
6143
  i0.ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 3);
4510
6144
  i0.ɵɵelement(3, "div", 4, 1);
@@ -4519,7 +6153,9 @@ class MagicShellComponent {
4519
6153
  }
4520
6154
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicShellComponent, [{
4521
6155
  type: Component,
4522
- args: [{ selector: 'magic-root', providers: [], template: `
6156
+ args: [{ selector: 'magic-root', providers: [
6157
+ // ExitMagicService
6158
+ ], template: `
4523
6159
  <div #magicRoot>
4524
6160
  <ndc-dynamic
4525
6161
  *ngIf = "RootComponent !== null"
@@ -4538,7 +6174,7 @@ class MagicShellComponent {
4538
6174
  <ng-template #defaultSpinner>
4539
6175
  <div class="mgSpinnerClass"></div>
4540
6176
  </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"] }]
6177
+ `, 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
6178
  }], () => [{ 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
6179
  type: Optional
4544
6180
  }] }], { rootMagicElementRef: [{
@@ -4553,18 +6189,24 @@ class MagicShellComponent {
4553
6189
  type: HostListener,
4554
6190
  args: ['window:unload', ['$event']]
4555
6191
  }] }); })();
4556
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicShellComponent, { className: "MagicShellComponent", filePath: "src\\ui\\magic-root.component.ts", lineNumber: 85 }); })();
6192
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicShellComponent, { className: "MagicShellComponent", filePath: "src/ui/magic-root.component.ts", lineNumber: 86 }); })();
4557
6193
 
6194
+ /**
6195
+ * @ignore
6196
+ */
4558
6197
  const CHECKBOX_VALUE_ACCESSOR = {
4559
6198
  provide: NG_VALUE_ACCESSOR,
4560
6199
  useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
4561
6200
  multi: true,
4562
6201
  };
6202
+ /**
6203
+ * Value accessor for Checkbox without a FormControl
6204
+ */
4563
6205
  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) {
6206
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicCheckboxControlValueAccessor_BaseFactory; return function MagicCheckboxControlValueAccessor_Factory(__ngFactoryType__) { return (ɵMagicCheckboxControlValueAccessor_BaseFactory || (ɵMagicCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor)))(__ngFactoryType__ || MagicCheckboxControlValueAccessor); }; })();
6207
+ /** @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
6208
  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] });
6209
+ } }, standalone: false, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
4568
6210
  }
4569
6211
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
4570
6212
  type: Directive,
@@ -4575,20 +6217,27 @@ class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
4575
6217
  input[type=checkbox][magic]:not([ngModel])
4576
6218
  `,
4577
6219
  host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
4578
- providers: [CHECKBOX_VALUE_ACCESSOR]
6220
+ providers: [CHECKBOX_VALUE_ACCESSOR],
6221
+ standalone: false
4579
6222
  }]
4580
6223
  }], null, null); })();
4581
6224
 
6225
+ /**
6226
+ * @ignore
6227
+ */
4582
6228
  const MAGIC_DEFAULT_VALUE_ACCESSOR = {
4583
6229
  provide: NG_VALUE_ACCESSOR,
4584
6230
  useExisting: forwardRef(() => MagicDefaultValueAccessor),
4585
6231
  multi: true
4586
6232
  };
6233
+ /**
6234
+ * @ignore
6235
+ */
4587
6236
  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) {
6237
+ /** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicDefaultValueAccessor_BaseFactory; return function MagicDefaultValueAccessor_Factory(__ngFactoryType__) { return (ɵMagicDefaultValueAccessor_BaseFactory || (ɵMagicDefaultValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicDefaultValueAccessor)))(__ngFactoryType__ || MagicDefaultValueAccessor); }; })();
6238
+ /** @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
6239
  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] });
6240
+ } }, exportAs: ["magic"], standalone: false, features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
4592
6241
  }
4593
6242
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDefaultValueAccessor, [{
4594
6243
  type: Directive,
@@ -4604,22 +6253,29 @@ class MagicDefaultValueAccessor extends DefaultValueAccessor {
4604
6253
  '(compositionend)': '$any(this)._compositionEnd($event.target.value)'
4605
6254
  },
4606
6255
  providers: [MAGIC_DEFAULT_VALUE_ACCESSOR],
4607
- exportAs: 'magic'
6256
+ exportAs: 'magic',
6257
+ standalone: false
4608
6258
  }]
4609
6259
  }], null, null); })();
4610
6260
 
6261
+ /**
6262
+ * Directive for checkboxes which should not have a form control
6263
+ */
4611
6264
  class CheckboxNoFormControlMagicDirective {
4612
6265
  magicDirective;
4613
6266
  constructor(magicDirective) {
4614
6267
  this.magicDirective = magicDirective;
4615
6268
  }
6269
+ /**
6270
+ * Handle the 'Checkbox' change event - pass it to the Magic engine
6271
+ */
4616
6272
  onChange($event) {
4617
6273
  this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4618
6274
  }
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) {
6275
+ /** @nocollapse */ static ɵfac = function CheckboxNoFormControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckboxNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
6276
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
4621
6277
  i0.ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4622
- } } });
6278
+ } }, standalone: false });
4623
6279
  }
4624
6280
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
4625
6281
  type: Directive,
@@ -4627,30 +6283,38 @@ class CheckboxNoFormControlMagicDirective {
4627
6283
  selector: `
4628
6284
  input[type=checkbox][magic]:([noFormControl])
4629
6285
  `,
6286
+ standalone: false
4630
6287
  }]
4631
6288
  }], () => [{ type: MagicDirective }], { onChange: [{
4632
6289
  type: HostListener,
4633
6290
  args: ['change', ['$event']]
4634
6291
  }] }); })();
4635
6292
 
6293
+ /**
6294
+ * Directive for non-checkbox input controls which do not have a form control
6295
+ */
4636
6296
  class InputNoFormControlMagicDirective {
4637
6297
  magicDirective;
4638
6298
  constructor(magicDirective) {
4639
6299
  this.magicDirective = magicDirective;
4640
6300
  }
6301
+ /**
6302
+ * Handles the 'change' event - pass it to the Magic engine
6303
+ */
4641
6304
  onChange($event) {
4642
6305
  this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
4643
6306
  }
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) {
6307
+ /** @nocollapse */ static ɵfac = function InputNoFormControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || InputNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
6308
+ /** @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
6309
  i0.ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4647
- } } });
6310
+ } }, standalone: false });
4648
6311
  }
4649
6312
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
4650
6313
  type: Directive,
4651
6314
  args: [{
4652
6315
  selector: `input[magic]:([noFormControl]):not([type=checkbox]),
4653
- textarea[magic]:([noFormControl]):not([type=checkbox])`
6316
+ textarea[magic]:([noFormControl]):not([type=checkbox])`,
6317
+ standalone: false
4654
6318
  }]
4655
6319
  }], () => [{ type: MagicDirective }], { onChange: [{
4656
6320
  type: HostListener,
@@ -4662,6 +6326,14 @@ const DATE_VALUE_ACCESSOR = {
4662
6326
  useExisting: forwardRef(() => DateValueAccessor),
4663
6327
  multi: true
4664
6328
  };
6329
+ /**
6330
+ * The accessor for writing a value and listening to changes on a date input element
6331
+ *
6332
+ * ### Example
6333
+ * `<input type="date" name="birthday" ngModel dateInput>`
6334
+ * OR
6335
+ * `<input type="date" formControlName="birthday" dateInput>`
6336
+ */
4665
6337
  class DateValueAccessor {
4666
6338
  renderer;
4667
6339
  elementRef;
@@ -4680,6 +6352,7 @@ class DateValueAccessor {
4680
6352
  this.magicDir = magicDir;
4681
6353
  this._task = _task;
4682
6354
  }
6355
+ /** Format year, if user enters 2 digits instead of 4 digits as per the century given in Magic.ini file */
4683
6356
  formatDateWithCentury(userInput, century, control) {
4684
6357
  const separator = userInput.includes('/') ? '/' : "-";
4685
6358
  let centuryVal = parseInt(century.toString().slice(0, 2));
@@ -4694,6 +6367,7 @@ class DateValueAccessor {
4694
6367
  year;
4695
6368
  control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
4696
6369
  }
6370
+ /** Writes a new value to the element (model -> view) */
4697
6371
  writeValue(value) {
4698
6372
  if (!value) {
4699
6373
  this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
@@ -4701,27 +6375,31 @@ class DateValueAccessor {
4701
6375
  }
4702
6376
  this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
4703
6377
  }
6378
+ /** Registers a callback function, called when value changes (view -> model) */
4704
6379
  registerOnChange(fn) {
4705
6380
  this.onChange = v => fn(v instanceof Date
4706
6381
  ? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
4707
6382
  : v);
4708
6383
  }
6384
+ /** Registers a callback function, called when the control is blurred */
4709
6385
  registerOnTouched(fn) {
4710
6386
  this.onTouched = fn;
4711
6387
  }
6388
+ /** Enables or disables the element when the control status changes */
4712
6389
  setDisabledState(isDisabled) {
4713
6390
  this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
4714
6391
  }
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) {
6392
+ /** @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)); };
6393
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
4717
6394
  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])] });
6395
+ } }, standalone: false, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
4719
6396
  }
4720
6397
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateValueAccessor, [{
4721
6398
  type: Directive,
4722
6399
  args: [{
4723
6400
  selector: "[dateInput]",
4724
- providers: [DATE_VALUE_ACCESSOR]
6401
+ providers: [DATE_VALUE_ACCESSOR],
6402
+ standalone: false
4725
6403
  }]
4726
6404
  }], () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: MagicDirective }, { type: TaskMagicService }], { onChange: [{
4727
6405
  type: HostListener,
@@ -4734,6 +6412,9 @@ class DateValueAccessor {
4734
6412
  args: ['blur', ['$event']]
4735
6413
  }] }); })();
4736
6414
 
6415
+ /**
6416
+ * 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
6417
+ */
4737
6418
  class NonMagicControlDirective {
4738
6419
  _task;
4739
6420
  element;
@@ -4744,13 +6425,38 @@ class NonMagicControlDirective {
4744
6425
  this.selector = 'NonMagicControl';
4745
6426
  }
4746
6427
  ;
6428
+ /**
6429
+ * The HTML element connected to this directive
6430
+ */
4747
6431
  htmlElement;
6432
+ /**
6433
+ * Magic's component handling this control
6434
+ */
4748
6435
  component;
6436
+ /**
6437
+ * Collection of event handlers for this element
6438
+ */
4749
6439
  eventHandlers = {};
6440
+ /**
6441
+ * Id of this element
6442
+ */
4750
6443
  id;
6444
+ /**
6445
+ * @ignore
6446
+ */
4751
6447
  selector;
6448
+ /**
6449
+ * @ignore
6450
+ */
4752
6451
  subscribeRefreshDom;
4753
6452
  eventsOnlyVal = false;
6453
+ /**
6454
+ *
6455
+ * @param _task The task service
6456
+ * @param element The element for which the directive is applied
6457
+ * @param renderer Renderer for the element
6458
+ * @param vcRef
6459
+ */
4754
6460
  constructor(_task, element, renderer, vcRef) {
4755
6461
  this._task = _task;
4756
6462
  this.element = element;
@@ -4758,29 +6464,44 @@ class NonMagicControlDirective {
4758
6464
  this.vcRef = vcRef;
4759
6465
  this.htmlElement = this.element.nativeElement;
4760
6466
  }
6467
+ /**
6468
+ * Get the task service
6469
+ * @returns
6470
+ */
4761
6471
  get task() {
4762
6472
  return this._task;
4763
6473
  }
6474
+ /**
6475
+ * Register to the events this element may need to handle
6476
+ */
4764
6477
  regEvents() {
6478
+ // Handle events for which event handler may be removed and restored
4765
6479
  this.eventHandlers['focusin'] = this.OnFocus.bind(this);
4766
6480
  Object.keys(this.eventHandlers).forEach((key) => {
4767
6481
  this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
4768
6482
  });
4769
6483
  }
6484
+ /**
6485
+ * Handle focus event
6486
+ */
4770
6487
  OnFocus() {
4771
6488
  this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', '', -1));
4772
6489
  event.cancelBubble = true;
4773
6490
  }
6491
+ /**
6492
+ * Initialize this object
6493
+ */
4774
6494
  ngOnInit() {
4775
6495
  this.regEvents();
4776
6496
  }
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"] } });
6497
+ /** @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)); };
6498
+ /** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: [0, "NonMagicControl", "magic"] }, standalone: false });
4779
6499
  }
4780
6500
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NonMagicControlDirective, [{
4781
6501
  type: Directive,
4782
6502
  args: [{
4783
- selector: '[NonMagicControl]'
6503
+ selector: '[NonMagicControl]',
6504
+ standalone: false
4784
6505
  }]
4785
6506
  }], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }], { magic: [{
4786
6507
  type: Input,
@@ -4808,16 +6529,20 @@ class Time24MagicPipe {
4808
6529
  }
4809
6530
  return value;
4810
6531
  }
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 });
6532
+ /** @nocollapse */ static ɵfac = function Time24MagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Time24MagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
6533
+ /** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true, standalone: false });
4813
6534
  }
4814
6535
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Time24MagicPipe, [{
4815
6536
  type: Pipe,
4816
6537
  args: [{
4817
- name: 'magicTime24'
6538
+ name: 'magicTime24',
6539
+ standalone: false
4818
6540
  }]
4819
6541
  }], () => [{ type: TaskMagicService }], null); })();
4820
6542
 
6543
+ /**
6544
+ * @ignore
6545
+ */
4821
6546
  const decs = [
4822
6547
  MagicDirective,
4823
6548
  CheckboxMagicDirective,
@@ -4849,30 +6574,33 @@ const decs = [
4849
6574
  MagicViewContainerRef,
4850
6575
  Time24MagicPipe
4851
6576
  ];
6577
+ /**
6578
+ * @ignore
6579
+ */
4852
6580
  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,
6581
+ /** @nocollapse */ static ɵfac = function MagicModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicModule)(); };
6582
+ /** @nocollapse */ static ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: MagicModule });
6583
+ /** @nocollapse */ static ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider, provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
4856
6584
  FormsModule,
4857
6585
  ReactiveFormsModule,
4858
6586
  RouterModule,
4859
6587
  DynamicModule,
4860
- HttpClientModule, MaskitoModule] });
6588
+ DragDropModule, MaskitoModule] });
4861
6589
  }
4862
6590
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicModule, [{
4863
6591
  type: NgModule,
4864
6592
  args: [{
4865
6593
  declarations: [...decs],
4866
6594
  exports: [...decs, MaskitoModule],
4867
- imports: [
4868
- CommonModule,
6595
+ imports: [CommonModule,
4869
6596
  FormsModule,
4870
6597
  ReactiveFormsModule,
4871
6598
  RouterModule,
4872
6599
  DynamicModule,
4873
- HttpClientModule
4874
- ],
4875
- providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
6600
+ CdkDragHandle,
6601
+ CdkDrag,
6602
+ DragDropModule],
6603
+ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider, provideHttpClient(withInterceptorsFromDi())]
4876
6604
  }]
4877
6605
  }], null, null); })();
4878
6606
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MagicModule, { declarations: [MagicDirective,
@@ -4908,7 +6636,9 @@ class MagicModule {
4908
6636
  ReactiveFormsModule,
4909
6637
  RouterModule,
4910
6638
  DynamicModule,
4911
- HttpClientModule], exports: [MagicDirective,
6639
+ CdkDragHandle,
6640
+ CdkDrag,
6641
+ DragDropModule], exports: [MagicDirective,
4912
6642
  CheckboxMagicDirective,
4913
6643
  CheckboxNoFormControlMagicDirective,
4914
6644
  InputNoFormControlMagicDirective,
@@ -5023,15 +6753,15 @@ class MgDateAdapter extends NativeDateAdapter {
5023
6753
  this.mgdtfmt = this.task.mgInputDateFormat;
5024
6754
  if (displayFormat === 'input') {
5025
6755
  if (this.mgdtfmt == null)
5026
- this.mgdtfmt = 'M/d/yyyy';
6756
+ this.mgdtfmt = 'M/d/yyyy'; //default format
5027
6757
  return formatDate(date, this.mgdtfmt, this.locale);
5028
6758
  }
5029
6759
  else {
5030
6760
  return date.toDateString();
5031
6761
  }
5032
6762
  }
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 });
6763
+ /** @nocollapse */ static ɵfac = function MgDateAdapter_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MgDateAdapter)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MAT_DATE_LOCALE)); };
6764
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
5035
6765
  }
5036
6766
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgDateAdapter, [{
5037
6767
  type: Injectable
@@ -5044,6 +6774,9 @@ const matDateProviders = [
5044
6774
  { provide: DateAdapter, useClass: MgDateAdapter },
5045
6775
  { provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
5046
6776
  ];
6777
+ /**
6778
+ * Magic service providers
6779
+ */
5047
6780
  const basicMagicProviders = [
5048
6781
  MagicServices,
5049
6782
  TaskMagicService,
@@ -5057,7 +6790,16 @@ const magicProviders = [
5057
6790
  TableMagicService
5058
6791
  ];
5059
6792
 
6793
+ /**
6794
+ * @ignore
6795
+ */
6796
+ ///////////////////////////////////////////////////////////
6797
+ // class to hold gui-related helper methods
6798
+ ///////////////////////////////////////////////////////////
5060
6799
  class utils {
6800
+ ///////////////////////////////////////////////////////////
6801
+ // Calculate the distance between the control and the supplied x,y coordinates
6802
+ ///////////////////////////////////////////////////////////
5061
6803
  static getDistance(control, x, y) {
5062
6804
  let left = control.clientLeft, top = control.clientTop;
5063
6805
  let dx, dy;
@@ -5084,6 +6826,9 @@ class utils {
5084
6826
  const ret = (dx * dx + dy * dy);
5085
6827
  return ret;
5086
6828
  }
6829
+ ///////////////////////////////////////////////////////////
6830
+ //
6831
+ ///////////////////////////////////////////////////////////
5087
6832
  static getDimentions(el) {
5088
6833
  let xPos = 0;
5089
6834
  let yPos = 0;
@@ -5091,12 +6836,14 @@ class utils {
5091
6836
  let height = el.height;
5092
6837
  while (el) {
5093
6838
  if (el.tagName == "BODY") {
6839
+ // deal with browser quirks with body/window/document and page scroll
5094
6840
  let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
5095
6841
  let yScroll = el.scrollTop || document.documentElement.scrollTop;
5096
6842
  xPos += (el.offsetLeft - xScroll + el.clientLeft);
5097
6843
  yPos += (el.offsetTop - yScroll + el.clientTop);
5098
6844
  }
5099
6845
  else {
6846
+ // for all other non-BODY elements
5100
6847
  xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
5101
6848
  yPos += (el.offsetTop - el.scrollTop + el.clientTop);
5102
6849
  }
@@ -5111,11 +6858,22 @@ class utils {
5111
6858
  }
5112
6859
  }
5113
6860
 
6861
+ /**
6862
+ * @ignore
6863
+ */
5114
6864
  class ModalFormDefinition {
5115
6865
  taskId = "";
5116
6866
  comp = null;
5117
6867
  parameters = {};
5118
6868
  }
5119
6869
 
6870
+ /**
6871
+ * @file Automatically generated by barrelsby.
6872
+ */
6873
+
6874
+ /**
6875
+ * Generated bundle index. Do not edit.
6876
+ */
6877
+
5120
6878
  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
6879
  //# sourceMappingURL=magic-xpa-angular.mjs.map