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