@magic-xpa/angular 4.1100.0-dev4110.106 → 4.1100.0-dev4110.107

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 (124) hide show
  1. package/README.md +5 -5
  2. package/esm2020/index.mjs +59 -2
  3. package/esm2020/src/controls.metadata.model.mjs +180 -0
  4. package/esm2020/src/interfaces/sub-form-definition.iterface.mjs +2 -0
  5. package/esm2020/src/magic.core.module.mjs +160 -0
  6. package/esm2020/src/services/ISubformMagicService.mjs +2 -0
  7. package/esm2020/src/services/OverlayWindowService.mjs +236 -0
  8. package/esm2020/src/services/StylesMapManager.mjs +28 -0
  9. package/esm2020/src/services/accessor.magic.service.mjs +356 -0
  10. package/esm2020/src/services/commands-collector.magic.service.mjs +46 -0
  11. package/esm2020/src/services/component-list.magic.service.mjs +46 -0
  12. package/esm2020/src/services/confirmation.components.magic.provider.mjs +21 -0
  13. package/esm2020/src/services/engine.magic.service.mjs +82 -0
  14. package/esm2020/src/services/exit.magic.service.mjs +13 -0
  15. package/esm2020/src/services/magic-color.service.mjs +99 -0
  16. package/esm2020/src/services/magic.lazy.loader.service.mjs +16 -0
  17. package/esm2020/src/services/magic.providers.mjs +25 -0
  18. package/esm2020/src/services/magic.services.mjs +31 -0
  19. package/esm2020/src/services/mg-date-adapter.mjs +109 -0
  20. package/esm2020/src/services/overlay.conainer.magic.provider.mjs +14 -0
  21. package/esm2020/src/services/router-commands.magic.service.mjs +28 -0
  22. package/esm2020/src/services/subform.magic.service.mjs +184 -0
  23. package/esm2020/src/services/table.magic.service.mjs +77 -0
  24. package/esm2020/src/services/task.magics.service.mjs +624 -0
  25. package/esm2020/src/services/title.magic.service.mjs +18 -0
  26. package/esm2020/src/ui/GuiInteractiveExecutor.mjs +105 -0
  27. package/esm2020/src/ui/components/base-magic-alert.component.mjs +23 -0
  28. package/esm2020/src/ui/components/base-magic-confirm.component.mjs +23 -0
  29. package/esm2020/src/ui/components/magic-alert.component.mjs +35 -0
  30. package/esm2020/src/ui/components/magic-confirmation-box.component.mjs +41 -0
  31. package/esm2020/src/ui/directives/NonMagicControlDirective.mjs +49 -0
  32. package/esm2020/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.mjs +28 -0
  33. package/esm2020/src/ui/directives/magic/checkbox.magic.directive.mjs +28 -0
  34. package/esm2020/src/ui/directives/magic/combobox.magic.directive.mjs +36 -0
  35. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.mjs +27 -0
  36. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +52 -0
  37. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.mjs +32 -0
  38. package/esm2020/src/ui/directives/magic/input.noformcontrol.magic.directive.mjs +27 -0
  39. package/esm2020/src/ui/directives/magic/nocontrol.magic.directive.mjs +193 -0
  40. package/esm2020/src/ui/directives/magic/row.magic.directive.mjs +58 -0
  41. package/esm2020/src/ui/directives/magic-focus.directive.mjs +19 -0
  42. package/esm2020/src/ui/directives/magic.directive.mjs +215 -0
  43. package/esm2020/src/ui/directives/magicViewContainerRef.directive.mjs +19 -0
  44. package/esm2020/src/ui/directives/mgformat.magic.directive.mjs +408 -0
  45. package/esm2020/src/ui/directives/range-validator.magic.directive.mjs +58 -0
  46. package/esm2020/src/ui/magic-confirmationBox.mjs +42 -0
  47. package/esm2020/src/ui/magic-modal/base-magic-overlay-container.mjs +22 -0
  48. package/esm2020/src/ui/magic-modal/magic-modal-form.mjs +8 -0
  49. package/esm2020/src/ui/magic-modal/magic-modal-interface.mjs +2 -0
  50. package/esm2020/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +121 -0
  51. package/esm2020/src/ui/magic-modal/magic-overlay-container.mjs +159 -0
  52. package/esm2020/src/ui/magic-root.component.mjs +203 -0
  53. package/esm2020/src/ui/mgerror.magic.component.mjs +119 -0
  54. package/esm2020/src/ui/pipes/date.magic.pipe.mjs +105 -0
  55. package/esm2020/src/ui/pipes/time.magic.pipe.mjs +51 -0
  56. package/esm2020/src/ui/pipes/time24.magic.pipe.mjs +34 -0
  57. package/esm2020/src/ui/router-container.magic.component.mjs +108 -0
  58. package/esm2020/src/ui/subform.magic.component.mjs +52 -0
  59. package/esm2020/src/ui/task-base.magic.component.mjs +86 -0
  60. package/esm2020/src/ui/utils.mjs +54 -0
  61. package/fesm2015/magic-xpa-angular.mjs +4863 -0
  62. package/fesm2015/magic-xpa-angular.mjs.map +1 -1
  63. package/fesm2020/magic-xpa-angular.mjs +4681 -0
  64. package/fesm2020/magic-xpa-angular.mjs.map +1 -1
  65. package/index.d.ts +58 -1
  66. package/package.json +3 -3
  67. package/src/controls.metadata.model.d.ts +62 -0
  68. package/src/interfaces/sub-form-definition.iterface.d.ts +12 -0
  69. package/src/magic.core.module.d.ts +41 -0
  70. package/src/services/ISubformMagicService.d.ts +4 -0
  71. package/src/services/OverlayWindowService.d.ts +31 -0
  72. package/src/services/StylesMapManager.d.ts +5 -0
  73. package/src/services/accessor.magic.service.d.ts +69 -0
  74. package/src/services/commands-collector.magic.service.d.ts +15 -0
  75. package/src/services/component-list.magic.service.d.ts +23 -0
  76. package/src/services/confirmation.components.magic.provider.d.ts +8 -0
  77. package/src/services/engine.magic.service.d.ts +27 -0
  78. package/src/services/exit.magic.service.d.ts +6 -0
  79. package/src/services/magic-color.service.d.ts +19 -0
  80. package/src/services/magic.lazy.loader.service.d.ts +6 -0
  81. package/src/services/magic.providers.d.ts +107 -0
  82. package/src/services/magic.services.d.ts +16 -0
  83. package/src/services/mg-date-adapter.d.ts +40 -0
  84. package/src/services/overlay.conainer.magic.provider.d.ts +7 -0
  85. package/src/services/router-commands.magic.service.d.ts +17 -0
  86. package/src/services/subform.magic.service.d.ts +43 -0
  87. package/src/services/table.magic.service.d.ts +30 -0
  88. package/src/services/task.magics.service.d.ts +100 -0
  89. package/src/services/title.magic.service.d.ts +9 -0
  90. package/src/ui/GuiInteractiveExecutor.d.ts +22 -0
  91. package/src/ui/components/base-magic-alert.component.d.ts +10 -0
  92. package/src/ui/components/base-magic-confirm.component.d.ts +10 -0
  93. package/src/ui/components/magic-alert.component.d.ts +6 -0
  94. package/src/ui/components/magic-confirmation-box.component.d.ts +6 -0
  95. package/src/ui/directives/NonMagicControlDirective.d.ts +26 -0
  96. package/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.d.ts +9 -0
  97. package/src/ui/directives/magic/checkbox.magic.directive.d.ts +9 -0
  98. package/src/ui/directives/magic/combobox.magic.directive.d.ts +10 -0
  99. package/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.d.ts +7 -0
  100. package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +17 -0
  101. package/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.d.ts +7 -0
  102. package/src/ui/directives/magic/input.noformcontrol.magic.directive.d.ts +9 -0
  103. package/src/ui/directives/magic/nocontrol.magic.directive.d.ts +18 -0
  104. package/src/ui/directives/magic/row.magic.directive.d.ts +17 -0
  105. package/src/ui/directives/magic-focus.directive.d.ts +9 -0
  106. package/src/ui/directives/magic.directive.d.ts +44 -0
  107. package/src/ui/directives/magicViewContainerRef.directive.d.ts +8 -0
  108. package/src/ui/directives/mgformat.magic.directive.d.ts +31 -0
  109. package/src/ui/directives/range-validator.magic.directive.d.ts +17 -0
  110. package/src/ui/magic-confirmationBox.d.ts +6 -0
  111. package/src/ui/magic-modal/base-magic-overlay-container.d.ts +5 -0
  112. package/src/ui/magic-modal/magic-modal-form.d.ts +5 -0
  113. package/src/ui/magic-modal/magic-modal-interface.d.ts +10 -0
  114. package/src/ui/magic-modal/magic-overlay-container-wrapper.d.ts +31 -0
  115. package/src/ui/magic-modal/magic-overlay-container.d.ts +25 -0
  116. package/src/ui/magic-root.component.d.ts +40 -0
  117. package/src/ui/mgerror.magic.component.d.ts +20 -0
  118. package/src/ui/pipes/date.magic.pipe.d.ts +17 -0
  119. package/src/ui/pipes/time.magic.pipe.d.ts +11 -0
  120. package/src/ui/pipes/time24.magic.pipe.d.ts +10 -0
  121. package/src/ui/router-container.magic.component.d.ts +30 -0
  122. package/src/ui/subform.magic.component.d.ts +16 -0
  123. package/src/ui/task-base.magic.component.d.ts +34 -0
  124. package/src/ui/utils.d.ts +9 -0
