@magic-xpa/angular 4.1100.0-dev4110.99 → 4.1101.0-dev4111.269

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 (170) hide show
  1. package/README.md +5 -5
  2. package/{esm2020 → esm2022}/index.mjs +59 -59
  3. package/{esm2020 → esm2022}/magic-xpa-angular.mjs +1 -1
  4. package/esm2022/src/controls.metadata.model.mjs +183 -0
  5. package/{esm2020 → esm2022}/src/interfaces/sub-form-definition.iterface.mjs +1 -1
  6. package/{esm2020 → esm2022}/src/magic.core.module.mjs +159 -160
  7. package/{esm2020 → esm2022}/src/services/ISubformMagicService.mjs +1 -1
  8. package/esm2022/src/services/OverlayWindowService.mjs +245 -0
  9. package/esm2022/src/services/StylesMapManager.mjs +28 -0
  10. package/esm2022/src/services/accessor.magic.service.mjs +358 -0
  11. package/esm2022/src/services/commands-collector.magic.service.mjs +47 -0
  12. package/esm2022/src/services/component-list.magic.service.mjs +45 -0
  13. package/{esm2020 → esm2022}/src/services/confirmation.components.magic.provider.mjs +21 -21
  14. package/esm2022/src/services/engine.magic.service.mjs +80 -0
  15. package/{esm2020 → esm2022}/src/services/exit.magic.service.mjs +13 -13
  16. package/esm2022/src/services/magic-color.service.mjs +101 -0
  17. package/{esm2020 → esm2022}/src/services/magic.lazy.loader.service.mjs +16 -16
  18. package/{esm2020 → esm2022}/src/services/magic.providers.mjs +24 -24
  19. package/esm2022/src/services/magic.services.mjs +36 -0
  20. package/esm2022/src/services/mg-date-adapter.mjs +108 -0
  21. package/{esm2020 → esm2022}/src/services/overlay.conainer.magic.provider.mjs +14 -14
  22. package/esm2022/src/services/router-commands.magic.service.mjs +31 -0
  23. package/esm2022/src/services/subform.magic.service.mjs +195 -0
  24. package/esm2022/src/services/table.magic.service.mjs +81 -0
  25. package/esm2022/src/services/task.magics.service.mjs +648 -0
  26. package/esm2022/src/services/title.magic.service.mjs +19 -0
  27. package/esm2022/src/ui/GuiInteractiveExecutor.mjs +114 -0
  28. package/esm2022/src/ui/components/base-magic-alert.component.mjs +24 -0
  29. package/esm2022/src/ui/components/base-magic-confirm.component.mjs +24 -0
  30. package/esm2022/src/ui/components/magic-alert.component.mjs +36 -0
  31. package/esm2022/src/ui/components/magic-confirmation-box.component.mjs +42 -0
  32. package/esm2022/src/ui/directives/NonMagicControlDirective.mjs +58 -0
  33. package/esm2022/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.mjs +29 -0
  34. package/esm2022/src/ui/directives/magic/checkbox.magic.directive.mjs +100 -0
  35. package/esm2022/src/ui/directives/magic/combobox.magic.directive.mjs +37 -0
  36. package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.mjs +27 -0
  37. package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +85 -0
  38. package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.mjs +32 -0
  39. package/esm2022/src/ui/directives/magic/input.noformcontrol.magic.directive.mjs +28 -0
  40. package/{esm2020 → esm2022}/src/ui/directives/magic/nocontrol.magic.directive.mjs +193 -193
  41. package/esm2022/src/ui/directives/magic/row.magic.directive.mjs +62 -0
  42. package/esm2022/src/ui/directives/magic-focus.directive.mjs +20 -0
  43. package/esm2022/src/ui/directives/magic.directive.mjs +232 -0
  44. package/esm2022/src/ui/directives/magicViewContainerRef.directive.mjs +20 -0
  45. package/esm2022/src/ui/directives/mgformat.magic.directive.mjs +579 -0
  46. package/esm2022/src/ui/directives/range-validator.magic.directive.mjs +60 -0
  47. package/{esm2020 → esm2022}/src/ui/magic-confirmationBox.mjs +41 -41
  48. package/{esm2020 → esm2022}/src/ui/magic-modal/base-magic-overlay-container.mjs +22 -22
  49. package/esm2022/src/ui/magic-modal/magic-modal-form.mjs +6 -0
  50. package/{esm2020 → esm2022}/src/ui/magic-modal/magic-modal-interface.mjs +1 -1
  51. package/esm2022/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +125 -0
  52. package/esm2022/src/ui/magic-modal/magic-overlay-container.mjs +162 -0
  53. package/esm2022/src/ui/magic-root.component.mjs +236 -0
  54. package/esm2022/src/ui/mgerror.magic.component.mjs +125 -0
  55. package/esm2022/src/ui/pipes/date.magic.pipe.mjs +106 -0
  56. package/esm2022/src/ui/pipes/time.magic.pipe.mjs +52 -0
  57. package/esm2022/src/ui/pipes/time24.magic.pipe.mjs +35 -0
  58. package/esm2022/src/ui/router-container.magic.component.mjs +115 -0
  59. package/{esm2020 → esm2022}/src/ui/subform.magic.component.mjs +50 -46
  60. package/esm2022/src/ui/task-base.magic.component.mjs +91 -0
  61. package/{esm2020 → esm2022}/src/ui/utils.mjs +53 -53
  62. package/{fesm2020 → fesm2022}/magic-xpa-angular.mjs +4933 -4495
  63. package/fesm2022/magic-xpa-angular.mjs.map +1 -0
  64. package/index.d.ts +58 -58
  65. package/package.json +10 -16
  66. package/src/controls.metadata.model.d.ts +62 -62
  67. package/src/interfaces/sub-form-definition.iterface.d.ts +12 -12
  68. package/src/magic.core.module.d.ts +41 -41
  69. package/src/services/ISubformMagicService.d.ts +4 -4
  70. package/src/services/OverlayWindowService.d.ts +30 -31
  71. package/src/services/StylesMapManager.d.ts +5 -5
  72. package/src/services/accessor.magic.service.d.ts +69 -69
  73. package/src/services/commands-collector.magic.service.d.ts +15 -15
  74. package/src/services/component-list.magic.service.d.ts +23 -23
  75. package/src/services/confirmation.components.magic.provider.d.ts +8 -8
  76. package/src/services/engine.magic.service.d.ts +27 -27
  77. package/src/services/exit.magic.service.d.ts +6 -6
  78. package/src/services/magic-color.service.d.ts +19 -19
  79. package/src/services/magic.lazy.loader.service.d.ts +6 -6
  80. package/src/services/magic.providers.d.ts +107 -107
  81. package/src/services/magic.services.d.ts +16 -16
  82. package/src/services/mg-date-adapter.d.ts +38 -40
  83. package/src/services/overlay.conainer.magic.provider.d.ts +7 -7
  84. package/src/services/router-commands.magic.service.d.ts +17 -17
  85. package/src/services/subform.magic.service.d.ts +43 -43
  86. package/src/services/table.magic.service.d.ts +30 -30
  87. package/src/services/task.magics.service.d.ts +100 -100
  88. package/src/services/title.magic.service.d.ts +9 -9
  89. package/src/ui/GuiInteractiveExecutor.d.ts +22 -22
  90. package/src/ui/components/base-magic-alert.component.d.ts +10 -10
  91. package/src/ui/components/base-magic-confirm.component.d.ts +10 -10
  92. package/src/ui/components/magic-alert.component.d.ts +6 -6
  93. package/src/ui/components/magic-confirmation-box.component.d.ts +6 -6
  94. package/src/ui/directives/NonMagicControlDirective.d.ts +26 -26
  95. package/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.d.ts +9 -9
  96. package/src/ui/directives/magic/checkbox.magic.directive.d.ts +22 -9
  97. package/src/ui/directives/magic/combobox.magic.directive.d.ts +10 -10
  98. package/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.d.ts +7 -7
  99. package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +23 -17
  100. package/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.d.ts +7 -7
  101. package/src/ui/directives/magic/input.noformcontrol.magic.directive.d.ts +9 -9
  102. package/src/ui/directives/magic/nocontrol.magic.directive.d.ts +18 -18
  103. package/src/ui/directives/magic/row.magic.directive.d.ts +17 -17
  104. package/src/ui/directives/magic-focus.directive.d.ts +9 -9
  105. package/src/ui/directives/magic.directive.d.ts +45 -44
  106. package/src/ui/directives/magicViewContainerRef.directive.d.ts +8 -8
  107. package/src/ui/directives/mgformat.magic.directive.d.ts +38 -31
  108. package/src/ui/directives/range-validator.magic.directive.d.ts +17 -17
  109. package/src/ui/magic-confirmationBox.d.ts +6 -6
  110. package/src/ui/magic-modal/base-magic-overlay-container.d.ts +5 -5
  111. package/src/ui/magic-modal/magic-modal-form.d.ts +5 -5
  112. package/src/ui/magic-modal/magic-modal-interface.d.ts +10 -10
  113. package/src/ui/magic-modal/magic-overlay-container-wrapper.d.ts +30 -31
  114. package/src/ui/magic-modal/magic-overlay-container.d.ts +24 -25
  115. package/src/ui/magic-root.component.d.ts +43 -40
  116. package/src/ui/mgerror.magic.component.d.ts +20 -20
  117. package/src/ui/pipes/date.magic.pipe.d.ts +17 -17
  118. package/src/ui/pipes/time.magic.pipe.d.ts +11 -11
  119. package/src/ui/pipes/time24.magic.pipe.d.ts +10 -10
  120. package/src/ui/router-container.magic.component.d.ts +29 -30
  121. package/src/ui/subform.magic.component.d.ts +16 -16
  122. package/src/ui/task-base.magic.component.d.ts +34 -34
  123. package/src/ui/utils.d.ts +9 -9
  124. package/esm2020/src/controls.metadata.model.mjs +0 -180
  125. package/esm2020/src/services/OverlayWindowService.mjs +0 -236
  126. package/esm2020/src/services/StylesMapManager.mjs +0 -28
  127. package/esm2020/src/services/accessor.magic.service.mjs +0 -356
  128. package/esm2020/src/services/commands-collector.magic.service.mjs +0 -46
  129. package/esm2020/src/services/component-list.magic.service.mjs +0 -46
  130. package/esm2020/src/services/engine.magic.service.mjs +0 -82
  131. package/esm2020/src/services/magic-color.service.mjs +0 -99
  132. package/esm2020/src/services/magic.services.mjs +0 -31
  133. package/esm2020/src/services/mg-date-adapter.mjs +0 -109
  134. package/esm2020/src/services/router-commands.magic.service.mjs +0 -28
  135. package/esm2020/src/services/subform.magic.service.mjs +0 -184
  136. package/esm2020/src/services/table.magic.service.mjs +0 -77
  137. package/esm2020/src/services/task.magics.service.mjs +0 -624
  138. package/esm2020/src/services/title.magic.service.mjs +0 -18
  139. package/esm2020/src/ui/GuiInteractiveExecutor.mjs +0 -105
  140. package/esm2020/src/ui/components/base-magic-alert.component.mjs +0 -23
  141. package/esm2020/src/ui/components/base-magic-confirm.component.mjs +0 -23
  142. package/esm2020/src/ui/components/magic-alert.component.mjs +0 -35
  143. package/esm2020/src/ui/components/magic-confirmation-box.component.mjs +0 -41
  144. package/esm2020/src/ui/directives/NonMagicControlDirective.mjs +0 -49
  145. package/esm2020/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.mjs +0 -28
  146. package/esm2020/src/ui/directives/magic/checkbox.magic.directive.mjs +0 -28
  147. package/esm2020/src/ui/directives/magic/combobox.magic.directive.mjs +0 -36
  148. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.mjs +0 -27
  149. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +0 -52
  150. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.mjs +0 -32
  151. package/esm2020/src/ui/directives/magic/input.noformcontrol.magic.directive.mjs +0 -27
  152. package/esm2020/src/ui/directives/magic/row.magic.directive.mjs +0 -58
  153. package/esm2020/src/ui/directives/magic-focus.directive.mjs +0 -19
  154. package/esm2020/src/ui/directives/magic.directive.mjs +0 -215
  155. package/esm2020/src/ui/directives/magicViewContainerRef.directive.mjs +0 -19
  156. package/esm2020/src/ui/directives/mgformat.magic.directive.mjs +0 -408
  157. package/esm2020/src/ui/directives/range-validator.magic.directive.mjs +0 -58
  158. package/esm2020/src/ui/magic-modal/magic-modal-form.mjs +0 -8
  159. package/esm2020/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +0 -121
  160. package/esm2020/src/ui/magic-modal/magic-overlay-container.mjs +0 -159
  161. package/esm2020/src/ui/magic-root.component.mjs +0 -203
  162. package/esm2020/src/ui/mgerror.magic.component.mjs +0 -119
  163. package/esm2020/src/ui/pipes/date.magic.pipe.mjs +0 -105
  164. package/esm2020/src/ui/pipes/time.magic.pipe.mjs +0 -51
  165. package/esm2020/src/ui/pipes/time24.magic.pipe.mjs +0 -34
  166. package/esm2020/src/ui/router-container.magic.component.mjs +0 -108
  167. package/esm2020/src/ui/task-base.magic.component.mjs +0 -86
  168. package/fesm2015/magic-xpa-angular.mjs +0 -4865
  169. package/fesm2015/magic-xpa-angular.mjs.map +0 -1
  170. package/fesm2020/magic-xpa-angular.mjs.map +0 -1