@@ -0,0 +1,624 @@
1
+ import { EventEmitter, Injectable } from '@angular/core';
2
+ import { FormControl, FormGroup } from '@angular/forms';
3
+ import { filter } from 'rxjs/operators';
4
+ import { Subject } from 'rxjs';
5
+ import { isNullOrUndefined, isUndefined } from '@magic-xpa/mscorelib';
6
+ import { StylesMapManager } from './StylesMapManager';
7
+ import { EngineMagicService } from './engine.magic.service';
8
+ import { Records } from '../controls.metadata.model';
9
+ import { CommandType, GuiConstants, HtmlProperties } from '@magic-xpa/gui';
10
+ import { NString, StringBuilder } from '@magic-xpa/mscorelib';
11
+ import { StorageAttribute } from '@magic-xpa/utils';
12
+ import { getGuiEventObj } from '@magic-xpa/engine';
13
+ import { GuiInteractiveExecutor } from '../ui/GuiInteractiveExecutor';
14
+ import { OverlayWindowService } from './OverlayWindowService';
15
+ import * as i0 from "@angular/core";
16
+ import * as i1 from "./engine.magic.service";
17
+ import * as i2 from "./OverlayWindowService";
18
+ export class TaskMagicService {
19
+ constructor(magic, overlayWindowService) {
20
+ this.magic = magic;
21
+ this.overlayWindowService = overlayWindowService;
22
+ this.Records = new Records();
23
+ this.formGroups = [];
24
+ this.refreshDom = new Subject();
25
+ this.detectChanges = new Subject();
26
+ this.interactiveCommands = new Subject();
27
+ this.OnSelectedRowChanged = new EventEmitter();
28
+ this.customPropertiesSubject = new Subject();
29
+ this.recordsCountChangeSubject = new Subject();
30
+ this.mgLoadSubject = new Subject();
31
+ this.oldPageSize = 0;
32
+ this.Records.setGuiTopIndex(0);
33
+ this.mgInputDateFormat = null;
34
+ }
35
+ getIsLoggenIn() {
36
+ return this.magic.getIsLoggedIn();
37
+ }
38
+ get taskId() {
39
+ return this._taskId;
40
+ }
41
+ set taskId(value) {
42
+ this._taskId = value;
43
+ }
44
+ get ScreenControlsData() {
45
+ return this.Records.list['0'];
46
+ }
47
+ settemplate(value) {
48
+ this.template = value;
49
+ }
50
+ buildScreenModeControls() {
51
+ const group = new FormGroup({});
52
+ for (const key in this.template) {
53
+ if (this.template[key] == '0') {
54
+ let fc = new FormControl('');
55
+ this.setStubValue(0, fc, key);
56
+ group.addControl(key, fc);
57
+ }
58
+ }
59
+ this.ScreenModeControls = group;
60
+ }
61
+ isTableControl(id) {
62
+ return this.template[id] == '1';
63
+ }
64
+ getMgInputDateFormat() { return this.mgInputDateFormat; }
65
+ getFormControl(guiRowid, id) {
66
+ let c;
67
+ let group = this.isTableControl(id) ? this.formGroups[guiRowid] : this.ScreenModeControls;
68
+ if (!isNullOrUndefined(group)) {
69
+ group.get(id);
70
+ c = group.controls[id];
71
+ }
72
+ return c;
73
+ }
74
+ setInputTextValue(controlId, guiRowid, val) {
75
+ this.setValue(controlId, guiRowid, this.ConvertValToNative(controlId, 0, val));
76
+ const fc = this.getFormControl(guiRowid, controlId);
77
+ if (!isNullOrUndefined(val))
78
+ fc.setValue(val);
79
+ }
80
+ buildTableRowControls(guiRowId) {
81
+ const group = new FormGroup({});
82
+ for (const key in this.template) {
83
+ if (this.template[key] == '1') {
84
+ let fc = new FormControl('');
85
+ this.setStubValue(guiRowId, fc, key);
86
+ group.addControl(key, fc);
87
+ }
88
+ }
89
+ this.formGroups[guiRowId] = group;
90
+ }
91
+ updateRecordsBeforeCurrentView(value) {
92
+ this.Records.recordsBeforeCurrentView = value;
93
+ }
94
+ setIncludesFirst(value) {
95
+ this.Records.includesFirst = value;
96
+ }
97
+ setIncludesLast(value) {
98
+ this.Records.includesLast = value;
99
+ }
100
+ markRowAsCreated(guiRowId) {
101
+ this.Records.markRowAsCreated(guiRowId);
102
+ }
103
+ markRowAsNotCreated(guiRowId) {
104
+ this.Records.markRowAsNotCreated(guiRowId);
105
+ }
106
+ startRowEditing(guiRowId) {
107
+ this.Records.startRowEditing(guiRowId);
108
+ }
109
+ stopRowEditing(guiRowId) {
110
+ this.Records.stopRowEditing(guiRowId);
111
+ }
112
+ isRowInRowEditing(guiRowId) {
113
+ return this.Records.isRowInRowEditing(guiRowId);
114
+ }
115
+ setIsEmptyDataView(isEmpty) {
116
+ if (this.Records.isEmptyDataView !== isEmpty) {
117
+ if (isEmpty)
118
+ this.recordsCountChangeSubject.next(0);
119
+ this.Records.isEmptyDataView = isEmpty;
120
+ this.tableService.refreshDataSource();
121
+ this.refreshView();
122
+ }
123
+ }
124
+ initTask(taskId, taskDescription) {
125
+ this.Records.createFirst();
126
+ this.oldPageSize = 0;
127
+ if (this.IsStub()) {
128
+ this.loadData();
129
+ }
130
+ else {
131
+ this.taskId = taskId;
132
+ this.settemplate(taskDescription);
133
+ }
134
+ this.buildScreenModeControls();
135
+ if (!isNullOrUndefined(this.subscribeRefreshDom))
136
+ this.subscribeRefreshDom.unsubscribe();
137
+ if (!isNullOrUndefined(this.subscribeInteractiveCommands))
138
+ this.subscribeInteractiveCommands.unsubscribe();
139
+ this.subscribeRefreshDom = this.magic.refreshDom.pipe(filter(command => command.TaskTag === this.taskId))
140
+ .subscribe(command => {
141
+ this.executeCommand(command);
142
+ });
143
+ this.subscribeInteractiveCommands = this.magic.interactiveCommands
144
+ .pipe(filter(command => command.TaskTag === this.taskId))
145
+ .subscribe(command => {
146
+ this.executeInteractiveCommand(command);
147
+ });
148
+ }
149
+ refreshView() {
150
+ this.detectChanges.next('');
151
+ }
152
+ insertEvent(guiEvent) {
153
+ guiEvent.TaskID = this.taskId;
154
+ this.magic.insertEvent(guiEvent);
155
+ }
156
+ GetControlPictureMask(controlName) {
157
+ return this.magic.GetControlPictureMask(this.taskId, controlName);
158
+ }
159
+ ValidateControlValue(controlName, value) {
160
+ return this.magic.ValidateControlValue(this.taskId, controlName, value);
161
+ }
162
+ GetRangedValue(controlName, value) {
163
+ return this.magic.GetRangedValue(this.taskId, controlName, value);
164
+ }
165
+ GetFldRanges(controlName) {
166
+ return this.magic.GetFldRanges(this.taskId, controlName);
167
+ }
168
+ getProperty(controlId, prop, guiRowId) {
169
+ if (isNullOrUndefined(guiRowId))
170
+ guiRowId = '0';
171
+ if (this.IsStub())
172
+ return this.getPropertyStub(this.Records.list[guiRowId], controlId, prop);
173
+ else {
174
+ let rec = this.Records.list[guiRowId];
175
+ if (isNullOrUndefined(rec))
176
+ debugger;
177
+ else
178
+ return this.Records.list[guiRowId].getProperty(controlId, prop);
179
+ }
180
+ }
181
+ getPropertyStub(ControlsProperties, controlId, prop) {
182
+ ControlsProperties = ControlsProperties.ControlsProperties;
183
+ if (controlId in ControlsProperties) {
184
+ if (prop in ControlsProperties[controlId].properties) {
185
+ return ControlsProperties[controlId].properties[prop];
186
+ }
187
+ }
188
+ return '';
189
+ }
190
+ getStyleStub(ControlsProperties, controlId, styleName) {
191
+ ControlsProperties = ControlsProperties.ControlsProperties;
192
+ return ControlsProperties[controlId].stylesMap.get(styleName);
193
+ }
194
+ getClasses(controlId, guiRowId) {
195
+ if (isNullOrUndefined(guiRowId))
196
+ guiRowId = '0';
197
+ return this.Records.list[guiRowId].getControlMetadata(controlId).classes;
198
+ }
199
+ getStyle(controlId, styleName, guiRowId) {
200
+ if (isNullOrUndefined(guiRowId))
201
+ guiRowId = '0';
202
+ if (this.IsStub())
203
+ return this.getStyleStub(this.Records.list[guiRowId], controlId, styleName);
204
+ else {
205
+ let magicValue = this.Records.list[guiRowId].getControlMetadata(controlId).stylesMap.get(styleName);
206
+ return StylesMapManager.magicValueGetStyle(styleName, magicValue);
207
+ }
208
+ }
209
+ getValue(controlId, guiRowId) {
210
+ if (isNullOrUndefined(guiRowId))
211
+ guiRowId = '0';
212
+ return this.Records.list.length > +guiRowId ? this.Records.list[guiRowId].values[controlId] : '';
213
+ }
214
+ getFormattedValue(controlName, val, rowId) {
215
+ return this.magic.GetFormattedValue(this.taskId, controlName, val, rowId);
216
+ }
217
+ setValue(controlId, guiRowId, value) {
218
+ return this.Records.list[guiRowId].setValue(controlId, value);
219
+ }
220
+ executeInteractiveCommand(guiInteractiveCommand) {
221
+ GuiInteractiveExecutor.executeInteractiveCommand(this, guiInteractiveCommand, this.overlayWindowService);
222
+ this.interactiveCommands.next(guiInteractiveCommand);
223
+ }
224
+ handleSetProperty(command, isTableChild) {
225
+ let controlId = command.CtrlName;
226
+ let dvRowId = (command.line || 0);
227
+ let guiRowId = this.getGuiRowId(dvRowId, isTableChild);
228
+ let properties;
229
+ if (command.Operation === HtmlProperties.SelectedRow) {
230
+ if (command.obj1 !== GuiConstants.NO_ROW_SELECTED) {
231
+ guiRowId = this.getGuiRowId(command.obj1, true);
232
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
233
+ properties.properties.set(command.Operation, command.line);
234
+ this.tableService.selectRow(guiRowId.toString());
235
+ this.OnSelectedRowChanged.emit(guiRowId.toString());
236
+ }
237
+ }
238
+ else if (command.Operation === HtmlProperties.Enabled) {
239
+ let c = this.getFormControl(guiRowId.toString(), controlId);
240
+ if (!isNullOrUndefined(c)) {
241
+ if (command.obj1)
242
+ c.enable();
243
+ else
244
+ c.disable();
245
+ }
246
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
247
+ properties.properties.set(command.Operation, command.obj1);
248
+ }
249
+ else {
250
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
251
+ properties.properties.set(command.Operation, command.obj1);
252
+ }
253
+ }
254
+ executeCommand(command) {
255
+ let dvRowId = (command.line || 0);
256
+ let guiRowId = 0;
257
+ let controlId = command.CtrlName;
258
+ let properties;
259
+ let isTableChild = this.isTableControl(controlId);
260
+ if (command.obj !== null)
261
+ isTableChild = isTableChild || command.obj.IsTableChild;
262
+ guiRowId = this.getGuiRowId(dvRowId, isTableChild);
263
+ switch (command.CommandType) {
264
+ case CommandType.SET_IS_LOGGED_IN:
265
+ break;
266
+ case CommandType.SET_TABLE_TOP_INDEX:
267
+ this.tableService.setTableTopIndex(command.number);
268
+ break;
269
+ case CommandType.REFRESH_TASK:
270
+ this.tableService.refreshDataSource();
271
+ this.refreshView();
272
+ break;
273
+ case CommandType.SET_TABLE_ITEMS_COUNT:
274
+ if (!isUndefined(command.number)) {
275
+ this.tableService.updateTableSize(command.number);
276
+ if (command.number > 0 && this.Records.sizeUpdated &&
277
+ !this.Records.isEmptyDataView) {
278
+ this.recordsCountChangeSubject.next(command.number);
279
+ this.Records.sizeUpdated = false;
280
+ }
281
+ }
282
+ break;
283
+ case CommandType.SET_CHUNK_SIZE:
284
+ if (!isUndefined(command.number)) {
285
+ this.tableService.setChunkSize(command.number);
286
+ }
287
+ break;
288
+ case CommandType.SET_RECORDS_BEFORE_CURRENT_VIEW:
289
+ this.updateRecordsBeforeCurrentView(command.number);
290
+ break;
291
+ case CommandType.CREATE_TABLE_ROW:
292
+ guiRowId = this.getGuiRowId(command.number, true);
293
+ this.buildTableRowControls(guiRowId);
294
+ this.markRowAsCreated(guiRowId);
295
+ break;
296
+ case CommandType.SET_IS_ROW_EDITING:
297
+ guiRowId = this.getGuiRowId(command.line, command.value);
298
+ this.startRowEditing(guiRowId);
299
+ break;
300
+ case CommandType.SET_NOT_IS_ROW_EDITING:
301
+ guiRowId = this.getGuiRowId(command.line, command.value);
302
+ this.stopRowEditing(guiRowId);
303
+ break;
304
+ case CommandType.UNDO_CREATE_TABLE_ROW:
305
+ this.markRowAsNotCreated(this.getGuiRowId(command.number, true));
306
+ break;
307
+ case CommandType.SET_TABLE_INCLUDES_FIRST:
308
+ this.setIncludesFirst(command.Bool1);
309
+ break;
310
+ case CommandType.SET_TABLE_INCLUDES_LAST:
311
+ this.setIncludesLast(command.Bool1);
312
+ break;
313
+ case CommandType.SET_PROPERTY:
314
+ this.handleSetProperty(command, isTableChild);
315
+ if (command.Operation == HtmlProperties.ReadOnly ||
316
+ command.Operation == HtmlProperties.ItemsList)
317
+ this.refreshDom.next(command);
318
+ break;
319
+ case CommandType.PROP_SET_USER_PROPERTY:
320
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
321
+ if (properties.userProperties.get(command.Operation) !== command.obj1) {
322
+ properties.userProperties.set(command.Operation, command.obj1);
323
+ this.customPropertiesSubject.next({ propertyName: controlId + '~' + command.Operation, value: command.obj1, rowId: guiRowId });
324
+ }
325
+ break;
326
+ case CommandType.PROP_SET_CUSTOM_VALIDATOR:
327
+ {
328
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
329
+ let control = this.getFormControl(guiRowId.toString(), controlId);
330
+ if (control != null) {
331
+ properties.customValidators.set(command.Operation, command.obj1);
332
+ if (control.validator != null)
333
+ control.setValidators([control.validator, this.customValidator(guiRowId.toString(), controlId)]);
334
+ else
335
+ control.setValidators(this.customValidator(guiRowId.toString(), controlId));
336
+ control.updateValueAndValidity();
337
+ }
338
+ }
339
+ break;
340
+ case CommandType.SET_CLASS:
341
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
342
+ properties.setClass(command.Operation, command.obj1);
343
+ break;
344
+ case CommandType.SET_STYLE:
345
+ properties = this.Records.list[guiRowId].getControlMetadata(controlId);
346
+ properties.setStyle(command.Operation, command.obj1);
347
+ break;
348
+ case CommandType.SET_ATTRIBUTE:
349
+ properties = this.Records.list[0].getControlMetadata(controlId);
350
+ properties.dataType = String.fromCharCode(command.number);
351
+ break;
352
+ case CommandType.SET_VALUE:
353
+ this.Records.list[guiRowId].values[controlId] = command.value;
354
+ let c = this.getFormControl(guiRowId.toString(), controlId);
355
+ if (!isNullOrUndefined(c)) {
356
+ c.setValue(this.ConvertValFromNative(controlId, command.line, command.value));
357
+ }
358
+ break;
359
+ case CommandType.CREATE_SUB_FORM:
360
+ this.mgSubformService.addSubformComp(command.CtrlName, command.userDropFormat.toString(), command.str, command.fileName, command.contextID, command.params, command.Bool1);
361
+ break;
362
+ case CommandType.CLOSE_SUB_FORM:
363
+ this.mgSubformService.deleteSubformComp(command.CtrlName, command.userDropFormat.toString());
364
+ break;
365
+ case CommandType.SET_EMPTY_DATAVIEW:
366
+ this.setIsEmptyDataView(command.Bool1);
367
+ break;
368
+ case CommandType.SET_FOCUS:
369
+ this.refreshDom.next(command);
370
+ break;
371
+ case CommandType.SET_WC_IDLE:
372
+ this.mgLoadSubject.next();
373
+ break;
374
+ }
375
+ }
376
+ customValidator(rowid, id) {
377
+ return (control) => {
378
+ let controlMetadata;
379
+ controlMetadata = this.Records.list[rowid].getControlMetadata(id);
380
+ for (let key of controlMetadata.customValidators.keys()) {
381
+ let validator = controlMetadata.customValidators.get(key);
382
+ if (!validator.isValid()) {
383
+ return { [key]: true };
384
+ }
385
+ }
386
+ return null;
387
+ };
388
+ }
389
+ ConvertValToNative(controlId, rowId, val) {
390
+ let properties;
391
+ properties = this.Records.list[0].getControlMetadata(controlId);
392
+ switch (properties.dataType) {
393
+ case StorageAttribute.BOOLEAN: {
394
+ if (typeof val === 'string') {
395
+ let ranges = this.GetFldRanges(controlId);
396
+ let found = ranges.indexOf(',');
397
+ let trueOption = ranges.substr(0, found);
398
+ let falseOption = ranges.substr(found + 1);
399
+ if (NString.Equals(val, trueOption, true))
400
+ return true;
401
+ else if (NString.Equals(val, falseOption, true))
402
+ return false;
403
+ else
404
+ return val;
405
+ }
406
+ else
407
+ return val;
408
+ }
409
+ case StorageAttribute.TIME: {
410
+ if (typeof val === 'string') {
411
+ let idx = val.indexOf(':', 0);
412
+ let hours = +val.substr(0, idx);
413
+ let minutes = +val.substr(idx + 1, 2);
414
+ let seconds = 0;
415
+ if (val.length > 5) {
416
+ idx = val.indexOf(':', idx + 1);
417
+ if (idx >= 0)
418
+ seconds = +val.substr(idx + 1, 2);
419
+ }
420
+ if (val.indexOf('PM') > 0)
421
+ hours += 12;
422
+ let dt = new Date();
423
+ dt.setHours(hours);
424
+ dt.setMinutes(minutes);
425
+ dt.setSeconds(seconds);
426
+ return dt;
427
+ }
428
+ else
429
+ return val;
430
+ }
431
+ case StorageAttribute.NUMERIC:
432
+ if (isUndefined(val))
433
+ return val;
434
+ else
435
+ return (val != null) ? (typeof val === 'string') ? val : +val : null;
436
+ default:
437
+ return val;
438
+ }
439
+ }
440
+ ConvertValFromNative(controlId, rowId, val) {
441
+ let properties;
442
+ properties = this.Records.list[0].getControlMetadata(controlId);
443
+ switch (properties.dataType) {
444
+ case StorageAttribute.TIME: {
445
+ if (val instanceof Date) {
446
+ let str = new StringBuilder();
447
+ let format = val.getHours() > 9 ? '{0}' : '0{0}';
448
+ str.AppendFormat(format, val.getHours().toString());
449
+ str.Append(':');
450
+ format = val.getMinutes() > 9 ? '{0}' : '0{0}';
451
+ str.AppendFormat(format, val.getMinutes().toString());
452
+ if (val.getSeconds() > 0) {
453
+ str.Append(':');
454
+ format = val.getSeconds() > 9 ? '{0}' : '0{0}';
455
+ str.AppendFormat(format, val.getSeconds().toString());
456
+ }
457
+ return str.ToString();
458
+ }
459
+ else
460
+ return val;
461
+ }
462
+ case StorageAttribute.BOOLEAN: {
463
+ let properties;
464
+ properties = this.Records.list['0'].getControlMetadata(controlId);
465
+ if (typeof val === 'boolean' && properties.rangeValidator) {
466
+ let ranges = this.GetFldRanges(controlId);
467
+ let found = ranges.indexOf(',');
468
+ let trueOption = ranges.substr(0, found);
469
+ let falseOption = ranges.substr(found + 1);
470
+ if (val)
471
+ return trueOption;
472
+ else
473
+ return falseOption;
474
+ }
475
+ else
476
+ return val;
477
+ }
478
+ default:
479
+ return val;
480
+ }
481
+ }
482
+ resize(pageSize, topGuiRowId) {
483
+ let guiEvent = getGuiEventObj('resize', 'table', 0);
484
+ guiEvent.PageSize = pageSize;
485
+ guiEvent.Line = topGuiRowId;
486
+ this.insertEvent(guiEvent);
487
+ }
488
+ onScrollDown() {
489
+ if (!this.Records.includesLast) {
490
+ let guiEvent = getGuiEventObj('getRows', '', 0);
491
+ guiEvent.Line = this.formGroups.length;
492
+ this.insertEvent(guiEvent);
493
+ }
494
+ }
495
+ setTitle(newTitle) {
496
+ this.mgTitleService.setTitle(newTitle);
497
+ }
498
+ getGuiRowId(dvRowId, isTableControl) {
499
+ return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
500
+ }
501
+ getDvRowId(guiRowId) {
502
+ return (guiRowId - this.Records.recordsBeforeCurrentView);
503
+ }
504
+ dispose() {
505
+ this.refreshDom.complete();
506
+ this.detectChanges.complete();
507
+ this.subscribeInteractiveCommands.unsubscribe();
508
+ this.subscribeRefreshDom.unsubscribe();
509
+ this.interactiveCommands.complete();
510
+ this.customPropertiesSubject.complete();
511
+ this.OnSelectedRowChanged.complete();
512
+ }
513
+ onComboboxSelectionChanged(event, idx, line) {
514
+ let guiEvent = getGuiEventObj('selectionchanged', idx, line);
515
+ if (typeof (event) == 'number') {
516
+ guiEvent.Value = event;
517
+ }
518
+ else {
519
+ if (!isNullOrUndefined(event.target)) {
520
+ let indexes = new Array(event.target.selectedOptions.length);
521
+ for (let i = 0; i < event.target.selectedOptions.length; i++) {
522
+ indexes[i] = event.target.selectedOptions[i].index;
523
+ }
524
+ guiEvent.Value = indexes.join(',');
525
+ }
526
+ else
527
+ guiEvent.Value = event.value;
528
+ }
529
+ this.insertEvent(guiEvent);
530
+ }
531
+ onListBoxSelectionChanged(event, idx) {
532
+ let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
533
+ let selectedOptions;
534
+ if (!isNullOrUndefined(event.target))
535
+ selectedOptions = event.target.selectedOptions;
536
+ else
537
+ selectedOptions = event.source.selectedOptions.selected;
538
+ let length = selectedOptions.length;
539
+ let indexes = new Array(length);
540
+ for (let i = 0; i < length; i++) {
541
+ if (!isNullOrUndefined(event.target))
542
+ indexes[i] = (selectedOptions[i]).index;
543
+ else
544
+ indexes[i] = (selectedOptions[i]).value;
545
+ }
546
+ guiEvent.Value = indexes;
547
+ this.insertEvent(guiEvent);
548
+ }
549
+ onCheckChanged(event, idx, rowId) {
550
+ if (typeof rowId === 'undefined')
551
+ rowId = 0;
552
+ let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
553
+ if (typeof (event) == 'boolean') {
554
+ guiEvent.Value = event;
555
+ }
556
+ else {
557
+ if (typeof event.target === 'undefined')
558
+ guiEvent.Value = (event).checked;
559
+ else
560
+ guiEvent.Value = (event.target).checked;
561
+ }
562
+ this.insertEvent(guiEvent);
563
+ }
564
+ mgOnTabSelectionChanged(idx, layer) {
565
+ let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
566
+ guiEvent.Value = layer.toString();
567
+ this.insertEvent(guiEvent);
568
+ }
569
+ mgOnRadioSelectionChanged(idx) {
570
+ let result = this.getFormControl('0', idx);
571
+ let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
572
+ if (typeof result.value !== 'number')
573
+ guiEvent.Value = result.value.index;
574
+ else
575
+ guiEvent.Value = result.value.toString();
576
+ this.insertEvent(guiEvent);
577
+ }
578
+ close() {
579
+ this.insertEvent(getGuiEventObj('close', null, 0));
580
+ }
581
+ IsStub() {
582
+ return this.magic.isStub;
583
+ }
584
+ saveData(data) {
585
+ this.magic.saveData(data);
586
+ }
587
+ createData() {
588
+ let myData = {
589
+ records: this.Records,
590
+ template: this.template
591
+ };
592
+ let text = 'loadData():any {\n' +
593
+ ' let stubData = ' + JSON.stringify(myData) + ';\n' +
594
+ ' this.loadStubData(stubData);}';
595
+ console.log(text);
596
+ this.saveData(text);
597
+ }
598
+ loadStubData(stubData) {
599
+ this.Records = stubData.records;
600
+ this.settemplate(stubData.template);
601
+ this.taskId = '1';
602
+ for (let i = 0; i < this.Records.list.length; i++)
603
+ this.buildTableRowControls(i);
604
+ }
605
+ loadData() {
606
+ alert('Please, overwrite method loadData');
607
+ }
608
+ setStubValue(guiRowId, fc, name) {
609
+ if (this.IsStub()) {
610
+ try {
611
+ let val = this.Records.list[guiRowId].values[name];
612
+ fc.setValue(val);
613
+ }
614
+ catch (e) {
615
+ }
616
+ }
617
+ }
618
+ }
619
+ TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(i0.ɵɵinject(i1.EngineMagicService), i0.ɵɵinject(i2.OverlayWindowService)); };
620
+ TaskMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
621
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskMagicService, [{
622
+ type: Injectable
623
+ }], function () { return [{ type: i1.EngineMagicService }, { type: i2.OverlayWindowService }]; }, null); })();
624
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFzay5tYWdpY3Muc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXIvc3JjL3NlcnZpY2VzL3Rhc2subWFnaWNzLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFlBQVksRUFBRSxVQUFVLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDdkQsT0FBTyxFQUFrQixXQUFXLEVBQUUsU0FBUyxFQUFnQyxNQUFNLGdCQUFnQixDQUFDO0FBQ3RHLE9BQU8sRUFBQyxNQUFNLEVBQUMsTUFBTSxnQkFBZ0IsQ0FBQztBQUN0QyxPQUFPLEVBQUMsT0FBTyxFQUFlLE1BQU0sTUFBTSxDQUFDO0FBRTNDLE9BQU8sRUFBQyxpQkFBaUIsRUFBRSxXQUFXLEVBQUMsTUFBTSxzQkFBc0IsQ0FBQztBQUNwRSxPQUFPLEVBQUMsZ0JBQWdCLEVBQUMsTUFBTSxvQkFBb0IsQ0FBQztBQUVwRCxPQUFPLEVBQUMsa0JBQWtCLEVBQUMsTUFBTSx3QkFBd0IsQ0FBQztBQUMxRCxPQUFPLEVBQWtCLE9BQU8sRUFBQyxNQUFNLDRCQUE0QixDQUFDO0FBQ3BFLE9BQU8sRUFBQyxXQUFXLEVBQStCLFlBQVksRUFBa0IsY0FBYyxFQUFDLE1BQU0sZ0JBQWdCLENBQUM7QUFFdEgsT0FBTyxFQUFDLE9BQU8sRUFB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gfSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGJyZWFrO1xyXG5cclxuICAgICAgY2FzZSBDb21tYW5kVHlwZS5QUk9QX1NFVF9DVVNUT01fVkFMSURBVE9SOiB7XHJcbiAgICAgICAgICBwcm9wZXJ0aWVzID0gdGhpcy5SZWNvcmRzLmxpc3RbZ3VpUm93SWRdLmdldENvbnRyb2xNZXRhZGF0YShjb250cm9sSWQpO1xyXG5cclxuICAgICAgICAgIGxldCBjb250cm9sID0gdGhpcy5nZXRGb3JtQ29udHJvbChndWlSb3dJZC50b1N0cmluZygpLCBjb250cm9sSWQpO1xyXG4gICAgICAgICAgaWYgKGNvbnRyb2wgIT0gbnVsbCkge1xyXG4gICAgICAgICAgICBwcm9wZXJ0aWVzLmN1c3RvbVZhbGlkYXRvcnMuc2V0KGNvbW1hbmQuT3BlcmF0aW9uLCBjb21tYW5kLm9iajEpO1xyXG4gICAgICAgICAgICBpZiAoY29udHJvbC52YWxpZGF0b3IgIT0gbnVsbClcclxuICAgICAgICAgICAgICBjb250cm9sLnNldFZhbGlkYXRvcnMoW2NvbnRyb2wudmFsaWRhdG9yLCB0aGlzLmN1c3RvbVZhbGlkYXRvcihndWlSb3dJZC50b1N0cmluZygpLCBjb250cm9sSWQpXSk7XHJcbiAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICBjb250cm9sLnNldFZhbGlkYXRvcnModGhpcy5jdXN0b21WYWxpZGF0b3IoZ3VpUm93SWQudG9TdHJpbmcoKSwgY29udHJvbElkKSk7XHJcblxyXG4gICAgICAgICAgICAgY29udHJvbC51cGRhdGVWYWx1ZUFuZFZhbGlkaXR5KCk7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGJyZWFrO1xyXG5cclxuICAgICAgY2FzZSBDb21tYW5kVHlwZS5TRVRfQ0xBU1M6XHJcbiAgICAgICAgcHJvcGVydGllcyA9IHRoaXMuUmVjb3Jkcy5saXN0W2d1aVJvd0lkXS5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0VmFsVG9OYXRpdmUoY29udHJvbElkOiBzdHJpbmcsIHJvd0lkOiBudW1iZXIsIHZhbDogYW55KTogYW55IHtcclxuXHJcbiAgICBsZXQgcHJvcGVydGllczogQ29udHJvbE1ldGFkYXRhO1xyXG4gICAgcHJvcGVydGllcyA9IHRoaXMuUmVjb3Jkcy5saXN0WzBdLmdldENvbnRyb2xNZXRhZGF0YShjb250cm9sSWQpO1xyXG5cclxuICAgIHN3aXRjaCAocHJvcGVydGllcy5kYXRhVHlwZSkge1xyXG5cclxuICAgICAgY2FzZSBTdG9yYWdlQXR0cmlidXRlLkJPT0xFQU46IHtcclxuICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgIGxldCByYW5nZXM6IHN0cmluZyA9IHRoaXMuR2V0RmxkUmFuZ2VzKGNvbnRyb2xJZCk7XHJcbiAgICAgICAgICBsZXQgZm91bmQ6IG51bWJlciA9IHJhbmdlcy5pbmRleE9mKCcsJyk7XHJcbiAgICAgICAgICBsZXQgdHJ1ZU9wdGlvbjogc3RyaW5nID0gcmFuZ2VzLnN1YnN0cigwLCBmb3VuZCk7XHJcbiAgICAgICAgICBsZXQgZmFsc2VPcHRpb246IHN0cmluZyA9IHJhbmdlcy5zdWJzdHIoZm91bmQgKyAxKTtcclxuICAgICAgICAgIGlmIChOU3RyaW5nLkVxdWFscyh2YWwsIHRydWVPcHRpb24sIHRydWUpKVxyXG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgIGVsc2UgaWYgKE5TdHJpbmcuRXF1YWxzKHZhbCwgZmFsc2VPcHRpb24sIHRydWUpKVxyXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICBlbHNlXHJcbiAgICAgICAgICAgIHJldHVybiB2YWw7XHJcbiAgICAgICAgfSBlbHNlXHJcbiAgICAgICAgICByZXR1cm4gdmFsO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBjYXNlIFN0b3JhZ2VBdHRyaWJ1dGUuVElNRToge1xyXG4gICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAnc3RyaW5nJyl7XHJcbiAgICAgICAgbGV0IGlkeCA9IHZhbC5pbmRleE9mKCc6JywwKTtcclxuICAgICAgICBsZXQgaG91cnM6IG51bWJlciA9ICt2YWwuc3Vic3RyKDAsIGlkeCk7XHJcbiAgICAgICAgbGV0IG1pbnV0ZXM6IG51bWJlciA9ICt2YWwuc3Vic3RyKGlkeCsxLCAyKTtcclxuICAgICAgICBsZXQgc2Vjb25kcyA9IDA7XHJcbiAgICAgICAgaWYgKHZhbC5sZW5ndGggPiA1KSB7XHJcbiAgICAgICAgICBpZHggPSB2YWwuaW5kZXhPZignOicsIGlkeCArIDEpO1xyXG4gICAgICAgICAgaWYgKGlkeCA+PSAwKVxyXG4gICAgICAgICAgICBzZWNvbmRzID0gK3ZhbC5zdWJzdHIoaWR4ICsgMSwgMik7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmICh2YWwuaW5kZXhPZignUE0nKT4wKVxyXG4gICAgICAgICAgaG91cnMgKz0gMTI7XHJcbiAgICAgICAgbGV0IGR0OiBEYXRlID0gbmV3IERhdGUoKTtcclxuICAgICAgICBkdC5zZXRIb3Vycyhob3Vycyk7XHJcbiAgICAgICAgZHQuc2V0TWludXRlcyhtaW51dGVzKTtcclxuICAgICAgICBkdC5zZXRTZWNvbmRzKHNlY29uZHMpO1xyXG5cclxuXHJcbiAgICAgICAgcmV0dXJuIGR0O1xyXG4gICAgICAgIH0gZWxzZVxyXG4gICAgICAgICAgcmV0dXJuIHZhbDtcclxuICAgICAgfVxyXG5cclxuICAgICAgY2FzZSBTdG9yYWdlQXR0cmlidXRlLk5VTUVSSUM6XHJcbiAgICAgICAgICBpZiAoaXNVbmRlZmluZWQodmFsKSlcclxuICAgICAgICAgICAgICByZXR1cm4gdmFsO1xyXG4gICAgICAgICAgZWxzZSByZXR1cm4gKHZhbCAhPSBudWxsKSA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TtcclxuICAgICAgICAgIHN0ci5BcHBlbmQoJzonKTtcclxuICAgICAgICAgIGZvcm1hdCA9IHZhbC5nZXRNaW51dGVzKCkgPiA5ID8gJ3swfScgOiAnMHswfSc7XHJcbiAgICAgICAgICBzdHIuQXBwZW5kRm9ybWF0KGZvcm1hdCwgdmFsLmdldE1pbnV0ZXMoKS50b1N0cmluZygpKTtcclxuICAgICAgICAgIGlmICggdmFsLmdldFNlY29uZHMoKSA+IDApIHtcclxuICAgICAgICAgICAgc3RyLkFwcGVuZCgnOicpO1xyXG4gICAgICAgICAgICBmb3JtYXQgPSB2YWwuZ2V0U2Vjb25kcygpID4gOSA/ICd7MH0nIDogJzB7MH0nO1xyXG4gICAgICAgICAgICBzdHIuQXBwZW5kRm9ybWF0KGZvcm1hdCwgdmFsLmdldFNlY29uZHMoKS50b1N0cmluZygpKTtcclxuICAgICAgICAgIH1cclxuICAgICAgICAgIHJldHVybiBzdHIuVG9TdHJpbmcoKTtcclxuICAgICAgICB9IGVsc2VcclxuICAgICAgICAgIHJldHVybiB2YWw7XHJcbiAgICAgIH1cclxuICAgICAgY2FzZSBTdG9yYWdlQXR0cmlidXRlLkJPT0xFQU46IHtcclxuICAgICAgICBsZXQgcHJvcGVydGllczogQ29udHJvbE1ldGFkYXRhO1xyXG4gICAgICAgIHByb3BlcnRpZXMgPSB0aGlzLlJlY29yZHMubGlzdFsnMCddLmdldENvbnRyb2xNZXRhZGF0YShjb250cm9sSWQpO1xyXG4gICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAnYm9vbGVhbicgJiYgcHJvcGVydGllcy5yYW5nZVZhbGlkYXRvcikge1xyXG4gICAgICAgICAgbGV0IHJhbmdlczogc3RyaW5nID0gdGhpcy5HZXRGbGRSYW5nZXMoY29udHJvbElkKTtcclxuICAgICAgICAgIGxldCBmb3VuZDogbnVtYmVyID0gcmFuZ2VzLmluZGV4T2YoJywnKTtcclxuICAgICAgICAgIGxldCB0cnVlT3B0aW9uOiBzdHJpbmc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