@@ -1,4865 +0,0 @@
1
- import { isNullOrUndefined, NString, List, isUndefined, StringBuilder, RefParam } from '@magic-xpa/mscorelib';
2
- import * as i0 from '@angular/core';
3
- import { Injectable, Component, Input, Output, EventEmitter, Directive, ViewChild, InjectionToken, Inject, HostListener, Optional, Pipe, forwardRef, NgModule } from '@angular/core';
4
- import * as i1 from '@angular/common';
5
- import { DatePipe, CommonModule, formatDate } from '@angular/common';
6
- import * as i2 from '@angular/router';
7
- import { RouterModule } from '@angular/router';
8
- import { FormGroup, FormControl, Validators, NG_VALIDATORS, NG_VALUE_ACCESSOR, CheckboxControlValueAccessor, DefaultValueAccessor, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
- import * as i3 from 'ng-dynamic-component';
10
- import { DynamicModule } from 'ng-dynamic-component';
11
- import { InteractiveCommandType, OverlayType, Styles, HtmlProperties, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
12
- import { MagicBridge, getGuiEventObj, CookieService } from '@magic-xpa/engine';
13
- import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
14
- import { filter, map, debounceTime } from 'rxjs/operators';
15
- import { Subject, fromEvent } from 'rxjs';
16
- import { __awaiter, __decorate, __metadata } from 'tslib';
17
- import * as i1$1 from '@angular/platform-browser';
18
- import { maskitoTimeOptionsGenerator } from '@maskito/kit';
19
- import * as i1$2 from '@angular/common/http';
20
- import { HttpClientModule } from '@angular/common/http';
21
- import * as i2$1 from '@angular/cdk/platform';
22
- import { MaskitoModule } from '@maskito/angular';
23
- import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
24
-
25
- class ControlMetadata {
26
- constructor() {
27
- this.properties = new Map();
28
- this.classesMap = new Map();
29
- this.stylesMap = new Map();
30
- this.userProperties = new Map();
31
- this.customValidators = new Map();
32
- }
33
- setClass(key, value) {
34
- if (this.classesMap.has(key)) {
35
- this.removedClass = this.classesMap.get(key);
36
- }
37
- this.classesMap.set(key, value);
38
- let result = '';
39
- for (let value of this.classesMap) {
40
- result += value + ' ';
41
- }
42
- this.classes = result;
43
- }
44
- setStyle(key, value) {
45
- this.stylesMap.set(key, value);
46
- }
47
- }
48
- class ControlsMetadata {
49
- constructor() {
50
- this.values = new Map();
51
- this.ControlsProperties = new Map();
52
- this.isCreated = false;
53
- this.isEditing = false;
54
- }
55
- get Values() {
56
- return this.values;
57
- }
58
- getControlMetadata(controlId) {
59
- if (!this.ControlsProperties.has(controlId))
60
- this.ControlsProperties.set(controlId, new ControlMetadata());
61
- return this.ControlsProperties.get(controlId);
62
- }
63
- update(obj) {
64
- let props = obj.ControlsMetaData;
65
- for (let controlName in props) {
66
- if (!this.ControlsProperties.has(controlName))
67
- this.ControlsProperties.set(controlName, new ControlMetadata());
68
- let controlMetaData = this.ControlsProperties.get(controlName);
69
- for (let property in obj.ControlsMetaData[controlName].Properties)
70
- controlMetaData[property] = obj.ControlsMetaData[controlName].Properties[property];
71
- controlMetaData.controlType = obj.ControlsMetaData[controlName].Type;
72
- }
73
- for (let controlName in obj.ControlsValues) {
74
- this.setValue(controlName, obj.ControlsValues[controlName]);
75
- }
76
- }
77
- setValue(controlName, value) {
78
- this.values.set(controlName, value);
79
- }
80
- getProperty(controlId, prop) {
81
- if (this.ControlsProperties.has(controlId)) {
82
- if (this.ControlsProperties.get(controlId).properties.has(prop)) {
83
- return this.ControlsProperties.get(controlId).properties.get(prop);
84
- }
85
- }
86
- return "";
87
- }
88
- getValue(controlName) {
89
- return this.values.get(controlName);
90
- }
91
- }
92
- class Records {
93
- constructor() {
94
- this.data = new Map();
95
- this.list = [];
96
- this.recordsBeforeCurrentView = 0;
97
- this.isEmptyDataView = false;
98
- this.sizeUpdated = false;
99
- }
100
- getRow(dvRowId) {
101
- return this.list[dvRowId + this.recordsBeforeCurrentView];
102
- }
103
- markRowAsCreated(guiRowId) {
104
- if (guiRowId < this.list.length) {
105
- this.addRow(guiRowId);
106
- this.data.get(guiRowId).isCreated = true;
107
- }
108
- }
109
- markRowAsNotCreated(guiRowId) {
110
- if (guiRowId < this.list.length)
111
- this.data.get(guiRowId).isCreated = false;
112
- }
113
- isRowCreated(guiRowId) {
114
- if (guiRowId < this.list.length) {
115
- if (!this.data.has(guiRowId) || isNullOrUndefined(this.data.get(guiRowId)))
116
- return false;
117
- else
118
- return this.data.get(guiRowId).isCreated;
119
- }
120
- return false;
121
- }
122
- startRowEditing(guiRowId) {
123
- if (guiRowId < this.list.length && this.data.has(guiRowId))
124
- this.data.get(guiRowId).isEditing = true;
125
- }
126
- stopRowEditing(guiRowId) {
127
- if (guiRowId < this.list.length && this.data.has(guiRowId))
128
- this.data.get(guiRowId).isEditing = false;
129
- }
130
- isRowInRowEditing(guiRowId) {
131
- if (+guiRowId < this.list.length) {
132
- if (!this.data.has(+guiRowId) || isNullOrUndefined(this.data.get(+guiRowId)))
133
- return false;
134
- else
135
- return this.data.get(+guiRowId).isEditing;
136
- }
137
- return false;
138
- }
139
- update(obj) {
140
- if (obj.fullRefresh && obj.rows.length != this.list.length) {
141
- this.data = new Map();
142
- this.list = new Array();
143
- }
144
- for (let rowId in obj.rows) {
145
- if (!this.data.has(+rowId) || this.data.get(+rowId) === null)
146
- this.data.set(+rowId, new ControlsMetadata());
147
- let controlsData = this.data.get(+rowId);
148
- controlsData.update(obj.rows[rowId]);
149
- controlsData.rowId = rowId;
150
- }
151
- for (var [key, value] of this.data) {
152
- this.list[key] = value;
153
- }
154
- }
155
- updateSize(len) {
156
- if (this.list.length != len) {
157
- if (len < this.list.length) {
158
- for (let i = len; i < this.list.length; i++) {
159
- this.data.delete(i);
160
- }
161
- }
162
- this.list.length = len;
163
- this.sizeUpdated = true;
164
- }
165
- }
166
- clearFirstTableRecord(template) {
167
- if (this.list.length >= 1) {
168
- for (const key in template) {
169
- if (template[key] == '1' && this.list[0].ControlsProperties.has(key)) {
170
- this.list[0].ControlsProperties.get(key).properties = new Map();
171
- }
172
- }
173
- }
174
- }
175
- addRow(guiRowId) {
176
- if (guiRowId !== 0 || !this.data.has(guiRowId) || isNullOrUndefined(this.data.get(guiRowId))) {
177
- this.data.set(guiRowId, new ControlsMetadata());
178
- this.data.get(guiRowId).rowId = "" + guiRowId;
179
- this.list[guiRowId] = this.data.get(guiRowId);
180
- }
181
- }
182
- createFirst() {
183
- this.addRow(0);
184
- }
185
- fromJson(data) {
186
- var obj = JSON.parse(data);
187
- this.update(obj);
188
- }
189
- setGuiTopIndex(topIndex) {
190
- this.guiTopIndex = topIndex;
191
- }
192
- getGuiTopIndex() {
193
- return this.guiTopIndex;
194
- }
195
- }
196
- var HtmlClasses;
197
- (function (HtmlClasses) {
198
- HtmlClasses["Color"] = "color";
199
- HtmlClasses["font"] = "font";
200
- HtmlClasses["FocusColor"] = "focuscolor";
201
- HtmlClasses["HintColor"] = "hintcolor";
202
- })(HtmlClasses || (HtmlClasses = {}));
203
-
204
- class StylesMapManager {
205
- static magicValueGetStyle(styleName, magicValue) {
206
- let style = "";
207
- if (!isNullOrUndefined(magicValue)) {
208
- let value = StylesMapManager.StylesMap.get(styleName);
209
- if (value.constructor === Map) {
210
- style = value.get(magicValue);
211
- }
212
- else if (value.constructor === String) {
213
- style = NString.Format(value.toString(), magicValue);
214
- }
215
- }
216
- return style;
217
- }
218
- }
219
- StylesMapManager.StylesMap = new Map([
220
- [MagicProperties.LineDivider, new Map([[true, "solid"], [false, "hidden"]])],
221
- [MagicProperties.ImageFile, "url('\{0}\')"],
222
- [MagicProperties.Wallpaper, "url('\{0}\')"]
223
- ]);
224
- StylesMapManager.MagicPropertyToHtmlAttributeMap = new Map([
225
- [MagicProperties.LineDivider, "border-bottom-style"],
226
- [MagicProperties.ImageFile, "background-image"],
227
- [MagicProperties.Wallpaper, "background-image"]
228
- ]);
229
-
230
- class ComponentListMagicService {
231
- constructor() {
232
- this.components = new Map();
233
- this.dialogs = new Map();
234
- this.lazyLoadModulesMap = null;
235
- }
236
- getData(name, mustHaveData) {
237
- let data = null;
238
- let haveData = this.components.has(name);
239
- if (!haveData && mustHaveData) {
240
- console.log("Error: Component: " + name + " does not exist in components map");
241
- }
242
- if (haveData)
243
- data = this.components.get(name);
244
- return data;
245
- }
246
- getComponent(name, mustHaveData = true) {
247
- let data = this.getData(name, mustHaveData);
248
- return data ? data.component : null;
249
- }
250
- addComponents(componentList, modulRef) {
251
- for (let key in componentList) {
252
- let data = { moduleRef: modulRef, component: componentList[key] };
253
- this.components.set(key, data);
254
- }
255
- }
256
- getModuleRef(name) {
257
- let data = this.getData(name, false);
258
- return data ? data.moduleRef : null;
259
- ;
260
- }
261
- getLazyLoadModuleData(name) {
262
- return (this.lazyLoadModulesMap != null && this.lazyLoadModulesMap.hasOwnProperty(name)) ? this.lazyLoadModulesMap[name] : null;
263
- }
264
- }
265
- ComponentListMagicService.ɵfac = function ComponentListMagicService_Factory(t) { return new (t || ComponentListMagicService)(); };
266
- ComponentListMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: ComponentListMagicService, factory: ComponentListMagicService.ɵfac, providedIn: 'root' });
267
- (function () {
268
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComponentListMagicService, [{
269
- type: Injectable,
270
- args: [{
271
- providedIn: 'root'
272
- }]
273
- }], null, null);
274
- })();
275
-
276
- class EngineMagicService {
277
- constructor() {
278
- this.magicBridge = MagicBridge;
279
- this.isStub = false;
280
- this.isLoggedIn = false;
281
- this.refreshDom = new Subject();
282
- this.interactiveCommands = new Subject();
283
- }
284
- startMagicEngine(httpClient) {
285
- this.magicBridge.registerExecuteCommandsCallback(data => {
286
- if (!this.isStub) {
287
- try {
288
- const list = data;
289
- for (let c of list) {
290
- this.refreshDom.next(c);
291
- }
292
- }
293
- catch (e) {
294
- console.dir(e);
295
- console.log('magic engine not found');
296
- console.log('moving to stub mode');
297
- this.isStub = true;
298
- }
299
- }
300
- });
301
- this.magicBridge.registerInteractiveCallback(data => {
302
- if (!this.isStub) {
303
- this.interactiveCommands.next(data);
304
- }
305
- });
306
- this.magicBridge.Initialize(httpClient);
307
- }
308
- terminateMagic() {
309
- return __awaiter(this, void 0, void 0, function* () {
310
- yield this.magicBridge.TerminateMagic();
311
- });
312
- }
313
- insertEvent(guiEvent) {
314
- if (!this.isStub)
315
- this.magicBridge.insertEvent(guiEvent);
316
- }
317
- GetRangedValue(taskId, controlName, value) {
318
- return this.magicBridge.GetRangedValue(taskId, controlName, value);
319
- }
320
- GetControlPictureMask(taskId, controlName) {
321
- return this.magicBridge.GetControlPictureMask(taskId, controlName);
322
- }
323
- GetFormattedValue(taskId, controlName, value, rowId) {
324
- return this.magicBridge.GetFormattedValue(taskId, controlName, value, rowId);
325
- }
326
- ValidateControlValue(taskId, controlName, value) {
327
- return this.magicBridge.ValidateControlValue(taskId, controlName, value);
328
- }
329
- GetFldRanges(taskId, controlName) {
330
- return this.magicBridge.GetFldRanges(taskId, controlName);
331
- }
332
- saveData(data) {
333
- }
334
- getIsLoggedIn() {
335
- return this.isLoggedIn;
336
- }
337
- setIsLoggedIn(setIsLoggedIn) {
338
- this.isLoggedIn = setIsLoggedIn;
339
- }
340
- TransCacheExists() {
341
- return this.magicBridge.TransCacheExists();
342
- }
343
- TerminateContextUsingFetchAPI() {
344
- this.magicBridge.TerminateContextUsingFetchAPI();
345
- }
346
- }
347
- EngineMagicService.ɵfac = function EngineMagicService_Factory(t) { return new (t || EngineMagicService)(); };
348
- EngineMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac, providedIn: 'root' });
349
- (function () {
350
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EngineMagicService, [{
351
- type: Injectable,
352
- args: [{
353
- providedIn: 'root'
354
- }]
355
- }], null, null);
356
- })();
357
-
358
- class CommandsCollectorMagicService {
359
- constructor(magic) {
360
- this.magic = magic;
361
- this.count = 0;
362
- this.commands = new List();
363
- this.subscription = null;
364
- }
365
- startCollecting() {
366
- this.count++;
367
- Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.startCollecting() --- " + this.count);
368
- if (this.subscription === null) {
369
- this.subscription = this.magic.refreshDom
370
- .subscribe(command => {
371
- this.commands.push(command);
372
- });
373
- }
374
- }
375
- stopCollecting() {
376
- this.count--;
377
- Logger.Instance.WriteDevToLog("CommandsCollectorMagicService.stopCollecting() --- " + this.count);
378
- if (this.count === 0) {
379
- this.subscription.unsubscribe();
380
- this.subscription = null;
381
- }
382
- }
383
- GetCommands(taskId) {
384
- const commands = this.commands.filter((command) => command.TaskTag === taskId);
385
- commands.forEach(command => { this.commands.Remove(command); });
386
- return commands;
387
- }
388
- }
389
- CommandsCollectorMagicService.ɵfac = function CommandsCollectorMagicService_Factory(t) { return new (t || CommandsCollectorMagicService)(i0.ɵɵinject(EngineMagicService)); };
390
- CommandsCollectorMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac, providedIn: 'root' });
391
- (function () {
392
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CommandsCollectorMagicService, [{
393
- type: Injectable,
394
- args: [{
395
- providedIn: 'root'
396
- }]
397
- }], function () { return [{ type: EngineMagicService }]; }, null);
398
- })();
399
-
400
- class RouteCommand {
401
- }
402
- class RouterCommandsMagicService {
403
- constructor() {
404
- this.pendingRouteCommands = [];
405
- }
406
- AddRouteCommand(routeCommand) {
407
- this.pendingRouteCommands.push(routeCommand);
408
- }
409
- ExecuteNextCommand() {
410
- let pendingRouteCommand = this.pendingRouteCommands.shift();
411
- if (!isNullOrUndefined(pendingRouteCommand)) {
412
- pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
413
- }
414
- }
415
- }
416
- RouterCommandsMagicService.ɵfac = function RouterCommandsMagicService_Factory(t) { return new (t || RouterCommandsMagicService)(); };
417
- RouterCommandsMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac, providedIn: 'root' });
418
- (function () {
419
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouterCommandsMagicService, [{
420
- type: Injectable,
421
- args: [{
422
- providedIn: 'root'
423
- }]
424
- }], null, null);
425
- })();
426
-
427
- class MagicLazyLoaderService {
428
- Load(path) {
429
- return Promise.reject('error in loading module :' + path);
430
- }
431
- }
432
- MagicLazyLoaderService.ɵfac = function MagicLazyLoaderService_Factory(t) { return new (t || MagicLazyLoaderService)(); };
433
- MagicLazyLoaderService.ɵprov = i0.ɵɵdefineInjectable({ token: MagicLazyLoaderService, factory: MagicLazyLoaderService.ɵfac, providedIn: 'root' });
434
- (function () {
435
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicLazyLoaderService, [{
436
- type: Injectable,
437
- args: [{
438
- providedIn: 'root'
439
- }]
440
- }], null, null);
441
- })();
442
-
443
- class SubformMagicService {
444
- constructor(task, activatedRoute, componentList, pendingCommandsCollector, router, routerCommandsMagicService, componentListMagicService, loader, injector, compiler) {
445
- this.task = task;
446
- this.activatedRoute = activatedRoute;
447
- this.componentList = componentList;
448
- this.pendingCommandsCollector = pendingCommandsCollector;
449
- this.router = router;
450
- this.routerCommandsMagicService = routerCommandsMagicService;
451
- this.componentListMagicService = componentListMagicService;
452
- this.loader = loader;
453
- this.injector = injector;
454
- this.compiler = compiler;
455
- this.subformsDict = {};
456
- this.routesDict = {};
457
- this.currentRouteDefinition = null;
458
- }
459
- mgGetComp(subformName) {
460
- if (subformName in this.subformsDict) {
461
- let formName = this.subformsDict[subformName].formName;
462
- if (formName)
463
- return this.componentList.getComponent(formName);
464
- }
465
- return null;
466
- }
467
- mgGetParameters(subformName) {
468
- if (subformName in this.subformsDict) {
469
- return this.subformsDict[subformName].parameters;
470
- }
471
- else
472
- return '';
473
- }
474
- deleteSubformComp(subformControlName, formName) {
475
- if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
476
- if (this.subformsDict[subformControlName].formName === formName) {
477
- this.subformsDict[subformControlName] = {};
478
- this.task.refreshView();
479
- }
480
- }
481
- }
482
- addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
483
- this.pendingCommandsCollector.startCollecting();
484
- let refreshNeeded = false;
485
- if (isNullOrUndefined(routerPath)) {
486
- if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
487
- if (this.subformsDict[subformControlName].formName === formName) {
488
- this.subformsDict[subformControlName] = {};
489
- this.task.refreshView();
490
- }
491
- }
492
- let moduleRef = this.componentListMagicService.getModuleRef(formName);
493
- if (moduleRef == null) {
494
- let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(formName);
495
- if (lazyLoadModule != null) {
496
- let moduleName = lazyLoadModule.moduleName.replace('Magic', '');
497
- moduleName = moduleName.replace('Module', '');
498
- this.loader.Load(moduleName).then(m => {
499
- const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
500
- moduleRef = compiled.ngModuleFactory.create(this.injector);
501
- this.subformsDict[subformControlName] = {
502
- formName,
503
- parameters: { taskIdParam: taskId, taskDescription: taskDescription }
504
- };
505
- this.task.refreshView();
506
- });
507
- }
508
- }
509
- else {
510
- this.subformsDict[subformControlName] = {
511
- formName,
512
- parameters: { taskIdParam: taskId, taskDescription: taskDescription }
513
- };
514
- refreshNeeded = true;
515
- }
516
- }
517
- else {
518
- if (inDefaultOutlet)
519
- subformControlName = 'primary';
520
- let routeParams = new List();
521
- routeParams.push(routerPath);
522
- if (params !== null) {
523
- routeParams = routeParams.concat(params);
524
- }
525
- let routeCommand = {
526
- callerMgSubformServiceRef: this,
527
- routerOutletName: subformControlName,
528
- formName: formName,
529
- parameters: { taskIdParam: taskId, taskDescription: taskDescription },
530
- routeParams: routeParams
531
- };
532
- if (SubformMagicService.currentCallerMgSubformServiceRef === null)
533
- this.ExecuteRouteCommand(routeCommand);
534
- else
535
- this.routerCommandsMagicService.AddRouteCommand(routeCommand);
536
- }
537
- if (refreshNeeded)
538
- this.task.refreshView();
539
- }
540
- ExecuteRouteCommand(routeCommand) {
541
- let currentSubformMagicService = routeCommand.callerMgSubformServiceRef;
542
- let relativeRoute = SubformMagicService.getRelativeRoute(currentSubformMagicService.activatedRoute);
543
- if (currentSubformMagicService.routesDict[routeCommand.routerOutletName] === routeCommand.routeParams[0]) {
544
- currentSubformMagicService.router.navigate([{ outlets: { [routeCommand.routerOutletName]: null } }], { relativeTo: relativeRoute })
545
- .then((result) => {
546
- SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
547
- currentSubformMagicService.currentRouteDefinition = {
548
- formName: routeCommand.formName,
549
- parameters: routeCommand.parameters
550
- };
551
- currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
552
- });
553
- }
554
- else {
555
- SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
556
- currentSubformMagicService.currentRouteDefinition = {
557
- formName: routeCommand.formName,
558
- parameters: routeCommand.parameters
559
- };
560
- if (SubformMagicService.routerContainers.length > 0) {
561
- let routeContainer = SubformMagicService.routerContainers[0];
562
- SubformMagicService.routerContainers.shift();
563
- routeContainer.initializeComponent();
564
- }
565
- else {
566
- currentSubformMagicService.PerformRouterNavigate(routeCommand.routerOutletName, routeCommand.routeParams);
567
- }
568
- }
569
- }
570
- PerformRouterNavigate(routerOutletName, routeParams) {
571
- let relativeRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
572
- this.router.navigate([{ outlets: { [routerOutletName]: routeParams } }], { relativeTo: relativeRoute })
573
- .then((result) => {
574
- if (result !== null && !result) {
575
- let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
576
- subformMagicService.currentRouteDefinition = null;
577
- SubformMagicService.currentCallerMgSubformServiceRef = null;
578
- subformMagicService.pendingCommandsCollector.stopCollecting();
579
- subformMagicService.routerCommandsMagicService.ExecuteNextCommand();
580
- }
581
- });
582
- }
583
- init() {
584
- const pendingCommands = this.pendingCommandsCollector.GetCommands(this.task.taskId);
585
- if (pendingCommands.length > 0) {
586
- pendingCommands.forEach(command => { this.task.executeCommand(command); });
587
- this.task.refreshView();
588
- }
589
- this.pendingCommandsCollector.stopCollecting();
590
- }
591
- refreshView() {
592
- this.task.refreshView();
593
- }
594
- static getRelativeRoute(sendActivatedRoute) {
595
- let currentActiveRoute = sendActivatedRoute;
596
- if (currentActiveRoute.snapshot.routeConfig !== null && currentActiveRoute.snapshot.routeConfig.path === '') {
597
- currentActiveRoute = currentActiveRoute.parent;
598
- if (!currentActiveRoute.snapshot.routeConfig.loadChildren)
599
- console.log('getRelativeRoute(): both path and currentActiveRoute.snapshot.routeConfig.loadChildren are empty.');
600
- }
601
- return currentActiveRoute;
602
- }
603
- }
604
- SubformMagicService.currentCallerMgSubformServiceRef = null;
605
- SubformMagicService.routerContainers = new Array();
606
- SubformMagicService.ɵfac = function SubformMagicService_Factory(t) { return new (t || SubformMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(i2.ActivatedRoute), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(CommandsCollectorMagicService), i0.ɵɵinject(i2.Router), i0.ɵɵinject(RouterCommandsMagicService), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler)); };
607
- SubformMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
608
- (function () {
609
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SubformMagicService, [{
610
- type: Injectable
611
- }], function () { return [{ 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);
612
- })();
613
-
614
- class RouterContainerMagicComponent {
615
- static get LastRoute() {
616
- return RouterContainerMagicComponent.lastRoute;
617
- }
618
- constructor(activatedRoute, router, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
619
- this.activatedRoute = activatedRoute;
620
- this.router = router;
621
- this.magic = magic;
622
- this.containerTaskService = containerTaskService;
623
- this.componentFactoryResolver = componentFactoryResolver;
624
- this.viewContainerRef = viewContainerRef;
625
- this.componentList = componentList;
626
- this.pendingCommandsCollector = pendingCommandsCollector;
627
- this.routerCommandsMagicService = routerCommandsMagicService;
628
- this.componentRef = null;
629
- this.parentMgSubformService = null;
630
- }
631
- ngOnInit() {
632
- let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
633
- let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
634
- RouterContainerMagicComponent.lastRoute = this.router.url;
635
- if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
636
- this.insertRouteEvent(currentActiveRoute);
637
- SubformMagicService.routerContainers.push(this);
638
- }
639
- else {
640
- this.initializeComponent();
641
- }
642
- }
643
- insertRouteEvent(currentActiveRoute) {
644
- let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
645
- guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
646
- if (currentActiveRoute.snapshot.outlet !== 'primary')
647
- guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
648
- let calcRouterPath = currentActiveRoute.routeConfig.path;
649
- if (calcRouterPath.length > 0) {
650
- let routerPath = calcRouterPath;
651
- let tokens = StrUtil.tokenize(routerPath, "/:");
652
- guiEvent.RouterPath = tokens[0];
653
- guiEvent.RouterParams = new List();
654
- for (let i = 1; i < tokens.length; i++) {
655
- guiEvent.RouterParams.push(currentActiveRoute.snapshot.params[tokens[i]]);
656
- }
657
- }
658
- this.containerTaskService.insertEvent(guiEvent);
659
- }
660
- initializeComponent() {
661
- let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
662
- if (subformMagicService.currentRouteDefinition !== null) {
663
- let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
664
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
665
- this.componentRef = this.viewContainerRef.createComponent(componentFactory);
666
- Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
667
- let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
668
- let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
669
- subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
670
- this.parentMgSubformService = subformMagicService;
671
- subformMagicService.currentRouteDefinition = null;
672
- SubformMagicService.currentCallerMgSubformServiceRef = null;
673
- let ignoreParamChange = true;
674
- myActiveRoute.paramMap.subscribe(params => {
675
- if (!ignoreParamChange)
676
- this.insertRouteEvent(myActiveRoute);
677
- ignoreParamChange = false;
678
- });
679
- this.parentMgSubformService.refreshView();
680
- this.routerCommandsMagicService.ExecuteNextCommand();
681
- }
682
- }
683
- ngOnDestroy() {
684
- if (this.componentRef != null) {
685
- this.componentRef.instance.task.close();
686
- let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
687
- this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
688
- RouterContainerMagicComponent.lastRoute = this.router.url;
689
- }
690
- }
691
- }
692
- RouterContainerMagicComponent.lastRoute = "/";
693
- RouterContainerMagicComponent.ɵfac = function RouterContainerMagicComponent_Factory(t) { return new (t || RouterContainerMagicComponent)(i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(RouterCommandsMagicService)); };
694
- RouterContainerMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
695
- (function () {
696
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouterContainerMagicComponent, [{
697
- type: Component,
698
- args: [{
699
- selector: 'magic-route-outlet',
700
- template: `
701
- `
702
- }]
703
- }], function () { return [{ type: i2.ActivatedRoute }, { type: i2.Router }, { type: EngineMagicService }, { type: TaskMagicService }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null);
704
- })();
705
-
706
- class GuiInteractiveExecutor {
707
- Run() {
708
- try {
709
- switch (this.command._commandType) {
710
- case InteractiveCommandType.GET_VALUE:
711
- this.onValue();
712
- break;
713
- case InteractiveCommandType.GET_ROWS_IN_PAGE:
714
- this.onGetRowsInPage();
715
- break;
716
- case InteractiveCommandType.GET_MAX_ROWS_IN_PAGINATED_TABLE:
717
- this.onGetMaxRowsInPaginatedTable();
718
- break;
719
- case InteractiveCommandType.MESSAGE_BOX:
720
- this.OnMessageBox();
721
- break;
722
- case InteractiveCommandType.GET_TOP_INDEX:
723
- this.OnGetTopIndex();
724
- break;
725
- case InteractiveCommandType.GET_IS_ROW_EDITING:
726
- this.OnGetIsRowEditing();
727
- break;
728
- case InteractiveCommandType.SET_TITLE:
729
- this.OnSetTitle();
730
- break;
731
- case InteractiveCommandType.REFRESH_PAGE:
732
- this.OnRefreshPage();
733
- break;
734
- case InteractiveCommandType.GET_LAST_ROUTE:
735
- this.OnGetLastRoute();
736
- break;
737
- case InteractiveCommandType.OPEN_FORM:
738
- this.OnOpenForm();
739
- break;
740
- }
741
- }
742
- catch (ex) {
743
- throw ex;
744
- }
745
- }
746
- static executeInteractiveCommand(task, guiIntactiveCommand, overlayService) {
747
- let executor = new GuiInteractiveExecutor();
748
- executor.task = task;
749
- executor.command = guiIntactiveCommand;
750
- executor.overlayService = overlayService;
751
- executor.Run();
752
- }
753
- onValue() {
754
- let guiRowId = this.task.getGuiRowId(+this.command._line, this.task.isTableControl(this.command.controlName) || this.command._obj2.IsTableChild);
755
- let result = this.task.getFormControl(guiRowId.toString(), this.command.controlName);
756
- let val;
757
- if (!isNullOrUndefined(result)) {
758
- val = result.value;
759
- }
760
- else if (this.task.isTableControl(this.command.controlName))
761
- val = this.task.getValue(this.command.controlName, guiRowId.toString());
762
- val = this.task.ConvertValToNative(this.command.controlName, guiRowId, val);
763
- this.command._mgValue.obj = val;
764
- }
765
- onGetRowsInPage() {
766
- this.command._intVal1 = this.task.tableService.getPageSize();
767
- if (this.task.oldPageSize == 0)
768
- this.task.oldPageSize = this.command._intVal1;
769
- }
770
- onGetMaxRowsInPaginatedTable() {
771
- this.command._intVal1 = this.task.tableService.getMaxRowsInTable();
772
- }
773
- OnMessageBox() {
774
- this.overlayService.openConfirmationBox(this.command._mgValue.title, this.command._mgValue.str, this.command._mgValue.style);
775
- }
776
- OnOpenForm() {
777
- if (this.command._boolVal)
778
- this.overlayService.loadAndOpenModule(this.command.controlName, this.command._mgValue.str, this.command._mgValue.path);
779
- }
780
- OnSetTitle() {
781
- this.task.setTitle(this.command._mgValue.title);
782
- }
783
- OnRefreshPage() {
784
- let navigateToRootRoute = this.command._boolVal;
785
- let initialUrl = this.command._obj1;
786
- if (navigateToRootRoute)
787
- window.location.replace(initialUrl);
788
- else
789
- window.location.reload();
790
- }
791
- OnGetTopIndex() {
792
- this.command._intVal1 = this.task.tableService.getTableTopIndex();
793
- }
794
- OnGetIsRowEditing() {
795
- let dvRowIndex = this.command._intVal1;
796
- let guiRowIndex = this.task.getGuiRowId(dvRowIndex, true);
797
- let isLineMode = this.command._boolVal;
798
- if (isLineMode && (isNullOrUndefined(guiRowIndex) || isNullOrUndefined(this.task.Records.list[guiRowIndex])))
799
- this.command._boolVal = false;
800
- else
801
- this.command._boolVal = this.task.Records.list[guiRowIndex].isEditing;
802
- }
803
- OnGetLastRoute() {
804
- this.command.resultString = RouterContainerMagicComponent.LastRoute;
805
- }
806
- }
807
-
808
- let BaseMagicOverlayContainer = class BaseMagicOverlayContainer {
809
- };
810
- __decorate([
811
- Input(),
812
- __metadata("design:type", Object)
813
- ], BaseMagicOverlayContainer.prototype, "ModalComp", void 0);
814
- __decorate([
815
- Input(),
816
- __metadata("design:type", Object)
817
- ], BaseMagicOverlayContainer.prototype, "ModalCompParameters", void 0);
818
- __decorate([
819
- Output(),
820
- __metadata("design:type", Object)
821
- ], BaseMagicOverlayContainer.prototype, "onClose", void 0);
822
- BaseMagicOverlayContainer = __decorate([
823
- Input(),
824
- Output()
825
- ], BaseMagicOverlayContainer);
826
-
827
- class BaseMagicConfirmComponent {
828
- constructor() {
829
- this.onClose = new EventEmitter();
830
- }
831
- OnClose(result) {
832
- this.onClose.emit(result);
833
- }
834
- }
835
- BaseMagicConfirmComponent.ɵfac = function BaseMagicConfirmComponent_Factory(t) { return new (t || BaseMagicConfirmComponent)(); };
836
- BaseMagicConfirmComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { } });
837
- (function () {
838
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
839
- type: Component,
840
- args: [{ selector: 'mg-base-alert', template: '' }]
841
- }], null, { title: [{
842
- type: Input
843
- }], message: [{
844
- type: Input
845
- }], onClose: [{
846
- type: Output
847
- }] });
848
- })();
849
-
850
- class BaseMagicAlertComponent {
851
- constructor() {
852
- this.onClose = new EventEmitter();
853
- }
854
- OnClose() {
855
- this.onClose.emit();
856
- }
857
- }
858
- BaseMagicAlertComponent.ɵfac = function BaseMagicAlertComponent_Factory(t) { return new (t || BaseMagicAlertComponent)(); };
859
- BaseMagicAlertComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicAlertComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicAlertComponent_Template(rf, ctx) { } });
860
- (function () {
861
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicAlertComponent, [{
862
- type: Component,
863
- args: [{ selector: 'mg-base-alert', template: '' }]
864
- }], null, { title: [{
865
- type: Input
866
- }], message: [{
867
- type: Input
868
- }], onClose: [{
869
- type: Output
870
- }] });
871
- })();
872
-
873
- class MagicFocusDirective {
874
- constructor(hostElement) {
875
- this.hostElement = hostElement;
876
- }
877
- ngAfterViewInit() {
878
- this.hostElement.nativeElement.focus();
879
- }
880
- }
881
- MagicFocusDirective.ɵfac = function MagicFocusDirective_Factory(t) { return new (t || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
882
- MagicFocusDirective.ɵdir = i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]] });
883
- (function () {
884
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicFocusDirective, [{
885
- type: Directive,
886
- args: [{
887
- selector: '[magicFocus]'
888
- }]
889
- }], function () { return [{ type: i0.ElementRef }]; }, null);
890
- })();
891
-
892
- class MagicViewContainerRef {
893
- constructor(vcRef) {
894
- this.vcRef = vcRef;
895
- let comp = (this.vcRef._hostLView).find(v => v != null && !isNullOrUndefined(v.setViewContainerRef));
896
- comp.setViewContainerRef(vcRef);
897
- }
898
- }
899
- MagicViewContainerRef.ɵfac = function MagicViewContainerRef_Factory(t) { return new (t || MagicViewContainerRef)(i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
900
- MagicViewContainerRef.ɵdir = i0.ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]] });
901
- (function () {
902
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicViewContainerRef, [{
903
- type: Directive,
904
- args: [{
905
- selector: '[magicViewContainerRef]',
906
- }]
907
- }], function () { return [{ type: i0.ViewContainerRef }]; }, null);
908
- })();
909
-
910
- const _c0$3 = ["overlayContainerWrapper"];
911
- class MagicOverlayContainerWrapper {
912
- constructor(componentListMagicService, magicLazyModuleLoader, injector, componentFactoryResolver, changeDetectorRef, compiler) {
913
- this.componentListMagicService = componentListMagicService;
914
- this.magicLazyModuleLoader = magicLazyModuleLoader;
915
- this.injector = injector;
916
- this.componentFactoryResolver = componentFactoryResolver;
917
- this.changeDetectorRef = changeDetectorRef;
918
- this.compiler = compiler;
919
- this.Component = null;
920
- this.Parameters = {};
921
- this.onClose = new EventEmitter();
922
- }
923
- ngOnInit() {
924
- let moduleRef = this.componentListMagicService.getModuleRef(this.Parameters.MagicFormName);
925
- if (moduleRef == null) {
926
- let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(this.Parameters.MagicFormName);
927
- if (lazyLoadModule != null) {
928
- let moduleName = lazyLoadModule.moduleName.replace("Magic", "");
929
- moduleName = moduleName.replace("Module", "");
930
- this.magicLazyModuleLoader.Load(moduleName).then(m => {
931
- const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
932
- moduleRef = compiled.ngModuleFactory.create(this.injector);
933
- this.loadComponent(moduleRef);
934
- });
935
- }
936
- else {
937
- this.loadComponent(null);
938
- }
939
- }
940
- else
941
- this.loadComponent(moduleRef);
942
- }
943
- loadComponent(moduleRef) {
944
- this.Parameters.ModalComp = this.componentListMagicService.getComponent(this.Parameters.MagicFormName, !isNullOrUndefined(this.Parameters.MagicFormName));
945
- let factory;
946
- if (moduleRef != null)
947
- factory = moduleRef.componentFactoryResolver.resolveComponentFactory(this.Component);
948
- else
949
- factory = this.componentFactoryResolver.resolveComponentFactory(this.Component);
950
- let componentRef = this.overlayContentViewContainerRef.createComponent(factory);
951
- let allowedBaseComp = MagicOverlayContainerWrapper.allowedBaseComps.get(this.OverlayTypeParam);
952
- if (componentRef.instance instanceof allowedBaseComp.comp) {
953
- Object.assign(componentRef.instance, this.Parameters);
954
- componentRef.instance.onClose.subscribe((res) => {
955
- this.onClose.emit(res);
956
- });
957
- }
958
- else {
959
- let msg = "Provided window container should subclass of : " + allowedBaseComp.error + "window will not work properly.";
960
- alert(msg);
961
- }
962
- }
963
- setViewContainerRef(vcRef) {
964
- this.overlayContentViewContainerRef = vcRef;
965
- }
966
- GetRootElement() {
967
- return this.overlayContainerWrapperElementRef.nativeElement;
968
- }
969
- DetectChanges() {
970
- this.changeDetectorRef.detectChanges();
971
- }
972
- }
973
- MagicOverlayContainerWrapper.allowedBaseComps = new Map([
974
- [OverlayType.Overlay, { comp: BaseMagicOverlayContainer, error: 'BaseMagicOverlayContainer . Overlay ' }],
975
- [OverlayType.Alert, { comp: BaseMagicAlertComponent, error: 'BaseMagicAlertComponent. Alert ' }],
976
- [OverlayType.ConfirmationBox, { comp: BaseMagicConfirmComponent, error: 'BaseMagicConfirmComponent. Confirmation ' }]
977
- ]);
978
- MagicOverlayContainerWrapper.ɵfac = function MagicOverlayContainerWrapper_Factory(t) { return new (t || MagicOverlayContainerWrapper)(i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(MagicLazyLoaderService), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.Compiler)); };
979
- MagicOverlayContainerWrapper.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) {
980
- if (rf & 1) {
981
- i0.ɵɵviewQuery(_c0$3, 7);
982
- }
983
- if (rf & 2) {
984
- let _t;
985
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.overlayContainerWrapperElementRef = _t.first);
986
- }
987
- }, inputs: { Component: "Component", Parameters: "Parameters", OverlayTypeParam: "OverlayTypeParam" }, outputs: { onClose: "onClose" }, decls: 7, vars: 0, consts: [["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["overlayContainerWrapper", ""], ["magicViewContainerRef", ""], ["overlayContent", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) {
988
- if (rf & 1) {
989
- i0.ɵɵelementStart(0, "div");
990
- i0.ɵɵelement(1, "div", 0);
991
- i0.ɵɵelementStart(2, "div", 1, 2);
992
- i0.ɵɵelement(4, "div", 3, 4);
993
- i0.ɵɵelementEnd();
994
- i0.ɵɵelement(6, "div", 5);
995
- i0.ɵɵelementEnd();
996
- }
997
- }, dependencies: [MagicFocusDirective, MagicViewContainerRef], styles: [".overlay-container-wrapper-background[_ngcontent-%COMP%]{position:fixed;z-index:999;inset:0}"] });
998
- (function () {
999
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainerWrapper, [{
1000
- type: Component,
1001
- args: [{ selector: 'app-magic-overlay-container-wrapper', template: `
1002
- <div>
1003
- <div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" magicFocus></div>
1004
- <div class="overlay-container-wrapper-background" #overlayContainerWrapper>
1005
- <div #overlayContent magicViewContainerRef>
1006
- </div>
1007
- </div>
1008
- <div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" ></div>
1009
- </div>
1010
- `, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
1011
- }], function () { return [{ type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }, { type: i0.Compiler }]; }, { Component: [{
1012
- type: Input
1013
- }], Parameters: [{
1014
- type: Input
1015
- }], OverlayTypeParam: [{
1016
- type: Input
1017
- }], onClose: [{
1018
- type: Output
1019
- }], overlayContainerWrapperElementRef: [{
1020
- type: ViewChild,
1021
- args: ['overlayContainerWrapper', { static: true }]
1022
- }] });
1023
- })();
1024
-
1025
- class confirmationBox {
1026
- static isConfirmBox(style) {
1027
- let buttonMode = style & 0x0F;
1028
- var isConfirm = (buttonMode === Styles.MSGBOX_BUTTON_OK_CANCEL) ||
1029
- (buttonMode === Styles.MSGBOX_BUTTON_ABORT_RETRY_IGNORE) ||
1030
- (buttonMode === Styles.MSGBOX_BUTTON_YES_NO_CANCEL) ||
1031
- (buttonMode === Styles.MSGBOX_BUTTON_YES_NO) ||
1032
- (buttonMode === Styles.MSGBOX_BUTTON_RETRY_CANCEL);
1033
- return (isConfirm);
1034
- }
1035
- static convertToExcpectedResultBox(style, okWasPressed) {
1036
- let buttonMode = style & 0x0F;
1037
- let retValue = Styles.MSGBOX_RESULT_OK;
1038
- if (buttonMode === Styles.MSGBOX_BUTTON_OK)
1039
- retValue = Styles.MSGBOX_RESULT_OK;
1040
- else if (buttonMode === Styles.MSGBOX_BUTTON_OK_CANCEL)
1041
- retValue = okWasPressed ? Styles.MSGBOX_RESULT_OK : Styles.MSGBOX_RESULT_CANCEL;
1042
- else if (buttonMode === Styles.MSGBOX_BUTTON_ABORT_RETRY_IGNORE)
1043
- retValue = okWasPressed ? Styles.MSGBOX_RESULT_ABORT : Styles.MSGBOX_RESULT_RETRY;
1044
- else if (buttonMode === Styles.MSGBOX_BUTTON_YES_NO_CANCEL)
1045
- retValue = okWasPressed ? Styles.MSGBOX_RESULT_YES : Styles.MSGBOX_RESULT_NO;
1046
- else if (buttonMode === Styles.MSGBOX_BUTTON_YES_NO)
1047
- retValue = okWasPressed ? Styles.MSGBOX_RESULT_YES : Styles.MSGBOX_RESULT_NO;
1048
- else if (buttonMode === Styles.MSGBOX_BUTTON_RETRY_CANCEL)
1049
- retValue = okWasPressed ? Styles.MSGBOX_RESULT_RETRY : Styles.MSGBOX_RESULT_CANCEL;
1050
- return retValue;
1051
- }
1052
- static showConfirmationBox(title, message, style) {
1053
- let okWasPressed = false;
1054
- let isConfirm = this.isConfirmBox(style);
1055
- let titleAndString = title + '\n' + '\n' + message;
1056
- if (isConfirm)
1057
- okWasPressed = confirm(titleAndString);
1058
- else {
1059
- alert(titleAndString);
1060
- okWasPressed = true;
1061
- }
1062
- return okWasPressed;
1063
- }
1064
- }
1065
-
1066
- const _c0$2 = ["modalheader"];
1067
- const _c1$1 = ["modalForeground"];
1068
- function MagicOverlayContainer_button_2_Template(rf, ctx) {
1069
- if (rf & 1) {
1070
- const _r5 = i0.ɵɵgetCurrentView();
1071
- i0.ɵɵelementStart(0, "button", 8);
1072
- i0.ɵɵlistener("click", function MagicOverlayContainer_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.OnClose()); });
1073
- i0.ɵɵtext(1, "X");
1074
- i0.ɵɵelementEnd();
1075
- }
1076
- }
1077
- function MagicOverlayContainer_div_5_Template(rf, ctx) {
1078
- if (rf & 1) {
1079
- const _r8 = i0.ɵɵgetCurrentView();
1080
- i0.ɵɵelementStart(0, "div", 9, 10);
1081
- i0.ɵɵtext(2);
1082
- i0.ɵɵelementStart(3, "button", 11);
1083
- i0.ɵɵlistener("click", function MagicOverlayContainer_div_5_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.OnClose()); });
1084
- i0.ɵɵtext(4, "X");
1085
- i0.ɵɵelementEnd()();
1086
- }
1087
- if (rf & 2) {
1088
- const ctx_r2 = i0.ɵɵnextContext();
1089
- i0.ɵɵadvance(2);
1090
- i0.ɵɵtextInterpolate1(" ", ctx_r2.getText(), " ");
1091
- }
1092
- }
1093
- class MagicOverlayContainer extends BaseMagicOverlayContainer {
1094
- constructor(componentFactoryResolver) {
1095
- super();
1096
- this.componentFactoryResolver = componentFactoryResolver;
1097
- this.ModalComp = null;
1098
- this.ModalCompParameters = {};
1099
- this.onClose = new EventEmitter();
1100
- this.componentRef = null;
1101
- }
1102
- ngOnInit() {
1103
- const factory = this.componentFactoryResolver.resolveComponentFactory(this.ModalComp);
1104
- this.componentRef = this.modalbodyViewContainerRef.createComponent(factory);
1105
- Object.assign(this.componentRef.instance, this.ModalCompParameters);
1106
- }
1107
- setViewContainerRef(vcRef) {
1108
- this.modalbodyViewContainerRef = vcRef;
1109
- }
1110
- getText() {
1111
- if (this.componentRef !== null) {
1112
- let comp = this.componentRef.instance;
1113
- return comp.FormName();
1114
- }
1115
- else
1116
- return '';
1117
- }
1118
- getStyle() {
1119
- let styles = {};
1120
- if (this.componentRef != undefined) {
1121
- let comp = this.componentRef.instance;
1122
- styles['width'] = comp.Width();
1123
- styles['height'] = comp.Height();
1124
- if (comp.IsCenteredToWindow()) {
1125
- styles['margin'] = 'auto';
1126
- }
1127
- else {
1128
- styles['margin-left'] = comp.X() + 'px';
1129
- styles['margin-top'] = comp.Y() + 'px';
1130
- }
1131
- }
1132
- return styles;
1133
- }
1134
- getClientAreaStyles() {
1135
- let styles = {};
1136
- if (this.componentRef != undefined) {
1137
- const headerHeight = this.getShowTitleBar() && !isNullOrUndefined(this.headerElementRef) ? (this.headerElementRef.nativeElement.offsetHeight + 1) : 0;
1138
- if (!isNullOrUndefined(this.foregroundElementRef)) {
1139
- const foregroundHeight = this.foregroundElementRef.nativeElement.offsetHeight;
1140
- styles['height'] = (foregroundHeight - headerHeight) + 'px';
1141
- const foregroundWidth = this.foregroundElementRef.nativeElement.offsetWidth;
1142
- styles['width'] = (foregroundWidth) + 'px';
1143
- }
1144
- styles['overflow'] = 'auto';
1145
- }
1146
- return styles;
1147
- }
1148
- getShowTitleBar() {
1149
- if (this.componentRef != undefined) {
1150
- let comp = this.componentRef.instance;
1151
- return comp.ShowTitleBar();
1152
- }
1153
- }
1154
- OnClose() {
1155
- this.onClose.emit();
1156
- }
1157
- OnBackgroundClick() {
1158
- let comp = this.componentRef.instance;
1159
- if (comp.ShouldCloseOnBackgroundClick())
1160
- this.OnClose();
1161
- }
1162
- }
1163
- MagicOverlayContainer.ɵfac = function MagicOverlayContainer_Factory(t) { return new (t || MagicOverlayContainer)(i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
1164
- MagicOverlayContainer.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) {
1165
- if (rf & 1) {
1166
- i0.ɵɵviewQuery(_c0$2, 5);
1167
- i0.ɵɵviewQuery(_c1$1, 5);
1168
- }
1169
- if (rf & 2) {
1170
- let _t;
1171
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
1172
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.foregroundElementRef = _t.first);
1173
- }
1174
- }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 9, vars: 4, consts: [[1, "modal-background", 3, "click"], ["tabindex", "-1", "style", "float:right; border: none; background-color: transparent; outline: none; color: white", 3, "click", 4, "ngIf"], [1, "modal-foreground", 3, "ngStyle"], ["modalForeground", ""], ["class", "modal-header", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["modalbody", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "modal-header"], ["modalheader", ""], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) {
1175
- if (rf & 1) {
1176
- i0.ɵɵelementStart(0, "div")(1, "div", 0);
1177
- i0.ɵɵlistener("click", function MagicOverlayContainer_Template_div_click_1_listener() { return ctx.OnBackgroundClick(); });
1178
- i0.ɵɵtemplate(2, MagicOverlayContainer_button_2_Template, 2, 0, "button", 1);
1179
- i0.ɵɵelementEnd();
1180
- i0.ɵɵelementStart(3, "div", 2, 3);
1181
- i0.ɵɵtemplate(5, MagicOverlayContainer_div_5_Template, 5, 1, "div", 4);
1182
- i0.ɵɵelementStart(6, "div", 5);
1183
- i0.ɵɵelement(7, "div", 6, 7);
1184
- i0.ɵɵelementEnd()()();
1185
- }
1186
- if (rf & 2) {
1187
- i0.ɵɵadvance(2);
1188
- i0.ɵɵproperty("ngIf", !ctx.getShowTitleBar());
1189
- i0.ɵɵadvance(1);
1190
- i0.ɵɵproperty("ngStyle", ctx.getStyle());
1191
- i0.ɵɵadvance(2);
1192
- i0.ɵɵproperty("ngIf", ctx.getShowTitleBar());
1193
- i0.ɵɵadvance(1);
1194
- i0.ɵɵproperty("ngStyle", ctx.getClientAreaStyles());
1195
- }
1196
- }, 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}"] });
1197
- (function () {
1198
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainer, [{
1199
- type: Component,
1200
- args: [{ selector: 'app-magic-overlay-container', template: `
1201
- <div>
1202
- <div class="modal-background" (click)="OnBackgroundClick()">
1203
- <button (click)="OnClose()" tabindex="-1" style="float:right; border: none; background-color: transparent; outline: none; color: white" *ngIf="!getShowTitleBar()">X</button>
1204
- </div>
1205
- <div #modalForeground class="modal-foreground" [ngStyle]="getStyle()">
1206
- <div #modalheader class="modal-header" *ngIf="getShowTitleBar()">
1207
- {{getText()}}
1208
- <button (click)="OnClose()" style="float:right" tabindex="-1">X</button>
1209
- </div>
1210
- <div [ngStyle]="getClientAreaStyles()">
1211
- <div #modalbody magicViewContainerRef>
1212
- </div>
1213
- </div>
1214
- </div>
1215
- </div>
1216
- `, 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"] }]
1217
- }], function () { return [{ type: i0.ComponentFactoryResolver }]; }, { headerElementRef: [{
1218
- type: ViewChild,
1219
- args: ['modalheader', { static: false }]
1220
- }], foregroundElementRef: [{
1221
- type: ViewChild,
1222
- args: ['modalForeground', { static: false }]
1223
- }], ModalComp: [{
1224
- type: Input
1225
- }], ModalCompParameters: [{
1226
- type: Input
1227
- }], onClose: [{
1228
- type: Output
1229
- }] });
1230
- })();
1231
-
1232
- class OverlayContainerMagicProvider {
1233
- getComponent() {
1234
- return MagicOverlayContainer;
1235
- }
1236
- }
1237
- OverlayContainerMagicProvider.ɵfac = function OverlayContainerMagicProvider_Factory(t) { return new (t || OverlayContainerMagicProvider)(); };
1238
- OverlayContainerMagicProvider.ɵprov = i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
1239
- (function () {
1240
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayContainerMagicProvider, [{
1241
- type: Injectable
1242
- }], null, null);
1243
- })();
1244
-
1245
- class MagicAlertComponent extends BaseMagicAlertComponent {
1246
- }
1247
- MagicAlertComponent.ɵfac = function () { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(t) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(t || MagicAlertComponent); }; }();
1248
- MagicAlertComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) {
1249
- if (rf & 1) {
1250
- i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1251
- i0.ɵɵtext(3);
1252
- i0.ɵɵelementEnd();
1253
- i0.ɵɵelementStart(4, "p");
1254
- i0.ɵɵtext(5);
1255
- i0.ɵɵelementEnd();
1256
- i0.ɵɵelementStart(6, "button", 1);
1257
- i0.ɵɵlistener("click", function MagicAlertComponent_Template_button_click_6_listener() { return ctx.OnClose(); });
1258
- i0.ɵɵtext(7, "OK");
1259
- i0.ɵɵelementEnd()()();
1260
- }
1261
- if (rf & 2) {
1262
- i0.ɵɵadvance(3);
1263
- i0.ɵɵtextInterpolate1(" ", ctx.title, "");
1264
- i0.ɵɵadvance(2);
1265
- i0.ɵɵtextInterpolate1("", ctx.message, " ");
1266
- }
1267
- }, styles: [".mg-message-background[_ngcontent-%COMP%]{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[_ngcontent-%COMP%]{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}"] });
1268
- (function () {
1269
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicAlertComponent, [{
1270
- type: Component,
1271
- args: [{ selector: 'sample-magic-alert-component', template: `<div>
1272
- <div class="mg-message-background">
1273
- <h2> {{title}}</h2>
1274
- <p>{{message}} </p>
1275
-
1276
- <button (click)="OnClose()">OK</button>
1277
- </div>
1278
- </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;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
1279
- }], null, null);
1280
- })();
1281
-
1282
- class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
1283
- }
1284
- MagicConfirmationBoxComponent.ɵfac = function () { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(t) { return (ɵMagicConfirmationBoxComponent_BaseFactory || (ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent)))(t || MagicConfirmationBoxComponent); }; }();
1285
- MagicConfirmationBoxComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "mg-message-background"], [3, "click"], [1, "cancel", 3, "click"]], template: function MagicConfirmationBoxComponent_Template(rf, ctx) {
1286
- if (rf & 1) {
1287
- i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
1288
- i0.ɵɵtext(3);
1289
- i0.ɵɵelementEnd();
1290
- i0.ɵɵtext(4);
1291
- i0.ɵɵelement(5, "br")(6, "br");
1292
- i0.ɵɵelementStart(7, "button", 1);
1293
- i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_7_listener() { return ctx.OnClose(true); });
1294
- i0.ɵɵtext(8, "OK");
1295
- i0.ɵɵelementEnd();
1296
- i0.ɵɵelementStart(9, "button", 2);
1297
- i0.ɵɵlistener("click", function MagicConfirmationBoxComponent_Template_button_click_9_listener() { return ctx.OnClose(false); });
1298
- i0.ɵɵtext(10, "Cancel");
1299
- i0.ɵɵelementEnd()()();
1300
- }
1301
- if (rf & 2) {
1302
- i0.ɵɵadvance(3);
1303
- i0.ɵɵtextInterpolate1(" ", ctx.title, "");
1304
- i0.ɵɵadvance(1);
1305
- i0.ɵɵtextInterpolate1(" ", ctx.message, " ");
1306
- }
1307
- }, styles: [".mg-message-background[_ngcontent-%COMP%]{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[_ngcontent-%COMP%]{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel[_ngcontent-%COMP%]{background-color:#c1c1c1}"] });
1308
- (function () {
1309
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicConfirmationBoxComponent, [{
1310
- type: Component,
1311
- args: [{ selector: 'sample-magic-confirmation-box', template: `<div>
1312
- <div class="mg-message-background">
1313
- <h2> {{title}}</h2>
1314
- {{message}}
1315
- <br>
1316
- <br>
1317
-
1318
- <button (click)="OnClose(true)">OK</button>
1319
- <button class="cancel" (click)="OnClose(false)">Cancel</button>
1320
- </div>
1321
- </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;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
1322
- }], null, null);
1323
- })();
1324
-
1325
- class ConfirmationComponentsMagicProvider {
1326
- showDefaultConfirmations() {
1327
- return true;
1328
- }
1329
- getAlertComponent() {
1330
- return MagicAlertComponent;
1331
- }
1332
- getConfirmtionComponent() {
1333
- return MagicConfirmationBoxComponent;
1334
- }
1335
- }
1336
- ConfirmationComponentsMagicProvider.ɵfac = function ConfirmationComponentsMagicProvider_Factory(t) { return new (t || ConfirmationComponentsMagicProvider)(); };
1337
- ConfirmationComponentsMagicProvider.ɵprov = i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
1338
- (function () {
1339
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmationComponentsMagicProvider, [{
1340
- type: Injectable
1341
- }], null, null);
1342
- })();
1343
-
1344
- class OverlayWindowService {
1345
- constructor(componentFactoryResolver, componentList, engineMagicService, magicLazyModuleLoader, injector, compiler, overlayContainerMagicProvider, confirmationComponentsMagicProvider) {
1346
- this.componentFactoryResolver = componentFactoryResolver;
1347
- this.componentList = componentList;
1348
- this.engineMagicService = engineMagicService;
1349
- this.magicLazyModuleLoader = magicLazyModuleLoader;
1350
- this.injector = injector;
1351
- this.compiler = compiler;
1352
- this.overlayContainerMagicProvider = overlayContainerMagicProvider;
1353
- this.confirmationComponentsMagicProvider = confirmationComponentsMagicProvider;
1354
- this.overlayWindowFocusManager = null;
1355
- this.changeDetectorRef = null;
1356
- }
1357
- init(overlayWindowsContainerViewRef, rootMagicElement, changeDetectorRef) {
1358
- this.overlayWindowsContainerViewRef = overlayWindowsContainerViewRef;
1359
- this.overlayWindowFocusManager = new OverlayWindowFocusManager(rootMagicElement);
1360
- this.changeDetectorRef = changeDetectorRef;
1361
- }
1362
- loadAndOpenModule(formName, taskId, taskDescription) {
1363
- let moduleRef = this.componentList.getModuleRef(formName);
1364
- if (moduleRef == null) {
1365
- let lazyLoadModule = this.componentList.getLazyLoadModuleData(formName);
1366
- if (lazyLoadModule != null) {
1367
- let moduleName = lazyLoadModule.moduleName.replace("Magic", "");
1368
- moduleName = moduleName.replace("Module", "");
1369
- this.magicLazyModuleLoader.Load(moduleName).then(m => {
1370
- const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
1371
- moduleRef = compiled.ngModuleFactory.create(this.injector);
1372
- this.open(formName, taskId, taskDescription);
1373
- this.finishConfirmation(Styles.MSGBOX_BUTTON_OK, true);
1374
- });
1375
- }
1376
- }
1377
- else {
1378
- this.open(formName, taskId, taskDescription);
1379
- this.finishConfirmation(Styles.MSGBOX_BUTTON_OK, true);
1380
- }
1381
- }
1382
- open(formName, taskId, taskDescription) {
1383
- let comp = this.componentList.lazyLoadModulesMap != null && this.componentList.lazyLoadModulesMap.hasOwnProperty(formName) ? null : this.componentList.getComponent(formName);
1384
- let parameters = { taskIdParam: taskId, taskDescription: taskDescription };
1385
- let componentRef = this.createModalComponent({ MagicFormName: formName, ModalComp: comp, ModalCompParameters: parameters }, this.overlayContainerMagicProvider.getComponent(), OverlayType.Overlay);
1386
- componentRef.instance.onClose.subscribe(() => {
1387
- let guiEvent = getGuiEventObj("close", null, 0);
1388
- guiEvent.TaskID = taskId;
1389
- this.engineMagicService.insertEvent(guiEvent);
1390
- });
1391
- this.changeDetectorRef.detectChanges();
1392
- }
1393
- close(commandStr) {
1394
- this.overlayWindowsContainerViewRef.remove();
1395
- this.overlayWindowFocusManager.popDialog();
1396
- let guiEvent1 = getGuiEventObj("dispose", null, 0);
1397
- guiEvent1.TaskID = commandStr;
1398
- this.engineMagicService.insertEvent(guiEvent1);
1399
- }
1400
- openConfirmationBox(title, msg, style) {
1401
- if (this.confirmationComponentsMagicProvider.showDefaultConfirmations()) {
1402
- let res = confirmationBox.showConfirmationBox(title, msg, style);
1403
- this.finishConfirmation(style, res);
1404
- }
1405
- else {
1406
- let comp = confirmationBox.isConfirmBox(style) ? this.confirmationComponentsMagicProvider.getConfirmtionComponent() : this.confirmationComponentsMagicProvider.getAlertComponent();
1407
- let overlayType = confirmationBox.isConfirmBox(style) ? OverlayType.ConfirmationBox : OverlayType.Alert;
1408
- let componentRef = this.createModalComponent({ title: title, message: msg }, comp, overlayType);
1409
- componentRef.instance.onClose.subscribe((res) => {
1410
- this.overlayWindowsContainerViewRef.remove();
1411
- this.overlayWindowFocusManager.popDialog();
1412
- this.finishConfirmation(style, res);
1413
- });
1414
- }
1415
- }
1416
- finishConfirmation(style, result) {
1417
- let guiEvent = getGuiEventObj("confirmationClosed", null, 0);
1418
- guiEvent.keyCode = confirmationBox.convertToExcpectedResultBox(style, result);
1419
- this.engineMagicService.insertEvent(guiEvent);
1420
- }
1421
- createModalComponent(parameters, component, overlayType) {
1422
- let componentRef;
1423
- let magicModalContainerParameters = {
1424
- Component: component,
1425
- Parameters: parameters,
1426
- OverlayTypeParam: overlayType
1427
- };
1428
- const factory = this.componentFactoryResolver.resolveComponentFactory(MagicOverlayContainerWrapper);
1429
- let viewCRef = this.overlayWindowsContainerViewRef;
1430
- componentRef = viewCRef.createComponent(factory);
1431
- Object.assign(componentRef.instance, magicModalContainerParameters);
1432
- this.overlayWindowFocusManager.pushDialog(componentRef.instance.GetRootElement());
1433
- componentRef.instance.DetectChanges();
1434
- return componentRef;
1435
- }
1436
- }
1437
- OverlayWindowService.ɵfac = function OverlayWindowService_Factory(t) { return new (t || OverlayWindowService)(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(OverlayContainerMagicProvider), i0.ɵɵinject(ConfirmationComponentsMagicProvider)); };
1438
- OverlayWindowService.ɵprov = i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac, providedIn: 'root' });
1439
- (function () {
1440
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayWindowService, [{
1441
- type: Injectable,
1442
- args: [{
1443
- providedIn: 'root'
1444
- }]
1445
- }], function () { return [{ type: i0.ComponentFactoryResolver }, { type: ComponentListMagicService }, { type: EngineMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.Compiler }, { type: OverlayContainerMagicProvider }, { type: ConfirmationComponentsMagicProvider }]; }, null);
1446
- })();
1447
- class OverlayWindowFocusManager {
1448
- constructor(rootMagicElement) {
1449
- this.rootMagicElement = null;
1450
- this.openDialogList = new Array(0);
1451
- this.ignoreUtilFocusChanges = false;
1452
- this.lastFocus = null;
1453
- this.focusListener = null;
1454
- this.rootMagicElement = rootMagicElement;
1455
- }
1456
- pushDialog(rootElement) {
1457
- if (this.openDialogList.length === 0) {
1458
- this.focusListener = this.trapFocus.bind(this);
1459
- document.addEventListener('focus', this.focusListener, true);
1460
- }
1461
- this.openDialogList.push(new DialogInfo(rootElement, (document.activeElement instanceof HTMLElement ? document.activeElement : null)));
1462
- }
1463
- popDialog() {
1464
- const dialogInfo = this.openDialogList.pop();
1465
- this.attemptFocus(dialogInfo.FocusElementOnClose);
1466
- if (this.openDialogList.length === 0) {
1467
- document.removeEventListener('focus', this.focusListener, true);
1468
- this.focusListener = null;
1469
- }
1470
- }
1471
- trapFocus(event) {
1472
- if (this.ignoreUtilFocusChanges) {
1473
- return;
1474
- }
1475
- if (this.openDialogList.length > 0) {
1476
- var currentDialog = this.openDialogList[this.openDialogList.length - 1].RootElement;
1477
- if (currentDialog.contains(event.target)) {
1478
- this.lastFocus = event.target;
1479
- }
1480
- else {
1481
- if (this.rootMagicElement.contains(event.target)) {
1482
- this.focusFirstDescendant(currentDialog);
1483
- if (this.lastFocus == document.activeElement) {
1484
- this.focusLastDescendant(currentDialog);
1485
- }
1486
- }
1487
- this.lastFocus = document.activeElement;
1488
- }
1489
- }
1490
- }
1491
- focusFirstDescendant(element) {
1492
- for (var i = 0; i < element.childNodes.length; i++) {
1493
- var child = element.childNodes[i];
1494
- if (this.attemptFocus(child) ||
1495
- this.focusFirstDescendant(child)) {
1496
- return true;
1497
- }
1498
- }
1499
- return false;
1500
- }
1501
- ;
1502
- focusLastDescendant(element) {
1503
- for (var i = element.childNodes.length - 1; i >= 0; i--) {
1504
- var child = element.childNodes[i];
1505
- if (this.attemptFocus(child) ||
1506
- this.focusLastDescendant(child)) {
1507
- return true;
1508
- }
1509
- }
1510
- return false;
1511
- }
1512
- ;
1513
- attemptFocus(element) {
1514
- if (!this.isFocusable(element)) {
1515
- return false;
1516
- }
1517
- this.ignoreUtilFocusChanges = true;
1518
- try {
1519
- element.focus();
1520
- }
1521
- catch (e) {
1522
- }
1523
- this.ignoreUtilFocusChanges = false;
1524
- return (document.activeElement === element);
1525
- }
1526
- ;
1527
- isFocusable(element) {
1528
- if (isNullOrUndefined(element))
1529
- return false;
1530
- if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {
1531
- return true;
1532
- }
1533
- else if (element.tabIndex < 0)
1534
- return false;
1535
- if (element.disabled) {
1536
- return false;
1537
- }
1538
- switch (element.nodeName) {
1539
- case 'A':
1540
- return !!element.href && element.rel != 'ignore';
1541
- case 'INPUT':
1542
- return element.type != 'hidden' && element.type != 'file';
1543
- case 'BUTTON':
1544
- case 'SELECT':
1545
- case 'TEXTAREA':
1546
- return true;
1547
- default:
1548
- return false;
1549
- }
1550
- }
1551
- }
1552
- class DialogInfo {
1553
- constructor(rootElement, focusElementOnClose) {
1554
- this.rootElement = rootElement;
1555
- this.focusElementOnClose = focusElementOnClose;
1556
- }
1557
- get RootElement() {
1558
- return this.rootElement;
1559
- }
1560
- get FocusElementOnClose() {
1561
- return this.focusElementOnClose;
1562
- }
1563
- }
1564
-
1565
- class TaskMagicService {
1566
- constructor(magic, overlayWindowService) {
1567
- this.magic = magic;
1568
- this.overlayWindowService = overlayWindowService;
1569
- this.Records = new Records();
1570
- this.formGroups = [];
1571
- this.refreshDom = new Subject();
1572
- this.detectChanges = new Subject();
1573
- this.interactiveCommands = new Subject();
1574
- this.OnSelectedRowChanged = new EventEmitter();
1575
- this.customPropertiesSubject = new Subject();
1576
- this.recordsCountChangeSubject = new Subject();
1577
- this.mgLoadSubject = new Subject();
1578
- this.oldPageSize = 0;
1579
- this.Records.setGuiTopIndex(0);
1580
- this.mgInputDateFormat = null;
1581
- }
1582
- getIsLoggenIn() {
1583
- return this.magic.getIsLoggedIn();
1584
- }
1585
- get taskId() {
1586
- return this._taskId;
1587
- }
1588
- set taskId(value) {
1589
- this._taskId = value;
1590
- }
1591
- get ScreenControlsData() {
1592
- return this.Records.list['0'];
1593
- }
1594
- settemplate(value) {
1595
- this.template = value;
1596
- }
1597
- buildScreenModeControls() {
1598
- const group = new FormGroup({});
1599
- for (const key in this.template) {
1600
- if (this.template[key] == '0') {
1601
- let fc = new FormControl('');
1602
- this.setStubValue(0, fc, key);
1603
- group.addControl(key, fc);
1604
- }
1605
- }
1606
- this.ScreenModeControls = group;
1607
- }
1608
- isTableControl(id) {
1609
- return this.template[id] == '1';
1610
- }
1611
- getMgInputDateFormat() { return this.mgInputDateFormat; }
1612
- getFormControl(guiRowid, id) {
1613
- let c;
1614
- let group = this.isTableControl(id) ? this.formGroups[guiRowid] : this.ScreenModeControls;
1615
- if (!isNullOrUndefined(group)) {
1616
- group.get(id);
1617
- c = group.controls[id];
1618
- }
1619
- return c;
1620
- }
1621
- setInputTextValue(controlId, guiRowid, val) {
1622
- this.setValue(controlId, guiRowid, this.ConvertValToNative(controlId, 0, val));
1623
- const fc = this.getFormControl(guiRowid, controlId);
1624
- if (!isNullOrUndefined(val))
1625
- fc.setValue(val);
1626
- }
1627
- buildTableRowControls(guiRowId) {
1628
- const group = new FormGroup({});
1629
- for (const key in this.template) {
1630
- if (this.template[key] == '1') {
1631
- let fc = new FormControl('');
1632
- this.setStubValue(guiRowId, fc, key);
1633
- group.addControl(key, fc);
1634
- }
1635
- }
1636
- this.formGroups[guiRowId] = group;
1637
- }
1638
- updateRecordsBeforeCurrentView(value) {
1639
- this.Records.recordsBeforeCurrentView = value;
1640
- }
1641
- setIncludesFirst(value) {
1642
- this.Records.includesFirst = value;
1643
- }
1644
- setIncludesLast(value) {
1645
- this.Records.includesLast = value;
1646
- }
1647
- markRowAsCreated(guiRowId) {
1648
- this.Records.markRowAsCreated(guiRowId);
1649
- }
1650
- markRowAsNotCreated(guiRowId) {
1651
- this.Records.markRowAsNotCreated(guiRowId);
1652
- }
1653
- startRowEditing(guiRowId) {
1654
- this.Records.startRowEditing(guiRowId);
1655
- }
1656
- stopRowEditing(guiRowId) {
1657
- this.Records.stopRowEditing(guiRowId);
1658
- }
1659
- isRowInRowEditing(guiRowId) {
1660
- return this.Records.isRowInRowEditing(guiRowId);
1661
- }
1662
- setIsEmptyDataView(isEmpty) {
1663
- if (this.Records.isEmptyDataView !== isEmpty) {
1664
- if (isEmpty)
1665
- this.recordsCountChangeSubject.next(0);
1666
- this.Records.isEmptyDataView = isEmpty;
1667
- this.tableService.refreshDataSource();
1668
- this.refreshView();
1669
- }
1670
- }
1671
- initTask(taskId, taskDescription) {
1672
- this.Records.createFirst();
1673
- this.oldPageSize = 0;
1674
- if (this.IsStub()) {
1675
- this.loadData();
1676
- }
1677
- else {
1678
- this.taskId = taskId;
1679
- this.settemplate(taskDescription);
1680
- }
1681
- this.buildScreenModeControls();
1682
- if (!isNullOrUndefined(this.subscribeRefreshDom))
1683
- this.subscribeRefreshDom.unsubscribe();
1684
- if (!isNullOrUndefined(this.subscribeInteractiveCommands))
1685
- this.subscribeInteractiveCommands.unsubscribe();
1686
- this.subscribeRefreshDom = this.magic.refreshDom.pipe(filter(command => command.TaskTag === this.taskId))
1687
- .subscribe(command => {
1688
- this.executeCommand(command);
1689
- });
1690
- this.subscribeInteractiveCommands = this.magic.interactiveCommands
1691
- .pipe(filter(command => command.TaskTag === this.taskId))
1692
- .subscribe(command => {
1693
- this.executeInteractiveCommand(command);
1694
- });
1695
- }
1696
- refreshView() {
1697
- this.detectChanges.next('');
1698
- }
1699
- insertEvent(guiEvent) {
1700
- guiEvent.TaskID = this.taskId;
1701
- this.magic.insertEvent(guiEvent);
1702
- }
1703
- GetControlPictureMask(controlName) {
1704
- return this.magic.GetControlPictureMask(this.taskId, controlName);
1705
- }
1706
- ValidateControlValue(controlName, value) {
1707
- return this.magic.ValidateControlValue(this.taskId, controlName, value);
1708
- }
1709
- GetRangedValue(controlName, value) {
1710
- return this.magic.GetRangedValue(this.taskId, controlName, value);
1711
- }
1712
- GetFldRanges(controlName) {
1713
- return this.magic.GetFldRanges(this.taskId, controlName);
1714
- }
1715
- getProperty(controlId, prop, guiRowId) {
1716
- if (isNullOrUndefined(guiRowId))
1717
- guiRowId = '0';
1718
- if (this.IsStub())
1719
- return this.getPropertyStub(this.Records.list[guiRowId], controlId, prop);
1720
- else {
1721
- let rec = this.Records.list[guiRowId];
1722
- if (isNullOrUndefined(rec))
1723
- debugger;
1724
- else
1725
- return this.Records.list[guiRowId].getProperty(controlId, prop);
1726
- }
1727
- }
1728
- getPropertyStub(ControlsProperties, controlId, prop) {
1729
- ControlsProperties = ControlsProperties.ControlsProperties;
1730
- if (controlId in ControlsProperties) {
1731
- if (prop in ControlsProperties[controlId].properties) {
1732
- return ControlsProperties[controlId].properties[prop];
1733
- }
1734
- }
1735
- return '';
1736
- }
1737
- getStyleStub(ControlsProperties, controlId, styleName) {
1738
- ControlsProperties = ControlsProperties.ControlsProperties;
1739
- return ControlsProperties[controlId].stylesMap.get(styleName);
1740
- }
1741
- getClasses(controlId, guiRowId) {
1742
- if (isNullOrUndefined(guiRowId))
1743
- guiRowId = '0';
1744
- return this.Records.list[guiRowId].getControlMetadata(controlId).classes;
1745
- }
1746
- getStyle(controlId, styleName, guiRowId) {
1747
- if (isNullOrUndefined(guiRowId))
1748
- guiRowId = '0';
1749
- if (this.IsStub())
1750
- return this.getStyleStub(this.Records.list[guiRowId], controlId, styleName);
1751
- else {
1752
- let magicValue = this.Records.list[guiRowId].getControlMetadata(controlId).stylesMap.get(styleName);
1753
- return StylesMapManager.magicValueGetStyle(styleName, magicValue);
1754
- }
1755
- }
1756
- getValue(controlId, guiRowId) {
1757
- if (isNullOrUndefined(guiRowId))
1758
- guiRowId = '0';
1759
- return this.Records.list.length > +guiRowId ? this.Records.list[guiRowId].values[controlId] : '';
1760
- }
1761
- getFormattedValue(controlName, val, rowId) {
1762
- return this.magic.GetFormattedValue(this.taskId, controlName, val, rowId);
1763
- }
1764
- setValue(controlId, guiRowId, value) {
1765
- return this.Records.list[guiRowId].setValue(controlId, value);
1766
- }
1767
- executeInteractiveCommand(guiInteractiveCommand) {
1768
- GuiInteractiveExecutor.executeInteractiveCommand(this, guiInteractiveCommand, this.overlayWindowService);
1769
- this.interactiveCommands.next(guiInteractiveCommand);
1770
- }
1771
- handleSetProperty(command, isTableChild) {
1772
- let controlId = command.CtrlName;
1773
- let dvRowId = (command.line || 0);
1774
- let guiRowId = this.getGuiRowId(dvRowId, isTableChild);
1775
- let properties;
1776
- if (command.Operation === HtmlProperties.SelectedRow) {
1777
- if (command.obj1 !== GuiConstants.NO_ROW_SELECTED) {
1778
- guiRowId = this.getGuiRowId(command.obj1, true);
1779
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1780
- properties.properties.set(command.Operation, command.line);
1781
- this.tableService.selectRow(guiRowId.toString());
1782
- this.OnSelectedRowChanged.emit(guiRowId.toString());
1783
- }
1784
- }
1785
- else if (command.Operation === HtmlProperties.Enabled) {
1786
- let c = this.getFormControl(guiRowId.toString(), controlId);
1787
- if (!isNullOrUndefined(c)) {
1788
- if (command.obj1)
1789
- c.enable();
1790
- else
1791
- c.disable();
1792
- }
1793
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1794
- properties.properties.set(command.Operation, command.obj1);
1795
- }
1796
- else {
1797
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1798
- properties.properties.set(command.Operation, command.obj1);
1799
- }
1800
- }
1801
- executeCommand(command) {
1802
- let dvRowId = (command.line || 0);
1803
- let guiRowId = 0;
1804
- let controlId = command.CtrlName;
1805
- let properties;
1806
- let isTableChild = this.isTableControl(controlId);
1807
- if (command.obj !== null)
1808
- isTableChild = isTableChild || command.obj.IsTableChild;
1809
- guiRowId = this.getGuiRowId(dvRowId, isTableChild);
1810
- switch (command.CommandType) {
1811
- case CommandType.SET_IS_LOGGED_IN:
1812
- break;
1813
- case CommandType.SET_TABLE_TOP_INDEX:
1814
- this.tableService.setTableTopIndex(command.number);
1815
- break;
1816
- case CommandType.REFRESH_TASK:
1817
- this.tableService.refreshDataSource();
1818
- this.refreshView();
1819
- break;
1820
- case CommandType.SET_TABLE_ITEMS_COUNT:
1821
- if (!isUndefined(command.number)) {
1822
- this.tableService.updateTableSize(command.number);
1823
- if (command.number > 0 && this.Records.sizeUpdated &&
1824
- !this.Records.isEmptyDataView) {
1825
- this.recordsCountChangeSubject.next(command.number);
1826
- this.Records.sizeUpdated = false;
1827
- }
1828
- }
1829
- break;
1830
- case CommandType.SET_CHUNK_SIZE:
1831
- if (!isUndefined(command.number)) {
1832
- this.tableService.setChunkSize(command.number);
1833
- }
1834
- break;
1835
- case CommandType.SET_RECORDS_BEFORE_CURRENT_VIEW:
1836
- this.updateRecordsBeforeCurrentView(command.number);
1837
- break;
1838
- case CommandType.CREATE_TABLE_ROW:
1839
- guiRowId = this.getGuiRowId(command.number, true);
1840
- this.buildTableRowControls(guiRowId);
1841
- this.markRowAsCreated(guiRowId);
1842
- break;
1843
- case CommandType.SET_IS_ROW_EDITING:
1844
- guiRowId = this.getGuiRowId(command.line, command.value);
1845
- this.startRowEditing(guiRowId);
1846
- break;
1847
- case CommandType.SET_NOT_IS_ROW_EDITING:
1848
- guiRowId = this.getGuiRowId(command.line, command.value);
1849
- this.stopRowEditing(guiRowId);
1850
- break;
1851
- case CommandType.UNDO_CREATE_TABLE_ROW:
1852
- this.markRowAsNotCreated(this.getGuiRowId(command.number, true));
1853
- break;
1854
- case CommandType.SET_TABLE_INCLUDES_FIRST:
1855
- this.setIncludesFirst(command.Bool1);
1856
- break;
1857
- case CommandType.SET_TABLE_INCLUDES_LAST:
1858
- this.setIncludesLast(command.Bool1);
1859
- break;
1860
- case CommandType.SET_PROPERTY:
1861
- this.handleSetProperty(command, isTableChild);
1862
- if (command.Operation == HtmlProperties.ReadOnly ||
1863
- command.Operation == HtmlProperties.ItemsList)
1864
- this.refreshDom.next(command);
1865
- break;
1866
- case CommandType.PROP_SET_USER_PROPERTY:
1867
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1868
- if (properties.userProperties.get(command.Operation) !== command.obj1) {
1869
- properties.userProperties.set(command.Operation, command.obj1);
1870
- this.customPropertiesSubject.next({ propertyName: controlId + '~' + command.Operation, value: command.obj1, rowId: guiRowId });
1871
- }
1872
- break;
1873
- case CommandType.PROP_SET_CUSTOM_VALIDATOR:
1874
- {
1875
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1876
- let control = this.getFormControl(guiRowId.toString(), controlId);
1877
- if (control != null) {
1878
- properties.customValidators.set(command.Operation, command.obj1);
1879
- if (control.validator != null)
1880
- control.setValidators([control.validator, this.customValidator(guiRowId.toString(), controlId)]);
1881
- else
1882
- control.setValidators(this.customValidator(guiRowId.toString(), controlId));
1883
- control.updateValueAndValidity();
1884
- }
1885
- }
1886
- break;
1887
- case CommandType.SET_CLASS:
1888
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1889
- properties.setClass(command.Operation, command.obj1);
1890
- break;
1891
- case CommandType.SET_STYLE:
1892
- properties = this.Records.list[guiRowId].getControlMetadata(controlId);
1893
- properties.setStyle(command.Operation, command.obj1);
1894
- break;
1895
- case CommandType.SET_ATTRIBUTE:
1896
- properties = this.Records.list[0].getControlMetadata(controlId);
1897
- properties.dataType = String.fromCharCode(command.number);
1898
- break;
1899
- case CommandType.SET_VALUE:
1900
- this.Records.list[guiRowId].values[controlId] = command.value;
1901
- let c = this.getFormControl(guiRowId.toString(), controlId);
1902
- if (!isNullOrUndefined(c)) {
1903
- c.setValue(this.ConvertValFromNative(controlId, command.line, command.value));
1904
- }
1905
- break;
1906
- case CommandType.CREATE_SUB_FORM:
1907
- this.mgSubformService.addSubformComp(command.CtrlName, command.userDropFormat.toString(), command.str, command.fileName, command.contextID, command.params, command.Bool1);
1908
- break;
1909
- case CommandType.CLOSE_SUB_FORM:
1910
- this.mgSubformService.deleteSubformComp(command.CtrlName, command.userDropFormat.toString());
1911
- break;
1912
- case CommandType.SET_EMPTY_DATAVIEW:
1913
- this.setIsEmptyDataView(command.Bool1);
1914
- break;
1915
- case CommandType.SET_FOCUS:
1916
- this.refreshDom.next(command);
1917
- break;
1918
- case CommandType.SET_WC_IDLE:
1919
- this.mgLoadSubject.next();
1920
- break;
1921
- }
1922
- }
1923
- customValidator(rowid, id) {
1924
- return (control) => {
1925
- let controlMetadata;
1926
- controlMetadata = this.Records.list[rowid].getControlMetadata(id);
1927
- for (let key of controlMetadata.customValidators.keys()) {
1928
- let validator = controlMetadata.customValidators.get(key);
1929
- if (!validator.isValid()) {
1930
- return { [key]: true };
1931
- }
1932
- }
1933
- return null;
1934
- };
1935
- }
1936
- ConvertValToNative(controlId, rowId, val) {
1937
- let properties;
1938
- properties = this.Records.list[0].getControlMetadata(controlId);
1939
- switch (properties.dataType) {
1940
- case StorageAttribute.BOOLEAN: {
1941
- if (typeof val === 'string') {
1942
- let ranges = this.GetFldRanges(controlId);
1943
- let found = ranges.indexOf(',');
1944
- let trueOption = ranges.substr(0, found);
1945
- let falseOption = ranges.substr(found + 1);
1946
- if (NString.Equals(val, trueOption, true))
1947
- return true;
1948
- else if (NString.Equals(val, falseOption, true))
1949
- return false;
1950
- else
1951
- return val;
1952
- }
1953
- else
1954
- return val;
1955
- }
1956
- case StorageAttribute.TIME: {
1957
- if (typeof val === 'string') {
1958
- let idx = val.indexOf(':', 0);
1959
- let hours = +val.substr(0, idx);
1960
- let minutes = +val.substr(idx + 1, 2);
1961
- let seconds = 0;
1962
- if (val.length > 5) {
1963
- idx = val.indexOf(':', idx + 1);
1964
- if (idx >= 0)
1965
- seconds = +val.substr(idx + 1, 2);
1966
- }
1967
- if (val.indexOf('PM') > 0)
1968
- hours += 12;
1969
- let dt = new Date();
1970
- dt.setHours(hours);
1971
- dt.setMinutes(minutes);
1972
- dt.setSeconds(seconds);
1973
- return dt;
1974
- }
1975
- else
1976
- return val;
1977
- }
1978
- case StorageAttribute.NUMERIC:
1979
- if (isUndefined(val))
1980
- return val;
1981
- else
1982
- return (val != null) ? (typeof val === 'string') ? val : +val : null;
1983
- default:
1984
- return val;
1985
- }
1986
- }
1987
- ConvertValFromNative(controlId, rowId, val) {
1988
- let properties;
1989
- properties = this.Records.list[0].getControlMetadata(controlId);
1990
- switch (properties.dataType) {
1991
- case StorageAttribute.TIME: {
1992
- if (val instanceof Date) {
1993
- let str = new StringBuilder();
1994
- let format = val.getHours() > 9 ? '{0}' : '0{0}';
1995
- str.AppendFormat(format, val.getHours().toString());
1996
- str.Append(':');
1997
- format = val.getMinutes() > 9 ? '{0}' : '0{0}';
1998
- str.AppendFormat(format, val.getMinutes().toString());
1999
- if (val.getSeconds() > 0) {
2000
- str.Append(':');
2001
- format = val.getSeconds() > 9 ? '{0}' : '0{0}';
2002
- str.AppendFormat(format, val.getSeconds().toString());
2003
- }
2004
- return str.ToString();
2005
- }
2006
- else
2007
- return val;
2008
- }
2009
- case StorageAttribute.BOOLEAN: {
2010
- let properties;
2011
- properties = this.Records.list['0'].getControlMetadata(controlId);
2012
- if (typeof val === 'boolean' && properties.rangeValidator) {
2013
- let ranges = this.GetFldRanges(controlId);
2014
- let found = ranges.indexOf(',');
2015
- let trueOption = ranges.substr(0, found);
2016
- let falseOption = ranges.substr(found + 1);
2017
- if (val)
2018
- return trueOption;
2019
- else
2020
- return falseOption;
2021
- }
2022
- else
2023
- return val;
2024
- }
2025
- default:
2026
- return val;
2027
- }
2028
- }
2029
- resize(pageSize, topGuiRowId) {
2030
- let guiEvent = getGuiEventObj('resize', 'table', 0);
2031
- guiEvent.PageSize = pageSize;
2032
- guiEvent.Line = topGuiRowId;
2033
- this.insertEvent(guiEvent);
2034
- }
2035
- onScrollDown() {
2036
- if (!this.Records.includesLast) {
2037
- let guiEvent = getGuiEventObj('getRows', '', 0);
2038
- guiEvent.Line = this.formGroups.length;
2039
- this.insertEvent(guiEvent);
2040
- }
2041
- }
2042
- setTitle(newTitle) {
2043
- this.mgTitleService.setTitle(newTitle);
2044
- }
2045
- getGuiRowId(dvRowId, isTableControl) {
2046
- return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
2047
- }
2048
- getDvRowId(guiRowId) {
2049
- return (guiRowId - this.Records.recordsBeforeCurrentView);
2050
- }
2051
- dispose() {
2052
- this.refreshDom.complete();
2053
- this.detectChanges.complete();
2054
- this.subscribeInteractiveCommands.unsubscribe();
2055
- this.subscribeRefreshDom.unsubscribe();
2056
- this.interactiveCommands.complete();
2057
- this.customPropertiesSubject.complete();
2058
- this.OnSelectedRowChanged.complete();
2059
- }
2060
- onComboboxSelectionChanged(event, idx, line) {
2061
- let guiEvent = getGuiEventObj('selectionchanged', idx, line);
2062
- if (typeof (event) == 'number') {
2063
- guiEvent.Value = event;
2064
- }
2065
- else {
2066
- if (!isNullOrUndefined(event.target)) {
2067
- let indexes = new Array(event.target.selectedOptions.length);
2068
- for (let i = 0; i < event.target.selectedOptions.length; i++) {
2069
- indexes[i] = event.target.selectedOptions[i].index;
2070
- }
2071
- guiEvent.Value = indexes.join(',');
2072
- }
2073
- else
2074
- guiEvent.Value = event.value;
2075
- }
2076
- this.insertEvent(guiEvent);
2077
- }
2078
- onListBoxSelectionChanged(event, idx) {
2079
- let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2080
- let selectedOptions;
2081
- if (!isNullOrUndefined(event.target))
2082
- selectedOptions = event.target.selectedOptions;
2083
- else
2084
- selectedOptions = event.source.selectedOptions.selected;
2085
- let length = selectedOptions.length;
2086
- let indexes = new Array(length);
2087
- for (let i = 0; i < length; i++) {
2088
- if (!isNullOrUndefined(event.target))
2089
- indexes[i] = (selectedOptions[i]).index;
2090
- else
2091
- indexes[i] = (selectedOptions[i]).value;
2092
- }
2093
- guiEvent.Value = indexes;
2094
- this.insertEvent(guiEvent);
2095
- }
2096
- onCheckChanged(event, idx, rowId) {
2097
- if (typeof rowId === 'undefined')
2098
- rowId = 0;
2099
- let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
2100
- if (typeof (event) == 'boolean') {
2101
- guiEvent.Value = event;
2102
- }
2103
- else {
2104
- if (typeof event.target === 'undefined')
2105
- guiEvent.Value = (event).checked;
2106
- else
2107
- guiEvent.Value = (event.target).checked;
2108
- }
2109
- this.insertEvent(guiEvent);
2110
- }
2111
- mgOnTabSelectionChanged(idx, layer) {
2112
- let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2113
- guiEvent.Value = layer.toString();
2114
- this.insertEvent(guiEvent);
2115
- }
2116
- mgOnRadioSelectionChanged(idx) {
2117
- let result = this.getFormControl('0', idx);
2118
- let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2119
- if (typeof result.value !== 'number')
2120
- guiEvent.Value = result.value.index;
2121
- else
2122
- guiEvent.Value = result.value.toString();
2123
- this.insertEvent(guiEvent);
2124
- }
2125
- close() {
2126
- this.insertEvent(getGuiEventObj('close', null, 0));
2127
- }
2128
- IsStub() {
2129
- return this.magic.isStub;
2130
- }
2131
- saveData(data) {
2132
- this.magic.saveData(data);
2133
- }
2134
- createData() {
2135
- let myData = {
2136
- records: this.Records,
2137
- template: this.template
2138
- };
2139
- let text = 'loadData():any {\n' +
2140
- ' let stubData = ' + JSON.stringify(myData) + ';\n' +
2141
- ' this.loadStubData(stubData);}';
2142
- console.log(text);
2143
- this.saveData(text);
2144
- }
2145
- loadStubData(stubData) {
2146
- this.Records = stubData.records;
2147
- this.settemplate(stubData.template);
2148
- this.taskId = '1';
2149
- for (let i = 0; i < this.Records.list.length; i++)
2150
- this.buildTableRowControls(i);
2151
- }
2152
- loadData() {
2153
- alert('Please, overwrite method loadData');
2154
- }
2155
- setStubValue(guiRowId, fc, name) {
2156
- if (this.IsStub()) {
2157
- try {
2158
- let val = this.Records.list[guiRowId].values[name];
2159
- fc.setValue(val);
2160
- }
2161
- catch (e) {
2162
- }
2163
- }
2164
- }
2165
- }
2166
- TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayWindowService)); };
2167
- TaskMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
2168
- (function () {
2169
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskMagicService, [{
2170
- type: Injectable
2171
- }], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null);
2172
- })();
2173
-
2174
- class TableMagicService {
2175
- constructor(componentList, task) {
2176
- this.componentList = componentList;
2177
- this.task = task;
2178
- this.shouldOpenFieldTextEditor = true;
2179
- }
2180
- refreshDataSource() {
2181
- }
2182
- getPageSize() {
2183
- return this.chunkSize;
2184
- }
2185
- setChunkSize(size) {
2186
- this.chunkSize = size;
2187
- }
2188
- getMaxRowsInTable() {
2189
- return this.task.Records.list.length;
2190
- }
2191
- selectRow(rowId) {
2192
- this.selectedItem = rowId;
2193
- }
2194
- getSelectedRow() {
2195
- return this.selectedItem;
2196
- }
2197
- selectedRow() {
2198
- return null;
2199
- }
2200
- selectPage(pageId) {
2201
- }
2202
- OpenDialogForControl(element) {
2203
- if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
2204
- element.tagName === "INPUT" ||
2205
- element.tagName === "SELECT")
2206
- return false;
2207
- return true;
2208
- }
2209
- getDialog() {
2210
- return null;
2211
- }
2212
- onScrollDown() {
2213
- this.task.onScrollDown();
2214
- }
2215
- sortData(e) { }
2216
- mgOnPaginateChange(e, changeSelectedRow) { }
2217
- mgOptionChanged(e) { }
2218
- updateTableSize(size) {
2219
- if (size === 0) {
2220
- size = 1;
2221
- this.task.Records.clearFirstTableRecord(this.task.template);
2222
- }
2223
- this.task.formGroups.length = size;
2224
- this.task.Records.updateSize(size);
2225
- this.task.setIncludesFirst(false);
2226
- }
2227
- setTableTopIndex(value) {
2228
- if (!this.task.Records.includesFirst)
2229
- value++;
2230
- this.task.Records.setGuiTopIndex(value);
2231
- }
2232
- getTableTopIndex() {
2233
- let topIndex = this.task.Records.getGuiTopIndex();
2234
- if (!this.task.Records.includesFirst)
2235
- topIndex--;
2236
- return topIndex;
2237
- }
2238
- }
2239
- TableMagicService.ɵfac = function TableMagicService_Factory(t) { return new (t || TableMagicService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(TaskMagicService)); };
2240
- TableMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
2241
- (function () {
2242
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableMagicService, [{
2243
- type: Injectable
2244
- }], function () { return [{ type: ComponentListMagicService }, { type: TaskMagicService }]; }, null);
2245
- })();
2246
-
2247
- class TitleMagicService {
2248
- constructor(titleService) {
2249
- this.titleService = titleService;
2250
- }
2251
- setTitle(newTitle) {
2252
- this.titleService.setTitle(newTitle);
2253
- }
2254
- }
2255
- TitleMagicService.ɵfac = function TitleMagicService_Factory(t) { return new (t || TitleMagicService)(i0.ɵɵinject(i1$1.Title)); };
2256
- TitleMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
2257
- (function () {
2258
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TitleMagicService, [{
2259
- type: Injectable
2260
- }], function () { return [{ type: i1$1.Title }]; }, null);
2261
- })();
2262
-
2263
- let COLOR_FILE_NAME = new InjectionToken('colorFile', {
2264
- providedIn: 'root',
2265
- factory: () => 'clr_rnt.eng'
2266
- });
2267
- const MAGIC_FG_COLOR = 1;
2268
- const MAGIC_BG_COLOR = 2;
2269
- const SYSTEM_FG = 2;
2270
- const SYSTEM_BG = 4;
2271
- const SYSTEM_FG_AND_SYSTEM_BG = 6;
2272
- const TRANSPERENT_BG = 1;
2273
- class MagicColorService {
2274
- getColorFilePath() {
2275
- return 'assets/' + this.colorFileName;
2276
- }
2277
- constructor(http, colorFile1 = 'clr_rnt.eng') {
2278
- this.http = http;
2279
- this.colorFileName = 'clr_rnt.eng';
2280
- this.fileNotFound = false;
2281
- if (colorFile1)
2282
- this.colorFileName = colorFile1;
2283
- else
2284
- this.colorFileName = 'clr_rnt.eng';
2285
- }
2286
- getColorData() {
2287
- if (!this.colorsData) {
2288
- this.http.get(this.getColorFilePath(), { responseType: 'text' }).subscribe(resp => {
2289
- this.colorsData = resp.replace(/\n/g, '@').split('@');
2290
- }, error1 => {
2291
- console.error('File not found ' + this.colorFileName);
2292
- this.fileNotFound = true;
2293
- });
2294
- }
2295
- }
2296
- hexToRgba(hex, isTransperent) {
2297
- let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i;
2298
- hex = hex.replace(shorthandRegex, function (m, r, g, b, a) {
2299
- return a + a + r + r + g + g + b + b;
2300
- });
2301
- let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
2302
- let rgb = {
2303
- 'red': parseInt(result[4], 16),
2304
- 'green': parseInt(result[3], 16),
2305
- 'blue': parseInt(result[2], 16),
2306
- 'alpha': (255 - parseInt(result[1], 16)) / 255
2307
- };
2308
- if (isTransperent)
2309
- rgb.alpha = 0;
2310
- return 'rgba(' + rgb.red + ',' + rgb.green + ',' + rgb.blue + ',' + rgb.alpha + ')';
2311
- }
2312
- getColor(colorIndex, colorType) {
2313
- let isTransperent = false;
2314
- if (!this.colorsData && !this.fileNotFound)
2315
- this.getColorData();
2316
- if (this.colorsData) {
2317
- if (this.colorsData[colorIndex - 1]) {
2318
- const grayHashCode = '00808080';
2319
- let hex = grayHashCode;
2320
- let color = this.colorsData[colorIndex - 1].split(',');
2321
- let colorAtrributes = +color[3];
2322
- switch (colorType) {
2323
- case MAGIC_FG_COLOR:
2324
- if (colorAtrributes != SYSTEM_FG && colorAtrributes != SYSTEM_FG_AND_SYSTEM_BG)
2325
- hex = (color[1]);
2326
- break;
2327
- case MAGIC_BG_COLOR:
2328
- if (colorAtrributes != SYSTEM_BG && colorAtrributes != SYSTEM_FG_AND_SYSTEM_BG) {
2329
- if (colorAtrributes == TRANSPERENT_BG)
2330
- isTransperent = true;
2331
- hex = (color[2]);
2332
- }
2333
- break;
2334
- default:
2335
- console.log('Please enter valid color type : 1-FG, 2-BG ' + colorIndex);
2336
- return '';
2337
- }
2338
- return this.hexToRgba('#' + hex, isTransperent);
2339
- }
2340
- else
2341
- console.log('Could not get color for number ' + colorIndex);
2342
- }
2343
- return '';
2344
- }
2345
- }
2346
- MagicColorService.ɵfac = function MagicColorService_Factory(t) { return new (t || MagicColorService)(i0.ɵɵinject(i1$2.HttpClient), i0.ɵɵinject(COLOR_FILE_NAME)); };
2347
- MagicColorService.ɵprov = i0.ɵɵdefineInjectable({ token: MagicColorService, factory: MagicColorService.ɵfac, providedIn: 'root' });
2348
- (function () {
2349
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicColorService, [{
2350
- type: Injectable,
2351
- args: [{
2352
- providedIn: 'root'
2353
- }]
2354
- }], function () {
2355
- return [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
2356
- type: Inject,
2357
- args: [COLOR_FILE_NAME]
2358
- }] }];
2359
- }, null);
2360
- })();
2361
-
2362
- class AccessorMagicService {
2363
- constructor(task, magicColor) {
2364
- this.task = task;
2365
- this.magicColor = magicColor;
2366
- this.Logger = null;
2367
- this.hhmm = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
2368
- this.hhmmss = maskitoTimeOptionsGenerator({ mode: 'HH:MM:SS' });
2369
- this.Logger = Logger.Instance;
2370
- }
2371
- checkIsReadOnly(controlId) {
2372
- let properties;
2373
- properties = this.task.Records.list[0].getControlMetadata(controlId);
2374
- if (properties.properties.get(HtmlProperties.ReadOnly) !== null && properties.properties.get(HtmlProperties.ReadOnly) === true)
2375
- return true;
2376
- else
2377
- return false;
2378
- }
2379
- getText(controlId, rowId) {
2380
- return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
2381
- }
2382
- getTabpageText(controlId, layer) {
2383
- const items = this.task.getProperty(controlId, HtmlProperties.ItemsList);
2384
- if (typeof items !== "undefined")
2385
- return items[layer].displayValue;
2386
- return "";
2387
- }
2388
- getImage(controlId, rowId) {
2389
- let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2390
- return result;
2391
- }
2392
- isImageExists(controlId, rowId) {
2393
- let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
2394
- return !isNullOrUndefined(result);
2395
- }
2396
- getClasses(controlId, rowId) {
2397
- return this.task.getClasses(controlId, rowId);
2398
- }
2399
- getStyle(controlId, styleName, rowId) {
2400
- let style = this.task.getStyle(controlId, styleName, rowId);
2401
- return style;
2402
- }
2403
- getVisible(controlId, rowId) {
2404
- let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
2405
- return vis ? 'visible' : 'hidden';
2406
- }
2407
- getAlphaMask(controlId, rowId) {
2408
- if (isNullOrUndefined(controlId))
2409
- return null;
2410
- let pic = this.task.GetControlPictureMask(controlId);
2411
- let mask = pic.getMask();
2412
- let valueStr = new StringBuilder();
2413
- for (let i = 0; i < mask.length; i++) {
2414
- switch (mask.charCodeAt(i)) {
2415
- case PICInterface.PIC_N:
2416
- valueStr.Append("0");
2417
- break;
2418
- case PICInterface.PIC_U:
2419
- case PICInterface.PIC_L:
2420
- case PICInterface.PIC_X:
2421
- valueStr.Append("A");
2422
- break;
2423
- default:
2424
- valueStr.Append(mask.charAt(i));
2425
- break;
2426
- }
2427
- }
2428
- return (pic != null) ? valueStr.toString() : null;
2429
- }
2430
- getNumericPicture(picture) {
2431
- var obj = {};
2432
- if (isNullOrUndefined(picture))
2433
- return obj;
2434
- let pic = new PIC(picture, StorageAttribute.NUMERIC, 0);
2435
- obj['prefix'] = "";
2436
- if (pic.getPosPref_().length > 0 && pic.getNegPref_().length > 0) {
2437
- let pref = '-' + pic.getPosPref_();
2438
- if (pref == pic.getNegPref_())
2439
- obj['prefix'] = pic.getPosPref_();
2440
- }
2441
- if (pic.getPosSuff_().length > 0)
2442
- obj['suffix'] = pic.getPosSuff_();
2443
- else
2444
- obj['suffix'] = "";
2445
- if (pic.isNegative())
2446
- obj['allowNegative'] = true;
2447
- else
2448
- obj['allowNegative'] = false;
2449
- if (pic.getDec() >= 0)
2450
- obj['precision'] = pic.getDec();
2451
- if (pic.isLeft())
2452
- obj['align'] = "left";
2453
- obj['decimal'] = GuiEnvironment.Environment.GetDecimal();
2454
- if (pic.withComa())
2455
- obj['thousands'] = GuiEnvironment.Environment.GetThousands();
2456
- else
2457
- obj['thousands'] = "";
2458
- if (pic.getWholes())
2459
- obj['wholes'] = pic.getWholes();
2460
- return obj;
2461
- }
2462
- getMustInput(controlId, rowId) {
2463
- let vis = this.getProperty(controlId, HtmlProperties.MustInput, rowId);
2464
- return vis ? 'true' : 'false';
2465
- }
2466
- isDisabled(controlId, rowId) {
2467
- let result = this.getProperty(controlId, HtmlProperties.Enabled, rowId);
2468
- return result === true ? null : true;
2469
- }
2470
- getProperty(controlId, prop, rowId) {
2471
- return this.task.getProperty(controlId, prop, rowId);
2472
- }
2473
- getTitle(controlId, rowId) {
2474
- return this.task.getProperty(controlId, HtmlProperties.Tooltip, rowId);
2475
- }
2476
- getZoomButtonTitle(controlId, rowId) {
2477
- return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
2478
- }
2479
- getSelectedValue(controlId, rowId) {
2480
- return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
2481
- }
2482
- getPlaceholder(controlId, rowId) {
2483
- return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
2484
- }
2485
- getType(controlId, rowId) {
2486
- let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
2487
- return result ? "password" : "text";
2488
- }
2489
- getTabIndex(controlId, rowId) {
2490
- return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
2491
- }
2492
- getValue(controlId, rowId) {
2493
- let val = this.task.getValue(controlId, rowId);
2494
- return val;
2495
- }
2496
- getFormattedValue(controlId, rowId) {
2497
- let val = this.task.getValue(controlId, rowId);
2498
- val = this.task.getFormattedValue(controlId, val, rowId);
2499
- return val;
2500
- }
2501
- getPicture(controlId, rowId) {
2502
- if (isNullOrUndefined(controlId))
2503
- return null;
2504
- let pic = this.task.GetControlPictureMask(controlId);
2505
- return (pic != null) ? pic.getFormat().toString() : null;
2506
- }
2507
- getCustomProperty(controlId, propertyNameOrRowID, rowId) {
2508
- if (controlId.indexOf('~') == -1)
2509
- return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
2510
- else {
2511
- let cid = controlId.split('~')[0];
2512
- let propName = controlId.split('~')[1];
2513
- return this.getCustomProperty_1(cid, propName, propertyNameOrRowID);
2514
- }
2515
- }
2516
- getCustomProperty_1(controlId, propertyName, rowId) {
2517
- let userProperties;
2518
- if (isNullOrUndefined(rowId))
2519
- rowId = '0';
2520
- let rec = this.task.Records.list[rowId];
2521
- if (isNullOrUndefined(rec))
2522
- debugger;
2523
- else {
2524
- const controlMetadata = rec.getControlMetadata(controlId);
2525
- if (controlMetadata.userProperties.has(propertyName)) {
2526
- userProperties = controlMetadata.userProperties.get(propertyName);
2527
- }
2528
- }
2529
- return userProperties;
2530
- }
2531
- getItemListValues(id, rowId) {
2532
- return this.getProperty(id, HtmlProperties.ItemsList, rowId);
2533
- }
2534
- getFilteredList(controlId, rowId) {
2535
- if (isNullOrUndefined(rowId))
2536
- rowId = '0';
2537
- let items = this.getItemListValues(controlId, rowId);
2538
- let value = this.task.getFormControl(rowId, controlId).value;
2539
- if (value !== null && value !== "" && items instanceof Array) {
2540
- value = value.toLowerCase();
2541
- return items.filter(option => option.displayValue.toLowerCase().includes(value));
2542
- }
2543
- else
2544
- return items;
2545
- }
2546
- getDisplayValue(id, rowId) {
2547
- let displayValue = "";
2548
- let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
2549
- let value = this.task.getValue(id, rowId);
2550
- if (value >= 0 && value < o.length && !isNullOrUndefined(o[value]))
2551
- displayValue = o[value].displayValue;
2552
- return displayValue;
2553
- }
2554
- isOptionSelected(index, controlId) {
2555
- let val = this.task.getValue(controlId, "0");
2556
- for (let item of val) {
2557
- if (item === index)
2558
- return true;
2559
- }
2560
- return false;
2561
- }
2562
- isTabPageSelected(controlId, layer) {
2563
- let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
2564
- return val == (layer - 1);
2565
- }
2566
- isTabPageLayerSelected(controlId, layer) {
2567
- let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
2568
- return val == (layer - 1);
2569
- }
2570
- getTabSelectedIndex(controlId) {
2571
- let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
2572
- return val;
2573
- }
2574
- ifRowCreated(row) {
2575
- if (row == null)
2576
- return false;
2577
- let rowId = typeof row == "number" ? row.toString() : row.rowId;
2578
- let result = this.getFormGroupByRow(rowId);
2579
- return !isNullOrUndefined(result);
2580
- }
2581
- getFormGroupByRow(id) {
2582
- return this.task.formGroups[id];
2583
- }
2584
- isRowSelected(controlId, rowId) {
2585
- const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
2586
- return selectedRow == rowId;
2587
- }
2588
- isRowInRowEditing(row) {
2589
- let guiRowId = '0';
2590
- guiRowId = typeof row == "number" ? row.toString() : row.rowId;
2591
- return this.task.isRowInRowEditing(guiRowId);
2592
- }
2593
- isCurrentInRowEditing() {
2594
- let row = this.task.tableService.getSelectedRow();
2595
- return this.task.isRowInRowEditing(row);
2596
- }
2597
- guiTopIndex() {
2598
- return this.task.tableService.getTableTopIndex();
2599
- }
2600
- getErrMsg(id, rowId) {
2601
- let c = this.task.getFormControl(rowId, id);
2602
- if (c.hasError('required'))
2603
- return 'Control must be updated.';
2604
- if (c.hasError('pattern')) {
2605
- if (c.errors.pattern.actualValue < 0 && !c.errors.pattern.requiredPattern.includes('-'))
2606
- return 'Value must be non-negative';
2607
- if (c.errors.pattern.requiredPattern.includes('.')) {
2608
- const numericFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[0];
2609
- const decimalFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[1];
2610
- const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2611
- const actualDecimalLimit = c.errors.pattern.requiredPattern.match(/(?:[^,]+,){2}(\d+)/)[1];
2612
- if (numericFormat.length > actualNumericLimit || decimalFormat.length > actualDecimalLimit) {
2613
- return "Numeric format is limited to " + actualNumericLimit + "." + actualDecimalLimit + " digits";
2614
- }
2615
- }
2616
- else if (!c.errors.pattern.requiredPattern.includes('.') && !Number.isInteger(c.errors.pattern.actualValue)) {
2617
- const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2618
- return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
2619
- }
2620
- else {
2621
- const numericFormat = Math.abs(c.errors.pattern.actualValue).toString();
2622
- const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2623
- if (numericFormat.length > actualNumericLimit) {
2624
- return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
2625
- }
2626
- }
2627
- }
2628
- if (c.hasError('rangevalidator'))
2629
- return c.errors.rangevalidator.errorMsg;
2630
- if (c.hasError('maxlength'))
2631
- return 'Max length allowed is : ' + c.errors.maxlength.requiredLength;
2632
- if (c.hasError('max'))
2633
- return 'Max value allowed is : ' + c.errors.max.max;
2634
- let controlMetadata = this.task.Records.list[rowId].getControlMetadata(id);
2635
- for (let key of controlMetadata.customValidators.keys()) {
2636
- if (c.hasError(key)) {
2637
- let customValidator = controlMetadata.customValidators.get(key);
2638
- return customValidator.getErrMessage();
2639
- }
2640
- }
2641
- return 'unknown error';
2642
- }
2643
- setValueToControl(controlName, value, refreshDisplay) {
2644
- if (typeof refreshDisplay === "undefined")
2645
- refreshDisplay = true;
2646
- let guiEvent = getGuiEventObj("setexternalvalue", controlName, 0);
2647
- guiEvent.externalValue = value;
2648
- guiEvent.param = refreshDisplay;
2649
- this.task.insertEvent(guiEvent);
2650
- }
2651
- isDataviewEmpty() {
2652
- return this.task.Records.isEmptyDataView;
2653
- }
2654
- simulateClick(controlName, rowId) {
2655
- if (typeof rowId === "undefined")
2656
- rowId = 0;
2657
- this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
2658
- }
2659
- isLoggedIn() {
2660
- return this.task.getIsLoggenIn();
2661
- }
2662
- GetFormRecords() {
2663
- let rowId = 0;
2664
- let recArray;
2665
- if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
2666
- let recList = this.task.Records.list;
2667
- let tableControls = new Array();
2668
- for (const key in this.task.template) {
2669
- if (this.task.template[key] == '1')
2670
- tableControls.push(key);
2671
- }
2672
- recArray = new Array();
2673
- if (tableControls.length > 0) {
2674
- recList.forEach((ctrlMetaData) => {
2675
- if (this.task.Records.isRowCreated(rowId)) {
2676
- var formRecord = {};
2677
- formRecord['rowId'] = rowId;
2678
- tableControls.forEach((ctrlId) => {
2679
- formRecord[ctrlId] = ctrlMetaData.values[ctrlId];
2680
- });
2681
- recArray.push(formRecord);
2682
- }
2683
- });
2684
- }
2685
- }
2686
- return recArray;
2687
- }
2688
- SetCookie(name, value, expires, path, domain, secure, sameSite) {
2689
- CookieService.setCookie(name, value, expires, path, domain, secure, sameSite);
2690
- }
2691
- GetCookie(name) {
2692
- return CookieService.getCookie(name);
2693
- }
2694
- DeleteCookie(name) {
2695
- return CookieService.deleteCookie(name);
2696
- }
2697
- getColor(colorNumber, colorType) {
2698
- return this.magicColor.getColor(colorNumber, colorType);
2699
- }
2700
- }
2701
- AccessorMagicService.ɵfac = function AccessorMagicService_Factory(t) { return new (t || AccessorMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MagicColorService)); };
2702
- AccessorMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
2703
- (function () {
2704
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AccessorMagicService, [{
2705
- type: Injectable
2706
- }], function () { return [{ type: TaskMagicService }, { type: MagicColorService }]; }, null);
2707
- })();
2708
-
2709
- class MagicServices {
2710
- constructor(task, subformService, tableService, titleService, mgAccessorService) {
2711
- this.task = task;
2712
- this.subformService = subformService;
2713
- this.tableService = tableService;
2714
- this.titleService = titleService;
2715
- this.mgAccessorService = mgAccessorService;
2716
- task.tableService = tableService;
2717
- task.mgSubformService = subformService;
2718
- task.mgTitleService = titleService;
2719
- task.mgAccessorService = mgAccessorService;
2720
- }
2721
- }
2722
- MagicServices.ɵfac = function MagicServices_Factory(t) { return new (t || MagicServices)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(SubformMagicService), i0.ɵɵinject(TableMagicService), i0.ɵɵinject(TitleMagicService), i0.ɵɵinject(AccessorMagicService)); };
2723
- MagicServices.ɵprov = i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
2724
- (function () {
2725
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicServices, [{
2726
- type: Injectable
2727
- }], function () { return [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }]; }, null);
2728
- })();
2729
-
2730
- class TaskBaseMagicComponent {
2731
- constructor(ref, magicServices) {
2732
- this.ref = ref;
2733
- this.magicServices = magicServices;
2734
- this.magicProperties = MagicProperties;
2735
- }
2736
- get task() {
2737
- return this.magicServices.task;
2738
- }
2739
- get mgSub() {
2740
- return this.magicServices.subformService;
2741
- }
2742
- get tableService() {
2743
- return this.magicServices.tableService;
2744
- }
2745
- get mg() {
2746
- return this.magicServices.mgAccessorService;
2747
- }
2748
- get taskId() {
2749
- return this.task.taskId;
2750
- }
2751
- get screenFormGroup() {
2752
- return this.task.ScreenModeControls;
2753
- }
2754
- ngOnInit() {
2755
- this.task.detectChanges.pipe().subscribe(c => {
2756
- this.ref.detectChanges();
2757
- });
2758
- this.task.initTask(this.taskIdParam, this.taskDescription);
2759
- this.createFormControlsAccessor(this.screenFormGroup);
2760
- this.setInputDateFormat();
2761
- this.task.customPropertiesSubject.pipe().subscribe(property => {
2762
- this.PropertyChanged(property.propertyName, property.rowId, property.value);
2763
- });
2764
- this.task.recordsCountChangeSubject.pipe().subscribe(value => {
2765
- this.RecordsCountChanged(value);
2766
- });
2767
- this.task.mgLoadSubject.pipe().subscribe(value => {
2768
- this.mgOnLoad();
2769
- });
2770
- }
2771
- createFormControlsAccessor(formGroup) { }
2772
- setInputDateFormat() { }
2773
- PropertyChanged(propertyName, rowId, value) {
2774
- }
2775
- RecordsCountChanged(recordsCount) {
2776
- }
2777
- mgOnLoad() {
2778
- }
2779
- ngAfterViewInit() {
2780
- this.mgSub.init();
2781
- }
2782
- ngAfterContentChecked() {
2783
- if (!isNullOrUndefined(this.tableService.getPageSize()) && this.task.oldPageSize != this.tableService.getPageSize()) {
2784
- this.task.resize(this.tableService.getPageSize(), 0);
2785
- this.task.oldPageSize = this.tableService.getPageSize();
2786
- }
2787
- }
2788
- ngOnDestroy() {
2789
- this.task.dispose();
2790
- }
2791
- }
2792
- TaskBaseMagicComponent.ɵfac = function TaskBaseMagicComponent_Factory(t) { return new (t || TaskBaseMagicComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(MagicServices)); };
2793
- TaskBaseMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TaskBaseMagicComponent, selectors: [["task-magic"]], inputs: { taskIdParam: "taskIdParam", taskDescription: "taskDescription" }, features: [i0.ɵɵProvidersFeature([TaskMagicService, SubformMagicService, TableMagicService])], decls: 0, vars: 0, template: function TaskBaseMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
2794
- (function () {
2795
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskBaseMagicComponent, [{
2796
- type: Component,
2797
- args: [{
2798
- selector: 'task-magic',
2799
- providers: [TaskMagicService, SubformMagicService, TableMagicService],
2800
- template: ''
2801
- }]
2802
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: MagicServices }]; }, { taskIdParam: [{
2803
- type: Input
2804
- }], taskDescription: [{
2805
- type: Input
2806
- }] });
2807
- })();
2808
-
2809
- class RowMagicDirective {
2810
- constructor(_task, element) {
2811
- this._task = _task;
2812
- this.element = element;
2813
- this.rowChangedSubscriber = null;
2814
- this.htmlElement = this.element.nativeElement;
2815
- }
2816
- ngOnInit() {
2817
- this.rowChangedSubscriber = this._task
2818
- .OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
2819
- .subscribe(rowId => {
2820
- if (!this.isInView(this.htmlElement))
2821
- this.htmlElement.scrollIntoView();
2822
- });
2823
- }
2824
- isInView(element) {
2825
- const rect = element.getBoundingClientRect();
2826
- const parentRect = element.parentElement.getBoundingClientRect();
2827
- return (rect.top >= parentRect.top &&
2828
- rect.bottom <= parentRect.bottom);
2829
- }
2830
- ngOnDestroy() {
2831
- if (this.rowChangedSubscriber !== null) {
2832
- this.rowChangedSubscriber.unsubscribe();
2833
- }
2834
- }
2835
- onClick($event) {
2836
- if (this.rowId != '') {
2837
- this._task.insertEvent(getGuiEventObj('click', "magicRow", +this.rowId));
2838
- if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
2839
- event.cancelBubble = true;
2840
- }
2841
- }
2842
- }
2843
- RowMagicDirective.ɵfac = function RowMagicDirective_Factory(t) { return new (t || RowMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
2844
- RowMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) {
2845
- if (rf & 1) {
2846
- i0.ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
2847
- }
2848
- }, inputs: { rowId: ["magicRow", "rowId"] } });
2849
- (function () {
2850
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RowMagicDirective, [{
2851
- type: Directive,
2852
- args: [{
2853
- selector: '[magicRow]'
2854
- }]
2855
- }], function () { return [{ type: TaskMagicService }, { type: i0.ElementRef }]; }, { rowId: [{
2856
- type: Input,
2857
- args: ['magicRow']
2858
- }], onClick: [{
2859
- type: HostListener,
2860
- args: ['click', ['$event']]
2861
- }] });
2862
- })();
2863
-
2864
- class MagicDirective {
2865
- set magic(val) {
2866
- this.id = val;
2867
- this.selector = "magic";
2868
- }
2869
- ;
2870
- set eventsOnly(val) {
2871
- console.log("eventsOnly");
2872
- this.eventsOnlyVal = true;
2873
- }
2874
- ;
2875
- constructor(_task, element, renderer, vcRef, platform, magicRow) {
2876
- this._task = _task;
2877
- this.element = element;
2878
- this.renderer = renderer;
2879
- this.vcRef = vcRef;
2880
- this.platform = platform;
2881
- this.magicRow = magicRow;
2882
- this.eventHandlers = {};
2883
- this.eventsOnlyVal = false;
2884
- this.htmlElement = this.element.nativeElement;
2885
- if (!(typeof magicRow === "undefined" || magicRow === null))
2886
- this.rowId = magicRow.rowId;
2887
- }
2888
- get task() {
2889
- return this._task;
2890
- }
2891
- regEvents() {
2892
- this.eventHandlers["focusin"] = this.OnFocus.bind(this);
2893
- Object.keys(this.eventHandlers).forEach((key) => {
2894
- this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
2895
- });
2896
- let events = ["click", "mousedown", "dblclick"];
2897
- events.forEach(event => {
2898
- this.renderer.listen(this.htmlElement, event, (e) => {
2899
- let fromButton = false;
2900
- if (this.htmlElement instanceof HTMLButtonElement)
2901
- fromButton = true;
2902
- if (fromButton && (this.platform.IOS || this.platform.SAFARI))
2903
- this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
2904
- this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
2905
- if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
2906
- e.cancelBubble = true;
2907
- });
2908
- });
2909
- this.renderer.listen(this.htmlElement, "change", (e) => {
2910
- let guiEvent = getGuiEventObj("selectionchanged", this.id, +this.rowId);
2911
- if ((event.target).selectedIndex !== undefined) {
2912
- guiEvent.Value = (event.target).selectedIndex.toString();
2913
- e.cancelBubble = true;
2914
- this.task.insertEvent(guiEvent);
2915
- }
2916
- });
2917
- fromEvent(this.htmlElement, "input").pipe(map((event) => {
2918
- return event.target.value;
2919
- }), debounceTime(200)).subscribe((x) => {
2920
- if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
2921
- let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
2922
- if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
2923
- this.task.mgAccessorService.setValueToControl(this.id, x, true);
2924
- }
2925
- });
2926
- this.renderer.listen(this.htmlElement, "keydown", (e) => {
2927
- let guiEvent = getGuiEventObj("keydown", this.id, +this.rowId);
2928
- guiEvent.modifiers = Modifiers.MODIFIER_NONE;
2929
- if (e.altKey && e.keyCode !== GuiConstants.KEY_ALT)
2930
- guiEvent.modifiers = Modifiers.MODIFIER_ALT;
2931
- else if (e.ctrlKey && e.keyCode !== GuiConstants.KEY_CTRL)
2932
- guiEvent.modifiers = Modifiers.MODIFIER_CTRL;
2933
- let supportedKey = e.keyCode === GuiConstants.KEY_PG_UP ||
2934
- e.keyCode === GuiConstants.KEY_PG_DOWN ||
2935
- e.keyCode === GuiConstants.KEY_LEFT ||
2936
- e.keyCode === GuiConstants.KEY_RIGHT ||
2937
- e.keyCode === GuiConstants.KEY_UP ||
2938
- e.keyCode === GuiConstants.KEY_DOWN ||
2939
- e.keyCode === GuiConstants.KEY_ESC ||
2940
- e.keyCode === GuiConstants.KEY_HOME ||
2941
- e.keyCode === GuiConstants.KEY_END ||
2942
- e.keyCode === GuiConstants.KEY_RETURN ||
2943
- (e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
2944
- if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
2945
- guiEvent.keyCode = e.keyCode;
2946
- if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
2947
- e.cancelBubble = true;
2948
- this.task.insertEvent(guiEvent);
2949
- }
2950
- });
2951
- }
2952
- OnFocus() {
2953
- this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
2954
- event.cancelBubble = true;
2955
- }
2956
- IsSameElement(command) {
2957
- let line = command.line;
2958
- if (this.task.isTableControl(command.CtrlName))
2959
- line = this.task.getGuiRowId(line, true);
2960
- return (command.CtrlName === this.id &&
2961
- (line === +this.rowId ||
2962
- (line === 0 && isNullOrUndefined(this.rowId))));
2963
- }
2964
- IsSameComponent(command) {
2965
- return (command.controlName === this.id);
2966
- }
2967
- regUpdatesUI() {
2968
- this.subscribeRefreshDom = this.task
2969
- .refreshDom.pipe(filter(c => this.IsSameElement(c)))
2970
- .subscribe(a => {
2971
- let command = a;
2972
- if (isNullOrUndefined(this.rowId))
2973
- this.rowId = "0";
2974
- try {
2975
- if (!this.eventsOnlyVal)
2976
- this.handleCommand(command);
2977
- }
2978
- catch (ex) {
2979
- console.dir(ex);
2980
- }
2981
- });
2982
- this.subscribeInteractiveCommands = this.task.interactiveCommands
2983
- .pipe(filter(c => this.IsSameComponent(c)))
2984
- .subscribe(command => {
2985
- this.handleInteractiveCommands(command);
2986
- });
2987
- }
2988
- ngOnInit() {
2989
- this.regEvents();
2990
- this.regUpdatesUI();
2991
- }
2992
- handleCommand(command) {
2993
- switch (command.CommandType) {
2994
- case CommandType.SET_PROPERTY:
2995
- this.handleSetProperty(command);
2996
- break;
2997
- case CommandType.SET_FOCUS:
2998
- this.focusUnlistener();
2999
- if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
3000
- this.htmlElement.focus();
3001
- this.focusUnlistener = this.renderer.listen(this.htmlElement, "focusin", this.eventHandlers["focusin"]);
3002
- break;
3003
- }
3004
- }
3005
- handleInteractiveCommands(command) {
3006
- switch (command._commandType) {
3007
- case InteractiveCommandType.CALL_JS:
3008
- let methodName = command._str;
3009
- let args = command.arguments;
3010
- let magicComponent = (this.vcRef._hostLView).find(v => v instanceof TaskBaseMagicComponent);
3011
- let resultString = "";
3012
- try {
3013
- if (!isNullOrUndefined(magicComponent[methodName])) {
3014
- resultString = magicComponent[methodName].apply(magicComponent, args);
3015
- }
3016
- else
3017
- console.error("Instance method " + methodName + " does not exists");
3018
- }
3019
- catch (e) {
3020
- console.error(e.message);
3021
- }
3022
- command.resultString = resultString;
3023
- break;
3024
- }
3025
- }
3026
- handleSetProperty(command) {
3027
- switch (command.Operation) {
3028
- case HtmlProperties.ReadOnly:
3029
- {
3030
- if (command.obj.Type == MgControlType.CTRL_TYPE_TEXT)
3031
- if (command.obj1 != true)
3032
- this.renderer.removeAttribute(this.htmlElement, command.Operation);
3033
- else
3034
- this.renderer.setAttribute(this.htmlElement, command.Operation, command.str);
3035
- }
3036
- break;
3037
- }
3038
- }
3039
- ngOnDestroy() {
3040
- this.subscribeRefreshDom.unsubscribe();
3041
- }
3042
- }
3043
- MagicDirective.opened = false;
3044
- MagicDirective.noOfAutoCompleteBoxesOpened = 0;
3045
- MagicDirective.ɵfac = function MagicDirective_Factory(t) { return new (t || MagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i2$1.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
3046
- MagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", rowId: "rowId" } });
3047
- (function () {
3048
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDirective, [{
3049
- type: Directive,
3050
- args: [{
3051
- selector: "[magic]"
3052
- }]
3053
- }], function () {
3054
- return [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
3055
- type: Optional
3056
- }] }];
3057
- }, { magic: [{
3058
- type: Input,
3059
- args: ["magic"]
3060
- }], eventsOnly: [{
3061
- type: Input,
3062
- args: ["eventsOnly"]
3063
- }], rowId: [{
3064
- type: Input
3065
- }] });
3066
- })();
3067
-
3068
- class NoControlMagicDirective extends MagicDirective {
3069
- set magic(val) { this.id = val; this.selector = 'magicnc'; }
3070
- ;
3071
- constructor(_task, element, renderer, vcRef, platform, magicRow) {
3072
- super(_task, element, renderer, vcRef, platform, magicRow);
3073
- }
3074
- regEvents() {
3075
- super.regEvents();
3076
- if (this.htmlElement instanceof HTMLSelectElement) {
3077
- this.htmlElement.addEventListener('change', (e) => {
3078
- let guiEvent = getGuiEventObj("selectionchanged", this.id, 0);
3079
- guiEvent.Value = (event.target).selectedIndex.toString();
3080
- this.task.insertEvent(guiEvent);
3081
- });
3082
- }
3083
- if (this.isRadio()) {
3084
- this.htmlElement.addEventListener('change', (e) => {
3085
- let guiEvent = getGuiEventObj("selectionchanged", this.id, 0);
3086
- guiEvent.Value = (e.target).value;
3087
- this.task.insertEvent(guiEvent);
3088
- });
3089
- }
3090
- if (this.isTabControl()) {
3091
- const tabControl = this.htmlElement.children[0];
3092
- let guiEvent = getGuiEventObj("selectionchanged", this.id, 0);
3093
- for (var i = 0; i < tabControl.children.length; i++) {
3094
- tabControl.children[i].addEventListener('click', (e) => {
3095
- guiEvent.Value = (e.currentTarget.getAttribute('layer') - 1).toString();
3096
- this.task.insertEvent(guiEvent);
3097
- });
3098
- }
3099
- }
3100
- }
3101
- isTabControl() {
3102
- return this.htmlElement instanceof HTMLDivElement &&
3103
- this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
3104
- }
3105
- isRadio() {
3106
- return this.htmlElement instanceof HTMLDivElement &&
3107
- this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
3108
- }
3109
- handleCommand(command) {
3110
- super.handleCommand(command);
3111
- switch (command.CommandType) {
3112
- case CommandType.SET_CLASS:
3113
- const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
3114
- if (controlMetadata.removedClass != '') {
3115
- this.htmlElement.classList.remove(controlMetadata.removedClass);
3116
- controlMetadata.removedClass = '';
3117
- }
3118
- this.htmlElement.classList.add(command.obj1);
3119
- break;
3120
- case CommandType.SET_VALUE:
3121
- if (this.htmlElement instanceof HTMLLabelElement)
3122
- this.htmlElement.innerText = command.value;
3123
- if (this.htmlElement instanceof HTMLSelectElement)
3124
- this.htmlElement.value = command.value;
3125
- if (this.htmlElement instanceof HTMLAnchorElement)
3126
- this.htmlElement.text = command.value;
3127
- if (this.htmlElement instanceof HTMLInputElement) {
3128
- if (this.htmlElement.type === "checkbox") {
3129
- this.htmlElement.checked = command.value;
3130
- }
3131
- else {
3132
- this.htmlElement.value = command.value;
3133
- }
3134
- }
3135
- if (this.htmlElement instanceof HTMLButtonElement) {
3136
- this.htmlElement.innerHTML = command.value;
3137
- }
3138
- break;
3139
- case CommandType.SET_PROPERTY:
3140
- this.handleSetProperty(command);
3141
- break;
3142
- case CommandType.SET_STYLE:
3143
- let value = StylesMapManager.magicValueGetStyle(command.Operation, command.obj1);
3144
- let attribute = StylesMapManager.MagicPropertyToHtmlAttributeMap.get(command.Operation);
3145
- this.htmlElement.setAttribute("style", attribute + ":" + value);
3146
- break;
3147
- }
3148
- }
3149
- handleSetProperty(command) {
3150
- super.handleSetProperty(command);
3151
- switch (command.Operation) {
3152
- case HtmlProperties.Text:
3153
- if (this.htmlElement instanceof HTMLLabelElement)
3154
- this.htmlElement.innerText = command.obj1;
3155
- break;
3156
- case HtmlProperties.Image:
3157
- if (this.htmlElement instanceof HTMLImageElement)
3158
- this.htmlElement.src = command.obj1;
3159
- else
3160
- this.htmlElement.setAttribute("src", command.obj1);
3161
- break;
3162
- case HtmlProperties.ItemsList:
3163
- if (this.htmlElement instanceof HTMLSelectElement) {
3164
- var len = this.htmlElement.length;
3165
- for (var i = len - 1; i >= 0; i--) {
3166
- this.htmlElement.remove(i);
3167
- }
3168
- for (let s of command.obj1) {
3169
- let elem = document.createElement("option");
3170
- elem.text = s.displayValue;
3171
- elem.value = s.index;
3172
- this.htmlElement.add(elem);
3173
- }
3174
- }
3175
- else if (this.isTabControl() && this.htmlElement.children.length > 0) {
3176
- const tabControl = this.htmlElement.children[0];
3177
- for (var i = 0; i < tabControl.children.length; i++) {
3178
- if (tabControl.children[i] instanceof HTMLButtonElement) {
3179
- tabControl.children[i].innerText = command.obj1[i].displayValue;
3180
- }
3181
- }
3182
- }
3183
- break;
3184
- case HtmlProperties.Visible:
3185
- this.htmlElement.setAttribute('style', 'visibility:' + (command.obj1 ? 'visible' : 'hidden'));
3186
- break;
3187
- case HtmlProperties.Enabled:
3188
- if (command.obj1 === false)
3189
- this.htmlElement.setAttribute("disabled", "true");
3190
- else
3191
- this.htmlElement.removeAttribute("disabled");
3192
- break;
3193
- case HtmlProperties.TabIndex:
3194
- this.htmlElement.setAttribute(command.Operation, command.obj1);
3195
- break;
3196
- case HtmlProperties.SelectedValue:
3197
- if (this.htmlElement instanceof HTMLSelectElement)
3198
- this.htmlElement.value = command.obj1;
3199
- else if (this.isTabControl() && this.htmlElement.children.length > 0) {
3200
- const tabControl = this.htmlElement.children[0];
3201
- for (var i = 0; i < tabControl.children.length; i++) {
3202
- let child = tabControl.children[i];
3203
- const layer = child.getAttribute('layer') - 1;
3204
- if (child instanceof HTMLButtonElement) {
3205
- if (layer == command.obj1) {
3206
- child.classList.add('tab_button_active');
3207
- }
3208
- else {
3209
- child.classList.remove('tab_button_active');
3210
- }
3211
- }
3212
- else {
3213
- let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
3214
- child.setAttribute('style', style);
3215
- }
3216
- }
3217
- }
3218
- break;
3219
- case HtmlProperties.PlaceHolder:
3220
- this.htmlElement.setAttribute("placeholder", command.obj1);
3221
- break;
3222
- case HtmlProperties.Tooltip:
3223
- this.htmlElement.setAttribute("title", command.obj1);
3224
- break;
3225
- case HtmlProperties.Password:
3226
- if (command.obj1 === false)
3227
- this.htmlElement.setAttribute("type", "text");
3228
- else
3229
- this.htmlElement.setAttribute("type", "password");
3230
- break;
3231
- }
3232
- }
3233
- }
3234
- NoControlMagicDirective.ɵfac = function NoControlMagicDirective_Factory(t) { return new (t || NoControlMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i2$1.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
3235
- NoControlMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: ["magicnc", "magic"] }, features: [i0.ɵɵInheritDefinitionFeature] });
3236
- (function () {
3237
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NoControlMagicDirective, [{
3238
- type: Directive,
3239
- args: [{
3240
- selector: '[magicnc]'
3241
- }]
3242
- }], function () {
3243
- return [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
3244
- type: Optional
3245
- }] }];
3246
- }, { magic: [{
3247
- type: Input,
3248
- args: ['magicnc']
3249
- }] });
3250
- })();
3251
-
3252
- class Constants {
3253
- }
3254
- Constants.DATE_FMT = 'dd/MMM/yyyy';
3255
- class DateMagicPipe extends DatePipe {
3256
- constructor(_task) {
3257
- super('en-US');
3258
- this._task = _task;
3259
- }
3260
- transform(value, controlId) {
3261
- let mask = this._task.GetControlPictureMask(controlId).getMask();
3262
- let formatStr = null;
3263
- let mgDateFormatter = new MgDateFormatter();
3264
- if (!isNullOrUndefined(value) && mask !== null) {
3265
- formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
3266
- if (formatStr != null && this._task.isTableControl(controlId)) {
3267
- if (this._task.mgInputDateFormat == null)
3268
- this._task.mgInputDateFormat = formatStr;
3269
- else
3270
- formatStr = this._task.mgInputDateFormat;
3271
- }
3272
- return super.transform(value, formatStr);
3273
- }
3274
- else
3275
- value = "";
3276
- return value;
3277
- }
3278
- }
3279
- DateMagicPipe.ɵfac = function DateMagicPipe_Factory(t) { return new (t || DateMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
3280
- DateMagicPipe.ɵpipe = i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
3281
- (function () {
3282
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateMagicPipe, [{
3283
- type: Pipe,
3284
- args: [{
3285
- name: 'magicDate'
3286
- }]
3287
- }], function () { return [{ type: TaskMagicService }]; }, null);
3288
- })();
3289
- class MgDateFormatter {
3290
- ConvertMgDateFormatToAngular(mgDateMask) {
3291
- let formatStr = new StringBuilder();
3292
- if (mgDateMask !== null) {
3293
- for (let i = 0; i < mgDateMask.length;) {
3294
- switch (mgDateMask.charCodeAt(i)) {
3295
- case PICInterface.PIC_YYYY:
3296
- formatStr.Append('yyyy');
3297
- i += 4;
3298
- break;
3299
- case PICInterface.PIC_MMD:
3300
- formatStr.Append('MM');
3301
- i += 2;
3302
- break;
3303
- case PICInterface.PIC_YY:
3304
- formatStr.Append('yy');
3305
- i += 2;
3306
- break;
3307
- case PICInterface.PIC_MMM:
3308
- {
3309
- let cnt = 0;
3310
- for (; i < mgDateMask.length; i++)
3311
- if (mgDateMask.charCodeAt(i) == PICInterface.PIC_MMM)
3312
- cnt++;
3313
- else
3314
- break;
3315
- if (cnt == 3)
3316
- formatStr.Append('MMM');
3317
- if (cnt > 3)
3318
- formatStr.Append('MMMM');
3319
- }
3320
- break;
3321
- case PICInterface.PIC_DD:
3322
- formatStr.Append('dd');
3323
- i += 2;
3324
- break;
3325
- case PICInterface.PIC_WWW:
3326
- {
3327
- let cnt = 0;
3328
- for (; i < mgDateMask.length; i++)
3329
- if (mgDateMask.charCodeAt(i) == PICInterface.PIC_WWW)
3330
- cnt++;
3331
- else
3332
- break;
3333
- if (cnt == 3)
3334
- formatStr.Append('EEE');
3335
- if (cnt > 3)
3336
- formatStr.Append('EEEE');
3337
- }
3338
- break;
3339
- default:
3340
- formatStr.Append(mgDateMask.charAt(i));
3341
- i++;
3342
- break;
3343
- }
3344
- }
3345
- return formatStr.ToString();
3346
- }
3347
- else
3348
- return "dd-mm-yyyy";
3349
- }
3350
- }
3351
-
3352
- class MgformatMagicDirective {
3353
- constructor(magicDir, _task) {
3354
- this.magicDir = magicDir;
3355
- this._task = _task;
3356
- this.datePasteFlag = false;
3357
- }
3358
- ngAfterViewInit() {
3359
- let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3360
- if (control != null && this._task.mgInputDateFormat == null) {
3361
- let pic = this._task.GetControlPictureMask(this.magicDir.id);
3362
- if (pic.getAttr() == StorageAttribute.DATE) {
3363
- this.formatDate(pic);
3364
- }
3365
- }
3366
- }
3367
- onFocusEvent($event) {
3368
- this.calculatePattern();
3369
- }
3370
- onPaste(event) {
3371
- this.datePasteFlag = true;
3372
- }
3373
- onInputEvent(event) {
3374
- let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
3375
- if (attr == StorageAttribute.DATE) {
3376
- if (!this.datePasteFlag)
3377
- this.dateMasking(event);
3378
- this.datePasteFlag = false;
3379
- }
3380
- this.calculatePattern();
3381
- }
3382
- dateMasking(event) {
3383
- const input = event.target;
3384
- let cursorPos = event.target.selectionStart;
3385
- const separator = this._task.mgInputDateFormat.includes('/') ? '/' : '-';
3386
- if (cursorPos >= input.value.length) {
3387
- const value = input.value.replace(/[^a-zA-Z0-9/-]/g, '');
3388
- if (this._task.mgInputDateFormat == "dd/MM/yyyy" || this._task.mgInputDateFormat == "MM/dd/yyyy" || this._task.mgInputDateFormat == "dd-MM-yyyy" || this._task.mgInputDateFormat == "MM-dd-yyyy") {
3389
- if (value.length == 1 && value[0] == separator)
3390
- input.value = '01' + separator;
3391
- else if (value.length == 2 && value[1] == separator)
3392
- input.value = 0 + value;
3393
- else if (value.length == 3 && value[2] != separator)
3394
- input.value = value.slice(0, 2) + separator + value.slice(2);
3395
- else if (value.length == 4 && value[3] == separator)
3396
- input.value = value.slice(0, 3) + '01' + value.slice(3);
3397
- else if (value.length == 5 && value[4] == separator)
3398
- input.value = value.slice(0, 3) + '0' + value.slice(3);
3399
- else if (value.length == 6 && value[5] != separator)
3400
- input.value = value.slice(0, 5) + separator + value.slice(5);
3401
- else if (value.length >= 10)
3402
- input.value = value.slice(0, 10);
3403
- }
3404
- else if (this._task.mgInputDateFormat == "yyyy/MM/dd" || this._task.mgInputDateFormat == "yyyy/dd/MM" || this._task.mgInputDateFormat == "yyyy-MM-dd" || this._task.mgInputDateFormat == "yyyy-dd-MM") {
3405
- if (value.length == 1 && value[0] == separator)
3406
- input.value = '0000' + separator;
3407
- else if (value.length == 2 && value[1] == separator)
3408
- input.value = '000' + value.slice(0);
3409
- else if (value.length == 3 && value[2] == separator)
3410
- input.value = '00' + value.slice(0);
3411
- else if (value.length == 4 && value[3] == separator)
3412
- input.value = '0' + value.slice(0);
3413
- else if (value.length == 5 && value[4] != separator)
3414
- input.value = value.slice(0, 4) + separator + value.slice(4);
3415
- else if (value.length == 6 && value[5] == separator)
3416
- input.value = value.slice(0, 5) + '01' + value.slice(5);
3417
- else if (value.length == 7 && value[6] == separator)
3418
- input.value = value.slice(0, 5) + '0' + value.slice(5);
3419
- else if (value.length == 8 && value[7] != separator)
3420
- input.value = value.slice(0, 7) + separator + value.slice(7);
3421
- else if (value.length >= 10)
3422
- input.value = value.slice(0, 10);
3423
- }
3424
- else if (this._task.mgInputDateFormat == "dd/MM/yy" || this._task.mgInputDateFormat == "yy/MM/dd" || this._task.mgInputDateFormat == "MM/dd/yy" || this._task.mgInputDateFormat == "yy/dd/MM" || this._task.mgInputDateFormat == "dd-MM-yy" || this._task.mgInputDateFormat == "yy-MM-dd" || this._task.mgInputDateFormat == "MM-dd-yy" || this._task.mgInputDateFormat == "yy-dd-MM") {
3425
- if (value.length == 1 && value[0] == separator)
3426
- input.value = '01' + separator;
3427
- else if (value.length == 2 && value[1] == separator)
3428
- input.value = 0 + value;
3429
- else if (value.length == 3 && value[2] != separator)
3430
- input.value = value.slice(0, 2) + separator + value.slice(2);
3431
- else if (value.length == 4 && value[3] == separator)
3432
- input.value = value.slice(0, 3) + '01' + value.slice(3);
3433
- else if (value.length == 5 && value[4] == separator)
3434
- input.value = value.slice(0, 3) + '0' + value.slice(3);
3435
- else if (value.length == 6 && value[5] != separator)
3436
- input.value = value.slice(0, 5) + separator + value.slice(5);
3437
- else if (value.length >= 8)
3438
- input.value = value.slice(0, 8);
3439
- }
3440
- else if (this._task.mgInputDateFormat == "dd/MMM/yy" || this._task.mgInputDateFormat == "dd-MMM-yy") {
3441
- if (value.length == 1 && value[0] == separator)
3442
- input.value = '01' + separator;
3443
- else if (value.length == 2 && value[1] == separator)
3444
- input.value = 0 + value;
3445
- else if (value.length == 3 && value[2] != separator)
3446
- input.value = value.slice(0, 2) + separator + value.slice(2);
3447
- else if (value.length == 7 && value[6] != separator)
3448
- input.value = value.slice(0, 6) + separator + value.slice(6);
3449
- else if (value.length >= 9)
3450
- input.value = value.slice(0, 9);
3451
- }
3452
- else if (this._task.mgInputDateFormat == "dd/MMM/yyyy" || this._task.mgInputDateFormat == "dd-MMM-yyyy") {
3453
- if (value.length == 1 && value[0] == separator)
3454
- input.value = '01' + separator;
3455
- else if (value.length == 2 && value[1] == separator)
3456
- input.value = 0 + value;
3457
- else if (value.length == 3 && value[2] != separator)
3458
- input.value = value.slice(0, 2) + separator + value.slice(2);
3459
- else if (value.length == 7 && value[6] != separator)
3460
- input.value = value.slice(0, 6) + separator + value.slice(6);
3461
- else if (value.length >= 11)
3462
- input.value = value.slice(0, 11);
3463
- }
3464
- else if (this._task.mgInputDateFormat == "yy/dd/MMM" || this._task.mgInputDateFormat == "yy-dd-MMM") {
3465
- if (value.length == 1 && value[0] == separator)
3466
- input.value = '00' + separator;
3467
- else if (value.length == 2 && value[1] == separator)
3468
- input.value = 0 + value;
3469
- else if (value.length == 3 && value[2] != separator)
3470
- input.value = value.slice(0, 2) + separator + value.slice(2);
3471
- else if (value.length == 4 && value[3] == separator)
3472
- input.value = value.slice(0, 3) + '01' + value.slice(3);
3473
- else if (value.length == 5 && value[4] == separator)
3474
- input.value = value.slice(0, 3) + '0' + value.slice(3);
3475
- else if (value.length == 6 && value[5] != separator)
3476
- input.value = value.slice(0, 5) + separator + value.slice(5);
3477
- else if (value.length >= 9)
3478
- input.value = value.slice(0, 9);
3479
- }
3480
- else if (this._task.mgInputDateFormat == "yyyy/dd/MMM" || this._task.mgInputDateFormat == "yyyy-dd-MMM") {
3481
- if (value.length == 1 && value[0] == separator)
3482
- input.value = '0000' + separator;
3483
- else if (value.length == 2 && value[1] == separator)
3484
- input.value = '000' + value.slice(0);
3485
- else if (value.length == 3 && value[2] == separator)
3486
- input.value = '00' + value.slice(0);
3487
- else if (value.length == 4 && value[3] == separator)
3488
- input.value = '0' + value.slice(0);
3489
- else if (value.length == 5 && value[4] != separator)
3490
- input.value = value.slice(0, 4) + separator + value.slice(4);
3491
- else if (value.length == 6 && value[5] == separator)
3492
- input.value = value.slice(0, 5) + '01' + value.slice(5);
3493
- else if (value.length == 7 && value[6] == separator)
3494
- input.value = value.slice(0, 5) + '0' + value.slice(5);
3495
- else if (value.length == 8 && value[7] != separator)
3496
- input.value = value.slice(0, 7) + separator + value.slice(7);
3497
- else if (value.length >= 11)
3498
- input.value = value.slice(0, 11);
3499
- }
3500
- else if (this._task.mgInputDateFormat == "MMM/dd/yy" || this._task.mgInputDateFormat == "MMM-dd-yy") {
3501
- if (value.length == 4 && value[3] != separator)
3502
- input.value = value.slice(0, 3) + separator + value.slice(3);
3503
- else if (value.length == 5 && value[4] == separator)
3504
- input.value = value.slice(0, 4) + '01' + value.slice(4);
3505
- else if (value.length == 6 && value[5] == separator)
3506
- input.value = value.slice(0, 4) + '0' + value.slice(4);
3507
- else if (value.length == 7 && value[6] != separator)
3508
- input.value = value.slice(0, 6) + separator + value.slice(6);
3509
- else if (value.length >= 9)
3510
- input.value = value.slice(0, 9);
3511
- }
3512
- else if (this._task.mgInputDateFormat == "MMM/dd/yyyy" || this._task.mgInputDateFormat == "MMM-dd-yyyy") {
3513
- if (value.length == 4 && value[3] != separator)
3514
- input.value = value.slice(0, 3) + separator + value.slice(3);
3515
- else if (value.length == 5 && value[4] == separator)
3516
- input.value = value.slice(0, 4) + '01' + value.slice(4);
3517
- else if (value.length == 6 && value[5] == separator)
3518
- input.value = value.slice(0, 4) + '0' + value.slice(4);
3519
- else if (value.length == 7 && value[6] != separator)
3520
- input.value = value.slice(0, 6) + separator + value.slice(6);
3521
- else if (value.length >= 11)
3522
- input.value = value.slice(0, 11);
3523
- }
3524
- }
3525
- if (cursorPos < input.value.length && input.value.length > this._task.mgInputDateFormat.length) {
3526
- let inputDate = input.value;
3527
- let start = input.selectionStart - 1;
3528
- let end = input.selectionEnd - 1;
3529
- let indexToRemove = input.selectionStart - 1;
3530
- input.value = inputDate.slice(0, indexToRemove) + inputDate.slice(indexToRemove + 1);
3531
- input.setSelectionRange(start, end);
3532
- }
3533
- }
3534
- onChangeEvent($event) {
3535
- let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3536
- let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
3537
- switch (attr) {
3538
- case StorageAttribute.ALPHA:
3539
- case StorageAttribute.UNICODE:
3540
- this.formatAlphaUnicode(control);
3541
- break;
3542
- case StorageAttribute.BOOLEAN:
3543
- this.formatBoolean(control);
3544
- break;
3545
- }
3546
- }
3547
- calculatePattern() {
3548
- let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3549
- if (control != null) {
3550
- let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
3551
- if (attr == StorageAttribute.NUMERIC || attr == StorageAttribute.ALPHA || attr == StorageAttribute.UNICODE) {
3552
- let pic = this._task.GetControlPictureMask(this.magicDir.id);
3553
- if (this.isPatternGenerationNeeded(attr, pic)) {
3554
- let pattern = this.generatePattern(attr, pic);
3555
- if (control.validator == null)
3556
- control.setValidators(Validators.pattern(pattern));
3557
- else
3558
- control.setValidators([control.validator, Validators.pattern(pattern)]);
3559
- }
3560
- else {
3561
- if (attr == StorageAttribute.ALPHA || attr == StorageAttribute.UNICODE) {
3562
- if (control.validator == null)
3563
- control.setValidators(Validators.maxLength(pic.getMaskLength()));
3564
- else {
3565
- if (pic.isFormatExp()) {
3566
- control.setValidators(Validators.maxLength(pic.getMaskLength()));
3567
- if (isUndefined(this.magicDir.rowId))
3568
- this.magicDir.rowId = '0';
3569
- control.setValidators([control.validator, this._task.customValidator(this.magicDir.rowId, this.magicDir.id)]);
3570
- }
3571
- else
3572
- control.setValidators([control.validator, Validators.maxLength(pic.getMaskLength())]);
3573
- }
3574
- control.updateValueAndValidity();
3575
- }
3576
- }
3577
- }
3578
- }
3579
- }
3580
- formatDate(pic) {
3581
- let mgDateFormatter = new MgDateFormatter();
3582
- this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
3583
- }
3584
- formatAlphaUnicode(control) {
3585
- let value = control.value;
3586
- if (value !== null && value.length > 0) {
3587
- const newValue = this._task.GetRangedValue(this.magicDir.id, value);
3588
- if (newValue != null)
3589
- value = newValue;
3590
- let pic = this._task.GetControlPictureMask(this.magicDir.id);
3591
- let mask = pic.getMask();
3592
- let valueStr = new StringBuilder();
3593
- for (let i = 0; i < value.length; i++) {
3594
- switch (mask.charCodeAt(i)) {
3595
- case PICInterface.PIC_U:
3596
- valueStr.Append(value.charAt(i).toUpperCase());
3597
- break;
3598
- case PICInterface.PIC_L:
3599
- valueStr.Append(value.charAt(i).toLowerCase());
3600
- break;
3601
- default:
3602
- valueStr.Append(value.charAt(i));
3603
- break;
3604
- }
3605
- }
3606
- control.setValue(valueStr.ToString());
3607
- }
3608
- }
3609
- formatBoolean(control) {
3610
- let value = control.value;
3611
- if (value !== null && value.length > 0) {
3612
- let newValue = this._task.GetRangedValue(this.magicDir.id, value);
3613
- if (newValue.toUpperCase().startsWith(value.toUpperCase())) {
3614
- control.setValue(newValue);
3615
- }
3616
- else {
3617
- control.setValue(value);
3618
- }
3619
- }
3620
- }
3621
- generatePattern(attribute, pic) {
3622
- let pattern = '';
3623
- switch (attribute) {
3624
- case StorageAttribute.NUMERIC:
3625
- pattern = this.generatePatternForNumber(pic);
3626
- break;
3627
- case StorageAttribute.ALPHA:
3628
- case StorageAttribute.UNICODE:
3629
- pattern = this.generatePatternForAlpha(pic);
3630
- break;
3631
- }
3632
- return pattern;
3633
- }
3634
- generatePatternForNumber(pic) {
3635
- let patternStr = new StringBuilder();
3636
- patternStr.Append('^');
3637
- if (pic.isNegative())
3638
- patternStr.Append('-?');
3639
- if (pic.getWholes())
3640
- patternStr.AppendFormat('\\d{{0},{1}}', 0, pic.getWholes());
3641
- if (pic.getDec())
3642
- patternStr.AppendFormat('(\\.\\d{1,{0}})?', pic.getDec());
3643
- patternStr.Append('$');
3644
- return patternStr.ToString();
3645
- }
3646
- isPatternGenerationNeeded(attr, pic) {
3647
- switch (attr) {
3648
- case StorageAttribute.NUMERIC:
3649
- return true;
3650
- case StorageAttribute.ALPHA:
3651
- case StorageAttribute.UNICODE:
3652
- return (pic.getMaskChars() > 0) ? true : false;
3653
- }
3654
- }
3655
- generatePatternForAlpha(pic) {
3656
- let cnt = 0;
3657
- let inputAllChars = false;
3658
- let closeSet = false;
3659
- let mask = pic.getMask();
3660
- let pattern = new StringBuilder();
3661
- pattern.Append('^');
3662
- for (let i = 0; i < mask.length;) {
3663
- if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
3664
- || mask.charCodeAt(i) == PICInterface.PIC_X)) {
3665
- pattern.Append('(');
3666
- closeSet = true;
3667
- inputAllChars = false;
3668
- }
3669
- cnt = 0;
3670
- switch (mask.charCodeAt(i)) {
3671
- case PICInterface.PIC_U:
3672
- case PICInterface.PIC_X:
3673
- case PICInterface.PIC_L:
3674
- {
3675
- pattern.Append('.');
3676
- let inputAllCharsRef = new RefParam(false);
3677
- let dirs = PICInterface.PIC_U.toString();
3678
- dirs += PICInterface.PIC_L.toString();
3679
- dirs += PICInterface.PIC_X.toString();
3680
- cnt = this.getDirectiveCount(mask, i, dirs, inputAllCharsRef);
3681
- inputAllChars = inputAllCharsRef.value;
3682
- i += cnt;
3683
- }
3684
- break;
3685
- case PICInterface.PIC_N:
3686
- {
3687
- pattern.Append('\\d');
3688
- let inputAllCharsRef = new RefParam(false);
3689
- cnt = this.getDirectiveCount(mask, i, PICInterface.PIC_L.toString(), inputAllCharsRef);
3690
- inputAllChars = inputAllCharsRef.value;
3691
- i += cnt;
3692
- }
3693
- break;
3694
- default:
3695
- pattern.Append(mask[i]);
3696
- i++;
3697
- break;
3698
- }
3699
- if (cnt > 0)
3700
- pattern.AppendFormat('{{0},{1}}', inputAllChars ? cnt : 0, cnt);
3701
- if (closeSet)
3702
- pattern.Append(')');
3703
- closeSet = false;
3704
- }
3705
- pattern.Append('$');
3706
- return pattern.ToString();
3707
- }
3708
- getDirectiveCount(mask, idx, pattern, changeInPattern) {
3709
- changeInPattern.value = false;
3710
- let patternCount = 0;
3711
- while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
3712
- patternCount++;
3713
- idx++;
3714
- }
3715
- if (idx < mask.length)
3716
- changeInPattern.value = true;
3717
- return patternCount;
3718
- }
3719
- IsPatternMatches(mask, pattern) {
3720
- for (let i = 0; i < pattern.length; i++)
3721
- if (mask == pattern[i])
3722
- return true;
3723
- return false;
3724
- }
3725
- }
3726
- MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
3727
- MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) {
3728
- if (rf & 1) {
3729
- 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); });
3730
- }
3731
- } });
3732
- (function () {
3733
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgformatMagicDirective, [{
3734
- type: Directive,
3735
- args: [{
3736
- selector: '[mgFormat]'
3737
- }]
3738
- }], function () { return [{ type: MagicDirective }, { type: TaskMagicService }]; }, { onFocusEvent: [{
3739
- type: HostListener,
3740
- args: ['focus', ['$event']]
3741
- }], onPaste: [{
3742
- type: HostListener,
3743
- args: ['paste', ['$event']]
3744
- }], onInputEvent: [{
3745
- type: HostListener,
3746
- args: ['input', ['$event']]
3747
- }], onChangeEvent: [{
3748
- type: HostListener,
3749
- args: ['change', ['$event']]
3750
- }] });
3751
- })();
3752
-
3753
- class TimeMagicPipe extends DatePipe {
3754
- constructor(_task) {
3755
- super('en-US');
3756
- this._task = _task;
3757
- }
3758
- transform(value, controlId) {
3759
- let mask = this._task.GetControlPictureMask(controlId).getMask();
3760
- let formatStr = new StringBuilder();
3761
- if (typeof value !== "undefined" && mask !== null) {
3762
- for (let i = 0; i < mask.length;) {
3763
- switch (mask.charCodeAt(i)) {
3764
- case PICInterface.PIC_HH:
3765
- formatStr.Append('hh');
3766
- i += 2;
3767
- break;
3768
- case PICInterface.PIC_MMT:
3769
- formatStr.Append('mm');
3770
- i += 2;
3771
- break;
3772
- case PICInterface.PIC_SS:
3773
- formatStr.Append('ss');
3774
- i += 2;
3775
- break;
3776
- default:
3777
- formatStr.Append(mask.charAt(i));
3778
- i++;
3779
- break;
3780
- }
3781
- }
3782
- formatStr.Append(' a');
3783
- return super.transform(value, formatStr.ToString());
3784
- }
3785
- return value;
3786
- }
3787
- }
3788
- TimeMagicPipe.ɵfac = function TimeMagicPipe_Factory(t) { return new (t || TimeMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
3789
- TimeMagicPipe.ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
3790
- (function () {
3791
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimeMagicPipe, [{
3792
- type: Pipe,
3793
- args: [{
3794
- name: 'magicTime'
3795
- }]
3796
- }], function () { return [{ type: TaskMagicService }]; }, null);
3797
- })();
3798
-
3799
- class RangeValidatorMagicDirective {
3800
- constructor(_task, vcRef) {
3801
- this._task = _task;
3802
- this.vcRef = vcRef;
3803
- }
3804
- validate(c) {
3805
- let controlName;
3806
- controlName = this.getControlName(c);
3807
- let properties;
3808
- properties = this._task.Records.list["0"].getControlMetadata(controlName);
3809
- properties.rangeValidator = true;
3810
- let errMsg = null;
3811
- if (c.dirty)
3812
- errMsg = this._task.ValidateControlValue(controlName, this._task.ConvertValToNative(controlName, 0, c.value));
3813
- let isValid = (errMsg == null) ? true : false;
3814
- if (isValid) {
3815
- return null;
3816
- }
3817
- else {
3818
- return {
3819
- rangevalidator: {
3820
- errorMsg: errMsg
3821
- }
3822
- };
3823
- }
3824
- }
3825
- getControlName(c) {
3826
- const formGroup = c.parent.controls;
3827
- return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
3828
- }
3829
- }
3830
- RangeValidatorMagicDirective.ɵfac = function RangeValidatorMagicDirective_Factory(t) { return new (t || RangeValidatorMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
3831
- RangeValidatorMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [i0.ɵɵProvidersFeature([
3832
- {
3833
- provide: NG_VALIDATORS,
3834
- useExisting: RangeValidatorMagicDirective,
3835
- multi: true,
3836
- }
3837
- ])] });
3838
- (function () {
3839
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RangeValidatorMagicDirective, [{
3840
- type: Directive,
3841
- args: [{
3842
- selector: '[rangevalidator] ',
3843
- providers: [
3844
- {
3845
- provide: NG_VALIDATORS,
3846
- useExisting: RangeValidatorMagicDirective,
3847
- multi: true,
3848
- }
3849
- ]
3850
- }]
3851
- }], function () { return [{ type: TaskMagicService }, { type: i0.ViewContainerRef }]; }, null);
3852
- })();
3853
-
3854
- function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) {
3855
- if (rf & 1) {
3856
- i0.ɵɵelement(0, "ndc-dynamic", 1);
3857
- }
3858
- if (rf & 2) {
3859
- const ctx_r0 = i0.ɵɵnextContext();
3860
- i0.ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
3861
- }
3862
- }
3863
- class SubformMagicComponent {
3864
- set magic(val) { this.id = val; }
3865
- ;
3866
- constructor(vcRef, mgSub) {
3867
- this.vcRef = vcRef;
3868
- this.mgSub = mgSub;
3869
- this.component = null;
3870
- this.component = (this.vcRef._hostLView).find(v => !isNullOrUndefined(v));
3871
- }
3872
- get Component() {
3873
- return this.mgSub.mgGetComp(this.id);
3874
- }
3875
- get Parameters() {
3876
- return this.mgSub.mgGetParameters(this.id);
3877
- }
3878
- }
3879
- SubformMagicComponent.ɵfac = function SubformMagicComponent_Factory(t) { return new (t || SubformMagicComponent)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(SubformMagicService)); };
3880
- SubformMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SubformMagicComponent, selectors: [["magic-subform"]], inputs: { magic: "magic" }, decls: 1, vars: 1, consts: [[3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"]], template: function SubformMagicComponent_Template(rf, ctx) {
3881
- if (rf & 1) {
3882
- i0.ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
3883
- }
3884
- if (rf & 2) {
3885
- i0.ɵɵproperty("ngIf", ctx.Component);
3886
- }
3887
- }, dependencies: [i1.NgIf, i3.DynamicComponent, i3.DynamicIoDirective], encapsulation: 2 });
3888
- (function () {
3889
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SubformMagicComponent, [{
3890
- type: Component,
3891
- args: [{
3892
- selector: 'magic-subform',
3893
- template: `
3894
- <ndc-dynamic
3895
- *ngIf="Component"
3896
- [ndcDynamicComponent]="Component"
3897
- [ndcDynamicInputs]="Parameters">
3898
- </ndc-dynamic>
3899
- `
3900
- }]
3901
- }], function () { return [{ type: i0.ViewContainerRef }, { type: SubformMagicService }]; }, { magic: [{
3902
- type: Input,
3903
- args: ['magic']
3904
- }] });
3905
- })();
3906
-
3907
- const _c0$1 = ["customContent"];
3908
- function ErrorMagicComponent_div_0_span_4_Template(rf, ctx) {
3909
- if (rf & 1) {
3910
- i0.ɵɵelementStart(0, "span");
3911
- i0.ɵɵtext(1);
3912
- i0.ɵɵelementEnd();
3913
- }
3914
- if (rf & 2) {
3915
- const ctx_r2 = i0.ɵɵnextContext(2);
3916
- i0.ɵɵadvance(1);
3917
- i0.ɵɵtextInterpolate1(" ", ctx_r2.mgService.getErrMsg(ctx_r2.id, ctx_r2.rowId), " ");
3918
- }
3919
- }
3920
- function ErrorMagicComponent_div_0_Template(rf, ctx) {
3921
- if (rf & 1) {
3922
- i0.ɵɵelementStart(0, "div")(1, "div", null, 1);
3923
- i0.ɵɵprojection(3);
3924
- i0.ɵɵelementEnd();
3925
- i0.ɵɵtemplate(4, ErrorMagicComponent_div_0_span_4_Template, 2, 1, "span", 0);
3926
- i0.ɵɵelementEnd();
3927
- }
3928
- if (rf & 2) {
3929
- const ctx_r0 = i0.ɵɵnextContext();
3930
- i0.ɵɵadvance(4);
3931
- i0.ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
3932
- }
3933
- }
3934
- const _c1 = ["*"];
3935
- class ErrorMagicComponent {
3936
- set magic(val) {
3937
- this.id = val;
3938
- }
3939
- ;
3940
- set rowId1(val) {
3941
- this.rowId = val;
3942
- }
3943
- ;
3944
- set CustomContent(innerComponent) {
3945
- this.defaultDisplay = innerComponent == undefined || this.isEmpty(innerComponent.nativeElement);
3946
- this.changeDetectorRef.detectChanges();
3947
- }
3948
- ;
3949
- constructor(_task, mgService, changeDetectorRef) {
3950
- this._task = _task;
3951
- this.mgService = mgService;
3952
- this.changeDetectorRef = changeDetectorRef;
3953
- this.defaultDisplay = true;
3954
- this.rowId = "0";
3955
- }
3956
- isEmpty(element) {
3957
- const nodes = element.childNodes;
3958
- for (let i = 0; i < nodes.length; i++) {
3959
- const node = nodes.item(i);
3960
- if (node.nodeType !== 8 && nodes.item(i).textContent.trim().length !== 0) {
3961
- return false;
3962
- }
3963
- }
3964
- return true;
3965
- }
3966
- HasErrors(id) {
3967
- if (!isUndefined(id)) {
3968
- let control = this._task.getFormControl(this.rowId, id);
3969
- if (control !== null) {
3970
- if (control.dirty && (control.hasError('pattern') || control.hasError('required') ||
3971
- control.hasError('rangevalidator') || control.hasError('maxlength') || control.hasError('max')))
3972
- return true;
3973
- if (control.touched && control.hasError('required'))
3974
- return true;
3975
- if (this._task.Records.list[this.rowId] && this._task.Records.list[this.rowId].getControlMetadata(id)) {
3976
- let controlMetadata = this._task.Records.list[this.rowId].getControlMetadata(id);
3977
- for (let customValidator of controlMetadata.customValidators.keys()) {
3978
- if (control.hasError(customValidator))
3979
- return true;
3980
- }
3981
- }
3982
- }
3983
- }
3984
- return false;
3985
- }
3986
- }
3987
- ErrorMagicComponent.ɵfac = function ErrorMagicComponent_Factory(t) { return new (t || ErrorMagicComponent)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(AccessorMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
3988
- ErrorMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) {
3989
- if (rf & 1) {
3990
- i0.ɵɵviewQuery(_c0$1, 5);
3991
- }
3992
- if (rf & 2) {
3993
- let _t;
3994
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.CustomContent = _t.first);
3995
- }
3996
- }, inputs: { magic: "magic", rowId1: ["rowId", "rowId1"] }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [[4, "ngIf"], ["customContent", ""]], template: function ErrorMagicComponent_Template(rf, ctx) {
3997
- if (rf & 1) {
3998
- i0.ɵɵprojectionDef();
3999
- i0.ɵɵtemplate(0, ErrorMagicComponent_div_0_Template, 5, 1, "div", 0);
4000
- }
4001
- if (rf & 2) {
4002
- i0.ɵɵproperty("ngIf", ctx.HasErrors(ctx.id));
4003
- }
4004
- }, dependencies: [i1.NgIf], encapsulation: 2 });
4005
- (function () {
4006
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorMagicComponent, [{
4007
- type: Component,
4008
- args: [{
4009
- selector: 'mgError',
4010
- template: `<div *ngIf="HasErrors(id)">
4011
- <div #customContent>
4012
- <ng-content></ng-content>
4013
- </div>
4014
- <span *ngIf="defaultDisplay">
4015
- {{mgService.getErrMsg(id, rowId)}}
4016
- </span>
4017
- </div>
4018
- `
4019
- }]
4020
- }], function () { return [{ type: TaskMagicService }, { type: AccessorMagicService }, { type: i0.ChangeDetectorRef }]; }, { magic: [{
4021
- type: Input,
4022
- args: ['magic']
4023
- }], rowId1: [{
4024
- type: Input,
4025
- args: ['rowId']
4026
- }], CustomContent: [{
4027
- type: ViewChild,
4028
- args: ['customContent', { static: false }]
4029
- }] });
4030
- })();
4031
-
4032
- class CheckboxMagicDirective {
4033
- constructor(magicDirective) {
4034
- this.magicDirective = magicDirective;
4035
- }
4036
- onChange($event) {
4037
- this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4038
- }
4039
- }
4040
- CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4041
- CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) {
4042
- if (rf & 1) {
4043
- i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4044
- }
4045
- } });
4046
- (function () {
4047
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
4048
- type: Directive,
4049
- args: [{
4050
- selector: `
4051
- input[type=checkbox][magic]:not([noFormControl])
4052
- `,
4053
- }]
4054
- }], function () { return [{ type: MagicDirective }]; }, { onChange: [{
4055
- type: HostListener,
4056
- args: ['change', ['$event']]
4057
- }] });
4058
- })();
4059
-
4060
- class ComboboxMagicDirective {
4061
- constructor(magicDirective) {
4062
- this.magicDirective = magicDirective;
4063
- this.magicDirective.task.refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c))).subscribe(value => {
4064
- let command = value;
4065
- if (command.Operation === HtmlProperties.ItemsList)
4066
- this.onComboboxItemsListChanged();
4067
- });
4068
- }
4069
- onChange($event) {
4070
- this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4071
- }
4072
- onComboboxItemsListChanged() {
4073
- this.magicDirective.task.refreshView();
4074
- }
4075
- }
4076
- ComboboxMagicDirective.ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4077
- ComboboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) {
4078
- if (rf & 1) {
4079
- i0.ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4080
- }
4081
- } });
4082
- (function () {
4083
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComboboxMagicDirective, [{
4084
- type: Directive,
4085
- args: [{
4086
- selector: `select[magic]:not([multiple])`,
4087
- }]
4088
- }], function () { return [{ type: MagicDirective }]; }, { onChange: [{
4089
- type: HostListener,
4090
- args: ['change', ['$event']]
4091
- }] });
4092
- })();
4093
-
4094
- class ExitMagicService {
4095
- exitMagic() {
4096
- console.log("Magic application terminated");
4097
- }
4098
- }
4099
- ExitMagicService.ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
4100
- ExitMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
4101
- (function () {
4102
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ExitMagicService, [{
4103
- type: Injectable
4104
- }], null, null);
4105
- })();
4106
-
4107
- const _c0 = ["magicRoot"];
4108
- function MagicShellComponent_ndc_dynamic_2_Template(rf, ctx) {
4109
- if (rf & 1) {
4110
- i0.ɵɵelement(0, "ndc-dynamic", 6);
4111
- }
4112
- if (rf & 2) {
4113
- const ctx_r1 = i0.ɵɵnextContext();
4114
- i0.ɵɵproperty("ndcDynamicComponent", ctx_r1.RootComponent)("ndcDynamicInputs", ctx_r1.RootComponentParameters);
4115
- }
4116
- }
4117
- function MagicShellComponent_div_5_Template(rf, ctx) {
4118
- if (rf & 1) {
4119
- i0.ɵɵelementStart(0, "div", 7);
4120
- i0.ɵɵelementContainer(1, 8);
4121
- i0.ɵɵelementEnd();
4122
- }
4123
- if (rf & 2) {
4124
- const ctx_r3 = i0.ɵɵnextContext();
4125
- const _r4 = i0.ɵɵreference(7);
4126
- i0.ɵɵadvance(1);
4127
- i0.ɵɵproperty("ngTemplateOutlet", ctx_r3.SpinnerTemplate ? ctx_r3.SpinnerTemplate : _r4);
4128
- }
4129
- }
4130
- function MagicShellComponent_ng_template_6_Template(rf, ctx) {
4131
- if (rf & 1) {
4132
- i0.ɵɵelement(0, "div", 9);
4133
- }
4134
- }
4135
- class MagicShellComponent {
4136
- constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, exitMagicService) {
4137
- this.engineMagicService = engineMagicService;
4138
- this.componentList = componentList;
4139
- this.changeDetectorRef = changeDetectorRef;
4140
- this.titleService = titleService;
4141
- this.overlayWindowService = overlayWindowService;
4142
- this.httpClient = httpClient;
4143
- this.pendingCommandsCollector = pendingCommandsCollector;
4144
- this.exitMagicService = exitMagicService;
4145
- this.RootComponent = null;
4146
- this.magicEngineTerminated = false;
4147
- this.initialize();
4148
- this.setTitle();
4149
- }
4150
- onBeforeUnload(event) {
4151
- if (this.engineMagicService.TransCacheExists()) {
4152
- event.returnValue = 'Are you sure?';
4153
- return 'Are you sure?';
4154
- }
4155
- else {
4156
- this.engineMagicService.TerminateContextUsingFetchAPI();
4157
- this.magicEngineTerminated = true;
4158
- }
4159
- }
4160
- onUnload(event) {
4161
- if (!this.magicEngineTerminated)
4162
- this.engineMagicService.TerminateContextUsingFetchAPI();
4163
- }
4164
- ngAfterViewInit() {
4165
- this.overlayWindowService.init(this.overlayWindowsContainerViewRef, this.rootMagicElementRef.nativeElement, this.changeDetectorRef);
4166
- this.engineMagicService.startMagicEngine(this.httpClient);
4167
- }
4168
- setViewContainerRef(vcRef) {
4169
- this.overlayWindowsContainerViewRef = vcRef;
4170
- }
4171
- initialize() {
4172
- this.registerUICommands();
4173
- }
4174
- setTitle() {
4175
- const newTitle = this.componentList.title;
4176
- this.titleService.setTitle(newTitle);
4177
- }
4178
- setComponent(formName, taskId, taskDescription, isModal) {
4179
- this.pendingCommandsCollector.startCollecting();
4180
- if (isModal) {
4181
- this.overlayWindowService.open(formName, taskId, taskDescription);
4182
- }
4183
- else {
4184
- this.RootComponent = this.componentList.getComponent(formName);
4185
- this.RootComponentParameters = { taskIdParam: taskId, taskDescription: taskDescription };
4186
- }
4187
- this.changeDetectorRef.detectChanges();
4188
- }
4189
- registerUICommands() {
4190
- this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
4191
- .subscribe(command => {
4192
- this.executeCommand(command);
4193
- });
4194
- this.engineMagicService
4195
- .interactiveCommands.pipe(filter(command => command.TaskTag === '0'))
4196
- .subscribe(command => {
4197
- GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
4198
- });
4199
- }
4200
- executeCommand(command) {
4201
- switch (command.CommandType) {
4202
- case CommandType.OPEN_FORM:
4203
- this.setComponent(command.str, command.stringList[0], command.stringList[1], command.Bool1);
4204
- break;
4205
- case CommandType.SET_IS_LOGGED_IN:
4206
- this.engineMagicService.setIsLoggedIn(command.Bool1);
4207
- break;
4208
- case CommandType.CLOSE_FORM:
4209
- if (this.RootComponent != null && command.str === this.RootComponentParameters.taskIdParam) {
4210
- this.RootComponent = null;
4211
- this.RootComponentParameters = {};
4212
- this.changeDetectorRef.detectChanges();
4213
- }
4214
- else {
4215
- this.overlayWindowService.close(command.str);
4216
- this.changeDetectorRef.detectChanges();
4217
- }
4218
- break;
4219
- case CommandType.RELOAD_PAGE:
4220
- window.location.reload();
4221
- break;
4222
- case CommandType.SHOW_SPINNER:
4223
- if (this.showSpinner != command.Bool1) {
4224
- this.showSpinner = command.Bool1;
4225
- this.changeDetectorRef.detectChanges();
4226
- }
4227
- break;
4228
- case CommandType.EXIT_MAGIC:
4229
- if (this.exitMagicService)
4230
- this.exitMagicService.exitMagic();
4231
- break;
4232
- case CommandType.SHOW_HTML_ERROR:
4233
- window.document.write(command.str);
4234
- break;
4235
- }
4236
- }
4237
- }
4238
- MagicShellComponent.ɵfac = function MagicShellComponent_Factory(t) { return new (t || MagicShellComponent)(i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$1.Title), i0.ɵɵdirectiveInject(OverlayWindowService), i0.ɵɵdirectiveInject(i1$2.HttpClient), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(ExitMagicService, 8)); };
4239
- MagicShellComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) {
4240
- if (rf & 1) {
4241
- i0.ɵɵviewQuery(_c0, 7);
4242
- }
4243
- if (rf & 2) {
4244
- let _t;
4245
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
4246
- }
4247
- }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) {
4248
- if (rf & 1) {
4249
- 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);
4250
- }
4251
- }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, features: [i0.ɵɵProvidersFeature([])], decls: 8, vars: 2, consts: [["magicRoot", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], ["magicViewContainerRef", ""], ["overlayWindowsContainer", ""], ["class", "spinner-background", 4, "ngIf"], ["defaultSpinner", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs"], [1, "spinner-background"], [3, "ngTemplateOutlet"], [1, "mgSpinnerClass"]], template: function MagicShellComponent_Template(rf, ctx) {
4252
- if (rf & 1) {
4253
- i0.ɵɵelementStart(0, "div", null, 0);
4254
- i0.ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 1);
4255
- i0.ɵɵelement(3, "div", 2, 3);
4256
- i0.ɵɵelementEnd();
4257
- i0.ɵɵtemplate(5, MagicShellComponent_div_5_Template, 2, 1, "div", 4);
4258
- i0.ɵɵtemplate(6, MagicShellComponent_ng_template_6_Template, 1, 0, "ng-template", null, 5, i0.ɵɵtemplateRefExtractor);
4259
- }
4260
- if (rf & 2) {
4261
- i0.ɵɵadvance(2);
4262
- i0.ɵɵproperty("ngIf", ctx.RootComponent !== null);
4263
- i0.ɵɵadvance(3);
4264
- i0.ɵɵproperty("ngIf", ctx.showSpinner);
4265
- }
4266
- }, dependencies: [i1.NgIf, i1.NgTemplateOutlet, i3.DynamicComponent, i3.DynamicIoDirective, MagicViewContainerRef], styles: [".mgSpinnerClass[_ngcontent-%COMP%]{border:10px solid #cccccc;border-top:10px solid black;border-radius:50%;position:fixed;margin:auto;inset:0;width:100px;height:100px;animation:_ngcontent-%COMP%_spin 2s linear infinite}.spinner-background[_ngcontent-%COMP%]{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}"] });
4267
- (function () {
4268
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicShellComponent, [{
4269
- type: Component,
4270
- args: [{ selector: 'magic-root', providers: [], template: `
4271
- <div #magicRoot>
4272
- <ndc-dynamic
4273
- *ngIf = "RootComponent !== null"
4274
- [ndcDynamicComponent]="RootComponent"
4275
- [ndcDynamicInputs] ="RootComponentParameters">
4276
- </ndc-dynamic>
4277
-
4278
- <div #overlayWindowsContainer magicViewContainerRef>
4279
- </div>
4280
- </div>
4281
-
4282
- <div class="spinner-background" *ngIf="showSpinner">
4283
- <ng-container [ngTemplateOutlet]="SpinnerTemplate ? SpinnerTemplate:defaultSpinner"></ng-container>
4284
- </div>
4285
-
4286
- <ng-template #defaultSpinner>
4287
- <div class="mgSpinnerClass"></div>
4288
- </ng-template>
4289
- `, 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"] }]
4290
- }], function () {
4291
- return [{ type: EngineMagicService }, { type: ComponentListMagicService }, { type: i0.ChangeDetectorRef }, { type: i1$1.Title }, { type: OverlayWindowService }, { type: i1$2.HttpClient }, { type: CommandsCollectorMagicService }, { type: ExitMagicService, decorators: [{
4292
- type: Optional
4293
- }] }];
4294
- }, { rootMagicElementRef: [{
4295
- type: ViewChild,
4296
- args: ['magicRoot', { static: true }]
4297
- }], SpinnerTemplate: [{
4298
- type: Input
4299
- }], onBeforeUnload: [{
4300
- type: HostListener,
4301
- args: ['window:beforeunload', ['$event']]
4302
- }], onUnload: [{
4303
- type: HostListener,
4304
- args: ['window:unload', ['$event']]
4305
- }] });
4306
- })();
4307
-
4308
- const CHECKBOX_VALUE_ACCESSOR = {
4309
- provide: NG_VALUE_ACCESSOR,
4310
- useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
4311
- multi: true,
4312
- };
4313
- class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
4314
- }
4315
- MagicCheckboxControlValueAccessor.ɵfac = function () { let ɵMagicCheckboxControlValueAccessor_BaseFactory; return function MagicCheckboxControlValueAccessor_Factory(t) { return (ɵMagicCheckboxControlValueAccessor_BaseFactory || (ɵMagicCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor)))(t || MagicCheckboxControlValueAccessor); }; }();
4316
- MagicCheckboxControlValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: MagicCheckboxControlValueAccessor, selectors: [["input", "type", "checkbox", "magic", "", 3, "formControlName", "", 3, "no-form-control", ""], ["input", "type", "checkbox", "magic", "", 3, "formControl", ""], ["input", "type", "checkbox", "magic", "", 3, "ngModel", ""]], hostBindings: function MagicCheckboxControlValueAccessor_HostBindings(rf, ctx) {
4317
- if (rf & 1) {
4318
- i0.ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
4319
- }
4320
- }, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
4321
- (function () {
4322
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
4323
- type: Directive,
4324
- args: [{
4325
- selector: `
4326
- input[type=checkbox][magic]:not([formControlName]):not([no-form-control]),
4327
- input[type=checkbox][magic]:not([formControl]),
4328
- input[type=checkbox][magic]:not([ngModel])
4329
- `,
4330
- host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
4331
- providers: [CHECKBOX_VALUE_ACCESSOR]
4332
- }]
4333
- }], null, null);
4334
- })();
4335
-
4336
- const MAGIC_DEFAULT_VALUE_ACCESSOR = {
4337
- provide: NG_VALUE_ACCESSOR,
4338
- useExisting: forwardRef(() => MagicDefaultValueAccessor),
4339
- multi: true
4340
- };
4341
- class MagicDefaultValueAccessor extends DefaultValueAccessor {
4342
- }
4343
- MagicDefaultValueAccessor.ɵfac = function () { let ɵMagicDefaultValueAccessor_BaseFactory; return function MagicDefaultValueAccessor_Factory(t) { return (ɵMagicDefaultValueAccessor_BaseFactory || (ɵMagicDefaultValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicDefaultValueAccessor)))(t || MagicDefaultValueAccessor); }; }();
4344
- MagicDefaultValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: MagicDefaultValueAccessor, selectors: [["input", "magic", "", 3, "type", "checkbox", 3, "formControlName", "", 3, "no-form-control", ""], ["textarea", "magic", "", 3, "formControlName", "", 3, "noFormControl", "", 3, "no-form-control", ""]], hostBindings: function MagicDefaultValueAccessor_HostBindings(rf, ctx) {
4345
- if (rf & 1) {
4346
- 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); });
4347
- }
4348
- }, exportAs: ["magic"], features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
4349
- (function () {
4350
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDefaultValueAccessor, [{
4351
- type: Directive,
4352
- args: [{
4353
- selector: `
4354
- input[magic]:not([type=checkbox]):not([formControlName]):not([no-form-control]),
4355
- textarea[magic]:not([formControlName]):not([noFormControl]):not([no-form-control])
4356
- `,
4357
- host: {
4358
- '(input)': '$any(this)._handleInput($event.target.value)',
4359
- '(blur)': 'onTouched()',
4360
- '(compositionstart)': '$any(this)._compositionStart()',
4361
- '(compositionend)': '$any(this)._compositionEnd($event.target.value)'
4362
- },
4363
- providers: [MAGIC_DEFAULT_VALUE_ACCESSOR],
4364
- exportAs: 'magic'
4365
- }]
4366
- }], null, null);
4367
- })();
4368
-
4369
- class CheckboxNoFormControlMagicDirective {
4370
- constructor(magicDirective) {
4371
- this.magicDirective = magicDirective;
4372
- }
4373
- onChange($event) {
4374
- this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4375
- }
4376
- }
4377
- CheckboxNoFormControlMagicDirective.ɵfac = function CheckboxNoFormControlMagicDirective_Factory(t) { return new (t || CheckboxNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4378
- CheckboxNoFormControlMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) {
4379
- if (rf & 1) {
4380
- i0.ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4381
- }
4382
- } });
4383
- (function () {
4384
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
4385
- type: Directive,
4386
- args: [{
4387
- selector: `
4388
- input[type=checkbox][magic]:([noFormControl])
4389
- `,
4390
- }]
4391
- }], function () { return [{ type: MagicDirective }]; }, { onChange: [{
4392
- type: HostListener,
4393
- args: ['change', ['$event']]
4394
- }] });
4395
- })();
4396
-
4397
- class InputNoFormControlMagicDirective {
4398
- constructor(magicDirective) {
4399
- this.magicDirective = magicDirective;
4400
- }
4401
- onChange($event) {
4402
- this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
4403
- }
4404
- }
4405
- InputNoFormControlMagicDirective.ɵfac = function InputNoFormControlMagicDirective_Factory(t) { return new (t || InputNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4406
- InputNoFormControlMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: InputNoFormControlMagicDirective, selectors: [["input", "magic", "", "noFormControl", "", 3, "type", "checkbox"], ["textarea", "magic", "", "noFormControl", "", 3, "type", "checkbox"]], hostBindings: function InputNoFormControlMagicDirective_HostBindings(rf, ctx) {
4407
- if (rf & 1) {
4408
- i0.ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
4409
- }
4410
- } });
4411
- (function () {
4412
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
4413
- type: Directive,
4414
- args: [{
4415
- selector: `input[magic]:([noFormControl]):not([type=checkbox]),
4416
- textarea[magic]:([noFormControl]):not([type=checkbox])`
4417
- }]
4418
- }], function () { return [{ type: MagicDirective }]; }, { onChange: [{
4419
- type: HostListener,
4420
- args: ['change', ['$event']]
4421
- }] });
4422
- })();
4423
-
4424
- const DATE_VALUE_ACCESSOR = {
4425
- provide: NG_VALUE_ACCESSOR,
4426
- useExisting: forwardRef(() => DateValueAccessor),
4427
- multi: true
4428
- };
4429
- class DateValueAccessor {
4430
- constructor(renderer, elementRef) {
4431
- this.renderer = renderer;
4432
- this.elementRef = elementRef;
4433
- this.onChange = (_) => { };
4434
- this.onTouched = () => { };
4435
- }
4436
- writeValue(value) {
4437
- if (!value) {
4438
- this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
4439
- return;
4440
- }
4441
- this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
4442
- }
4443
- registerOnChange(fn) {
4444
- this.onChange = v => fn(v instanceof Date
4445
- ? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
4446
- : v);
4447
- }
4448
- registerOnTouched(fn) {
4449
- this.onTouched = fn;
4450
- }
4451
- setDisabledState(isDisabled) {
4452
- this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
4453
- }
4454
- }
4455
- DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef)); };
4456
- DateValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) {
4457
- if (rf & 1) {
4458
- i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
4459
- }
4460
- }, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
4461
- (function () {
4462
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateValueAccessor, [{
4463
- type: Directive,
4464
- args: [{
4465
- selector: "[dateInput]",
4466
- providers: [DATE_VALUE_ACCESSOR]
4467
- }]
4468
- }], function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, { onChange: [{
4469
- type: HostListener,
4470
- args: ["input", ["$event.target.valueAsDate"]]
4471
- }], onTouched: [{
4472
- type: HostListener,
4473
- args: ["blur", []]
4474
- }] });
4475
- })();
4476
-
4477
- class NonMagicControlDirective {
4478
- set magic(val) {
4479
- this.id = val;
4480
- this.selector = 'NonMagicControl';
4481
- }
4482
- ;
4483
- constructor(_task, element, renderer, vcRef) {
4484
- this._task = _task;
4485
- this.element = element;
4486
- this.renderer = renderer;
4487
- this.vcRef = vcRef;
4488
- this.eventHandlers = {};
4489
- this.eventsOnlyVal = false;
4490
- this.htmlElement = this.element.nativeElement;
4491
- }
4492
- get task() {
4493
- return this._task;
4494
- }
4495
- regEvents() {
4496
- this.eventHandlers['focusin'] = this.OnFocus.bind(this);
4497
- Object.keys(this.eventHandlers).forEach((key) => {
4498
- this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
4499
- });
4500
- }
4501
- OnFocus() {
4502
- this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', '', -1));
4503
- event.cancelBubble = true;
4504
- }
4505
- ngOnInit() {
4506
- this.regEvents();
4507
- }
4508
- }
4509
- NonMagicControlDirective.ɵfac = function NonMagicControlDirective_Factory(t) { return new (t || NonMagicControlDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
4510
- NonMagicControlDirective.ɵdir = i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: ["NonMagicControl", "magic"] } });
4511
- (function () {
4512
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NonMagicControlDirective, [{
4513
- type: Directive,
4514
- args: [{
4515
- selector: '[NonMagicControl]'
4516
- }]
4517
- }], function () { return [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }]; }, { magic: [{
4518
- type: Input,
4519
- args: ['NonMagicControl']
4520
- }] });
4521
- })();
4522
-
4523
- class Time24MagicPipe {
4524
- constructor(_task) {
4525
- this._task = _task;
4526
- }
4527
- transform(value, controlId) {
4528
- let mask = this._task.GetControlPictureMask(controlId).getMask();
4529
- if (typeof value !== "undefined" && mask !== null) {
4530
- const date = new Date(value);
4531
- const hours = date.getHours().toString().padStart(2, '0');
4532
- const minutes = date.getMinutes().toString().padStart(2, '0');
4533
- const seconds = date.getSeconds().toString().padStart(2, '0');
4534
- if (mask.length == 5) {
4535
- return `${hours}:${minutes}`;
4536
- }
4537
- else if (mask.length > 5) {
4538
- return `${hours}:${minutes}:${seconds}`;
4539
- }
4540
- }
4541
- return value;
4542
- }
4543
- }
4544
- Time24MagicPipe.ɵfac = function Time24MagicPipe_Factory(t) { return new (t || Time24MagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
4545
- Time24MagicPipe.ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true });
4546
- (function () {
4547
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Time24MagicPipe, [{
4548
- type: Pipe,
4549
- args: [{
4550
- name: 'magicTime24'
4551
- }]
4552
- }], function () { return [{ type: TaskMagicService }]; }, null);
4553
- })();
4554
-
4555
- const decs = [
4556
- MagicDirective,
4557
- CheckboxMagicDirective,
4558
- CheckboxNoFormControlMagicDirective,
4559
- InputNoFormControlMagicDirective,
4560
- ComboboxMagicDirective,
4561
- RowMagicDirective,
4562
- MagicCheckboxControlValueAccessor,
4563
- MagicDefaultValueAccessor,
4564
- DateValueAccessor,
4565
- TaskBaseMagicComponent,
4566
- MagicOverlayContainer,
4567
- MagicAlertComponent,
4568
- MagicConfirmationBoxComponent,
4569
- BaseMagicAlertComponent,
4570
- BaseMagicConfirmComponent,
4571
- MagicOverlayContainerWrapper,
4572
- RouterContainerMagicComponent,
4573
- MagicShellComponent,
4574
- SubformMagicComponent,
4575
- ErrorMagicComponent,
4576
- NoControlMagicDirective,
4577
- MgformatMagicDirective,
4578
- DateMagicPipe,
4579
- TimeMagicPipe,
4580
- RangeValidatorMagicDirective,
4581
- NonMagicControlDirective,
4582
- MagicFocusDirective,
4583
- MagicViewContainerRef,
4584
- Time24MagicPipe
4585
- ];
4586
- class MagicModule {
4587
- }
4588
- MagicModule.ɵfac = function MagicModule_Factory(t) { return new (t || MagicModule)(); };
4589
- MagicModule.ɵmod = i0.ɵɵdefineNgModule({ type: MagicModule });
4590
- MagicModule.ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [CommonModule,
4591
- FormsModule,
4592
- ReactiveFormsModule,
4593
- RouterModule,
4594
- DynamicModule,
4595
- HttpClientModule, MaskitoModule] });
4596
- (function () {
4597
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicModule, [{
4598
- type: NgModule,
4599
- args: [{
4600
- declarations: [...decs],
4601
- exports: [...decs, MaskitoModule],
4602
- entryComponents: [],
4603
- imports: [
4604
- CommonModule,
4605
- FormsModule,
4606
- ReactiveFormsModule,
4607
- RouterModule,
4608
- DynamicModule,
4609
- HttpClientModule
4610
- ],
4611
- providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
4612
- }]
4613
- }], null, null);
4614
- })();
4615
- (function () {
4616
- (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MagicModule, { declarations: [MagicDirective,
4617
- CheckboxMagicDirective,
4618
- CheckboxNoFormControlMagicDirective,
4619
- InputNoFormControlMagicDirective,
4620
- ComboboxMagicDirective,
4621
- RowMagicDirective,
4622
- MagicCheckboxControlValueAccessor,
4623
- MagicDefaultValueAccessor,
4624
- DateValueAccessor,
4625
- TaskBaseMagicComponent,
4626
- MagicOverlayContainer,
4627
- MagicAlertComponent,
4628
- MagicConfirmationBoxComponent,
4629
- BaseMagicAlertComponent,
4630
- BaseMagicConfirmComponent,
4631
- MagicOverlayContainerWrapper,
4632
- RouterContainerMagicComponent,
4633
- MagicShellComponent,
4634
- SubformMagicComponent,
4635
- ErrorMagicComponent,
4636
- NoControlMagicDirective,
4637
- MgformatMagicDirective,
4638
- DateMagicPipe,
4639
- TimeMagicPipe,
4640
- RangeValidatorMagicDirective,
4641
- NonMagicControlDirective,
4642
- MagicFocusDirective,
4643
- MagicViewContainerRef,
4644
- Time24MagicPipe], imports: [CommonModule,
4645
- FormsModule,
4646
- ReactiveFormsModule,
4647
- RouterModule,
4648
- DynamicModule,
4649
- HttpClientModule], exports: [MagicDirective,
4650
- CheckboxMagicDirective,
4651
- CheckboxNoFormControlMagicDirective,
4652
- InputNoFormControlMagicDirective,
4653
- ComboboxMagicDirective,
4654
- RowMagicDirective,
4655
- MagicCheckboxControlValueAccessor,
4656
- MagicDefaultValueAccessor,
4657
- DateValueAccessor,
4658
- TaskBaseMagicComponent,
4659
- MagicOverlayContainer,
4660
- MagicAlertComponent,
4661
- MagicConfirmationBoxComponent,
4662
- BaseMagicAlertComponent,
4663
- BaseMagicConfirmComponent,
4664
- MagicOverlayContainerWrapper,
4665
- RouterContainerMagicComponent,
4666
- MagicShellComponent,
4667
- SubformMagicComponent,
4668
- ErrorMagicComponent,
4669
- NoControlMagicDirective,
4670
- MgformatMagicDirective,
4671
- DateMagicPipe,
4672
- TimeMagicPipe,
4673
- RangeValidatorMagicDirective,
4674
- NonMagicControlDirective,
4675
- MagicFocusDirective,
4676
- MagicViewContainerRef,
4677
- Time24MagicPipe, MaskitoModule] });
4678
- })();
4679
-
4680
- const MG_FORMATS = {
4681
- parse: { dateInput: { month: 'short', year: 'numeric', day: 'numeric' } },
4682
- display: {
4683
- dateInput: 'input',
4684
- monthYearLabel: { year: 'numeric', month: 'short' },
4685
- dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
4686
- monthYearA11yLabel: { year: 'numeric', month: 'long' }
4687
- }
4688
- };
4689
- class MgDateAdapter extends NativeDateAdapter {
4690
- constructor(platform, task, localeId) {
4691
- super(localeId, platform);
4692
- this.platform = platform;
4693
- this.task = task;
4694
- this.localeId = localeId;
4695
- this.mgdtfmt = null;
4696
- this.setLocale(localeId);
4697
- }
4698
- parse(value) {
4699
- let valueStr = value;
4700
- let date = 0, month = 0, year = 0;
4701
- let mgDateMask = this.mgdtfmt;
4702
- let sep = valueStr.indexOf('/') > 0 ? '/' : '-';
4703
- if (value == null || value == "")
4704
- return null;
4705
- if (this.mgdtfmt == null && this.task.mgInputDateFormat != null)
4706
- this.mgdtfmt = this.task.mgInputDateFormat;
4707
- if ((this.mgdtfmt.indexOf('MMM') > 0) || (this.mgdtfmt.indexOf('MMMM') > 0))
4708
- return new Date(value);
4709
- if (mgDateMask !== null) {
4710
- for (let i = 0; i < mgDateMask.length;) {
4711
- switch (mgDateMask[i]) {
4712
- case 'd':
4713
- {
4714
- let tmpStr;
4715
- let len = valueStr.indexOf(sep, 0);
4716
- tmpStr = len == -1 ? valueStr : valueStr.substr(0, len);
4717
- if (len > -1)
4718
- valueStr = valueStr.substr(len + 1);
4719
- for (; mgDateMask[i] == 'd'; i++)
4720
- ;
4721
- date = (Number)(tmpStr);
4722
- }
4723
- break;
4724
- case 'M':
4725
- {
4726
- let tmpStr;
4727
- let len = valueStr.indexOf(sep, 0);
4728
- tmpStr = len == -1 ? valueStr : valueStr.substr(0, len);
4729
- if (len > -1)
4730
- valueStr = valueStr.substr(len + 1);
4731
- for (; mgDateMask[i] == 'M'; i++)
4732
- ;
4733
- month = (Number)(tmpStr) > 0 ? (Number)(tmpStr) - 1 : 0;
4734
- }
4735
- break;
4736
- case 'y':
4737
- {
4738
- let tmpStr;
4739
- let len = valueStr.indexOf(sep, 0);
4740
- tmpStr = len == -1 ? valueStr : valueStr.substr(0, len);
4741
- if (len > -1) {
4742
- valueStr = valueStr.substr(len + 1);
4743
- }
4744
- for (; mgDateMask[i] == 'y'; i++)
4745
- ;
4746
- year = (Number)(tmpStr);
4747
- }
4748
- break;
4749
- default:
4750
- i++;
4751
- break;
4752
- }
4753
- }
4754
- if (month == 0 && year == 0 && date == 0)
4755
- return null;
4756
- return new Date(year, month, date);
4757
- }
4758
- }
4759
- format(date, displayFormat) {
4760
- if (this.mgdtfmt == null && this.task.mgInputDateFormat != null)
4761
- this.mgdtfmt = this.task.mgInputDateFormat;
4762
- if (displayFormat === 'input') {
4763
- if (this.mgdtfmt == null)
4764
- this.mgdtfmt = 'M/d/yyyy';
4765
- return formatDate(date, this.mgdtfmt, this.locale);
4766
- }
4767
- else {
4768
- return date.toDateString();
4769
- }
4770
- }
4771
- }
4772
- MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(i0.ɵɵinject(i2$1.Platform), i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MAT_DATE_LOCALE)); };
4773
- MgDateAdapter.ɵprov = i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
4774
- (function () {
4775
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgDateAdapter, [{
4776
- type: Injectable
4777
- }], function () {
4778
- return [{ type: i2$1.Platform }, { type: TaskMagicService }, { type: undefined, decorators: [{
4779
- type: Inject,
4780
- args: [MAT_DATE_LOCALE]
4781
- }] }];
4782
- }, null);
4783
- })();
4784
-
4785
- const matDateProviders = [
4786
- { provide: DateAdapter, useClass: MgDateAdapter },
4787
- { provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
4788
- ];
4789
- const basicMagicProviders = [
4790
- MagicServices,
4791
- TaskMagicService,
4792
- SubformMagicService,
4793
- TitleMagicService,
4794
- AccessorMagicService,
4795
- matDateProviders,
4796
- ];
4797
- const magicProviders = [
4798
- ...basicMagicProviders,
4799
- TableMagicService
4800
- ];
4801
-
4802
- class utils {
4803
- static getDistance(control, x, y) {
4804
- let left = control.clientLeft, top = control.clientTop;
4805
- let dx, dy;
4806
- const right = left + control.clientWidth;
4807
- const bottom = top + control.clientHeight;
4808
- if (x < left) {
4809
- dx = left - x;
4810
- }
4811
- else if (x > right) {
4812
- dx = x - right;
4813
- }
4814
- else {
4815
- dx = 0;
4816
- }
4817
- if (y < top) {
4818
- dy = top - y;
4819
- }
4820
- else if (y > bottom) {
4821
- dy = y - bottom;
4822
- }
4823
- else {
4824
- dy = 0;
4825
- }
4826
- const ret = (dx * dx + dy * dy);
4827
- return ret;
4828
- }
4829
- static getDimentions(el) {
4830
- let xPos = 0;
4831
- let yPos = 0;
4832
- let width = el.width;
4833
- let height = el.height;
4834
- while (el) {
4835
- if (el.tagName == "BODY") {
4836
- let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
4837
- let yScroll = el.scrollTop || document.documentElement.scrollTop;
4838
- xPos += (el.offsetLeft - xScroll + el.clientLeft);
4839
- yPos += (el.offsetTop - yScroll + el.clientTop);
4840
- }
4841
- else {
4842
- xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
4843
- yPos += (el.offsetTop - el.scrollTop + el.clientTop);
4844
- }
4845
- el = el.offsetParent;
4846
- }
4847
- return {
4848
- x: xPos,
4849
- y: yPos,
4850
- width: width,
4851
- height: height
4852
- };
4853
- }
4854
- }
4855
-
4856
- class ModalFormDefinition {
4857
- constructor() {
4858
- this.taskId = "";
4859
- this.comp = null;
4860
- this.parameters = {};
4861
- }
4862
- }
4863
-
4864
- 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 };
4865
- //# sourceMappingURL=magic-xpa-angular.mjs.map